3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-17 05:20:05 +01:00

Fix BLOCK_PLACED when placing on snow/step

Dieser Commit ist enthalten in:
Erik Broes 2011-03-18 22:57:22 +01:00
Ursprung 1144013362
Commit 778079677e

Datei anzeigen

@ -67,19 +67,21 @@ public class ItemBlock extends Item {
* rather than the block touching the face we clicked on. * rather than the block touching the face we clicked on.
*/ */
int typeId = blockClicked.getTypeId(); int typeId = blockClicked.getTypeId();
org.bukkit.block.Block replacedBlock = blockClicked.getFace(faceClicked); org.bukkit.block.Block placedBlock = blockClicked.getFace(faceClicked);
if (typeId == Block.SNOW.id || (typeId == Block.STEP.id && itemstack.id == Block.STEP.id && faceClicked == BlockFace.UP)) if (typeId == Block.SNOW.id || (typeId == Block.STEP.id && itemstack.id == Block.STEP.id && faceClicked == BlockFace.UP))
replacedBlock = blockClicked; placedBlock = blockClicked;
final BlockState replacedBlockState = new CraftBlockState(replacedBlock); final BlockState replacedBlockState = new CraftBlockState(placedBlock);
// CraftBukkit end // CraftBukkit end
if (world.a(this.a, i, j, k, false)) { if (world.a(this.a, i, j, k, false)) {
Block block = Block.byId[this.a]; Block block = Block.byId[this.a];
// CraftBukkit start - This executes the placement of the block // CraftBukkit start - This executes the placement of the block
/* /**
* @see net.minecraft.server.World#b(int i, int j, int k, int l, int i1)
*
* 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.
@ -90,9 +92,8 @@ public class ItemBlock extends Item {
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;
org.bukkit.block.Block placedBlock = blockClicked.getFace(faceClicked) ;
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack); org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
Player thePlayer = (entityhuman ==null) ? null : (Player) entityhuman.getBukkitEntity(); Player thePlayer = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
ChunkCoordinates chunkcoordinates = world.l(); ChunkCoordinates chunkcoordinates = world.l();
int spawnX = chunkcoordinates.a; int spawnX = chunkcoordinates.a;