mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 02:20:01 +03:00
29 lines
1.3 KiB
Diff
29 lines
1.3 KiB
Diff
--- ../src-base/minecraft/net/minecraft/item/ItemHangingEntity.java
|
|
+++ ../src-work/minecraft/net/minecraft/item/ItemHangingEntity.java
|
|
@@ -11,6 +11,8 @@
|
|
import net.minecraft.util.EnumHand;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.world.World;
|
|
+import org.bukkit.entity.Player;
|
|
+import org.bukkit.event.hanging.HangingPlaceEvent;
|
|
|
|
public class ItemHangingEntity extends Item
|
|
{
|
|
@@ -35,6 +37,16 @@
|
|
{
|
|
if (!worldIn.isRemote)
|
|
{
|
|
+ Player who = (player == null) ? null : (Player) player.getBukkitEntity();
|
|
+ org.bukkit.block.Block blockClicked = worldIn.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
|
+ org.bukkit.block.BlockFace blockFace = org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(facing);
|
|
+
|
|
+ HangingPlaceEvent event = new HangingPlaceEvent((org.bukkit.entity.Hanging) entityhanging.getBukkitEntity(), who, blockClicked, blockFace);
|
|
+ worldIn.getServer().getPluginManager().callEvent(event);
|
|
+
|
|
+ if (event.isCancelled()) {
|
|
+ return EnumActionResult.FAIL;
|
|
+ }
|
|
entityhanging.playPlaceSound();
|
|
worldIn.spawnEntity(entityhanging);
|
|
}
|