We've split up the commands, scripting and mods, and add ons category! Please be sure you get your thread in the right place.

26

Disable Item drops

3 Comments

Please sign in to leave a comment.

Sorted by oldest
  • 0
    Registered User commented
    Comment actions Permalink

    hmm... u need to explain more, i mean does this gamerule affect droppers? i mean this gamerule would only prevent player from droping items or it would prevent items from exist?

  • 4
    Registered User commented
    Comment actions Permalink

    This is already possible with the current commands; we don't need a new gamerule.

    It's as simple as putting this command into a repeating command block in a constantly loaded chunk, or putting it in a function tagged in #minecraft:tick

    /execute as @e[type=item] run data merge entity @s {PickupDelay:0s}

    This makes it impossible to drop any time because you will instantly pick it up again. You can optimize it so that it only affects items that have the Age 0 (i.e. the only items that could have been recently dropped).

    /execute as @e[type=item,nbt={Age:0s}] run data merge entity @s {PickupDelay:0s}

    You can further make it more specific so that it only affects items of a specific type (I used stone as an example):

    /execute as @e[type=item,nbt={Age:0s,Item:{id:"minecraft:stone"}}] run data merge entity @s {PickupDelay:0s}

    or items with some other NBT tag (I used "items enchanted with Sharpness V" as an example here):

    /execute as @e[type=item,nbt={Age:0s,Item:{tag:{Enchantments:[{id:"minecraft:sharpness",lvl:5}]}}}] run data merge entity @s {PickupDelay:0s}

    You can see a full list of all the different NBT tags that an item could have here:

    https://minecraft.gamepedia.com/Player.dat_format#Item_structure

    Hope this helps!

  • 0
    Registered User commented
    Comment actions Permalink

    Morro