[SOLVED] Item Explosion And Despawn Immunity

Started by Alec Cature on

Topic category: Help with modding (Java Edition)

Last seen on 04:33, 27. Apr 2024
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[SOLVED] Item Explosion And Despawn Immunity
Sat, 03/09/2024 - 20:40 (edited)

Hello, I am attempting to make a very important item that when dropped, I do not want to be easily destroyed via explosions or despawned after the 5 minutes of it being on the ground. Is there a way to prevent these from happening?

As a bonus, if i can make it immune to cacti as well, that would be amazing but this isn't mandatory and I'm aware this can be much more difficult to achieve.

Edited by Alec Cature on Sat, 03/09/2024 - 20:40
Last seen on 04:33, 27. Apr 2024
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Solved this issue! Here is…
Sat, 03/09/2024 - 20:40

Solved this issue! Here is the code for anyone else who wishes to do the same thing.



For the command, paste in this: data merge entity @e[type=item,limit=1,nbt={Item:{id:"MOD:ITEM"}}] {Invulnerable:1b,Age:-32000} and make sure to replace the 'MOD:ITEM' with your mod identifier and item name such as 'minecraft:iron_ingot'.