mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-02-24 03:02:08 +01:00
Replaced INSTANCE fields with global getter
This commit is contained in:
parent
34d7808325
commit
d129cb5ed3
@ -90,7 +90,7 @@ public abstract class MixinFontStorage {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) {
|
||||
if (viaFabricPlus$isForbiddenCharacter(font, codePoint)) cir.setReturnValue(FontStorage.GlyphPair.MISSING);
|
||||
|
||||
if (VisualSettings.INSTANCE.changeFontRendererBehaviour.isEnabled() && cir.getReturnValue() == FontStorage.GlyphPair.MISSING) {
|
||||
if (VisualSettings.global().changeFontRendererBehaviour.isEnabled() && cir.getReturnValue() == FontStorage.GlyphPair.MISSING) {
|
||||
cir.setReturnValue(new FontStorage.GlyphPair(BuiltinEmptyGlyph1_12_2.VERY_MISSING, BuiltinEmptyGlyph1_12_2.VERY_MISSING));
|
||||
}
|
||||
}
|
||||
@ -103,7 +103,7 @@ public abstract class MixinFontStorage {
|
||||
if (!viaFabricPlus$obfuscation && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) {
|
||||
if (viaFabricPlus$isForbiddenCharacter(font, codePoint)) cir.setReturnValue(this.blankGlyphRenderer);
|
||||
|
||||
if (VisualSettings.INSTANCE.changeFontRendererBehaviour.isEnabled() && cir.getReturnValue() == this.blankGlyphRenderer) {
|
||||
if (VisualSettings.global().changeFontRendererBehaviour.isEnabled() && cir.getReturnValue() == this.blankGlyphRenderer) {
|
||||
cir.setReturnValue(BuiltinEmptyGlyph1_12_2.VERY_MISSING.bake(this::getGlyphRenderer));
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public abstract class MixinMinecraftClient {
|
||||
@Inject(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;",
|
||||
ordinal = 4, shift = At.Shift.BEFORE))
|
||||
private void injectTick(CallbackInfo ci) {
|
||||
if (!DebugSettings.INSTANCE.executeInputsInSync.isEnabled()) {
|
||||
if (!DebugSettings.global().executeInputsInSync.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ public abstract class MixinMinecraftClient {
|
||||
|
||||
@Inject(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;hasRidingInventory()Z"))
|
||||
private void onInventoryKeyPressed(CallbackInfo ci) {
|
||||
if (getNetworkHandler() != null && DebugSettings.INSTANCE.sendOpenInventoryPacket.isEnabled()) {
|
||||
if (getNetworkHandler() != null && DebugSettings.global().sendOpenInventoryPacket.isEnabled()) {
|
||||
final UserConnection userConnection = ProtocolHack.getPlayNetworkUserConnection();
|
||||
|
||||
if (userConnection != null && userConnection.getProtocolInfo().getPipeline().contains(Protocol1_12To1_11_1.class)) {
|
||||
|
@ -31,7 +31,7 @@ public abstract class MixinPendingUpdateManager {
|
||||
|
||||
@Inject(method = "incrementSequence", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/PendingUpdateManager;pendingSequence:Z", shift = At.Shift.BEFORE), cancellable = true)
|
||||
private void injectIncrementSequence(CallbackInfoReturnable<PendingUpdateManager> cir) {
|
||||
if (DebugSettings.INSTANCE.disableSequencing.isEnabled()) {
|
||||
if (DebugSettings.global().disableSequencing.isEnabled()) {
|
||||
cir.setReturnValue((PendingUpdateManager) (Object) this);
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public abstract class MixinAbstractBlock {
|
||||
|
||||
@Inject(method = "calcBlockBreakingDelta", at = @At("HEAD"), cancellable = true)
|
||||
private void changeMiningSpeedCalculation(BlockState state, PlayerEntity player, BlockView world, BlockPos pos, CallbackInfoReturnable<Float> cir) {
|
||||
if (DebugSettings.INSTANCE.legacyMiningSpeeds.isEnabled()) {
|
||||
if (DebugSettings.global().legacyMiningSpeeds.isEnabled()) {
|
||||
final float hardness = state.getHardness(world, pos);
|
||||
if (hardness == -1.0F) {
|
||||
cir.setReturnValue(0.0F);
|
||||
|
@ -40,7 +40,7 @@ public abstract class MixinBipedEntityModel<T extends LivingEntity> {
|
||||
|
||||
@Inject(method = "setAngles(Lnet/minecraft/entity/LivingEntity;FFFFF)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/model/ModelPart;roll:F", ordinal = 1, shift = At.Shift.AFTER))
|
||||
private void addOldWalkAnimation(T livingEntity, float f, float g, float h, float i, float j, CallbackInfo ci) {
|
||||
if (VisualSettings.INSTANCE.oldWalkingAnimation.isEnabled()) {
|
||||
if (VisualSettings.global().oldWalkingAnimation.isEnabled()) {
|
||||
this.rightArm.pitch = MathHelper.cos(f * 0.6662F + 3.1415927F) * 2.0F * g;
|
||||
this.rightArm.roll = (MathHelper.cos(f * 0.2312F) + 1.0F) * 1.0F * g;
|
||||
|
||||
|
@ -101,7 +101,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
|
||||
@Redirect(method = "sendMovementPackets", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;lastOnGround:Z", ordinal = 0))
|
||||
private boolean sendIdlePacket(ClientPlayerEntity instance) {
|
||||
if (DebugSettings.INSTANCE.sendIdlePacket.isEnabled()) {
|
||||
if (DebugSettings.global().sendIdlePacket.isEnabled()) {
|
||||
return !isOnGround();
|
||||
}
|
||||
return lastOnGround;
|
||||
|
@ -114,7 +114,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
|
||||
@Inject(method = "getHurtSound", at = @At("HEAD"), cancellable = true)
|
||||
private void replaceSound(DamageSource source, CallbackInfoReturnable<SoundEvent> cir) {
|
||||
if (VisualSettings.INSTANCE.replaceHurtSoundWithOOFSound.isEnabled()) {
|
||||
if (VisualSettings.global().replaceHurtSoundWithOOFSound.isEnabled()) {
|
||||
cir.setReturnValue(viaFabricPlus$random_hurt);
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public abstract class MixinCamera {
|
||||
|
||||
@Inject(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;setPos(DDD)V", shift = At.Shift.BEFORE))
|
||||
private void onUpdateHeight(BlockView area, Entity focusedEntity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo ci) {
|
||||
if (!DebugSettings.INSTANCE.replaceSneaking.isEnabled() && DebugSettings.INSTANCE.sneakInstant.isEnabled()) {
|
||||
if (!DebugSettings.global().replaceSneaking.isEnabled() && DebugSettings.global().sneakInstant.isEnabled()) {
|
||||
cameraY = lastCameraY = focusedEntity.getStandingEyeHeight();
|
||||
}
|
||||
}
|
||||
@ -53,14 +53,14 @@ public abstract class MixinCamera {
|
||||
private void onUpdateEyeHeight(CallbackInfo ci) {
|
||||
if (this.focusedEntity == null) return;
|
||||
|
||||
if (DebugSettings.INSTANCE.replaceSneaking.isEnabled()) {
|
||||
if (DebugSettings.global().replaceSneaking.isEnabled()) {
|
||||
ci.cancel();
|
||||
this.lastCameraY = this.cameraY;
|
||||
|
||||
if (this.focusedEntity instanceof PlayerEntity player && !player.isSleeping()) {
|
||||
if (player.isSneaking()) {
|
||||
cameraY = 1.54F;
|
||||
} else if (!DebugSettings.INSTANCE.longSneaking.isEnabled()) {
|
||||
} else if (!DebugSettings.global().longSneaking.isEnabled()) {
|
||||
cameraY = 1.62F;
|
||||
} else if (cameraY < 1.62F) {
|
||||
float delta = 1.62F - cameraY;
|
||||
|
@ -50,7 +50,7 @@ public abstract class MixinHeldItemRenderer {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
matrices.translate(-0.1F, 0.05F, 0.0F);
|
||||
|
||||
if (VisualSettings.INSTANCE.blockHitAnimation.isEnabled()) {
|
||||
if (VisualSettings.global().blockHitAnimation.isEnabled()) {
|
||||
final var arm = (hand == Hand.MAIN_HAND) ? player.getMainArm() : player.getMainArm().getOpposite();
|
||||
applySwingOffset(matrices, arm, swingProgress);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public abstract class MixinItemCooldownManager {
|
||||
|
||||
@Inject(method = "set", at = @At("HEAD"), cancellable = true)
|
||||
private void dontSetCooldown(Item item, int duration, CallbackInfo ci) {
|
||||
if (DebugSettings.INSTANCE.removeCooldowns.isEnabled()) {
|
||||
if (DebugSettings.global().removeCooldowns.isEnabled()) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public abstract class MixinItemRenderer {
|
||||
|
||||
@Inject(method = "getModel", at = @At("HEAD"), cancellable = true)
|
||||
private void removeModel(ItemStack stack, World world, LivingEntity entity, int seed, CallbackInfoReturnable<BakedModel> cir) {
|
||||
if (VisualSettings.INSTANCE.replacePetrifiedOakSlab.isEnabled() && world != null /* world is null in gui rendering */ && stack.isOf(Items.PETRIFIED_OAK_SLAB)) {
|
||||
if (VisualSettings.global().replacePetrifiedOakSlab.isEnabled() && world != null /* world is null in gui rendering */ && stack.isOf(Items.PETRIFIED_OAK_SLAB)) {
|
||||
cir.setReturnValue(this.models.getModelManager().getMissingModel());
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public abstract class MixinItemStack implements IItemStack {
|
||||
@SuppressWarnings({"InvalidInjectorMethodSignature", "MixinAnnotationTarget"})
|
||||
@ModifyVariable(method = "getAttributeModifiers", ordinal = 0, at = @At(value = "STORE", ordinal = 1))
|
||||
private Multimap<EntityAttribute, EntityAttributeModifier> modifyVariableGetAttributeModifiers(Multimap<EntityAttribute, EntityAttributeModifier> modifiers) {
|
||||
if (!DebugSettings.INSTANCE.replaceAttributeModifiers.isEnabled() || modifiers.isEmpty()) return modifiers;
|
||||
if (!DebugSettings.global().replaceAttributeModifiers.isEnabled() || modifiers.isEmpty()) return modifiers;
|
||||
|
||||
modifiers = HashMultimap.create(modifiers);
|
||||
modifiers.removeAll(EntityAttributes.GENERIC_ATTACK_DAMAGE);
|
||||
|
@ -126,7 +126,7 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
|
||||
@Redirect(method = "onServerMetadata", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/ServerMetadataS2CPacket;isSecureChatEnforced()Z"))
|
||||
private boolean removeSecureChatWarning(ServerMetadataS2CPacket instance) {
|
||||
return instance.isSecureChatEnforced() || VisualSettings.INSTANCE.disableSecureChatWarning.isEnabled();
|
||||
return instance.isSecureChatEnforced() || VisualSettings.global().disableSecureChatWarning.isEnabled();
|
||||
}
|
||||
|
||||
@Redirect(method = "onSynchronizeRecipes", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/SynchronizeRecipesS2CPacket;getRecipes()Ljava/util/List;"))
|
||||
|
@ -47,7 +47,7 @@ public abstract class MixinChatScreen {
|
||||
|
||||
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;getIndicatorAt(DD)Lnet/minecraft/client/gui/hud/MessageIndicator;"))
|
||||
private MessageIndicator removeIndicator(ChatHud instance, double mouseX, double mouseY) {
|
||||
if (VisualSettings.INSTANCE.hideSignatureIndicator.isEnabled()) {
|
||||
if (VisualSettings.global().hideSignatureIndicator.isEnabled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public abstract class MixinCommandBlockScreen {
|
||||
|
||||
@Inject(method = "init", at = @At("TAIL"))
|
||||
private void removeWidgets(CallbackInfo ci) {
|
||||
if (VisualSettings.INSTANCE.removeNewerFeaturesFromCommandBlockScreen.isEnabled()) {
|
||||
if (VisualSettings.global().removeNewerFeaturesFromCommandBlockScreen.isEnabled()) {
|
||||
modeButton.visible = false;
|
||||
conditionalModeButton.visible = false;
|
||||
redstoneTriggerButton.visible = false;
|
||||
|
@ -83,7 +83,7 @@ public abstract class MixinConnectScreen_1 {
|
||||
|
||||
@Redirect(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;send(Lnet/minecraft/network/packet/Packet;)V"))
|
||||
private void spoofUserName(ClientConnection instance, Packet<?> packet) {
|
||||
if (AuthenticationSettings.INSTANCE.setSessionNameToClassiCubeNameInServerList.getValue() && ViaFabricPlusClassicMPPassProvider.classiCubeMPPass != null) {
|
||||
if (AuthenticationSettings.global().setSessionNameToClassiCubeNameInServerList.getValue() && ViaFabricPlusClassicMPPassProvider.classiCubeMPPass != null) {
|
||||
final var account = ViaFabricPlus.global().getSaveManager().getAccountsSave().getClassicubeAccount();
|
||||
if (account != null) {
|
||||
instance.send(new LoginHelloC2SPacket(account.username(), MinecraftClient.getInstance().getSession().getUuidOrNull()));
|
||||
|
@ -33,7 +33,7 @@ public abstract class MixinCreativeInventoryScreen {
|
||||
|
||||
@Inject(method = "init", at = @At("RETURN"))
|
||||
private void replaceCreativeMenu(CallbackInfo ci) {
|
||||
if (VisualSettings.INSTANCE.replaceCreativeInventory.isEnabled()) {
|
||||
if (VisualSettings.global().replaceCreativeInventory.isEnabled()) {
|
||||
if (ClassicItemSelectionScreen.INSTANCE == null) return;
|
||||
|
||||
MinecraftClient.getInstance().setScreen(ClassicItemSelectionScreen.INSTANCE);
|
||||
|
@ -52,7 +52,7 @@ public abstract class MixinJigsawBlockScreen extends Screen {
|
||||
|
||||
@Inject(method = "init", at = @At("RETURN"))
|
||||
private void injectInit(CallbackInfo ci) {
|
||||
if (VisualSettings.INSTANCE.removeNewerFeaturesFromJigsawScreen.isEnabled()) {
|
||||
if (VisualSettings.global().removeNewerFeaturesFromJigsawScreen.isEnabled()) {
|
||||
nameField.active = false;
|
||||
jointRotationButton.active = false;
|
||||
int index = children().indexOf(jointRotationButton);
|
||||
@ -64,7 +64,7 @@ public abstract class MixinJigsawBlockScreen extends Screen {
|
||||
|
||||
@Inject(method = "render", at = @At("HEAD"))
|
||||
private void injectRender(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
if (VisualSettings.INSTANCE.removeNewerFeaturesFromJigsawScreen.isEnabled()) {
|
||||
if (VisualSettings.global().removeNewerFeaturesFromJigsawScreen.isEnabled()) {
|
||||
nameField.setText(targetField.getText());
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public abstract class MixinOptionsScreen extends Screen {
|
||||
|
||||
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/GridWidget$Adder;add(Lnet/minecraft/client/gui/widget/Widget;)Lnet/minecraft/client/gui/widget/Widget;", ordinal = 10, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private void showSuperSecretSettings(CallbackInfo ci, GridWidget gridWidget, GridWidget.Adder adder) {
|
||||
if (VisualSettings.INSTANCE.showSuperSecretSettings.isEnabled() && MinecraftClient.getInstance().player != null) {
|
||||
if (VisualSettings.global().showSuperSecretSettings.isEnabled() && MinecraftClient.getInstance().player != null) {
|
||||
this.addDrawableChild(ButtonWidget.builder(Text.literal("Super Secret Settings..."), button -> MinecraftClient.getInstance().gameRenderer.cycleSuperSecretSetting()).dimensions(this.width / 2 + 5, this.height / 6 + 18, 150, 20).build());
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public abstract class MixinChatHud {
|
||||
|
||||
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHudLine$Visible;indicator()Lnet/minecraft/client/gui/hud/MessageIndicator;"), require = 0)
|
||||
private MessageIndicator removeIndicators(ChatHudLine.Visible instance, Operation<MessageIndicator> original) {
|
||||
if (VisualSettings.INSTANCE.hideSignatureIndicator.isEnabled()) {
|
||||
if (VisualSettings.global().hideSignatureIndicator.isEnabled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -42,22 +42,22 @@ public abstract class MixinInGameHud {
|
||||
|
||||
@Inject(method = "renderExperienceBar", at = @At("HEAD"), cancellable = true)
|
||||
private void removeExperienceBar(DrawContext context, int x, CallbackInfo ci) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) ci.cancel();
|
||||
if (VisualSettings.global().removeNewerHudElements.isEnabled()) ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "renderMountJumpBar", at = @At("HEAD"), cancellable = true)
|
||||
private void removeMountJumpBar(JumpingMount mount, DrawContext context, int x, CallbackInfo ci) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) ci.cancel();
|
||||
if (VisualSettings.global().removeNewerHudElements.isEnabled()) ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "renderMountHealth", at = @At("HEAD"), cancellable = true)
|
||||
private void removeMountHealth(DrawContext context, CallbackInfo ci) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) ci.cancel();
|
||||
if (VisualSettings.global().removeNewerHudElements.isEnabled()) ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "getHeartCount", at = @At("HEAD"), cancellable = true)
|
||||
private void removeHungerBar(LivingEntity entity, CallbackInfoReturnable<Integer> cir) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) {
|
||||
if (VisualSettings.global().removeNewerHudElements.isEnabled()) {
|
||||
cir.setReturnValue(1);
|
||||
}
|
||||
}
|
||||
@ -67,7 +67,7 @@ public abstract class MixinInGameHud {
|
||||
@ModifyExpressionValue(method = "renderStatusBars", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/hud/InGameHud;scaledHeight:I", opcode = Opcodes.GETFIELD),
|
||||
require = 0)
|
||||
private int moveHealthDown(int originalValue) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) return originalValue + 6;
|
||||
if (VisualSettings.global().removeNewerHudElements.isEnabled()) return originalValue + 6;
|
||||
return originalValue;
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ public abstract class MixinInGameHud {
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 0)), index = 1,
|
||||
require = 0)
|
||||
private int moveArmor(int old) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) return scaledWidth - old - 9;
|
||||
if (VisualSettings.global().removeNewerHudElements.isEnabled()) return scaledWidth - old - 9;
|
||||
return old;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public abstract class MixinInGameHud {
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 0)), index = 2,
|
||||
require = 0)
|
||||
private int moveArmorDown(int old) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) return scaledWidth - 39 + 6;
|
||||
if (VisualSettings.global().removeNewerHudElements.isEnabled()) return scaledWidth - 39 + 6;
|
||||
return old;
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public abstract class MixinInGameHud {
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V")), index = 1,
|
||||
require = 0)
|
||||
private int moveAir(int old) {
|
||||
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) return scaledWidth - old - 9;
|
||||
if (VisualSettings.global().removeNewerHudElements.isEnabled()) return scaledWidth - old - 9;
|
||||
return old;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public abstract class MixinMerchantScreen extends HandledScreen<MerchantScreenHa
|
||||
|
||||
@Inject(method = "syncRecipeIndex", at = @At("HEAD"))
|
||||
private void smoothOutRecipeIndex(CallbackInfo ci) {
|
||||
if (DebugSettings.INSTANCE.smoothOutMerchantScreens.isEnabled()) {
|
||||
if (DebugSettings.global().smoothOutMerchantScreens.isEnabled()) {
|
||||
if (viaFabricPlus$previousRecipeIndex != selectedIndex) {
|
||||
int direction = viaFabricPlus$previousRecipeIndex < selectedIndex ? 1 : -1;
|
||||
for (int smooth = viaFabricPlus$previousRecipeIndex + direction /* don't send the page we already are on */; smooth != selectedIndex; smooth += direction) {
|
||||
|
@ -39,7 +39,7 @@ public class ViaFabricPlusTransferProvider extends TransferProvider {
|
||||
public void connectToServer(UserConnection user, InetSocketAddress newAddress) {
|
||||
final var mc = MinecraftClient.getInstance();
|
||||
mc.execute(() -> {
|
||||
if (BedrockSettings.INSTANCE.openPromptGUIToConfirmTransfer.getValue()) {
|
||||
if (BedrockSettings.global().openPromptGUIToConfirmTransfer.getValue()) {
|
||||
mc.setScreen(new ConfirmScreen(
|
||||
(bl) -> {
|
||||
if (bl)
|
||||
|
@ -37,7 +37,7 @@ public class ViaFabricPlusClassicMPPassProvider extends ClassicMPPassProvider {
|
||||
return classiCubeMPPass;
|
||||
}
|
||||
|
||||
if (AuthenticationSettings.INSTANCE.useBetaCraftAuthentication.getValue()) {
|
||||
if (AuthenticationSettings.global().useBetaCraftAuthentication.getValue()) {
|
||||
final var handshakeStorage = user.get(HandshakeStorage.class);
|
||||
if (handshakeStorage == null) {
|
||||
return super.getMpPass(user);
|
||||
|
@ -32,7 +32,7 @@ public class ViaFabricPlusOldAuthProvider extends OldAuthProvider {
|
||||
|
||||
@Override
|
||||
public void sendAuthRequest(UserConnection user, String serverId) throws Throwable {
|
||||
if (!AuthenticationSettings.INSTANCE.verifySessionForOnlineModeServers.getValue()) return;
|
||||
if (!AuthenticationSettings.global().verifySessionForOnlineModeServers.getValue()) return;
|
||||
|
||||
try {
|
||||
final var mc = MinecraftClient.getInstance();
|
||||
|
@ -139,7 +139,7 @@ public class ClassiCubeServerListScreen extends VFPScreen {
|
||||
final ServerInfo entry = new ServerInfo(classiCubeServerInfo.name(), serverAddress.getAddress(), ServerInfo.ServerType.OTHER);
|
||||
ViaFabricPlusClassicMPPassProvider.classiCubeMPPass = classiCubeServerInfo.mpPass();
|
||||
|
||||
if (AuthenticationSettings.INSTANCE.automaticallySelectCPEInClassiCubeServerList.getValue()) {
|
||||
if (AuthenticationSettings.global().automaticallySelectCPEInClassiCubeServerList.getValue()) {
|
||||
((IServerInfo) entry).viaFabricPlus$forceVersion(VersionEnum.c0_30cpe);
|
||||
}
|
||||
|
||||
|
@ -35,10 +35,10 @@ public class SettingsManager {
|
||||
|
||||
addGroup(
|
||||
GeneralSettings.global(),
|
||||
BedrockSettings.INSTANCE,
|
||||
AuthenticationSettings.INSTANCE,
|
||||
VisualSettings.INSTANCE,
|
||||
DebugSettings.INSTANCE
|
||||
BedrockSettings.global(),
|
||||
AuthenticationSettings.global(),
|
||||
VisualSettings.global(),
|
||||
DebugSettings.global()
|
||||
);
|
||||
|
||||
RegisterSettingsCallback.EVENT.invoker().onInitializeSettings(RegisterSettingsCallback.State.POST);
|
||||
|
@ -24,7 +24,7 @@ import de.florianmichael.viafabricplus.settings.base.BooleanSetting;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public class AuthenticationSettings extends SettingGroup {
|
||||
public static final AuthenticationSettings INSTANCE = new AuthenticationSettings();
|
||||
private static final AuthenticationSettings instance = new AuthenticationSettings();
|
||||
|
||||
public final BooleanSetting useBetaCraftAuthentication = new BooleanSetting(this, Text.translatable("authentication_settings.viafabricplus.use_beta_craft_authentication"), true);
|
||||
public final BooleanSetting verifySessionForOnlineModeServers = new BooleanSetting(this, Text.translatable("authentication_settings.viafabricplus.verify_session_for_online_mode"), true);
|
||||
@ -34,4 +34,8 @@ public class AuthenticationSettings extends SettingGroup {
|
||||
public AuthenticationSettings() {
|
||||
super(Text.translatable("setting_group_name.viafabricplus.authentication"));
|
||||
}
|
||||
|
||||
public static AuthenticationSettings global() {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ import java.net.URISyntaxException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class BedrockSettings extends SettingGroup {
|
||||
public static final BedrockSettings INSTANCE = new BedrockSettings();
|
||||
private static final BedrockSettings instance = new BedrockSettings();
|
||||
|
||||
public final ButtonSetting _1 = new ButtonSetting(this, Text.translatable("bedrock_settings.viafabricplus.click_to_set_bedrock_account"), () -> CompletableFuture.runAsync(this::openBedrockAccountLogin)) {
|
||||
|
||||
@ -88,5 +88,9 @@ public class BedrockSettings extends SettingGroup {
|
||||
VFPScreen.showErrorScreen("Microsoft Bedrock Login", e, prevScreen);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static BedrockSettings global() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import net.minecraft.text.Text;
|
||||
import net.raphimc.vialoader.util.VersionRange;
|
||||
|
||||
public class DebugSettings extends SettingGroup {
|
||||
public static final DebugSettings INSTANCE = new DebugSettings();
|
||||
private static final DebugSettings instance = new DebugSettings();
|
||||
|
||||
// 1.19 -> 1.18.2
|
||||
public final VersionedBooleanSetting disableSequencing = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.disable_sequencing"), VersionRange.andOlder(VersionEnum.r1_18_2));
|
||||
@ -56,4 +56,9 @@ public class DebugSettings extends SettingGroup {
|
||||
public DebugSettings() {
|
||||
super(Text.translatable("setting_group_name.viafabricplus.debug"));
|
||||
}
|
||||
|
||||
public static DebugSettings global() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import net.minecraft.text.Text;
|
||||
import net.raphimc.vialoader.util.VersionRange;
|
||||
|
||||
public class VisualSettings extends SettingGroup {
|
||||
public static final VisualSettings INSTANCE = new VisualSettings();
|
||||
private static final VisualSettings instance = new VisualSettings();
|
||||
|
||||
// 1.19.2 -> 1.19
|
||||
public final VersionedBooleanSetting disableSecureChatWarning = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.disable_secure_chat_warning"), VersionRange.andOlder(VersionEnum.r1_19));
|
||||
@ -62,4 +62,9 @@ public class VisualSettings extends SettingGroup {
|
||||
public VisualSettings() {
|
||||
super(Text.translatable("setting_group_name.viafabricplus.visual"));
|
||||
}
|
||||
|
||||
public static VisualSettings global() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user