I think EnumHand didn't exist in 1.7.10. So instead of both instances of getHeldItem you need to use getCurrentEquippedItem (it was called if I remember correctly)
I think EnumHand didn't exist in 1.7.10. So instead of both instances of getHeldItem you need to use getCurrentEquippedItem (it was called if I remember correctly)
Nope doesn't work. Perhaps can we just have it not set fire if it is in inventory at all if that is easier?
The Meaning of Life, the Universe, and Everything.
Location:
Colorado
Join Date:
3/27/2016
Posts:
208
Location:
Colorado
Minecraft:
ProfessorOro
Discord:
gargatheoro
PMC:
GargatheOro
Member Details
Perhaps maybe can we just make it so the metal sets you on fire unless you got fire resistance? Then make tongs give you fire resistance when you hold them?
For the metal, use the onUpdate() method Metamorphic_Fish gave you and inside check if the item is selected (there is a isSelected parameter in method) and within the if statement, you either use entity.setFire(1) or for the tongs, type this:
With the player, you can easily use the addPotionEffect(int id, int duration [should be 1 because the time is infinitely repeating unless the tongs or another item is held ], int level [It is 0 based. ex) Regen 1 = 0 ] ) to give the player your desired effect.
For the metal, use the onUpdate() method Metamorphic_Fish gave you and inside check if the item is selected (there is a isSelected parameter in method) and within the if statement, you either use entity.setFire(1) or for the tongs, type this:
With the player, you can easily use the addPotionEffect(int id, int duration [should be 1 because the time is infinitely repeating unless the tongs or another item is held ], int level [It is 0 based. ex) Regen 1 = 0 ] ) to give the player your desired effect.
I dont understand. So I will just put e.setFire(1); in the metal class and how to I make the game know when someone is holding the tongs? Of course I can make it give fire res but how to make it only do that when in your hand?
For the metal, yes when the item isSelected (you can check via an if statement) you can do e.setFire(1) to set the player on fire.
That isSelected parameter is very helpful in this method because it checks if the specific item you are holding (in this case, the metal) is selected on the hotbar. If the game notices that you selected the tongs or any other item, isSelected will be false and the game won't set you on fire.
I want to create an item that sets you on fire while having it in your inventory, unless you are holding a certain item.
Trying to create melted metal that burns you if you are not holding tongs.
Please help. Thank you.
An SF Towny server! Join our Discord: Click here
Override Item.onUpdate in your melted metal class, then check if the player is holding tongs, if they are not, call Entity.setFire.
My Github ด้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้дด็็็็็้้้้้็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้
Thank you, but I am new to modding and do not really know how to use that code. Could you help me out a bit more? Thank you.
An SF Towny server! Join our Discord: Click here
I have created the method that does what you're asking: https://pastebin.com/DYBTxA07
I don't usually give out code, but I guess I'm feeling more generous today.
My Github ด้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้дด็็็็็้้้้้็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้
How do I make it so that the metal burns them? I see the tongs makes them immune to it, but where do I plugin the metal? Thank you
EDIT: nevermind sorry I reread your original post thanks so much for the help
EDIT 2: It is erroring on EnumHand
An SF Towny server! Join our Discord: Click here
I think EnumHand didn't exist in 1.7.10. So instead of both instances of getHeldItem you need to use getCurrentEquippedItem (it was called if I remember correctly)
Nope doesn't work. Perhaps can we just have it not set fire if it is in inventory at all if that is easier?
An SF Towny server! Join our Discord: Click here
Perhaps maybe can we just make it so the metal sets you on fire unless you got fire resistance? Then make tongs give you fire resistance when you hold them?
An SF Towny server! Join our Discord: Click here
Then, it is quite simple to do.
For the metal, use the onUpdate() method Metamorphic_Fish gave you and inside check if the item is selected (there is a isSelected parameter in method) and within the if statement, you either use entity.setFire(1) or for the tongs, type this:
With the player, you can easily use the addPotionEffect(int id, int duration [should be 1 because the time is infinitely repeating unless the tongs or another item is held ], int level [It is 0 based. ex) Regen 1 = 0 ] ) to give the player your desired effect.
I dont understand. So I will just put e.setFire(1); in the metal class and how to I make the game know when someone is holding the tongs? Of course I can make it give fire res but how to make it only do that when in your hand?
An SF Towny server! Join our Discord: Click here
For the metal, yes when the item isSelected (you can check via an if statement) you can do e.setFire(1) to set the player on fire.
That isSelected parameter is very helpful in this method because it checks if the specific item you are holding (in this case, the metal) is selected on the hotbar. If the game notices that you selected the tongs or any other item, isSelected will be false and the game won't set you on fire.