3
0
KCauldronX/patches/net/minecraft/item/ItemShears.java.patch

29 lines
1.2 KiB
Diff
Raw Normal View History

2015-03-22 17:38:04 +00:00
--- ../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));