@@ -0,0 +1,90 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/AbstractChestBoat.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/AbstractChestBoat.java
|
||||
@@ -27,6 +27,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 abstract class AbstractChestBoat extends AbstractBoat implements HasCustomInventoryScreen, ContainerEntity {
|
||||
|
||||
private static final int CONTAINER_SIZE = 27;
|
||||
@@ -70,11 +79,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
|
||||
@@ -212,4 +228,51 @@
|
||||
public void stopOpen(EntityHuman entityhuman) {
|
||||
this.level().gameEvent((Holder) GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.a.of((Entity) entityhuman));
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||
+ private int maxStack = MAX_STACK;
|
||||
+
|
||||
+ @Override
|
||||
+ public List<ItemStack> 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<HumanEntity> 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
|
||||
}
|
||||
Reference in New Issue
Block a user