2023-12-03 02:35:10 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 22 Mar 2022 09:34:41 -0700
Subject: [PATCH] Restore vanilla entity drops behavior
Instead of just tracking the itemstacks, this tracks with it, the
action to take with that itemstack to apply the correct logic
on dropping the item instead of generalizing it for all dropped
items like CB does.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
2024-10-25 12:30:19 +02:00
index 419fcb4cd97cf10a2601e02024b999a51a0ff952..df21cd1bd2a3dda7169edbea18bbfdf043db76f8 100644
2023-12-03 02:35:10 +01:00
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
2024-10-24 12:11:32 +02:00
@@ -1235,20 +1235,20 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
2023-12-03 02:35:10 +01:00
if (this.isRemoved()) {
return;
}
2024-07-06 21:19:14 +02:00
- java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<>(this.getInventory().getContainerSize());
2024-01-13 16:35:59 +01:00
+ List<DefaultDrop> loot = new java.util.ArrayList<>(this.getInventory().getContainerSize()); // Paper - Restore vanilla drops behavior
2024-10-24 12:11:32 +02:00
boolean keepInventory = this.serverLevel().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || this.isSpectator();
2023-12-03 02:35:10 +01:00
if (!keepInventory) {
for (ItemStack item : this.getInventory().getContents()) {
2024-06-14 19:15:52 +02:00
if (!item.isEmpty() && !EnchantmentHelper.has(item, EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP)) {
2024-07-18 10:13:20 +02:00
- loot.add(CraftItemStack.asCraftMirror(item).markForInventoryDrop());
2024-01-13 16:35:59 +01:00
+ loot.add(new DefaultDrop(item, stack -> this.drop(stack, true, false, false))); // Paper - Restore vanilla drops behavior; drop function taken from Inventory#dropAll (don't fire drop event)
2023-12-03 02:35:10 +01:00
}
}
}
2024-10-25 12:30:19 +02:00
if (this.shouldDropLoot() && this.serverLevel().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // Paper - fix player loottables running when mob loot gamerule is false
2023-12-03 02:35:10 +01:00
// SPIGOT-5071: manually add player loot tables (SPIGOT-5195 - ignores keepInventory rule)
2024-10-24 12:11:32 +02:00
this.dropFromLootTable(this.serverLevel(), damageSource, this.lastHurtByPlayerTime > 0);
2024-07-06 21:19:14 +02:00
- this.dropCustomDeathLoot(this.serverLevel(), damageSource, flag);
+ // Paper - Restore vanilla drops behaviour; custom death loot is a noop on server player, remove.
2023-12-19 05:57:49 +01:00
2024-07-06 21:19:14 +02:00
loot.addAll(this.drops);
this.drops.clear(); // SPIGOT-5188: make sure to clear
2023-12-03 02:35:10 +01:00
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
2024-10-25 12:30:19 +02:00
index 1d66c35b1092b8101f0a803d8c087e5a958875b1..aac1d620bf4cd1f18243f8c53cd32ab16fdeb616 100644
2023-12-03 02:35:10 +01:00
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
2024-10-24 12:11:32 +02:00
@@ -2678,19 +2678,45 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
2023-12-03 02:35:10 +01:00
@Nullable
2024-10-24 12:11:32 +02:00
public ItemEntity spawnAtLocation(ServerLevel world, ItemStack stack, float yOffset) {
2024-01-13 16:35:59 +01:00
+ // Paper start - Restore vanilla drops behavior
2024-10-24 12:11:32 +02:00
+ return this.spawnAtLocation(world, stack, yOffset, null);
2023-12-03 02:35:10 +01:00
+ }
+ public record DefaultDrop(Item item, org.bukkit.inventory.ItemStack stack, @Nullable java.util.function.Consumer<ItemStack> dropConsumer) {
+ public DefaultDrop(final ItemStack stack, final java.util.function.Consumer<ItemStack> dropConsumer) {
+ this(stack.getItem(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), dropConsumer);
+ }
+
2024-09-15 21:51:35 +02:00
+ public void runConsumer(final java.util.function.Consumer<org.bukkit.inventory.ItemStack> fallback) {
2024-02-01 10:15:57 +01:00
+ if (this.dropConsumer == null || org.bukkit.craftbukkit.inventory.CraftItemType.bukkitToMinecraft(this.stack.getType()) != this.item) {
2024-09-15 21:51:35 +02:00
+ fallback.accept(this.stack);
2023-12-03 02:35:10 +01:00
+ } else {
+ this.dropConsumer.accept(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(this.stack));
+ }
+ }
+ }
+ @Nullable
2024-10-24 12:11:32 +02:00
+ public ItemEntity spawnAtLocation(ServerLevel world, ItemStack stack, float yOffset, @Nullable java.util.function.Consumer<? super ItemEntity> delayedAddConsumer) {
2024-01-13 16:35:59 +01:00
+ // Paper end - Restore vanilla drops behavior
2023-12-03 02:35:10 +01:00
if (stack.isEmpty()) {
return null;
} else {
// CraftBukkit start - Capture drops for death event
if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {
- ((net.minecraft.world.entity.LivingEntity) this).drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack)); // Paper - mirror so we can destroy it later
2024-01-13 16:35:59 +01:00
+ // Paper start - Restore vanilla drops behavior
2023-12-03 02:35:10 +01:00
+ ((net.minecraft.world.entity.LivingEntity) this).drops.add(new net.minecraft.world.entity.Entity.DefaultDrop(stack, itemStack -> {
+ ItemEntity itemEntity = new ItemEntity(this.level, this.getX(), this.getY() + (double) yOffset, this.getZ(), itemStack); // stack is copied before consumer
+ itemEntity.setDefaultPickUpDelay();
+ this.level.addFreshEntity(itemEntity);
+ if (delayedAddConsumer != null) delayedAddConsumer.accept(itemEntity);
+ }));
2024-01-13 16:35:59 +01:00
+ // Paper end - Restore vanilla drops behavior
2023-12-03 02:35:10 +01:00
return null;
}
// CraftBukkit end
2024-10-24 12:11:32 +02:00
ItemEntity entityitem = new ItemEntity(world, this.getX(), this.getY() + (double) yOffset, this.getZ(), stack);
2023-12-03 02:35:10 +01:00
stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe
- entityitem.setDefaultPickUpDelay();
+ entityitem.setDefaultPickUpDelay(); // Paper - diff on change (in dropConsumer)
2024-01-18 15:56:25 +01:00
// Paper start - Call EntityDropItemEvent
2024-10-25 12:30:19 +02:00
return this.spawnAtLocation(world, entityitem);
2023-12-03 02:35:10 +01:00
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
2024-10-25 12:30:19 +02:00
index 9bc6ed9fd8e5154d39fe12ffed1ecd5ec8e70df8..4b9108e48d052919bca000ddb54f9bf4589c33e6 100644
2023-12-03 02:35:10 +01:00
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
2024-10-24 12:11:32 +02:00
@@ -291,7 +291,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
2024-06-14 10:17:11 +02:00
protected float appliedScale;
2023-12-03 02:35:10 +01:00
// CraftBukkit start
public int expToDrop;
- public ArrayList<org.bukkit.inventory.ItemStack> drops = new ArrayList<org.bukkit.inventory.ItemStack>();
2024-01-13 16:35:59 +01:00
+ public ArrayList<DefaultDrop> drops = new ArrayList<>(); // Paper - Restore vanilla drops behavior
2023-12-03 02:35:10 +01:00
public final org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
public boolean collides = true;
public Set<UUID> collidableExemptions = new HashSet<>();
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
2024-10-24 12:11:32 +02:00
index e6b18d7f8922cb42acb9e40bef2f71a56aea8646..e1be143959fbaa1d54af2a1a2c27187d70e6a9e9 100644
2023-12-03 02:35:10 +01:00
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
2024-10-24 12:11:32 +02:00
@@ -536,10 +536,10 @@ public class WitherBoss extends Monster implements RangedAttackMob {
2023-12-03 02:35:10 +01:00
@Override
2024-06-14 10:17:11 +02:00
protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) {
super.dropCustomDeathLoot(world, source, causedByPlayer);
2024-10-24 12:11:32 +02:00
- ItemEntity entityitem = this.spawnAtLocation(world, (ItemLike) Items.NETHER_STAR);
+ ItemEntity entityitem = this.spawnAtLocation(world, new net.minecraft.world.item.ItemStack(Items.NETHER_STAR), 0, ItemEntity::setExtendedLifetime); // Paper - Restore vanilla drops behavior; spawnAtLocation returns null so modify the item entity with a consumer
2023-12-03 02:35:10 +01:00
if (entityitem != null) {
- entityitem.setExtendedLifetime();
+ entityitem.setExtendedLifetime(); // Paper - diff on change
}
}
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
2024-10-24 12:11:32 +02:00
index 2bb2b36f793d25b6e49d1a72bb665cfa9f212730..63f02cdc67d9e88cc6998d0ae9d139c83e85b447 100644
2023-12-03 02:35:10 +01:00
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
2024-10-24 12:11:32 +02:00
@@ -619,7 +619,7 @@ public class ArmorStand extends LivingEntity {
2024-04-25 01:25:57 +02:00
ItemStack itemstack = new ItemStack(Items.ARMOR_STAND);
2023-12-03 02:35:10 +01:00
2024-04-25 01:25:57 +02:00
itemstack.set(DataComponents.CUSTOM_NAME, this.getCustomName());
2023-12-03 02:35:10 +01:00
- this.drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
2024-01-13 16:35:59 +01:00
+ this.drops.add(new DefaultDrop(itemstack, stack -> Block.popResource(this.level(), this.blockPosition(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior
2024-06-14 10:17:11 +02:00
return this.brokenByAnything(world, damageSource); // Paper
2023-12-03 02:35:10 +01:00
}
2024-10-24 12:11:32 +02:00
@@ -633,7 +633,7 @@ public class ArmorStand extends LivingEntity {
2023-12-03 02:35:10 +01:00
for (i = 0; i < this.handItems.size(); ++i) {
itemstack = (ItemStack) this.handItems.get(i);
if (!itemstack.isEmpty()) {
- this.drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)); // CraftBukkit - add to drops // Paper - mirror so we can destroy it later - though this call site was safe
2024-01-13 16:35:59 +01:00
+ this.drops.add(new DefaultDrop(itemstack, stack -> Block.popResource(this.level(), this.blockPosition().above(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior; mirror so we can destroy it later - though this call site was safe & spawn drops correctly
2023-12-03 02:35:10 +01:00
this.handItems.set(i, ItemStack.EMPTY);
}
}
2024-10-24 12:11:32 +02:00
@@ -641,7 +641,7 @@ public class ArmorStand extends LivingEntity {
2023-12-03 02:35:10 +01:00
for (i = 0; i < this.armorItems.size(); ++i) {
itemstack = (ItemStack) this.armorItems.get(i);
if (!itemstack.isEmpty()) {
- this.drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)); // CraftBukkit - add to drops // Paper - mirror so we can destroy it later - though this call site was safe
2024-01-13 16:35:59 +01:00
+ this.drops.add(new DefaultDrop(itemstack, stack -> Block.popResource(this.level(), this.blockPosition().above(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior; mirror so we can destroy it later - though this call site was safe & spawn drops correctly
2023-12-03 02:35:10 +01:00
this.armorItems.set(i, ItemStack.EMPTY);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
2024-10-25 20:09:45 +02:00
index dbef230ae88ee1bfbc20ba53b534434c3ccac985..a0455f590d549343d6d8fd7991ba1b87a87acdb8 100644
2023-12-03 02:35:10 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
2024-10-24 12:11:32 +02:00
@@ -973,19 +973,25 @@ public class CraftEventFactory {
2023-12-03 02:35:10 +01:00
}
2024-05-11 23:48:37 +02:00
public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, DamageSource damageSource) {
- return CraftEventFactory.callEntityDeathEvent(victim, damageSource, new ArrayList<org.bukkit.inventory.ItemStack>(0));
+ return CraftEventFactory.callEntityDeathEvent(victim, damageSource, new ArrayList<>(0)); // Paper - Restore vanilla drops behavior
2023-12-03 02:35:10 +01:00
}
2024-05-11 23:48:37 +02:00
- public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, DamageSource damageSource, List<org.bukkit.inventory.ItemStack> drops) {
+ public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, DamageSource damageSource, List<Entity.DefaultDrop> drops) { // Paper - Restore vanilla drops behavior
2023-12-03 02:35:10 +01:00
// Paper start
2024-05-11 23:48:37 +02:00
return CraftEventFactory.callEntityDeathEvent(victim, damageSource, drops, com.google.common.util.concurrent.Runnables.doNothing());
2023-12-03 02:35:10 +01:00
}
2024-05-11 23:48:37 +02:00
- public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, DamageSource damageSource, List<org.bukkit.inventory.ItemStack> drops, Runnable lootCheck) {
2024-02-01 10:15:57 +01:00
+
+ private static final java.util.function.Function<org.bukkit.inventory.ItemStack, Entity.DefaultDrop> FROM_FUNCTION = stack -> {
2023-12-03 02:35:10 +01:00
+ if (stack == null) return null;
2024-01-14 10:46:04 +01:00
+ return new Entity.DefaultDrop(CraftItemType.bukkitToMinecraft(stack.getType()), stack, null);
2023-12-03 02:35:10 +01:00
+ };
2024-02-01 10:15:57 +01:00
+
2024-10-24 12:11:32 +02:00
+ public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, DamageSource damageSource, List<Entity.DefaultDrop> drops, Runnable lootCheck) { // Paper - Restore vanilla drops behavior
2023-12-03 02:35:10 +01:00
// Paper end
CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
2024-05-11 23:48:37 +02:00
CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource);
2023-12-03 02:35:10 +01:00
CraftWorld world = (CraftWorld) entity.getWorld();
2024-10-24 12:11:32 +02:00
- EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(world.getHandle(), damageSource.getEntity()));
2024-10-25 20:09:45 +02:00
+ EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward(world.getHandle(), damageSource.getEntity())); // Paper - Restore vanilla drops behavior
2024-10-24 12:11:32 +02:00
populateFields(victim, event); // Paper - make cancellable
2023-12-03 02:35:10 +01:00
Bukkit.getServer().getPluginManager().callEvent(event);
2024-10-24 12:11:32 +02:00
@@ -998,20 +1004,24 @@ public class CraftEventFactory {
2023-12-03 02:35:10 +01:00
victim.expToDrop = event.getDroppedExp();
lootCheck.run(); // Paper - advancement triggers before destroying items
- for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
2024-01-13 16:35:59 +01:00
+ // Paper start - Restore vanilla drops behavior
2023-12-03 02:35:10 +01:00
+ for (Entity.DefaultDrop drop : drops) {
2024-02-01 10:15:57 +01:00
+ if (drop == null) continue;
2023-12-03 02:35:10 +01:00
+ final org.bukkit.inventory.ItemStack stack = drop.stack();
2024-10-24 12:11:32 +02:00
+ // Paper end - Restore vanilla drops behavior
2023-12-10 19:33:36 +01:00
if (stack == null || stack.getType() == Material.AIR || stack.getAmount() == 0) continue;
2023-12-03 02:35:10 +01:00
- world.dropItem(entity.getLocation(), stack); // Paper - note: dropItem already clones due to this being bukkit -> NMS
2024-09-15 21:51:35 +02:00
+ drop.runConsumer(s -> world.dropItem(entity.getLocation(), s)); // Paper - Restore vanilla drops behavior
2023-12-03 02:35:10 +01:00
if (stack instanceof CraftItemStack) stack.setAmount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe, but don't nuke bukkit stacks of manually added items
}
return event;
}
2024-05-11 23:48:37 +02:00
- public static PlayerDeathEvent callPlayerDeathEvent(ServerPlayer victim, DamageSource damageSource, List<org.bukkit.inventory.ItemStack> drops, net.kyori.adventure.text.Component deathMessage, boolean keepInventory) { // Paper - Adventure
+ public static PlayerDeathEvent callPlayerDeathEvent(ServerPlayer victim, DamageSource damageSource, List<Entity.DefaultDrop> drops, net.kyori.adventure.text.Component deathMessage, boolean keepInventory) { // Paper - Adventure & Restore vanilla drops behavior
2023-12-03 02:35:10 +01:00
CraftPlayer entity = victim.getBukkitEntity();
2024-05-11 23:48:37 +02:00
CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource);
2024-10-24 12:11:32 +02:00
- PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(victim.serverLevel(), damageSource.getEntity()), 0, deathMessage);
+ PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward(victim.serverLevel(), damageSource.getEntity()), 0, deathMessage); // Paper - Restore vanilla drops behavior
2023-12-03 02:35:10 +01:00
event.setKeepInventory(keepInventory);
event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel
populateFields(victim, event); // Paper - make cancellable
2024-10-24 12:11:32 +02:00
@@ -1029,16 +1039,14 @@ public class CraftEventFactory {
2023-12-03 02:35:10 +01:00
victim.expToDrop = event.getDroppedExp();
victim.newExp = event.getNewExp();
- for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
2024-01-13 16:35:59 +01:00
+ // Paper start - Restore vanilla drops behavior
2023-12-03 02:35:10 +01:00
+ for (Entity.DefaultDrop drop : drops) {
2023-12-10 19:33:36 +01:00
+ if (drop == null) continue;
2023-12-03 02:35:10 +01:00
+ final org.bukkit.inventory.ItemStack stack = drop.stack();
2024-10-24 12:11:32 +02:00
+ // Paper end - Restore vanilla drops behavior
2023-12-10 19:33:36 +01:00
if (stack == null || stack.getType() == Material.AIR) continue;
2023-12-03 02:35:10 +01:00
2024-07-18 10:13:20 +02:00
- if (stack instanceof CraftItemStack craftItemStack && craftItemStack.isForInventoryDrop()) {
- victim.drop(CraftItemStack.asNMSCopy(stack), true, false, false); // SPIGOT-7800, SPIGOT-7801: Vanilla Behaviour for Player Inventory dropped items
- } else {
- victim.forceDrops = true;
2024-10-24 12:11:32 +02:00
- victim.spawnAtLocation(victim.serverLevel(), CraftItemStack.asNMSCopy(stack)); // SPIGOT-7806: Vanilla Behaviour for items not related to Player Inventory dropped items
2024-07-18 10:13:20 +02:00
- victim.forceDrops = false;
- }
2024-09-15 21:51:35 +02:00
+ drop.runConsumer(s -> victim.drop(CraftItemStack.unwrap(s), true, false, false)); // Paper - Restore vanilla drops behavior
2023-12-03 02:35:10 +01:00
}
return event;
2024-07-18 10:13:20 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
2024-10-24 12:11:32 +02:00
index 30eba68435387daa3917fa2b3071892c350d9ddc..0b7bc5e83634a26ac6521694377b554c74c6bff0 100644
2024-07-18 10:13:20 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
2024-10-24 12:11:32 +02:00
@@ -142,27 +142,6 @@ public final class CraftItemStack extends ItemStack {
2024-07-18 10:13:20 +02:00
this.setItemMeta(itemMeta);
}
- /**
- * Gets if the item is marked as an inventory drop in death events.
- *
- * @return true if the item is marked as an inventory drop
- */
- @ApiStatus.Internal
- public boolean isForInventoryDrop() {
- return this.isForInventoryDrop;
- }
-
- /**
- * Marks this item as an inventory drop in death events.
- *
- * @return the ItemStack marked as an inventory drop
- */
- @ApiStatus.Internal
- public ItemStack markForInventoryDrop() {
- this.isForInventoryDrop = true;
- return this;
- }
-
@Override
public MaterialData getData() {
return this.handle != null ? CraftMagicNumbers.getMaterialData(this.handle.getItem()) : super.getData();