summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntitySnowman.patch
blob: d78d57264ade82c1306d6eef9f8596c3f8cf11c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--- a/net/minecraft/server/EntitySnowman.java
+++ b/net/minecraft/server/EntitySnowman.java
@@ -1,6 +1,10 @@
 package net.minecraft.server;
 
 import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.player.PlayerShearEntityEvent;
+// CraftBukkit end
 
 public class EntitySnowman extends EntityGolem implements IRangedEntity {
 
@@ -55,7 +59,7 @@
             }
 
             if (this.world.getBiome(new BlockPosition(i, 0, k)).c(new BlockPosition(i, j, k)) > 1.0F) {
-                this.damageEntity(DamageSource.BURN, 1.0F);
+                this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
             }
 
             if (!this.world.getGameRules().getBoolean("mobGriefing")) {
@@ -71,7 +75,7 @@
                 BlockPosition blockposition = new BlockPosition(i, j, k);
 
                 if (this.world.getType(blockposition).isAir() && this.world.getBiome(blockposition).c(blockposition) < 0.8F && iblockdata.canPlace(this.world, blockposition)) {
-                    this.world.setTypeUpdate(blockposition, iblockdata);
+                    org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.world, blockposition, iblockdata, this); // CraftBukkit
                 }
             }
         }
@@ -104,6 +108,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);
         }