Jump to content

Helmet Overlays


ashtonr12

Recommended Posts

If you want to see how it's implemented, take a look there:

net.minecraft.client.gui.GuiIngame.java, line 85

 

It's hard coded and there's no rendering handles around for you to use. The only option I see is to make your own TickHandler, which should receive the RENDER TickType. Put your rendering methods in the tickEnd(...) method and monitor the client if he's wearing your helmet.

 

Edit: I forgot that it will overlay the current HUD elements. That might be bit of a problem indeed ... Ah well.

Link to comment
Share on other sites

Well there's no other option. You either render it with in your TickHandler class ( but your helmet overlay will be rendered over existing HUD elements, like experience bar, hearts and stuff ) or you modify the stock Minecraft GUI classes which handle this. If you're going to modify the method rendering the HUD, just add another condition and copy the method that renders the pumpkin overlay changing the name of the texture. I don't think the TickHandler will be of use in this case, because just like I've said it would cover all of your existing HUD elements.

Link to comment
Share on other sites

It's not really that complicated. The reason why I didn't explain a thing on how to implement a TickHandler is because I didn't know if you want to use them :) It's just a copy-paste job, I'm sure you'd handle that ;) I'm sorry to hear you're eventually dumping the idea though.

 

Cheers!

Link to comment
Share on other sites

ok so i am slightly confused, probably because i am so tired. Thanks for all your help so far.

Is is possible without editing the base minecraft files to add a custom overlay to my self created helmet?

if yes how? example code or suggestions?

if no thanks for your help so far :)

 

Use examples, i have aspergers.

Examples make sense to me.

Link to comment
Share on other sites

Alrighty then ... with this code you will get the following result ( in my case when wearing a golden helmet - just change it ):

 

spzcK3Hl.png

 

Bear in mind though, that it will cover all of the existing HUD elements ( just as in the image ). Also the helmet overlay is not drawn when a menu is opened, because that would cover the entire menu :) Here's the code for the renderer:

 

http://paste.minecraftforge.net/view/6cff4e04

 

Also, add the following line in your mod init method:

 

TickRegistry.registerTickHandler(new RenderHUD(), Side.CLIENT);

 

That should do the trick. Let me know if that's what were you looking for :)

Link to comment
Share on other sites

WOW!

you must be very advanced at this if you came up with that!

is it possible to change the overlay? to say a see through circle in the middle and  black area around the outside?

i also notice that the item bar is behind the overlay? and when you put on a pumkin head the item bar is infront of the overlay?

dont misunderstand me i am immensly gratefull :D i was just wondering if it is possible to change the black squidy areas?

Use examples, i have aspergers.

Examples make sense to me.

Link to comment
Share on other sites

It's just a matter of a custom texture file. Make your new overlay with transparency ( in GIMP for instance, but could be pretty much anything ), save it in PNG format and paste it into jars/bin/minecraft.jar/... Then in my paste change this part:

 

%blur%/misc/pumpkinblur.png

 

... into:

 

%blur%/<your path to the new texture inside the minecraft.jar>

 

i also notice that the item bar is behind the overlay? and when you put on a pumkin head the item bar is infront of the overlay?

 

That's what I was rambling all about all this time :D This method has one big disadvantage: you will have all of these HUD elements like: experience bar, handy inventory at the bottom of the screen, health and hunger levels covered by the overlay texture. There's no way around it unfortunately. Unless you modify the Minecraft. Or a miracle happens and the Forge team puts some render handlers in there to have some control over layering the overlays but I don't think it's gonna happen any time soon :)

 

Cheers

Link to comment
Share on other sites

But I've told you that already:

 

It's just a matter of a custom texture file. Make your new overlay with transparency ( in GIMP for instance, but could be pretty much anything ), save it in PNG format and paste it into jars/bin/minecraft.jar/... Then in my paste change this part:

 

%blur%/misc/pumpkinblur.png

 

... into:

 

%blur%/<your path to the new texture inside the minecraft.jar>

 

You need to put your texture file inside of the minecraft.jar file. Open it up with any archiver like WinZIP, 7-Zip and paste your texture in there.

Link to comment
Share on other sites

I am using a custom helmet

 

package ashtonsmod.common;

import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.IArmorTextureProvider;

public class MinersHelmet extends ItemArmor implements IArmorTextureProvider{

        public MinersHelmet(int par1,EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) {
                super(par1, par2EnumArmorMaterial, par3, par4);
        }

	@Override
    	public String getTextureFile(){
    		return CommonProxy.items_png;
         }

        public String getArmorTextureFile(ItemStack par1){
                if ( par1.itemID==ashtonsmod.ObsidianHelmet.shiftedIndex){
                        return "/armor/AbsorbingArmor_1.png";
                }return "/armor/AbsorbingArmor_2.png";
        }
}

 

however it worked before i used the overlays? i have provided code anyway in case i have made some stupid error.

 

Overlay code

package ashtonsmod.common;

import java.util.EnumSet;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;

public class MiningHelmetOverlay implements ITickHandler
{
        @Override
        public void tickStart(EnumSet<TickType> type, Object... tickData)
        {
               
        }

        @Override
        public void tickEnd(EnumSet<TickType> type, Object... tickData)
        {
                if(Minecraft.getMinecraft().thePlayer == null || Minecraft.getMinecraft().currentScreen != null)
                        return;
               
                ItemStack helmet = Minecraft.getMinecraft().thePlayer.inventory.armorItemInSlot(3);
                if(Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && helmet != null && helmet.itemID == ashtonsmod.MinersHelmet.shiftedIndex)
                {
                        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
                       
                        Tessellator t = Tessellator.instance;
                       
                        ScaledResolution scale = new ScaledResolution(Minecraft.getMinecraft().gameSettings, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
                        int width = scale.getScaledWidth();
                        int height = scale.getScaledHeight();
                       
                        GL11.glDisable(GL11.GL_DEPTH_TEST);
                        GL11.glDepthMask(false);
                        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                        GL11.glDisable(GL11.GL_ALPHA_TEST);
                        GL11.glBindTexture(GL11.GL_TEXTURE_2D, Minecraft.getMinecraft().renderEngine.getTexture("%blur%/armor/MiningHelmetblur.png"));
                       
                        t.startDrawingQuads();
                        t.addVertexWithUV(0.0D, (double)height, 90.0D, 0.0D, 1.0D);
                        t.addVertexWithUV((double)width, (double)height, 90.0D, 1.0D, 1.0D);
                        t.addVertexWithUV((double)width, 0.0D, 90.0D, 1.0D, 0.0D);
                        t.addVertexWithUV(0.0D, 0.0D, 90.0D, 0.0D, 0.0D);
                        t.draw();
                       
                        GL11.glPopAttrib();
                }
        }

        @Override
        public EnumSet<TickType> ticks()
        {
                return EnumSet.of(TickType.RENDER);
        }

        @Override
        public String getLabel()
        {
                return "render hud tick handler";
        }

}

 

Use examples, i have aspergers.

Examples make sense to me.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • When i try to launch Minecraft Java 1.20.1 forge with mods (82 mods),on start it loaded all mods,but at end Java just crashed.  p.s i allocated 8GB ram for minecraft and i didn't runned another instance.Log file pp.s I use ATlauncher   Environment: Organising filesystem [24/04/2024 23:40:08 PM] ATLauncher Version: 3.4.36.3 [11ae0b2334c236e93ee8128de980952b2a1b8900] [24/04/2024 23:40:08 PM] App Arguments: ["--install-method=aur","--no-launcher-update"] [24/04/2024 23:40:08 PM] JVM Arguments: ["-Dawt.useSystemAAFontSettings=on","-Dswing.aatext=true"] [24/04/2024 23:40:08 PM] Java Version: Java 22 (22) [24/04/2024 23:40:08 PM] Java Path: /usr/lib/jvm/java-22-openjdk [24/04/2024 23:40:08 PM] 64 Bit Java: true [24/04/2024 23:40:08 PM] RAM Available: 14931MB [24/04/2024 23:40:08 PM] Launcher Directory: **USERSDIR** [24/04/2024 23:40:08 PM] GPU: IvyBridge GT2 [HD Graphics 4000] (Intel Corporation (0x8086)) unknown 256MB VRAM [24/04/2024 23:40:08 PM] CPU: Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz 4 cores/8 threads [24/04/2024 23:40:08 PM] Operating System: EndeavourOS (unknown (unknown) build 6.8.7-arch1-1) [24/04/2024 23:40:08 PM] Bitness: 64 [24/04/2024 23:40:08 PM] Uptime: 15889 [24/04/2024 23:40:08 PM] Manufacturer: GNU/Linux
    • If you have nvidia graphics, don't touch your amd drivers, otherwise it might fix it but keep running on integrated graphics, which will result in terrible performance. For nvidia graphics, you need to tell windows and nvidia control panel that anything Minecraft related (the launcher, java, etc...) should prefer high performance graphics so that it actually uses your nvidia gpu
    • In the ever-evolving landscape of technology, the rise of cryptocurrencies and digital assets has introduced both unparalleled opportunities and unprecedented challenges. As these digital currencies become increasingly prevalent, so too does the risk of theft and loss. Yet, amidst the complexity and uncertainty, there exists a beacon of hope: ADRIAN LAMO HACKER. Technology has indeed become more sophisticated and enhanced, presenting new challenges in the realm of asset recovery. However, just as any other currency can be stolen or lost, crypto and digital assets are not beyond redemption. With the right expertise and guidance, recovery is possible and achievable. Contact ADRIAN LAMO HACKER via the website: https://adrianlamohackpro.online/ , a trusted, honest, and certified agency specializing in the retrieval of stolen or lost digital assets. In my own experience, I found myself in dire straits after falling victim to cybercriminals who absconded with a significant portion of my crypto holdings. It was a daunting situation, but I refused to succumb to despair. Upon engaging ADRIAN LAMO HACKER, their professionalism, and integrity immediately struck me, as an unwavering commitment to their clients. They deeply understand blockchain technology and utilize advanced methodologies to trace and recover lost or stolen funds. Their approach is meticulous, their expertise unparalleled, and their results speak for themselves. In a matter of days, ADRIAN LAMO HACKER successfully traced and recovered over 90% of my stolen funds, a feat I once believed to be unattainable. Their fees were fair and transparent, and communication throughout the process was nothing short of excellent. They kept me informed every step of the way, providing reassurance and guidance when I needed it most. For anyone who has fallen victim to crypto theft or loss, I wholeheartedly recommend ADRIAN LAMO HACKER. They are not just experts in their field; they are guardians of justice in the digital realm. With their assistance, you can reclaim what's rightfully yours and emerge stronger than ever before. So, if you find yourself grappling with the devastation of lost or stolen digital assets, don't despair. Reach out to ADRIAN LAMO HACKER via website: https://adrianlamohackpro.online/  / Telegram: @ADRIANLAMOHACKERTECH and let them guide you toward a brighter tomorrow.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.