aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/entity/vehicle/ChestBoat.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/vehicle/ChestBoat.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/entity/vehicle/ChestBoat.java.patch204
1 files changed, 204 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/vehicle/ChestBoat.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/vehicle/ChestBoat.java.patch
new file mode 100644
index 0000000000..c4a0363d2c
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/vehicle/ChestBoat.java.patch
@@ -0,0 +1,204 @@
+--- a/net/minecraft/world/entity/vehicle/ChestBoat.java
++++ b/net/minecraft/world/entity/vehicle/ChestBoat.java
+@@ -4,8 +4,9 @@
+ import net.minecraft.core.NonNullList;
+ import net.minecraft.nbt.CompoundTag;
+ import net.minecraft.resources.ResourceLocation;
++import net.minecraft.world.Container;
+ import net.minecraft.world.Containers;
+-import net.minecraft.world.InteractionHand;
++import net.minecraft.world.EnumHand;
+ import net.minecraft.world.InteractionResult;
+ import net.minecraft.world.damagesource.DamageSource;
+ import net.minecraft.world.entity.Entity;
+@@ -22,24 +23,34 @@
+ import net.minecraft.world.item.Items;
+ import net.minecraft.world.level.Level;
+ import net.minecraft.world.level.gameevent.GameEvent;
++// CraftBukkit start
++import java.util.List;
++import org.bukkit.Location;
++import org.bukkit.craftbukkit.entity.CraftHumanEntity;
++import org.bukkit.entity.HumanEntity;
++import org.bukkit.inventory.InventoryHolder;
++// CraftBukkit end
+
+ public class ChestBoat extends Boat implements HasCustomInventoryScreen, ContainerEntity {
++
+ private static final int CONTAINER_SIZE = 27;
+- private NonNullList<ItemStack> itemStacks = NonNullList.withSize(27, ItemStack.EMPTY);
++ private NonNullList<ItemStack> itemStacks;
+ @Nullable
+ private ResourceLocation lootTable;
+ private long lootTableSeed;
+
+ public ChestBoat(EntityType<? extends Boat> entityType, Level level) {
+ super(entityType, level);
++ this.itemStacks = NonNullList.withSize(27, ItemStack.EMPTY);
+ }
+
+- public ChestBoat(Level level, double x, double y, double z) {
++ public ChestBoat(Level level, double x, double d1, double y) {
+ super(EntityType.CHEST_BOAT, level);
+- this.setPos(x, y, z);
++ this.itemStacks = NonNullList.withSize(27, ItemStack.EMPTY);
++ this.setPos(x, d1, y);
+ this.xo = x;
+- this.yo = y;
+- this.zo = z;
++ this.yo = d1;
++ this.zo = y;
+ }
+
+ @Override
+@@ -73,24 +84,25 @@
+ @Override
+ public void remove(Entity.RemovalReason reason) {
+ if (!this.level().isClientSide && reason.shouldDestroy()) {
+- Containers.dropContents(this.level(), this, this);
++ Containers.dropContents(this.level(), (Entity) this, (Container) this);
+ }
+
+ super.remove(reason);
+ }
+
+ @Override
+- public InteractionResult interact(Player player, InteractionHand hand) {
++ public InteractionResult interact(Player player, EnumHand hand) {
+ if (this.canAddPassenger(player) && !player.isSecondaryUseActive()) {
+ return super.interact(player, hand);
+ } else {
+- InteractionResult interactionResult = this.interactWithContainerVehicle(player);
+- if (interactionResult.consumesAction()) {
++ InteractionResult enuminteractionresult = this.interactWithContainerVehicle(player);
++
++ if (enuminteractionresult.consumesAction()) {
+ this.gameEvent(GameEvent.CONTAINER_OPEN, player);
+ PiglinAi.angerNearbyPiglins(player, true);
+ }
+
+- return interactionResult;
++ return enuminteractionresult;
+ }
+ }
+
+@@ -101,21 +113,43 @@
+ this.gameEvent(GameEvent.CONTAINER_OPEN, player);
+ PiglinAi.angerNearbyPiglins(player, true);
+ }
++
+ }
+
+ @Override
+ public Item getDropItem() {
+- return switch (this.getVariant()) {
+- case SPRUCE -> Items.SPRUCE_CHEST_BOAT;
+- case BIRCH -> Items.BIRCH_CHEST_BOAT;
+- case JUNGLE -> Items.JUNGLE_CHEST_BOAT;
+- case ACACIA -> Items.ACACIA_CHEST_BOAT;
+- case CHERRY -> Items.CHERRY_CHEST_BOAT;
+- case DARK_OAK -> Items.DARK_OAK_CHEST_BOAT;
+- case MANGROVE -> Items.MANGROVE_CHEST_BOAT;
+- case BAMBOO -> Items.BAMBOO_CHEST_RAFT;
+- default -> Items.OAK_CHEST_BOAT;
+- };
++ Item item;
++
++ switch (this.getVariant()) {
++ case SPRUCE:
++ item = Items.SPRUCE_CHEST_BOAT;
++ break;
++ case BIRCH:
++ item = Items.BIRCH_CHEST_BOAT;
++ break;
++ case JUNGLE:
++ item = Items.JUNGLE_CHEST_BOAT;
++ break;
++ case ACACIA:
++ item = Items.ACACIA_CHEST_BOAT;
++ break;
++ case CHERRY:
++ item = Items.CHERRY_CHEST_BOAT;
++ break;
++ case DARK_OAK:
++ item = Items.DARK_OAK_CHEST_BOAT;
++ break;
++ case MANGROVE:
++ item = Items.MANGROVE_CHEST_BOAT;
++ break;
++ case BAMBOO:
++ item = Items.BAMBOO_CHEST_RAFT;
++ break;
++ default:
++ item = Items.OAK_CHEST_BOAT;
++ }
++
++ return item;
+ }
+
+ @Override
+@@ -154,8 +188,7 @@
+ }
+
+ @Override
+- public void setChanged() {
+- }
++ public void setChanged() {}
+
+ @Override
+ public boolean stillValid(Player player) {
+@@ -210,6 +243,53 @@
+
+ @Override
+ public void stopOpen(Player player) {
+- this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of(player));
++ this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of((Entity) player));
+ }
++
++ // 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
+ }