Jump to content

How do i change despawn time of dropped items.


Kevblocknikow

Recommended Posts

This would be a decent gamerule. You can somewhat do this with commands however:

[Put this in Repeating, Unconditional, Always Active, command block]
execute if entity @e[type=minecraft:item,tag=!10minDespawn] as @e[type=minecraft:item,tag=!10minDespawn] run data merge entity @s {Age:-6000s}

[Put this in Chain, Conditional, Always Active, command block, off of the repeating command block, with the arrow pointing the same direction]
tag @e[type=minecraft:item,tag=!10minDespawn] add 10minDespawn

The way this works is, when you normally drop an item, it has an Age value of 0 and gradually ticks up at 20 ticks per second till it reaches 6000 (which is the default despawn time of 5 mins). By setting the Age to -6000, it takes the item another 5 mins to reach 6000. Adding the tag after data merging the Age value prevents the item from continuously being set to -6000 and never being able to despawn.

just note that the maximum time you can extend this to is ~26.5 minutes. If you want to extend it further you'll have to build a more complex system.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...