2016-06-30 07:39:58 +02:00
|
|
|
--- a/net/minecraft/server/ItemBlock.java
|
|
|
|
+++ b/net/minecraft/server/ItemBlock.java
|
2018-07-15 02:00:00 +02:00
|
|
|
@@ -2,6 +2,11 @@
|
2016-06-30 07:39:58 +02:00
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
import java.util.Map;
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.block.CraftBlock;
|
|
|
|
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
|
|
|
+import org.bukkit.event.block.BlockCanBuildEvent;
|
|
|
|
+// CraftBukkit end
|
|
|
|
|
|
|
|
public class ItemBlock extends Item {
|
|
|
|
|
|
|
|
@@ -45,7 +50,7 @@
|
|
|
|
|
|
|
|
SoundEffectType soundeffecttype = block.getStepSound();
|
2016-06-30 07:39:58 +02:00
|
|
|
|
|
|
|
- world.a(entityhuman, blockposition, soundeffecttype.e(), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F);
|
|
|
|
+ // world.a(entityhuman, blockposition, soundeffecttype.e(), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F); // CraftBukkit - SPIGOT-1288
|
2016-11-17 02:41:03 +01:00
|
|
|
itemstack.subtract(1);
|
2018-07-15 02:00:00 +02:00
|
|
|
return EnumInteractionResult.SUCCESS;
|
2016-06-30 07:39:58 +02:00
|
|
|
}
|
2018-11-17 23:27:46 +01:00
|
|
|
@@ -64,7 +69,15 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected boolean b(BlockActionContext blockactioncontext, IBlockData iblockdata) {
|
|
|
|
- return iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition());
|
|
|
|
+ // CraftBukkit start - store default return
|
|
|
|
+ boolean defaultReturn = iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition());
|
2018-11-17 23:27:46 +01:00
|
|
|
+ org.bukkit.entity.Player player = (blockactioncontext.getEntity() instanceof EntityPlayer) ? (org.bukkit.entity.Player) blockactioncontext.getEntity().getBukkitEntity() : null;
|
2018-07-15 02:00:00 +02:00
|
|
|
+
|
2018-11-17 23:27:46 +01:00
|
|
|
+ BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), player, CraftBlockData.fromData(iblockdata), defaultReturn);
|
2018-07-15 02:00:00 +02:00
|
|
|
+ blockactioncontext.getWorld().getServer().getPluginManager().callEvent(event);
|
|
|
|
+
|
|
|
|
+ return event.isBuildable();
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
2016-06-30 07:39:58 +02:00
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
protected boolean a(BlockActionContext blockactioncontext, IBlockData iblockdata) {
|