Jump to content

hooks for renderName


DarkGuardsman

Recommended Posts

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.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

 

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.

Link to comment
Share on other sites

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);
        	}

 

Link to comment
Share on other sites

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.  :)

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

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

    • Slot deposit 3000 adalah situs slot deposit 3000 via dana yang super gacor dimana para pemain dijamin garansi wd hari ini juga hanya dengan modal receh berupa deposit sebesar 3000 baik via dana, ovo, gopay maupun linkaja untuk para pemain pengguna e-wallet di seluruh Indonesia.   DAFTAR & LOGIN AKUN PRO SLOT DEPOSIT 3000 ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
    • OLXTOTO: Menikmati Sensasi Bermain Togel dan Slot dengan Aman dan Mengasyikkan Dunia perjudian daring terus berkembang dengan cepat, dan salah satu situs yang telah menonjol dalam pasar adalah OLXTOTO. Sebagai platform resmi untuk permainan togel dan slot, OLXTOTO telah memenangkan kepercayaan banyak pemain dengan menyediakan pengalaman bermain yang aman, adil, dan mengasyikkan. DAFTAR OLXTOTO DISINI <a href="https://imgbb.com/"><img src="https://i.ibb.co/GnjSVpx/daftar1-480x480.webp" alt="daftar1-480x480" border="0" /></a> Keamanan Sebagai Prioritas Utama Salah satu aspek utama yang membuat OLXTOTO begitu menonjol adalah komitmennya terhadap keamanan pemain. Dengan menggunakan teknologi enkripsi terkini, situs ini memastikan bahwa semua informasi pribadi dan keuangan para pemain tetap aman dan terlindungi dari akses yang tidak sah. Beragam Permainan yang Menarik Di OLXTOTO, pemain dapat menemukan beragam permainan yang menarik untuk dinikmati. Mulai dari permainan klasik seperti togel hingga slot modern dengan fitur-fitur inovatif, ada sesuatu untuk setiap selera dan preferensi. Grafik yang memukau dan efek suara yang mengagumkan menambah keseruan setiap putaran. Peluang Menang yang Tinggi Salah satu hal yang paling menarik bagi para pemain adalah peluang menang yang tinggi yang ditawarkan oleh OLXTOTO. Dengan pembayaran yang adil dan peluang yang setara bagi semua pemain, setiap taruhan memberikan kesempatan nyata untuk memenangkan hadiah besar. Layanan Pelanggan yang Responsif Tim layanan pelanggan OLXTOTO siap membantu para pemain dengan setiap pertanyaan atau masalah yang mereka hadapi. Dengan layanan yang ramah dan responsif, pemain dapat yakin bahwa mereka akan mendapatkan bantuan yang mereka butuhkan dengan cepat dan efisien. Kesimpulan OLXTOTO telah membuktikan dirinya sebagai salah satu situs terbaik untuk penggemar togel dan slot online. Dengan fokus pada keamanan, beragam permainan yang menarik, peluang menang yang tinggi, dan layanan pelanggan yang luar biasa, tidak mengherankan bahwa situs ini telah menjadi pilihan utama bagi banyak pemain. Jadi, jika Anda mencari pengalaman bermain yang aman, adil, dan mengasyikkan, jangan ragu untuk bergabung dengan OLXTOTO hari ini dan rasakan sensasi kemenangan!
    • Slot deposit dana adalah situs slot deposit dana yang juga menerima dari e-wallet lain seperti deposit via dana, ovo, gopay & linkaja terlengkap saat ini, sehingga para pemain yang tidak memiliki rekening bank lokal bisa tetap bermain slot dan terbantu dengan adanya fitur tersebut.   DAFTAR & LOGIN AKUN PRO SLOT DEPOSIT DANA ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
    • Slot deposit dana adalah situs slot deposit dana minimal 5000 yang dijamin garansi super gacor dan gampang menang, dimana para pemain yang tidak memiliki rekening bank lokal tetap dalam bermain slot dengan melakukan deposit dana serta e-wallet lainnya seperti ovo, gopay maupun linkaja lengkap. Agar para pecinta slot di seluruh Indonesia tetap dapat menikmati permainan tanpa halangan apapun khususnya metode deposit, dimana ketersediaan cara deposit saat ini yang lebih beragam tentunya sangat membantu para pecinta slot.   DAFTAR & LOGIN AKUN PRO SLOT DEPOSIT DANA ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
    • Slot deposit pulsa adalah situs slot deposit pulsa tanpa potongan apapun yang dijamin garansi terpercaya, dimana kamu bisa bermain slot dengan melakukan deposit pulsa dan tanpa dikenakan potongan apapun sehingga dana yang masuk ke dalam akun akan 100% utuh. Proses penarikan dana juga dijamin gampang dan tidak sulit sehingga kamu tidak perlu khawatir akan kemenangan yang akan kamu peroleh dengan sangat mudah jika bermain disini.   DAFTAR & LOGIN AKUN PRO SLOT DEPOSIT PULSA TANPA POTONGAN ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
  • Topics

×
×
  • Create New...

Important Information

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