diff --git a/nms-patches/EntitySnowman.patch b/nms-patches/EntitySnowman.patch index 029613e448..bf919be5b2 100644 --- a/nms-patches/EntitySnowman.patch +++ b/nms-patches/EntitySnowman.patch @@ -1,18 +1,17 @@ --- a/net/minecraft/server/EntitySnowman.java +++ b/net/minecraft/server/EntitySnowman.java -@@ -1,6 +1,11 @@ +@@ -1,6 +1,10 @@ package net.minecraft.server; import javax.annotation.Nullable; +// CraftBukkit start +import org.bukkit.craftbukkit.event.CraftEventFactory; -+import org.bukkit.craftbukkit.util.CraftMagicNumbers; -+import org.bukkit.event.block.EntityBlockFormEvent; ++import org.bukkit.event.player.PlayerShearEntityEvent; +// CraftBukkit end public class EntitySnowman extends EntityGolem implements IRangedEntity { -@@ -59,7 +64,7 @@ +@@ -59,7 +63,7 @@ } if (this.world.getBiome(new BlockPosition(i, 0, k)).a(new BlockPosition(i, j, k)) > 1.0F) { @@ -21,7 +20,7 @@ } if (!this.world.getGameRules().getBoolean("mobGriefing")) { -@@ -73,7 +78,7 @@ +@@ -73,7 +77,7 @@ BlockPosition blockposition = new BlockPosition(i, j, k); if (this.world.getType(blockposition).getMaterial() == Material.AIR && this.world.getBiome(blockposition).a(blockposition) < 0.8F && Blocks.SNOW_LAYER.canPlace(this.world, blockposition)) { @@ -30,3 +29,19 @@ } } } +@@ -106,6 +110,15 @@ + ItemStack itemstack = entityhuman.b(enumhand); + + if (itemstack.getItem() == Items.SHEARS && this.hasPumpkin() && !this.world.isClientSide) { ++ // CraftBukkit start ++ PlayerShearEntityEvent event = new PlayerShearEntityEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), this.getBukkitEntity()); ++ this.world.getServer().getPluginManager().callEvent(event); ++ ++ if (event.isCancelled()) { ++ return false; ++ } ++ // CraftBukkit end ++ + this.setHasPumpkin(false); + itemstack.damage(1, entityhuman); + } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java index eddd605e5f..0349f0a574 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java @@ -12,12 +12,12 @@ public class CraftSnowman extends CraftGolem implements Snowman { @Override public boolean isDerp() { - return getHandle().hasPumpkin(); + return !getHandle().hasPumpkin(); } @Override public void setDerp(boolean derpMode) { - getHandle().setHasPumpkin(derpMode); + getHandle().setHasPumpkin(!derpMode); } @Override