Search in sources :

Example 1 with DebugBlockLocation

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);
}
Also used : DebugBlockLocation(com.magmaguy.elitemobs.utils.DebugBlockLocation) ConfigurationLocation(com.magmaguy.elitemobs.utils.ConfigurationLocation) Location(org.bukkit.Location) DebugBlockLocation(com.magmaguy.elitemobs.utils.DebugBlockLocation)

Aggregations

ConfigurationLocation (com.magmaguy.elitemobs.utils.ConfigurationLocation)1 DebugBlockLocation (com.magmaguy.elitemobs.utils.DebugBlockLocation)1 Location (org.bukkit.Location)1