summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityTurtle.patch
blob: 11c6bc4b1c3b641366394af8caba1541164b73c1 (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
--- a/net/minecraft/server/EntityTurtle.java
+++ b/net/minecraft/server/EntityTurtle.java
@@ -231,7 +231,9 @@
 
     protected void l() {
         super.l();
+        this.forceDrops = true; // CraftBukkit
         this.a((IMaterial) Items.SCUTE, 1);
+        this.forceDrops = false; // CraftBukkit
     }
 
     public void a(float f, float f1, float f2) {
@@ -260,7 +262,9 @@
     }
 
     public void onLightningStrike(EntityLightning entitylightning) {
+        org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = entitylightning; // CraftBukkit
         this.damageEntity(DamageSource.LIGHTNING, Float.MAX_VALUE);
+        org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit
     }
 
     public void die(DamageSource damagesource) {
@@ -438,8 +442,12 @@
                 } else if (this.f.bK > 200) {
                     World world = this.f.world;
 
+                    // CraftBukkit start
+                    if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.f, this.d.up(), Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, Integer.valueOf(this.f.random.nextInt(4) + 1))).isCancelled()) {
                     world.a((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_LAY_EGG, SoundCategory.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F);
                     world.setTypeAndData(this.d.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, Integer.valueOf(this.f.random.nextInt(4) + 1)), 3);
+                    }
+                    // CraftBukkit end
                     this.f.s(false);
                     this.f.t(false);
                     this.f.e(600);