Fix the bounding box problems. Now just block glitching and suffocation

This commit is contained in:
libraryaddict
2013-12-22 14:30:15 +13:00
parent f6d0994079
commit d00d10f3a8
2 changed files with 25 additions and 33 deletions

View File

@@ -136,28 +136,26 @@ public class DisguiseUtilities {
// TODO Slimes
Entity entity = disguise.getEntity();
if (entity != null) {
DisguiseValues disguiseValues = DisguiseValues.getDisguiseValues(disguise.getType());
DisguiseValues entityValues = DisguiseValues.getDisguiseValues(DisguiseType.getType(entity.getType()));
FakeBoundingBox entityBox = entityValues.getAdultBox();
FakeBoundingBox disguiseBox = disguiseValues.getAdultBox();
if (entityValues.getBabyBox() != null) {
if (entity instanceof Ageable && !(((Ageable) entity).isAdult())
|| (entity instanceof Zombie && ((Zombie) entity).isBaby())) {
entityBox = entityValues.getBabyBox();
}
}
if (disguiseValues.getBabyBox() != null) {
if (disguise.getWatcher() instanceof AgeableWatcher && (((AgeableWatcher) disguise.getWatcher()).isBaby())
|| (disguise.getWatcher() instanceof ZombieWatcher && ((ZombieWatcher) disguise.getWatcher()).isBaby())) {
disguiseBox = disguiseValues.getBabyBox();
}
}
if (isDisguiseInUse(disguise)) {
DisguiseValues values = DisguiseValues.getDisguiseValues(disguise.getType());
FakeBoundingBox fakeBox = values.getAdultBox();
if (values.getBabyBox() != null) {
if (disguise.getWatcher() instanceof AgeableWatcher
&& (((AgeableWatcher) disguise.getWatcher()).isBaby())
|| (disguise.getWatcher() instanceof ZombieWatcher && ((ZombieWatcher) disguise.getWatcher())
.isBaby())) {
fakeBox = values.getBabyBox();
}
}
ReflectionManager.setBoundingBox(entity, fakeBox.getX(), fakeBox.getY(), fakeBox.getZ());
ReflectionManager.setBoundingBox(entity, entityBox, disguiseBox);
} else {
DisguiseValues values = DisguiseValues.getDisguiseValues(DisguiseType.getType(entity.getType()));
FakeBoundingBox fakeBox = values.getAdultBox();
if (values.getBabyBox() != null) {
if (entity instanceof Ageable && !(((Ageable) entity).isAdult())
|| (entity instanceof Zombie && ((Zombie) entity).isBaby())) {
fakeBox = values.getBabyBox();
}
}
ReflectionManager.setBoundingBox(disguise.getEntity(), fakeBox.getX(), fakeBox.getY(), fakeBox.getZ());
ReflectionManager.setBoundingBox(entity, disguiseBox, entityBox);
}
}
}