2011-06-09 10:03:15 +02:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
// CraftBukkit start
|
2011-06-18 05:47:33 +02:00
|
|
|
import org.bukkit.craftbukkit.entity.CraftEntity;
|
2011-06-09 10:03:15 +02:00
|
|
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
2011-06-18 05:47:33 +02:00
|
|
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
|
|
import org.bukkit.event.entity.EntityDamageEvent;
|
|
|
|
import org.bukkit.event.entity.EntityTargetEvent;
|
2011-06-09 10:03:15 +02:00
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
public class EntityWolf extends EntityAnimal {
|
|
|
|
|
|
|
|
private boolean a = false;
|
|
|
|
private float b;
|
|
|
|
private float c;
|
|
|
|
private boolean f;
|
|
|
|
private boolean g;
|
|
|
|
private float h;
|
|
|
|
private float i;
|
|
|
|
|
|
|
|
public EntityWolf(World world) {
|
|
|
|
super(world);
|
|
|
|
this.texture = "/mob/wolf.png";
|
|
|
|
this.b(0.8F, 0.8F);
|
|
|
|
this.aE = 1.1F;
|
|
|
|
this.health = 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void b() {
|
|
|
|
super.b();
|
|
|
|
this.datawatcher.a(16, Byte.valueOf((byte) 0));
|
|
|
|
this.datawatcher.a(17, "");
|
|
|
|
this.datawatcher.a(18, new Integer(this.health));
|
|
|
|
}
|
|
|
|
|
|
|
|
protected boolean n() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void b(NBTTagCompound nbttagcompound) {
|
|
|
|
super.b(nbttagcompound);
|
|
|
|
nbttagcompound.a("Angry", this.isAngry());
|
|
|
|
nbttagcompound.a("Sitting", this.isSitting());
|
2011-06-27 00:25:01 +02:00
|
|
|
if (this.getOwnerName() == null) {
|
2011-06-09 10:03:15 +02:00
|
|
|
nbttagcompound.setString("Owner", "");
|
|
|
|
} else {
|
2011-06-27 00:25:01 +02:00
|
|
|
nbttagcompound.setString("Owner", this.getOwnerName());
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void a(NBTTagCompound nbttagcompound) {
|
|
|
|
super.a(nbttagcompound);
|
|
|
|
this.setAngry(nbttagcompound.m("Angry"));
|
|
|
|
this.setSitting(nbttagcompound.m("Sitting"));
|
|
|
|
String s = nbttagcompound.getString("Owner");
|
|
|
|
|
|
|
|
if (s.length() > 0) {
|
2011-06-27 00:25:01 +02:00
|
|
|
this.setOwnerName(s);
|
|
|
|
this.setTamed(true);
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:02:25 +02:00
|
|
|
protected boolean h_() {
|
2011-06-27 00:25:01 +02:00
|
|
|
return !this.isTamed();
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected String g() {
|
2011-06-27 00:25:01 +02:00
|
|
|
return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.b(18) < 10 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected String h() {
|
|
|
|
return "mob.wolf.hurt";
|
|
|
|
}
|
|
|
|
|
|
|
|
protected String i() {
|
|
|
|
return "mob.wolf.death";
|
|
|
|
}
|
|
|
|
|
|
|
|
protected float k() {
|
|
|
|
return 0.4F;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected int j() {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void c_() {
|
|
|
|
super.c_();
|
2011-06-30 00:02:25 +02:00
|
|
|
if (!this.e && !this.C() && this.isTamed() && this.vehicle == null) {
|
2011-06-27 00:25:01 +02:00
|
|
|
EntityHuman entityhuman = this.world.a(this.getOwnerName());
|
2011-06-09 10:03:15 +02:00
|
|
|
|
|
|
|
if (entityhuman != null) {
|
|
|
|
float f = entityhuman.f(this);
|
|
|
|
|
|
|
|
if (f > 5.0F) {
|
|
|
|
this.c(entityhuman, f);
|
|
|
|
}
|
2011-06-30 00:02:25 +02:00
|
|
|
} else if (!this.ad()) {
|
2011-06-09 10:03:15 +02:00
|
|
|
this.setSitting(true);
|
|
|
|
}
|
2011-06-30 00:02:25 +02:00
|
|
|
} else if (this.target == null && !this.C() && !this.isTamed() && this.world.random.nextInt(100) == 0) {
|
2011-06-09 10:03:15 +02:00
|
|
|
List list = this.world.a(EntitySheep.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).b(16.0D, 4.0D, 16.0D));
|
|
|
|
|
|
|
|
if (!list.isEmpty()) {
|
2011-06-19 04:37:52 +02:00
|
|
|
// CraftBukkit start
|
|
|
|
Entity entity = (Entity) list.get(this.world.random.nextInt(list.size()));
|
2011-06-27 00:25:01 +02:00
|
|
|
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
|
2011-06-19 04:37:52 +02:00
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.RANDOM_TARGET);
|
|
|
|
this.world.getServer().getPluginManager().callEvent(event);
|
2011-06-19 04:37:52 +02:00
|
|
|
|
|
|
|
if (!event.isCancelled() || event.getTarget() != null ) {
|
2011-06-27 00:25:01 +02:00
|
|
|
this.setTarget(entity);
|
2011-06-19 04:37:52 +02:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:02:25 +02:00
|
|
|
if (this.ad()) {
|
2011-06-09 10:03:15 +02:00
|
|
|
this.setSitting(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.world.isStatic) {
|
2011-06-27 00:25:01 +02:00
|
|
|
this.datawatcher.watch(18, Integer.valueOf(this.health));
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:02:25 +02:00
|
|
|
public void v() {
|
|
|
|
super.v();
|
2011-06-09 10:03:15 +02:00
|
|
|
this.a = false;
|
2011-06-30 00:02:25 +02:00
|
|
|
if (this.V() && !this.C() && !this.isAngry()) {
|
|
|
|
Entity entity = this.W();
|
2011-06-09 10:03:15 +02:00
|
|
|
|
|
|
|
if (entity instanceof EntityHuman) {
|
|
|
|
EntityHuman entityhuman = (EntityHuman) entity;
|
|
|
|
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
|
|
|
|
|
|
|
if (itemstack != null) {
|
2011-06-27 00:25:01 +02:00
|
|
|
if (!this.isTamed() && itemstack.id == Item.BONE.id) {
|
2011-06-09 10:03:15 +02:00
|
|
|
this.a = true;
|
2011-06-27 00:25:01 +02:00
|
|
|
} else if (this.isTamed() && Item.byId[itemstack.id] instanceof ItemFood) {
|
2011-06-09 10:03:15 +02:00
|
|
|
this.a = ((ItemFood) Item.byId[itemstack.id]).l();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:02:25 +02:00
|
|
|
if (!this.Y && this.f && !this.g && !this.C() && this.onGround) {
|
2011-06-09 10:03:15 +02:00
|
|
|
this.g = true;
|
|
|
|
this.h = 0.0F;
|
|
|
|
this.i = 0.0F;
|
|
|
|
this.world.a(this, (byte) 8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:02:25 +02:00
|
|
|
public void m_() {
|
|
|
|
super.m_();
|
2011-06-09 10:03:15 +02:00
|
|
|
this.c = this.b;
|
|
|
|
if (this.a) {
|
|
|
|
this.b += (1.0F - this.b) * 0.4F;
|
|
|
|
} else {
|
|
|
|
this.b += (0.0F - this.b) * 0.4F;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.a) {
|
|
|
|
this.aF = 10;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:02:25 +02:00
|
|
|
if (this.ac()) {
|
2011-06-09 10:03:15 +02:00
|
|
|
this.f = true;
|
|
|
|
this.g = false;
|
|
|
|
this.h = 0.0F;
|
|
|
|
this.i = 0.0F;
|
|
|
|
} else if ((this.f || this.g) && this.g) {
|
|
|
|
if (this.h == 0.0F) {
|
|
|
|
this.world.makeSound(this, "mob.wolf.shake", this.k(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.i = this.h;
|
|
|
|
this.h += 0.05F;
|
|
|
|
if (this.i >= 2.0F) {
|
|
|
|
this.f = false;
|
|
|
|
this.g = false;
|
|
|
|
this.i = 0.0F;
|
|
|
|
this.h = 0.0F;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.h > 0.4F) {
|
|
|
|
float f = (float) this.boundingBox.b;
|
|
|
|
int i = (int) (MathHelper.sin((this.h - 0.4F) * 3.1415927F) * 7.0F);
|
|
|
|
|
|
|
|
for (int j = 0; j < i; ++j) {
|
|
|
|
float f1 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length * 0.5F;
|
|
|
|
float f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length * 0.5F;
|
|
|
|
|
|
|
|
this.world.a("splash", this.locX + (double) f1, (double) (f + 0.8F), this.locZ + (double) f2, this.motX, this.motY, this.motZ);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:02:25 +02:00
|
|
|
public float t() {
|
2011-06-09 10:03:15 +02:00
|
|
|
return this.width * 0.8F;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:02:25 +02:00
|
|
|
protected int u() {
|
|
|
|
return this.isSitting() ? 20 : super.u();
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void c(Entity entity, float f) {
|
|
|
|
PathEntity pathentity = this.world.findPath(this, entity, 16.0F);
|
|
|
|
|
|
|
|
if (pathentity == null && f > 12.0F) {
|
|
|
|
int i = MathHelper.floor(entity.locX) - 2;
|
|
|
|
int j = MathHelper.floor(entity.locZ) - 2;
|
|
|
|
int k = MathHelper.floor(entity.boundingBox.b);
|
|
|
|
|
|
|
|
for (int l = 0; l <= 4; ++l) {
|
|
|
|
for (int i1 = 0; i1 <= 4; ++i1) {
|
2011-06-30 00:02:25 +02:00
|
|
|
if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && this.world.e(i + l, k - 1, j + i1) && !this.world.e(i + l, k, j + i1) && !this.world.e(i + l, k + 1, j + i1)) {
|
2011-06-09 10:03:15 +02:00
|
|
|
this.setPositionRotation((double) ((float) (i + l) + 0.5F), (double) k, (double) ((float) (j + i1) + 0.5F), this.yaw, this.pitch);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2011-06-27 00:25:01 +02:00
|
|
|
this.setPathEntity(pathentity);
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected boolean w() {
|
|
|
|
return this.isSitting() || this.g;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean damageEntity(Entity entity, int i) {
|
|
|
|
this.setSitting(false);
|
|
|
|
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
|
|
|
|
i = (i + 1) / 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!super.damageEntity((Entity) entity, i)) {
|
|
|
|
return false;
|
|
|
|
} else {
|
2011-06-27 00:25:01 +02:00
|
|
|
if (!this.isTamed() && !this.isAngry()) {
|
2011-06-09 10:03:15 +02:00
|
|
|
if (entity instanceof EntityHuman) {
|
2011-06-18 05:47:33 +02:00
|
|
|
// CraftBukkit start
|
2011-06-27 00:25:01 +02:00
|
|
|
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
|
2011-06-18 05:47:33 +02:00
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);
|
|
|
|
this.world.getServer().getPluginManager().callEvent(event);
|
2011-06-18 05:47:33 +02:00
|
|
|
|
|
|
|
if (!event.isCancelled()) {
|
|
|
|
if (event.getTarget() == null) {
|
|
|
|
this.target = null;
|
|
|
|
} else {
|
|
|
|
this.setAngry(true);
|
|
|
|
this.target = ((CraftEntity) event.getTarget()).getHandle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (entity instanceof EntityArrow && ((EntityArrow) entity).shooter != null) {
|
|
|
|
entity = ((EntityArrow) entity).shooter;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (entity instanceof EntityLiving) {
|
|
|
|
List list = this.world.a(EntityWolf.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).b(16.0D, 4.0D, 16.0D));
|
|
|
|
Iterator iterator = list.iterator();
|
|
|
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
Entity entity1 = (Entity) iterator.next();
|
|
|
|
EntityWolf entitywolf = (EntityWolf) entity1;
|
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
if (!entitywolf.isTamed() && entitywolf.target == null) {
|
2011-06-18 05:47:33 +02:00
|
|
|
// CraftBukkit start
|
2011-06-27 00:25:01 +02:00
|
|
|
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
|
2011-06-18 05:47:33 +02:00
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);
|
|
|
|
this.world.getServer().getPluginManager().callEvent(event);
|
2011-06-18 05:47:33 +02:00
|
|
|
|
|
|
|
if (!event.isCancelled()) {
|
|
|
|
if (event.getTarget() == null) {
|
|
|
|
this.target = null;
|
|
|
|
} else {
|
|
|
|
entitywolf.target = (Entity) entity;
|
|
|
|
if (entity instanceof EntityHuman) {
|
|
|
|
entitywolf.setAngry(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (entity != this && entity != null) {
|
2011-06-27 00:25:01 +02:00
|
|
|
if (this.isTamed() && entity instanceof EntityHuman && ((EntityHuman) entity).name.equalsIgnoreCase(this.getOwnerName())) {
|
2011-06-09 10:03:15 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.target = (Entity) entity;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected Entity findTarget() {
|
2011-06-27 00:25:01 +02:00
|
|
|
return this.isAngry() ? this.world.findNearbyPlayer(this, 16.0D) : null;
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected void a(Entity entity, float f) {
|
|
|
|
if (f > 2.0F && f < 6.0F && this.random.nextInt(10) == 0) {
|
|
|
|
if (this.onGround) {
|
|
|
|
double d0 = entity.locX - this.locX;
|
|
|
|
double d1 = entity.locZ - this.locZ;
|
|
|
|
float f1 = MathHelper.a(d0 * d0 + d1 * d1);
|
|
|
|
|
|
|
|
this.motX = d0 / (double) f1 * 0.5D * 0.800000011920929D + this.motX * 0.20000000298023224D;
|
|
|
|
this.motZ = d1 / (double) f1 * 0.5D * 0.800000011920929D + this.motZ * 0.20000000298023224D;
|
|
|
|
this.motY = 0.4000000059604645D;
|
|
|
|
}
|
|
|
|
} else if ((double) f < 1.5D && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
|
|
|
|
this.attackTicks = 20;
|
|
|
|
byte b0 = 2;
|
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
if (this.isTamed()) {
|
2011-06-09 10:03:15 +02:00
|
|
|
b0 = 4;
|
|
|
|
}
|
2011-06-18 05:47:33 +02:00
|
|
|
// CraftBukkit start
|
|
|
|
org.bukkit.entity.Entity damager = this.getBukkitEntity();
|
2011-06-27 00:25:01 +02:00
|
|
|
org.bukkit.entity.Entity damagee = entity == null ? null : entity.getBukkitEntity();
|
2011-06-09 10:03:15 +02:00
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, b0);
|
|
|
|
this.world.getServer().getPluginManager().callEvent(event);
|
2011-06-18 05:47:33 +02:00
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
if (event.isCancelled()) {
|
|
|
|
return;
|
2011-06-18 05:47:33 +02:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2011-06-27 00:25:01 +02:00
|
|
|
|
|
|
|
entity.damageEntity(this, b0);
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean a(EntityHuman entityhuman) {
|
|
|
|
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
if (!this.isTamed()) {
|
2011-06-09 10:03:15 +02:00
|
|
|
if (itemstack != null && itemstack.id == Item.BONE.id && !this.isAngry()) {
|
|
|
|
--itemstack.count;
|
|
|
|
if (itemstack.count <= 0) {
|
|
|
|
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.world.isStatic) {
|
2011-06-24 01:26:36 +02:00
|
|
|
// CraftBukkit - added event call and isCancelled check.
|
|
|
|
if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
|
2011-06-27 00:25:01 +02:00
|
|
|
// CraftBukkit end
|
|
|
|
this.setTamed(true);
|
|
|
|
this.setPathEntity((PathEntity) null);
|
2011-06-24 01:26:36 +02:00
|
|
|
this.setSitting(true);
|
|
|
|
this.health = 20;
|
2011-06-27 00:25:01 +02:00
|
|
|
this.setOwnerName(entityhuman.name);
|
2011-06-24 01:26:36 +02:00
|
|
|
this.a(true);
|
|
|
|
this.world.a(this, (byte) 7);
|
|
|
|
} else {
|
|
|
|
this.a(false);
|
|
|
|
this.world.a(this, (byte) 6);
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (itemstack != null && Item.byId[itemstack.id] instanceof ItemFood) {
|
|
|
|
ItemFood itemfood = (ItemFood) Item.byId[itemstack.id];
|
|
|
|
|
|
|
|
if (itemfood.l() && this.datawatcher.b(18) < 20) {
|
|
|
|
--itemstack.count;
|
|
|
|
if (itemstack.count <= 0) {
|
|
|
|
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.b(((ItemFood) Item.PORK).k());
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
if (entityhuman.name.equalsIgnoreCase(this.getOwnerName())) {
|
2011-06-09 10:03:15 +02:00
|
|
|
if (!this.world.isStatic) {
|
|
|
|
this.setSitting(!this.isSitting());
|
|
|
|
this.aC = false;
|
2011-06-27 00:25:01 +02:00
|
|
|
this.setPathEntity((PathEntity) null);
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void a(boolean flag) {
|
|
|
|
String s = "heart";
|
|
|
|
|
|
|
|
if (!flag) {
|
|
|
|
s = "smoke";
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < 7; ++i) {
|
|
|
|
double d0 = this.random.nextGaussian() * 0.02D;
|
|
|
|
double d1 = this.random.nextGaussian() * 0.02D;
|
|
|
|
double d2 = this.random.nextGaussian() * 0.02D;
|
|
|
|
|
|
|
|
this.world.a(s, this.locX + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length, this.locY + 0.5D + (double) (this.random.nextFloat() * this.width), this.locZ + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length, d0, d1, d2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public int l() {
|
|
|
|
return 8;
|
|
|
|
}
|
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
public String getOwnerName() {
|
2011-06-09 10:03:15 +02:00
|
|
|
return this.datawatcher.c(17);
|
|
|
|
}
|
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
public void setOwnerName(String s) {
|
|
|
|
this.datawatcher.watch(17, s);
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isSitting() {
|
|
|
|
return (this.datawatcher.a(16) & 1) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSitting(boolean flag) {
|
|
|
|
byte b0 = this.datawatcher.a(16);
|
|
|
|
|
|
|
|
if (flag) {
|
2011-06-27 00:25:01 +02:00
|
|
|
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1)));
|
2011-06-09 10:03:15 +02:00
|
|
|
} else {
|
2011-06-27 00:25:01 +02:00
|
|
|
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -2)));
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isAngry() {
|
|
|
|
return (this.datawatcher.a(16) & 2) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAngry(boolean flag) {
|
|
|
|
byte b0 = this.datawatcher.a(16);
|
|
|
|
|
|
|
|
if (flag) {
|
2011-06-27 00:25:01 +02:00
|
|
|
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 2)));
|
2011-06-09 10:03:15 +02:00
|
|
|
} else {
|
2011-06-27 00:25:01 +02:00
|
|
|
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -3)));
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
public boolean isTamed() {
|
2011-06-09 10:03:15 +02:00
|
|
|
return (this.datawatcher.a(16) & 4) != 0;
|
|
|
|
}
|
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
public void setTamed(boolean flag) {
|
2011-06-18 05:06:20 +02:00
|
|
|
byte b0 = this.datawatcher.a(16);
|
2011-06-13 05:38:35 +02:00
|
|
|
|
2011-06-18 05:06:20 +02:00
|
|
|
if (flag) {
|
2011-06-27 00:25:01 +02:00
|
|
|
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 4)));
|
2011-06-18 05:06:20 +02:00
|
|
|
} else {
|
2011-06-27 00:25:01 +02:00
|
|
|
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -5)));
|
2011-06-09 10:03:15 +02:00
|
|
|
}
|
|
|
|
}
|
2011-06-12 00:02:58 +02:00
|
|
|
}
|