3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-21 05:50:05 +01:00
Paper/src/main/java/net/minecraft/server/EntityCow.java
Erik Broes 61ec751ca1 Update for 1.1_01 renames.
We know these updates (can) break plugins bypassing Bukkit. They are needed for
smooth updates however. There will be another one right before before 1.1-R1.
2012-01-15 10:52:37 +01:00

96 Zeilen
2.6 KiB
Java

package net.minecraft.server;
// CraftBukkit start
import java.util.List;
import org.bukkit.Location;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.player.PlayerBucketFillEvent;
// CraftBukkit end
public class EntityCow extends EntityAnimal {
public EntityCow(World world) {
super(world);
this.texture = "/mob/cow.png";
this.b(0.9F, 1.3F);
}
public int getMaxHealth() {
return 10;
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
}
protected String c_() {
return "mob.cow";
}
protected String m() {
return "mob.cowhurt";
}
protected String n() {
return "mob.cowhurt";
}
protected float o() {
return 0.4F;
}
protected int getLootId() {
return Item.LEATHER.id;
}
protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int j = this.random.nextInt(3) + this.random.nextInt(1 + i);
if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(Item.LEATHER.id, j));
}
j = this.random.nextInt(3) + 1 + this.random.nextInt(1 + i);
if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(this.isBurning() ? Item.COOKED_BEEF.id : Item.RAW_BEEF.id, j));
}
CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end
}
public boolean b(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.BUCKET.id) {
// CraftBukkit start - got milk?
Location loc = this.getBukkitEntity().getLocation();
PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), -1, itemstack, Item.MILK_BUCKET);
if (event.isCancelled()) {
return false;
}
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, CraftItemStack.createNMSItemStack(event.getItemStack()));
// CraftBukkit end
return true;
} else {
return super.b(entityhuman);
}
}
protected EntityAnimal createChild(EntityAnimal entityanimal) {
return new EntityCow(this.world);
}
}