Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
Call BlockPlaceEvent for skulls the same as other blocks. BUKKIT-3406
When the skull BlockPlaceEvent was added it was made so the event would be called after all the data has been set, however this is a behavior change that is inconsistent with other BlockPlaceEvents. Instead, if people wish to get the block data they should schedule a task. Relates to: BUKKIT-3438
Dieser Commit ist enthalten in:
Ursprung
9df87d3399
Commit
f1efe717bd
@ -1,7 +1,5 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState; // CraftBukkit
|
||||
|
||||
public class ItemSkull extends Item {
|
||||
|
||||
private static final String[] a = new String[] { "skeleton", "wither", "zombie", "char", "creeper"};
|
||||
@ -20,8 +18,6 @@ public class ItemSkull extends Item {
|
||||
} else if (!world.getMaterial(i, j, k).isBuildable()) {
|
||||
return false;
|
||||
} else {
|
||||
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
|
||||
|
||||
if (l == 1) {
|
||||
++j;
|
||||
}
|
||||
@ -47,9 +43,13 @@ public class ItemSkull extends Item {
|
||||
} else if (!Block.SKULL.canPlace(world, i, j, k)) {
|
||||
return false;
|
||||
} else {
|
||||
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||
|
||||
world.setTypeIdAndData(i, j, k, Block.SKULL.id, l);
|
||||
// CraftBukkit start - handle in ItemBlock
|
||||
// world.setTypeIdAndData(i, j, k, Block.SKULL.id, l);
|
||||
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, Block.SKULL.id, l)) {
|
||||
return false;
|
||||
}
|
||||
l = world.getData(i, j, k);
|
||||
// CraftBukkit end
|
||||
int i1 = 0;
|
||||
|
||||
if (l == 1) {
|
||||
@ -70,15 +70,6 @@ public class ItemSkull extends Item {
|
||||
((BlockSkull) Block.SKULL).a(world, i, j, k, (TileEntitySkull) tileentity);
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.event.block.BlockPlaceEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ);
|
||||
|
||||
if (event.isCancelled() || !event.canBuild()) {
|
||||
event.getBlockPlaced().setTypeIdAndData(blockState.getTypeId(), blockState.getRawData(), false);
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
--itemstack.count;
|
||||
return true;
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren