2012-01-24 01:51:36 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
2012-07-22 08:18:00 +02:00
|
|
|
import org.bukkit.event.player.PlayerShearEntityEvent; // CraftBukkit
|
|
|
|
|
2012-01-24 01:51:36 +01:00
|
|
|
public class EntityMushroomCow extends EntityCow {
|
|
|
|
|
|
|
|
public EntityMushroomCow(World world) {
|
|
|
|
super(world);
|
|
|
|
this.texture = "/mob/redcow.png";
|
2012-07-29 09:33:13 +02:00
|
|
|
this.a(0.9F, 1.3F);
|
2012-01-24 01:51:36 +01:00
|
|
|
}
|
|
|
|
|
2012-11-06 13:05:28 +01:00
|
|
|
public boolean a(EntityHuman entityhuman) {
|
2012-01-24 01:51:36 +01:00
|
|
|
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
|
|
|
|
|
|
|
if (itemstack != null && itemstack.id == Item.BOWL.id && this.getAge() >= 0) {
|
2012-03-30 23:33:51 +02:00
|
|
|
if (itemstack.count == 1) {
|
|
|
|
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, new ItemStack(Item.MUSHROOM_SOUP));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (entityhuman.inventory.pickup(new ItemStack(Item.MUSHROOM_SOUP)) && !entityhuman.abilities.canInstantlyBuild) {
|
|
|
|
entityhuman.inventory.splitStack(entityhuman.inventory.itemInHandIndex, 1);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2012-07-22 08:18:00 +02:00
|
|
|
|
2012-03-30 23:33:51 +02:00
|
|
|
if (itemstack != null && itemstack.id == Item.SHEARS.id && this.getAge() >= 0) {
|
2012-01-24 01:51:36 +01:00
|
|
|
// CraftBukkit start
|
2012-07-22 08:18:00 +02:00
|
|
|
PlayerShearEntityEvent event = new PlayerShearEntityEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), this.getBukkitEntity());
|
2012-01-24 01:51:36 +01:00
|
|
|
this.world.getServer().getPluginManager().callEvent(event);
|
|
|
|
|
|
|
|
if (event.isCancelled()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
this.die();
|
2012-10-25 05:53:23 +02:00
|
|
|
this.world.addParticle("largeexplode", this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, 0.0D, 0.0D, 0.0D);
|
2012-03-01 11:49:23 +01:00
|
|
|
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());
|
2012-12-20 05:03:52 +01:00
|
|
|
entitycow.ax = this.ax;
|
2012-03-01 11:49:23 +01:00
|
|
|
this.world.addEntity(entitycow);
|
2012-01-24 01:51:36 +01:00
|
|
|
|
2012-03-01 11:49:23 +01:00
|
|
|
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)));
|
|
|
|
}
|
2012-01-24 01:51:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else {
|
2012-11-06 13:05:28 +01:00
|
|
|
return super.a(entityhuman);
|
2012-01-24 01:51:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-06 13:05:28 +01:00
|
|
|
public EntityMushroomCow c(EntityAgeable entityageable) {
|
2012-01-24 01:51:36 +01:00
|
|
|
return new EntityMushroomCow(this.world);
|
|
|
|
}
|
2012-11-06 13:05:28 +01:00
|
|
|
|
|
|
|
public EntityCow b(EntityAgeable entityageable) {
|
|
|
|
return this.c(entityageable);
|
|
|
|
}
|
|
|
|
|
|
|
|
public EntityAgeable createChild(EntityAgeable entityageable) {
|
|
|
|
return this.c(entityageable);
|
|
|
|
}
|
2012-01-24 01:51:36 +01:00
|
|
|
}
|