So, is there a way create an item, using commands, that when dropped, will not despawn or get destroyed by lava or something. Im not looking for this to effect all items in the game because that would leave a lot of stuff just lying around when mobs get killed. I just want it to effect an item that you get from the /give command or something.
I know this is probably a difficult question so thank you for your help ahead of time.
Setting the health to 999999 will not work as expected because the maxsize of a short is 32767. So you need to set it to 32767s. This generally, will make it indestructible, however, if you don't want explosions to be able to move the item you can use Invulnerable:1b.
For now. The "but it works" is not a good argument for not respecting the correct syntax. See: before 1.12 using spaces in names without using quotes was basically also wrong but "it worked" so some people never bothered. And then Mojang made syntax checking on names more strict for both better optimization but also making it more error prone (assumption on my part). As a result all those players who didn't bother with quotes had to rebuild their stuff.
This is no different. It may work for now, but the moment things become more strict again (and I seriously expect something to happen in 1.13) then you may very well run into problems (again) because you didn't use the right syntax from the start.
That's actually not why it still "works". It appears to work because if you set a value higher than the maxsize (65535), it will overflow. 999999%65535=16974. So you are still giving it quite a bit of health, but by setting it above the maxsize, you are actually giving it less health than you could be.
So, is there a way create an item, using commands, that when dropped, will not despawn or get destroyed by lava or something. Im not looking for this to effect all items in the game because that would leave a lot of stuff just lying around when mobs get killed. I just want it to effect an item that you get from the /give command or something.
I know this is probably a difficult question so thank you for your help ahead of time.
Setting the health to 999999 will not work as expected because the maxsize of a short is 32767. So you need to set it to 32767s. This generally, will make it indestructible, however, if you don't want explosions to be able to move the item you can use Invulnerable:1b.
That's actually not why it still "works". It appears to work because if you set a value higher than the maxsize (65535), it will overflow. 999999%65535=16974. So you are still giving it quite a bit of health, but by setting it above the maxsize, you are actually giving it less health than you could be.