Add min self disguise scale, reword stuff

This commit is contained in:
libraryaddict 2024-10-03 15:54:51 +13:00
parent 1d6c59b5d5
commit 12331aa67d
3 changed files with 14 additions and 4 deletions

View File

@ -294,6 +294,9 @@ public class DisguiseConfig {
private static boolean scaleSelfDisguises;
@Getter
@Setter
private static double scaleSelfDisguisesMin;
@Getter
@Setter
private static double scaleSelfDisguisesMax;
@Getter
@Setter
@ -605,6 +608,7 @@ public class DisguiseConfig {
setViewDisguises(config.getBoolean("ViewSelfDisguises"));
setViewSelfDisguisesDefault(config.getBoolean("ViewSelfDisguisesDefault"));
setScaleSelfDisguises(config.getBoolean("SelfDisguisesScaling"));
setScaleSelfDisguisesMin(config.getDouble("SelfDisguisesScaleMin"));
setScaleSelfDisguisesMax(config.getDouble("SelfDisguisesScaleMax"));
setSelfDisguisesSoundsReplaced(config.getBoolean("HearSelfDisguise"));
setShowDisguisedPlayersInTab(config.getBoolean("ShowPlayerDisguisesInTab"));

View File

@ -563,7 +563,8 @@ public abstract class Disguise {
// Here we have the scale of the player itself, where they'd be scaled up or down to match the disguise's scale
// So a disguise that's 0.5 blocks high, will have the player be given something like 0.33 scale
double playerScale = disguiseHeight / (1.8 * entityScaleWithoutLibsDisguises);
playerScale = Math.min(playerScale, DisguiseConfig.getScaleSelfDisguisesMax());
// Clamp the scale to the min and max
playerScale = Math.max(Math.min(playerScale, DisguiseConfig.getScaleSelfDisguisesMax()), DisguiseConfig.getScaleSelfDisguisesMin());
// The max size the self disguise is allowed to be, as it'd hide the player's view
double prevScale = getInternals().getSelfDisguiseTallScaleMax();
@ -976,7 +977,8 @@ public abstract class Disguise {
@Deprecated
public Disguise setViewSelfDisguise(boolean viewSelfDisguise) {
if (viewSelfDisguise && !isTallDisguisesVisible() && isTallDisguise()) {
if (DisguiseConfig.isTallSelfDisguisesScaling() && NmsVersion.v1_20_R4.isSupported() && canScaleDisguise() && !isPlayerDisguise()) {
if (DisguiseConfig.isTallSelfDisguisesScaling() && NmsVersion.v1_20_R4.isSupported() && canScaleDisguise() &&
!isPlayerDisguise()) {
adjustTallSelfDisguiseScale();
} else {
viewSelfDisguise = false;

View File

@ -20,8 +20,12 @@ ViewSelfDisguisesDefault: true
# The player's move, jump, etc is unchanged
SelfDisguisesScaling: false
# The max size a self disguise will change the player to match, 1 means they can only shrink, 2 means they can go up to 2x the size
# There is no min set as there's not much of a point, disable this entirely if you need the min.
# The following two settings controls the min and max scale that can be applied to a self disguise so that the player's viewpoint will shrink/grow to match.
# This means they will not shrink below the min, and will not grow beyond the max
# 0.3 means 30% of the player's size. 0.72 means 72%, 2 means 200%, etc.
# The minimum scale (per Minecraft) is 0.06
SelfDisguisesScaleMin: 0.06
# The default is 1, so players can only shrink and if disguised as something larger, will not see themselves become taller
SelfDisguisesScaleMax: 1
# Shall the disguised hear their disguise sounds or their damage sounds.