diff options
Diffstat (limited to 'patch-remap/og/net/minecraft/world/entity/animal/EntityMushroomCow.patch')
-rw-r--r-- | patch-remap/og/net/minecraft/world/entity/animal/EntityMushroomCow.patch | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/entity/animal/EntityMushroomCow.patch b/patch-remap/og/net/minecraft/world/entity/animal/EntityMushroomCow.patch new file mode 100644 index 0000000000..9e8f913847 --- /dev/null +++ b/patch-remap/og/net/minecraft/world/entity/animal/EntityMushroomCow.patch @@ -0,0 +1,65 @@ +--- a/net/minecraft/world/entity/animal/EntityMushroomCow.java ++++ b/net/minecraft/world/entity/animal/EntityMushroomCow.java +@@ -42,6 +42,13 @@ + import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.level.gameevent.GameEvent; + ++// CraftBukkit start ++import org.bukkit.Bukkit; ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++import org.bukkit.event.entity.EntityDropItemEvent; ++import org.bukkit.event.entity.EntityTransformEvent; ++// CraftBukkit end ++ + public class EntityMushroomCow extends EntityCow implements IShearable, VariantHolder<EntityMushroomCow.Type> { + + private static final DataWatcherObject<String> DATA_TYPE = DataWatcher.defineId(EntityMushroomCow.class, DataWatcherRegistry.STRING); +@@ -114,6 +121,11 @@ + this.playSound(soundeffect, 1.0F, 1.0F); + return EnumInteractionResult.sidedSuccess(this.level().isClientSide); + } else if (itemstack.is(Items.SHEARS) && this.readyForShearing()) { ++ // CraftBukkit start ++ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) { ++ return EnumInteractionResult.PASS; ++ } ++ // CraftBukkit end + this.shear(SoundCategory.PLAYERS); + this.gameEvent(GameEvent.SHEAR, entityhuman); + if (!this.level().isClientSide) { +@@ -161,7 +173,7 @@ + + if (entitycow != null) { + ((WorldServer) this.level()).sendParticles(Particles.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D); +- this.discard(); ++ // this.discard(); // CraftBukkit - moved down + entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); + entitycow.setHealth(this.getHealth()); + entitycow.yBodyRot = this.yBodyRot; +@@ -175,10 +187,25 @@ + } + + entitycow.setInvulnerable(this.isInvulnerable()); +- this.level().addFreshEntity(entitycow); ++ // CraftBukkit start ++ if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) { ++ return; ++ } ++ this.level().addFreshEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED); ++ ++ this.discard(); // CraftBukkit - from above ++ // CraftBukkit end + + for (int i = 0; i < 5; ++i) { +- this.level().addFreshEntity(new EntityItem(this.level(), this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock()))); ++ // CraftBukkit start ++ EntityItem entityitem = new EntityItem(this.level(), this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock())); ++ EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity()); ++ Bukkit.getPluginManager().callEvent(event); ++ if (event.isCancelled()) { ++ continue; ++ } ++ this.level().addFreshEntity(entityitem); ++ // CraftBukkit end + } + } + } |