Jump to content

[1.7.2] Replacing vanilla abstract method in EntityLivingBase


Recommended Posts

Posted

Hello!

 

I'm creating my own potion system, and I need to add new PotionEffect handler.

I have an ElixirEffect class. When I restart the game,

'public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)'

loads an PotionEffect instead of ElixirEffect.

 

So that's why i need to override this method.

Any ideas?

 

Regards,

Martin

 

Posted

Well as I said, I need this to implement my elixir system.

But method 'public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound par0NBTTagCompound)',

prevent me to load my ElixirEffect class instead of it's base.

 

Posted

@jabelar I'm not replacing an ItemPotion work, I have own class already.

But the Entity NBT Data when entity join game is a point."readEntityFromNBT" loads an PotionEffect, so most of functions aren't working, because game thinks it's normal PotionEffect instead of ElixirEffect. So that's why I must override "readCustomPotionEffectFromNBT" in PotionEffect class to return an ElixirEffect. But I already managed to make it work.

 

I need it because I'm make my effects handle in ElixirEffect class, not in EventHandler. I'm also increasing maximum potion duration to Integer.MAX_VALUE.

 

I have one more question according to ASM.

In Potion class there's a field named "public static final Potion[] potionTypes". I'm using a Java Reflection to change it accesibility and increase initial array size (from 32 to n/a). But how do this in ASM?

 

Thanks for advice,

Martin

Posted

I know what I to achieve and I'm 100 percent sure it will not break other mods functionality.

 

According to my last request:

"I have one more question according to ASM.

In Potion class there's a field named "public static final Potion[] potionTypes". I'm using a Java Reflection to change it accesibility and increase initial array size (from 32 to n/a). But how do this in ASM?"

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



×
×
  • Create New...

Important Information

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