Posted October 18, 20159 yr 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
October 19, 20159 yr ASM is probably the only way to do it. Sorry m8 I hate it too. Theres a good example of it here though, you could get it working by just changing the names of what this guy did to whatever you want to change. https://bitbucket.org/cuchaz/ships/src "you seem to be THE best modder I've seen imo." ~spynathan ლ(́◉◞౪◟◉‵ლ
October 19, 20159 yr Author 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.
October 19, 20159 yr I think a different approach would be to cancel the regular potions use item functionality (i.e. with the PlayerUseItem event) and replace it with your own. You wouldn't need to change any vanilla functions, just they'll never get called but yours will. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
October 19, 20159 yr Author @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
October 19, 20159 yr Author 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.