This commit is contained in:
FlorianMichael 2023-06-18 00:36:12 +02:00
parent 19194f8bc6
commit ee5a44fd70
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
31 changed files with 103 additions and 85 deletions

View File

@ -23,11 +23,11 @@ viabackwards_version=4.7.1-SNAPSHOT
snake_yml_version=2.0
# raphimc libs
vialegacy_version=2.2.17
vialegacy_version=2.2.18-SNAPSHOT
viaaprilfools_version=2.0.8-SNAPSHOT
viabedrock_version=0.0.2-SNAPSHOT
minecraftauth_version=2.1.4-SNAPSHOT
vialoader_version=2.2.5
vialoader_version=2.2.7-SNAPSHOT
# lenni0451 libs
mcstructs_text_version=2.2.5

View File

@ -32,7 +32,6 @@ public class GeneralSettings extends SettingGroup {
Text.translatable("words.viafabricplus.rb")
);
public final BooleanSetting removeNotAvailableItemsFromCreativeTab = new BooleanSetting(this, Text.translatable("general.viafabricplus.creative"), true);
public final BooleanSetting automaticallyChangeValuesBasedOnTheCurrentVersion = new BooleanSetting(this, Text.translatable("general.viafabricplus.protocolsync"), true);
public final BooleanSetting showSuperSecretSettings = new BooleanSetting(this, Text.translatable("general.viafabricplus.secret"), true);
public final BooleanSetting showExtraInformationInDebugHud = new BooleanSetting(this, Text.translatable("general.viafabricplus.extrainformation"), true);
public final BooleanSetting showClassicLoadingProgressInConnectScreen = new BooleanSetting(this, Text.translatable("general.viafabricplus.classicloading"), true);

View File

@ -18,19 +18,22 @@
package de.florianmichael.viafabricplus.base.settings.type_impl;
import com.google.gson.JsonObject;
import de.florianmichael.viafabricplus.base.settings.base.AbstractSetting;
import de.florianmichael.viafabricplus.screen.MappedSlotEntry;
import de.florianmichael.viafabricplus.screen.impl.settings.settingrenderer.ProtocolSyncBooleanSettingRenderer;
import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import net.minecraft.text.MutableText;
import net.raphimc.vialoader.util.VersionRange;
public class ProtocolSyncBooleanSetting extends BooleanSetting {
public class ProtocolSyncBooleanSetting extends AbstractSetting<Integer> {
public final static int AUTO = 2;
public final static int ENABLED = 0;
private final VersionRange protocolRange;
public ProtocolSyncBooleanSetting(SettingGroup parent, MutableText name, VersionRange protocolRange) {
super(parent, name, true);
super(parent, name, 2);
this.protocolRange = protocolRange;
}
@ -49,14 +52,22 @@ public class ProtocolSyncBooleanSetting extends BooleanSetting {
public void read(JsonObject object) {
if (!object.has(getTranslationKey())) return;
setValue(object.get(getTranslationKey()).getAsBoolean());
if (object.get(getTranslationKey()).isJsonPrimitive() && object.get(getTranslationKey()).getAsJsonPrimitive().isBoolean()) { // Migrate configs, will be removed in the future
setValue(AUTO);
return;
}
@Override
public Boolean getValue() {
if (GeneralSettings.INSTANCE.automaticallyChangeValuesBasedOnTheCurrentVersion.getValue()) return this.getProtocolRange().contains(ProtocolHack.getTargetVersion());
setValue(object.get(getTranslationKey()).getAsInt());
}
return super.getValue();
public boolean isAuto() {
return getValue() == AUTO;
}
public boolean isEnabled() {
if (isAuto()) return this.getProtocolRange().contains(ProtocolHack.getTargetVersion());
return getValue() == ENABLED;
}
public VersionRange getProtocolRange() {

View File

@ -22,7 +22,7 @@ import de.florianmichael.viafabricplus.ViaFabricPlus;
import de.florianmichael.viafabricplus.base.FileSaver;
import net.raphimc.mcauth.MinecraftAuth;
import net.raphimc.mcauth.step.bedrock.StepMCChain;
import net.raphimc.mcauth.step.bedrock.playfab.StepPlayFabToken;
import net.raphimc.mcauth.step.bedrock.StepPlayFabToken;
import net.raphimc.mcauth.util.MicrosoftConstants;
import org.apache.http.impl.client.CloseableHttpClient;

View File

@ -38,7 +38,7 @@ public 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))
public void addOldWalkAnimation(T livingEntity, float f, float g, float h, float i, float j, CallbackInfo ci) {
if (VisualSettings.INSTANCE.oldWalkingAnimation.getValue()) {
if (VisualSettings.INSTANCE.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;

View File

@ -42,7 +42,7 @@ public class MixinCamera {
@Inject(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;setPos(DDD)V", shift = At.Shift.BEFORE))
public void onUpdateHeight(BlockView area, Entity focusedEntity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo ci) {
if (!DebugSettings.INSTANCE.replaceSneaking.getValue() && DebugSettings.INSTANCE.sneakInstant.getValue()) {
if (!DebugSettings.INSTANCE.replaceSneaking.isEnabled() && DebugSettings.INSTANCE.sneakInstant.isEnabled()) {
cameraY = lastCameraY = focusedEntity.getStandingEyeHeight();
}
}
@ -51,14 +51,14 @@ public class MixinCamera {
public void onUpdateEyeHeight(CallbackInfo ci) {
if (this.focusedEntity == null) return;
if (DebugSettings.INSTANCE.replaceSneaking.getValue()) {
if (DebugSettings.INSTANCE.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.getValue()) {
} else if (!DebugSettings.INSTANCE.longSneaking.isEnabled()) {
cameraY = 1.62F;
} else if (cameraY < 1.62F) {
float delta = 1.62F - cameraY;

View File

@ -161,7 +161,7 @@ public abstract class MixinClientPlayNetworkHandler {
@Redirect(method = "onServerMetadata", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/ServerMetadataS2CPacket;isSecureChatEnforced()Z"))
public boolean removeSecureChatWarning(ServerMetadataS2CPacket instance) {
return instance.isSecureChatEnforced() || VisualSettings.INSTANCE.disableSecureChatWarning.getValue();
return instance.isSecureChatEnforced() || VisualSettings.INSTANCE.disableSecureChatWarning.isEnabled();
}
@Inject(method = "onSetTradeOffers", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER), cancellable = true)

View File

@ -42,22 +42,22 @@ public abstract class MixinInGameHud {
@Inject(method = "renderExperienceBar", at = @At("HEAD"), cancellable = true)
public void removeExperienceBar(DrawContext context, int x, CallbackInfo ci) {
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) ci.cancel();
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) ci.cancel();
}
@Inject(method = "renderMountJumpBar", at = @At("HEAD"), cancellable = true)
public void removeMountJumpBar(JumpingMount mount, DrawContext context, int x, CallbackInfo ci) {
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) ci.cancel();
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) ci.cancel();
}
@Inject(method = "renderMountHealth", at = @At("HEAD"), cancellable = true)
public void removeMountHealth(DrawContext context, CallbackInfo ci) {
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) ci.cancel();
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) ci.cancel();
}
@Inject(method = "getHeartCount", at = @At("HEAD"), cancellable = true)
public void removeHungerBar(LivingEntity entity, CallbackInfoReturnable<Integer> cir) {
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) {
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) {
cir.setReturnValue(1);
}
}
@ -66,7 +66,7 @@ public abstract class MixinInGameHud {
@ModifyExpressionValue(method = "renderStatusBars", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/hud/InGameHud;scaledHeight:I", opcode = Opcodes.GETFIELD))
private int moveHealthDown(int originalValue) {
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) return originalValue + 6;
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) return originalValue + 6;
return originalValue;
}
@ -74,7 +74,7 @@ public abstract class MixinInGameHud {
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"),
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 0)), index = 1)
private int moveArmor(int old) {
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) return scaledWidth - old - 9;
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) return scaledWidth - old - 9;
return old;
}
@ -82,7 +82,7 @@ public abstract class MixinInGameHud {
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"),
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 0)), index = 2)
private int moveArmorDown(int old) {
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) return scaledWidth - 39 + 6;
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) return scaledWidth - 39 + 6;
return old;
}
@ -90,7 +90,7 @@ public abstract class MixinInGameHud {
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 2),
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V")), index = 1)
private int moveAir(int old) {
if (VisualSettings.INSTANCE.removeNewerHudElements.getValue()) return scaledWidth - old - 9;
if (VisualSettings.INSTANCE.removeNewerHudElements.isEnabled()) return scaledWidth - old - 9;
return old;
}
}

View File

@ -39,7 +39,7 @@ public class MixinItemRenderer {
@Inject(method = "getModel", at = @At("HEAD"), cancellable = true)
public void removeModel(ItemStack stack, World world, LivingEntity entity, int seed, CallbackInfoReturnable<BakedModel> cir) {
if (VisualSettings.INSTANCE.replacePetrifiedOakSlab.getValue() && world != null /* world is null in gui rendering */ && stack.isOf(Items.PETRIFIED_OAK_SLAB)) {
if (VisualSettings.INSTANCE.replacePetrifiedOakSlab.isEnabled() && world != null /* world is null in gui rendering */ && stack.isOf(Items.PETRIFIED_OAK_SLAB)) {
cir.setReturnValue(this.models.getModelManager().getMissingModel());
}
}

View File

@ -111,7 +111,7 @@ public abstract class MixinMinecraftClient implements IMinecraftClient {
@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))
public void injectTick(CallbackInfo ci) {
if (!DebugSettings.INSTANCE.executeInputsInSync.getValue()) return;
if (!DebugSettings.INSTANCE.executeInputsInSync.isEnabled()) return;
while (!viafabricplus_mouseInteractions.isEmpty()) {
viafabricplus_mouseInteractions.poll().run();
@ -123,7 +123,7 @@ public abstract class MixinMinecraftClient implements IMinecraftClient {
@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.getValue()) {
if (getNetworkHandler() != null && DebugSettings.INSTANCE.sendOpenInventoryPacket.isEnabled()) {
final UserConnection userConnection = ProtocolHack.getMainUserConnection();
if (userConnection != null && userConnection.getProtocolInfo().getPipeline().contains(Protocol1_12To1_11_1.class)) {

View File

@ -29,7 +29,7 @@ public class MixinPendingUpdateManager {
@Inject(method = "incrementSequence", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/PendingUpdateManager;pendingSequence:Z", shift = At.Shift.BEFORE), cancellable = true)
public void injectIncrementSequence(CallbackInfoReturnable<PendingUpdateManager> cir) {
if (DebugSettings.INSTANCE.disableSequencing.getValue()) {
if (DebugSettings.INSTANCE.disableSequencing.isEnabled()) {
cir.setReturnValue((PendingUpdateManager) (Object) this);
}
}

View File

@ -33,7 +33,7 @@ public class MixinAbstractBlock {
@Inject(method = "calcBlockBreakingDelta", at = @At("HEAD"), cancellable = true)
public void fixLegacyMiningSpeed(BlockState state, PlayerEntity player, BlockView world, BlockPos pos, CallbackInfoReturnable<Float> cir) {
if (DebugSettings.INSTANCE.legacyMiningSpeeds.getValue()) {
if (DebugSettings.INSTANCE.legacyMiningSpeeds.isEnabled()) {
final float hardness = state.getHardness(world, pos);
if (hardness == -1.0F) {
cir.setReturnValue(0.0F);

View File

@ -94,7 +94,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
@Redirect(method = "sendMovementPackets", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;lastOnGround:Z", ordinal = 0))
public boolean sendIdlePacket(ClientPlayerEntity instance) {
if (DebugSettings.INSTANCE.sendIdlePacket.getValue()) {
if (DebugSettings.INSTANCE.sendIdlePacket.isEnabled()) {
return !isOnGround();
}
return lastOnGround;
@ -198,7 +198,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
@Override
public int getArmor() {
if (VisualSettings.INSTANCE.emulateArmorHud.getValue()) {
if (VisualSettings.INSTANCE.emulateArmorHud.isEnabled()) {
return ArmorPointCalculation.sum();
}
return super.getArmor();

View File

@ -100,7 +100,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
@Inject(method = "getHurtSound", at = @At("HEAD"), cancellable = true)
public void replaceSound(DamageSource source, CallbackInfoReturnable<SoundEvent> cir) {
if (VisualSettings.INSTANCE.replaceHurtSoundWithOOFSound.getValue()) {
if (VisualSettings.INSTANCE.replaceHurtSoundWithOOFSound.isEnabled()) {
cir.setReturnValue(viafabricplus_random_hurt);
}
}

View File

@ -34,7 +34,7 @@ public class MixinKeyboard {
@Redirect(method = "*", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;execute(Ljava/lang/Runnable;)V"))
public void redirectSync(MinecraftClient instance, Runnable runnable) {
if (DebugSettings.INSTANCE.executeInputsInSync.getValue()) {
if (DebugSettings.INSTANCE.executeInputsInSync.isEnabled()) {
((IMinecraftClient) MinecraftClient.getInstance()).viafabricplus_getKeyboardInteractions().add(runnable);
return;
}

View File

@ -30,7 +30,7 @@ public class MixinMouse {
@Redirect(method = { "method_29615", "method_22685", "method_22684" }, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;execute(Ljava/lang/Runnable;)V"))
public void redirectSync(MinecraftClient instance, Runnable runnable) {
if (DebugSettings.INSTANCE.executeInputsInSync.getValue()) {
if (DebugSettings.INSTANCE.executeInputsInSync.isEnabled()) {
((IMinecraftClient) MinecraftClient.getInstance()).viafabricplus_getMouseInteractions().add(runnable);
return;
}

View File

@ -30,7 +30,7 @@ public class MixinItemCooldownManager {
@Inject(method = "set", at = @At("HEAD"), cancellable = true)
public void injectSet(Item item, int duration, CallbackInfo ci) {
if (DebugSettings.INSTANCE.removeCooldowns.getValue()) {
if (DebugSettings.INSTANCE.removeCooldowns.isEnabled()) {
ci.cancel();
}
}

View File

@ -82,7 +82,7 @@ public abstract class MixinItemStack {
@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.getValue() || modifiers.isEmpty()) return modifiers;
if (!DebugSettings.INSTANCE.replaceAttributeModifiers.isEnabled() || modifiers.isEmpty()) return modifiers;
modifiers = HashMultimap.create(modifiers);
modifiers.removeAll(EntityAttributes.GENERIC_ATTACK_DAMAGE);

View File

@ -30,7 +30,7 @@ public class MixinChatHud {
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHudLine$Visible;indicator()Lnet/minecraft/client/gui/hud/MessageIndicator;"), require = 0)
public MessageIndicator removeIndicators(ChatHudLine.Visible instance) {
if (VisualSettings.INSTANCE.hideSignatureIndicator.getValue()) {
if (VisualSettings.INSTANCE.hideSignatureIndicator.isEnabled()) {
return null;
}
return instance.indicator();

View File

@ -45,7 +45,7 @@ public class MixinChatScreen {
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;getIndicatorAt(DD)Lnet/minecraft/client/gui/hud/MessageIndicator;"))
public MessageIndicator removeIndicator(ChatHud instance, double mouseX, double mouseY) {
if (VisualSettings.INSTANCE.hideSignatureIndicator.getValue()) {
if (VisualSettings.INSTANCE.hideSignatureIndicator.isEnabled()) {
return null;
}
return instance.getIndicatorAt(mouseX, mouseY);

View File

@ -43,7 +43,7 @@ public abstract class MixinCommandBlockScreen {
@Inject(method = "init", at = @At("TAIL"))
private void injectInit(CallbackInfo ci) {
if (VisualSettings.INSTANCE.removeNewerFeaturesFromCommandBlockScreen.getValue()) {
if (VisualSettings.INSTANCE.removeNewerFeaturesFromCommandBlockScreen.isEnabled()) {
modeButton.visible = false;
conditionalModeButton.visible = false;
redstoneTriggerButton.visible = false;

View File

@ -19,6 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.ProfileKey;
import net.raphimc.mcauth.util.MicrosoftConstants;
import net.raphimc.vialoader.util.VersionEnum;
import de.florianmichael.viafabricplus.ViaFabricPlus;
import de.florianmichael.viafabricplus.definition.bedrock.BedrockAccountHandler;
@ -38,6 +39,7 @@ import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.c2s.login.LoginHelloC2SPacket;
import net.raphimc.mcauth.step.bedrock.StepMCChain;
import net.raphimc.viabedrock.protocol.storage.AuthChainData;
import org.apache.http.impl.client.CloseableHttpClient;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@ -97,11 +99,18 @@ public class MixinConnectScreen_1 {
final VersionEnum targetVersion = ProtocolHack.getTargetVersion(connection.channel);
if (targetVersion == VersionEnum.bedrockLatest) {
final StepMCChain.MCChain account = BedrockAccountHandler.INSTANCE.getMcChain();
StepMCChain.MCChain account = BedrockAccountHandler.INSTANCE.getMcChain();
if (account == null) return;
final UUID deviceId = account.prevResult().initialXblSession().prevResult2().id();
final String playFabId = BedrockAccountHandler.INSTANCE.getPlayFabToken().playFabId();
try (final CloseableHttpClient httpClient = MicrosoftConstants.createHttpClient()) {
account = new StepMCChain(null).applyStep(httpClient, account.prevResult());
} catch (Exception e) {
ViaFabricPlus.LOGGER.error("Failed to refresh Bedrock chain data. Please re-login to Bedrock!", e);
return;
}
userConnection.put(new AuthChainData(userConnection, account.mojangJwt(), account.identityJwt(), account.publicKey(), account.privateKey(), deviceId, playFabId));
ViaFabricPlus.LOGGER.info("Created AuthChainData for Bedrock authentication!");
return;

View File

@ -31,7 +31,7 @@ public class MixinCreativeInventoryScreen {
@Inject(method = "init", at = @At("RETURN"))
public void replaceCreativeMenu(CallbackInfo ci) {
if (VisualSettings.INSTANCE.replaceCreativeInventory.getValue()) {
if (VisualSettings.INSTANCE.replaceCreativeInventory.isEnabled()) {
if (ClassicItemSelectionScreen.INSTANCE == null) return;
MinecraftClient.getInstance().setScreen(ClassicItemSelectionScreen.INSTANCE);

View File

@ -51,7 +51,7 @@ public class MixinJigsawBlockScreen extends Screen {
@Inject(method = "init", at = @At("RETURN"))
public void injectInit(CallbackInfo ci) {
if (VisualSettings.INSTANCE.removeNewerFeaturesFromJigsawScreen.getValue()) {
if (VisualSettings.INSTANCE.removeNewerFeaturesFromJigsawScreen.isEnabled()) {
nameField.active = false;
jointRotationButton.active = false;
int index = children().indexOf(jointRotationButton);
@ -63,7 +63,7 @@ public class MixinJigsawBlockScreen extends Screen {
@Inject(method = "render", at = @At("HEAD"))
public void injectRender(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
if (VisualSettings.INSTANCE.removeNewerFeaturesFromJigsawScreen.getValue()) {
if (VisualSettings.INSTANCE.removeNewerFeaturesFromJigsawScreen.isEnabled()) {
nameField.setText(targetField.getText());
}
}

View File

@ -51,7 +51,7 @@ public abstract class MixinMerchantScreen extends HandledScreen<MerchantScreenHa
@Inject(method = "syncRecipeIndex", at = @At("HEAD"))
public void smoothOutRecipeIndex(CallbackInfo ci) {
if (DebugSettings.INSTANCE.smoothOutMerchantScreens.getValue()) {
if (DebugSettings.INSTANCE.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) {

View File

@ -30,7 +30,7 @@ public abstract class MixinChunkTracker {
@Redirect(method = "recalculateChunks", at = @At(value = "INVOKE", target = "Lit/unimi/dsi/fastutil/longs/Long2IntOpenHashMap;get(J)I"))
private int modifyRenderCondition(Long2IntOpenHashMap instance, long k) {
if (VisualSettings.INSTANCE.fixSodiumChunkRendering.getValue()) {
if (VisualSettings.INSTANCE.fixSodiumChunkRendering.isEnabled()) {
return instance.getOrDefault(k, -1);
}

View File

@ -53,33 +53,33 @@ public class ItemReleaseVersionMappings {
}
public void load() {
register(Items.CALIBRATED_SCULK_SENSOR, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.PITCHER_PLANT, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.SNIFFER_EGG, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.SUSPICIOUS_GRAVEL, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.PITCHER_POD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.RAISER_ARMOR_TRIM_SMITHING_TEMPLATE, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.HOST_ARMOR_TRIM_SMITHING_TEMPLATE, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.ANGLER_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.BLADE_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.BREWER_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.BURN_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.DANGER_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.EXPLORER_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.FRIEND_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.HEART_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.HEARTBREAK_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.HOWL_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.MINER_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.MOURNER_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.PLENTY_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.SHEAF_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.SHELTER_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.SNORT_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.MUSIC_DISC_RELIC, VersionRange.andNewer(VersionEnum.r1_20));
register(Items.CALIBRATED_SCULK_SENSOR, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.PITCHER_PLANT, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.SNIFFER_EGG, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.SUSPICIOUS_GRAVEL, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.PITCHER_POD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.RAISER_ARMOR_TRIM_SMITHING_TEMPLATE, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.HOST_ARMOR_TRIM_SMITHING_TEMPLATE, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.ANGLER_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.BLADE_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.BREWER_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.BURN_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.DANGER_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.EXPLORER_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.FRIEND_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.HEART_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.HEARTBREAK_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.HOWL_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.MINER_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.MOURNER_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.PLENTY_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.SHEAF_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.SHELTER_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.SNORT_POTTERY_SHERD, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.MUSIC_DISC_RELIC, VersionRange.andNewer(VersionEnum.r1_20tor1_20_1));
register(Items.BRUSH, VersionRange.andNewer(VersionEnum.r1_19_4));
register(Items.CHERRY_BOAT, VersionRange.andNewer(VersionEnum.r1_19_4));
@ -122,7 +122,9 @@ public class ItemReleaseVersionMappings {
register(Items.TORCHFLOWER_SEEDS, VersionRange.andNewer(VersionEnum.r1_19_4));
register(Items.VEX_ARMOR_TRIM_SMITHING_TEMPLATE, VersionRange.andNewer(VersionEnum.r1_19_4));
register(Items.WARD_ARMOR_TRIM_SMITHING_TEMPLATE, VersionRange.andNewer(VersionEnum.r1_19_4));
register(Items.WILD_ARMOR_TRIM_SMITHING_TEMPLATE, VersionRange.andNewer(VersionEnum.r1_19_4)); register(Items.IRON_GOLEM_SPAWN_EGG, VersionRange.andNewer(VersionEnum.r1_19_3));
register(Items.WILD_ARMOR_TRIM_SMITHING_TEMPLATE, VersionRange.andNewer(VersionEnum.r1_19_4));
register(Items.IRON_GOLEM_SPAWN_EGG, VersionRange.andNewer(VersionEnum.r1_19_3));
register(Items.SNOW_GOLEM_SPAWN_EGG, VersionRange.andNewer(VersionEnum.r1_19_3));
register(Items.ACACIA_CHEST_BOAT, VersionRange.andNewer(VersionEnum.r1_19));
@ -1348,7 +1350,6 @@ public class ItemReleaseVersionMappings {
register(Items.IRON_ORE, VersionRange.andNewer(VersionEnum.c0_28toc0_30));
register(Items.MOSSY_COBBLESTONE, VersionRange.andNewer(VersionEnum.c0_28toc0_30));
register(Items.BLACK_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27));
register(Items.BLUE_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27), VersionRange.singleton(VersionEnum.c0_30cpe));
register(Items.BROWN_MUSHROOM, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27), VersionRange.singleton(VersionEnum.c0_30cpe));

View File

@ -33,7 +33,7 @@ public class PackFormatsMappings {
private final static Map<Integer, GameVersion> protocolMap = new HashMap<>();
public static void load() {
registerVersion(VersionEnum.r1_20, 15, "1.20.1"); // 1.20 and 1.20.1 are the same, why care...
registerVersion(VersionEnum.r1_20tor1_20_1, 15, "1.20.1"); // 1.20 and 1.20.1 are the same, why care...
registerVersion(VersionEnum.r1_19_4, 13, "1.19.4");
registerVersion(VersionEnum.r1_19_3, 12, "1.19.3");
registerVersion(VersionEnum.r1_19_1tor1_19_2, 9, "1.19.2");

View File

@ -73,7 +73,7 @@ public class ProtocolHack {
/**
* This field stores the target version that you set in the GUI
*/
public static VersionEnum targetVersion = VersionEnum.r1_20;
public static VersionEnum targetVersion = VersionEnum.r1_20tor1_20_1;
/**
* This method is used when you need the target version after connecting to the server.
@ -112,7 +112,7 @@ public class ProtocolHack {
return channel.attr(FORCED_VERSION).get();
}
if (MinecraftClient.getInstance() == null || MinecraftClient.getInstance().isInSingleplayer()) return VersionEnum.r1_20;
if (MinecraftClient.getInstance() == null || MinecraftClient.getInstance().isInSingleplayer()) return VersionEnum.r1_20tor1_20_1;
return targetVersion;
}

View File

@ -18,12 +18,10 @@
package de.florianmichael.viafabricplus.screen.impl.settings.settingrenderer;
import de.florianmichael.viafabricplus.screen.MappedSlotEntry;
import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
import de.florianmichael.viafabricplus.base.settings.type_impl.ProtocolSyncBooleanSetting;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
@ -43,20 +41,20 @@ public class ProtocolSyncBooleanSettingRenderer extends MappedSlotEntry {
@Override
public void mappedMouseClicked(double mouseX, double mouseY, int button) {
this.value.setValue(!this.value.getValue());
this.value.setValue(this.value.getValue() + 1);
if (this.value.getValue() % 3 == 0) this.value.setValue(0);
}
@Override
public void mappedRender(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
final Text text = this.value.getValue() ? Text.translatable("words.viafabricplus.on") : Text.translatable("words.viafabricplus.off");
Color color = this.value.getValue() ? Color.GREEN : Color.RED;
final Text text = Text.translatable("words.viafabricplus." + (this.value.isAuto() ? "auto" : this.value.isEnabled() ? "on" : "off"));
Color color = this.value.isAuto() ? Color.ORANGE : this.value.isEnabled() ? Color.GREEN : Color.RED;
final int length = context.drawTextWithShadow(textRenderer, this.value.getName().formatted(Formatting.GRAY), 3, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
context.drawTextWithShadow(textRenderer, "(" + this.value.getProtocolRange().toString() + ")", length + 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
if (GeneralSettings.INSTANCE.automaticallyChangeValuesBasedOnTheCurrentVersion.getValue()) color = color.darker().darker();
context.drawTextWithShadow(textRenderer, text, entryWidth - textRenderer.getWidth(text) - 3 - 3, entryHeight / 2 - textRenderer.fontHeight / 2, color.getRGB());
}
}

View File

@ -15,6 +15,7 @@
"words.viafabricplus.error": "Something went wrong! Please try again later",
"words.viafabricplus.translate": "Via translates to: %s",
"words.viafabricplus.serverversion": "Server version: %s",
"words.viafabricplus.auto": "Auto",
"settings.viafabricplus.authentication": "Authentication",
"settings.viafabricplus.experimental": "Experimental",
@ -27,7 +28,6 @@
"general.viafabricplus.classicloading": "Show classic loading progress in connect screen",
"general.viafabricplus.main": "Main button orientation",
"general.viafabricplus.creative": "Remove not available items from creative tab",
"general.viafabricplus.protocolsync": "Automatically change Settings based on the current version",
"general.viafabricplus.autodetect": "Auto detect version",
"general.viafabricplus.advertised": "Show advertised/server version in Multiplayer",