diff --git a/src/main/java/net/ltxprogrammer/changed/ChangedConfig.java b/src/main/java/net/ltxprogrammer/changed/ChangedConfig.java index 90736d1bc..3be82077a 100644 --- a/src/main/java/net/ltxprogrammer/changed/ChangedConfig.java +++ b/src/main/java/net/ltxprogrammer/changed/ChangedConfig.java @@ -104,6 +104,7 @@ public static class Server { public final ForgeConfigSpec.ConfigValue> whitelistCoverBlocks; public final ForgeConfigSpec.ConfigValue playerControllingAbilities; public final ForgeConfigSpec.ConfigValue isGrabEnabled; + public final ForgeConfigSpec.ConfigValue bpiSizeTolerance; public Server(ForgeConfigSpec.Builder builder) { builder.comment("Should transfurred players have a nametag"); @@ -116,6 +117,8 @@ public Server(ForgeConfigSpec.Builder builder) { playerControllingAbilities = builder.define("playerControllingAbilities", true); builder.comment("Can latexes use the grab ability on players."); isGrabEnabled = builder.define("isGrabEnabled", true); + builder.comment("Acceptable model scaling through BPI (Default: +/- 5%)"); + bpiSizeTolerance = builder.defineInRange("bpiSizeTolerance", 0.05, 0.01, 0.95); } public Stream> getBlacklistedCoverBlocks() { diff --git a/src/main/java/net/ltxprogrammer/changed/client/gui/BasicPlayerInfoScreen.java b/src/main/java/net/ltxprogrammer/changed/client/gui/BasicPlayerInfoScreen.java index ec54ac63b..3aaf927cb 100644 --- a/src/main/java/net/ltxprogrammer/changed/client/gui/BasicPlayerInfoScreen.java +++ b/src/main/java/net/ltxprogrammer/changed/client/gui/BasicPlayerInfoScreen.java @@ -90,7 +90,7 @@ protected void init() { } private double convertToScaledValue() { - return (this.value * BasicPlayerInfo.SIZE_TOLERANCE * 2) - BasicPlayerInfo.SIZE_TOLERANCE + 1.0; + return (this.value * BasicPlayerInfo.getSizeTolerance() * 2) - BasicPlayerInfo.getSizeTolerance() + 1.0; } @Override diff --git a/src/main/java/net/ltxprogrammer/changed/client/renderer/AdvancedHumanoidRenderer.java b/src/main/java/net/ltxprogrammer/changed/client/renderer/AdvancedHumanoidRenderer.java index 1964bb07a..d722e0ef1 100644 --- a/src/main/java/net/ltxprogrammer/changed/client/renderer/AdvancedHumanoidRenderer.java +++ b/src/main/java/net/ltxprogrammer/changed/client/renderer/AdvancedHumanoidRenderer.java @@ -103,7 +103,7 @@ protected boolean isEntityUprightType(@NotNull T entity) { } protected void scaleForBPI(BasicPlayerInfo bpi, PoseStack poseStack) { - float forcedLimit = Mth.clamp(bpi.getSize(), 1.0f - BasicPlayerInfo.SIZE_TOLERANCE, 1.05f + BasicPlayerInfo.SIZE_TOLERANCE); + float forcedLimit = Mth.clamp(bpi.getSize(), 1.0f - BasicPlayerInfo.getSizeTolerance(), 1.05f + BasicPlayerInfo.getSizeTolerance()); poseStack.scale(forcedLimit, forcedLimit, forcedLimit); } diff --git a/src/main/java/net/ltxprogrammer/changed/entity/BasicPlayerInfo.java b/src/main/java/net/ltxprogrammer/changed/entity/BasicPlayerInfo.java index 0b7bba3de..498d7abb4 100644 --- a/src/main/java/net/ltxprogrammer/changed/entity/BasicPlayerInfo.java +++ b/src/main/java/net/ltxprogrammer/changed/entity/BasicPlayerInfo.java @@ -1,5 +1,6 @@ package net.ltxprogrammer.changed.entity; +import net.ltxprogrammer.changed.Changed; import net.ltxprogrammer.changed.util.Color3; import net.minecraft.Util; import net.minecraft.nbt.CompoundTag; @@ -12,7 +13,9 @@ * This is basic info about the player, that they set. */ public class BasicPlayerInfo { - public static final float SIZE_TOLERANCE = 0.05f; + public static float getSizeTolerance() { + return (float) Changed.config.server.bpiSizeTolerance.get().doubleValue(); + } // Default values here are based on Colin's properties // When the player is TF'd these values will copy over to the latex representative @@ -68,7 +71,7 @@ public static BasicPlayerInfo random(Random random) { info.irisRightColor = random.nextFloat() > 0.05f ? info.irisLeftColor : Util.getRandom(IRIS_COLORS, random); // 5% for dichrome eyes info.eyeStyle = Util.getRandom(EyeStyle.values(), random); info.overrideOthersToMatchStyle = false; - info.size = (random.nextFloat() * (random.nextBoolean() ? SIZE_TOLERANCE : -SIZE_TOLERANCE)) + 1.0f; + info.size = (random.nextFloat() * (random.nextBoolean() ? getSizeTolerance() : -getSizeTolerance())) + 1.0f; return info; } @@ -133,11 +136,11 @@ public EyeStyle getEyeStyle() { } public float getSize() { - return Mth.clamp(size, 1.0f - SIZE_TOLERANCE, 1.0f + SIZE_TOLERANCE); + return Mth.clamp(size, 1.0f - getSizeTolerance(), 1.0f + getSizeTolerance()); } public double getSizeValueForConfiguration() { - return (size - 1.0f + SIZE_TOLERANCE) / (SIZE_TOLERANCE * 2); + return (size - 1.0f + getSizeTolerance()) / (getSizeTolerance() * 2); } public void copyFrom(BasicPlayerInfo other) {