mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2025-08-21 05:44:33 +00:00

This reverts commits: - d2d03afc8854394aeefb40ea5ebf224c8032b19f - 6245746e91123dd8ef70e5f15b7cdfc7e36d8e8c - 41fae5c613e9e69a8f6bdf33b23bb09d7f407433 - c34bdecab42cf4098054a5ea43e1c2958d44ae92 - d7445084ac9a90fa0b66d8b050b8d0d2a062eaf3 - 6a6ed2e6ae2328a8a791bcc6857c44dc6c6a7030 - a783bc4dc95da8e26c673abe48fad96b550aba28 - cb50fd68766df8e07631ba5be85759f8257e8068 - 34dfff2ad5c407c712b2783f02960aac5e8649f2 - f33b513820de987b49a4338e85df80968217a601 - 5fd9fdfde055e6eb6a83db246d009b69377b7c94 - 2795b116f40d06551fbb7b96d1963c0ddbeac384
51 lines
2 KiB
Java
51 lines
2 KiB
Java
package net.minecraft.server;
|
|
|
|
public class EntityMushroomCow extends EntityCow {
|
|
|
|
public EntityMushroomCow(World world) {
|
|
super(world);
|
|
this.texture = "/mob/redcow.png";
|
|
this.b(0.9F, 1.3F);
|
|
}
|
|
|
|
public boolean b(EntityHuman entityhuman) {
|
|
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
|
|
|
if (itemstack != null && itemstack.id == Item.BOWL.id && this.getAge() >= 0) {
|
|
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, new ItemStack(Item.MUSHROOM_SOUP));
|
|
return true;
|
|
} else if (itemstack != null && itemstack.id == Item.SHEARS.id && this.getAge() >= 0) {
|
|
// CraftBukkit start
|
|
org.bukkit.event.player.PlayerShearEntityEvent event = new org.bukkit.event.player.PlayerShearEntityEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), this.getBukkitEntity());
|
|
this.world.getServer().getPluginManager().callEvent(event);
|
|
|
|
if (event.isCancelled()) {
|
|
return false;
|
|
}
|
|
// CraftBukkit end
|
|
|
|
this.die();
|
|
this.world.a("largeexplode", this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, 0.0D, 0.0D, 0.0D);
|
|
if (!this.world.isStatic) {
|
|
EntityCow entitycow = new EntityCow(this.world);
|
|
|
|
entitycow.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
|
entitycow.setHealth(this.getHealth());
|
|
entitycow.V = this.V;
|
|
this.world.addEntity(entitycow);
|
|
|
|
for (int i = 0; i < 5; ++i) {
|
|
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY + (double) this.length, this.locZ, new ItemStack(Block.RED_MUSHROOM)));
|
|
}
|
|
}
|
|
|
|
return true;
|
|
} else {
|
|
return super.b(entityhuman);
|
|
}
|
|
}
|
|
|
|
public EntityAnimal createChild(EntityAnimal entityanimal) {
|
|
return new EntityMushroomCow(this.world);
|
|
}
|
|
}
|