mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-01-20 21:21:40 +01:00
global() -> INSTANCE
This commit is contained in:
parent
acf924f9ca
commit
e31e76a492
@ -25,8 +25,8 @@ import com.viaversion.viafabricplus.api.ChangeProtocolVersionCallback;
|
||||
import com.viaversion.viafabricplus.api.LoadingCycleCallback;
|
||||
import com.viaversion.viafabricplus.api.ViaFabricPlusBase;
|
||||
import com.viaversion.viafabricplus.base.Events;
|
||||
import com.viaversion.viafabricplus.base.save.SaveManager;
|
||||
import com.viaversion.viafabricplus.base.settings.SettingsManager;
|
||||
import com.viaversion.viafabricplus.save.SaveManager;
|
||||
import com.viaversion.viafabricplus.settings.SettingsManager;
|
||||
import com.viaversion.viafabricplus.features.FeaturesLoading;
|
||||
import com.viaversion.viafabricplus.features.max_chat_length.MaxChatLength;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
@ -81,12 +81,14 @@ public final class ViaFabricPlusImpl implements ViaFabricPlusBase {
|
||||
private final Logger logger = LogManager.getLogger("ViaFabricPlus");
|
||||
private final Path path = FabricLoader.getInstance().getConfigDir().resolve("viafabricplus");
|
||||
|
||||
private final SettingsManager settingsManager;
|
||||
private final SaveManager saveManager;
|
||||
private SettingsManager settingsManager;
|
||||
private SaveManager saveManager;
|
||||
|
||||
private final CompletableFuture<Void> loadingFuture;
|
||||
private CompletableFuture<Void> loadingFuture;
|
||||
|
||||
public void init() {
|
||||
ViaFabricPlus.init(this);
|
||||
|
||||
private ViaFabricPlusImpl() {
|
||||
// Create the directory if it doesn't exist
|
||||
if (!Files.exists(path)) {
|
||||
try {
|
||||
@ -118,8 +120,6 @@ public final class ViaFabricPlusImpl implements ViaFabricPlusBase {
|
||||
});
|
||||
}
|
||||
|
||||
// Proxy most important functions to the API to prevent users depending on mod internals
|
||||
|
||||
@Override
|
||||
public Logger logger() {
|
||||
return logger;
|
||||
|
@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.base.bedrock;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.StorableObject;
|
||||
|
||||
public class BedrockJoinGameTracker implements StorableObject {
|
||||
public final class BedrockJoinGameTracker implements StorableObject {
|
||||
|
||||
private long seed;
|
||||
private String levelId;
|
||||
|
@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.base.screen;
|
||||
|
||||
import com.viaversion.viafabricplus.screen.PerServerVersionScreen;
|
||||
import com.viaversion.viafabricplus.screen.ProtocolSelectionScreen;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.GeneralSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
|
||||
@ -47,7 +47,7 @@ public class VFPList extends AlwaysSelectedEntryListWidget<VFPListEntry> {
|
||||
|
||||
public void initScrollY(final double scrollY) {
|
||||
// Needs calling last in init to have data loaded before setting scroll amount
|
||||
if (GeneralSettings.global().saveScrollPositionInSlotScreens.getValue()) {
|
||||
if (GeneralSettings.INSTANCE.saveScrollPositionInSlotScreens.getValue()) {
|
||||
this.setScrollY(scrollY);
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.features;
|
||||
|
||||
import com.viaversion.viafabricplus.api.LoadingCycleCallback;
|
||||
import com.viaversion.viafabricplus.base.Events;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.features.block.CollisionShapes;
|
||||
import com.viaversion.viafabricplus.features.cpe_extensions.CPEAdditions;
|
||||
import com.viaversion.viafabricplus.features.footstep_particle.FootStepParticle1_12_2;
|
||||
@ -40,7 +40,7 @@ import net.minecraft.client.MinecraftClient;
|
||||
import net.raphimc.viaaprilfools.api.AprilFoolsProtocolVersion;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
|
||||
public class FeaturesLoading {
|
||||
public final class FeaturesLoading {
|
||||
|
||||
static {
|
||||
ResourcePackHeaderDiff.init();
|
||||
@ -58,7 +58,7 @@ public class FeaturesLoading {
|
||||
});
|
||||
|
||||
Events.CHANGE_PROTOCOL_VERSION.register((oldVersion, newVersion) -> MinecraftClient.getInstance().execute(() -> {
|
||||
VisualSettings.global().filterNonExistingGlyphs.onValueChanged();
|
||||
VisualSettings.INSTANCE.filterNonExistingGlyphs.onValueChanged();
|
||||
CollisionShapes.reloadBlockShapes();
|
||||
|
||||
if (newVersion.olderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
|
||||
|
@ -40,7 +40,7 @@ import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
|
||||
public class WorldHeightSupport {
|
||||
public final class WorldHeightSupport {
|
||||
|
||||
public static PacketHandler handleJoinGame(final PacketHandler parentHandler) {
|
||||
return wrapper -> {
|
||||
|
@ -35,7 +35,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
public class CPEAdditions {
|
||||
public final class CPEAdditions {
|
||||
|
||||
public final static List<ClassicProtocolExtension> ALLOWED_EXTENSIONS = new ArrayList<>();
|
||||
public final static Map<Integer, ClientboundPacketsc0_30cpe> CUSTOM_PACKETS = new HashMap<>();
|
||||
|
@ -37,7 +37,7 @@ import static com.viaversion.viafabricplus.util.MapUtil.linkedHashMap;
|
||||
/**
|
||||
* Data dump for entity dimension changes between versions.
|
||||
*/
|
||||
public class EntityDimensionDiff {
|
||||
public final class EntityDimensionDiff {
|
||||
|
||||
/**
|
||||
* A map of entity types to a map of versions to dimensions.
|
||||
|
@ -38,7 +38,7 @@ import net.minecraft.registry.tag.BlockTags;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class EnchantmentAttributesEmulation1_20_6 {
|
||||
public final class EnchantmentAttributesEmulation1_20_6 {
|
||||
|
||||
static {
|
||||
ClientTickEvents.START_WORLD_TICK.register(world -> {
|
||||
|
@ -25,7 +25,7 @@ import com.viaversion.viaversion.api.connection.StorableObject;
|
||||
import it.unimi.dsi.fastutil.ints.Int2FloatMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap;
|
||||
|
||||
public class WolfHealthTracker1_14_4 implements StorableObject {
|
||||
public final class WolfHealthTracker1_14_4 implements StorableObject {
|
||||
|
||||
private final Int2FloatMap healthDataMap = new Int2FloatOpenHashMap();
|
||||
|
||||
|
@ -43,7 +43,7 @@ import net.minecraft.util.math.Vec3d;
|
||||
* Minecraft 1.20.2 changed the calculation of the mounted height offset for all entities, this class contains the old
|
||||
* values for all entities. This class is used for 1.20.1 and lower.
|
||||
*/
|
||||
public class EntityRidingOffsetsPre1_20_2 {
|
||||
public final class EntityRidingOffsetsPre1_20_2 {
|
||||
|
||||
/**
|
||||
* Returns the mounted height offset for the given entity and passenger. This method is used for 1.20.1 and lower.
|
||||
|
@ -30,7 +30,7 @@ import net.minecraft.util.Identifier;
|
||||
/**
|
||||
* Model for boats in 1.8 and lower.
|
||||
*/
|
||||
public class BoatModel1_8 extends EntityModel<BoatEntityRenderState> {
|
||||
public final class BoatModel1_8 extends EntityModel<BoatEntityRenderState> {
|
||||
|
||||
public static final EntityModelLayer MODEL_LAYER = new EntityModelLayer(Identifier.of("viafabricplus", "boat1_8"), "main");
|
||||
|
||||
|
@ -37,7 +37,7 @@ import net.minecraft.util.math.RotationAxis;
|
||||
/**
|
||||
* Renderer for boats in 1.8 and lower.
|
||||
*/
|
||||
public class BoatRenderer1_8 extends AbstractBoatEntityRenderer {
|
||||
public final class BoatRenderer1_8 extends AbstractBoatEntityRenderer {
|
||||
|
||||
private static final Identifier TEXTURE = Identifier.of("viafabricplus", "textures/boat1_8.png");
|
||||
private final BoatModel1_8 model;
|
||||
|
@ -37,7 +37,7 @@ import static net.raphimc.vialegacy.api.LegacyProtocolVersion.c0_0_15a_1;
|
||||
* characters which the client doesn't know about and therefore can't render as placeholder for e.g. scoreboards, we have
|
||||
* to hide them because our client would render them as a different character.
|
||||
*/
|
||||
public class RenderableGlyphDiff {
|
||||
public final class RenderableGlyphDiff {
|
||||
|
||||
private static final Int2ObjectMap<ProtocolVersion> RENDERABLE_GLYPH_DIFF_LEGACY = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<ProtocolVersion> RENDERABLE_GLYPH_DIFF = new Int2ObjectOpenHashMap<>();
|
||||
|
@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.features.filter_non_existing_characters;
|
||||
import com.viaversion.viafabricplus.base.Events;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.util.LanguageUtil;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.option.SimpleOption;
|
||||
@ -35,7 +35,7 @@ import net.minecraft.util.Language;
|
||||
* Older versions only had unicode font support for some languages and therefore servers are expecting the client
|
||||
* to use a unicode font, not using it on older versions can cause issues with wrong dimensions in chat components.
|
||||
*/
|
||||
public class UnicodeFontFix1_12_2 {
|
||||
public final class UnicodeFontFix1_12_2 {
|
||||
|
||||
private static boolean enabled = false;
|
||||
private static Runnable task = null;
|
||||
@ -59,7 +59,7 @@ public class UnicodeFontFix1_12_2 {
|
||||
public static void updateUnicodeFontOverride(final ProtocolVersion version) {
|
||||
final SimpleOption<Boolean> option = MinecraftClient.getInstance().options.getForceUnicodeFont();
|
||||
|
||||
if (VisualSettings.global().forceUnicodeFontForNonAsciiLanguages.isEnabled(version)) {
|
||||
if (VisualSettings.INSTANCE.forceUnicodeFontForNonAsciiLanguages.isEnabled(version)) {
|
||||
if (Language.getInstance() instanceof TranslationStorage storage) {
|
||||
enabled = LanguageUtil.isUnicodeFont1_12_2(storage.translations);
|
||||
task = () -> option.setValue(enabled);
|
||||
|
@ -37,7 +37,7 @@ import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
public class FootStepParticle1_12_2 extends SpriteBillboardParticle {
|
||||
public final class FootStepParticle1_12_2 extends SpriteBillboardParticle {
|
||||
|
||||
public static final Identifier ID = Identifier.of("viafabricplus", "footstep");
|
||||
public static int RAW_ID;
|
||||
|
@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.features.interaction;
|
||||
|
||||
import net.minecraft.util.ActionResult;
|
||||
|
||||
public class ActionResultException1_12_2 extends RuntimeException {
|
||||
public final class ActionResultException1_12_2 extends RuntimeException {
|
||||
|
||||
private final ActionResult actionResult;
|
||||
|
||||
|
@ -36,7 +36,7 @@ import net.minecraft.util.math.Vec2f;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public class ClientPlayerInteractionManager1_18_2 {
|
||||
public final class ClientPlayerInteractionManager1_18_2 {
|
||||
|
||||
private final Object2ObjectLinkedOpenHashMap<Pair<BlockPos, PlayerActionC2SPacket.Action>, Pair<Vec3d, Vec2f>> unAckedActions = new Object2ObjectLinkedOpenHashMap<>();
|
||||
|
||||
|
@ -44,7 +44,7 @@ import static net.raphimc.vialoader.util.VersionRange.*;
|
||||
/**
|
||||
* Class file which contains the {@link VersionRange} for every item added in the game.
|
||||
*/
|
||||
public class ItemRegistryDiff {
|
||||
public final class ItemRegistryDiff {
|
||||
|
||||
public static final Map<Item, VersionRange> ITEM_DIFF = new HashMap<>();
|
||||
public static final List<Item> EXTENDED_CLASSIC_ITEMS = new ArrayList<>();
|
||||
|
@ -26,7 +26,7 @@ import com.viaversion.viaversion.protocols.v1_10to1_11.Protocol1_10To1_11;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
|
||||
public class NegativeItemUtil {
|
||||
public final class NegativeItemUtil {
|
||||
|
||||
private static final String VV_IDENTIFIER = "VV|" + Protocol1_10To1_11.class.getSimpleName(); // ItemRewriter#nbtTagName
|
||||
|
||||
|
@ -30,7 +30,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class Enchantments1_14_4 {
|
||||
public final class Enchantments1_14_4 {
|
||||
|
||||
private static final Map<String, RegistryKey<Enchantment>> ENCHANTMENT_REGISTRY = new HashMap<>();
|
||||
|
||||
|
@ -31,7 +31,7 @@ import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialegacy.protocol.classic.c0_30cpetoc0_28_30.data.ClassicProtocolExtension;
|
||||
import net.raphimc.vialegacy.protocol.classic.c0_30cpetoc0_28_30.storage.ExtensionProtocolMetadataStorage;
|
||||
|
||||
public class MaxChatLength {
|
||||
public final class MaxChatLength {
|
||||
|
||||
public static int getChatLength() {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
|
||||
|
@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.features.mouse_sensitivity;
|
||||
|
||||
import it.unimi.dsi.fastutil.floats.FloatIntPair;
|
||||
|
||||
public class MouseSensitivity1_13_2 {
|
||||
public final class MouseSensitivity1_13_2 {
|
||||
|
||||
public static FloatIntPair get1_13SliderValue(final float value1_14) {
|
||||
final int oldSliderWidth = 150 - 8;
|
||||
|
@ -35,7 +35,7 @@ import java.util.Map;
|
||||
/**
|
||||
* This class file contains the {@link GameVersion} for each protocol version.
|
||||
*/
|
||||
public class ResourcePackHeaderDiff {
|
||||
public final class ResourcePackHeaderDiff {
|
||||
|
||||
private final static Map<ProtocolVersion, GameVersion> GAME_VERSION_DIFF = new HashMap<>();
|
||||
|
||||
|
@ -40,7 +40,7 @@ import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.util.DyeColor;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class AddBannerPatternRecipe extends SpecialCraftingRecipe {
|
||||
public final class AddBannerPatternRecipe extends SpecialCraftingRecipe {
|
||||
|
||||
public static final RecipeSerializer<AddBannerPatternRecipe> SERIALIZER = new SpecialRecipeSerializer<>(AddBannerPatternRecipe::new);
|
||||
|
||||
|
@ -36,7 +36,7 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class RecipeManager1_11_2 {
|
||||
public final class RecipeManager1_11_2 {
|
||||
|
||||
private final Multimap<RecipeType<?>, RecipeEntry<?>> recipesByType;
|
||||
private final Map<RegistryKey<Recipe<?>>, RecipeEntry<?>> recipesById;
|
||||
|
@ -48,7 +48,7 @@ import java.util.List;
|
||||
/**
|
||||
* Recipe data dump for all versions below 1.12.
|
||||
*/
|
||||
public class Recipes1_11_2 {
|
||||
public final class Recipes1_11_2 {
|
||||
|
||||
private static RecipeManager1_11_2 RECIPE_MANAGER;
|
||||
|
||||
|
@ -34,7 +34,7 @@ import net.minecraft.recipe.input.CraftingRecipeInput;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ShulkerBoxColoringRecipe extends SpecialCraftingRecipe {
|
||||
public final class ShulkerBoxColoringRecipe extends SpecialCraftingRecipe {
|
||||
|
||||
public static final RecipeSerializer<ShulkerBoxColoringRecipe> SERIALIZER = new SpecialRecipeSerializer<>(ShulkerBoxColoringRecipe::new);
|
||||
|
||||
|
@ -29,16 +29,15 @@ import com.viaversion.viaversion.protocols.v1_8to1_9.data.ArmorTypes1_8;
|
||||
import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_9;
|
||||
import com.viaversion.viafabricplus.ViaFabricPlusImpl;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.registry.Registries;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ArmorHudEmulation1_8 {
|
||||
public final class ArmorHudEmulation1_8 {
|
||||
|
||||
private static final UUID ARMOR_POINTS_UUID = UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150");
|
||||
|
||||
@ -46,7 +45,7 @@ public class ArmorHudEmulation1_8 {
|
||||
|
||||
static {
|
||||
ClientTickEvents.START_WORLD_TICK.register(world -> {
|
||||
if (!VisualSettings.global().emulateArmorHud.isEnabled()) {
|
||||
if (!VisualSettings.INSTANCE.emulateArmorHud.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
public class GridItemSelectionScreen extends VFPScreen {
|
||||
public final class GridItemSelectionScreen extends VFPScreen {
|
||||
|
||||
public static final GridItemSelectionScreen INSTANCE = new GridItemSelectionScreen();
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.features.ui.v1_7_tab_list_style;
|
||||
|
||||
public class LegacyTabList {
|
||||
public final class LegacyTabList {
|
||||
|
||||
/**
|
||||
* This is an incremental index used for tablist entries to implement FIFO behavior <= 1.7
|
||||
|
@ -31,7 +31,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
* No-op implementation of {@link PendingUpdateManager} for 1.18.2 and lower since those versions don't have the
|
||||
* {@link PendingUpdateManager} class.
|
||||
*/
|
||||
public class PendingUpdateManager1_18_2 extends PendingUpdateManager {
|
||||
public final class PendingUpdateManager1_18_2 extends PendingUpdateManager {
|
||||
|
||||
@Override
|
||||
public void addPendingUpdate(BlockPos pos, BlockState state, ClientPlayerEntity player) {
|
||||
|
@ -43,7 +43,7 @@ import net.minecraft.util.hit.EntityHitResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class ItemPick1_21_3 {
|
||||
public final class ItemPick1_21_3 {
|
||||
|
||||
private static void addPickBlock(final PlayerInventory inventory, final ItemStack stack) {
|
||||
final int index = inventory.getSlotWithStack(stack);
|
||||
|
@ -31,7 +31,7 @@ import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ViaFabricPlusMixinPlugin implements IMixinConfigPlugin {
|
||||
public final class ViaFabricPlusMixinPlugin implements IMixinConfigPlugin {
|
||||
|
||||
public static final String INJECTOR_PACKAGE = "com.viaversion.viafabricplus.injection.mixin.";
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.base;
|
||||
|
||||
import com.viaversion.viafabricplus.ViaFabricPlus;
|
||||
import com.viaversion.viafabricplus.ViaFabricPlusImpl;
|
||||
import com.viaversion.viafabricplus.api.LoadingCycleCallback;
|
||||
import com.viaversion.viafabricplus.base.Events;
|
||||
@ -37,7 +36,7 @@ public abstract class MixinMain {
|
||||
@Inject(method = "main", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Util;startTimerHack()V"))
|
||||
private static void bootstrap(CallbackInfo ci) {
|
||||
Events.LOADING_CYCLE.invoker().onLoadCycle(LoadingCycleCallback.LoadingCycle.INITIAL_LOAD);
|
||||
ViaFabricPlus.init(ViaFabricPlusImpl.INSTANCE);
|
||||
ViaFabricPlusImpl.INSTANCE.init();
|
||||
Events.LOADING_CYCLE.invoker().onLoadCycle(LoadingCycleCallback.LoadingCycle.FINAL_LOAD);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(MinecraftClient.class)
|
||||
public class MixinMinecraftClient {
|
||||
public final class MixinMinecraftClient {
|
||||
|
||||
@Inject(method = "startIntegratedServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;connect(Ljava/lang/String;ILnet/minecraft/network/listener/ClientLoginPacketListener;)V", shift = At.Shift.BEFORE))
|
||||
private void disableProtocolTranslator(LevelStorage.Session session, ResourcePackManager dataPackManager, SaveLoader saveLoader, boolean newWorld, CallbackInfo ci, @Local ClientConnection clientConnection) {
|
||||
|
@ -36,7 +36,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
@Mixin(MultiplayerServerListPinger.class)
|
||||
public class MixinMultiplayerServerListPinger {
|
||||
public final class MixinMultiplayerServerListPinger {
|
||||
|
||||
@WrapOperation(method = "add", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/util/profiler/MultiValueDebugSampleLogImpl;)Lnet/minecraft/network/ClientConnection;"))
|
||||
private ClientConnection setForcedVersion(InetSocketAddress address, boolean useEpoll, MultiValueDebugSampleLogImpl packetSizeLog, Operation<ClientConnection> original, @Local(argsOnly = true) ServerInfo serverInfo) {
|
||||
|
@ -22,7 +22,7 @@
|
||||
package com.viaversion.viafabricplus.injection.mixin.base.integration;
|
||||
|
||||
import com.viaversion.viafabricplus.ViaFabricPlusImpl;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@ -38,7 +38,7 @@ public abstract class MixinClientConnection {
|
||||
|
||||
@Inject(method = "exceptionCaught", at = @At("HEAD"))
|
||||
private void printNetworkingErrors(ChannelHandlerContext context, Throwable ex, CallbackInfo ci) {
|
||||
if (DebugSettings.global().printNetworkingErrorsToLogs.getValue()) {
|
||||
if (DebugSettings.INSTANCE.printNetworkingErrorsToLogs.getValue()) {
|
||||
if (ex instanceof SocketException || ex instanceof ConnectException) {
|
||||
// Thrown when server is not reachable
|
||||
return;
|
||||
|
@ -28,7 +28,7 @@ import com.viaversion.viafabricplus.injection.ViaFabricPlusMixinPlugin;
|
||||
import com.viaversion.viafabricplus.injection.access.base.bedrock.IChunkTracker;
|
||||
import com.viaversion.viafabricplus.injection.access.base.bedrock.IRakSessionCodec;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.GeneralSettings;
|
||||
import com.viaversion.viafabricplus.util.ChatUtil;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.hud.DebugHud;
|
||||
@ -56,7 +56,7 @@ public abstract class MixinDebugHud {
|
||||
|
||||
@Inject(method = "getLeftText", at = @At("RETURN"))
|
||||
public void addViaFabricPlusInformation(CallbackInfoReturnable<List<String>> cir) {
|
||||
if (!GeneralSettings.global().showExtraInformationInDebugHud.getValue()) { // Only show if enabled
|
||||
if (!GeneralSettings.INSTANCE.showExtraInformationInDebugHud.getValue()) { // Only show if enabled
|
||||
return;
|
||||
}
|
||||
if (MinecraftClient.getInstance().isInSingleplayer() && MinecraftClient.getInstance().player != null) { // Don't show in singleplayer
|
||||
|
@ -25,7 +25,7 @@ import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.viafabricplus.injection.access.base.IServerInfo;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.BedrockSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.BedrockSettings;
|
||||
import net.minecraft.client.network.MultiplayerServerListPinger;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
|
@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.injection.mixin.base.integration;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viafabricplus.injection.access.base.IServerInfo;
|
||||
import com.viaversion.viafabricplus.base.save.impl.SettingsSave;
|
||||
import com.viaversion.viafabricplus.save.impl.SettingsSave;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.injection.mixin.base.ui;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viafabricplus.injection.access.base.IServerInfo;
|
||||
import com.viaversion.viafabricplus.screen.PerServerVersionScreen;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.GeneralSettings;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.AddServerScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
@ -64,7 +64,7 @@ public abstract class MixinAddServerScreen extends Screen {
|
||||
|
||||
@Inject(method = "init", at = @At("RETURN"))
|
||||
private void addVersionSetterButton(CallbackInfo ci) {
|
||||
final int buttonPosition = GeneralSettings.global().addServerScreenButtonOrientation.getIndex();
|
||||
final int buttonPosition = GeneralSettings.INSTANCE.addServerScreenButtonOrientation.getIndex();
|
||||
if (buttonPosition == 0) { // Off
|
||||
return;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import com.viaversion.viafabricplus.injection.access.base.IServerInfo;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.impl.provider.vialegacy.ViaFabricPlusClassicMPPassProvider;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.util.ProtocolVersionDetector;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.AuthenticationSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.AuthenticationSettings;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import net.minecraft.client.gui.screen.multiplayer.ConnectScreen;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
@ -75,7 +75,7 @@ public abstract class MixinConnectScreen_1 {
|
||||
}
|
||||
ProtocolTranslator.setTargetVersion(targetVersion, true);
|
||||
|
||||
this.viaFabricPlus$useClassiCubeAccount = AuthenticationSettings.global().setSessionNameToClassiCubeNameInServerList.getValue() && ViaFabricPlusClassicMPPassProvider.classicubeMPPass != null;
|
||||
this.viaFabricPlus$useClassiCubeAccount = AuthenticationSettings.INSTANCE.setSessionNameToClassiCubeNameInServerList.getValue() && ViaFabricPlusClassicMPPassProvider.classicubeMPPass != null;
|
||||
|
||||
final ChannelFuture future = original.call(address, useEpoll, connection);
|
||||
ProtocolTranslator.injectPreviousVersionReset(future.channel());
|
||||
|
@ -22,7 +22,7 @@
|
||||
package com.viaversion.viafabricplus.injection.mixin.base.ui;
|
||||
|
||||
import com.viaversion.viafabricplus.screen.ProtocolSelectionScreen;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.GeneralSettings;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.DirectConnectScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
@ -41,7 +41,7 @@ public abstract class MixinDirectConnectScreen extends Screen {
|
||||
|
||||
@Inject(method = "init", at = @At("RETURN"))
|
||||
private void addProtocolSelectionButton(CallbackInfo ci) {
|
||||
final int buttonPosition = GeneralSettings.global().directConnectScreenButtonOrientation.getIndex();
|
||||
final int buttonPosition = GeneralSettings.INSTANCE.directConnectScreenButtonOrientation.getIndex();
|
||||
if (buttonPosition == 0) { // Off
|
||||
return;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.injection.mixin.base.ui;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.GeneralSettings;
|
||||
import com.viaversion.viafabricplus.util.ChatUtil;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
|
||||
@ -44,7 +44,7 @@ public abstract class MixinDownloadingTerrainScreen extends Screen {
|
||||
|
||||
@Inject(method = "render", at = @At("RETURN"))
|
||||
private void renderClassicProgress(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
if (GeneralSettings.global().showClassicLoadingProgressInConnectScreen.getValue()) {
|
||||
if (GeneralSettings.INSTANCE.showClassicLoadingProgressInConnectScreen.getValue()) {
|
||||
// Check if ViaVersion is translating
|
||||
final UserConnection connection = ProtocolTranslator.getPlayNetworkUserConnection();
|
||||
if (connection == null) {
|
||||
|
@ -24,12 +24,12 @@ package com.viaversion.viafabricplus.injection.mixin.base.ui;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.BedrockSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.BedrockSettings;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viafabricplus.injection.access.base.IServerInfo;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.screen.ProtocolSelectionScreen;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.GeneralSettings;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
@ -50,7 +50,7 @@ public abstract class MixinMultiplayerScreen extends Screen {
|
||||
|
||||
@Inject(method = "init", at = @At("RETURN"))
|
||||
private void addProtocolSelectionButton(CallbackInfo ci) {
|
||||
final int buttonPosition = GeneralSettings.global().multiplayerScreenButtonOrientation.getIndex();
|
||||
final int buttonPosition = GeneralSettings.INSTANCE.multiplayerScreenButtonOrientation.getIndex();
|
||||
if (buttonPosition == 0) { // Off
|
||||
return;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
package com.viaversion.viafabricplus.injection.mixin.compat.fabricapi;
|
||||
|
||||
import com.viaversion.viafabricplus.ViaFabricPlusImpl;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.fabricmc.fabric.impl.client.registry.sync.ClientRegistrySyncHandler;
|
||||
import net.fabricmc.fabric.impl.registry.sync.packet.RegistryPacketHandler;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@ -35,7 +35,7 @@ public abstract class MixinClientRegistrySyncHandler {
|
||||
|
||||
@Inject(method = "checkRemoteRemap", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;)V", ordinal = 0), cancellable = true, remap = false)
|
||||
private static void ignoreFabricSyncErrors(RegistryPacketHandler.SyncedPacketData data, CallbackInfo ci) {
|
||||
if (DebugSettings.global().ignoreFabricSyncErrors.getValue()) {
|
||||
if (DebugSettings.INSTANCE.ignoreFabricSyncErrors.getValue()) {
|
||||
ViaFabricPlusImpl.INSTANCE.logger().warn("Ignoring missing registries from Fabric API");
|
||||
ci.cancel();
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.execute_inputs_sync;
|
||||
|
||||
import com.viaversion.viafabricplus.injection.access.execute_inputs_sync.IMouseKeyboard;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.client.Keyboard;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@ -47,7 +47,7 @@ public abstract class MixinKeyboard implements IMouseKeyboard {
|
||||
|
||||
@Redirect(method = {"method_22676", "method_22675"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;execute(Ljava/lang/Runnable;)V"))
|
||||
private void storeEvent(MinecraftClient instance, Runnable runnable) {
|
||||
if (this.client.getNetworkHandler() != null && this.client.currentScreen != null && DebugSettings.global().executeInputsSynchronously.isEnabled()) {
|
||||
if (this.client.getNetworkHandler() != null && this.client.currentScreen != null && DebugSettings.INSTANCE.executeInputsSynchronously.isEnabled()) {
|
||||
this.viaFabricPlus$pendingScreenEvents.offer(runnable);
|
||||
} else {
|
||||
instance.execute(runnable);
|
||||
|
@ -22,7 +22,7 @@
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.execute_inputs_sync;
|
||||
|
||||
import com.viaversion.viafabricplus.injection.access.execute_inputs_sync.IMouseKeyboard;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.client.Keyboard;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.Mouse;
|
||||
@ -55,7 +55,7 @@ public abstract class MixinMinecraftClient {
|
||||
)
|
||||
)
|
||||
private void processInputQueues(CallbackInfo ci) {
|
||||
if (DebugSettings.global().executeInputsSynchronously.isEnabled()) {
|
||||
if (DebugSettings.INSTANCE.executeInputsSynchronously.isEnabled()) {
|
||||
Queue<Runnable> inputEvents = ((IMouseKeyboard) this.mouse).viaFabricPlus$getPendingScreenEvents();
|
||||
while (!inputEvents.isEmpty()) inputEvents.poll().run();
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.execute_inputs_sync;
|
||||
|
||||
import com.viaversion.viafabricplus.injection.access.execute_inputs_sync.IMouseKeyboard;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.Mouse;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@ -47,7 +47,7 @@ public abstract class MixinMouse implements IMouseKeyboard {
|
||||
|
||||
@Redirect(method = {"method_22684", "method_22685"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;execute(Ljava/lang/Runnable;)V"))
|
||||
private void storeEvent(MinecraftClient instance, Runnable runnable) {
|
||||
if (this.client.getNetworkHandler() != null && this.client.currentScreen != null && DebugSettings.global().executeInputsSynchronously.isEnabled()) {
|
||||
if (this.client.getNetworkHandler() != null && this.client.currentScreen != null && DebugSettings.INSTANCE.executeInputsSynchronously.isEnabled()) {
|
||||
this.viaFabricPlus$pendingScreenEvents.offer(runnable);
|
||||
} else {
|
||||
instance.execute(runnable);
|
||||
|
@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.filter_non_existin
|
||||
|
||||
import com.viaversion.viafabricplus.features.filter_non_existing_characters.RenderableGlyphDiff;
|
||||
import com.viaversion.viafabricplus.features.filter_non_existing_characters.BuiltinEmptyGlyph1_12_2;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.*;
|
||||
import net.minecraft.util.Identifier;
|
||||
@ -72,7 +72,7 @@ public abstract class MixinFontStorage {
|
||||
|
||||
@Inject(method = "findGlyph", at = @At("RETURN"), cancellable = true)
|
||||
private void fixBlankGlyph1_12_2(int codePoint, CallbackInfoReturnable<FontStorage.GlyphPair> cir) {
|
||||
if (VisualSettings.global().changeFontRendererBehaviour.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.changeFontRendererBehaviour.isEnabled()) {
|
||||
final FontStorage.GlyphPair glyphPair = cir.getReturnValue();
|
||||
final Glyph glyph1 = glyphPair.glyph();
|
||||
final Glyph glyph2 = glyphPair.advanceValidatedGlyph();
|
||||
@ -87,7 +87,7 @@ public abstract class MixinFontStorage {
|
||||
|
||||
@Unique
|
||||
private boolean viaFabricPlus$shouldBeInvisible(final int codePoint) {
|
||||
if (VisualSettings.global().filterNonExistingGlyphs.getValue()) {
|
||||
if (VisualSettings.INSTANCE.filterNonExistingGlyphs.getValue()) {
|
||||
return (this.id.equals(MinecraftClient.DEFAULT_FONT_ID) || this.id.equals(MinecraftClient.UNICODE_FONT_ID)) && !RenderableGlyphDiff.isGlyphRenderable(codePoint);
|
||||
} else {
|
||||
return false;
|
||||
@ -96,7 +96,7 @@ public abstract class MixinFontStorage {
|
||||
|
||||
@Unique
|
||||
private FontStorage.GlyphPair viaFabricPlus$getBlankGlyphPair() {
|
||||
if (VisualSettings.global().changeFontRendererBehaviour.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.changeFontRendererBehaviour.isEnabled()) {
|
||||
return new FontStorage.GlyphPair(BuiltinEmptyGlyph1_12_2.INSTANCE, BuiltinEmptyGlyph1_12_2.INSTANCE);
|
||||
} else {
|
||||
return FontStorage.GlyphPair.MISSING;
|
||||
@ -105,7 +105,7 @@ public abstract class MixinFontStorage {
|
||||
|
||||
@Unique
|
||||
private BakedGlyph viaFabricPlus$getBlankBakedGlyph() {
|
||||
if (VisualSettings.global().changeFontRendererBehaviour.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.changeFontRendererBehaviour.isEnabled()) {
|
||||
return this.viaFabricPlus$blankBakedGlyph1_12_2;
|
||||
} else {
|
||||
return this.blankBakedGlyph;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.instant_sneaking;
|
||||
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.render.Camera;
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@ -44,7 +44,7 @@ public abstract class MixinCamera {
|
||||
|
||||
@Inject(method = "updateEyeHeight", at = @At(value = "HEAD"), cancellable = true)
|
||||
private void sneakInstantly(CallbackInfo ci) {
|
||||
if (this.focusedEntity != null && VisualSettings.global().sneakInstantly.isEnabled()) {
|
||||
if (this.focusedEntity != null && VisualSettings.INSTANCE.sneakInstantly.isEnabled()) {
|
||||
ci.cancel();
|
||||
cameraY = lastCameraY = focusedEntity.getStandingEyeHeight();
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ import com.viaversion.viafabricplus.injection.access.IScreenHandler;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.impl.provider.viaversion.ViaFabricPlusHandItemProvider;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.translator.ItemTranslator;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.SnowBlock;
|
||||
@ -328,7 +328,7 @@ public abstract class MixinClientPlayerInteractionManager implements IClientPlay
|
||||
|
||||
@Inject(method = "hasExperienceBar", at = @At("HEAD"), cancellable = true)
|
||||
private void removeExperienceBar(CallbackInfoReturnable<Boolean> cir) {
|
||||
if (VisualSettings.global().hideModernHUDElements.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.hideModernHUDElements.isEnabled()) {
|
||||
cir.setReturnValue(false);
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.item.cooldown;
|
||||
|
||||
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.entity.player.ItemCooldownManager;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@ -33,7 +33,7 @@ public abstract class MixinItemCooldownManager {
|
||||
|
||||
@Inject(method = "set(Lnet/minecraft/util/Identifier;I)V", at = @At("HEAD"), cancellable = true)
|
||||
private void dontSetCooldown(CallbackInfo ci) {
|
||||
if (DebugSettings.global().removeCooldowns.isEnabled()) {
|
||||
if (DebugSettings.INSTANCE.removeCooldowns.isEnabled()) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.item.filter_creati
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import com.viaversion.viafabricplus.features.item.filter_creative_tabs.ItemRegistryDiff;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.GeneralSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
@ -46,7 +46,7 @@ public abstract class MixinItemGroup_EntriesImpl {
|
||||
@WrapOperation(method = "add", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;isEnabled(Lnet/minecraft/resource/featuretoggle/FeatureSet;)Z"))
|
||||
private boolean removeUnknownItems(Item instance, FeatureSet featureSet, Operation<Boolean> original) {
|
||||
final boolean originalValue = original.call(instance, featureSet);
|
||||
final int index = GeneralSettings.global().removeNotAvailableItemsFromCreativeTab.getIndex();
|
||||
final int index = GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getIndex();
|
||||
|
||||
if (index == 2 /* Off */ || MinecraftClient.getInstance().isInSingleplayer()) {
|
||||
return originalValue;
|
||||
|
@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.item.filter_creati
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.GeneralSettings;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemGroups;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
@ -55,9 +55,9 @@ public abstract class MixinItemGroups {
|
||||
|
||||
@Inject(method = "updateDisplayContext", at = @At("HEAD"), cancellable = true)
|
||||
private static void trackLastVersion(FeatureSet enabledFeatures, boolean operatorEnabled, RegistryWrapper.WrapperLookup lookup, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (viaFabricPlus$version != ProtocolTranslator.getTargetVersion() || viaFabricPlus$state != GeneralSettings.global().removeNotAvailableItemsFromCreativeTab.getIndex()) {
|
||||
if (viaFabricPlus$version != ProtocolTranslator.getTargetVersion() || viaFabricPlus$state != GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getIndex()) {
|
||||
viaFabricPlus$version = ProtocolTranslator.getTargetVersion();
|
||||
viaFabricPlus$state = GeneralSettings.global().removeNotAvailableItemsFromCreativeTab.getIndex();
|
||||
viaFabricPlus$state = GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getIndex();
|
||||
|
||||
displayContext = new ItemGroup.DisplayContext(enabledFeatures, operatorEnabled, lookup);
|
||||
updateEntries(displayContext);
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.item.missing_model;
|
||||
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.item.ItemModelManager;
|
||||
import net.minecraft.component.ComponentType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -41,7 +41,7 @@ public abstract class MixinItemRenderer {
|
||||
@Redirect(method = "update(Lnet/minecraft/client/render/item/ItemRenderState;Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ModelTransformationMode;Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;I)V",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;get(Lnet/minecraft/component/ComponentType;)Ljava/lang/Object;"))
|
||||
private Object removeModel(ItemStack instance, ComponentType componentType) {
|
||||
if (VisualSettings.global().replacePetrifiedOakSlab.isEnabled() && instance.isOf(Items.PETRIFIED_OAK_SLAB)) {
|
||||
if (VisualSettings.INSTANCE.replacePetrifiedOakSlab.isEnabled() && instance.isOf(Items.PETRIFIED_OAK_SLAB)) {
|
||||
return viaFabricPlus$missingIdentifier;
|
||||
} else {
|
||||
return instance.get(componentType);
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.item.v1_7_tilt;
|
||||
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.item.HeldItemRenderer;
|
||||
@ -65,7 +65,7 @@ public abstract class MixinHeldItemRenderer {
|
||||
@Inject(method = "renderFirstPersonItem",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", ordinal = 1))
|
||||
private void slightlyTiltItemPosition(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack stack, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
|
||||
if (VisualSettings.global().tiltItemPositions.isEnabled() && !(stack.getItem() instanceof BlockItem)) {
|
||||
if (VisualSettings.INSTANCE.tiltItemPositions.isEnabled() && !(stack.getItem() instanceof BlockItem)) {
|
||||
final Arm arm = hand == Hand.MAIN_HAND ? player.getMainArm() : player.getMainArm().getOpposite();
|
||||
final int direction = arm == Arm.RIGHT ? 1 : -1;
|
||||
|
||||
@ -78,7 +78,7 @@ public abstract class MixinHeldItemRenderer {
|
||||
|
||||
@Unique
|
||||
private void viaFabricPlus$applySwingOffset(AbstractClientPlayerEntity player, Hand hand, float swingProgress, MatrixStack matrices) {
|
||||
if (VisualSettings.global().swingHandOnItemUse.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.swingHandOnItemUse.isEnabled()) {
|
||||
final Arm arm = hand == Hand.MAIN_HAND ? player.getMainArm() : player.getMainArm().getOpposite();
|
||||
applySwingOffset(matrices, arm, swingProgress);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.legacy_tab_completions;
|
||||
|
||||
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ChatInputSuggestor;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
@ -90,7 +90,7 @@ public abstract class MixinChatInputSuggestor {
|
||||
|
||||
@Unique
|
||||
private boolean viaFabricPlus$cancelTabComplete() {
|
||||
return DebugSettings.global().legacyTabCompletions.isEnabled() && this.textField.getText().startsWith("/");
|
||||
return DebugSettings.INSTANCE.legacyTabCompletions.isEnabled() && this.textField.getText().startsWith("/");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.legacy_tab_completions;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.client.gui.screen.ChatInputSuggestor;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
@ -48,12 +48,12 @@ public abstract class MixinChatScreen {
|
||||
|
||||
@WrapWithCondition(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/TextFieldWidget;setText(Ljava/lang/String;)V"))
|
||||
public boolean moveSetTextDown(TextFieldWidget instance, String text) {
|
||||
return !DebugSettings.global().legacyTabCompletions.isEnabled();
|
||||
return !DebugSettings.INSTANCE.legacyTabCompletions.isEnabled();
|
||||
}
|
||||
|
||||
@Inject(method = "init", at = @At("RETURN"))
|
||||
private void moveSetTextDown(CallbackInfo ci) {
|
||||
if (DebugSettings.global().legacyTabCompletions.isEnabled()) {
|
||||
if (DebugSettings.INSTANCE.legacyTabCompletions.isEnabled()) {
|
||||
this.chatField.setText(this.originalChatText);
|
||||
this.chatInputSuggestor.refresh();
|
||||
}
|
||||
@ -75,7 +75,7 @@ public abstract class MixinChatScreen {
|
||||
|
||||
@Unique
|
||||
private boolean viaFabricPlus$keepTabComplete() {
|
||||
return !DebugSettings.global().legacyTabCompletions.isEnabled() || !this.chatField.getText().startsWith("/");
|
||||
return !DebugSettings.INSTANCE.legacyTabCompletions.isEnabled() || !this.chatField.getText().startsWith("/");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.protocols.v1_19_3to1_19_4.packet.ServerboundPackets1_19_4;
|
||||
import com.viaversion.viaversion.protocols.v1_20to1_20_2.Protocol1_20To1_20_2;
|
||||
import com.viaversion.viaversion.protocols.v1_20to1_20_2.packet.ServerboundPackets1_20_2;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@ -36,7 +36,7 @@ public abstract class MixinProtocol1_20To1_20_2 {
|
||||
|
||||
@Inject(method = "lambda$queueServerboundPacket$12", at = @At("HEAD"), cancellable = true)
|
||||
private static void dontQueueConfigPackets(ServerboundPackets1_20_2 packetType, PacketWrapper wrapper, CallbackInfo ci) {
|
||||
if (!DebugSettings.global().queueConfigPackets.getValue()) {
|
||||
if (!DebugSettings.INSTANCE.queueConfigPackets.getValue()) {
|
||||
ci.cancel();
|
||||
switch (packetType) {
|
||||
case CUSTOM_PAYLOAD -> wrapper.setPacketType(ServerboundPackets1_19_4.CUSTOM_PAYLOAD);
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.networking.legacy_chat_signatures;
|
||||
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.gui.hud.ChatHud;
|
||||
import net.minecraft.client.gui.hud.MessageIndicator;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@ -33,7 +33,7 @@ public abstract class MixinChatHud {
|
||||
|
||||
@ModifyVariable(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", at = @At("HEAD"), ordinal = 0, argsOnly = true)
|
||||
private MessageIndicator removeIndicator(MessageIndicator instance) {
|
||||
return VisualSettings.global().hideSignatureIndicator.isEnabled() ? null : instance;
|
||||
return VisualSettings.INSTANCE.hideSignatureIndicator.isEnabled() ? null : instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.networking.legacy_chat_signatures;
|
||||
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.gui.hud.ChatHud;
|
||||
import net.minecraft.client.gui.hud.MessageIndicator;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
@ -34,7 +34,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.global().hideSignatureIndicator.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.hideSignatureIndicator.isEnabled()) {
|
||||
return null;
|
||||
} else {
|
||||
return instance.getIndicatorAt(mouseX, mouseY);
|
||||
|
@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.networking.packet_
|
||||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientCommonNetworkHandler;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
@ -75,7 +75,7 @@ public abstract class MixinClientCommonNetworkHandler {
|
||||
|
||||
@Inject(method = "savePacketErrorReport", at = @At("HEAD"), cancellable = true)
|
||||
private void dontCreatePacketErrorCrashReports(CallbackInfoReturnable<Optional<Path>> cir) {
|
||||
if (DebugSettings.global().dontCreatePacketErrorCrashReports.isEnabled()) {
|
||||
if (DebugSettings.INSTANCE.dontCreatePacketErrorCrashReports.isEnabled()) {
|
||||
cir.setReturnValue(Optional.empty());
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.block.entity.SignBlockEntity;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
|
||||
@ -216,7 +216,7 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
||||
|
||||
@Redirect(method = "onGameJoin", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;isSecureChatEnforced()Z"))
|
||||
private boolean removeSecureChatWarning(ClientPlayNetworkHandler instance) {
|
||||
return isSecureChatEnforced() || VisualSettings.global().disableSecureChatWarning.isEnabled();
|
||||
return isSecureChatEnforced() || VisualSettings.INSTANCE.disableSecureChatWarning.isEnabled();
|
||||
}
|
||||
|
||||
@SuppressWarnings({"InvalidInjectorMethodSignature"})
|
||||
|
@ -22,7 +22,7 @@
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.ui.classic_creative_menu;
|
||||
|
||||
import com.viaversion.viafabricplus.features.ui.classic_creative_menu.GridItemSelectionScreen;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@ -35,7 +35,7 @@ public abstract class MixinCreativeInventoryScreen {
|
||||
|
||||
@Inject(method = "init", at = @At("RETURN"))
|
||||
private void replaceCreativeMenu(CallbackInfo ci) {
|
||||
if (VisualSettings.global().replaceCreativeInventory.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.replaceCreativeInventory.isEnabled()) {
|
||||
MinecraftClient.getInstance().setScreen(GridItemSelectionScreen.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,8 @@ import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viafabricplus.injection.access.base.IServerInfo;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.GeneralSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
@ -69,7 +69,7 @@ public abstract class MixinMultiplayerServerListWidget_ServerEntry {
|
||||
ProtocolVersion version = ((IServerInfo) server).viaFabricPlus$forcedVersion();
|
||||
if (version == null) version = ProtocolTranslator.getTargetVersion();
|
||||
|
||||
viaFabricPlus$disableServerPinging = VisualSettings.global().disableServerPinging.isEnabled(version);
|
||||
viaFabricPlus$disableServerPinging = VisualSettings.INSTANCE.disableServerPinging.isEnabled(version);
|
||||
if (viaFabricPlus$disableServerPinging) {
|
||||
this.server.version = Text.of(version.getName()); // Show target version
|
||||
}
|
||||
@ -128,7 +128,7 @@ public abstract class MixinMultiplayerServerListWidget_ServerEntry {
|
||||
}
|
||||
final List<Text> tooltips = new ArrayList<>();
|
||||
tooltips.add(text);
|
||||
if (GeneralSettings.global().showAdvertisedServerVersion.getValue()) {
|
||||
if (GeneralSettings.INSTANCE.showAdvertisedServerVersion.getValue()) {
|
||||
final ProtocolVersion version = ((IServerInfo) server).viaFabricPlus$translatingVersion();
|
||||
if (version != null) {
|
||||
tooltips.add(Text.translatable("base.viafabricplus.via_translates_to", version.getName() + " (" + version.getOriginalVersion() + ")"));
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.ui.downloading_terrain_transitions;
|
||||
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@ -36,7 +36,7 @@ public abstract class MixinDownloadingTerrainScreen {
|
||||
|
||||
@Redirect(method = "renderBackground", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen;worldEntryReason:Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen$WorldEntryReason;"))
|
||||
private DownloadingTerrainScreen.WorldEntryReason hideDownloadTerrainScreenTransitionEffects(DownloadingTerrainScreen downloadingTerrainScreen) {
|
||||
if (VisualSettings.global().hideDownloadTerrainScreenTransitionEffects.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.hideDownloadTerrainScreenTransitionEffects.isEnabled()) {
|
||||
return DownloadingTerrainScreen.WorldEntryReason.OTHER;
|
||||
} else {
|
||||
return this.worldEntryReason;
|
||||
|
@ -26,7 +26,7 @@ import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.hud.InGameHud;
|
||||
@ -55,19 +55,19 @@ public abstract class MixinInGameHud {
|
||||
|
||||
@Inject(method = "playBurstSound", at = @At("HEAD"), cancellable = true)
|
||||
private void disableBubblePopSound(int bubble, PlayerEntity player, int burstBubbles, CallbackInfo ci) {
|
||||
if (VisualSettings.global().removeBubblePopSound.getValue()) {
|
||||
if (VisualSettings.INSTANCE.removeBubblePopSound.getValue()) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@WrapWithCondition(method = "renderAirBubbles", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIII)V", ordinal = 2))
|
||||
private boolean disableEmptyBubbles(DrawContext instance, Function<Identifier, RenderLayer> renderLayers, Identifier sprite, int x, int y, int width, int height) {
|
||||
return !VisualSettings.global().hideEmptyBubbleIcons.getValue();
|
||||
return !VisualSettings.INSTANCE.hideEmptyBubbleIcons.getValue();
|
||||
}
|
||||
|
||||
@WrapOperation(method = "renderCrosshair", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/Perspective;isFirstPerson()Z"))
|
||||
private boolean alwaysRenderCrosshair(Perspective instance, Operation<Boolean> original) {
|
||||
if (VisualSettings.global().alwaysRenderCrosshair.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.alwaysRenderCrosshair.isEnabled()) {
|
||||
return true;
|
||||
} else {
|
||||
return original.call(instance);
|
||||
@ -76,21 +76,21 @@ public abstract class MixinInGameHud {
|
||||
|
||||
@Inject(method = {"renderMountJumpBar", "renderMountHealth"}, at = @At("HEAD"), cancellable = true)
|
||||
private void removeMountJumpBar(CallbackInfo ci) {
|
||||
if (VisualSettings.global().hideModernHUDElements.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.hideModernHUDElements.isEnabled()) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getHeartCount", at = @At("HEAD"), cancellable = true)
|
||||
private void removeHungerBar(LivingEntity entity, CallbackInfoReturnable<Integer> cir) {
|
||||
if (VisualSettings.global().hideModernHUDElements.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.hideModernHUDElements.isEnabled()) {
|
||||
cir.setReturnValue(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyExpressionValue(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;getScaledWindowHeight()I"), require = 0)
|
||||
private int moveHealthDown(int value) {
|
||||
if (VisualSettings.global().hideModernHUDElements.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.hideModernHUDElements.isEnabled()) {
|
||||
return value + 6; // Magical offset
|
||||
} else {
|
||||
return value;
|
||||
@ -99,7 +99,7 @@ public abstract class MixinInGameHud {
|
||||
|
||||
@ModifyArgs(method = "renderArmor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIII)V"), require = 0)
|
||||
private static void moveArmorPositions(Args args, @Local(ordinal = 3, argsOnly = true) int x, @Local(ordinal = 6) int n) {
|
||||
if (!VisualSettings.global().hideModernHUDElements.isEnabled()) {
|
||||
if (!VisualSettings.INSTANCE.hideModernHUDElements.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
final MinecraftClient client = MinecraftClient.getInstance();
|
||||
@ -114,7 +114,7 @@ public abstract class MixinInGameHud {
|
||||
@ModifyArg(method = "renderAirBubbles", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIII)V"),
|
||||
index = 2, require = 0)
|
||||
private int moveAirBubbles(int value) {
|
||||
if (VisualSettings.global().hideModernHUDElements.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.hideModernHUDElements.isEnabled()) {
|
||||
final MinecraftClient client = MinecraftClient.getInstance();
|
||||
return client.getWindow().getScaledWidth() - value - client.textRenderer.fontHeight;
|
||||
} else {
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.ui.remove_newer_screen_features;
|
||||
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.block.entity.CommandBlockBlockEntity;
|
||||
import net.minecraft.client.gui.screen.ingame.CommandBlockScreen;
|
||||
import net.minecraft.client.gui.widget.CyclingButtonWidget;
|
||||
@ -48,7 +48,7 @@ public abstract class MixinCommandBlockScreen {
|
||||
|
||||
@Inject(method = "init", at = @At("TAIL"))
|
||||
private void removeWidgets(CallbackInfo ci) {
|
||||
if (VisualSettings.global().hideModernCommandBlockScreenFeatures.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.hideModernCommandBlockScreenFeatures.isEnabled()) {
|
||||
modeButton.visible = false;
|
||||
conditionalModeButton.visible = false;
|
||||
redstoneTriggerButton.visible = false;
|
||||
|
@ -26,7 +26,7 @@ import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.screen.GameMenuScreen;
|
||||
import net.minecraft.client.gui.screen.OpenToLanScreen;
|
||||
@ -95,7 +95,7 @@ public abstract class MixinGameMenuScreen extends Screen {
|
||||
|
||||
@WrapOperation(method = "initWidgets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/GameMenuScreen;createButton(Lnet/minecraft/text/Text;Ljava/util/function/Supplier;)Lnet/minecraft/client/gui/widget/ButtonWidget;"), require = 0)
|
||||
private ButtonWidget replaceButtons(GameMenuScreen instance, Text text, Supplier<Screen> screenSupplier, Operation<ButtonWidget> original) {
|
||||
if (VisualSettings.global().changeGameMenuScreenLayout.getIndex() == 0) {
|
||||
if (VisualSettings.INSTANCE.changeGameMenuScreenLayout.getIndex() == 0) {
|
||||
// Player reporting -> share to lan
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19) && text.equals(PLAYER_REPORTING_TEXT)) {
|
||||
final ButtonWidget button = ButtonWidget.builder(SHARE_TO_LAN_TEXT, buttonWidget -> new OpenToLanScreen(instance)).width(NORMAL_BUTTON_WIDTH).build();
|
||||
@ -106,7 +106,7 @@ public abstract class MixinGameMenuScreen extends Screen {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_4tob1_4_1) && text.equals(ADVANCEMENTS_TEXT)) {
|
||||
return ButtonWidget.builder(ScreenTexts.DISCONNECT, viaFabricPlus$disconnectSupplier).width(viaFabricPlus$disconnectButtonWidth).build();
|
||||
}
|
||||
} else if (VisualSettings.global().changeGameMenuScreenLayout.getIndex() == 1) {
|
||||
} else if (VisualSettings.INSTANCE.changeGameMenuScreenLayout.getIndex() == 1) {
|
||||
// Player reporting -> Social interactions
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19) && text.equals(PLAYER_REPORTING_TEXT)) {
|
||||
return createButton(SocialInteractionsScreen.TITLE, () -> new SocialInteractionsScreen(instance));
|
||||
@ -117,12 +117,12 @@ public abstract class MixinGameMenuScreen extends Screen {
|
||||
|
||||
@WrapWithCondition(method = "initWidgets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/GameMenuScreen;addFeedbackAndBugsButtons(Lnet/minecraft/client/gui/screen/Screen;Lnet/minecraft/client/gui/widget/GridWidget$Adder;)V"), require = 0)
|
||||
private boolean removeFeedbackAndBugsButtons(Screen parentScreen, GridWidget.Adder gridAdder) {
|
||||
return VisualSettings.global().changeGameMenuScreenLayout.getIndex() != 0 || ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_13_2);
|
||||
return VisualSettings.INSTANCE.changeGameMenuScreenLayout.getIndex() != 0 || ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_13_2);
|
||||
}
|
||||
|
||||
@Inject(method = "initWidgets", at = @At("RETURN"))
|
||||
private void moveButtonPositions(CallbackInfo ci) {
|
||||
if (VisualSettings.global().changeGameMenuScreenLayout.getIndex() != 0) {
|
||||
if (VisualSettings.INSTANCE.changeGameMenuScreenLayout.getIndex() != 0) {
|
||||
return;
|
||||
}
|
||||
// Manually adjust positions in older versions since the grid system doesn't work for these layouts
|
||||
@ -161,7 +161,7 @@ public abstract class MixinGameMenuScreen extends Screen {
|
||||
|
||||
@WrapWithCondition(method = "initWidgets", 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;"), require = 0)
|
||||
private boolean removeButtons(GridWidget.Adder instance, Widget widget) {
|
||||
if (VisualSettings.global().changeGameMenuScreenLayout.getIndex() != 0) {
|
||||
if (VisualSettings.INSTANCE.changeGameMenuScreenLayout.getIndex() != 0) {
|
||||
return true;
|
||||
}
|
||||
// Mods could add other widgets as well
|
||||
|
@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.ui.remove_newer_sc
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.block.entity.JigsawBlockEntity;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
@ -62,7 +62,7 @@ public abstract class MixinJigsawBlockScreen extends Screen {
|
||||
|
||||
@Inject(method = "init", at = @At("RETURN"))
|
||||
private void disableWidgets(CallbackInfo ci) {
|
||||
if (!VisualSettings.global().hideModernJigsawScreenFeatures.getValue()) {
|
||||
if (!VisualSettings.INSTANCE.hideModernJigsawScreenFeatures.getValue()) {
|
||||
return;
|
||||
}
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) {
|
||||
@ -81,7 +81,7 @@ public abstract class MixinJigsawBlockScreen extends Screen {
|
||||
|
||||
@Inject(method = "render", at = @At("HEAD"))
|
||||
private void copyText(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
if (VisualSettings.global().hideModernJigsawScreenFeatures.getValue() && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
|
||||
if (VisualSettings.INSTANCE.hideModernJigsawScreenFeatures.getValue() && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
|
||||
nameField.setText(targetField.getText());
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.ui.remove_newer_screen_features;
|
||||
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.Drawable;
|
||||
import net.minecraft.client.gui.Element;
|
||||
@ -49,9 +49,9 @@ public abstract class MixinScreen {
|
||||
if (drawableElement instanceof TexturedButtonWidget button && button.textures == RecipeBookWidget.BUTTON_TEXTURES) {
|
||||
final boolean furnace = ((Screen) (Object) this) instanceof FurnaceScreen;
|
||||
|
||||
if (VisualSettings.global().hideFurnaceRecipeBook.isEnabled() && furnace) {
|
||||
if (VisualSettings.INSTANCE.hideFurnaceRecipeBook.isEnabled() && furnace) {
|
||||
cir.setReturnValue(drawableElement);
|
||||
} else if (VisualSettings.global().hideCraftingRecipeBook.isEnabled() && !furnace) {
|
||||
} else if (VisualSettings.INSTANCE.hideCraftingRecipeBook.isEnabled() && !furnace) {
|
||||
cir.setReturnValue(drawableElement);
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.ui.v1_7_tab_list_s
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import com.viaversion.viafabricplus.injection.access.v1_7_tab_list_style.IPlayerListEntry;
|
||||
import com.viaversion.viafabricplus.injection.access.v1_7_tab_list_style.IPlayerListHud;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.hud.PlayerListHud;
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
@ -59,7 +59,7 @@ public abstract class MixinPlayerListHud implements IPlayerListHud {
|
||||
|
||||
@Inject(method = "collectPlayerEntries", at = @At("HEAD"), cancellable = true)
|
||||
private void collectPlayerEntries(CallbackInfoReturnable<List<PlayerListEntry>> result) {
|
||||
if (VisualSettings.global().enableLegacyTablist.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.enableLegacyTablist.isEnabled()) {
|
||||
result.setReturnValue(this.client.player.networkHandler.getListedPlayerListEntries().stream()
|
||||
.sorted(viaFabricPlus$FIFO_COMPARATOR)
|
||||
.limit(viaFabricPlus$maxSlots)
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.world.always_tick_entities;
|
||||
|
||||
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.injection.access.world.always_tick_entities.IEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@ -35,7 +35,7 @@ public abstract class MixinEntity implements IEntity {
|
||||
|
||||
@Override
|
||||
public boolean viaFabricPlus$isInLoadedChunkAndShouldTick() {
|
||||
return this.viaFabricPlus$isInLoadedChunkAndShouldTick || DebugSettings.global().alwaysTickClientPlayer.isEnabled();
|
||||
return this.viaFabricPlus$isInLoadedChunkAndShouldTick || DebugSettings.INSTANCE.alwaysTickClientPlayer.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,7 +22,7 @@
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.world.disable_sequencing;
|
||||
|
||||
import com.viaversion.viafabricplus.features.world.disable_sequencing.PendingUpdateManager1_18_2;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.client.network.PendingUpdateManager;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@ -43,7 +43,7 @@ public abstract class MixinClientWorld {
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void removePendingUpdateManager(CallbackInfo ci) {
|
||||
if (DebugSettings.global().disableSequencing.isEnabled()) {
|
||||
if (DebugSettings.INSTANCE.disableSequencing.isEnabled()) {
|
||||
this.pendingUpdateManager = new PendingUpdateManager1_18_2();
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.integration.vialegacy;
|
||||
|
||||
import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.GeneralSettings;
|
||||
import net.raphimc.vialegacy.ViaLegacyConfig;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@ -33,7 +33,7 @@ public abstract class MixinViaLegacyConfig {
|
||||
|
||||
@Inject(method = { "isLegacySkullLoading", "isLegacySkinLoading" }, at = @At("HEAD"), cancellable = true)
|
||||
private void replaceWithVFPSetting(CallbackInfoReturnable<Boolean> cir) {
|
||||
cir.setReturnValue(GeneralSettings.global().loadSkinsAndSkullsInLegacyVersions.getValue());
|
||||
cir.setReturnValue(GeneralSettings.INSTANCE.loadSkinsAndSkullsInLegacyVersions.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,19 +21,15 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.old.minecraft;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.protocols.v1_11_1to1_12.Protocol1_11_1To1_12;
|
||||
import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ServerboundPackets1_9_3;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@ -41,7 +37,6 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(MinecraftClient.class)
|
||||
public abstract class MixinMinecraftClient {
|
||||
@ -55,7 +50,7 @@ public abstract class MixinMinecraftClient {
|
||||
|
||||
@Inject(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/tutorial/TutorialManager;onInventoryOpened()V", shift = At.Shift.AFTER))
|
||||
private void sendOpenInventoryPacket(CallbackInfo ci) {
|
||||
if (DebugSettings.global().sendOpenInventoryPacket.isEnabled()) {
|
||||
if (DebugSettings.INSTANCE.sendOpenInventoryPacket.isEnabled()) {
|
||||
final PacketWrapper clientCommand = PacketWrapper.create(ServerboundPackets1_9_3.CLIENT_COMMAND, ProtocolTranslator.getPlayNetworkUserConnection());
|
||||
clientCommand.write(Types.VAR_INT, 2); // Open Inventory Achievement
|
||||
clientCommand.scheduleSendToServer(Protocol1_11_1To1_12.class);
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
|
||||
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
||||
import net.minecraft.client.render.entity.state.BipedEntityRenderState;
|
||||
@ -47,7 +47,7 @@ public abstract class MixinBipedEntityModel<T extends BipedEntityRenderState> {
|
||||
|
||||
@Redirect(method = "positionBlockingArm", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(FFF)F"))
|
||||
private float preventArmFollowingThirdPersonRotation(float value, float min, float max) {
|
||||
if (VisualSettings.global().lockBlockingArmRotation.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.lockBlockingArmRotation.isEnabled()) {
|
||||
return 0.0F;
|
||||
} else {
|
||||
return MathHelper.clamp(value, min, max);
|
||||
@ -56,7 +56,7 @@ public abstract class MixinBipedEntityModel<T extends BipedEntityRenderState> {
|
||||
|
||||
@Inject(method = "setAngles(Lnet/minecraft/client/render/entity/state/BipedEntityRenderState;)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/model/ModelPart;roll:F", ordinal = 1, shift = At.Shift.AFTER))
|
||||
private void addOldWalkAnimation(T bipedEntityRenderState, CallbackInfo ci) {
|
||||
if (VisualSettings.global().oldWalkingAnimation.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.oldWalkingAnimation.isEnabled()) {
|
||||
final float limbFrequency = bipedEntityRenderState.limbFrequency;
|
||||
final float limbAmplitudeMultiplier = bipedEntityRenderState.limbAmplitudeMultiplier;
|
||||
|
||||
|
@ -29,7 +29,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viafabricplus.injection.access.base.IClientConnection;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.input.Input;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
@ -264,7 +264,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.global().sendIdlePacket.isEnabled()) {
|
||||
if (DebugSettings.INSTANCE.sendIdlePacket.isEnabled()) {
|
||||
return !isOnGround();
|
||||
} else {
|
||||
return this.lastOnGround;
|
||||
|
@ -23,11 +23,10 @@ package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viafabricplus.features.entity.enchantment_attributes.EnchantmentAttributesEmulation1_20_6;
|
||||
import com.viaversion.viafabricplus.features.entity.riding_offsets.EntityRidingOffsetsPre1_20_2;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.DebugSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.TrapdoorBlock;
|
||||
import net.minecraft.entity.*;
|
||||
@ -101,7 +100,7 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
|
||||
@Redirect(method = "turnHead", at = @At(value = "INVOKE", target = "Ljava/lang/Math;abs(F)F"))
|
||||
private float changeBodyRotationInterpolation(float g) {
|
||||
if (VisualSettings.global().changeBodyRotationInterpolation.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.changeBodyRotationInterpolation.isEnabled()) {
|
||||
g = MathHelper.clamp(g, -75.0F, 75.0F);
|
||||
this.bodyYaw = this.getYaw() - g;
|
||||
if (Math.abs(g) > 50.0F) {
|
||||
@ -115,7 +114,7 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
|
||||
@Inject(method = "tickCramming", at = @At("HEAD"), cancellable = true)
|
||||
private void preventEntityPush(CallbackInfo ci) {
|
||||
if (DebugSettings.global().preventEntityCramming.isEnabled()) {
|
||||
if (DebugSettings.INSTANCE.preventEntityCramming.isEnabled()) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
@ -221,7 +220,7 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
|
||||
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;abs(F)F"))
|
||||
private float alwaysRotateWhenWalkingBackwards(float value) {
|
||||
if (VisualSettings.global().sidewaysBackwardsRunning.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.sidewaysBackwardsRunning.isEnabled()) {
|
||||
return 0F;
|
||||
} else {
|
||||
return MathHelper.abs(value);
|
||||
|
@ -26,7 +26,7 @@ import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
@ -239,7 +239,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.global().replaceHurtSoundWithOOFSound.isEnabled()) {
|
||||
if (VisualSettings.INSTANCE.replaceHurtSoundWithOOFSound.isEnabled()) {
|
||||
cir.setReturnValue(viaFabricPlus$oof_hurt);
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
|
||||
|
||||
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.render.entity.feature.VillagerClothingFeatureRenderer;
|
||||
import net.minecraft.village.VillagerData;
|
||||
import net.minecraft.village.VillagerProfession;
|
||||
@ -34,7 +34,7 @@ public abstract class MixinVillagerClothingFeatureRenderer {
|
||||
|
||||
@Redirect(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/state/LivingEntityRenderState;FF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/village/VillagerData;getProfession()Lnet/minecraft/village/VillagerProfession;"))
|
||||
private VillagerProfession revertVillagerVisual(VillagerData instance) {
|
||||
if (VisualSettings.global().hideVillagerProfession.getValue()) {
|
||||
if (VisualSettings.INSTANCE.hideVillagerProfession.getValue()) {
|
||||
return VillagerProfession.NONE;
|
||||
} else {
|
||||
return instance.getProfession();
|
||||
|
@ -76,7 +76,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
/**
|
||||
* This class represents the whole Protocol Translator, here all important variables are stored
|
||||
*/
|
||||
public class ProtocolTranslator {
|
||||
public final class ProtocolTranslator {
|
||||
|
||||
/**
|
||||
* These attribute keys are used to track the main connections of Minecraft and ViaVersion, so that they can be used later during the connection to send packets.
|
||||
|
@ -32,7 +32,7 @@ import net.minecraft.registry.Registries;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ViaFabricPlusMappingDataLoader extends MappingDataLoader {
|
||||
public final class ViaFabricPlusMappingDataLoader extends MappingDataLoader {
|
||||
|
||||
public static final Map<String, Material> MATERIALS = new HashMap<>();
|
||||
public static final Map<String, Map<ProtocolVersion, String>> BLOCK_MATERIALS = new HashMap<>();
|
||||
|
@ -32,7 +32,7 @@ import net.raphimc.vialoader.impl.viaversion.VLCommandHandler;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class ViaFabricPlusVLCommandHandler extends VLCommandHandler {
|
||||
public final class ViaFabricPlusVLCommandHandler extends VLCommandHandler {
|
||||
|
||||
public ViaFabricPlusVLCommandHandler() {
|
||||
super();
|
||||
|
@ -28,7 +28,7 @@ import net.minecraft.text.Text;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ViaFabricPlusViaCommandSender implements ViaCommandSender {
|
||||
public final class ViaFabricPlusViaCommandSender implements ViaCommandSender {
|
||||
|
||||
private final CommandSource source;
|
||||
|
||||
|
@ -28,7 +28,7 @@ import net.minecraft.util.Formatting;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialegacy.protocol.classic.c0_30cpetoc0_28_30.storage.ExtensionProtocolMetadataStorage;
|
||||
|
||||
public class ListExtensionsCommand implements VFPViaSubCommand {
|
||||
public final class ListExtensionsCommand implements VFPViaSubCommand {
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
|
@ -27,7 +27,7 @@ import net.minecraft.util.Formatting;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialegacy.protocol.alpha.a1_0_16_2toa1_0_17_1_0_17_4.storage.TimeLockStorage;
|
||||
|
||||
public class SetTimeCommand implements VFPViaSubCommand {
|
||||
public final class SetTimeCommand implements VFPViaSubCommand {
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
|
@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.protocoltranslator.impl.platform;
|
||||
|
||||
import net.raphimc.vialoader.impl.platform.ViaLegacyPlatformImpl;
|
||||
|
||||
public class ViaFabricPlusViaLegacyPlatformImpl extends ViaLegacyPlatformImpl {
|
||||
public final class ViaFabricPlusViaLegacyPlatformImpl extends ViaLegacyPlatformImpl {
|
||||
|
||||
@Override
|
||||
public String getCpeAppName() {
|
||||
|
@ -33,7 +33,7 @@ import net.raphimc.vialoader.impl.platform.ViaVersionPlatformImpl;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ViaFabricPlusViaVersionPlatformImpl extends ViaVersionPlatformImpl {
|
||||
public final class ViaFabricPlusViaVersionPlatformImpl extends ViaVersionPlatformImpl {
|
||||
|
||||
public ViaFabricPlusViaVersionPlatformImpl(File rootFolder) { // Only required to not throw an exception, not used
|
||||
super(rootFolder);
|
||||
|
@ -32,7 +32,7 @@ import net.raphimc.vialoader.netty.VLPipeline;
|
||||
|
||||
import javax.crypto.SecretKey;
|
||||
|
||||
public class ViaFabricPlusNettyPipelineProvider extends NettyPipelineProvider {
|
||||
public final class ViaFabricPlusNettyPipelineProvider extends NettyPipelineProvider {
|
||||
|
||||
@Override
|
||||
public void enableCompression(UserConnection user, ProtocolCompression protocolCompression) {
|
||||
|
@ -34,7 +34,7 @@ import java.util.List;
|
||||
|
||||
import static net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.copyItems;
|
||||
|
||||
public class ViaFabricPlusAlphaInventoryProvider extends AlphaInventoryProvider {
|
||||
public final class ViaFabricPlusAlphaInventoryProvider extends AlphaInventoryProvider {
|
||||
|
||||
@Override
|
||||
public boolean usesInventoryTracker() {
|
||||
|
@ -25,11 +25,11 @@ import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.classic4j.BetaCraftHandler;
|
||||
import com.viaversion.viafabricplus.ViaFabricPlusImpl;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.AuthenticationSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.AuthenticationSettings;
|
||||
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.provider.ClassicMPPassProvider;
|
||||
import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.provider.OldAuthProvider;
|
||||
|
||||
public class ViaFabricPlusClassicMPPassProvider extends ClassicMPPassProvider {
|
||||
public final class ViaFabricPlusClassicMPPassProvider extends ClassicMPPassProvider {
|
||||
|
||||
public static String classicubeMPPass;
|
||||
|
||||
@ -41,7 +41,7 @@ public class ViaFabricPlusClassicMPPassProvider extends ClassicMPPassProvider {
|
||||
return mpPass;
|
||||
}
|
||||
|
||||
if (AuthenticationSettings.global().useBetaCraftAuthentication.getValue()) {
|
||||
if (AuthenticationSettings.INSTANCE.useBetaCraftAuthentication.getValue()) {
|
||||
// Doesn't use the MPPass system anymore, but still kept here for simplicity
|
||||
BetaCraftHandler.authenticate(serverId -> {
|
||||
try {
|
||||
|
@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.protocoltranslator.impl.provider.vialegacy;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.provider.ClassicWorldHeightProvider;
|
||||
|
||||
public class ViaFabricPlusClassicWorldHeightProvider extends ClassicWorldHeightProvider {
|
||||
public final class ViaFabricPlusClassicWorldHeightProvider extends ClassicWorldHeightProvider {
|
||||
|
||||
@Override
|
||||
public short getMaxChunkSectionCount(UserConnection user) {
|
||||
|
@ -26,7 +26,7 @@ import com.viaversion.viafabricplus.injection.access.base.IClientConnection;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.provider.EncryptionProvider;
|
||||
|
||||
public class ViaFabricPlusEncryptionProvider extends EncryptionProvider {
|
||||
public final class ViaFabricPlusEncryptionProvider extends EncryptionProvider {
|
||||
|
||||
@Override
|
||||
public void enableDecryption(UserConnection user) {
|
||||
|
@ -37,7 +37,7 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class ViaFabricPlusGameProfileFetcher extends GameProfileFetcher {
|
||||
public final class ViaFabricPlusGameProfileFetcher extends GameProfileFetcher {
|
||||
|
||||
private static final HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY);
|
||||
private static final MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService();
|
||||
|
@ -24,17 +24,17 @@ package com.viaversion.viafabricplus.protocoltranslator.impl.provider.vialegacy;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viafabricplus.ViaFabricPlusImpl;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viafabricplus.base.settings.impl.AuthenticationSettings;
|
||||
import com.viaversion.viafabricplus.settings.impl.AuthenticationSettings;
|
||||
import com.viaversion.viafabricplus.util.ChatUtil;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.text.Text;
|
||||
import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.provider.OldAuthProvider;
|
||||
|
||||
public class ViaFabricPlusOldAuthProvider extends OldAuthProvider {
|
||||
public final class ViaFabricPlusOldAuthProvider extends OldAuthProvider {
|
||||
|
||||
@Override
|
||||
public void sendAuthRequest(UserConnection user, String serverId) {
|
||||
if (!AuthenticationSettings.global().verifySessionForOnlineModeServers.getValue()) {
|
||||
if (!AuthenticationSettings.INSTANCE.verifySessionForOnlineModeServers.getValue()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.protocoltranslator.impl.provider.viaversion
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.protocols.v1_18_2to1_19.provider.AckSequenceProvider;
|
||||
|
||||
public class ViaFabricPlusAckSequenceProvider extends AckSequenceProvider {
|
||||
public final class ViaFabricPlusAckSequenceProvider extends AckSequenceProvider {
|
||||
|
||||
@Override
|
||||
public void handleSequence(UserConnection connection, int sequence) {
|
||||
|
@ -26,7 +26,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viaversion.protocol.version.BaseVersionProvider;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
|
||||
public class ViaFabricPlusBaseVersionProvider extends BaseVersionProvider {
|
||||
public final class ViaFabricPlusBaseVersionProvider extends BaseVersionProvider {
|
||||
|
||||
@Override
|
||||
public ProtocolVersion getClosestServerProtocol(UserConnection connection) throws Exception {
|
||||
|
@ -30,7 +30,7 @@ import net.minecraft.command.argument.SignedArgumentList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ViaFabricPlusCommandArgumentsProvider extends SignableCommandArgumentsProvider {
|
||||
public final class ViaFabricPlusCommandArgumentsProvider extends SignableCommandArgumentsProvider {
|
||||
|
||||
@Override
|
||||
public List<Pair<String, String>> getSignableArguments(String command) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user