mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 14:33:56 +01:00
Add special case for handling place event with lilies. Fixes BUKKIT-5641
This commit is contained in:
parent
1c13d076af
commit
1b48298d25
@ -26,7 +26,15 @@ public class ItemWaterLily extends ItemWithAuxData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (world.getType(i, j, k).getMaterial() == Material.WATER && world.getData(i, j, k) == 0 && world.isEmpty(i, j + 1, k)) {
|
if (world.getType(i, j, k).getMaterial() == Material.WATER && world.getData(i, j, k) == 0 && world.isEmpty(i, j + 1, k)) {
|
||||||
|
// CraftBukkit start - special case for handling block placement with water lilies
|
||||||
|
org.bukkit.block.BlockState blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(world, i, j + 1, k);
|
||||||
world.setTypeUpdate(i, j + 1, k, Blocks.WATER_LILY);
|
world.setTypeUpdate(i, j + 1, k, Blocks.WATER_LILY);
|
||||||
|
org.bukkit.event.block.BlockPlaceEvent placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockstate, i, j, k);
|
||||||
|
if (placeEvent != null && (placeEvent.isCancelled() || !placeEvent.canBuild())) {
|
||||||
|
blockstate.update(true, false);
|
||||||
|
return itemstack;
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||||
--itemstack.count;
|
--itemstack.count;
|
||||||
|
@ -610,7 +610,7 @@ public class PlayerConnection implements PacketPlayInListener {
|
|||||||
// CraftBukkit - notch decrements the counter by 1 in the above method with food,
|
// CraftBukkit - notch decrements the counter by 1 in the above method with food,
|
||||||
// snowballs and so forth, but he does it in a place that doesn't cause the
|
// snowballs and so forth, but he does it in a place that doesn't cause the
|
||||||
// inventory update packet to get sent
|
// inventory update packet to get sent
|
||||||
always = (itemstack.count != itemstackAmount);
|
always = (itemstack.count != itemstackAmount) || itemstack.getItem() == Item.getItemOf(Blocks.WATER_LILY);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
} else if (packetplayinblockplace.d() >= this.minecraftServer.getMaxBuildHeight() - 1 && (packetplayinblockplace.getFace() == 1 || packetplayinblockplace.d() >= this.minecraftServer.getMaxBuildHeight())) {
|
} else if (packetplayinblockplace.d() >= this.minecraftServer.getMaxBuildHeight() - 1 && (packetplayinblockplace.getFace() == 1 || packetplayinblockplace.d() >= this.minecraftServer.getMaxBuildHeight())) {
|
||||||
ChatMessage chatmessage = new ChatMessage("build.tooHigh", new Object[] { Integer.valueOf(this.minecraftServer.getMaxBuildHeight())});
|
ChatMessage chatmessage = new ChatMessage("build.tooHigh", new Object[] { Integer.valueOf(this.minecraftServer.getMaxBuildHeight())});
|
||||||
|
Loading…
Reference in New Issue
Block a user