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.
This commit is contained in:
Jake Potrebic
2022-03-22 09:34:41 -07:00
parent ec3623bcc2
commit ddbfcd4403
7 changed files with 141 additions and 108 deletions

View File

@@ -126,6 +126,19 @@
}
this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth());
@@ -488,10 +535,10 @@
@Override
protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) {
super.dropCustomDeathLoot(world, source, causedByPlayer);
- 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
if (entityitem != null) {
- entityitem.setExtendedLifetime();
+ entityitem.setExtendedLifetime(); // Paper - diff on change
}
}
@@ -499,7 +546,7 @@
@Override
public void checkDespawn() {