Archiviert
13
0

Half-step placement bug fix, all credits to Brettflan

Dieser Commit ist enthalten in:
VictorD 2011-02-03 22:34:22 +01:00
Ursprung 3a19f9e429
Commit 059d23b4c9

Datei anzeigen

@ -66,9 +66,14 @@ public class ItemBlock extends Item {
} else { } else {
// CraftBukkit start // CraftBukkit start
/* We store the old data so we can undo it. Snow(78) and half-steps(44) are special in that they replace the block itself, /* We store the old data so we can undo it. Snow(78) and half-steps(44) are special in that they replace the block itself,
* rather than the block touching the face we clicked on. * rather than the block touching the face we clicked on.
*/ */
org.bukkit.block.Block replacedBlock = ( blockClicked.getTypeId() == Block.SNOW.id || (blockClicked.getTypeId() == Block.STEP.id && itemstack.id == Block.STEP.id && faceClicked == BlockFace.UP) ) ? blockClicked : blockClicked.getFace(faceClicked); int typeId = blockClicked.getTypeId();
org.bukkit.block.Block replacedBlock = blockClicked.getFace(faceClicked);
if (typeId == Block.SNOW.id || (typeId == Block.STEP.id && itemstack.id == Block.STEP.id && faceClicked == BlockFace.UP))
replacedBlock = blockClicked;
final BlockState replacedBlockState = new CraftBlockState(replacedBlock); final BlockState replacedBlockState = new CraftBlockState(replacedBlock);
// CraftBukkit end // CraftBukkit end
@ -77,13 +82,13 @@ public class ItemBlock extends Item {
// CraftBukkit start - This executes the placement of the block // CraftBukkit start - This executes the placement of the block
/* /*
* This replaces world.b(IIIII), we're doing this because we need to * This replaces world.b(IIIII), we're doing this because we need to
* hook between the 'placement' and the informing to 'world' so we can * hook between the 'placement' and the informing to 'world' so we can
* sanely undo this. * sanely undo this.
* *
* Whenever the call to 'world.b' changes we need to figure out again what to * Whenever the call to 'world.b' changes we need to figure out again what to
* replace this with. * replace this with.
*/ */
if (world.setTypeIdAndData(i, j, k, a, a(itemstack.h()))) { // <-- world.b does this to place the block if (world.setTypeIdAndData(i, j, k, a, a(itemstack.h()))) { // <-- world.b does this to place the block
org.bukkit.Server server = ((WorldServer) world).getServer(); org.bukkit.Server server = ((WorldServer) world).getServer();
Type eventType = Type.BLOCK_PLACED; Type eventType = Type.BLOCK_PLACED;