Posted May 11, 201213 yr In the renderPlayer.class i tend to rewrite the RenderName method to make my mod ComeCloser work. Since forge changes that class i tend to have to rewrite my mod every update to be safe. It would be nice if there were some hooks to mess around with the rendering of player names. For example changing the size of the name tag, The name being displayed, the colors of the name, or for my mod the range at which it renders for other players. i would be grateful if they were added to forge. Especially since i plan to edit the player's name to show his Team in another mod i'm working on. I think a few other mods would take advantage of this if the hooks existed. http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
May 11, 201213 yr Write it up and submit a pull request I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
May 12, 201213 yr Author Write it up and submit a pull request How and where do i do that at? http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
May 13, 201213 yr Write it up and submit a pull request How and where do i do that at? Is is standard in the open source programming community, on Minecraft Forge's GitHub page.
May 16, 201213 yr Author ty i found the where but i'm confused on how. Do i edit the code with the changes i want or is there some button i press to make the request. I've never used GitHub or open source stuff. Also i'm not even sure how to make a hook for something. http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
May 17, 201213 yr Github itself actually has detailed instructions about how to do the entire pull process. A quick google search for github pull requests might be revealing.
May 17, 201213 yr Author ty after i posted and finish work on one of my mods i finally got to google how. I'm a little stuck on how to start going about creating a hook. I'm going to do a little research later on it but you think you can start me in the right direction. Maybe with an example or guide of how forge does hooks. http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
May 18, 201213 yr The ForgeHooks.java file is the primary link for them all, mostly copy how it works.
May 18, 201213 yr Author The ForgeHooks.java file is the primary link for them all, mostly copy how it works. ty, your doing a good job at not hand holding. I'll just try something and post back here if i need code help. http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
May 18, 201213 yr The ForgeHooks.java file is the primary link for them all, mostly copy how it works. ty, your doing a good job at not hand holding. I'll just try something and post back here if i need code help. Mostly due to being busy. Besides, the ForgeHooks.java file is fascinating. It is the central communication point for so many of the Forge hooks, good at giving ideas.
May 18, 201213 yr Author Mostly due to being busy. i know being busy too well Besides, the ForgeHooks.java file is fascinating. It is the central communication point for so many of the Forge hooks, good at giving ideas. I would find them fascinating if i understood java better. Still working out in my head how it goes together. http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
May 18, 201213 yr Author Ok i got somethings, don't know what it is but its something . I took how forge did custom item rendering and tried to make my code a custom player name render. It will do a check too see if the mod wants to use the normal name render. If it doesn't it calls to the mod's playerName render. At least that how it should work. Here my code if anyone want to comment on it. I'm still trying to understand how to make hooks, and how to use them. At the bottom of the ForgeHooksClient.class public static boolean ShouldRenderNameOther() { for (IPlayerName handler : playerNameHandlers) { if (handler.shouldRenderNameOther()) { return true; } } return false; } static LinkedList<IPlayerName> playerNameHandlers = new LinkedList<IPlayerName>(); public static void renderPlayerName(IPlayerName customRenderer, EntityPlayer par1EntityPlayer, double par2, double par4, double par6) { if(customRenderer != null) { customRenderer.renderNewName(par1EntityPlayer,par2, par4, par6); } } at the bottom of the MinecraftForgeCleint.class private static IPlayerName customPlayerNameRender; public static void registerPlayerNameRenderer(IPlayerName renderer) { customPlayerNameRender = renderer; } public static IPlayerName getPlayerNameRender() { return customPlayerNameRender; } My handler class package net.minecraft.src.forge; import net.minecraft.src.*; public interface IPlayerName { /** Called when RenderPlayer goes to render player name. * @return true if player's name should be rendered another way */ public boolean shouldRenderNameOther(); public void renderNewName(EntityPlayer par1EntityPlayer, double par2, double par4, double par6); } changed made to renderPlayer.class if(ForgeHooksClient.ShouldRenderNameOther()) { //normal renderName Stuff } else { IPlayerName customRenderer = MinecraftForgeClient.getPlayerNameRender(); ForgeHooksClient.renderPlayerName(customRenderer, par1EntityPlayer,par2,par4, par6); } http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
May 18, 201213 yr Lex generally likes code submissions following the Open Source Standard ways, hence http://help.github.com/send-pull-requests/.
May 19, 201213 yr Author i was posting the code for people to make suggestions before i finished and make a pull request. Also too see if i missed anything in make this work right. http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
May 19, 201213 yr i was posting the code for people to make suggestions before i finished and make a pull request. Also too see if i missed anything in make this work right. A pull request submission allow people to make comments on it, comments on individual lines of code, lets people see how it fits into the whole, and lets people submit fixes to the pull request.
May 19, 201213 yr Author ;/ ok, but i still want to finish my testing of it. Need to make sure it fits the original need for one of my mods. http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
May 22, 201213 yr I think that this would work only with one mod using this, lets say that I'd like to use this too there are two things that would happen a) it would override my code b) it would override your code
May 25, 201213 yr Author I think that this would work only with one mod using this, lets say that I'd like to use this too there are two things that would happen a) it would override my code b) it would override your code Ya i noticed that but not sure how too change it much. I think no matter what i change this would always be the case since a player can only have one name tag.do you have any suggestions on how to get it working without conflict? http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
May 27, 201213 yr In what conditions do you want to change this? Like if I'm in water set font size to 100 and when I get out set it back to normal or you set it once and it should stay like that.
May 30, 201213 yr Author In what conditions do you want to change this? Like if I'm in water set font size to 100 and when I get out set it back to normal or you set it once and it should stay like that. original i was looking for a way to remove conflict with the fact my mod ComeCloser would conflict with anything that effected player render. The mod does the simplest thing and change the range at which name tags render for the player. So say you 10 blocks from me your name would show above your head in game for me. My mod changes this so at 10 blocks i can't see your name tag but at 8 i can. I was also looking to hook into this for other conditions say your in water the range is even less. Or if i use a smoke grenade it reduces to almost zero. Also for another mod i'm working on i want to add a team name before or under the player's name without conflicting with my other mod or another mod. http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
June 6, 201213 yr Author Maybe PlayerAPI has something that could help? ;/ trying to avoid using more APIs. Want to keep things simple so when players install my mods they only install forge and modloader. Since more likely they have already installed those for other mods. http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
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.