summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntitySnowman.patch
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2017-07-15 09:53:22 +1000
committermd_5 <git@md-5.net>2017-07-15 09:53:22 +1000
commite03b1a556d889f5ad47d53a4157bde75cbbf4764 (patch)
tree92b9e64d7936598eef024897c07e3ff045037050 /nms-patches/EntitySnowman.patch
parent6659ddf11a13d7eebea247f8627de0957fc6cc85 (diff)
downloadcraftbukkit-e03b1a556d889f5ad47d53a4157bde75cbbf4764.tar
craftbukkit-e03b1a556d889f5ad47d53a4157bde75cbbf4764.tar.gz
craftbukkit-e03b1a556d889f5ad47d53a4157bde75cbbf4764.tar.lz
craftbukkit-e03b1a556d889f5ad47d53a4157bde75cbbf4764.tar.xz
craftbukkit-e03b1a556d889f5ad47d53a4157bde75cbbf4764.zip
SPIGOT-3417: Event for shearing snowman
Diffstat (limited to 'nms-patches/EntitySnowman.patch')
-rw-r--r--nms-patches/EntitySnowman.patch25
1 files changed, 20 insertions, 5 deletions
diff --git a/nms-patches/EntitySnowman.patch b/nms-patches/EntitySnowman.patch
index 029613e4..bf919be5 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);
+ }