1
0
forked from xjboss/KCauldronX
KCauldronX/patches/net/minecraft/item/ItemShears.java.patch
2015-03-22 20:38:04 +03:00

29 lines
1.2 KiB
Diff

--- ../src-base/minecraft/net/minecraft/item/ItemShears.java
+++ ../src-work/minecraft/net/minecraft/item/ItemShears.java
@@ -3,6 +3,8 @@
import java.util.ArrayList;
import java.util.Random;
+import org.bukkit.event.player.PlayerShearEntityEvent;
+
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
@@ -61,6 +63,16 @@
IShearable target = (IShearable)entity;
if (target.isShearable(itemstack, entity.worldObj, (int)entity.posX, (int)entity.posY, (int)entity.posZ))
{
+ // Cauldron start
+ PlayerShearEntityEvent event = new PlayerShearEntityEvent((org.bukkit.entity.Player) player.getBukkitEntity(), entity.getBukkitEntity());
+ player.worldObj.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled())
+ {
+ return false;
+ }
+
+ // Cauldron end
ArrayList<ItemStack> drops = target.onSheared(itemstack, entity.worldObj, (int)entity.posX, (int)entity.posY, (int)entity.posZ,
EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack));