summaryrefslogtreecommitdiffstats
path: root/nms-patches/TileEntityChest.patch
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2016-11-17 12:41:03 +1100
committermd_5 <git@md-5.net>2016-11-17 12:41:03 +1100
commitc25ddf063a808e3adb749e22017661f403c5fb7e (patch)
treeb2efcff512be12fd3e38cf8c36386148ce6ab4ae /nms-patches/TileEntityChest.patch
parent51263e97187a84338f89698eef187284055a682a (diff)
downloadcraftbukkit-c25ddf063a808e3adb749e22017661f403c5fb7e.tar
craftbukkit-c25ddf063a808e3adb749e22017661f403c5fb7e.tar.gz
craftbukkit-c25ddf063a808e3adb749e22017661f403c5fb7e.tar.lz
craftbukkit-c25ddf063a808e3adb749e22017661f403c5fb7e.tar.xz
craftbukkit-c25ddf063a808e3adb749e22017661f403c5fb7e.zip
Update to Minecraft 1.11
Diffstat (limited to 'nms-patches/TileEntityChest.patch')
-rw-r--r--nms-patches/TileEntityChest.patch58
1 files changed, 26 insertions, 32 deletions
diff --git a/nms-patches/TileEntityChest.patch b/nms-patches/TileEntityChest.patch
index 1dfb8f18..c302cf64 100644
--- a/nms-patches/TileEntityChest.patch
+++ b/nms-patches/TileEntityChest.patch
@@ -1,26 +1,25 @@
--- a/net/minecraft/server/TileEntityChest.java
+++ b/net/minecraft/server/TileEntityChest.java
-@@ -4,6 +4,11 @@
+@@ -3,6 +3,10 @@
+ import java.util.Iterator;
import java.util.List;
import javax.annotation.Nullable;
-
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
-+
- public class TileEntityChest extends TileEntityLootable implements ITickable, IInventory {
- private ItemStack[] items = new ItemStack[27];
-@@ -21,6 +26,31 @@
+ public class TileEntityChest extends TileEntityLootable implements ITickable {
- public TileEntityChest() {}
+@@ -18,6 +22,31 @@
+ private int q;
+ private BlockChest.Type r;
+ // CraftBukkit start - add fields and methods
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ private int maxStack = MAX_STACK;
+
-+ public ItemStack[] getContents() {
++ public List<ItemStack> getContents() {
+ return this.items;
+ }
+
@@ -41,10 +40,10 @@
+ }
+ // CraftBukkit end
+
- public TileEntityChest(BlockChest.Type blockchest_type) {
- this.q = blockchest_type;
+ public TileEntityChest() {
+ this.items = NonNullList.a(27, ItemStack.a);
}
-@@ -127,10 +157,11 @@
+@@ -82,7 +111,7 @@
}
public int getMaxStackSize() {
@@ -52,12 +51,8 @@
+ return maxStack; // CraftBukkit
}
- public boolean a(EntityHuman entityhuman) {
-+ if (this.world == null) return true; // CraftBukkit
- return this.world.getTileEntity(this.position) != this ? false : entityhuman.e((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D;
- }
-
-@@ -307,9 +338,21 @@
+ public void invalidateBlockCache() {
+@@ -258,9 +287,21 @@
if (this.l < 0) {
this.l = 0;
}
@@ -76,41 +71,40 @@
+ }
+ }
+ // CraftBukkit end
- this.world.applyPhysics(this.position, this.getBlock());
- this.world.applyPhysics(this.position.down(), this.getBlock());
- }
-@@ -318,8 +361,20 @@
+ this.world.applyPhysics(this.position, this.getBlock(), false);
+ if (this.p() == BlockChest.Type.TRAP) {
+ this.world.applyPhysics(this.position.down(), this.getBlock(), false);
+@@ -271,12 +312,21 @@
public void closeContainer(EntityHuman entityhuman) {
if (!entityhuman.isSpectator() && this.getBlock() instanceof BlockChest) {
+ int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added
--this.l;
-+ if (this.world == null) return; // CraftBukkit
this.world.playBlockAction(this.position, this.getBlock(), 1, this.l);
+ this.world.applyPhysics(this.position, this.getBlock(), false);
+
+ // CraftBukkit start - Call redstone event
-+ if (this.getBlock() == Blocks.TRAPPED_CHEST) {
+ if (this.p() == BlockChest.Type.TRAP) {
+ int newPower = Math.max(0, Math.min(15, this.l));
+
+ if (oldPower != newPower) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, position.getX(), position.getY(), position.getZ(), oldPower, newPower);
+ }
-+ }
+ this.world.applyPhysics(this.position.down(), this.getBlock(), false);
+ }
+ // CraftBukkit end
- this.world.applyPhysics(this.position, this.getBlock());
- this.world.applyPhysics(this.position.down(), this.getBlock());
}
-@@ -376,6 +431,13 @@
}
-
+@@ -311,4 +361,11 @@
+ protected NonNullList<ItemStack> q() {
+ return this.items;
+ }
++
+ // CraftBukkit start
+ @Override
+ public boolean isFilteredNBT() {
+ return true;
+ }
+ // CraftBukkit end
-+
- static class SyntheticClass_1 {
-
- static final int[] a = new int[EnumDirection.values().length];
+ }