38 lines
1.6 KiB
Diff
38 lines
1.6 KiB
Diff
--- a/net/minecraft/world/item/ItemBlockWallable.java
|
|
+++ b/net/minecraft/world/item/ItemBlockWallable.java
|
|
@@ -10,6 +10,13 @@
|
|
import net.minecraft.world.level.block.state.IBlockData;
|
|
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
|
|
|
+// CraftBukkit start
|
|
+import net.minecraft.server.level.EntityPlayer;
|
|
+import org.bukkit.craftbukkit.block.CraftBlock;
|
|
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
|
+import org.bukkit.event.block.BlockCanBuildEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public class ItemBlockWallable extends ItemBlock {
|
|
|
|
public final Block wallBlock;
|
|
@@ -44,7 +51,19 @@
|
|
}
|
|
}
|
|
|
|
- return iblockdata1 != null && iworldreader.isUnobstructed(iblockdata1, blockposition, VoxelShapeCollision.empty()) ? iblockdata1 : null;
|
|
+ // CraftBukkit start
|
|
+ if (iblockdata1 != null) {
|
|
+ boolean defaultReturn = iworldreader.isUnobstructed(iblockdata1, blockposition, VoxelShapeCollision.empty());
|
|
+ org.bukkit.entity.Player player = (blockactioncontext.getPlayer() instanceof EntityPlayer) ? (org.bukkit.entity.Player) blockactioncontext.getPlayer().getBukkitEntity() : null;
|
|
+
|
|
+ BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getLevel(), blockposition), player, CraftBlockData.fromData(iblockdata1), defaultReturn);
|
|
+ blockactioncontext.getLevel().getCraftServer().getPluginManager().callEvent(event);
|
|
+
|
|
+ return (event.isBuildable()) ? iblockdata1 : null;
|
|
+ } else {
|
|
+ return null;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
@Override
|