aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch137
1 files changed, 137 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch
new file mode 100644
index 0000000000..85c4cf618a
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch
@@ -0,0 +1,137 @@
+--- a/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
++++ b/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.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;
+@@ -16,19 +17,70 @@
+ import net.minecraft.world.inventory.AbstractContainerMenu;
+ import net.minecraft.world.item.ItemStack;
+ import net.minecraft.world.level.Level;
++// 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 abstract class AbstractMinecartContainer extends AbstractMinecart implements ContainerEntity {
+- private NonNullList<ItemStack> itemStacks = NonNullList.withSize(36, ItemStack.EMPTY);
++
++ private NonNullList<ItemStack> itemStacks;
+ @Nullable
+- private ResourceLocation lootTable;
+- private long lootTableSeed;
++ public ResourceLocation lootTable;
++ public long lootTableSeed;
+
++ // CraftBukkit start
++ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
++ private int maxStack = MAX_STACK;
++
++ public List<ItemStack> getContents() {
++ return this.itemStacks;
++ }
++
++ public void onOpen(CraftHumanEntity who) {
++ transaction.add(who);
++ }
++
++ public void onClose(CraftHumanEntity who) {
++ transaction.remove(who);
++ }
++
++ public List<HumanEntity> getViewers() {
++ return transaction;
++ }
++
++ public InventoryHolder getOwner() {
++ org.bukkit.entity.Entity cart = getBukkitEntity();
++ if(cart instanceof InventoryHolder) return (InventoryHolder) cart;
++ return null;
++ }
++
++ @Override
++ public int getMaxStackSize() {
++ return maxStack;
++ }
++
++ public void setMaxStackSize(int size) {
++ maxStack = size;
++ }
++
++ @Override
++ public Location getLocation() {
++ return getBukkitEntity().getLocation();
++ }
++ // CraftBukkit end
++
+ protected AbstractMinecartContainer(EntityType<?> entityType, Level level) {
+ super(entityType, level);
++ this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); // CraftBukkit - SPIGOT-3513
+ }
+
+- protected AbstractMinecartContainer(EntityType<?> entityType, double x, double y, double z, Level level) {
+- super(entityType, level, x, y, z);
++ protected AbstractMinecartContainer(EntityType<?> entityType, double x, double d1, double y, Level world) {
++ super(entityType, world, x, d1, y);
++ this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); // CraftBukkit - SPIGOT-3513
+ }
+
+ @Override
+@@ -63,8 +115,7 @@
+ }
+
+ @Override
+- public void setChanged() {
+- }
++ public void setChanged() {}
+
+ @Override
+ public boolean stillValid(Player player) {
+@@ -74,7 +125,7 @@
+ @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);
+@@ -93,23 +144,25 @@
+ }
+
+ @Override
+- public InteractionResult interact(Player player, InteractionHand hand) {
++ public InteractionResult interact(Player player, EnumHand hand) {
+ return this.interactWithContainerVehicle(player);
+ }
+
+ @Override
+ protected void applyNaturalSlowdown() {
+ float f = 0.98F;
++
+ if (this.lootTable == null) {
+ int i = 15 - AbstractContainerMenu.getRedstoneSignalFromContainer(this);
+- f += (float)i * 0.001F;
++
++ f += (float) i * 0.001F;
+ }
+
+ if (this.isInWater()) {
+ f *= 0.95F;
+ }
+
+- this.setDeltaMovement(this.getDeltaMovement().multiply((double)f, 0.0, (double)f));
++ this.setDeltaMovement(this.getDeltaMovement().multiply((double) f, 0.0D, (double) f));
+ }
+
+ @Override