Started by
ManTruck29
on
Topic category: Help with Minecraft modding (Java Edition)
Hello, so i have a throwable axe that uses it self as ammo and when you throw it it get's removed from your inventory and when it hit's either ground either entity it will drop as an item in that location. The problem is i can't figure how to keep the durabillity of it and deal damage to it when it hit's something. Anyone that could help?
ok i see why you are confused because this involves using some complex stuff
in the text below i will refer to the entity that is flying in the air (like an arrow or a bullet) as the "ranged item entity"
so the problem is that when you throw the axe, it resets the durability because the ranged item entity isnt actually able to store a durability value because it's an entity not an item
so the solution to this is to create an NBT variable that is stored inside the ranged item entity
this NBT variable would store the durability of the item
when you throw the item, it would set the durability NBT variable of the ranged item entity = to the durability of the item
and when it lands on the ground, it would set the ground item's durability NBT = to the ranged item entity's NBT
sorry if this is unclear, if you're confused then tell me that and i will draw a picture or something