mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-04 13:54:35 +01:00
Fix bounding boxes having incorrect Y (or am I now breaking it)
This commit is contained in:
parent
1739ef51c0
commit
fedde0d3f4
@ -253,8 +253,7 @@ public class ReflectionManager implements ReflectionManagerAbstract {
|
||||
public void setBoundingBox(Entity entity, double x, double y, double z) {
|
||||
Location loc = entity.getLocation();
|
||||
((CraftEntity) entity).getHandle().setBoundingBox(
|
||||
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
|
||||
loc.getZ() + z / 2));
|
||||
new AABB(loc.getX() - x / 2, loc.getY(), loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y, loc.getZ() + z / 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -253,8 +253,7 @@ public class ReflectionManager implements ReflectionManagerAbstract {
|
||||
public void setBoundingBox(Entity entity, double x, double y, double z) {
|
||||
Location loc = entity.getLocation();
|
||||
((CraftEntity) entity).getHandle().setBoundingBox(
|
||||
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
|
||||
loc.getZ() + z / 2));
|
||||
new AABB(loc.getX() - x / 2, loc.getY(), loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y, loc.getZ() + z / 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -255,8 +255,7 @@ public class ReflectionManager implements ReflectionManagerAbstract {
|
||||
public void setBoundingBox(Entity entity, double x, double y, double z) {
|
||||
Location loc = entity.getLocation();
|
||||
((CraftEntity) entity).getHandle().setBoundingBox(
|
||||
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
|
||||
loc.getZ() + z / 2));
|
||||
new AABB(loc.getX() - x / 2, loc.getY(), loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y, loc.getZ() + z / 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -254,8 +254,7 @@ public class ReflectionManager implements ReflectionManagerAbstract {
|
||||
public void setBoundingBox(Entity entity, double x, double y, double z) {
|
||||
Location loc = entity.getLocation();
|
||||
((CraftEntity) entity).getHandle().setBoundingBox(
|
||||
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
|
||||
loc.getZ() + z / 2));
|
||||
new AABB(loc.getX() - x / 2, loc.getY(), loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y, loc.getZ() + z / 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -273,8 +273,7 @@ public class ReflectionManager implements ReflectionManagerAbstract {
|
||||
public void setBoundingBox(Entity entity, double x, double y, double z) {
|
||||
Location loc = entity.getLocation();
|
||||
((CraftEntity) entity).getHandle().setBoundingBox(
|
||||
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
|
||||
loc.getZ() + z / 2));
|
||||
new AABB(loc.getX() - x / 2, loc.getY(), loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y, loc.getZ() + z / 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -268,8 +268,7 @@ public class ReflectionManager implements ReflectionManagerAbstract {
|
||||
public void setBoundingBox(Entity entity, double x, double y, double z) {
|
||||
Location loc = entity.getLocation();
|
||||
((CraftEntity) entity).getHandle().setBoundingBox(
|
||||
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
|
||||
loc.getZ() + z / 2));
|
||||
new AABB(loc.getX() - x / 2, loc.getY(), loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y, loc.getZ() + z / 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -269,8 +269,7 @@ public class ReflectionManager implements ReflectionManagerAbstract {
|
||||
public void setBoundingBox(Entity entity, double x, double y, double z) {
|
||||
Location loc = entity.getLocation();
|
||||
((CraftEntity) entity).getHandle().setBoundingBox(
|
||||
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
|
||||
loc.getZ() + z / 2));
|
||||
new AABB(loc.getX() - x / 2, loc.getY(), loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y, loc.getZ() + z / 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -282,8 +282,7 @@ public class ReflectionManager implements ReflectionManagerAbstract {
|
||||
public void setBoundingBox(Entity entity, double x, double y, double z) {
|
||||
Location loc = entity.getLocation();
|
||||
((CraftEntity) entity).getHandle().setBoundingBox(
|
||||
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
|
||||
loc.getZ() + z / 2));
|
||||
new AABB(loc.getX() - x / 2, loc.getY(), loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y, loc.getZ() + z / 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -283,8 +283,7 @@ public class ReflectionManager implements ReflectionManagerAbstract {
|
||||
public void setBoundingBox(Entity entity, double x, double y, double z) {
|
||||
Location loc = entity.getLocation();
|
||||
((CraftEntity) entity).getHandle().setBoundingBox(
|
||||
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
|
||||
loc.getZ() + z / 2));
|
||||
new AABB(loc.getX() - x / 2, loc.getY(), loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y, loc.getZ() + z / 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -286,8 +286,7 @@ public class ReflectionManager implements ReflectionManagerAbstract {
|
||||
public void setBoundingBox(Entity entity, double x, double y, double z) {
|
||||
Location loc = entity.getLocation();
|
||||
((CraftEntity) entity).getHandle().setBoundingBox(
|
||||
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
|
||||
loc.getZ() + z / 2));
|
||||
new AABB(loc.getX() - x / 2, loc.getY(), loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y, loc.getZ() + z / 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -291,8 +291,7 @@ public class ReflectionManager implements ReflectionManagerAbstract {
|
||||
public void setBoundingBox(Entity entity, double x, double y, double z) {
|
||||
Location loc = entity.getLocation();
|
||||
((CraftEntity) entity).getHandle().setBoundingBox(
|
||||
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
|
||||
loc.getZ() + z / 2));
|
||||
new AABB(loc.getX() - x / 2, loc.getY(), loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y, loc.getZ() + z / 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -293,8 +293,7 @@ public class ReflectionManager implements ReflectionManagerAbstract {
|
||||
public void setBoundingBox(Entity entity, double x, double y, double z) {
|
||||
Location loc = entity.getLocation();
|
||||
((CraftEntity) entity).getHandle().setBoundingBox(
|
||||
new AABB(loc.getX() - x / 2, loc.getY() - y / 2, loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y / 2,
|
||||
loc.getZ() + z / 2));
|
||||
new AABB(loc.getX() - x / 2, loc.getY(), loc.getZ() - z / 2, loc.getX() + x / 2, loc.getY() + y, loc.getZ() + z / 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,10 +1,12 @@
|
||||
package me.libraryaddict.disguise.utilities;
|
||||
|
||||
import lombok.Setter;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.utilities.reflection.FakeBoundingBox;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Setter
|
||||
public class DisguiseValues {
|
||||
private static final HashMap<DisguiseType, DisguiseValues> values = new HashMap<>();
|
||||
|
||||
@ -25,18 +27,10 @@ public class DisguiseValues {
|
||||
return adultBox;
|
||||
}
|
||||
|
||||
public void setAdultBox(FakeBoundingBox newBox) {
|
||||
adultBox = newBox;
|
||||
}
|
||||
|
||||
public FakeBoundingBox getBabyBox() {
|
||||
return babyBox;
|
||||
}
|
||||
|
||||
public void setBabyBox(FakeBoundingBox newBox) {
|
||||
babyBox = newBox;
|
||||
}
|
||||
|
||||
public double getMaxHealth() {
|
||||
return maxHealth;
|
||||
}
|
||||
|
@ -1382,6 +1382,12 @@ public class ReflectionManager {
|
||||
double y = newBox.getY();
|
||||
double z = newBox.getZ();
|
||||
|
||||
if (NmsVersion.v1_20_R4.isSupported()) {
|
||||
x *= scale;
|
||||
y *= scale;
|
||||
z *= scale;
|
||||
}
|
||||
|
||||
if (nmsReflection != null) {
|
||||
nmsReflection.setBoundingBox(entity, x, y, z);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user