mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-12 15:07:22 +01:00
Fix no setting to control if tall self disguises are scaled per disguise
This commit is contained in:
parent
ebf66ce1b0
commit
1fbda44bb1
@ -44,7 +44,7 @@ public class DisguiseViewSelfCommand implements CommandExecutor {
|
||||
// If they're disguised, tall disguises are hidden, it's a tall disguise
|
||||
// Then tell the player, it's not a bug! The disguise is too tall
|
||||
if (disguise != null && !disguise.isTallDisguisesVisible() &&
|
||||
(!NmsVersion.v1_20_R4.isSupported() || !DisguiseConfig.isTallSelfDisguisesScaling() ||
|
||||
(!NmsVersion.v1_20_R4.isSupported() || !disguise.isTallSelfDisguisesScaling() ||
|
||||
(disguise.isMiscDisguise() || disguise.getType() == DisguiseType.ENDER_DRAGON)) && disguise.canSee(player) &&
|
||||
DisguiseUtilities.isTallDisguise(disguise)) {
|
||||
LibsMsg.VIEW_SELF_TALL_NOTE.send(player);
|
||||
|
@ -133,6 +133,8 @@ public abstract class Disguise {
|
||||
@Getter
|
||||
private boolean scalePlayerToDisguise = DisguiseConfig.isScaleSelfDisguises();
|
||||
@Getter
|
||||
private boolean tallSelfDisguisesScaling = DisguiseConfig.isTallSelfDisguisesScaling();
|
||||
@Getter
|
||||
private final DisguiseInternals internals;
|
||||
|
||||
public Disguise(DisguiseType disguiseType) {
|
||||
@ -521,7 +523,7 @@ public abstract class Disguise {
|
||||
}
|
||||
|
||||
if (getEntity() instanceof Player && isSelfDisguiseVisible() && !isTallDisguisesVisible() && isTallDisguise()) {
|
||||
if (DisguiseConfig.isTallSelfDisguisesScaling() && NmsVersion.v1_20_R4.isSupported() && canScaleDisguise()) {
|
||||
if (isTallSelfDisguisesScaling() && NmsVersion.v1_20_R4.isSupported() && canScaleDisguise()) {
|
||||
adjustTallSelfDisguiseScale();
|
||||
} else {
|
||||
setSelfDisguiseVisible(false);
|
||||
@ -550,6 +552,15 @@ public abstract class Disguise {
|
||||
adjustTallSelfDisguiseScale();
|
||||
}
|
||||
|
||||
public void setTallSelfDisguisesScaling(boolean tallSelfDisguisesScaling) {
|
||||
if (!NmsVersion.v1_20_R4.isSupported()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.tallSelfDisguisesScaling = tallSelfDisguisesScaling;
|
||||
adjustTallSelfDisguiseScale();
|
||||
}
|
||||
|
||||
protected void adjustTallSelfDisguiseScale() {
|
||||
if (!canScaleDisguise() || !isDisguiseInUse() || getEntity() == null) {
|
||||
return;
|
||||
@ -598,7 +609,7 @@ public abstract class Disguise {
|
||||
return;
|
||||
}
|
||||
|
||||
if (prevPersonalDisguiseScaleMax != newPersonalDisguiseScaleMax && isSelfDisguiseVisible()) {
|
||||
if (prevPersonalDisguiseScaleMax != newPersonalDisguiseScaleMax && isSelfDisguiseVisible() && isTallSelfDisguisesScaling()) {
|
||||
double scaleToSend;
|
||||
|
||||
if (((LivingWatcher) getWatcher()).getScale() != null) {
|
||||
@ -607,7 +618,9 @@ public abstract class Disguise {
|
||||
scaleToSend = playerScaleWithoutLibsDisguises;
|
||||
}
|
||||
|
||||
scaleToSend = Math.min(scaleToSend, newPersonalDisguiseScaleMax);
|
||||
if (isScalePlayerToDisguise()) {
|
||||
scaleToSend = Math.min(scaleToSend, newPersonalDisguiseScaleMax);
|
||||
}
|
||||
|
||||
// The scale of the self disguise, not the player
|
||||
WrapperPlayServerUpdateAttributes.Property property =
|
||||
@ -1000,8 +1013,7 @@ 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 (isTallSelfDisguisesScaling() && NmsVersion.v1_20_R4.isSupported() && canScaleDisguise() && !isPlayerDisguise()) {
|
||||
adjustTallSelfDisguiseScale();
|
||||
} else {
|
||||
viewSelfDisguise = false;
|
||||
|
@ -98,7 +98,7 @@ public class LivingWatcher extends FlagWatcher {
|
||||
Entity entity = getDisguise().getEntity();
|
||||
|
||||
for (Player player : DisguiseUtilities.getPerverts(getDisguise())) {
|
||||
double toSend = player == entity && DisguiseConfig.isTallSelfDisguisesScaling() ?
|
||||
double toSend = player == entity && getDisguise().isTallSelfDisguisesScaling() ?
|
||||
Math.min(getDisguise().getInternals().getSelfDisguiseTallScaleMax(), scaleToSend) : scaleToSend;
|
||||
|
||||
WrapperPlayServerUpdateAttributes.Property property =
|
||||
|
@ -54,7 +54,7 @@ public class PacketHandlerAttributes implements IPacketHandler<WrapperPlayServer
|
||||
Double scale = ((LivingWatcher) disguise.getWatcher()).getScale();
|
||||
|
||||
// If it's for the self disguise and the disguise had to be scaled down
|
||||
if (entity == observer && DisguiseConfig.isTallSelfDisguisesScaling()) {
|
||||
if (entity == observer && disguise.isTallSelfDisguisesScaling()) {
|
||||
attributes.add(new WrapperPlayServerUpdateAttributes.Property(Attributes.GENERIC_SCALE,
|
||||
Math.min(disguise.getInternals().getSelfDisguiseTallScaleMax(), scale == null ? property.getValue() : scale),
|
||||
new ArrayList<>()));
|
||||
|
@ -310,7 +310,7 @@ public class PacketHandlerSpawn implements IPacketHandler {
|
||||
if (NmsVersion.v1_20_R4.isSupported()) {
|
||||
Double scale = ((LivingWatcher) disguise.getWatcher()).getScale();
|
||||
|
||||
if (observer == disguisedEntity && DisguiseConfig.isTallSelfDisguisesScaling()) {
|
||||
if (observer == disguisedEntity && disguise.isTallSelfDisguisesScaling()) {
|
||||
if (scale == null) {
|
||||
scale = DisguiseUtilities.getEntityScaleWithoutLibsDisguises(observer);
|
||||
}
|
||||
|
@ -184,6 +184,7 @@ public class DisguiseMethods {
|
||||
|
||||
if (NmsVersion.v1_20_R4.isSupported()) {
|
||||
extraMethods.add("setScalePlayerToDisguise");
|
||||
extraMethods.add("setTallSelfDisguisesScaling");
|
||||
}
|
||||
|
||||
// Add these last as it's what we want to present to be called the least
|
||||
|
Loading…
Reference in New Issue
Block a user