diff options
author | md_5 <git@md-5.net> | 2018-07-15 10:00:00 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-07-15 10:00:00 +1000 |
commit | 421c1728c81e2f729dff88da2ac96535d2b8e5e8 (patch) | |
tree | 6c51d93e811d1eb86b68461a42fc5cf03b168b0c /nms-patches/TileEntityChest.patch | |
parent | 57ab4cfc6f4ff526d44319d9b8c79f6848db2de7 (diff) | |
download | craftbukkit-421c1728c81e2f729dff88da2ac96535d2b8e5e8.tar craftbukkit-421c1728c81e2f729dff88da2ac96535d2b8e5e8.tar.gz craftbukkit-421c1728c81e2f729dff88da2ac96535d2b8e5e8.tar.lz craftbukkit-421c1728c81e2f729dff88da2ac96535d2b8e5e8.tar.xz craftbukkit-421c1728c81e2f729dff88da2ac96535d2b8e5e8.zip |
Update to Minecraft 1.13-pre7
Diffstat (limited to 'nms-patches/TileEntityChest.patch')
-rw-r--r-- | nms-patches/TileEntityChest.patch | 66 |
1 files changed, 31 insertions, 35 deletions
diff --git a/nms-patches/TileEntityChest.patch b/nms-patches/TileEntityChest.patch index c302cf64..80ec4086 100644 --- a/nms-patches/TileEntityChest.patch +++ b/nms-patches/TileEntityChest.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/server/TileEntityChest.java +++ b/net/minecraft/server/TileEntityChest.java -@@ -3,6 +3,10 @@ +@@ -2,6 +2,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; @@ -11,9 +11,9 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { -@@ -18,6 +22,31 @@ - private int q; - private BlockChest.Type r; +@@ -11,6 +15,31 @@ + protected int f; + private int k; + // CraftBukkit start - add fields and methods + public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>(); @@ -40,10 +40,10 @@ + } + // CraftBukkit end + - public TileEntityChest() { + protected TileEntityChest(TileEntityTypes<?> tileentitytypes) { + super(tileentitytypes); this.items = NonNullList.a(27, ItemStack.a); - } -@@ -82,7 +111,7 @@ +@@ -75,7 +104,7 @@ } public int getMaxStackSize() { @@ -51,54 +51,50 @@ + return maxStack; // CraftBukkit } - public void invalidateBlockCache() { -@@ -258,9 +287,21 @@ - if (this.l < 0) { - this.l = 0; + public void X_() { +@@ -170,8 +199,20 @@ + if (this.f < 0) { + this.f = 0; } -+ int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added ++ int oldPower = Math.max(0, Math.min(15, this.f)); // CraftBukkit - Get power before new viewer is added - ++this.l; + ++this.f; + if (this.world == null) return; // CraftBukkit - this.world.playBlockAction(this.position, this.getBlock(), 1, this.l); + + // CraftBukkit start - Call redstone event + if (this.getBlock() == Blocks.TRAPPED_CHEST) { -+ int newPower = Math.max(0, Math.min(15, this.l)); ++ int newPower = Math.max(0, Math.min(15, this.f)); + + if (oldPower != newPower) { -+ org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, position.getX(), position.getY(), position.getZ(), oldPower, newPower); ++ org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, position, oldPower, newPower); + } + } + // CraftBukkit end - 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 @@ + this.p(); + } + +@@ -179,7 +220,18 @@ 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; - this.world.playBlockAction(this.position, this.getBlock(), 1, this.l); - this.world.applyPhysics(this.position, this.getBlock(), false); + if (!entityhuman.isSpectator()) { ++ int oldPower = Math.max(0, Math.min(15, this.f)); // CraftBukkit - Get power before new viewer is added + --this.f; + + // CraftBukkit start - Call redstone event - if (this.p() == BlockChest.Type.TRAP) { -+ int newPower = Math.max(0, Math.min(15, this.l)); ++ if (this.getBlock() == Blocks.TRAPPED_CHEST) { ++ int newPower = Math.max(0, Math.min(15, this.f)); + + if (oldPower != newPower) { -+ org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, position.getX(), position.getY(), position.getZ(), oldPower, newPower); ++ org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, position, oldPower, newPower); + } - this.world.applyPhysics(this.position.down(), this.getBlock(), false); - } ++ } + // CraftBukkit end + this.p(); } - } -@@ -311,4 +361,11 @@ - protected NonNullList<ItemStack> q() { - return this.items; +@@ -232,4 +284,11 @@ + tileentitychest.a(tileentitychest1.q()); + tileentitychest1.a(nonnulllist); } + + // CraftBukkit start |