Prevented sounds from silenced vegetables.

This commit is contained in:
Jonathan Williams 2013-12-21 03:22:58 -05:00
parent 5fffcf89b6
commit 7574a5972b
6 changed files with 15 additions and 10 deletions

Binary file not shown.

View File

@ -55,6 +55,7 @@ public class UtilEnt
}
((CraftEntity)entity).getHandle().Invisible = invisible;
((CraftEntity)entity).getHandle().setInvisible(invisible);
}
public static void Leash(LivingEntity leashed, Entity holder, boolean pull, boolean breakable)
@ -71,6 +72,11 @@ public class UtilEnt
}
public static void Vegetate(Entity entity)
{
Vegetate(entity, false);
}
public static void Vegetate(Entity entity, boolean mute)
{
try
{
@ -104,6 +110,7 @@ public class UtilEnt
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
creature.Vegetated = true;
creature.Silent = mute;
PathfinderGoalSelector goalSelector = new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler);
goalSelector.a(7, new PathfinderGoalLookAtPlayer(creature, EntityHuman.class, 6.0F));

View File

@ -149,6 +149,7 @@ public abstract class Entity {
public boolean valid; // CraftBukkit
public boolean Invisible;
public boolean Silent;
public Entity(World world) {
this.id = entityCount++;
@ -708,7 +709,9 @@ public abstract class Entity {
this.makeSound("liquid.swim", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
}
this.a(l, k, i1, j1);
if (!Silent)
a(l, k, i1, j1);
Block.byId[j1].b(this.world, l, k, i1, this);
}
}

View File

@ -148,7 +148,7 @@ public abstract class EntityInsentient extends EntityLiving {
public void y() {
super.y();
this.world.methodProfiler.a("mobBaseTick");
if (this.isAlive() && this.random.nextInt(1000) < this.a_++) {
if (this.isAlive() && !Silent && this.random.nextInt(1000) < this.a_++) {
this.a_ = -this.o();
this.p();
}

View File

@ -52,7 +52,7 @@ public class Sleigh
Target = loc.clone();
CentralEntity = loc.getWorld().spawn(loc, Chicken.class);
UtilEnt.Vegetate(CentralEntity);
UtilEnt.Vegetate(CentralEntity, true);
UtilEnt.ghost(CentralEntity, true, true);
//Presents
@ -142,11 +142,6 @@ public class Sleigh
for (SleighHorse horse : SleighHorses)
UtilEnt.Leash(horse.Ent, santa.GetTop(), false, false);
for (SleighPart part : SleighEnts)
{
((CraftEntity)part.Ent).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32));
}
}
public Location GetLocation()

View File

@ -37,7 +37,7 @@ public class SleighPart
Ent = loc.getWorld().spawn(loc.add(x, 0, z), Chicken.class);
Ent.setBaby();
Ent.setAgeLock(true);
UtilEnt.Vegetate(Ent);
UtilEnt.Vegetate(Ent, true);
UtilEnt.ghost(Ent, true, true);
//Height
@ -47,7 +47,7 @@ public class SleighPart
Chicken newTop = loc.getWorld().spawn(loc.add(x, 0, z), Chicken.class);
newTop.setBaby();
newTop.setAgeLock(true);
UtilEnt.Vegetate(newTop);
UtilEnt.Vegetate(newTop, true);
UtilEnt.ghost(newTop, true, true);
top.setPassenger(newTop);