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

    • Does it work without natures_spirit and/or spectrum / adventurez?
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system
    • (i originally submitted this report to CurseForge but since we localized the issue to the modloader they pointed us here)  I am the partner of the user, GalaxyReach, assisting them as they are not as tech savvy. We have spent days troubleshooting a very weird issue that none of our other friends have with a certain modloader.  On a curse-forge launched instance of the Minecraft Launcher, clicking "play" throws an error code 1: crash log says EXCEPTION_ACCESS_VIOLATION. This exception happens in a blank, no-mods test pack as well as manually installing Forge. This issue also happens on NeoForge. We tried All of the steps withing this guide: https://support.curseforge.com/en/support/solutions/articles/9000218027-issues-related-to-the-forge-modloader namely: reinstalling the modpack reinstalling minecraft & curseforge deleting curseforge appdata updating the drivers updating the firewall the computer has been restarted several times we have tried running it on different networks manually installing & selecting java manually installing forge I don't think it is a specs/hardware issue, its a pretty good laptop (HP Omen), 16GB RAM & a 3060. It runs windows 11. Further, launching minecraft like normal through the Microsoft Store runs the game just fine. It is solely with trying to use a modded launch with Forge & NeoForge. I also tried different versions of Forge, though the specific instance I am trying to get running is 47.3.0 Is there anything else we can do here or does Forge just truly not work on this laptop?   Thank you MINECRAFT LAUNCHER GAME OUTPUT LOG 10:07:33.755 launcher main Version does not support log configuration, will assume one plaintext entry per line 10:07:36.419 game 2024-08-31 10:07:36,408 main WARN Advanced terminal features are not available in this environment 10:07:36.586 game [10:07:36] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, GalaxyReach, --version, forge-47.3.0, --gameDir, C:\Users\Micha\curseforge\minecraft\Instances\Liminal Server, --assetsDir, C:\Users\Micha\curseforge\minecraft\Install\assets, --assetIndex, 5, --uuid, 7f099235327e4206afdfbc22c7712328, --accessToken, ????????, --clientId, OWEyZTE3Y2MtOTZiOC00MWMwLWFkZjYtNmY2MDU2NmIxNDAz, --xuid, 2535442900827884, --userType, msa, --versionType, release, --width, 854, --height, 480, --quickPlayPath, C:\Users\Micha\curseforge\minecraft\Install\quickPlay\java\1725124053749.json, --launchTarget, forgeclient, --fml.forgeVersion, 47.3.0, --fml.mcVersion, 1.20.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20230612.114412] 10:07:36.593 game [10:07:36] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 10.0.9+10.0.9+main.dcd20f30 starting: java version 17.0.11 by Oracle Corporation; OS Windows 11 arch amd64 version 10.0 10:07:37.363 game [10:07:37] [main/INFO] [ne.mi.fm.lo.ImmediateWindowHandler/]: Loading ImmediateWindowProvider fmlearlywindow 10:07:37.452 game [10:07:37] [main/INFO] [EARLYDISPLAY/]: Trying GL version 4.6 10:07:37.503 game # 10:07:37.503 game # A fatal error has been detected by the Java Runtime Environment: 10:07:37.503 game # 10:07:37.503 game # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff8a76f59f0, pid=13980, tid=12732 10:07:37.503 game # 10:07:37.503 game # JRE version: Java(TM) SE Runtime Environment (17.0.11+7) (build 17.0.11+7-LTS-207) 10:07:37.503 game # Java VM: Java HotSpot(TM) 64-Bit Server VM (17.0.11+7-LTS-207, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64) 10:07:37.503 game # Problematic frame: 10:07:37.506 game # C [atio6axx.dll+0x1759f0] 10:07:37.507 game # 10:07:37.507 game # No core dump will be written. Minidumps are not enabled by default on client versions of Windows 10:07:37.507 game #   Debug txt:  [31Aug2024 10:07:36.584] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, GalaxyReach, --version, forge-47.3.0, --gameDir, C:\Users\Micha\curseforge\minecraft\Instances\Liminal Server, --assetsDir, C:\Users\Micha\curseforge\minecraft\Install\assets, --assetIndex, 5, --uuid, 7f099235327e4206afdfbc22c7712328, --accessToken, ????????, --clientId, OWEyZTE3Y2MtOTZiOC00MWMwLWFkZjYtNmY2MDU2NmIxNDAz, --xuid, 2535442900827884, --userType, msa, --versionType, release, --width, 854, --height, 480, --quickPlayPath, C:\Users\Micha\curseforge\minecraft\Install\quickPlay\java\1725124053749.json, --launchTarget, forgeclient, --fml.forgeVersion, 47.3.0, --fml.mcVersion, 1.20.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20230612.114412] [31Aug2024 10:07:36.592] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.9+10.0.9+main.dcd20f30 starting: java version 17.0.11 by Oracle Corporation; OS Windows 11 arch amd64 version 10.0 [31Aug2024 10:07:36.640] [main/DEBUG] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Found launch services [fmlclientdev,forgeclient,minecraft,forgegametestserverdev,fmlserveruserdev,fmlclient,fmldatauserdev,forgeserverdev,forgeserveruserdev,forgeclientdev,forgeclientuserdev,forgeserver,forgedatadev,fmlserver,fmlclientuserdev,fmlserverdev,forgedatauserdev,testharness,forgegametestserveruserdev] [31Aug2024 10:07:36.648] [main/DEBUG] [cpw.mods.modlauncher.NameMappingServiceHandler/MODLAUNCHER]: Found naming services : [srgtomcp] [31Aug2024 10:07:36.664] [main/DEBUG] [cpw.mods.modlauncher.LaunchPluginHandler/MODLAUNCHER]: Found launch plugins: [mixin,eventbus,slf4jfixer,object_holder_definalize,runtime_enum_extender,capability_token_subclass,accesstransformer,runtimedistcleaner] [31Aug2024 10:07:36.672] [main/DEBUG] [cpw.mods.modlauncher.TransformationServicesHandler/MODLAUNCHER]: Discovering transformation services [31Aug2024 10:07:36.680] [main/DEBUG] [net.minecraftforge.fml.loading.FMLPaths/CORE]: Path GAMEDIR is C:\Users\Micha\curseforge\minecraft\Instances\Liminal Server [31Aug2024 10:07:36.680] [main/DEBUG] [net.minecraftforge.fml.loading.FMLPaths/CORE]: Path MODSDIR is C:\Users\Micha\curseforge\minecraft\Instances\Liminal Server\mods [31Aug2024 10:07:36.680] [main/DEBUG] [net.minecraftforge.fml.loading.FMLPaths/CORE]: Path CONFIGDIR is C:\Users\Micha\curseforge\minecraft\Instances\Liminal Server\config [31Aug2024 10:07:36.680] [main/DEBUG] [net.minecraftforge.fml.loading.FMLPaths/CORE]: Path FMLCONFIG is C:\Users\Micha\curseforge\minecraft\Instances\Liminal Server\config\fml.toml [31Aug2024 10:07:37.354] [main/DEBUG] [cpw.mods.modlauncher.TransformationServicesHandler/MODLAUNCHER]: Found additional transformation services from discovery services: [31Aug2024 10:07:37.362] [main/INFO] [net.minecraftforge.fml.loading.ImmediateWindowHandler/]: Loading ImmediateWindowProvider fmlearlywindow [31Aug2024 10:07:37.450] [main/INFO] [EARLYDISPLAY/]: Trying GL version 4.6  
  • Topics

×
×
  • Create New...

Important Information

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