3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-19 04:50:06 +01:00

Fix door physics and revert to pre 1.0 behavior

Dieser Commit ist enthalten in:
Tahg 2012-01-07 18:38:05 -05:00
Ursprung 483a619e8a
Commit b74a69041e
2 geänderte Dateien mit 10 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -142,8 +142,7 @@ public class BlockDoor extends Block {
if (world.getTypeId(i, j - 1, k) != this.id) { if (world.getTypeId(i, j - 1, k) != this.id) {
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} }
else if (l > 0 && l != this.id) { // CraftBukkit
if (l > 0 && l != this.id) {
this.doPhysics(world, i, j - 1, k, l); this.doPhysics(world, i, j - 1, k, l);
} }
} else { } else {
@ -166,8 +165,8 @@ public class BlockDoor extends Block {
if (!world.isStatic) { if (!world.isStatic) {
this.b(world, i, j, k, i1, 0); 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.World bworld = world.getWorld();
org.bukkit.block.Block block = bworld.getBlockAt(i, j, k); org.bukkit.block.Block block = bworld.getBlockAt(i, j, k);
org.bukkit.block.Block blockTop = bworld.getBlockAt(i, j + 1, k); org.bukkit.block.Block blockTop = bworld.getBlockAt(i, j + 1, k);

Datei anzeigen

@ -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) { 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); 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) { 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 b0 = 0;
byte b1 = 0; byte b1 = 0;
@ -93,30 +93,22 @@ public class ItemDoor extends Item {
} }
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
world.suppressPhysics = true; world.suppressPhysics = true;
world.setTypeIdAndData(i, j, k, block.id, l); world.setTypeIdAndData(i, j, k, block.id, l);
world.suppressPhysics = false; // CraftBukkit start
world.applyPhysics(i, j, k, block.id);
if (entityhuman != null) { 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()) { if (event.isCancelled() || !event.canBuild()) {
event.getBlockPlaced().setTypeIdAndData(blockState.getTypeId(), blockState.getRawData(), false); event.getBlockPlaced().setTypeIdAndData(blockState.getTypeId(), blockState.getRawData(), false);
return false; return false;
} }
} }
//CraftBukkit end
world.suppressPhysics = true;
world.setTypeIdAndData(i, j + 1, k, block.id, l + 8); world.setTypeIdAndData(i, j + 1, k, block.id, l + 8);
world.suppressPhysics = false; world.suppressPhysics = false;
world.applyPhysics(i, j, k, block.id);
// world.applyPhysics(i, j, k, block.id); // CraftBukkit - moved up
world.applyPhysics(i, j + 1, k, block.id); world.applyPhysics(i, j + 1, k, block.id);
return true; // CraftBukkit
return true;
// CraftBukkit end
} }
} }