2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/EntityMushroomCow.java
|
|
|
|
+++ b/net/minecraft/server/EntityMushroomCow.java
|
2020-05-02 09:48:37 +02:00
|
|
|
@@ -3,6 +3,10 @@
|
2019-06-21 12:00:00 +02:00
|
|
|
import java.util.Random;
|
2019-04-23 04:00:00 +02:00
|
|
|
import java.util.UUID;
|
|
|
|
import org.apache.commons.lang3.tuple.Pair;
|
2018-11-14 04:10:22 +01:00
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
+import org.bukkit.event.entity.EntityTransformEvent;
|
|
|
|
+// CraftBukkit end
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
public class EntityMushroomCow extends EntityCow {
|
2018-12-04 23:51:20 +01:00
|
|
|
|
2020-05-02 09:48:37 +02:00
|
|
|
@@ -81,9 +85,14 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
int i;
|
2018-11-14 04:10:22 +01:00
|
|
|
|
2019-12-10 23:00:00 +01:00
|
|
|
if (itemstack.getItem() == Items.SHEARS && !this.isBaby()) {
|
2018-11-14 04:10:22 +01:00
|
|
|
+ // CraftBukkit start
|
2020-05-02 09:48:37 +02:00
|
|
|
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
|
2018-11-14 04:10:22 +01:00
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2019-12-10 23:00:00 +01:00
|
|
|
this.world.addParticle(Particles.EXPLOSION, this.locX(), this.e(0.5D), this.locZ(), 0.0D, 0.0D, 0.0D);
|
2019-04-23 04:00:00 +02:00
|
|
|
if (!this.world.isClientSide) {
|
|
|
|
- this.die();
|
|
|
|
+ // this.die(); // CraftBukkit - moved down
|
|
|
|
EntityCow entitycow = (EntityCow) EntityTypes.COW.a(this.world);
|
|
|
|
|
2019-12-10 23:00:00 +01:00
|
|
|
entitycow.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, this.pitch);
|
2020-05-02 09:48:37 +02:00
|
|
|
@@ -99,7 +108,14 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
}
|
|
|
|
|
2019-12-10 23:00:00 +01:00
|
|
|
entitycow.setInvulnerable(this.isInvulnerable());
|
2019-04-23 04:00:00 +02:00
|
|
|
- this.world.addEntity(entitycow);
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ this.world.addEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
|
|
|
|
+
|
|
|
|
+ this.die(); // CraftBukkit - from above
|
|
|
|
+ // CraftBukkit end
|
2018-11-14 04:10:22 +01:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
for (i = 0; i < 5; ++i) {
|
2019-12-10 23:00:00 +01:00
|
|
|
this.world.addEntity(new EntityItem(this.world, this.locX(), this.e(1.0D), this.locZ(), new ItemStack(this.getVariant().d.getBlock())));
|