--- a/net/minecraft/world/entity/vehicle/ChestBoat.java +++ b/net/minecraft/world/entity/vehicle/ChestBoat.java @@ -26,6 +26,15 @@ import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.storage.loot.LootTable; +// CraftBukkit start +import java.util.List; +import org.bukkit.Location; +import org.bukkit.craftbukkit.entity.CraftHumanEntity; +import org.bukkit.entity.HumanEntity; +import org.bukkit.event.entity.EntityRemoveEvent; +import org.bukkit.inventory.InventoryHolder; +// CraftBukkit end + public class ChestBoat extends EntityBoat implements HasCustomInventoryScreen, ContainerEntity { private static final int CONTAINER_SIZE = 27; @@ -78,11 +87,18 @@ @Override public void remove(Entity.RemovalReason entity_removalreason) { + // CraftBukkit start - add Bukkit remove cause + this.remove(entity_removalreason, null); + } + + @Override + public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { + // CraftBukkit end if (!this.level().isClientSide && entity_removalreason.shouldDestroy()) { InventoryUtils.dropContents(this.level(), (Entity) this, (IInventory) this); } - super.remove(entity_removalreason); + super.remove(entity_removalreason, cause); // CraftBukkit - add Bukkit remove cause } @Override @@ -248,4 +264,51 @@ public void stopOpen(EntityHuman entityhuman) { this.level().gameEvent((Holder) GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.a.of((Entity) entityhuman)); } + + // CraftBukkit start + public List transaction = new java.util.ArrayList(); + private int maxStack = MAX_STACK; + + @Override + public List getContents() { + return this.itemStacks; + } + + @Override + public void onOpen(CraftHumanEntity who) { + transaction.add(who); + } + + @Override + public void onClose(CraftHumanEntity who) { + transaction.remove(who); + } + + @Override + public List getViewers() { + return transaction; + } + + @Override + public InventoryHolder getOwner() { + org.bukkit.entity.Entity entity = getBukkitEntity(); + if (entity instanceof InventoryHolder) return (InventoryHolder) entity; + return null; + } + + @Override + public int getMaxStackSize() { + return maxStack; + } + + @Override + public void setMaxStackSize(int size) { + maxStack = size; + } + + @Override + public Location getLocation() { + return getBukkitEntity().getLocation(); + } + // CraftBukkit end }