From b74a69041e0a86e3be167babded9399907ed9cce Mon Sep 17 00:00:00 2001 From: Tahg Date: Sat, 7 Jan 2012 18:38:05 -0500 Subject: [PATCH] Fix door physics and revert to pre 1.0 behavior --- .../java/net/minecraft/server/BlockDoor.java | 7 +++--- .../java/net/minecraft/server/ItemDoor.java | 22 ++++++------------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/main/java/net/minecraft/server/BlockDoor.java b/src/main/java/net/minecraft/server/BlockDoor.java index b2482240d2..047b86823a 100644 --- a/src/main/java/net/minecraft/server/BlockDoor.java +++ b/src/main/java/net/minecraft/server/BlockDoor.java @@ -142,8 +142,7 @@ public class BlockDoor extends Block { if (world.getTypeId(i, j - 1, k) != this.id) { world.setTypeId(i, j, k, 0); } - - if (l > 0 && l != this.id) { + else if (l > 0 && l != this.id) { // CraftBukkit this.doPhysics(world, i, j - 1, k, l); } } else { @@ -166,8 +165,8 @@ public class BlockDoor extends Block { if (!world.isStatic) { this.b(world, i, j, k, i1, 0); } - } else if (l > 0 && l != this.id) { - // CraftBukkit start + // CraftBukkit start + } else if (l > 0 && Block.byId[l].isPowerSource()) { org.bukkit.World bworld = world.getWorld(); org.bukkit.block.Block block = bworld.getBlockAt(i, j, k); org.bukkit.block.Block blockTop = bworld.getBlockAt(i, j + 1, k); diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java index fc3dd9c99d..7c1aba2d5e 100644 --- a/src/main/java/net/minecraft/server/ItemDoor.java +++ b/src/main/java/net/minecraft/server/ItemDoor.java @@ -50,12 +50,12 @@ public class ItemDoor extends Item { } public static void a(World world, int i, int j, int k, int l, Block block) { - // CraftBukkit Start + // CraftBukkit start a(world, i, j, k, l, block, null); } public static boolean a(World world, int i, int j, int k, int l, Block block, EntityHuman entityhuman) { - int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit + // CraftBukkit end byte b0 = 0; byte b1 = 0; @@ -93,30 +93,22 @@ public class ItemDoor extends Item { } CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit - world.suppressPhysics = true; world.setTypeIdAndData(i, j, k, block.id, l); - world.suppressPhysics = false; - - world.applyPhysics(i, j, k, block.id); - + // CraftBukkit start if (entityhuman != null) { - BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, block); + BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, i, j, k, block); if (event.isCancelled() || !event.canBuild()) { event.getBlockPlaced().setTypeIdAndData(blockState.getTypeId(), blockState.getRawData(), false); return false; } } - - world.suppressPhysics = true; + //CraftBukkit end world.setTypeIdAndData(i, j + 1, k, block.id, l + 8); world.suppressPhysics = false; - - // world.applyPhysics(i, j, k, block.id); // CraftBukkit - moved up + world.applyPhysics(i, j, k, block.id); world.applyPhysics(i, j + 1, k, block.id); - - return true; - // CraftBukkit end + return true; // CraftBukkit } }