diff --git a/src/main/java/com/viaversion/viafabricplus/ViaFabricPlusImpl.java b/src/main/java/com/viaversion/viafabricplus/ViaFabricPlusImpl.java
index 002b8baf..ba0f40ff 100644
--- a/src/main/java/com/viaversion/viafabricplus/ViaFabricPlusImpl.java
+++ b/src/main/java/com/viaversion/viafabricplus/ViaFabricPlusImpl.java
@@ -27,6 +27,7 @@ import com.viaversion.viafabricplus.api.ViaFabricPlusBase;
import com.viaversion.viafabricplus.base.Events;
import com.viaversion.viafabricplus.base.save.SaveManager;
import com.viaversion.viafabricplus.base.settings.SettingsManager;
+import com.viaversion.viafabricplus.features.FeaturesLoading;
import com.viaversion.viafabricplus.features.max_chat_length.MaxChatLength;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viafabricplus.util.ClassLoaderPriorityUtil;
@@ -102,6 +103,9 @@ public final class ViaFabricPlusImpl implements ViaFabricPlusBase {
settingsManager = new SettingsManager();
saveManager = new SaveManager(settingsManager);
+ // Init features
+ FeaturesLoading.init();
+
// Init ViaVersion protocol translator platform
loadingFuture = ProtocolTranslator.init(path);
diff --git a/src/main/java/com/viaversion/viafabricplus/old/ClientsideFeatures.java b/src/main/java/com/viaversion/viafabricplus/features/FeaturesLoading.java
similarity index 56%
rename from src/main/java/com/viaversion/viafabricplus/old/ClientsideFeatures.java
rename to src/main/java/com/viaversion/viafabricplus/features/FeaturesLoading.java
index 605a0ed5..ace9463c 100644
--- a/src/main/java/com/viaversion/viafabricplus/old/ClientsideFeatures.java
+++ b/src/main/java/com/viaversion/viafabricplus/features/FeaturesLoading.java
@@ -19,99 +19,58 @@
* along with this program. If not, see .
*/
-package com.viaversion.viafabricplus.old;
+package com.viaversion.viafabricplus.features;
import com.viaversion.viafabricplus.api.LoadingCycleCallback;
import com.viaversion.viafabricplus.base.Events;
-import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import com.viaversion.viafabricplus.old.data.EntityDimensionDiff;
+import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
+import com.viaversion.viafabricplus.features.block.CollisionShapes;
+import com.viaversion.viafabricplus.features.cpe_extensions.CPEAdditions;
+import com.viaversion.viafabricplus.features.footstep_particle.FootStepParticle1_12_2;
import com.viaversion.viafabricplus.features.networking.resource_pack_header.ResourcePackHeaderDiff;
import com.viaversion.viafabricplus.features.recipe_emulation.Recipes1_11_2;
-import com.viaversion.viafabricplus.old.versioned.EnchantmentAttributesEmulation1_20_6;
-import com.viaversion.viafabricplus.features.cpe_extensions.CPEAdditions;
-import com.viaversion.viafabricplus.features.ui.classic_creative_menu.GridItemSelectionScreen;
-import com.viaversion.viafabricplus.features.ui.armor_hud.ArmorHudEmulation1_8;
-import com.viaversion.viafabricplus.features.footstep_particle.FootStepParticle1_12_2;
import com.viaversion.viafabricplus.features.text_rendering.non_existing_characters.UnicodeFontFix1_12_2;
-import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
+import com.viaversion.viafabricplus.features.ui.armor_hud.ArmorHudEmulation1_8;
+import com.viaversion.viafabricplus.features.ui.classic_creative_menu.GridItemSelectionScreen;
+import com.viaversion.viafabricplus.old.data.EntityDimensionDiff;
+import com.viaversion.viafabricplus.old.versioned.EnchantmentAttributesEmulation1_20_6;
import com.viaversion.viafabricplus.util.DataCustomPayload;
-import net.minecraft.block.*;
+import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.minecraft.client.MinecraftClient;
-import net.minecraft.registry.Registries;
import net.raphimc.viaaprilfools.api.AprilFoolsProtocolVersion;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
-/**
- * This class contains random fields and methods that are used to fix bugs on the client side
- */
-public class ClientsideFeatures {
+public class FeaturesLoading {
static {
- // Register additional CPE features
- CPEAdditions.modifyMappings();
-
- // Check if the pack format mappings are correct
- ResourcePackHeaderDiff.checkOutdated();
-
+ ResourcePackHeaderDiff.init();
+ CPEAdditions.init();
+ DataCustomPayload.init();
UnicodeFontFix1_12_2.init();
+ FootStepParticle1_12_2.init();
Events.LOADING_CYCLE.register(cycle -> {
- if (cycle != LoadingCycleCallback.LoadingCycle.POST_GAME_LOAD) {
- return;
+ if (cycle == LoadingCycleCallback.LoadingCycle.POST_GAME_LOAD) {
+ EntityDimensionDiff.init();
+ EnchantmentAttributesEmulation1_20_6.init();
+ ArmorHudEmulation1_8.init();
}
-
- // Handle clientside enchantment calculations in <= 1.20.6
- EnchantmentAttributesEmulation1_20_6.init();
-
- // Handles and updates entity dimension changes in <= 1.17
- EntityDimensionDiff.init();
-
- // Ticks the armor hud manually in <= 1.8.x
- ArmorHudEmulation1_8.init();
});
- // Reloads some clientside stuff when the protocol version changes
Events.CHANGE_PROTOCOL_VERSION.register((oldVersion, newVersion) -> MinecraftClient.getInstance().execute(() -> {
VisualSettings.global().filterNonExistingGlyphs.onValueChanged();
+ CollisionShapes.reloadBlockShapes();
- // Reloads all bounding boxes of the blocks that we changed
- for (Block block : Registries.BLOCK) {
- if (block instanceof AnvilBlock || block instanceof BedBlock || block instanceof BrewingStandBlock
- || block instanceof CarpetBlock || block instanceof CauldronBlock || block instanceof ChestBlock
- || block instanceof EnderChestBlock || block instanceof EndPortalBlock || block instanceof EndPortalFrameBlock
- || block instanceof FarmlandBlock || block instanceof FenceBlock || block instanceof FenceGateBlock
- || block instanceof HopperBlock || block instanceof LadderBlock || block instanceof LeavesBlock
- || block instanceof LilyPadBlock || block instanceof PaneBlock || block instanceof PistonBlock
- || block instanceof PistonHeadBlock || block instanceof SnowBlock || block instanceof WallBlock
- || block instanceof CropBlock || block instanceof FlowerbedBlock
- ) {
- for (BlockState state : block.getStateManager().getStates()) {
- state.initShapeCache();
- }
- }
- }
-
- // Rebuilds the item selection screen grid
if (newVersion.olderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
GridItemSelectionScreen.INSTANCE.itemGrid = null;
}
-
- // Reloads the clientside recipes
if (newVersion.olderThanOrEqualTo(ProtocolVersion.v1_11_1)) {
Recipes1_11_2.reset();
}
-
- // Reload sound system when switching between 3D Shareware and normal versions
if (oldVersion.equals(AprilFoolsProtocolVersion.s3d_shareware) || newVersion.equals(AprilFoolsProtocolVersion.s3d_shareware)) {
MinecraftClient.getInstance().getSoundManager().reloadSounds();
}
}));
-
- // Register the footstep particle
- FootStepParticle1_12_2.init();
-
- // Register the custom payload packet for sync tasks
- DataCustomPayload.init();
}
public static void init() {
diff --git a/src/main/java/com/viaversion/viafabricplus/features/block/CollisionShapes.java b/src/main/java/com/viaversion/viafabricplus/features/block/CollisionShapes.java
new file mode 100644
index 00000000..0601ce17
--- /dev/null
+++ b/src/main/java/com/viaversion/viafabricplus/features/block/CollisionShapes.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.features.block;
+
+import net.minecraft.block.*;
+import net.minecraft.registry.Registries;
+
+public final class CollisionShapes {
+
+ public static void reloadBlockShapes() {
+ for (Block block : Registries.BLOCK) {
+ if (block instanceof AnvilBlock || block instanceof BedBlock || block instanceof BrewingStandBlock
+ || block instanceof CarpetBlock || block instanceof CauldronBlock || block instanceof ChestBlock
+ || block instanceof EnderChestBlock || block instanceof EndPortalBlock || block instanceof EndPortalFrameBlock
+ || block instanceof FarmlandBlock || block instanceof FenceBlock || block instanceof FenceGateBlock
+ || block instanceof HopperBlock || block instanceof LadderBlock || block instanceof LeavesBlock
+ || block instanceof LilyPadBlock || block instanceof PaneBlock || block instanceof PistonBlock
+ || block instanceof PistonHeadBlock || block instanceof SnowBlock || block instanceof WallBlock
+ || block instanceof CropBlock || block instanceof FlowerbedBlock
+ ) {
+ for (BlockState state : block.getStateManager().getStates()) {
+ state.initShapeCache();
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/com/viaversion/viafabricplus/features/cpe_extensions/CPEAdditions.java b/src/main/java/com/viaversion/viafabricplus/features/cpe_extensions/CPEAdditions.java
index 73721456..cc558bb6 100644
--- a/src/main/java/com/viaversion/viafabricplus/features/cpe_extensions/CPEAdditions.java
+++ b/src/main/java/com/viaversion/viafabricplus/features/cpe_extensions/CPEAdditions.java
@@ -28,7 +28,6 @@ import net.lenni0451.reflect.Enums;
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.packet.ClientboundPacketsc0_30cpe;
-import org.jetbrains.annotations.ApiStatus;
import java.util.ArrayList;
import java.util.HashMap;
@@ -45,7 +44,7 @@ public class CPEAdditions {
private static boolean snowing = false;
- public static void modifyMappings() {
+ public static void init() {
allowExtension(ClassicProtocolExtension.ENV_WEATHER_TYPE);
EXT_WEATHER_TYPE = createNewPacket(ClassicProtocolExtension.ENV_WEATHER_TYPE, 31, (user, buf) -> buf.readByte());
}
diff --git a/src/main/java/com/viaversion/viafabricplus/old/versioned/visual/BoatModel1_8.java b/src/main/java/com/viaversion/viafabricplus/features/entity/v1_8_boat/BoatModel1_8.java
similarity index 97%
rename from src/main/java/com/viaversion/viafabricplus/old/versioned/visual/BoatModel1_8.java
rename to src/main/java/com/viaversion/viafabricplus/features/entity/v1_8_boat/BoatModel1_8.java
index d11270aa..33ea5ef6 100644
--- a/src/main/java/com/viaversion/viafabricplus/old/versioned/visual/BoatModel1_8.java
+++ b/src/main/java/com/viaversion/viafabricplus/features/entity/v1_8_boat/BoatModel1_8.java
@@ -19,7 +19,7 @@
* along with this program. If not, see .
*/
-package com.viaversion.viafabricplus.old.versioned.visual;
+package com.viaversion.viafabricplus.features.entity.v1_8_boat;
import net.minecraft.client.model.*;
import net.minecraft.client.render.entity.model.EntityModel;
diff --git a/src/main/java/com/viaversion/viafabricplus/old/versioned/visual/BoatRenderer1_8.java b/src/main/java/com/viaversion/viafabricplus/features/entity/v1_8_boat/BoatRenderer1_8.java
similarity index 97%
rename from src/main/java/com/viaversion/viafabricplus/old/versioned/visual/BoatRenderer1_8.java
rename to src/main/java/com/viaversion/viafabricplus/features/entity/v1_8_boat/BoatRenderer1_8.java
index a27e03c4..46995e90 100644
--- a/src/main/java/com/viaversion/viafabricplus/old/versioned/visual/BoatRenderer1_8.java
+++ b/src/main/java/com/viaversion/viafabricplus/features/entity/v1_8_boat/BoatRenderer1_8.java
@@ -19,7 +19,7 @@
* along with this program. If not, see .
*/
-package com.viaversion.viafabricplus.old.versioned.visual;
+package com.viaversion.viafabricplus.features.entity.v1_8_boat;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.RenderLayer;
diff --git a/src/main/java/com/viaversion/viafabricplus/old/versioned/ActionResultException1_12_2.java b/src/main/java/com/viaversion/viafabricplus/features/interaction/ActionResultException1_12_2.java
similarity index 96%
rename from src/main/java/com/viaversion/viafabricplus/old/versioned/ActionResultException1_12_2.java
rename to src/main/java/com/viaversion/viafabricplus/features/interaction/ActionResultException1_12_2.java
index 8b83bc5f..4f52769a 100644
--- a/src/main/java/com/viaversion/viafabricplus/old/versioned/ActionResultException1_12_2.java
+++ b/src/main/java/com/viaversion/viafabricplus/features/interaction/ActionResultException1_12_2.java
@@ -19,7 +19,7 @@
* along with this program. If not, see .
*/
-package com.viaversion.viafabricplus.old.versioned;
+package com.viaversion.viafabricplus.features.interaction;
import net.minecraft.util.ActionResult;
diff --git a/src/main/java/com/viaversion/viafabricplus/features/networking/resource_pack_header/ResourcePackHeaderDiff.java b/src/main/java/com/viaversion/viafabricplus/features/networking/resource_pack_header/ResourcePackHeaderDiff.java
index c6f06a92..60798167 100644
--- a/src/main/java/com/viaversion/viafabricplus/features/networking/resource_pack_header/ResourcePackHeaderDiff.java
+++ b/src/main/java/com/viaversion/viafabricplus/features/networking/resource_pack_header/ResourcePackHeaderDiff.java
@@ -27,7 +27,6 @@ import net.minecraft.GameVersion;
import net.minecraft.SaveVersion;
import net.minecraft.SharedConstants;
import net.minecraft.resource.ResourceType;
-import org.jetbrains.annotations.ApiStatus;
import java.util.Date;
import java.util.HashMap;
@@ -87,10 +86,11 @@ public class ResourcePackHeaderDiff {
registerVersion(ProtocolVersion.v1_7_2, 1, "1.7.5");
}
- public static void checkOutdated() {
+ public static void init() {
if (!GAME_VERSION_DIFF.containsKey(ProtocolTranslator.NATIVE_VERSION)) {
throw new RuntimeException("The native client version is not registered in the resource pack header diff!");
}
+ // Also calls the static block
}
/**
diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/entity/v1_8_boat/MixinEntityModels.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/entity/v1_8_boat/MixinEntityModels.java
index d72055f1..084ca748 100644
--- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/entity/v1_8_boat/MixinEntityModels.java
+++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/entity/v1_8_boat/MixinEntityModels.java
@@ -22,7 +22,7 @@
package com.viaversion.viafabricplus.injection.mixin.features.entity.v1_8_boat;
import com.google.common.collect.ImmutableMap;
-import com.viaversion.viafabricplus.old.versioned.visual.BoatModel1_8;
+import com.viaversion.viafabricplus.features.entity.v1_8_boat.BoatModel1_8;
import net.minecraft.client.model.TexturedModelData;
import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.client.render.entity.model.EntityModels;
diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/entity/v1_8_boat/MixinEntityRenderDispatcher.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/entity/v1_8_boat/MixinEntityRenderDispatcher.java
index 3a393ed8..6fe6a03a 100644
--- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/entity/v1_8_boat/MixinEntityRenderDispatcher.java
+++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/entity/v1_8_boat/MixinEntityRenderDispatcher.java
@@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.entity.v1_8_boat;
import com.llamalad7.mixinextras.sugar.Local;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import com.viaversion.viafabricplus.old.versioned.visual.BoatRenderer1_8;
+import com.viaversion.viafabricplus.features.entity.v1_8_boat.BoatRenderer1_8;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.EntityRenderer;
diff --git a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/interaction/MixinClientPlayerInteractionManager.java b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/interaction/MixinClientPlayerInteractionManager.java
index dd9d3bf8..4079635c 100644
--- a/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/interaction/MixinClientPlayerInteractionManager.java
+++ b/src/main/java/com/viaversion/viafabricplus/injection/mixin/features/interaction/MixinClientPlayerInteractionManager.java
@@ -28,7 +28,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.protocols.v1_16_1to1_16_2.packet.ServerboundPackets1_16_2;
import com.viaversion.viaversion.protocols.v1_16_4to1_17.Protocol1_16_4To1_17;
-import com.viaversion.viafabricplus.old.versioned.ActionResultException1_12_2;
+import com.viaversion.viafabricplus.features.interaction.ActionResultException1_12_2;
import com.viaversion.viafabricplus.features.interaction.ClientPlayerInteractionManager1_18_2;
import com.viaversion.viafabricplus.injection.access.IClientConnection;
import com.viaversion.viafabricplus.injection.access.IClientPlayerInteractionManager;
diff --git a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusVLCommandHandler.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusVLCommandHandler.java
index db6600df..78bd24fd 100644
--- a/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusVLCommandHandler.java
+++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusVLCommandHandler.java
@@ -25,8 +25,8 @@ import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
-import com.viaversion.viafabricplus.old.versioned.classic.command.ListExtensionsCommand;
-import com.viaversion.viafabricplus.old.versioned.classic.command.SetTimeCommand;
+import com.viaversion.viafabricplus.protocoltranslator.impl.command.classic.ListExtensionsCommand;
+import com.viaversion.viafabricplus.protocoltranslator.impl.command.classic.SetTimeCommand;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.raphimc.vialoader.impl.viaversion.VLCommandHandler;
diff --git a/src/main/java/com/viaversion/viafabricplus/old/versioned/classic/command/ListExtensionsCommand.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/classic/ListExtensionsCommand.java
similarity index 96%
rename from src/main/java/com/viaversion/viafabricplus/old/versioned/classic/command/ListExtensionsCommand.java
rename to src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/classic/ListExtensionsCommand.java
index 58a54ce5..84177cc6 100644
--- a/src/main/java/com/viaversion/viafabricplus/old/versioned/classic/command/ListExtensionsCommand.java
+++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/classic/ListExtensionsCommand.java
@@ -19,7 +19,7 @@
* along with this program. If not, see .
*/
-package com.viaversion.viafabricplus.old.versioned.classic.command;
+package com.viaversion.viafabricplus.protocoltranslator.impl.command.classic;
import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viafabricplus.injection.access.IExtensionProtocolMetadataStorage;
diff --git a/src/main/java/com/viaversion/viafabricplus/old/versioned/classic/command/SetTimeCommand.java b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/classic/SetTimeCommand.java
similarity index 96%
rename from src/main/java/com/viaversion/viafabricplus/old/versioned/classic/command/SetTimeCommand.java
rename to src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/classic/SetTimeCommand.java
index e266a8b1..8d2963c8 100644
--- a/src/main/java/com/viaversion/viafabricplus/old/versioned/classic/command/SetTimeCommand.java
+++ b/src/main/java/com/viaversion/viafabricplus/protocoltranslator/impl/command/classic/SetTimeCommand.java
@@ -19,7 +19,7 @@
* along with this program. If not, see .
*/
-package com.viaversion.viafabricplus.old.versioned.classic.command;
+package com.viaversion.viafabricplus.protocoltranslator.impl.command.classic;
import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viafabricplus.protocoltranslator.impl.command.VFPViaSubCommand;