mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 13:07:06 +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
This commit is contained in:
parent
9df87d3399
commit
f1efe717bd
1 changed files with 7 additions and 16 deletions
|
@ -1,7 +1,5 @@
|
||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.block.CraftBlockState; // CraftBukkit
|
|
||||||
|
|
||||||
public class ItemSkull extends Item {
|
public class ItemSkull extends Item {
|
||||||
|
|
||||||
private static final String[] a = new String[] { "skeleton", "wither", "zombie", "char", "creeper"};
|
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()) {
|
} else if (!world.getMaterial(i, j, k).isBuildable()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
|
|
||||||
|
|
||||||
if (l == 1) {
|
if (l == 1) {
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
@ -47,9 +43,13 @@ public class ItemSkull extends Item {
|
||||||
} else if (!Block.SKULL.canPlace(world, i, j, k)) {
|
} else if (!Block.SKULL.canPlace(world, i, j, k)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
// CraftBukkit start - handle in ItemBlock
|
||||||
|
// world.setTypeIdAndData(i, j, k, Block.SKULL.id, l);
|
||||||
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;
|
int i1 = 0;
|
||||||
|
|
||||||
if (l == 1) {
|
if (l == 1) {
|
||||||
|
@ -70,15 +70,6 @@ public class ItemSkull extends Item {
|
||||||
((BlockSkull) Block.SKULL).a(world, i, j, k, (TileEntitySkull) tileentity);
|
((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;
|
--itemstack.count;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue