use of com.magmaguy.elitemobs.utils.DebugBlockLocation in project EliteMobs by MagmaGuy.
the class DungeonPackagerConfigFields method setAnchorPoint.
private void setAnchorPoint(Location location) {
Location roundedLocation = location.clone();
roundedLocation.setX(roundedLocation.getBlockX() + 0.5);
roundedLocation.setY(roundedLocation.getBlockY() + 0.5);
roundedLocation.setZ(roundedLocation.getBlockZ() + 0.5);
float roundedYaw = roundedLocation.getYaw();
while (roundedYaw < -225F) {
roundedYaw += 360F;
}
while (roundedYaw > 225F) {
roundedYaw -= 360F;
}
if (roundedYaw <= 45F && roundedYaw >= -45F)
roundedYaw = 0F;
else if (roundedYaw >= 45F && roundedYaw <= 135F)
roundedYaw = 90F;
else if (roundedYaw <= -45F && roundedYaw >= -135F)
roundedYaw = -90F;
else if (roundedYaw >= 135F || roundedYaw <= -135F)
roundedYaw = 180F;
roundedLocation.setYaw(roundedYaw);
this.anchorPoint = roundedLocation;
setRotation(roundedYaw);
ConfigurationEngine.writeValue(ConfigurationLocation.deserialize(roundedLocation), file, fileConfiguration, "anchorPoint");
new DebugBlockLocation(roundedLocation);
}
Aggregations