diff options
author | Matthew <stteg@hotmail.com> | 2016-03-16 20:50:55 -0400 |
---|---|---|
committer | md_5 <git@md-5.net> | 2016-03-18 14:30:03 +1100 |
commit | da444904c207e8030a50c084f864b37e3d5a763a (patch) | |
tree | 798856c18507555f4c5cd337b4efb083727b7ebc | |
parent | 6efa87306bf6549864182edd77b989b90fa1a637 (diff) | |
download | craftbukkit-da444904c207e8030a50c084f864b37e3d5a763a.tar craftbukkit-da444904c207e8030a50c084f864b37e3d5a763a.tar.gz craftbukkit-da444904c207e8030a50c084f864b37e3d5a763a.tar.lz craftbukkit-da444904c207e8030a50c084f864b37e3d5a763a.tar.xz craftbukkit-da444904c207e8030a50c084f864b37e3d5a763a.zip |
Implement EndGateway state
3 files changed, 52 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index dc258975..03d8afb9 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -272,6 +272,8 @@ public class CraftBlock implements Block { return new CraftDispenser(this); case DROPPER: return new CraftDropper(this); + case END_GATEWAY: + return new CraftEndGateway(this); case HOPPER: return new CraftHopper(this); case MOB_SPAWNER: diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftEndGateway.java b/src/main/java/org/bukkit/craftbukkit/block/CraftEndGateway.java new file mode 100644 index 00000000..ed0e609d --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftEndGateway.java @@ -0,0 +1,40 @@ +package org.bukkit.craftbukkit.block; + +import net.minecraft.server.TileEntityEndGateway; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.EndGateway; +import org.bukkit.craftbukkit.CraftWorld; + +public class CraftEndGateway extends CraftBlockState implements EndGateway { + + private TileEntityEndGateway gateway; + + public CraftEndGateway(Block block) { + super(block); + + CraftWorld world = (CraftWorld) block.getWorld(); + gateway = (TileEntityEndGateway) world.getTileEntityAt(getX(), getY(), getZ()); + } + + public CraftEndGateway(final Material material, TileEntityEndGateway te) { + super(material); + this.gateway = te; + } + + @Override + public boolean update(boolean force, boolean applyPhysics) { + boolean result = super.update(force, applyPhysics); + + if (result) { + gateway.update(); + } + + return result; + } + + @Override + public TileEntityEndGateway getTileEntity() { + return gateway; + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java index 1ee36a94..6737fad5 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java @@ -15,6 +15,7 @@ import net.minecraft.server.TileEntityChest; import net.minecraft.server.TileEntityCommand; import net.minecraft.server.TileEntityDispenser; import net.minecraft.server.TileEntityDropper; +import net.minecraft.server.TileEntityEndGateway; import net.minecraft.server.TileEntityFurnace; import net.minecraft.server.TileEntityHopper; import net.minecraft.server.TileEntityMobSpawner; @@ -34,6 +35,7 @@ import org.bukkit.craftbukkit.block.CraftCommandBlock; import org.bukkit.craftbukkit.block.CraftCreatureSpawner; import org.bukkit.craftbukkit.block.CraftDispenser; import org.bukkit.craftbukkit.block.CraftDropper; +import org.bukkit.craftbukkit.block.CraftEndGateway; import org.bukkit.craftbukkit.block.CraftFurnace; import org.bukkit.craftbukkit.block.CraftHopper; import org.bukkit.craftbukkit.block.CraftJukebox; @@ -222,6 +224,11 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta te = new TileEntityDispenser(); } return new CraftDropper(material, (TileEntityDropper) te); + case END_GATEWAY: + if (te == null) { + te = new TileEntityEndGateway(); + } + return new CraftEndGateway(material, (TileEntityEndGateway) te); case HOPPER: if (te == null) { te = new TileEntityHopper(); @@ -304,6 +311,9 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta case DROPPER: valid = te instanceof TileEntityDropper; break; + case END_GATEWAY: + valid = te instanceof TileEntityEndGateway; + break; case HOPPER: valid = te instanceof TileEntityHopper; break; |