0

I am making a puzzle adventure map which involves dropping items onto pressure plates to keep doors open. Of course, an item despawning would break the map, so I've been trying to find ways to prevent this.

At the moment, I'm running two repeating command blocks both set to 'Unconditional' and 'Always active' with these commands:

/tag @e[type=minecraft:item] add Remain

/execute as @e[tag=Remain] run data merge entity @s {Age:0}

The first command gives the 'Remain' tag to all items, and the second command continuously sets their age to 0. Unfortunately, items are still despawning. Any help would be greatly appreciated.

5
  • This might be related to bugs.mojang.com/browse/MC-99628 . Commented Mar 29, 2020 at 21:21
  • I assume you mean the items still despawn anyway? It would be good if you added to your question what actually doesn't work. Commented Mar 29, 2020 at 21:24
  • It works for me, the item keeps existing. BTW, you don't need a tag. Commented Mar 29, 2020 at 21:33
  • I think there may be problems with my world - it was previously 1.9 and I just updated it to 1.14.4, doing this might have messed with command blocks somehow. Chain command blocks also don't work, which probably confirms this theory.
    – Tom
    Commented Mar 30, 2020 at 8:55
  • Why 1.14.4? 1.15.2 is better in every way, especially performance and bugfixes. And I'm pretty sure there was a bug in 1.14.x that made a few repeating command blocks randomly not activate anymore. Try breaking and placing them again in 1.15.2. Commented Mar 30, 2020 at 14:05

2 Answers 2

-1

You can execute a command for all items just by using "/execute as @e[type=item]", there's no need on adding a tag.

Also to make the item not despawn, you can simply modify it's "Age" tag to '-32768s', that will make the item never despawn.

/execute as @e[type=item] run data modify entity @s Age set value -32768s

If you want to make this for all items, just put the command on a repeat commandblock, and it'll work for every item that is dropped.

-3

You can't really do that to stop blocks from despawning when they've already been dropped. But what you can do is organize. You can place items in chests to stop them from despawning.

2
  • This won't help when the items are relied on to activate pressure plates. Organizing won't help - the idea is that the dropped items stay on the pressure plates and don't despawn.
    – One 2 Many
    Commented Nov 3, 2020 at 0:01
  • Also it is actually possible, I was just overcomplicating it. Just use a repeating "/execute as" command to make all items set their age to 0.
    – Tom
    Commented Nov 3, 2020 at 21:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .