diff options
author | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-11-26 08:32:16 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2014-11-28 17:16:30 +1100 |
commit | 24557bc2b37deb6a0edf497d547471832457b1dd (patch) | |
tree | c560572889a3b0b34964a0cddb35dc87fda3c914 /nms-patches/TileEntityChest.patch | |
parent | a4805dbd77da057cc1ea0bf344379bc6e53ca1f6 (diff) | |
download | craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.gz craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.lz craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.xz craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.zip |
Update to Minecraft 1.8
For more information please see http://www.spigotmc.org/
Diffstat (limited to 'nms-patches/TileEntityChest.patch')
-rw-r--r-- | nms-patches/TileEntityChest.patch | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/nms-patches/TileEntityChest.patch b/nms-patches/TileEntityChest.patch new file mode 100644 index 00000000..52d98548 --- /dev/null +++ b/nms-patches/TileEntityChest.patch @@ -0,0 +1,104 @@ +--- ../work/decompile-bb26c12b/net/minecraft/server/TileEntityChest.java 2014-11-27 08:59:46.905420949 +1100 ++++ src/main/java/net/minecraft/server/TileEntityChest.java 2014-11-27 08:42:10.168850880 +1100 +@@ -3,6 +3,11 @@ + import java.util.Iterator; + import java.util.List; + ++// CraftBukkit start ++import org.bukkit.craftbukkit.entity.CraftHumanEntity; ++import org.bukkit.entity.HumanEntity; ++// CraftBukkit end ++ + public class TileEntityChest extends TileEntityContainer implements IUpdatePlayerListBox, IInventory { + + private ItemStack[] items = new ItemStack[27]; +@@ -19,6 +24,31 @@ + private String p; + + public TileEntityChest() {} ++ ++ // CraftBukkit start - add fields and methods ++ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>(); ++ private int maxStack = MAX_STACK; ++ ++ public ItemStack[] getContents() { ++ return this.items; ++ } ++ ++ public void onOpen(CraftHumanEntity who) { ++ transaction.add(who); ++ } ++ ++ public void onClose(CraftHumanEntity who) { ++ transaction.remove(who); ++ } ++ ++ public List<HumanEntity> getViewers() { ++ return transaction; ++ } ++ ++ public void setMaxStackSize(int size) { ++ maxStack = size; ++ } ++ // CraftBukkit end + + public int getSize() { + return 27; +@@ -125,10 +155,11 @@ + } + + public int getMaxStackSize() { +- return 64; ++ 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; + } + +@@ -304,9 +335,22 @@ + if (this.l < 0) { + this.l = 0; + } ++ ++ 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.w(), 1, this.l); ++ ++ // CraftBukkit start - Call redstone event ++ if (this.w() == Blocks.TRAPPED_CHEST) { ++ 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); ++ } ++ } ++ // CraftBukkit end + this.world.applyPhysics(this.position, this.w()); + this.world.applyPhysics(this.position.down(), this.w()); + } +@@ -315,8 +359,21 @@ + + public void closeContainer(EntityHuman entityhuman) { + if (!entityhuman.v() && this.w() 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.w(), 1, this.l); ++ ++ // CraftBukkit start - Call redstone event ++ if (this.w() == Blocks.TRAPPED_CHEST) { ++ 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); ++ } ++ } ++ // CraftBukkit end + this.world.applyPhysics(this.position, this.w()); + this.world.applyPhysics(this.position.down(), this.w()); + } |