Fix bounding boxes
This commit is contained in:
parent
1c04576ae3
commit
dda362f082
@ -455,7 +455,10 @@ public class DisguiseUtilities {
|
||||
public static void doBoundingBox(TargetedDisguise disguise) {
|
||||
Entity entity = disguise.getEntity();
|
||||
|
||||
if (entity != null) {
|
||||
if (entity == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isDisguiseInUse(disguise)) {
|
||||
DisguiseValues disguiseValues = DisguiseValues.getDisguiseValues(disguise.getType());
|
||||
FakeBoundingBox disguiseBox = disguiseValues.getAdultBox();
|
||||
@ -485,7 +488,6 @@ public class DisguiseUtilities {
|
||||
ReflectionManager.setBoundingBox(entity, entityBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int getChunkCord(int blockCord) {
|
||||
int cord = (int) Math.floor(blockCord / 16D) - 17;
|
||||
|
@ -187,7 +187,10 @@ public class ReflectionManager {
|
||||
int stage = 0;
|
||||
|
||||
for (Field field : boundingBox.getClass().getDeclaredFields()) {
|
||||
if (field.getType().getSimpleName().equals("double")) {
|
||||
if (!field.getType().getSimpleName().equals("double")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
stage++;
|
||||
|
||||
switch (stage) {
|
||||
@ -213,7 +216,6 @@ public class ReflectionManager {
|
||||
throw new Exception("Error while setting the bounding box, more doubles than I thought??");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new FakeBoundingBox(x, y, z);
|
||||
}
|
||||
@ -618,8 +620,9 @@ public class ReflectionManager {
|
||||
Location loc = entity.getLocation();
|
||||
|
||||
Object boundingBox = boundingBoxConstructor
|
||||
.newInstance(loc.getX() - newBox.getX(), loc.getY() - newBox.getY(), loc.getZ() - newBox.getZ(),
|
||||
loc.getX() + newBox.getX(), loc.getY() + newBox.getY(), loc.getZ() + newBox.getZ());
|
||||
.newInstance(loc.getX() - (newBox.getX() / 2), loc.getY(), loc.getZ() - (newBox.getZ() / 2),
|
||||
loc.getX() + (newBox.getX() / 2), loc.getY() + newBox.getY(),
|
||||
loc.getZ() + (newBox.getZ() / 2));
|
||||
|
||||
setBoundingBoxMethod.invoke(getNmsEntity(entity), boundingBox);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user