diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2013-03-13 17:33:27 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2013-03-15 13:28:59 -0500 |
commit | 83d29e461c85733f0113b6eb19db6e3b42da2949 (patch) | |
tree | b3063a1c28f478ab368d5ba3413a842def68c28f /src/main/java/net/minecraft/server/BlockMinecartDetector.java | |
parent | ba6e4c38cfa98ad291974195cc46d70a4f138ac1 (diff) | |
download | craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.gz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.lz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.xz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.zip |
Update CraftBukkit to Minecraft 1.5
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockMinecartDetector.java')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockMinecartDetector.java | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/src/main/java/net/minecraft/server/BlockMinecartDetector.java b/src/main/java/net/minecraft/server/BlockMinecartDetector.java index 93d13625..3469207e 100644 --- a/src/main/java/net/minecraft/server/BlockMinecartDetector.java +++ b/src/main/java/net/minecraft/server/BlockMinecartDetector.java @@ -5,14 +5,14 @@ import java.util.Random; import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit -public class BlockMinecartDetector extends BlockMinecartTrack { +public class BlockMinecartDetector extends BlockMinecartTrackAbstract { - public BlockMinecartDetector(int i, int j) { - super(i, j, true); + public BlockMinecartDetector(int i) { + super(i, true); this.b(true); } - public int r_() { + public int a(World world) { return 20; } @@ -30,7 +30,7 @@ public class BlockMinecartDetector extends BlockMinecartTrack { } } - public void b(World world, int i, int j, int k, Random random) { + public void a(World world, int i, int j, int k, Random random) { if (!world.isStatic) { int l = world.getData(i, j, k); @@ -40,19 +40,19 @@ public class BlockMinecartDetector extends BlockMinecartTrack { } } - public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) { - return (iblockaccess.getData(i, j, k) & 8) != 0; + public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) { + return (iblockaccess.getData(i, j, k) & 8) != 0 ? 15 : 0; } - public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) { - return (iblockaccess.getData(i, j, k) & 8) == 0 ? false : l == 1; + public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) { + return (iblockaccess.getData(i, j, k) & 8) == 0 ? 0 : (l == 1 ? 15 : 0); } private void d(World world, int i, int j, int k, int l) { boolean flag = (l & 8) != 0; boolean flag1 = false; float f = 0.125F; - List list = world.a(EntityMinecart.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f))); + List list = world.a(EntityMinecartAbstract.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f))); if (!list.isEmpty()) { flag1 = true; @@ -62,7 +62,7 @@ public class BlockMinecartDetector extends BlockMinecartTrack { if (flag != flag1) { org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k); - BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0); + BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 15 : 0, flag1 ? 15 : 0); world.getServer().getPluginManager().callEvent(eventRedstone); flag1 = eventRedstone.getNewCurrent() > 0; @@ -70,21 +70,45 @@ public class BlockMinecartDetector extends BlockMinecartTrack { // CraftBukkit end if (flag1 && !flag) { - world.setData(i, j, k, l | 8); + world.setData(i, j, k, l | 8, 3); world.applyPhysics(i, j, k, this.id); world.applyPhysics(i, j - 1, k, this.id); - world.e(i, j, k, i, j, k); + world.g(i, j, k, i, j, k); } if (!flag1 && flag) { - world.setData(i, j, k, l & 7); + world.setData(i, j, k, l & 7, 3); world.applyPhysics(i, j, k, this.id); world.applyPhysics(i, j - 1, k, this.id); - world.e(i, j, k, i, j, k); + world.g(i, j, k, i, j, k); } if (flag1) { - world.a(i, j, k, this.id, this.r_()); + world.a(i, j, k, this.id, this.a(world)); } + + world.m(i, j, k, this.id); + } + + public void onPlace(World world, int i, int j, int k) { + super.onPlace(world, i, j, k); + this.d(world, i, j, k, world.getData(i, j, k)); + } + + public boolean q_() { + return true; + } + + public int b_(World world, int i, int j, int k, int l) { + if ((world.getData(i, j, k) & 8) > 0) { + float f = 0.125F; + List list = world.a(EntityMinecartAbstract.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f)), IEntitySelector.b); + + if (list.size() > 0) { + return Container.b((IInventory) list.get(0)); + } + } + + return 0; } } |