mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 03:52:45 +01:00
65bc2541a3
By: md_5 <git@md-5.net>
90 lines
2.6 KiB
Diff
90 lines
2.6 KiB
Diff
--- 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
|
|
@@ -240,4 +256,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
|
|
}
|