From 2f8187ced93370f1842e135518fff0207386e5ad Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Mon, 23 Dec 2024 12:55:41 +0100 Subject: [PATCH] More work --- .../{util => base}/DataCustomPayload.java | 5 +- .../viafabricplus/base/SyncTasks.java | 68 ++++++++++++++ .../features/ClientsideFeatures.java | 85 +---------------- .../WorldHeightSupport.java | 2 +- .../ClientPlayerInteractionManager1_18_2.java | 2 +- .../tooltip_changes}/Enchantments1_14_4.java | 2 +- .../ResourcePackHeaderDiff.java | 2 +- .../AddBannerPatternRecipe.java | 2 +- .../BannerPattern_1_13_2.java | 2 +- .../recipe_emulation}/RecipeInfo.java | 2 +- .../RecipeManager1_11_2.java | 2 +- .../recipe_emulation}/Recipes1_11_2.java | 2 +- .../ShulkerBoxColoringRecipe.java | 2 +- .../BuiltinEmptyGlyph1_12_2.java | 4 +- .../RenderableGlyphDiff.java | 2 +- .../UnicodeFontFix1_12_2.java | 2 +- .../GridItemSelectionScreen.java | 2 +- .../ui/v1_7_tab_list_style/LegacyTabList.java | 31 +++++++ .../PendingUpdateManager1_18_2.java | 2 +- .../IClientPlayerInteractionManager.java | 2 +- .../IDownloadingTerrainScreen.java | 2 +- .../IPlayerListEntry.java | 2 +- .../IPlayerListHud.java | 2 +- .../MixinMultiplayerServerListPinger.java | 4 +- .../{ => bedrock}/MixinConnectScreen_1.java | 12 +-- .../MixinClientCommonNetworkHandler.java | 44 +++++++++ .../mixin/base/ui/MixinMultiplayerScreen.java | 3 +- .../MixinBuiltChunk.java | 2 +- .../MixinEntityPacketRewriter1_17.java | 4 +- .../MixinWorldPacketRewriter1_17.java | 4 +- .../MixinClientPlayerInteractionManager.java | 4 +- .../MixinItemPlacementContext.java | 2 +- .../item/interactions}/MixinAxeItem.java | 2 +- .../item/interactions}/MixinBlockItem.java | 2 +- .../item/interactions}/MixinBowItem.java | 2 +- .../item/interactions}/MixinBrushItem.java | 2 +- .../item/interactions}/MixinBucketItem.java | 2 +- .../interactions}/MixinEnderPearlItem.java | 2 +- .../MixinEquippableComponent.java | 2 +- .../interactions}/MixinFireChargeItem.java | 2 +- .../interactions}/MixinKnowledgeBookItem.java | 2 +- .../item/interactions}/MixinShovelItem.java | 2 +- .../item/interactions}/MixinSwordItem.java | 2 +- .../item/swinging}/MixinBundleItem.java | 2 +- .../item/swinging}/MixinFishingRodItem.java | 2 +- .../item/swinging}/MixinLeadItem.java | 2 +- .../item/tooltip_changes}/MixinItemStack.java | 4 +- .../MixinAbstractCommandBlockScreen.java | 2 +- .../elytra}/MixinFireworkRocketItem.java | 2 +- .../movement}/item/MixinEnderEyeItem.java | 2 +- ...ixinClientConfigurationNetworkHandler.java | 9 +- .../MixinClientPlayNetworkHandler.java | 58 ++++++++++++ .../MixinNetworkStateTransitionHandler.java | 2 +- .../MixinNetworkStateTransitions.java | 2 +- .../MixinClientPlayNetworkHandler.java | 60 ++++++++++++ .../MixinDownloadingTerrainScreen.java | 21 +---- .../MixinClientCommonNetworkHandler.java | 13 +-- .../MixinClientLoginNetworkHandler.java | 2 +- .../MixinClientPlayNetworkHandler.java | 72 ++++++++++++++ .../MixinProtocol1_20_3To1_20_5.java | 2 +- .../MixinServerResourcePackLoader_4.java | 2 +- ...ixinClientConfigurationNetworkHandler.java | 47 ++++++++++ .../MixinUpdatePlayerAbilitiesC2SPacket.java | 2 +- .../MixinCraftingScreenHandler.java | 50 ++++++++++ .../MixinPlayerScreenHandler.java | 50 ++++++++++ .../MixinScreen.java | 52 +++++++++++ .../MixinFontStorage.java | 6 +- .../MixinLanguageManager.java | 4 +- .../MixinBookEditScreen.java | 2 +- .../MixinCreativeInventoryScreen.java | 2 +- .../MixinDownloadingTerrainScreen.java | 46 +++++++++ .../MixinGameModeSelectionScreen.java | 2 +- ...ModeSelectionScreen_GameModeSelection.java | 2 +- .../MixinInGameHud.java | 2 +- .../MixinScreen.java | 8 -- .../MixinAbstractSignEditScreen.java | 2 +- .../MixinClientPlayNetworkHandler.java | 43 +++++++++ .../MixinPlayerListEntry.java | 6 +- .../MixinPlayerListHud.java | 4 +- .../MixinClientWorld.java | 18 ---- .../disable_sequencing/MixinClientWorld.java | 50 ++++++++++ .../MixinGameOptions.java | 2 +- .../mixin/old/minecraft/MixinCamera.java | 3 +- .../MixinClientPlayNetworkHandler.java | 59 +----------- .../MixinCraftingScreenHandler.java | 10 +- .../MixinPlayerScreenHandler.java | 9 +- .../MixinItemPacketRewriter1_14.java | 6 +- .../MixinWorldPacketRewriter1_19.java | 6 +- .../settings/impl/BedrockSettings.java | 21 +++++ src/main/resources/viafabricplus.mixins.json | 93 +++++++++++-------- 90 files changed, 843 insertions(+), 353 deletions(-) rename src/main/java/com/viaversion/viafabricplus/{util => base}/DataCustomPayload.java (90%) create mode 100644 src/main/java/com/viaversion/viafabricplus/base/SyncTasks.java rename src/main/java/com/viaversion/viafabricplus/{features/versioned/classic => features2/classic_world_height}/WorldHeightSupport.java (99%) rename src/main/java/com/viaversion/viafabricplus/{features/versioned => features2/interaction}/ClientPlayerInteractionManager1_18_2.java (98%) rename src/main/java/com/viaversion/viafabricplus/{features/versioned => features2/item/tooltip_changes}/Enchantments1_14_4.java (98%) rename src/main/java/com/viaversion/viafabricplus/{features/data => features2/networking/resource_pack_header}/ResourcePackHeaderDiff.java (98%) rename src/main/java/com/viaversion/viafabricplus/{features/data/recipe => features2/recipe_emulation}/AddBannerPatternRecipe.java (99%) rename src/main/java/com/viaversion/viafabricplus/{features/data/recipe => features2/recipe_emulation}/BannerPattern_1_13_2.java (98%) rename src/main/java/com/viaversion/viafabricplus/{features/data/recipe => features2/recipe_emulation}/RecipeInfo.java (99%) rename src/main/java/com/viaversion/viafabricplus/{features/data/recipe => features2/recipe_emulation}/RecipeManager1_11_2.java (97%) rename src/main/java/com/viaversion/viafabricplus/{features/data/recipe => features2/recipe_emulation}/Recipes1_11_2.java (99%) rename src/main/java/com/viaversion/viafabricplus/{features/data/recipe => features2/recipe_emulation}/ShulkerBoxColoringRecipe.java (98%) rename src/main/java/com/viaversion/viafabricplus/{features/versioned/visual => features2/text_rendering/non_existing_characters}/BuiltinEmptyGlyph1_12_2.java (94%) rename src/main/java/com/viaversion/viafabricplus/{features/data => features2/text_rendering/non_existing_characters}/RenderableGlyphDiff.java (99%) rename src/main/java/com/viaversion/viafabricplus/{features/versioned/visual => features2/text_rendering/non_existing_characters}/UnicodeFontFix1_12_2.java (97%) rename src/main/java/com/viaversion/viafabricplus/{features/versioned/classic => features2/ui/classic_creative_menu}/GridItemSelectionScreen.java (98%) create mode 100644 src/main/java/com/viaversion/viafabricplus/features2/ui/v1_7_tab_list_style/LegacyTabList.java rename src/main/java/com/viaversion/viafabricplus/{features/versioned => features2/world/disable_sequencing}/PendingUpdateManager1_18_2.java (96%) rename src/main/java/com/viaversion/viafabricplus/injection/access/{ => networking/downloading_terrain_handling}/IDownloadingTerrainScreen.java (91%) rename src/main/java/com/viaversion/viafabricplus/injection/access/{ => v1_7_tab_list_style}/IPlayerListEntry.java (93%) rename src/main/java/com/viaversion/viafabricplus/injection/access/{ => v1_7_tab_list_style}/IPlayerListHud.java (93%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/{ => bedrock}/MixinConnectScreen_1.java (90%) create mode 100644 src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/sync_tasks/MixinClientCommonNetworkHandler.java rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft => features/classic_world_height}/MixinBuiltChunk.java (95%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/viaversion => features/classic_world_height}/MixinEntityPacketRewriter1_17.java (93%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/viaversion => features/classic_world_height}/MixinWorldPacketRewriter1_17.java (93%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/network => features/interaction}/MixinClientPlayerInteractionManager.java (99%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/interaction}/MixinItemPlacementContext.java (98%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/item/interactions}/MixinAxeItem.java (96%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/item/interactions}/MixinBlockItem.java (97%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/item/interactions}/MixinBowItem.java (97%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/item/interactions}/MixinBrushItem.java (95%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/item/interactions}/MixinBucketItem.java (96%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/item/interactions}/MixinEnderPearlItem.java (96%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/item/interactions}/MixinEquippableComponent.java (97%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/item/interactions}/MixinFireChargeItem.java (95%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/item/interactions}/MixinKnowledgeBookItem.java (96%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/item/interactions}/MixinShovelItem.java (96%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/item/interactions}/MixinSwordItem.java (96%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/item/swinging}/MixinBundleItem.java (95%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/item/swinging}/MixinFishingRodItem.java (96%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/item/swinging}/MixinLeadItem.java (96%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/item/tooltip_changes}/MixinItemStack.java (97%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/screen => features/legacy_tab_completions}/MixinAbstractCommandBlockScreen.java (95%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/item => features/movement/elytra}/MixinFireworkRocketItem.java (95%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft => features/movement}/item/MixinEnderEyeItem.java (95%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/network => features/networking/auto_read}/MixinClientConfigurationNetworkHandler.java (84%) create mode 100644 src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/auto_read/MixinClientPlayNetworkHandler.java rename src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/{pre_config_state => auto_read}/MixinNetworkStateTransitionHandler.java (98%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/{pre_config_state => auto_read}/MixinNetworkStateTransitions.java (98%) create mode 100644 src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/downloading_terrain_handling/MixinClientPlayNetworkHandler.java rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/screen => features/networking/downloading_terrain_handling}/MixinDownloadingTerrainScreen.java (81%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/network => features/networking/packet_handling_changes}/MixinClientLoginNetworkHandler.java (95%) create mode 100644 src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/remove_signed_commands/MixinClientPlayNetworkHandler.java rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/viaversion => features/networking/remove_signed_commands}/MixinProtocol1_20_3To1_20_5.java (97%) create mode 100644 src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/warn_feature_updates/MixinClientConfigurationNetworkHandler.java rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/network => features/player_abilities}/MixinUpdatePlayerAbilitiesC2SPacket.java (97%) create mode 100644 src/main/java/com/viaversion/viafabricplus/injection/mixin/features/recipe_emulation/MixinCraftingScreenHandler.java create mode 100644 src/main/java/com/viaversion/viafabricplus/injection/mixin/features/recipe_emulation/MixinPlayerScreenHandler.java create mode 100644 src/main/java/com/viaversion/viafabricplus/injection/mixin/features/run_command_action_handling/MixinScreen.java rename src/main/java/com/viaversion/viafabricplus/injection/mixin/features/text_rendering/{ => non_existing_characters}/MixinFontStorage.java (95%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/features/text_rendering/{ => non_existing_characters}/MixinLanguageManager.java (92%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/screen => features/ui/book_edit_page_limitations}/MixinBookEditScreen.java (95%) create mode 100644 src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/downloading_terrain_transitions/MixinDownloadingTerrainScreen.java rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/screen => features/ui/filter_game_mode_selections}/MixinGameModeSelectionScreen.java (97%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/screen => features/ui/filter_game_mode_selections}/MixinGameModeSelectionScreen_GameModeSelection.java (97%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/{beta_hud_elements => hud_element_changes}/MixinInGameHud.java (99%) rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft/screen => features/ui/sign_editor_reach}/MixinAbstractSignEditScreen.java (96%) create mode 100644 src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinClientPlayNetworkHandler.java create mode 100644 src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/disable_sequencing/MixinClientWorld.java rename src/main/java/com/viaversion/viafabricplus/injection/mixin/{old/minecraft => features/world/remove_server_view_distance}/MixinGameOptions.java (94%) diff --git a/src/main/java/com/viaversion/viafabricplus/util/DataCustomPayload.java b/src/main/java/com/viaversion/viafabricplus/base/DataCustomPayload.java similarity index 90% rename from src/main/java/com/viaversion/viafabricplus/util/DataCustomPayload.java rename to src/main/java/com/viaversion/viafabricplus/base/DataCustomPayload.java index 2284d3d6..9d59984f 100644 --- a/src/main/java/com/viaversion/viafabricplus/util/DataCustomPayload.java +++ b/src/main/java/com/viaversion/viafabricplus/base/DataCustomPayload.java @@ -19,9 +19,8 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.util; +package com.viaversion.viafabricplus.base; -import com.viaversion.viafabricplus.features.ClientsideFeatures; import io.netty.buffer.Unpooled; import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; import net.minecraft.network.PacketByteBuf; @@ -30,7 +29,7 @@ import net.minecraft.util.Identifier; public record DataCustomPayload(PacketByteBuf buf) implements CustomPayload { - public static final CustomPayload.Id ID = new CustomPayload.Id<>(Identifier.of(ClientsideFeatures.PACKET_SYNC_IDENTIFIER)); + public static final CustomPayload.Id ID = new CustomPayload.Id<>(Identifier.of(SyncTasks.PACKET_SYNC_IDENTIFIER)); static { PayloadTypeRegistry.playS2C().register(DataCustomPayload.ID, CustomPayload.codecOf((value, buf) -> { diff --git a/src/main/java/com/viaversion/viafabricplus/base/SyncTasks.java b/src/main/java/com/viaversion/viafabricplus/base/SyncTasks.java new file mode 100644 index 00000000..be574c20 --- /dev/null +++ b/src/main/java/com/viaversion/viafabricplus/base/SyncTasks.java @@ -0,0 +1,68 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus + * Copyright (C) 2021-2024 the original authors + * - FlorianMichael/EnZaXD + * - RK_01/RaphiMC + * Copyright (C) 2023-2024 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.viaversion.viafabricplus.base; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.RegistryByteBuf; + +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Consumer; + +public class SyncTasks { + + /** + * Contains all tasks that are waiting for a packet to be received, this system can be used to sync ViaVersion tasks with the correct thread + */ + private static final Map> PENDING_EXECUTION_TASKS = new ConcurrentHashMap<>(); + + /** + * This identifier is an internal identifier used to identify packets that are sent by ViaFabricPlus + */ + public static final String PACKET_SYNC_IDENTIFIER = UUID.randomUUID() + ":" + UUID.randomUUID(); + + /** + * Executes a task synchronized with the main thread from networking threads + * + * @param task The task to execute + * @return The uuid of the task + */ + public static String executeSyncTask(final Consumer task) { + final String uuid = UUID.randomUUID().toString(); + PENDING_EXECUTION_TASKS.put(uuid, task); + return uuid; + } + + public static void handleSyncTask(final PacketByteBuf buf) { + final String uuid = buf.readString(); + + if (PENDING_EXECUTION_TASKS.containsKey(uuid)) { + MinecraftClient.getInstance().execute(() -> { // Execute the task on the main thread + final Consumer task = PENDING_EXECUTION_TASKS.remove(uuid); + task.accept(new RegistryByteBuf(buf, MinecraftClient.getInstance().getNetworkHandler().getRegistryManager())); + }); + } + } + +} diff --git a/src/main/java/com/viaversion/viafabricplus/features/ClientsideFeatures.java b/src/main/java/com/viaversion/viafabricplus/features/ClientsideFeatures.java index 85a399b4..8a509904 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/ClientsideFeatures.java +++ b/src/main/java/com/viaversion/viafabricplus/features/ClientsideFeatures.java @@ -25,61 +25,27 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.event.ChangeProtocolVersionCallback; import com.viaversion.viafabricplus.event.PostGameLoadCallback; import com.viaversion.viafabricplus.features.data.EntityDimensionDiff; -import com.viaversion.viafabricplus.features.data.ResourcePackHeaderDiff; -import com.viaversion.viafabricplus.features.data.recipe.Recipes1_11_2; +import com.viaversion.viafabricplus.features2.networking.resource_pack_header.ResourcePackHeaderDiff; +import com.viaversion.viafabricplus.features2.recipe_emulation.Recipes1_11_2; import com.viaversion.viafabricplus.features.versioned.EnchantmentAttributesEmulation1_20_6; import com.viaversion.viafabricplus.features2.cpe_extensions.CPEAdditions; -import com.viaversion.viafabricplus.features.versioned.classic.GridItemSelectionScreen; +import com.viaversion.viafabricplus.features2.ui.classic_creative_menu.GridItemSelectionScreen; import com.viaversion.viafabricplus.features.versioned.visual.ArmorHudEmulation1_8; import com.viaversion.viafabricplus.features2.footstep_particle.FootStepParticle1_12_2; -import com.viaversion.viafabricplus.features.versioned.visual.UnicodeFontFix1_12_2; -import com.viaversion.viafabricplus.injection.access.IClientConnection; -import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.settings.impl.BedrockSettings; +import com.viaversion.viafabricplus.features2.text_rendering.non_existing_characters.UnicodeFontFix1_12_2; import com.viaversion.viafabricplus.settings.impl.VisualSettings; -import com.viaversion.viafabricplus.util.DataCustomPayload; +import com.viaversion.viafabricplus.base.DataCustomPayload; import net.minecraft.block.*; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayNetworkHandler; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.network.RegistryByteBuf; import net.minecraft.registry.Registries; import net.raphimc.viaaprilfools.api.AprilFoolsProtocolVersion; -import net.raphimc.viabedrock.api.BedrockProtocolVersion; -import net.raphimc.viabedrock.protocol.data.ProtocolConstants; 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; -import org.jetbrains.annotations.ApiStatus; - -import java.util.Map; -import java.util.Objects; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.function.Consumer; /** * This class contains random fields and methods that are used to fix bugs on the client side */ public class ClientsideFeatures { - /** - * Contains all tasks that are waiting for a packet to be received, this system can be used to sync ViaVersion tasks with the correct thread - */ - private static final Map> PENDING_EXECUTION_TASKS = new ConcurrentHashMap<>(); - - /** - * This identifier is an internal identifier used to identify packets that are sent by ViaFabricPlus - */ - @ApiStatus.Internal - public static final String PACKET_SYNC_IDENTIFIER = UUID.randomUUID() + ":" + UUID.randomUUID(); - - /** - * This is an incremental index used for tablist entries to implement FIFO behavior <= 1.7 - */ - @ApiStatus.Internal - public static int globalTablistIndex = 0; - static { // Register additional CPE features CPEAdditions.modifyMappings(); @@ -148,45 +114,4 @@ public class ClientsideFeatures { // Calls the static block } - /** - * Replaces the default port when parsing a server address if the default port should be replaced - * - * @param address The original address of the server - * @param version The protocol version - * @return The server address with the replaced default port - */ - public static String replaceDefaultPort(final String address, final ProtocolVersion version) { - // If the default port for this entry should be replaced, check if the address already contains a port - // We can't just replace vanilla's default port because a bedrock server might be running on the same port - if (BedrockSettings.global().replaceDefaultPort.getValue() && Objects.equals(version, BedrockProtocolVersion.bedrockLatest) && !address.contains(":")) { - return address + ":" + ProtocolConstants.BEDROCK_DEFAULT_PORT; - } else { - return address; - } - } - - /** - * Executes a task synchronized with the main thread from networking threads - * - * @param task The task to execute - * @return The uuid of the task - */ - public static String executeSyncTask(final Consumer task) { - final String uuid = UUID.randomUUID().toString(); - PENDING_EXECUTION_TASKS.put(uuid, task); - return uuid; - } - - @ApiStatus.Internal - public static void handleSyncTask(final PacketByteBuf buf) { - final String uuid = buf.readString(); - - if (PENDING_EXECUTION_TASKS.containsKey(uuid)) { - MinecraftClient.getInstance().execute(() -> { // Execute the task on the main thread - final Consumer task = PENDING_EXECUTION_TASKS.remove(uuid); - task.accept(new RegistryByteBuf(buf, MinecraftClient.getInstance().getNetworkHandler().getRegistryManager())); - }); - } - } - } diff --git a/src/main/java/com/viaversion/viafabricplus/features/versioned/classic/WorldHeightSupport.java b/src/main/java/com/viaversion/viafabricplus/features2/classic_world_height/WorldHeightSupport.java similarity index 99% rename from src/main/java/com/viaversion/viafabricplus/features/versioned/classic/WorldHeightSupport.java rename to src/main/java/com/viaversion/viafabricplus/features2/classic_world_height/WorldHeightSupport.java index 16eb0d3b..77329803 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/versioned/classic/WorldHeightSupport.java +++ b/src/main/java/com/viaversion/viafabricplus/features2/classic_world_height/WorldHeightSupport.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.versioned.classic; +package com.viaversion.viafabricplus.features2.classic_world_height; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.viaversion.api.Via; diff --git a/src/main/java/com/viaversion/viafabricplus/features/versioned/ClientPlayerInteractionManager1_18_2.java b/src/main/java/com/viaversion/viafabricplus/features2/interaction/ClientPlayerInteractionManager1_18_2.java similarity index 98% rename from src/main/java/com/viaversion/viafabricplus/features/versioned/ClientPlayerInteractionManager1_18_2.java rename to src/main/java/com/viaversion/viafabricplus/features2/interaction/ClientPlayerInteractionManager1_18_2.java index bcec1677..38e2ecd0 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/versioned/ClientPlayerInteractionManager1_18_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features2/interaction/ClientPlayerInteractionManager1_18_2.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.versioned; +package com.viaversion.viafabricplus.features2.interaction; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.ViaFabricPlus; diff --git a/src/main/java/com/viaversion/viafabricplus/features/versioned/Enchantments1_14_4.java b/src/main/java/com/viaversion/viafabricplus/features2/item/tooltip_changes/Enchantments1_14_4.java similarity index 98% rename from src/main/java/com/viaversion/viafabricplus/features/versioned/Enchantments1_14_4.java rename to src/main/java/com/viaversion/viafabricplus/features2/item/tooltip_changes/Enchantments1_14_4.java index a93bc11f..859b4692 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/versioned/Enchantments1_14_4.java +++ b/src/main/java/com/viaversion/viafabricplus/features2/item/tooltip_changes/Enchantments1_14_4.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.versioned; +package com.viaversion.viafabricplus.features2.item.tooltip_changes; import com.viaversion.viaversion.util.Key; import net.minecraft.enchantment.Enchantment; diff --git a/src/main/java/com/viaversion/viafabricplus/features/data/ResourcePackHeaderDiff.java b/src/main/java/com/viaversion/viafabricplus/features2/networking/resource_pack_header/ResourcePackHeaderDiff.java similarity index 98% rename from src/main/java/com/viaversion/viafabricplus/features/data/ResourcePackHeaderDiff.java rename to src/main/java/com/viaversion/viafabricplus/features2/networking/resource_pack_header/ResourcePackHeaderDiff.java index f61f2157..3245ce62 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/data/ResourcePackHeaderDiff.java +++ b/src/main/java/com/viaversion/viafabricplus/features2/networking/resource_pack_header/ResourcePackHeaderDiff.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.data; +package com.viaversion.viafabricplus.features2.networking.resource_pack_header; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/features/data/recipe/AddBannerPatternRecipe.java b/src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/AddBannerPatternRecipe.java similarity index 99% rename from src/main/java/com/viaversion/viafabricplus/features/data/recipe/AddBannerPatternRecipe.java rename to src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/AddBannerPatternRecipe.java index 60798831..83d958d2 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/data/recipe/AddBannerPatternRecipe.java +++ b/src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/AddBannerPatternRecipe.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.data.recipe; +package com.viaversion.viafabricplus.features2.recipe_emulation; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/features/data/recipe/BannerPattern_1_13_2.java b/src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/BannerPattern_1_13_2.java similarity index 98% rename from src/main/java/com/viaversion/viafabricplus/features/data/recipe/BannerPattern_1_13_2.java rename to src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/BannerPattern_1_13_2.java index a6655a1b..0569f5a4 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/data/recipe/BannerPattern_1_13_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/BannerPattern_1_13_2.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.data.recipe; +package com.viaversion.viafabricplus.features2.recipe_emulation; import net.minecraft.block.Blocks; import net.minecraft.block.entity.BannerPattern; diff --git a/src/main/java/com/viaversion/viafabricplus/features/data/recipe/RecipeInfo.java b/src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/RecipeInfo.java similarity index 99% rename from src/main/java/com/viaversion/viafabricplus/features/data/recipe/RecipeInfo.java rename to src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/RecipeInfo.java index aea21f12..4c551f8c 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/data/recipe/RecipeInfo.java +++ b/src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/RecipeInfo.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.data.recipe; +package com.viaversion.viafabricplus.features2.recipe_emulation; import net.minecraft.item.ItemConvertible; import net.minecraft.item.ItemStack; diff --git a/src/main/java/com/viaversion/viafabricplus/features/data/recipe/RecipeManager1_11_2.java b/src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/RecipeManager1_11_2.java similarity index 97% rename from src/main/java/com/viaversion/viafabricplus/features/data/recipe/RecipeManager1_11_2.java rename to src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/RecipeManager1_11_2.java index c8160b1e..75083fad 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/data/recipe/RecipeManager1_11_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/RecipeManager1_11_2.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.data.recipe; +package com.viaversion.viafabricplus.features2.recipe_emulation; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultimap; diff --git a/src/main/java/com/viaversion/viafabricplus/features/data/recipe/Recipes1_11_2.java b/src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/Recipes1_11_2.java similarity index 99% rename from src/main/java/com/viaversion/viafabricplus/features/data/recipe/Recipes1_11_2.java rename to src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/Recipes1_11_2.java index a00022a9..c5d6ab65 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/data/recipe/Recipes1_11_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/Recipes1_11_2.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.data.recipe; +package com.viaversion.viafabricplus.features2.recipe_emulation; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/features/data/recipe/ShulkerBoxColoringRecipe.java b/src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/ShulkerBoxColoringRecipe.java similarity index 98% rename from src/main/java/com/viaversion/viafabricplus/features/data/recipe/ShulkerBoxColoringRecipe.java rename to src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/ShulkerBoxColoringRecipe.java index cc8f6521..5b29d5ec 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/data/recipe/ShulkerBoxColoringRecipe.java +++ b/src/main/java/com/viaversion/viafabricplus/features2/recipe_emulation/ShulkerBoxColoringRecipe.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.data.recipe; +package com.viaversion.viafabricplus.features2.recipe_emulation; import net.minecraft.block.Block; import net.minecraft.block.ShulkerBoxBlock; diff --git a/src/main/java/com/viaversion/viafabricplus/features/versioned/visual/BuiltinEmptyGlyph1_12_2.java b/src/main/java/com/viaversion/viafabricplus/features2/text_rendering/non_existing_characters/BuiltinEmptyGlyph1_12_2.java similarity index 94% rename from src/main/java/com/viaversion/viafabricplus/features/versioned/visual/BuiltinEmptyGlyph1_12_2.java rename to src/main/java/com/viaversion/viafabricplus/features2/text_rendering/non_existing_characters/BuiltinEmptyGlyph1_12_2.java index fffe0aa1..2dbb1e61 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/versioned/visual/BuiltinEmptyGlyph1_12_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features2/text_rendering/non_existing_characters/BuiltinEmptyGlyph1_12_2.java @@ -19,9 +19,9 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.versioned.visual; +package com.viaversion.viafabricplus.features2.text_rendering.non_existing_characters; -import com.viaversion.viafabricplus.injection.mixin.features.text_rendering.MixinFontStorage; +import com.viaversion.viafabricplus.injection.mixin.features.text_rendering.non_existing_characters.MixinFontStorage; import net.minecraft.client.font.BakedGlyph; import net.minecraft.client.font.Glyph; import net.minecraft.client.font.RenderableGlyph; diff --git a/src/main/java/com/viaversion/viafabricplus/features/data/RenderableGlyphDiff.java b/src/main/java/com/viaversion/viafabricplus/features2/text_rendering/non_existing_characters/RenderableGlyphDiff.java similarity index 99% rename from src/main/java/com/viaversion/viafabricplus/features/data/RenderableGlyphDiff.java rename to src/main/java/com/viaversion/viafabricplus/features2/text_rendering/non_existing_characters/RenderableGlyphDiff.java index 8365d945..ac321c34 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/data/RenderableGlyphDiff.java +++ b/src/main/java/com/viaversion/viafabricplus/features2/text_rendering/non_existing_characters/RenderableGlyphDiff.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.data; +package com.viaversion.viafabricplus.features2.text_rendering.non_existing_characters; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/features/versioned/visual/UnicodeFontFix1_12_2.java b/src/main/java/com/viaversion/viafabricplus/features2/text_rendering/non_existing_characters/UnicodeFontFix1_12_2.java similarity index 97% rename from src/main/java/com/viaversion/viafabricplus/features/versioned/visual/UnicodeFontFix1_12_2.java rename to src/main/java/com/viaversion/viafabricplus/features2/text_rendering/non_existing_characters/UnicodeFontFix1_12_2.java index 747c8565..a51ac955 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/versioned/visual/UnicodeFontFix1_12_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features2/text_rendering/non_existing_characters/UnicodeFontFix1_12_2.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.versioned.visual; +package com.viaversion.viafabricplus.features2.text_rendering.non_existing_characters; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.event.ChangeProtocolVersionCallback; diff --git a/src/main/java/com/viaversion/viafabricplus/features/versioned/classic/GridItemSelectionScreen.java b/src/main/java/com/viaversion/viafabricplus/features2/ui/classic_creative_menu/GridItemSelectionScreen.java similarity index 98% rename from src/main/java/com/viaversion/viafabricplus/features/versioned/classic/GridItemSelectionScreen.java rename to src/main/java/com/viaversion/viafabricplus/features2/ui/classic_creative_menu/GridItemSelectionScreen.java index 3503973a..6319b110 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/versioned/classic/GridItemSelectionScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/features2/ui/classic_creative_menu/GridItemSelectionScreen.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.versioned.classic; +package com.viaversion.viafabricplus.features2.ui.classic_creative_menu; import com.viaversion.viafabricplus.features2.item.filter_creative_tabs.ItemRegistryDiff; import com.viaversion.viafabricplus.screen.VFPScreen; diff --git a/src/main/java/com/viaversion/viafabricplus/features2/ui/v1_7_tab_list_style/LegacyTabList.java b/src/main/java/com/viaversion/viafabricplus/features2/ui/v1_7_tab_list_style/LegacyTabList.java new file mode 100644 index 00000000..058b5290 --- /dev/null +++ b/src/main/java/com/viaversion/viafabricplus/features2/ui/v1_7_tab_list_style/LegacyTabList.java @@ -0,0 +1,31 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus + * Copyright (C) 2021-2024 the original authors + * - FlorianMichael/EnZaXD + * - RK_01/RaphiMC + * Copyright (C) 2023-2024 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.viaversion.viafabricplus.features2.ui.v1_7_tab_list_style; + +public class LegacyTabList { + + /** + * This is an incremental index used for tablist entries to implement FIFO behavior <= 1.7 + */ + public static int globalTablistIndex = 0; + +} diff --git a/src/main/java/com/viaversion/viafabricplus/features/versioned/PendingUpdateManager1_18_2.java b/src/main/java/com/viaversion/viafabricplus/features2/world/disable_sequencing/PendingUpdateManager1_18_2.java similarity index 96% rename from src/main/java/com/viaversion/viafabricplus/features/versioned/PendingUpdateManager1_18_2.java rename to src/main/java/com/viaversion/viafabricplus/features2/world/disable_sequencing/PendingUpdateManager1_18_2.java index 05ccd7d5..904e0d43 100644 --- a/src/main/java/com/viaversion/viafabricplus/features/versioned/PendingUpdateManager1_18_2.java +++ b/src/main/java/com/viaversion/viafabricplus/features2/world/disable_sequencing/PendingUpdateManager1_18_2.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.features.versioned; +package com.viaversion.viafabricplus.features2.world.disable_sequencing; import net.minecraft.block.BlockState; import net.minecraft.client.network.ClientPlayerEntity; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/access/IClientPlayerInteractionManager.java b/src/main/java/com/viaversion/viafabricplus/injection/access/IClientPlayerInteractionManager.java index 99ba092b..29f3eefb 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/access/IClientPlayerInteractionManager.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/access/IClientPlayerInteractionManager.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.access; -import com.viaversion.viafabricplus.features.versioned.ClientPlayerInteractionManager1_18_2; +import com.viaversion.viafabricplus.features2.interaction.ClientPlayerInteractionManager1_18_2; public interface IClientPlayerInteractionManager { diff --git a/src/main/java/com/viaversion/viafabricplus/injection/access/IDownloadingTerrainScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/access/networking/downloading_terrain_handling/IDownloadingTerrainScreen.java similarity index 91% rename from src/main/java/com/viaversion/viafabricplus/injection/access/IDownloadingTerrainScreen.java rename to src/main/java/com/viaversion/viafabricplus/injection/access/networking/downloading_terrain_handling/IDownloadingTerrainScreen.java index c0f75c6e..b2dbb9f6 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/access/IDownloadingTerrainScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/access/networking/downloading_terrain_handling/IDownloadingTerrainScreen.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.access; +package com.viaversion.viafabricplus.injection.access.networking.downloading_terrain_handling; public interface IDownloadingTerrainScreen { diff --git a/src/main/java/com/viaversion/viafabricplus/injection/access/IPlayerListEntry.java b/src/main/java/com/viaversion/viafabricplus/injection/access/v1_7_tab_list_style/IPlayerListEntry.java similarity index 93% rename from src/main/java/com/viaversion/viafabricplus/injection/access/IPlayerListEntry.java rename to src/main/java/com/viaversion/viafabricplus/injection/access/v1_7_tab_list_style/IPlayerListEntry.java index d57e985c..1e508f91 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/access/IPlayerListEntry.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/access/v1_7_tab_list_style/IPlayerListEntry.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.access; +package com.viaversion.viafabricplus.injection.access.v1_7_tab_list_style; public interface IPlayerListEntry { diff --git a/src/main/java/com/viaversion/viafabricplus/injection/access/IPlayerListHud.java b/src/main/java/com/viaversion/viafabricplus/injection/access/v1_7_tab_list_style/IPlayerListHud.java similarity index 93% rename from src/main/java/com/viaversion/viafabricplus/injection/access/IPlayerListHud.java rename to src/main/java/com/viaversion/viafabricplus/injection/access/v1_7_tab_list_style/IPlayerListHud.java index 1dfc3305..be7968ea 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/access/IPlayerListHud.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/access/v1_7_tab_list_style/IPlayerListHud.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.access; +package com.viaversion.viafabricplus.injection.access.v1_7_tab_list_style; public interface IPlayerListHud { diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinMultiplayerServerListPinger.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinMultiplayerServerListPinger.java index f1f86c93..47d70805 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinMultiplayerServerListPinger.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinMultiplayerServerListPinger.java @@ -24,8 +24,8 @@ package com.viaversion.viafabricplus.injection.mixin.base.integration; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.llamalad7.mixinextras.sugar.Local; -import com.viaversion.viafabricplus.features.ClientsideFeatures; import com.viaversion.viafabricplus.injection.access.IServerInfo; +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; @@ -38,7 +38,7 @@ public abstract class MixinMultiplayerServerListPinger { @WrapOperation(method = "add", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ServerAddress;parse(Ljava/lang/String;)Lnet/minecraft/client/network/ServerAddress;")) private ServerAddress replaceDefaultPort(String address, Operation original, @Local(argsOnly = true) ServerInfo entry) { // Replace port when pinging the server and the forced version is set - return original.call(ClientsideFeatures.replaceDefaultPort(address, ((IServerInfo) entry).viaFabricPlus$forcedVersion())); + return original.call(BedrockSettings.replaceDefaultPort(address, ((IServerInfo) entry).viaFabricPlus$forcedVersion())); } } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinConnectScreen_1.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/bedrock/MixinConnectScreen_1.java similarity index 90% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinConnectScreen_1.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/bedrock/MixinConnectScreen_1.java index 8fe9e606..00112f00 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/MixinConnectScreen_1.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/bedrock/MixinConnectScreen_1.java @@ -19,38 +19,28 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.base.integration; +package com.viaversion.viafabricplus.injection.mixin.base.integration.bedrock; import com.llamalad7.mixinextras.sugar.Local; import com.viaversion.viaversion.api.connection.UserConnection; -import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.ViaFabricPlus; import com.viaversion.viafabricplus.injection.access.IClientConnection; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import net.minecraft.client.network.ServerAddress; import net.minecraft.network.ClientConnection; import net.raphimc.minecraftauth.step.bedrock.StepMCChain; import net.raphimc.minecraftauth.step.bedrock.session.StepFullBedrockSession; import net.raphimc.viabedrock.api.BedrockProtocolVersion; import net.raphimc.viabedrock.protocol.storage.AuthChainData; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; 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 java.net.InetSocketAddress; import java.util.UUID; @Mixin(targets = "net.minecraft.client.gui.screen.multiplayer.ConnectScreen$1") public abstract class MixinConnectScreen_1 { - @Final - @Shadow - ServerAddress field_33737; - @Inject(method = "run", at = @At(value = "INVOKE", target = "Lio/netty/channel/ChannelFuture;syncUninterruptibly()Lio/netty/channel/ChannelFuture;", remap = false, shift = At.Shift.AFTER)) private void setupBedrockAccount(CallbackInfo ci, @Local ClientConnection clientConnection) { final UserConnection userConnection = ((IClientConnection) clientConnection).viaFabricPlus$getUserConnection(); diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/sync_tasks/MixinClientCommonNetworkHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/sync_tasks/MixinClientCommonNetworkHandler.java new file mode 100644 index 00000000..69326fc5 --- /dev/null +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/integration/sync_tasks/MixinClientCommonNetworkHandler.java @@ -0,0 +1,44 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus + * Copyright (C) 2021-2024 the original authors + * - FlorianMichael/EnZaXD + * - RK_01/RaphiMC + * Copyright (C) 2023-2024 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.viaversion.viafabricplus.injection.mixin.base.integration.sync_tasks; + +import com.viaversion.viafabricplus.base.SyncTasks; +import com.viaversion.viafabricplus.base.DataCustomPayload; +import net.minecraft.client.network.ClientCommonNetworkHandler; +import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(value = ClientCommonNetworkHandler.class, priority = 1 /* Has to be applied before Fabric's Networking API, so it doesn't cancel our custom-payload packets */) +public abstract class MixinClientCommonNetworkHandler { + + @Inject(method = "onCustomPayload(Lnet/minecraft/network/packet/s2c/common/CustomPayloadS2CPacket;)V", at = @At("HEAD"), cancellable = true) + private void handleSyncTask(CustomPayloadS2CPacket packet, CallbackInfo ci) { + if (packet.payload() instanceof DataCustomPayload dataCustomPayload) { + SyncTasks.handleSyncTask(dataCustomPayload.buf()); + ci.cancel(); // Cancel the packet, so it doesn't get processed by the client + } + } + +} \ No newline at end of file diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinMultiplayerScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinMultiplayerScreen.java index e6190bc0..44b02122 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinMultiplayerScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/base/ui/MixinMultiplayerScreen.java @@ -24,6 +24,7 @@ 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.settings.impl.BedrockSettings; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.features.ClientsideFeatures; import com.viaversion.viafabricplus.injection.access.IServerInfo; @@ -70,7 +71,7 @@ public abstract class MixinMultiplayerScreen extends Screen { } else { version = mixinServerInfo.viaFabricPlus$forcedVersion(); } - return original.call(ClientsideFeatures.replaceDefaultPort(address, version)); + return original.call(BedrockSettings.replaceDefaultPort(address, version)); } @WrapOperation(method = "directConnect", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/multiplayer/MultiplayerScreen;connect(Lnet/minecraft/client/network/ServerInfo;)V")) diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/MixinBuiltChunk.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/classic_world_height/MixinBuiltChunk.java similarity index 95% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/MixinBuiltChunk.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/classic_world_height/MixinBuiltChunk.java index a8b0192b..e8f60265 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/MixinBuiltChunk.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/classic_world_height/MixinBuiltChunk.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft; +package com.viaversion.viafabricplus.injection.mixin.features.classic_world_height; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/viaversion/MixinEntityPacketRewriter1_17.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/classic_world_height/MixinEntityPacketRewriter1_17.java similarity index 93% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/viaversion/MixinEntityPacketRewriter1_17.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/classic_world_height/MixinEntityPacketRewriter1_17.java index 89bc6479..e74667a1 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/viaversion/MixinEntityPacketRewriter1_17.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/classic_world_height/MixinEntityPacketRewriter1_17.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.viaversion; +package com.viaversion.viafabricplus.injection.mixin.features.classic_world_height; import com.viaversion.viaversion.api.protocol.Protocol; import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; @@ -27,7 +27,7 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; import com.viaversion.viaversion.protocols.v1_16_1to1_16_2.packet.ClientboundPackets1_16_2; import com.viaversion.viaversion.protocols.v1_16_4to1_17.Protocol1_16_4To1_17; import com.viaversion.viaversion.protocols.v1_16_4to1_17.rewriter.EntityPacketRewriter1_17; -import com.viaversion.viafabricplus.features.versioned.classic.WorldHeightSupport; +import com.viaversion.viafabricplus.features2.classic_world_height.WorldHeightSupport; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/viaversion/MixinWorldPacketRewriter1_17.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/classic_world_height/MixinWorldPacketRewriter1_17.java similarity index 93% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/viaversion/MixinWorldPacketRewriter1_17.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/classic_world_height/MixinWorldPacketRewriter1_17.java index eb8cc2b8..f4924632 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/viaversion/MixinWorldPacketRewriter1_17.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/classic_world_height/MixinWorldPacketRewriter1_17.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.viaversion; +package com.viaversion.viafabricplus.injection.mixin.features.classic_world_height; import com.viaversion.viaversion.api.protocol.Protocol; import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; @@ -27,7 +27,7 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; import com.viaversion.viaversion.protocols.v1_16_1to1_16_2.packet.ClientboundPackets1_16_2; import com.viaversion.viaversion.protocols.v1_16_4to1_17.Protocol1_16_4To1_17; import com.viaversion.viaversion.protocols.v1_16_4to1_17.rewriter.WorldPacketRewriter1_17; -import com.viaversion.viafabricplus.features.versioned.classic.WorldHeightSupport; +import com.viaversion.viafabricplus.features2.classic_world_height.WorldHeightSupport; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinClientPlayerInteractionManager.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/interaction/MixinClientPlayerInteractionManager.java similarity index 99% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinClientPlayerInteractionManager.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/interaction/MixinClientPlayerInteractionManager.java index f15c0ec2..672feabe 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinClientPlayerInteractionManager.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/interaction/MixinClientPlayerInteractionManager.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.network; +package com.viaversion.viafabricplus.injection.mixin.features.interaction; import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; import com.llamalad7.mixinextras.sugar.Local; @@ -30,7 +30,7 @@ import com.viaversion.viaversion.protocols.v1_16_1to1_16_2.packet.ServerboundPac import com.viaversion.viaversion.protocols.v1_16_4to1_17.Protocol1_16_4To1_17; import com.viaversion.viafabricplus.ViaFabricPlus; import com.viaversion.viafabricplus.features.versioned.ActionResultException1_12_2; -import com.viaversion.viafabricplus.features.versioned.ClientPlayerInteractionManager1_18_2; +import com.viaversion.viafabricplus.features2.interaction.ClientPlayerInteractionManager1_18_2; import com.viaversion.viafabricplus.injection.access.IClientConnection; import com.viaversion.viafabricplus.injection.access.IClientPlayerInteractionManager; import com.viaversion.viafabricplus.injection.access.IScreenHandler; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinItemPlacementContext.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/interaction/MixinItemPlacementContext.java similarity index 98% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinItemPlacementContext.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/interaction/MixinItemPlacementContext.java index 07ae578d..e7a17147 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinItemPlacementContext.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/interaction/MixinItemPlacementContext.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.interaction; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinAxeItem.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinAxeItem.java similarity index 96% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinAxeItem.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinAxeItem.java index 24c00a9e..8e27c77f 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinAxeItem.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinAxeItem.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.item.interactions; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinBlockItem.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinBlockItem.java similarity index 97% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinBlockItem.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinBlockItem.java index d0f76954..868830a4 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinBlockItem.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinBlockItem.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.item.interactions; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinBowItem.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinBowItem.java similarity index 97% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinBowItem.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinBowItem.java index 33a73555..45604e36 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinBowItem.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinBowItem.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.item.interactions; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.player.PlayerEntity; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinBrushItem.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinBrushItem.java similarity index 95% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinBrushItem.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinBrushItem.java index 9789184b..abbeeeee 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinBrushItem.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinBrushItem.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.item.interactions; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinBucketItem.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinBucketItem.java similarity index 96% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinBucketItem.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinBucketItem.java index 031891e8..d001d774 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinBucketItem.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinBucketItem.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.item.interactions; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinEnderPearlItem.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinEnderPearlItem.java similarity index 96% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinEnderPearlItem.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinEnderPearlItem.java index 90c9ae54..e6992a99 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinEnderPearlItem.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinEnderPearlItem.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.item.interactions; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinEquippableComponent.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinEquippableComponent.java similarity index 97% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinEquippableComponent.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinEquippableComponent.java index 9b8bd318..1ba31133 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinEquippableComponent.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinEquippableComponent.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.item.interactions; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinFireChargeItem.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinFireChargeItem.java similarity index 95% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinFireChargeItem.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinFireChargeItem.java index 0c35b8fe..49262ffa 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinFireChargeItem.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinFireChargeItem.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.item.interactions; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinKnowledgeBookItem.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinKnowledgeBookItem.java similarity index 96% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinKnowledgeBookItem.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinKnowledgeBookItem.java index b94c3eda..ffa933ab 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinKnowledgeBookItem.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinKnowledgeBookItem.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.item.interactions; import com.llamalad7.mixinextras.sugar.Local; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinShovelItem.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinShovelItem.java similarity index 96% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinShovelItem.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinShovelItem.java index e4b1c598..5c2e9ccc 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinShovelItem.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinShovelItem.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.item.interactions; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinSwordItem.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinSwordItem.java similarity index 96% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinSwordItem.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinSwordItem.java index 62894171..27767589 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinSwordItem.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/interactions/MixinSwordItem.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.item.interactions; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinBundleItem.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/swinging/MixinBundleItem.java similarity index 95% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinBundleItem.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/swinging/MixinBundleItem.java index e937fc9e..8770e47d 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinBundleItem.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/swinging/MixinBundleItem.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.item.swinging; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinFishingRodItem.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/swinging/MixinFishingRodItem.java similarity index 96% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinFishingRodItem.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/swinging/MixinFishingRodItem.java index f8dc0bd3..1077ee1d 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinFishingRodItem.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/swinging/MixinFishingRodItem.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.item.swinging; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinLeadItem.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/swinging/MixinLeadItem.java similarity index 96% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinLeadItem.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/swinging/MixinLeadItem.java index 839a7256..12ab64b8 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinLeadItem.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/swinging/MixinLeadItem.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.item.swinging; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinItemStack.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/tooltip_changes/MixinItemStack.java similarity index 97% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinItemStack.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/tooltip_changes/MixinItemStack.java index 1a823dbd..fdf37640 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinItemStack.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/item/tooltip_changes/MixinItemStack.java @@ -19,10 +19,10 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.item.tooltip_changes; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import com.viaversion.viafabricplus.features.versioned.Enchantments1_14_4; +import com.viaversion.viafabricplus.features2.item.tooltip_changes.Enchantments1_14_4; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; import com.viaversion.viafabricplus.util.ItemUtil; import net.minecraft.component.ComponentType; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinAbstractCommandBlockScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/legacy_tab_completions/MixinAbstractCommandBlockScreen.java similarity index 95% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinAbstractCommandBlockScreen.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/legacy_tab_completions/MixinAbstractCommandBlockScreen.java index b69bcc59..0993113c 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinAbstractCommandBlockScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/legacy_tab_completions/MixinAbstractCommandBlockScreen.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.screen; +package com.viaversion.viafabricplus.injection.mixin.features.legacy_tab_completions; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinFireworkRocketItem.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/movement/elytra/MixinFireworkRocketItem.java similarity index 95% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinFireworkRocketItem.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/movement/elytra/MixinFireworkRocketItem.java index 880c4ba9..7363acbd 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinFireworkRocketItem.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/movement/elytra/MixinFireworkRocketItem.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.movement.elytra; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinEnderEyeItem.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/movement/item/MixinEnderEyeItem.java similarity index 95% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinEnderEyeItem.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/movement/item/MixinEnderEyeItem.java index b4154185..2d0bc813 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/item/MixinEnderEyeItem.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/movement/item/MixinEnderEyeItem.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item; +package com.viaversion.viafabricplus.injection.mixin.features.movement.item; import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinClientConfigurationNetworkHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/auto_read/MixinClientConfigurationNetworkHandler.java similarity index 84% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinClientConfigurationNetworkHandler.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/auto_read/MixinClientConfigurationNetworkHandler.java index 4179656a..a42b053f 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinClientConfigurationNetworkHandler.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/auto_read/MixinClientConfigurationNetworkHandler.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.network; +package com.viaversion.viafabricplus.injection.mixin.features.networking.auto_read; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; @@ -60,11 +60,4 @@ public abstract class MixinClientConfigurationNetworkHandler extends ClientCommo } } - @Inject(method = "onFeatures", at = @At(value = "HEAD")) - private void notifyAboutFeatures(FeaturesS2CPacket packet, CallbackInfo ci) { - if (ProtocolTranslator.getTargetVersion().olderThan(ProtocolVersion.v1_20) && packet.features().contains(Identifier.of("update_1_20"))) { - ChatUtil.sendPrefixedMessage(Text.translatable("translation.viafabricplus.updates_1_20").formatted(Formatting.RED)); - } - } - } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/auto_read/MixinClientPlayNetworkHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/auto_read/MixinClientPlayNetworkHandler.java new file mode 100644 index 00000000..b90b0970 --- /dev/null +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/auto_read/MixinClientPlayNetworkHandler.java @@ -0,0 +1,58 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus + * Copyright (C) 2021-2024 the original authors + * - FlorianMichael/EnZaXD + * - RK_01/RaphiMC + * Copyright (C) 2023-2024 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.viaversion.viafabricplus.injection.mixin.features.networking.auto_read; + +import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; +import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientCommonNetworkHandler; +import net.minecraft.client.network.ClientConnectionState; +import net.minecraft.client.network.ClientPlayNetworkHandler; +import net.minecraft.network.ClientConnection; +import net.minecraft.network.packet.s2c.play.EnterReconfigurationS2CPacket; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ClientPlayNetworkHandler.class) +public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkHandler { + + protected MixinClientPlayNetworkHandler(MinecraftClient client, ClientConnection connection, ClientConnectionState connectionState) { + super(client, connection, connectionState); + } + + @Inject(method = "onEnterReconfiguration", at = @At("HEAD")) + private void disableAutoRead(EnterReconfigurationS2CPacket packet, CallbackInfo ci) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) { + this.connection.channel.config().setAutoRead(false); + } + } + + @Inject(method = "onEnterReconfiguration", at = @At("RETURN")) + private void enableAutoRead(EnterReconfigurationS2CPacket packet, CallbackInfo ci) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) { + this.connection.channel.config().setAutoRead(true); + } + } + +} diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/pre_config_state/MixinNetworkStateTransitionHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/auto_read/MixinNetworkStateTransitionHandler.java similarity index 98% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/pre_config_state/MixinNetworkStateTransitionHandler.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/auto_read/MixinNetworkStateTransitionHandler.java index 66eadff1..487a528a 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/pre_config_state/MixinNetworkStateTransitionHandler.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/auto_read/MixinNetworkStateTransitionHandler.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.features.networking.pre_config_state; +package com.viaversion.viafabricplus.injection.mixin.features.networking.auto_read; import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/pre_config_state/MixinNetworkStateTransitions.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/auto_read/MixinNetworkStateTransitions.java similarity index 98% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/pre_config_state/MixinNetworkStateTransitions.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/auto_read/MixinNetworkStateTransitions.java index 98676266..4809f199 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/pre_config_state/MixinNetworkStateTransitions.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/auto_read/MixinNetworkStateTransitions.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.features.networking.pre_config_state; +package com.viaversion.viafabricplus.injection.mixin.features.networking.auto_read; import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/downloading_terrain_handling/MixinClientPlayNetworkHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/downloading_terrain_handling/MixinClientPlayNetworkHandler.java new file mode 100644 index 00000000..89b486fc --- /dev/null +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/downloading_terrain_handling/MixinClientPlayNetworkHandler.java @@ -0,0 +1,60 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus + * Copyright (C) 2021-2024 the original authors + * - FlorianMichael/EnZaXD + * - RK_01/RaphiMC + * Copyright (C) 2023-2024 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.viaversion.viafabricplus.injection.mixin.features.networking.downloading_terrain_handling; + +import com.viaversion.viafabricplus.injection.access.networking.downloading_terrain_handling.IDownloadingTerrainScreen; +import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; +import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientCommonNetworkHandler; +import net.minecraft.client.network.ClientConnectionState; +import net.minecraft.client.network.ClientPlayNetworkHandler; +import net.minecraft.network.ClientConnection; +import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket; +import net.minecraft.network.packet.s2c.play.PlayerSpawnPositionS2CPacket; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ClientPlayNetworkHandler.class) +public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkHandler { + + protected MixinClientPlayNetworkHandler(MinecraftClient client, ClientConnection connection, ClientConnectionState connectionState) { + super(client, connection, connectionState); + } + + @Inject(method = "onPlayerSpawnPosition", at = @At("RETURN")) + private void moveDownloadingTerrainClosing(PlayerSpawnPositionS2CPacket packet, CallbackInfo ci) { + if (ProtocolTranslator.getTargetVersion().betweenInclusive(ProtocolVersion.v1_18_2, ProtocolVersion.v1_20_2) && this.client.currentScreen instanceof IDownloadingTerrainScreen mixinDownloadingTerrainScreen) { + mixinDownloadingTerrainScreen.viaFabricPlus$setReady(); + } + } + + @Inject(method = "onPlayerPositionLook", at = @At("RETURN")) + private void closeDownloadingTerrain(PlayerPositionLookS2CPacket packet, CallbackInfo ci) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18) && this.client.currentScreen instanceof IDownloadingTerrainScreen mixinDownloadingTerrainScreen) { + mixinDownloadingTerrainScreen.viaFabricPlus$setReady(); + } + } + +} diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinDownloadingTerrainScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/downloading_terrain_handling/MixinDownloadingTerrainScreen.java similarity index 81% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinDownloadingTerrainScreen.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/downloading_terrain_handling/MixinDownloadingTerrainScreen.java index 0e37357e..5c6db52b 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinDownloadingTerrainScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/downloading_terrain_handling/MixinDownloadingTerrainScreen.java @@ -19,12 +19,11 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.screen; +package com.viaversion.viafabricplus.injection.mixin.features.networking.downloading_terrain_handling; -import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import com.viaversion.viafabricplus.injection.access.IDownloadingTerrainScreen; +import com.viaversion.viafabricplus.injection.access.networking.downloading_terrain_handling.IDownloadingTerrainScreen; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; -import com.viaversion.viafabricplus.settings.impl.VisualSettings; +import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import net.minecraft.client.gui.screen.DownloadingTerrainScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.network.packet.c2s.common.KeepAliveC2SPacket; @@ -36,7 +35,6 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; 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; @Mixin(DownloadingTerrainScreen.class) @@ -46,10 +44,6 @@ public abstract class MixinDownloadingTerrainScreen extends Screen implements ID @Final private long loadStartTime; - @Shadow - @Final - private DownloadingTerrainScreen.WorldEntryReason worldEntryReason; - @Unique private int viaFabricPlus$tickCounter; @@ -63,15 +57,6 @@ public abstract class MixinDownloadingTerrainScreen extends Screen implements ID super(title); } - @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()) { - return DownloadingTerrainScreen.WorldEntryReason.OTHER; - } else { - return this.worldEntryReason; - } - } - @Inject(method = "tick", at = @At("HEAD"), cancellable = true) private void modifyCloseCondition(CallbackInfo ci) { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) { diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/packet_handling_changes/MixinClientCommonNetworkHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/packet_handling_changes/MixinClientCommonNetworkHandler.java index 2e526f04..9aa6b86a 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/packet_handling_changes/MixinClientCommonNetworkHandler.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/packet_handling_changes/MixinClientCommonNetworkHandler.java @@ -23,10 +23,8 @@ 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.features.ClientsideFeatures; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; import com.viaversion.viafabricplus.settings.impl.DebugSettings; -import com.viaversion.viafabricplus.util.DataCustomPayload; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientCommonNetworkHandler; import net.minecraft.network.ClientConnection; @@ -35,7 +33,6 @@ import net.minecraft.network.listener.ServerPacketListener; import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.c2s.common.ResourcePackStatusC2SPacket; import net.minecraft.network.packet.s2c.common.CommonPingS2CPacket; -import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket; import net.minecraft.network.packet.s2c.common.ResourcePackSendS2CPacket; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Final; @@ -53,7 +50,7 @@ import java.time.Duration; import java.util.Optional; import java.util.function.BooleanSupplier; -@Mixin(value = ClientCommonNetworkHandler.class, priority = 1 /* Has to be applied before Fabric's Networking API, so it doesn't cancel our custom-payload packets */) +@Mixin(ClientCommonNetworkHandler.class) public abstract class MixinClientCommonNetworkHandler { @Shadow @@ -117,12 +114,4 @@ public abstract class MixinClientCommonNetworkHandler { } } - @Inject(method = "onCustomPayload(Lnet/minecraft/network/packet/s2c/common/CustomPayloadS2CPacket;)V", at = @At("HEAD"), cancellable = true) - private void handleSyncTask(CustomPayloadS2CPacket packet, CallbackInfo ci) { - if (packet.payload() instanceof DataCustomPayload dataCustomPayload) { - ClientsideFeatures.handleSyncTask(dataCustomPayload.buf()); - ci.cancel(); // Cancel the packet, so it doesn't get processed by the client - } - } - } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinClientLoginNetworkHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/packet_handling_changes/MixinClientLoginNetworkHandler.java similarity index 95% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinClientLoginNetworkHandler.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/packet_handling_changes/MixinClientLoginNetworkHandler.java index fc7dcb84..333aef10 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinClientLoginNetworkHandler.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/packet_handling_changes/MixinClientLoginNetworkHandler.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.network; +package com.viaversion.viafabricplus.injection.mixin.features.networking.packet_handling_changes; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/remove_signed_commands/MixinClientPlayNetworkHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/remove_signed_commands/MixinClientPlayNetworkHandler.java new file mode 100644 index 00000000..551649cc --- /dev/null +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/remove_signed_commands/MixinClientPlayNetworkHandler.java @@ -0,0 +1,72 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus + * Copyright (C) 2021-2024 the original authors + * - FlorianMichael/EnZaXD + * - RK_01/RaphiMC + * Copyright (C) 2023-2024 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.viaversion.viafabricplus.injection.mixin.features.networking.remove_signed_commands; + +import com.llamalad7.mixinextras.sugar.Local; +import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; +import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientCommonNetworkHandler; +import net.minecraft.client.network.ClientConnectionState; +import net.minecraft.client.network.ClientPlayNetworkHandler; +import net.minecraft.network.ClientConnection; +import net.minecraft.network.message.ArgumentSignatureDataMap; +import net.minecraft.network.message.LastSeenMessagesCollector; +import net.minecraft.network.packet.Packet; +import net.minecraft.network.packet.c2s.play.ChatCommandSignedC2SPacket; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import java.time.Instant; +import java.util.List; + +@Mixin(ClientPlayNetworkHandler.class) +public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkHandler { + + @Shadow + private LastSeenMessagesCollector lastSeenMessagesCollector; + + protected MixinClientPlayNetworkHandler(MinecraftClient client, ClientConnection connection, ClientConnectionState connectionState) { + super(client, connection, connectionState); + } + + @Redirect(method = "sendChatCommand", at = @At(value = "INVOKE", target = "Ljava/util/List;isEmpty()Z")) + private boolean alwaysSignCommands(List instance) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) { + return false; + } else { + return instance.isEmpty(); + } + } + + @Redirect(method = "sendCommand", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V")) + private void alwaysSignCommands(ClientPlayNetworkHandler instance, Packet packet, @Local(argsOnly = true) String command) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) { + this.sendPacket(new ChatCommandSignedC2SPacket(command, Instant.now(), 0L, ArgumentSignatureDataMap.EMPTY, this.lastSeenMessagesCollector.collect().update())); + } else { + instance.sendPacket(packet); + } + } + +} \ No newline at end of file diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/viaversion/MixinProtocol1_20_3To1_20_5.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/remove_signed_commands/MixinProtocol1_20_3To1_20_5.java similarity index 97% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/viaversion/MixinProtocol1_20_3To1_20_5.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/remove_signed_commands/MixinProtocol1_20_3To1_20_5.java index 4df36a05..391bc873 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/viaversion/MixinProtocol1_20_3To1_20_5.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/remove_signed_commands/MixinProtocol1_20_3To1_20_5.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.viaversion; +package com.viaversion.viafabricplus.injection.mixin.features.networking.remove_signed_commands; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.protocol.AbstractProtocol; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/resource_pack_header/MixinServerResourcePackLoader_4.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/resource_pack_header/MixinServerResourcePackLoader_4.java index 7dbe32d2..4baba5da 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/resource_pack_header/MixinServerResourcePackLoader_4.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/resource_pack_header/MixinServerResourcePackLoader_4.java @@ -22,7 +22,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.networking.resource_pack_header; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import com.viaversion.viafabricplus.features.data.ResourcePackHeaderDiff; +import com.viaversion.viafabricplus.features2.networking.resource_pack_header.ResourcePackHeaderDiff; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.GameVersion; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/warn_feature_updates/MixinClientConfigurationNetworkHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/warn_feature_updates/MixinClientConfigurationNetworkHandler.java new file mode 100644 index 00000000..cdb040f1 --- /dev/null +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/networking/warn_feature_updates/MixinClientConfigurationNetworkHandler.java @@ -0,0 +1,47 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus + * Copyright (C) 2021-2024 the original authors + * - FlorianMichael/EnZaXD + * - RK_01/RaphiMC + * Copyright (C) 2023-2024 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.viaversion.viafabricplus.injection.mixin.features.networking.warn_feature_updates; + +import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; +import com.viaversion.viafabricplus.util.ChatUtil; +import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; +import net.minecraft.client.network.ClientConfigurationNetworkHandler; +import net.minecraft.network.packet.s2c.config.FeaturesS2CPacket; +import net.minecraft.text.Text; +import net.minecraft.util.Formatting; +import net.minecraft.util.Identifier; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ClientConfigurationNetworkHandler.class) +public abstract class MixinClientConfigurationNetworkHandler { + + @Inject(method = "onFeatures", at = @At(value = "HEAD")) + private void notifyAboutFeatures(FeaturesS2CPacket packet, CallbackInfo ci) { + if (ProtocolTranslator.getTargetVersion().olderThan(ProtocolVersion.v1_20) && packet.features().contains(Identifier.of("update_1_20"))) { + ChatUtil.sendPrefixedMessage(Text.translatable("translation.viafabricplus.updates_1_20").formatted(Formatting.RED)); + } + } + +} \ No newline at end of file diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinUpdatePlayerAbilitiesC2SPacket.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/player_abilities/MixinUpdatePlayerAbilitiesC2SPacket.java similarity index 97% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinUpdatePlayerAbilitiesC2SPacket.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/player_abilities/MixinUpdatePlayerAbilitiesC2SPacket.java index ced16b99..1bee7d54 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinUpdatePlayerAbilitiesC2SPacket.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/player_abilities/MixinUpdatePlayerAbilitiesC2SPacket.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.network; +package com.viaversion.viafabricplus.injection.mixin.features.player_abilities; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/recipe_emulation/MixinCraftingScreenHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/recipe_emulation/MixinCraftingScreenHandler.java new file mode 100644 index 00000000..763723b7 --- /dev/null +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/recipe_emulation/MixinCraftingScreenHandler.java @@ -0,0 +1,50 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus + * Copyright (C) 2021-2024 the original authors + * - FlorianMichael/EnZaXD + * - RK_01/RaphiMC + * Copyright (C) 2023-2024 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.viaversion.viafabricplus.injection.mixin.features.recipe_emulation; + +import com.viaversion.viafabricplus.features2.recipe_emulation.Recipes1_11_2; +import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; +import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; +import net.minecraft.inventory.Inventory; +import net.minecraft.screen.AbstractCraftingScreenHandler; +import net.minecraft.screen.CraftingScreenHandler; +import net.minecraft.screen.ScreenHandlerType; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(CraftingScreenHandler.class) +public abstract class MixinCraftingScreenHandler extends AbstractCraftingScreenHandler { + + public MixinCraftingScreenHandler(ScreenHandlerType type, int syncId, int width, int height) { + super(type, syncId, width, height); + } + + @Inject(method = "onContentChanged", at = @At("HEAD")) + private void clientSideCrafting(Inventory inventory, CallbackInfo ci) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { + Recipes1_11_2.setCraftingResultSlot(syncId, this, this.craftingInventory); + } + } + +} \ No newline at end of file diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/recipe_emulation/MixinPlayerScreenHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/recipe_emulation/MixinPlayerScreenHandler.java new file mode 100644 index 00000000..13f49783 --- /dev/null +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/recipe_emulation/MixinPlayerScreenHandler.java @@ -0,0 +1,50 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus + * Copyright (C) 2021-2024 the original authors + * - FlorianMichael/EnZaXD + * - RK_01/RaphiMC + * Copyright (C) 2023-2024 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.viaversion.viafabricplus.injection.mixin.features.recipe_emulation; + +import com.viaversion.viafabricplus.features2.recipe_emulation.Recipes1_11_2; +import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; +import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; +import net.minecraft.inventory.Inventory; +import net.minecraft.screen.AbstractCraftingScreenHandler; +import net.minecraft.screen.PlayerScreenHandler; +import net.minecraft.screen.ScreenHandlerType; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(PlayerScreenHandler.class) +public abstract class MixinPlayerScreenHandler extends AbstractCraftingScreenHandler { + + public MixinPlayerScreenHandler(ScreenHandlerType type, int syncId, int width, int height) { + super(type, syncId, width, height); + } + + @Inject(method = "onContentChanged", at = @At("HEAD")) + private void clientSideCrafting(Inventory inventory, CallbackInfo ci) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { + Recipes1_11_2.setCraftingResultSlot(syncId, this, this.craftingInventory); + } + } + +} \ No newline at end of file diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/run_command_action_handling/MixinScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/run_command_action_handling/MixinScreen.java new file mode 100644 index 00000000..0eb55ab0 --- /dev/null +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/run_command_action_handling/MixinScreen.java @@ -0,0 +1,52 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus + * Copyright (C) 2021-2024 the original authors + * - FlorianMichael/EnZaXD + * - RK_01/RaphiMC + * Copyright (C) 2023-2024 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.viaversion.viafabricplus.injection.mixin.features.run_command_action_handling; + +import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; +import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.text.Style; +import net.minecraft.util.StringHelper; +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(Screen.class) +public abstract class MixinScreen { + + @Shadow + @Nullable + protected MinecraftClient client; + + @Inject(method = "handleTextClick", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;)V", shift = At.Shift.BEFORE, ordinal = 1, remap = false), cancellable = true) + private void allowRunCommandAction(Style style, CallbackInfoReturnable cir) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19)) { + this.client.player.networkHandler.sendChatMessage(StringHelper.stripInvalidChars(style.getClickEvent().getValue())); + cir.setReturnValue(true); + } + } + +} \ No newline at end of file diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/text_rendering/MixinFontStorage.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/text_rendering/non_existing_characters/MixinFontStorage.java similarity index 95% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/features/text_rendering/MixinFontStorage.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/text_rendering/non_existing_characters/MixinFontStorage.java index 41af0450..9a090ebe 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/text_rendering/MixinFontStorage.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/text_rendering/non_existing_characters/MixinFontStorage.java @@ -19,10 +19,10 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.features.text_rendering; +package com.viaversion.viafabricplus.injection.mixin.features.text_rendering.non_existing_characters; -import com.viaversion.viafabricplus.features.data.RenderableGlyphDiff; -import com.viaversion.viafabricplus.features.versioned.visual.BuiltinEmptyGlyph1_12_2; +import com.viaversion.viafabricplus.features2.text_rendering.non_existing_characters.RenderableGlyphDiff; +import com.viaversion.viafabricplus.features2.text_rendering.non_existing_characters.BuiltinEmptyGlyph1_12_2; import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.*; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/text_rendering/MixinLanguageManager.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/text_rendering/non_existing_characters/MixinLanguageManager.java similarity index 92% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/features/text_rendering/MixinLanguageManager.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/text_rendering/non_existing_characters/MixinLanguageManager.java index acea4d95..e6d26c78 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/text_rendering/MixinLanguageManager.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/text_rendering/non_existing_characters/MixinLanguageManager.java @@ -19,9 +19,9 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.features.text_rendering; +package com.viaversion.viafabricplus.injection.mixin.features.text_rendering.non_existing_characters; -import com.viaversion.viafabricplus.features.versioned.visual.UnicodeFontFix1_12_2; +import com.viaversion.viafabricplus.features2.text_rendering.non_existing_characters.UnicodeFontFix1_12_2; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.resource.language.LanguageManager; import net.minecraft.resource.ResourceManager; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinBookEditScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/book_edit_page_limitations/MixinBookEditScreen.java similarity index 95% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinBookEditScreen.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/book_edit_page_limitations/MixinBookEditScreen.java index a6e78683..5dbb2b47 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinBookEditScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/book_edit_page_limitations/MixinBookEditScreen.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.screen; +package com.viaversion.viafabricplus.injection.mixin.features.ui.book_edit_page_limitations; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/classic_creative_menu/MixinCreativeInventoryScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/classic_creative_menu/MixinCreativeInventoryScreen.java index 84170fb3..50228f85 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/classic_creative_menu/MixinCreativeInventoryScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/classic_creative_menu/MixinCreativeInventoryScreen.java @@ -21,7 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.ui.classic_creative_menu; -import com.viaversion.viafabricplus.features.versioned.classic.GridItemSelectionScreen; +import com.viaversion.viafabricplus.features2.ui.classic_creative_menu.GridItemSelectionScreen; import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/downloading_terrain_transitions/MixinDownloadingTerrainScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/downloading_terrain_transitions/MixinDownloadingTerrainScreen.java new file mode 100644 index 00000000..621fa3ca --- /dev/null +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/downloading_terrain_transitions/MixinDownloadingTerrainScreen.java @@ -0,0 +1,46 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus + * Copyright (C) 2021-2024 the original authors + * - FlorianMichael/EnZaXD + * - RK_01/RaphiMC + * Copyright (C) 2023-2024 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.viaversion.viafabricplus.injection.mixin.features.ui.downloading_terrain_transitions; + +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; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(DownloadingTerrainScreen.class) +public abstract class MixinDownloadingTerrainScreen { + + @Shadow @Final private DownloadingTerrainScreen.WorldEntryReason worldEntryReason; + + @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()) { + return DownloadingTerrainScreen.WorldEntryReason.OTHER; + } else { + return this.worldEntryReason; + } + } + +} diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinGameModeSelectionScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/filter_game_mode_selections/MixinGameModeSelectionScreen.java similarity index 97% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinGameModeSelectionScreen.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/filter_game_mode_selections/MixinGameModeSelectionScreen.java index 0c330c36..63adc0bd 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinGameModeSelectionScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/filter_game_mode_selections/MixinGameModeSelectionScreen.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.screen; +package com.viaversion.viafabricplus.injection.mixin.features.ui.filter_game_mode_selections; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinGameModeSelectionScreen_GameModeSelection.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/filter_game_mode_selections/MixinGameModeSelectionScreen_GameModeSelection.java similarity index 97% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinGameModeSelectionScreen_GameModeSelection.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/filter_game_mode_selections/MixinGameModeSelectionScreen_GameModeSelection.java index dc6cb5b4..62626460 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinGameModeSelectionScreen_GameModeSelection.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/filter_game_mode_selections/MixinGameModeSelectionScreen_GameModeSelection.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.screen; +package com.viaversion.viafabricplus.injection.mixin.features.ui.filter_game_mode_selections; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/beta_hud_elements/MixinInGameHud.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/hud_element_changes/MixinInGameHud.java similarity index 99% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/beta_hud_elements/MixinInGameHud.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/hud_element_changes/MixinInGameHud.java index 930ef29f..9f0f561b 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/beta_hud_elements/MixinInGameHud.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/hud_element_changes/MixinInGameHud.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.features.ui.beta_hud_elements; +package com.viaversion.viafabricplus.injection.mixin.features.ui.hud_element_changes; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinScreen.java index 69bfc2fd..a15bb3cd 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/remove_newer_screen_features/MixinScreen.java @@ -48,14 +48,6 @@ public abstract class MixinScreen { @Nullable protected MinecraftClient client; - @Inject(method = "handleTextClick", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;)V", shift = At.Shift.BEFORE, ordinal = 1, remap = false), cancellable = true) - private void allowRunCommandAction(Style style, CallbackInfoReturnable cir) { - if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19)) { - this.client.player.networkHandler.sendChatMessage(StringHelper.stripInvalidChars(style.getClickEvent().getValue())); - cir.setReturnValue(true); - } - } - @Inject(method = "addDrawableChild", at = @At("HEAD"), cancellable = true) private void removeRecipeBook(T drawableElement, CallbackInfoReturnable cir) { if (drawableElement instanceof TexturedButtonWidget button && button.textures == RecipeBookWidget.BUTTON_TEXTURES) { diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinAbstractSignEditScreen.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/sign_editor_reach/MixinAbstractSignEditScreen.java similarity index 96% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinAbstractSignEditScreen.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/sign_editor_reach/MixinAbstractSignEditScreen.java index 5e8e6415..f85dc11e 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/MixinAbstractSignEditScreen.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/sign_editor_reach/MixinAbstractSignEditScreen.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft.screen; +package com.viaversion.viafabricplus.injection.mixin.features.ui.sign_editor_reach; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinClientPlayNetworkHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinClientPlayNetworkHandler.java new file mode 100644 index 00000000..a4c50c73 --- /dev/null +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinClientPlayNetworkHandler.java @@ -0,0 +1,43 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus + * Copyright (C) 2021-2024 the original authors + * - FlorianMichael/EnZaXD + * - RK_01/RaphiMC + * Copyright (C) 2023-2024 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.viaversion.viafabricplus.injection.mixin.features.ui.v1_7_tab_list_style; + +import com.viaversion.viafabricplus.features2.ui.v1_7_tab_list_style.LegacyTabList; +import com.viaversion.viafabricplus.injection.access.v1_7_tab_list_style.IPlayerListHud; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayNetworkHandler; +import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ClientPlayNetworkHandler.class) +public abstract class MixinClientPlayNetworkHandler { + + @Inject(method = "onGameJoin", at = @At("RETURN")) + private void initPlayerListFix(GameJoinS2CPacket packet, CallbackInfo ci) { + LegacyTabList.globalTablistIndex = 0; + ((IPlayerListHud) MinecraftClient.getInstance().inGameHud.getPlayerListHud()).viaFabricPlus$setMaxPlayers(packet.maxPlayers()); + } + +} diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinPlayerListEntry.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinPlayerListEntry.java index c375b7bd..591d1f3d 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinPlayerListEntry.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinPlayerListEntry.java @@ -21,8 +21,8 @@ package com.viaversion.viafabricplus.injection.mixin.features.ui.v1_7_tab_list_style; -import com.viaversion.viafabricplus.features.ClientsideFeatures; -import com.viaversion.viafabricplus.injection.access.IPlayerListEntry; +import com.viaversion.viafabricplus.features2.ui.v1_7_tab_list_style.LegacyTabList; +import com.viaversion.viafabricplus.injection.access.v1_7_tab_list_style.IPlayerListEntry; import net.minecraft.client.network.PlayerListEntry; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; @@ -31,7 +31,7 @@ import org.spongepowered.asm.mixin.Unique; public abstract class MixinPlayerListEntry implements IPlayerListEntry { @Unique - private final int viaFabricPlus$index = ClientsideFeatures.globalTablistIndex++; + private final int viaFabricPlus$index = LegacyTabList.globalTablistIndex++; @Override public int viaFabricPlus$getIndex() { diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinPlayerListHud.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinPlayerListHud.java index 15d37601..55498c5c 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinPlayerListHud.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/ui/v1_7_tab_list_style/MixinPlayerListHud.java @@ -22,8 +22,8 @@ package com.viaversion.viafabricplus.injection.mixin.features.ui.v1_7_tab_list_style; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import com.viaversion.viafabricplus.injection.access.IPlayerListEntry; -import com.viaversion.viafabricplus.injection.access.IPlayerListHud; +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.settings.impl.VisualSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.hud.PlayerListHud; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/always_tick_entities/MixinClientWorld.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/always_tick_entities/MixinClientWorld.java index b080809b..c415c001 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/always_tick_entities/MixinClientWorld.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/always_tick_entities/MixinClientWorld.java @@ -21,10 +21,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.world.always_tick_entities; -import com.viaversion.viafabricplus.features.versioned.PendingUpdateManager1_18_2; import com.viaversion.viafabricplus.injection.access.IEntity; -import com.viaversion.viafabricplus.settings.impl.DebugSettings; -import net.minecraft.client.network.PendingUpdateManager; import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; @@ -39,9 +36,6 @@ import net.minecraft.world.MutableWorldProperties; import net.minecraft.world.World; import net.minecraft.world.dimension.DimensionType; import org.spongepowered.asm.mixin.*; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(value = ClientWorld.class, priority = 900) public abstract class MixinClientWorld extends World { @@ -50,22 +44,10 @@ public abstract class MixinClientWorld extends World { @Final EntityList entityList; - @Mutable - @Shadow - @Final - private PendingUpdateManager pendingUpdateManager; - protected MixinClientWorld(MutableWorldProperties properties, RegistryKey registryRef, DynamicRegistryManager registryManager, RegistryEntry dimensionEntry, boolean isClient, boolean debugWorld, long seed, int maxChainedNeighborUpdates) { super(properties, registryRef, registryManager, dimensionEntry, isClient, debugWorld, seed, maxChainedNeighborUpdates); } - @Inject(method = "", at = @At("RETURN")) - private void removePendingUpdateManager(CallbackInfo ci) { - if (DebugSettings.global().disableSequencing.isEnabled()) { - this.pendingUpdateManager = new PendingUpdateManager1_18_2(); - } - } - /** * @author RK_01 * @reason Versions <= 1.8.x and >= 1.17 always tick entities, even if they are not in a loaded chunk. diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/disable_sequencing/MixinClientWorld.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/disable_sequencing/MixinClientWorld.java new file mode 100644 index 00000000..13770f4c --- /dev/null +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/disable_sequencing/MixinClientWorld.java @@ -0,0 +1,50 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus + * Copyright (C) 2021-2024 the original authors + * - FlorianMichael/EnZaXD + * - RK_01/RaphiMC + * Copyright (C) 2023-2024 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.viaversion.viafabricplus.injection.mixin.features.world.disable_sequencing; + +import com.viaversion.viafabricplus.features2.world.disable_sequencing.PendingUpdateManager1_18_2; +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; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Mutable; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(value = ClientWorld.class, priority = 900) +public abstract class MixinClientWorld { + + @Mutable + @Shadow + @Final + private PendingUpdateManager pendingUpdateManager; + + @Inject(method = "", at = @At("RETURN")) + private void removePendingUpdateManager(CallbackInfo ci) { + if (DebugSettings.global().disableSequencing.isEnabled()) { + this.pendingUpdateManager = new PendingUpdateManager1_18_2(); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/MixinGameOptions.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/remove_server_view_distance/MixinGameOptions.java similarity index 94% rename from src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/MixinGameOptions.java rename to src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/remove_server_view_distance/MixinGameOptions.java index 5308b9a5..56cea617 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/MixinGameOptions.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/world/remove_server_view_distance/MixinGameOptions.java @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -package com.viaversion.viafabricplus.injection.mixin.old.minecraft; +package com.viaversion.viafabricplus.injection.mixin.features.world.remove_server_view_distance; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/MixinCamera.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/MixinCamera.java index 5e7d6e34..206c5d00 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/MixinCamera.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/MixinCamera.java @@ -39,7 +39,8 @@ public abstract class MixinCamera { @Shadow private float lastCameraY; - @Shadow private Entity focusedEntity; + @Shadow + private Entity focusedEntity; @Inject(method = "updateEyeHeight", at = @At(value = "HEAD"), cancellable = true) private void sneakInstantly(CallbackInfo ci) { diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinClientPlayNetworkHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinClientPlayNetworkHandler.java index 0b7780cc..52e97914 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinClientPlayNetworkHandler.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/network/MixinClientPlayNetworkHandler.java @@ -24,9 +24,7 @@ package com.viaversion.viafabricplus.injection.mixin.old.minecraft.network; 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.features.ClientsideFeatures; -import com.viaversion.viafabricplus.injection.access.IDownloadingTerrainScreen; -import com.viaversion.viafabricplus.injection.access.IPlayerListHud; +import com.viaversion.viafabricplus.injection.access.networking.downloading_terrain_handling.IDownloadingTerrainScreen; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; import com.viaversion.viafabricplus.settings.impl.VisualSettings; import net.minecraft.block.entity.SignBlockEntity; @@ -84,9 +82,6 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH @Shadow protected abstract boolean isSecureChatEnforced(); - @Shadow - private LastSeenMessagesCollector lastSeenMessagesCollector; - @Shadow private ClientWorld world; @@ -182,38 +177,6 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH } } - @Inject(method = "onEnterReconfiguration", at = @At("HEAD")) - private void disableAutoRead(EnterReconfigurationS2CPacket packet, CallbackInfo ci) { - if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) { - this.connection.channel.config().setAutoRead(false); - } - } - - @Inject(method = "onEnterReconfiguration", at = @At("RETURN")) - private void enableAutoRead(EnterReconfigurationS2CPacket packet, CallbackInfo ci) { - if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) { - this.connection.channel.config().setAutoRead(true); - } - } - - @Redirect(method = "sendChatCommand", at = @At(value = "INVOKE", target = "Ljava/util/List;isEmpty()Z")) - private boolean alwaysSignCommands(List instance) { - if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) { - return false; - } else { - return instance.isEmpty(); - } - } - - @Redirect(method = "sendCommand", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V")) - private void alwaysSignCommands(ClientPlayNetworkHandler instance, Packet packet, @Local(argsOnly = true) String command) { - if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) { - this.sendPacket(new ChatCommandSignedC2SPacket(command, Instant.now(), 0L, ArgumentSignatureDataMap.EMPTY, this.lastSeenMessagesCollector.collect().update())); - } else { - instance.sendPacket(packet); - } - } - @WrapWithCondition(method = "onPlayerRespawn", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;startWorldLoading(Lnet/minecraft/client/network/ClientPlayerEntity;Lnet/minecraft/client/world/ClientWorld;Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen$WorldEntryReason;)V")) private boolean checkDimensionChange(ClientPlayNetworkHandler instance, ClientPlayerEntity player, ClientWorld world, DownloadingTerrainScreen.WorldEntryReason worldEntryReason, @Local(ordinal = 0) RegistryKey registryKey) { return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_20_3) || registryKey != this.client.player.getWorld().getRegistryKey(); @@ -262,20 +225,6 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH return isSecureChatEnforced() || VisualSettings.global().disableSecureChatWarning.isEnabled(); } - @Inject(method = "onPlayerSpawnPosition", at = @At("RETURN")) - private void moveDownloadingTerrainClosing(PlayerSpawnPositionS2CPacket packet, CallbackInfo ci) { - if (ProtocolTranslator.getTargetVersion().betweenInclusive(ProtocolVersion.v1_18_2, ProtocolVersion.v1_20_2) && this.client.currentScreen instanceof IDownloadingTerrainScreen mixinDownloadingTerrainScreen) { - mixinDownloadingTerrainScreen.viaFabricPlus$setReady(); - } - } - - @Inject(method = "onPlayerPositionLook", at = @At("RETURN")) - private void closeDownloadingTerrain(PlayerPositionLookS2CPacket packet, CallbackInfo ci) { - if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18) && this.client.currentScreen instanceof IDownloadingTerrainScreen mixinDownloadingTerrainScreen) { - mixinDownloadingTerrainScreen.viaFabricPlus$setReady(); - } - } - @SuppressWarnings({"InvalidInjectorMethodSignature"}) @ModifyConstant(method = "onEntityPassengersSet", constant = @Constant(classValue = AbstractBoatEntity.class)) private Class dontChangeYawWhenMountingBoats(Object entity, Class boatClass) { @@ -302,10 +251,4 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH } } - @Inject(method = "onGameJoin", at = @At("RETURN")) - private void initPlayerListFix(GameJoinS2CPacket packet, CallbackInfo ci) { - ClientsideFeatures.globalTablistIndex = 0; - ((IPlayerListHud) MinecraftClient.getInstance().inGameHud.getPlayerListHud()).viaFabricPlus$setMaxPlayers(packet.maxPlayers()); - } - } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/screenhandler/MixinCraftingScreenHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/screenhandler/MixinCraftingScreenHandler.java index de855bee..12911955 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/screenhandler/MixinCraftingScreenHandler.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/screenhandler/MixinCraftingScreenHandler.java @@ -22,7 +22,7 @@ package com.viaversion.viafabricplus.injection.mixin.old.minecraft.screen.screenhandler; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import com.viaversion.viafabricplus.features.data.recipe.Recipes1_11_2; +import com.viaversion.viafabricplus.features2.recipe_emulation.Recipes1_11_2; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.inventory.Inventory; import net.minecraft.item.ItemStack; @@ -42,17 +42,9 @@ public abstract class MixinCraftingScreenHandler extends AbstractCraftingScreenH super(type, syncId, width, height); } - @Redirect(method = "quickMove", at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/CraftingScreenHandler;insertItem(Lnet/minecraft/item/ItemStack;IIZ)Z", ordinal = 1)) private boolean noShiftClickMoveIntoCraftingTable(CraftingScreenHandler instance, ItemStack itemStack, int startIndex, int endIndex, boolean fromLast) { return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_14_4) && this.insertItem(itemStack, startIndex, endIndex, fromLast); } - @Inject(method = "onContentChanged", at = @At("HEAD")) - private void clientSideCrafting(Inventory inventory, CallbackInfo ci) { - if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { - Recipes1_11_2.setCraftingResultSlot(syncId, this, this.craftingInventory); - } - } - } diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/screenhandler/MixinPlayerScreenHandler.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/screenhandler/MixinPlayerScreenHandler.java index 812f569a..49de00a3 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/screenhandler/MixinPlayerScreenHandler.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/minecraft/screen/screenhandler/MixinPlayerScreenHandler.java @@ -22,7 +22,7 @@ package com.viaversion.viafabricplus.injection.mixin.old.minecraft.screen.screenhandler; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import com.viaversion.viafabricplus.features.data.recipe.Recipes1_11_2; +import com.viaversion.viafabricplus.features2.recipe_emulation.Recipes1_11_2; import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.inventory.Inventory; import net.minecraft.screen.AbstractCraftingScreenHandler; @@ -43,13 +43,6 @@ public abstract class MixinPlayerScreenHandler extends AbstractCraftingScreenHan super(type, syncId, width, height); } - @Inject(method = "onContentChanged", at = @At("HEAD")) - private void clientSideCrafting(Inventory inventory, CallbackInfo ci) { - if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { - Recipes1_11_2.setCraftingResultSlot(syncId, this, this.craftingInventory); - } - } - @Redirect(method = "", slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/screen/PlayerScreenHandler$1;(Lnet/minecraft/screen/PlayerScreenHandler;Lnet/minecraft/inventory/Inventory;IIILnet/minecraft/entity/player/PlayerEntity;)V")), at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/PlayerScreenHandler;addSlot(Lnet/minecraft/screen/slot/Slot;)Lnet/minecraft/screen/slot/Slot;", ordinal = 0)) diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/viaversion/MixinItemPacketRewriter1_14.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/viaversion/MixinItemPacketRewriter1_14.java index 7ebd21c0..98d0ad1f 100644 --- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/viaversion/MixinItemPacketRewriter1_14.java +++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/old/viaversion/MixinItemPacketRewriter1_14.java @@ -22,6 +22,7 @@ package com.viaversion.viafabricplus.injection.mixin.old.viaversion; import com.llamalad7.mixinextras.sugar.Local; +import com.viaversion.viafabricplus.base.SyncTasks; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.type.Type; @@ -34,7 +35,6 @@ import com.viaversion.viaversion.protocols.v1_13_2to1_14.packet.ClientboundPacke import com.viaversion.viaversion.protocols.v1_13_2to1_14.packet.ServerboundPackets1_14; import com.viaversion.viaversion.protocols.v1_13_2to1_14.rewriter.ItemPacketRewriter1_14; import com.viaversion.viaversion.rewriter.ItemRewriter; -import com.viaversion.viafabricplus.features.ClientsideFeatures; import com.viaversion.viafabricplus.protocoltranslator.translator.TextComponentTranslator; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ingame.GenericContainerScreen; @@ -65,7 +65,7 @@ public abstract class MixinItemPacketRewriter1_14 extends ItemRewriter 54 || slots <= 0)) { ci.cancel(); - final String uuid = ClientsideFeatures.executeSyncTask(data -> { + final String uuid = SyncTasks.executeSyncTask(data -> { final MinecraftClient mc = MinecraftClient.getInstance(); try { @@ -83,7 +83,7 @@ public abstract class MixinItemPacketRewriter1_14 extends ItemRewriter { wrapper.resetReader(); - final String uuid = ClientsideFeatures.executeSyncTask(data -> { + final String uuid = SyncTasks.executeSyncTask(data -> { try { final BlockPos pos = data.readBlockPos(); final BlockState blockState = BlockStateTranslator.via1_18_2toMc(data.readVarInt()); @@ -59,7 +59,7 @@ public abstract class MixinWorldPacketRewriter1_19 { throw new RuntimeException("Failed to handle BlockBreakAck packet data", t); } }); - wrapper.write(Types.STRING, ClientsideFeatures.PACKET_SYNC_IDENTIFIER); + wrapper.write(Types.STRING, SyncTasks.PACKET_SYNC_IDENTIFIER); wrapper.write(Types.STRING, uuid); }); } diff --git a/src/main/java/com/viaversion/viafabricplus/settings/impl/BedrockSettings.java b/src/main/java/com/viaversion/viafabricplus/settings/impl/BedrockSettings.java index 3fc9fcb0..dac1e8b3 100644 --- a/src/main/java/com/viaversion/viafabricplus/settings/impl/BedrockSettings.java +++ b/src/main/java/com/viaversion/viafabricplus/settings/impl/BedrockSettings.java @@ -28,6 +28,7 @@ import com.viaversion.viafabricplus.screen.VFPScreen; import com.viaversion.viafabricplus.settings.base.BooleanSetting; import com.viaversion.viafabricplus.settings.base.ButtonSetting; import com.viaversion.viafabricplus.settings.base.SettingGroup; +import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; @@ -42,8 +43,11 @@ import net.raphimc.minecraftauth.step.msa.StepMsaDeviceCodeMsaCode; import net.raphimc.minecraftauth.util.MicrosoftConstants; import net.raphimc.minecraftauth.util.logging.ConsoleLogger; import net.raphimc.minecraftauth.util.logging.ILogger; +import net.raphimc.viabedrock.api.BedrockProtocolVersion; +import net.raphimc.viabedrock.protocol.data.ProtocolConstants; import java.util.Locale; +import java.util.Objects; public class BedrockSettings extends SettingGroup { @@ -123,6 +127,23 @@ public class BedrockSettings extends SettingGroup { } } + /** + * Replaces the default port when parsing a server address if the default port should be replaced + * + * @param address The original address of the server + * @param version The protocol version + * @return The server address with the replaced default port + */ + public static String replaceDefaultPort(final String address, final ProtocolVersion version) { + // If the default port for this entry should be replaced, check if the address already contains a port + // We can't just replace vanilla's default port because a bedrock server might be running on the same port + if (BedrockSettings.global().replaceDefaultPort.getValue() && Objects.equals(version, BedrockProtocolVersion.bedrockLatest) && !address.contains(":")) { + return address + ":" + ProtocolConstants.BEDROCK_DEFAULT_PORT; + } else { + return address; + } + } + public static BedrockSettings global() { return INSTANCE; } diff --git a/src/main/resources/viafabricplus.mixins.json b/src/main/resources/viafabricplus.mixins.json index 3ed1c498..9e3fe8c3 100644 --- a/src/main/resources/viafabricplus.mixins.json +++ b/src/main/resources/viafabricplus.mixins.json @@ -17,12 +17,13 @@ "base.connection.MixinMinecraftClient", "base.connection.MixinMultiplayerServerListPinger", "base.integration.MixinClientConnection", - "base.integration.MixinConnectScreen_1", "base.integration.MixinDebugHud", "base.integration.MixinMinecraftClient", "base.integration.MixinMultiplayerServerListPinger", "base.integration.MixinMultiplayerServerListPinger_1", "base.integration.MixinServerInfo", + "base.integration.bedrock.MixinConnectScreen_1", + "base.integration.sync_tasks.MixinClientCommonNetworkHandler", "base.ui.MixinAddServerScreen", "base.ui.MixinConfirmScreen", "base.ui.MixinConnectScreen_1", @@ -72,6 +73,9 @@ "features.block.interactions.MixinNoteBlock", "features.block.mining_calculations.MixinAbstractBlock", "features.block.mining_calculations.MixinAbstractBlock_AbstractBlockState", + "features.classic_world_height.MixinBuiltChunk", + "features.classic_world_height.MixinEntityPacketRewriter1_17", + "features.classic_world_height.MixinWorldPacketRewriter1_17", "features.cpe_extensions.MixinClassicProtocolExtension", "features.cpe_extensions.MixinClientboundPacketsc0_30cpe", "features.cpe_extensions.MixinProtocolc0_30cpeToc0_28_30", @@ -85,12 +89,23 @@ "features.footstep_particle.MixinRegistrySyncManager", "features.item.filter_creative_tabs.MixinItemGroup_EntriesImpl", "features.item.filter_creative_tabs.MixinItemGroups", + "features.item.interactions.MixinAxeItem", + "features.item.interactions.MixinBlockItem", + "features.item.interactions.MixinBowItem", + "features.item.interactions.MixinBrushItem", + "features.item.interactions.MixinBucketItem", + "features.item.interactions.MixinEnderPearlItem", + "features.item.interactions.MixinEquippableComponent", + "features.item.interactions.MixinFireChargeItem", "features.item.negative_items.MixinDrawContext", + "features.item.swinging.MixinBundleItem", + "features.item.swinging.MixinFishingRodItem", "features.legacy_chat_signatures.MixinConnectScreen_1", "features.legacy_chat_signatures.MixinKeyPairResponse", "features.legacy_chat_signatures.MixinPlayerPublicKey_PublicKeyData", "features.legacy_chat_signatures.MixinProfileKeysImpl", "features.legacy_chat_signatures.MixinYggdrasilUserApiService", + "features.legacy_tab_completions.MixinAbstractCommandBlockScreen", "features.legacy_tab_completions.MixinChatInputSuggestor", "features.legacy_tab_completions.MixinChatScreen", "features.max_chat_length.MixinChatMessageC2SPacket", @@ -103,39 +118,57 @@ "features.movement.block.MixinFlowableFluid", "features.movement.block.MixinHoneyBlock", "features.movement.block.MixinSoulSandBlock", + "features.movement.elytra.MixinFireworkRocketItem", + "features.movement.item.MixinEnderEyeItem", "features.movement.levitation_value.MixinStatusEffectInstance", + "features.networking.auto_read.MixinClientConfigurationNetworkHandler", + "features.networking.auto_read.MixinClientPlayNetworkHandler", + "features.networking.auto_read.MixinNetworkStateTransitionHandler", + "features.networking.auto_read.MixinNetworkStateTransitions", + "features.networking.downloading_terrain_handling.MixinClientPlayNetworkHandler", + "features.networking.downloading_terrain_handling.MixinDownloadingTerrainScreen", "features.networking.packet_handling_changes.MixinClientCommonNetworkHandler", - "features.networking.pre_config_state.MixinNetworkStateTransitionHandler", - "features.networking.pre_config_state.MixinNetworkStateTransitions", + "features.networking.packet_handling_changes.MixinClientLoginNetworkHandler", "features.networking.registry_validations.MixinRegistryEntryList_Named", "features.networking.registry_validations.MixinRegistryEntryListCodec", "features.networking.remove_legacy_pinger.MixinMultiplayerServerListPinger", + "features.networking.remove_signed_commands.MixinClientPlayNetworkHandler", + "features.networking.remove_signed_commands.MixinProtocol1_20_3To1_20_5", "features.networking.resource_pack_header.MixinServerResourcePackLoader_4", "features.networking.srv_resolving.MixinAllowedAddressResolver", "features.networking.srv_resolving.MixinConnectScreen_1", "features.networking.srv_resolving.MixinRedirectResolver", "features.networking.srv_resolving.MixinServerAddress", - "features.text_rendering.MixinFontStorage", - "features.text_rendering.MixinLanguageManager", + "features.networking.warn_feature_updates.MixinClientConfigurationNetworkHandler", + "features.player_abilities.MixinUpdatePlayerAbilitiesC2SPacket", + "features.run_command_action_handling.MixinScreen", "features.text_rendering.MixinTextRenderer_Drawer", - "features.ui.beta_hud_elements.MixinInGameHud", + "features.text_rendering.non_existing_characters.MixinFontStorage", + "features.text_rendering.non_existing_characters.MixinLanguageManager", + "features.ui.book_edit_page_limitations.MixinBookEditScreen", "features.ui.chat_indicator.MixinChatHud", "features.ui.chat_indicator.MixinChatScreen", "features.ui.classic_creative_menu.MixinCreativeInventoryScreen", + "features.ui.downloading_terrain_transitions.MixinDownloadingTerrainScreen", + "features.ui.filter_game_mode_selections.MixinGameModeSelectionScreen", + "features.ui.filter_game_mode_selections.MixinGameModeSelectionScreen_GameModeSelection", + "features.ui.hud_element_changes.MixinInGameHud", "features.ui.remove_newer_screen_features.MixinCommandBlockScreen", "features.ui.remove_newer_screen_features.MixinGameMenuScreen", "features.ui.remove_newer_screen_features.MixinJigsawBlockScreen", "features.ui.remove_newer_screen_features.MixinScreen", "features.ui.remove_newer_screen_features.MixinStructureBlockScreen_1", + "features.ui.sign_editor_reach.MixinAbstractSignEditScreen", + "features.ui.v1_7_tab_list_style.MixinClientPlayNetworkHandler", "features.ui.v1_7_tab_list_style.MixinPlayerListEntry", "features.ui.v1_7_tab_list_style.MixinPlayerListHud", "features.world.always_tick_entities.MixinClientWorld", + "features.world.disable_sequencing.MixinClientWorld", + "features.world.remove_server_view_distance.MixinGameOptions", "integration.viabedrock.MixinJoinPackets", "integration.vialegacy.MixinExtensionProtocolMetadataStorage", "integration.vialegacy.MixinViaLegacyConfig", - "old.minecraft.MixinBuiltChunk", "old.minecraft.MixinCamera", - "old.minecraft.MixinGameOptions", "old.minecraft.MixinMinecraftClient", "old.minecraft.MixinPlayerListEntry", "old.minecraft.MixinStaticSound", @@ -168,39 +201,18 @@ "old.minecraft.entity.MixinVillagerClothingFeatureRenderer", "old.minecraft.entity.MixinWolfEntity", "old.minecraft.entity.MixinZombieVillagerEntity", - "old.minecraft.item.MixinAxeItem", - "old.minecraft.item.MixinBlockItem", - "old.minecraft.item.MixinBowItem", - "old.minecraft.item.MixinBrushItem", - "old.minecraft.item.MixinBucketItem", - "old.minecraft.item.MixinBundleItem", - "old.minecraft.item.MixinEnderEyeItem", - "old.minecraft.item.MixinEnderPearlItem", - "old.minecraft.item.MixinEquippableComponent", - "old.minecraft.item.MixinFireChargeItem", - "old.minecraft.item.MixinFireworkRocketItem", - "old.minecraft.item.MixinFishingRodItem", "old.minecraft.item.MixinHeldItemRenderer", "old.minecraft.item.MixinItemCooldownManager", - "old.minecraft.item.MixinItemPlacementContext", + "features.interaction.MixinItemPlacementContext", "old.minecraft.item.MixinItemRenderer", - "old.minecraft.item.MixinItemStack", - "old.minecraft.item.MixinKnowledgeBookItem", - "old.minecraft.item.MixinLeadItem", - "old.minecraft.item.MixinShovelItem", - "old.minecraft.item.MixinSwordItem", - "old.minecraft.network.MixinClientConfigurationNetworkHandler", - "old.minecraft.network.MixinClientLoginNetworkHandler", - "old.minecraft.network.MixinClientPlayerInteractionManager", + "features.item.tooltip_changes.MixinItemStack", + "features.item.interactions.MixinKnowledgeBookItem", + "features.item.swinging.MixinLeadItem", + "features.item.interactions.MixinShovelItem", + "features.item.interactions.MixinSwordItem", + "features.interaction.MixinClientPlayerInteractionManager", "old.minecraft.network.MixinClientPlayNetworkHandler", "old.minecraft.network.MixinMultiplayerServerListWidget_ServerEntry", - "old.minecraft.network.MixinUpdatePlayerAbilitiesC2SPacket", - "old.minecraft.screen.MixinAbstractCommandBlockScreen", - "old.minecraft.screen.MixinAbstractSignEditScreen", - "old.minecraft.screen.MixinBookEditScreen", - "old.minecraft.screen.MixinDownloadingTerrainScreen", - "old.minecraft.screen.MixinGameModeSelectionScreen", - "old.minecraft.screen.MixinGameModeSelectionScreen_GameModeSelection", "old.minecraft.screen.screenhandler.MixinAbstractFurnaceScreenHandler", "old.minecraft.screen.screenhandler.MixinBrewingStandScreenHandler_FuelSlot", "old.minecraft.screen.screenhandler.MixinCraftingScreenHandler", @@ -214,7 +226,6 @@ "old.viaversion.MixinCommonBoss", "old.viaversion.MixinEntityPacketRewriter1_12", "old.viaversion.MixinEntityPacketRewriter1_15", - "old.viaversion.MixinEntityPacketRewriter1_17", "old.viaversion.MixinEntityPacketRewriter1_19_4", "old.viaversion.MixinEntityPacketRewriter1_20_3", "old.viaversion.MixinEntityPacketRewriter1_20_5", @@ -225,12 +236,10 @@ "old.viaversion.MixinItemPacketRewriter1_17", "old.viaversion.MixinItemPacketRewriter1_9", "old.viaversion.MixinNamedCompoundTagType", - "old.viaversion.MixinProtocol1_20_3To1_20_5", "old.viaversion.MixinProtocol1_20To1_20_2", "old.viaversion.MixinTagType", "old.viaversion.MixinUserConnectionImpl", "old.viaversion.MixinWorldPacketRewriter1_16_2", - "old.viaversion.MixinWorldPacketRewriter1_17", "old.viaversion.MixinWorldPacketRewriter1_19" ], "injectors": { @@ -238,5 +247,9 @@ }, "overwrites": { "requireAnnotations": true - } + }, + "mixins": [ + "features.recipe_emulation.MixinCraftingScreenHandler", + "features.recipe_emulation.MixinPlayerScreenHandler" + ] }