Jump to content

How intercept the convertToVillager method


sidben

Recommended Posts

Hello, I'm working on a mod to add small tweaks to the game, one of those would be to give a villager a special trade when he is cured from being a zombie.

 

I figured out that the best place for my code would be inside the "EntityZombie.convertToVillager()" method, but I did not find any hooks for it.

 

    protected void convertToVillager()
    {
        EntityVillager entityvillager = new EntityVillager(this.worldObj);
        entityvillager.copyLocationAndAnglesFrom(this);
        entityvillager.func_110161_a((EntityLivingData)null);
        entityvillager.func_82187_q();

        if (this.isChild())
        {
            entityvillager.setGrowingAge(-24000);
        }

        // HERE IS WHERE I WOULD LIKE MY CODE

        this.worldObj.removeEntity(this);
        this.worldObj.spawnEntityInWorld(entityvillager);
        entityvillager.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 0));
        this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1017, (int)this.posX, (int)this.posY, (int)this.posZ, 0);
    }

 

 

Does anyone know of a hook I could use?

 

Thanks

Link to comment
Share on other sites

Thanks, I forked the repo, I'll look into how I can do that.

 

I think I could achieve what I want tracking "EntityJoinWorldEvent" and "onLivingDeath" or "onUpdate", but it would be a half-assed way for what I want  ;D

 

I'll see if I can crate a "EntityTransform(Entity old, Entity new)" hook, it could be used for other transformations like Pig -> Zombie Pigman.

Link to comment
Share on other sites

checking that EVERY tick would be overkill

 

kinda like always looking at the windows in case there's someone coming instead of waiting til you hear the door knock

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • My journey with Wizard Web Recovery began with skepticism, as I had already been burned once. However, desperate times called for desperate measures. I reached out to them, and from the onset, their professionalism was evident. They took  time to understand my situation, reassured me of their expertise, and provided a detailed plan on how they intended to recover my lost Bitcoin. Wizard Web Recovery stands out for several reasons. Firstly, their team comprises highly skilled professionals who specialize in blockchain technology and cyber forensics. This expertise is crucial when dealing with the complexities of cryptocurrency theft. They explained every step of the process to me, ensuring I was well-informed and comfortable with their approach. Communication with Wizard Web Recovery was seamless. They maintained regular updates, keeping me in the loop about the progress they were making. This transparency was something I had not experienced with other firms I had contacted. It built my confidence in their ability to deliver on their promises. Another significant aspect of Wizard Web Recovery is its ethical approach. They operate with integrity, ensuring that every action they take is within legal boundaries. In a field rife with scams and false promises, their commitment to ethical practices is a breath of fresh air. They provided me with all necessary documentation and evidence of their progress, which further reassured me of their legitimacy. The actual recovery process was nothing short of impressive. Wizard Web Recovery used advanced techniques to trace the stolen Bitcoin through the blockchain. They were able to identify the wallets it had been transferred to and worked tirelessly to negotiate the return of my funds. The level of detail and precision they demonstrated was extraordinary. By the end of the process, Wizard Web Recovery had successfully recovered my lost Bitcoin. The relief and gratitude I felt were overwhelming. It was not just about the money but about restoring my faith in the possibility of justice and recovery in the cryptocurrency world. Wizard Web Recovery turned my nightmare into a success story. Their expertise, transparency, ethical approach, and relentless effort make them the best in the business. If you are in a similar situation, do not hesitate to reach out to them. They are proof that amidst the darkness of scams, there are still trustworthy experts dedicated to helping you recover your digital assets.  
    • My journey with Wizard Web Recovery began with skepticism, as I had already been burned once. However, desperate times called for desperate measures. I reached out to them, and from the onset, their professionalism was evident. They took  time to understand my situation, reassured me of their expertise, and provided a detailed plan on how they intended to recover my lost Bitcoin. Wizard Web Recovery stands out for several reasons. Firstly, their team comprises highly skilled professionals who specialize in blockchain technology and cyber forensics. This expertise is crucial when dealing with the complexities of cryptocurrency theft. They explained every step of the process to me, ensuring I was well-informed and comfortable with their approach. Communication with Wizard Web Recovery was seamless. They maintained regular updates, keeping me in the loop about the progress they were making. This transparency was something I had not experienced with other firms I had contacted. It built my confidence in their ability to deliver on their promises. Another significant aspect of Wizard Web Recovery is its ethical approach. They operate with integrity, ensuring that every action they take is within legal boundaries. In a field rife with scams and false promises, their commitment to ethical practices is a breath of fresh air. They provided me with all necessary documentation and evidence of their progress, which further reassured me of their legitimacy. The actual recovery process was nothing short of impressive. Wizard Web Recovery used advanced techniques to trace the stolen Bitcoin through the blockchain. They were able to identify the wallets it had been transferred to and worked tirelessly to negotiate the return of my funds. The level of detail and precision they demonstrated was extraordinary. By the end of the process, Wizard Web Recovery had successfully recovered my lost Bitcoin. The relief and gratitude I felt were overwhelming. It was not just about the money but about restoring my faith in the possibility of justice and recovery in the cryptocurrency world. Wizard Web Recovery turned my nightmare into a success story. Their expertise, transparency, ethical approach, and relentless effort make them the best in the business. If you are in a similar situation, do not hesitate to reach out to them. They are proof that amidst the darkness of scams, there are still trustworthy experts dedicated to helping you recover your digital assets.   Contact Below:   Mail - wizard webrecovery@ programmer . net
    • Well don't I feel dumb, thank you as always @TileEntity you're the GOAT
    • Here is my code: @Mod.EventBusSubscriber(modid = Mod.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class PlayerRenderModifications { @SubscribeEvent public static void prePlayerRender(RenderPlayerEvent.Pre evt) { RenderSystem.setShaderColor(0.0F, 1.0F, 1.0F, 1.0F); } @SubscribeEvent public static void postPlayerRender(RenderPlayerEvent.Post evt) { RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); } } This code is supposed to tint the player blue, however it doesn't tint the player at all (yes i know it only runs in f5 mode or when rendering players in multiplayer). I had also done some testing and it seems if I remove "postPlayerRender" then it tints the player, and also tints everything else that renders after the player (like other entities, clouds, etc.)   If you need me to provide other information then go ahead and ask!
  • Topics

×
×
  • Create New...

Important Information

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