diff --git a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java index 74baaa65d..4f95409fd 100644 --- a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java +++ b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java @@ -21,7 +21,7 @@ import de.florianmichael.viafabricplus.event.PostGameLoadCallback; import de.florianmichael.viafabricplus.fixes.ClientsideFixes; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.save.SaveManager; import de.florianmichael.viafabricplus.settings.SettingsManager; import de.florianmichael.viafabricplus.util.ClassLoaderPriorityUtil; @@ -68,7 +68,7 @@ public void bootstrap() { saveManager = new SaveManager(settingsManager); ClientsideFixes.init(); // Init clientside related fixes - loadingFuture = ProtocolHack.init(directory); // Init ViaVersion protocol translator platform + loadingFuture = ProtocolTranslator.init(directory); // Init ViaVersion protocol translator platform PostGameLoadCallback.EVENT.register(() -> loadingFuture.join()); // Block game loading until ViaVersion has loaded } diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/ClientsideFixes.java b/src/main/java/de/florianmichael/viafabricplus/fixes/ClientsideFixes.java index d0b5cc1ea..3f90d743b 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/ClientsideFixes.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/ClientsideFixes.java @@ -30,7 +30,7 @@ import de.florianmichael.viafabricplus.fixes.versioned.visual.FootStepParticle1_12_2; import de.florianmichael.viafabricplus.injection.ViaFabricPlusMixinPlugin; import de.florianmichael.viafabricplus.injection.access.IClientConnection; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.*; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.FontStorage; @@ -120,12 +120,12 @@ public static void init() { } /** - * Calculates the maximum chat length for the selected protocol version in {@link ProtocolHack#getTargetVersion()} + * Calculates the maximum chat length for the selected protocol version in {@link ProtocolTranslator#getTargetVersion()} * * @return The maximum chat length */ public static int getChatLength() { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { final ClientPlayNetworkHandler handler = MinecraftClient.getInstance().getNetworkHandler(); final ExtensionProtocolMetadataStorage extensionProtocol = ((IClientConnection) handler.getConnection()).viaFabricPlus$getUserConnection().get(ExtensionProtocolMetadataStorage.class); @@ -134,9 +134,9 @@ public static int getChatLength() { } else { return 64 - (MinecraftClient.getInstance().getSession().getUsername().length() + 2); } - } else if (ProtocolHack.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) { + } else if (ProtocolTranslator.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) { return 512; - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_9_3)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_9_3)) { return 100; } else { return 256; diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/data/ItemRegistryDiff.java b/src/main/java/de/florianmichael/viafabricplus/fixes/data/ItemRegistryDiff.java index 275528460..4d12e420c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/data/ItemRegistryDiff.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/data/ItemRegistryDiff.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.injection.access.IClientConnection; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.item.Item; @@ -1365,7 +1365,7 @@ public class ItemRegistryDiff { * @return true if the item exists in the current version, false otherwise, this will also check for CPE items (CustomBlocks V1 extension) */ public static boolean keepItem(final Item item) { - if (ProtocolHack.getTargetVersion().equals(c0_30cpe)) { + if (ProtocolTranslator.getTargetVersion().equals(c0_30cpe)) { final ClientPlayNetworkHandler handler = MinecraftClient.getInstance().getNetworkHandler(); if (handler == null) { // Don't drop any items if the connection is not established yet @@ -1380,7 +1380,7 @@ public static boolean keepItem(final Item item) { } } - return contains(item, ProtocolHack.getTargetVersion()); + return contains(item, ProtocolTranslator.getTargetVersion()); } /** diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/data/Material1_19_4.java b/src/main/java/de/florianmichael/viafabricplus/fixes/data/Material1_19_4.java index 2d4f69887..5b7fb0af4 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/data/Material1_19_4.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/data/Material1_19_4.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.fixes.data; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -1109,7 +1109,7 @@ public enum Material1_19_4 { * @return The material of the block for game version 1.19.4 */ public static Material1_19_4 getMaterial(final Block block) { - if (block instanceof ShulkerBoxBlock && ProtocolHack.getTargetVersion().olderThan(ProtocolVersion.v1_14)) { + if (block instanceof ShulkerBoxBlock && ProtocolTranslator.getTargetVersion().olderThan(ProtocolVersion.v1_14)) { return STONE; } else { return MATERIALS.get(block); diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/data/RenderableGlyphDiff.java b/src/main/java/de/florianmichael/viafabricplus/fixes/data/RenderableGlyphDiff.java index 108192e30..12000cbf8 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/data/RenderableGlyphDiff.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/data/RenderableGlyphDiff.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.fixes.data; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.IntConsumer; @@ -975,7 +975,7 @@ public class RenderableGlyphDiff { * @return true if the given code point is renderable in the current version of the game */ public static boolean isGlyphRenderable(final int codePoint) { - final ProtocolVersion targetVersion = ProtocolHack.getTargetVersion(); + final ProtocolVersion targetVersion = ProtocolTranslator.getTargetVersion(); if (targetVersion.newerThanOrEqualTo(v1_20)) { // 1.20 switched to using Unihex as a main font return !RENDERABLE_GLYPH_DIFF.containsKey(codePoint) || targetVersion.newerThanOrEqualTo(RENDERABLE_GLYPH_DIFF.get(codePoint)); diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/data/recipe/AddBannerPatternRecipe.java b/src/main/java/de/florianmichael/viafabricplus/fixes/data/recipe/AddBannerPatternRecipe.java index 5a1813658..3049ff874 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/data/recipe/AddBannerPatternRecipe.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/data/recipe/AddBannerPatternRecipe.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.fixes.data.recipe; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.entity.BannerBlockEntity; import net.minecraft.inventory.RecipeInputInventory; import net.minecraft.item.BannerItem; @@ -76,7 +76,7 @@ public ItemStack craft(RecipeInputInventory inv, DynamicRegistryManager registry BannerPattern_1_13_2 pattern = getBannerPattern(inv); if (pattern != null) { - DyeColor color = ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2) ? DyeColor.BLACK : DyeColor.WHITE; + DyeColor color = ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2) ? DyeColor.BLACK : DyeColor.WHITE; for (int i = 0; i < inv.size(); i++) { Item item = inv.getStack(i).getItem(); if (item instanceof DyeItem dyeItem) { @@ -138,7 +138,7 @@ private static BannerPattern_1_13_2 getBannerPattern(RecipeInputInventory inv) { } } } - if (!foundBaseItem || (!foundDye && ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_10))) matches = false; + if (!foundBaseItem || (!foundDye && ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_10))) matches = false; } else if (inv.size() == pattern.getRecipePattern().length * pattern.getRecipePattern()[0].length()) { DyeColor patternColor = null; for (int i = 0; i < inv.size(); i++) { diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/ClientPlayerInteractionManager1_18_2.java b/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/ClientPlayerInteractionManager1_18_2.java index ebbc5649f..b8daa0365 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/ClientPlayerInteractionManager1_18_2.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/ClientPlayerInteractionManager1_18_2.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.ViaFabricPlus; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -41,7 +41,7 @@ public void trackPlayerAction(final PlayerActionC2SPacket.Action action, final B final ClientPlayerEntity player = MinecraftClient.getInstance().player; final Vec2f rotation; - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_1)) { rotation = null; } else { rotation = new Vec2f(player.getYaw(), player.getPitch()); @@ -58,9 +58,9 @@ public void handleBlockBreakAck(final BlockPos blockPos, final BlockState expect final var oldPlayerState = unAckedActions.remove(Pair.of(blockPos, action)); final var actualState = world.getBlockState(blockPos); - if ((oldPlayerState == null || !allGood || action != PlayerActionC2SPacket.Action.START_DESTROY_BLOCK && actualState != expectedState) && (actualState != expectedState || ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2))) { + if ((oldPlayerState == null || !allGood || action != PlayerActionC2SPacket.Action.START_DESTROY_BLOCK && actualState != expectedState) && (actualState != expectedState || ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2))) { world.setBlockState(blockPos, expectedState, Block.NOTIFY_ALL | Block.FORCE_STATE); - if (oldPlayerState != null && (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_1) || (world == player.getWorld() && player.collidesWithStateAtPos(blockPos, expectedState)))) { + if (oldPlayerState != null && (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_1) || (world == player.getWorld() && player.collidesWithStateAtPos(blockPos, expectedState)))) { final Vec3d oldPlayerPosition = oldPlayerState.getKey(); if (oldPlayerState.getValue() != null) { player.updatePositionAndAngles(oldPlayerPosition.x, oldPlayerPosition.y, oldPlayerPosition.z, oldPlayerState.getValue().x, oldPlayerState.getValue().y); diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/classic/command/ListExtensionsCommand.java b/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/classic/command/ListExtensionsCommand.java index d51ef3190..f22e6bda0 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/classic/command/ListExtensionsCommand.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/classic/command/ListExtensionsCommand.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.command.ViaCommandSender; import de.florianmichael.viafabricplus.injection.access.IExtensionProtocolMetadataStorage; -import de.florianmichael.viafabricplus.protocolhack.impl.command.VFPViaSubCommand; +import de.florianmichael.viafabricplus.protocoltranslator.impl.command.VFPViaSubCommand; import net.minecraft.util.Formatting; import net.raphimc.vialegacy.api.LegacyProtocolVersion; import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.storage.ExtensionProtocolMetadataStorage; diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/classic/command/SetTimeCommand.java b/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/classic/command/SetTimeCommand.java index fe92da099..f181bec64 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/classic/command/SetTimeCommand.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/classic/command/SetTimeCommand.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.fixes.versioned.classic.command; import com.viaversion.viaversion.api.command.ViaCommandSender; -import de.florianmichael.viafabricplus.protocolhack.impl.command.VFPViaSubCommand; +import de.florianmichael.viafabricplus.protocoltranslator.impl.command.VFPViaSubCommand; import net.minecraft.util.Formatting; import net.raphimc.vialegacy.api.LegacyProtocolVersion; import net.raphimc.vialegacy.protocols.alpha.protocola1_0_17_1_0_17_4toa1_0_16_2.storage.TimeLockStorage; diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/visual/ArmorHudEmulation1_8.java b/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/visual/ArmorHudEmulation1_8.java index e9a7a1a7a..83509facf 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/visual/ArmorHudEmulation1_8.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/visual/ArmorHudEmulation1_8.java @@ -26,7 +26,7 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9; import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8; import de.florianmichael.viafabricplus.ViaFabricPlus; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.settings.impl.VisualSettings; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.minecraft.client.MinecraftClient; @@ -48,7 +48,7 @@ public static void init() { } if (MinecraftClient.getInstance().player != null) { - final UserConnection userConnection = ProtocolHack.getPlayNetworkUserConnection(); + final UserConnection userConnection = ProtocolTranslator.getPlayNetworkUserConnection(); if (userConnection != null) { try { sendArmorUpdate(userConnection); diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/visual/EntityRidingOffsetsPre1_20_2.java b/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/visual/EntityRidingOffsetsPre1_20_2.java index 86cf91794..b25beea31 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/visual/EntityRidingOffsetsPre1_20_2.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/visual/EntityRidingOffsetsPre1_20_2.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.fixes.versioned.visual; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityDimensions; import net.minecraft.entity.EntityPose; @@ -55,7 +55,7 @@ public static Vector3f getMountedHeightOffset(final Entity entity, final Entity if (entity instanceof BoatEntity boatEntity) { if (!boatEntity.hasPassenger(passenger)) return new Vector3f(); - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { yOffset = -0.3F; final float xOffset = MathHelper.cos(boatEntity.getYaw() * MathHelper.PI / 180F); final float zOffset = MathHelper.sin(boatEntity.getYaw() * MathHelper.PI / 180F); @@ -149,7 +149,7 @@ public static Vector3f getMountedHeightOffset(final Entity entity, final Entity */ public static double getHeightOffset(final Entity entity) { if (entity instanceof AllayEntity || entity instanceof VexEntity) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_1)) { return 0D; } else { return 0.4D; diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/visual/FootStepParticle1_12_2.java b/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/visual/FootStepParticle1_12_2.java index 07154b22e..28080effd 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/visual/FootStepParticle1_12_2.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/versioned/visual/FootStepParticle1_12_2.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.fixes.versioned.visual; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes; import net.minecraft.client.particle.*; @@ -96,7 +96,7 @@ public Factory(SpriteProvider spriteProvider) { @Override public Particle createParticle(DefaultParticleType parameters, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { - if (ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_12_2)) { throw new UnsupportedOperationException("FootStepParticle is not supported on versions newer than 1.12.2"); } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/connect/MixinClientConnection.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/connect/MixinClientConnection.java index d30b576b2..54b589f67 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/connect/MixinClientConnection.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/connect/MixinClientConnection.java @@ -25,8 +25,8 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.injection.access.IClientConnection; import de.florianmichael.viafabricplus.injection.access.IPerformanceLog; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; -import de.florianmichael.viafabricplus.protocolhack.netty.ViaFabricPlusVLLegacyPipeline; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; +import de.florianmichael.viafabricplus.protocoltranslator.netty.ViaFabricPlusVLLegacyPipeline; import io.netty.bootstrap.AbstractBootstrap; import io.netty.bootstrap.Bootstrap; import io.netty.channel.*; @@ -138,10 +138,10 @@ private static boolean dontSetPerformanceLog(ClientConnection instance, Performa private static void setTargetVersion(InetSocketAddress address, boolean useEpoll, ClientConnection connection, CallbackInfoReturnable cir) { ProtocolVersion targetVersion = ((IClientConnection) connection).viaFabricPlus$getTargetVersion(); if (targetVersion == null) { // No server specific override - targetVersion = ProtocolHack.getTargetVersion(); + targetVersion = ProtocolTranslator.getTargetVersion(); } - if (targetVersion == ProtocolHack.AUTO_DETECT_PROTOCOL) { // Auto-detect enabled (when pinging always use native version). Auto-detect is resolved in ConnectScreen mixin - targetVersion = ProtocolHack.NATIVE_VERSION; + if (targetVersion == ProtocolTranslator.AUTO_DETECT_PROTOCOL) { // Auto-detect enabled (when pinging always use native version). Auto-detect is resolved in ConnectScreen mixin + targetVersion = ProtocolTranslator.NATIVE_VERSION; } ((IClientConnection) connection).viaFabricPlus$setTargetVersion(targetVersion); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/connect/MixinClientConnection_1.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/connect/MixinClientConnection_1.java index 5256151b6..ac7b01d6d 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/connect/MixinClientConnection_1.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/connect/MixinClientConnection_1.java @@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.base.connect; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import io.netty.channel.Channel; import net.minecraft.network.ClientConnection; import org.spongepowered.asm.mixin.Final; @@ -38,7 +38,7 @@ public abstract class MixinClientConnection_1 { @Inject(method = "initChannel", at = @At("RETURN")) private void injectViaIntoPipeline(Channel channel, CallbackInfo ci) { - ProtocolHack.injectViaPipeline(this.field_11663, channel); + ProtocolTranslator.injectViaPipeline(this.field_11663, channel); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinConnectScreen_1.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinConnectScreen_1.java index 1cbf1e1c7..18178f468 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinConnectScreen_1.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinConnectScreen_1.java @@ -24,9 +24,9 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.ViaFabricPlus; import de.florianmichael.viafabricplus.injection.access.IServerInfo; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; -import de.florianmichael.viafabricplus.protocolhack.impl.provider.vialegacy.ViaFabricPlusClassicMPPassProvider; -import de.florianmichael.viafabricplus.protocolhack.util.ProtocolVersionDetector; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; +import de.florianmichael.viafabricplus.protocoltranslator.impl.provider.vialegacy.ViaFabricPlusClassicMPPassProvider; +import de.florianmichael.viafabricplus.protocoltranslator.util.ProtocolVersionDetector; import de.florianmichael.viafabricplus.settings.impl.AuthenticationSettings; import io.netty.channel.ChannelFuture; import net.minecraft.client.gui.screen.multiplayer.ConnectScreen; @@ -61,20 +61,20 @@ public abstract class MixinConnectScreen_1 { private ChannelFuture setServerInfoAndHandleDisconnect(InetSocketAddress address, boolean useEpoll, ClientConnection connection, Operation original) { final IServerInfo mixinServerInfo = (IServerInfo) this.field_40415; - ProtocolVersion targetVersion = ProtocolHack.getTargetVersion(); + ProtocolVersion targetVersion = ProtocolTranslator.getTargetVersion(); if (mixinServerInfo.viaFabricPlus$forcedVersion() != null && !mixinServerInfo.viaFabricPlus$passedDirectConnectScreen()) { targetVersion = mixinServerInfo.viaFabricPlus$forcedVersion(); } - if (targetVersion == ProtocolHack.AUTO_DETECT_PROTOCOL) { + if (targetVersion == ProtocolTranslator.AUTO_DETECT_PROTOCOL) { this.field_2416.setStatus(Text.translatable("base.viafabricplus.detecting_server_version")); - targetVersion = ProtocolVersionDetector.get(address, ProtocolHack.NATIVE_VERSION); + targetVersion = ProtocolVersionDetector.get(address, ProtocolTranslator.NATIVE_VERSION); } - ProtocolHack.setTargetVersion(targetVersion, true); + ProtocolTranslator.setTargetVersion(targetVersion, true); this.viaFabricPlus$useClassiCubeAccount = AuthenticationSettings.global().setSessionNameToClassiCubeNameInServerList.getValue() && ViaFabricPlusClassicMPPassProvider.classicMpPassForNextJoin != null; final ChannelFuture future = original.call(address, useEpoll, connection); - ProtocolHack.injectPreviousVersionReset(future.channel()); + ProtocolTranslator.injectPreviousVersionReset(future.channel()); return future; } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinDebugHud.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinDebugHud.java index b9c05bb92..492c34b42 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinDebugHud.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinDebugHud.java @@ -26,7 +26,7 @@ import de.florianmichael.viafabricplus.injection.ViaFabricPlusMixinPlugin; import de.florianmichael.viafabricplus.injection.access.IChunkTracker; import de.florianmichael.viafabricplus.injection.access.IRakSessionCodec; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.settings.impl.GeneralSettings; import de.florianmichael.viafabricplus.util.ChatUtil; import net.minecraft.client.MinecraftClient; @@ -60,7 +60,7 @@ public void addViaFabricPlusInformation(CallbackInfoReturnable> cir if (MinecraftClient.getInstance().isInSingleplayer() && MinecraftClient.getInstance().player != null) { return; } - final UserConnection userConnection = ProtocolHack.getPlayNetworkUserConnection(); + final UserConnection userConnection = ProtocolTranslator.getPlayNetworkUserConnection(); if (userConnection == null) { // Via is not translating this session return; } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinDownloadingTerrainScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinDownloadingTerrainScreen.java index e7e64d435..5b1b088c1 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinDownloadingTerrainScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinDownloadingTerrainScreen.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.base.integration; import com.viaversion.viaversion.api.connection.UserConnection; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.settings.impl.GeneralSettings; import de.florianmichael.viafabricplus.util.ChatUtil; import net.minecraft.client.gui.DrawContext; @@ -44,7 +44,7 @@ public MixinDownloadingTerrainScreen(Text title) { private void renderClassicProgress(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { if (GeneralSettings.global().showClassicLoadingProgressInConnectScreen.getValue()) { // Check if ViaVersion is translating - final UserConnection connection = ProtocolHack.getPlayNetworkUserConnection(); + final UserConnection connection = ProtocolTranslator.getPlayNetworkUserConnection(); if (connection == null) { return; } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinMinecraftClient.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinMinecraftClient.java index deeb8b828..66e0b478b 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinMinecraftClient.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinMinecraftClient.java @@ -21,7 +21,7 @@ import com.llamalad7.mixinextras.sugar.Local; import de.florianmichael.viafabricplus.event.PostGameLoadCallback; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.MinecraftClient; import net.minecraft.client.RunArgs; import net.minecraft.network.ClientConnection; @@ -43,8 +43,8 @@ private void callPostGameLoadEvent(RunArgs args, CallbackInfo ci) { @Inject(method = "startIntegratedServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;connect(Ljava/lang/String;ILnet/minecraft/network/listener/ClientLoginPacketListener;)V", shift = At.Shift.BEFORE)) private void disableProtocolHack(LevelStorage.Session session, ResourcePackManager dataPackManager, SaveLoader saveLoader, boolean newWorld, CallbackInfo ci, @Local ClientConnection clientConnection) { - ProtocolHack.setTargetVersion(ProtocolHack.NATIVE_VERSION, true); - ProtocolHack.injectPreviousVersionReset(clientConnection.channel); + ProtocolTranslator.setTargetVersion(ProtocolTranslator.NATIVE_VERSION, true); + ProtocolTranslator.injectPreviousVersionReset(clientConnection.channel); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/compat/ipnext/MixinAutoRefillHandler_ItemSlotMonitor.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/compat/ipnext/MixinAutoRefillHandler_ItemSlotMonitor.java index b8eecc20e..767580e28 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/compat/ipnext/MixinAutoRefillHandler_ItemSlotMonitor.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/compat/ipnext/MixinAutoRefillHandler_ItemSlotMonitor.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.compat.ipnext; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.Shadow; @@ -43,14 +43,14 @@ public abstract class MixinAutoRefillHandler_ItemSlotMonitor { @Inject(method = { "checkHandle", "checkShouldHandle" }, at = @At("HEAD"), cancellable = true) public void dontHandleOffhandSlot(CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { if (currentSlotId == 45) ci.cancel(); } } @Inject(method = "updateCurrent", at = @At(value = "FIELD", target = "Lorg/anti_ad/mc/ipnext/event/AutoRefillHandler$ItemSlotMonitor;currentSlotId:I", shift = At.Shift.AFTER), cancellable = true) public void dontUpdateCurrentOffhandSlot(CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { if (currentSlotId == 45) ci.cancel(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/compat/lithium/MixinEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/compat/lithium/MixinEntity.java index 8eecb5918..f7713bc81 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/compat/lithium/MixinEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/compat/lithium/MixinEntity.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.compat.lithium; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.Entity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -34,7 +34,7 @@ public abstract class MixinEntity { @SuppressWarnings({"MixinAnnotationTarget", "UnresolvedMixinReference"}) @Redirect(method = "lithiumCollideMultiAxisMovement", at = @At(value = "INVOKE", target = "Ljava/lang/Math;abs(D)D", ordinal = 0), remap = false) private static double alwaysSortYXZ(double a) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { return Double.MAX_VALUE; } else { return Math.abs(a); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinAllowedAddressResolver.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinAllowedAddressResolver.java index bd36eb412..0ef81aef4 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinAllowedAddressResolver.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinAllowedAddressResolver.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.network.Address; import net.minecraft.client.network.AddressResolver; import net.minecraft.client.network.AllowedAddressResolver; @@ -44,7 +44,7 @@ public abstract class MixinAllowedAddressResolver { @Inject(method = "resolve", at = @At("HEAD"), cancellable = true) private void oldResolveBehaviour(ServerAddress address, CallbackInfoReturnable> cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4) || ProtocolHack.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4) || ProtocolTranslator.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) { cir.setReturnValue(this.addressResolver.resolve(address)); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinBuiltChunk.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinBuiltChunk.java index 9bb0a4c4e..ecf8d3e7c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinBuiltChunk.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinBuiltChunk.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.render.chunk.ChunkBuilder; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -32,7 +32,7 @@ public abstract class MixinBuiltChunk { @Inject(method = "shouldBuild", at = @At("HEAD"), cancellable = true) private void modifyRenderCondition(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { cir.setReturnValue(true); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinChatInputSuggestor.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinChatInputSuggestor.java index 825097b21..33a357cb2 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinChatInputSuggestor.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinChatInputSuggestor.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ChatInputSuggestor; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -89,7 +89,7 @@ private void clearMessages(DrawContext drawContext, int mouseX, int mouseY, Call @Unique private boolean viaFabricPlus$cancelTabComplete() { - return ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2) && this.textField.getText().startsWith("/"); + return ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2) && this.textField.getText().startsWith("/"); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientCommandSource.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientCommandSource.java index 0d4897c30..c568b4e61 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientCommandSource.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientCommandSource.java @@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.network.ClientCommandSource; import net.raphimc.viabedrock.api.BedrockProtocolVersion; import org.spongepowered.asm.mixin.Final; @@ -41,7 +41,7 @@ public abstract class MixinClientCommandSource { @Inject(method = {"getPlayerNames", "getChatSuggestions"}, at = @At("HEAD"), cancellable = true) private void returnChatSuggestions(CallbackInfoReturnable> cir) { - if (ProtocolHack.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) { + if (ProtocolTranslator.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) { cir.setReturnValue(this.chatSuggestions); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinEnchantmentHelper.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinEnchantmentHelper.java index 5cc337053..4296f32d9 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinEnchantmentHelper.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinEnchantmentHelper.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.enchantment.EnchantmentHelper; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.Constant; @@ -31,7 +31,7 @@ public abstract class MixinEnchantmentHelper { @ModifyConstant(method = "getLevelFromNbt", constant = @Constant(intValue = 0)) private static int usePossibleMinLevel(int constant) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { return Short.MIN_VALUE; } else { return constant; @@ -40,7 +40,7 @@ private static int usePossibleMinLevel(int constant) { @ModifyConstant(method = "getLevelFromNbt", constant = @Constant(intValue = 255)) private static int usePossibleMaxLevel(int constant) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { return Short.MAX_VALUE; } else { return constant; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinFlowableFluid.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinFlowableFluid.java index c1a9c697e..3083d3612 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinFlowableFluid.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinFlowableFluid.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.fixes.data.Material1_19_4; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.*; import net.minecraft.fluid.FlowableFluid; import net.minecraft.util.math.BlockPos; @@ -36,9 +36,9 @@ public abstract class MixinFlowableFluid { @Redirect(method = "isFlowBlocked", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isSideSolidFullSquare(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;)Z")) private boolean modifyIsSolidBlock(BlockState instance, BlockView blockView, BlockPos blockPos, Direction direction) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { return Material1_19_4.getMaterial(instance).solid(); - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { final Block block = instance.getBlock(); if (block instanceof ShulkerBoxBlock || block instanceof LeavesBlock || block instanceof TrapdoorBlock || block == Blocks.BEACON || block == Blocks.CAULDRON || block == Blocks.GLASS || diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinGameOptions.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinGameOptions.java index 8a46f1118..44fd15861 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinGameOptions.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinGameOptions.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.ViaFabricPlus; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.option.GameOptions; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; @@ -37,7 +37,7 @@ public abstract class MixinGameOptions { @ModifyVariable(method = "setServerViewDistance", at = @At("HEAD"), ordinal = 0, argsOnly = true) private int changeServerViewDistance(int viewDistance) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_17_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_17_1)) { return 0; } else { return viewDistance; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinGameRenderer.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinGameRenderer.java index 0755083d6..54539bf6e 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinGameRenderer.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinGameRenderer.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.GameRenderer; import net.minecraft.entity.Entity; @@ -44,7 +44,7 @@ public abstract class MixinGameRenderer { @ModifyExpressionValue(method = "updateTargetedEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;raycast(DFZ)Lnet/minecraft/util/hit/HitResult;")) private HitResult bedrockReachAroundRaycast(HitResult hitResult) { - if (ProtocolHack.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) { + if (ProtocolTranslator.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) { final Entity entity = this.client.getCameraEntity(); if (hitResult.getType() != HitResult.Type.MISS) return hitResult; if (!this.viaFabricPlus$canReachAround(entity)) return hitResult; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinKeyboardInput.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinKeyboardInput.java index 9a3a57853..7b1f88e6c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinKeyboardInput.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinKeyboardInput.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.MinecraftClient; import net.minecraft.client.input.Input; import net.minecraft.client.input.KeyboardInput; @@ -33,9 +33,9 @@ public abstract class MixinKeyboardInput extends Input { @ModifyVariable(method = "tick", at = @At(value = "LOAD", ordinal = 0), argsOnly = true) private boolean changeSneakSlowdownCondition(boolean slowDown) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { return this.sneaking; - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { return !MinecraftClient.getInstance().player.isSpectator() && (this.sneaking || slowDown); } else { return slowDown; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java index b1237d7ca..34e871720 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java @@ -28,7 +28,7 @@ import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3; import de.florianmichael.viafabricplus.fixes.data.ItemRegistryDiff; import de.florianmichael.viafabricplus.injection.access.IMouseKeyboard; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.settings.impl.DebugSettings; import net.minecraft.client.Keyboard; import net.minecraft.client.MinecraftClient; @@ -89,17 +89,17 @@ private void dontSendEmptyItem(ClientPlayerInteractionManager instance, ItemStac @Redirect(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ActionResult;shouldSwingHand()Z", ordinal = 0)) private boolean disableSwing(ActionResult instance) { - return instance.shouldSwingHand() && ProtocolHack.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_15); + return instance.shouldSwingHand() && ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_15); } @Redirect(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ActionResult;shouldSwingHand()Z", ordinal = 2)) private boolean disableSwing2(ActionResult instance) { - return instance.shouldSwingHand() && ProtocolHack.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_15); + return instance.shouldSwingHand() && ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_15); } @WrapWithCondition(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V")) private boolean disableSwing(ClientPlayerEntity instance, Hand hand) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_14_4); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_14_4); } @Inject(method = "tick", @@ -122,7 +122,7 @@ private void processInputQueues(CallbackInfo ci) { @Inject(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/tutorial/TutorialManager;onInventoryOpened()V", shift = At.Shift.AFTER)) private void sendOpenInventoryPacket(CallbackInfo ci) throws Exception { if (DebugSettings.global().sendOpenInventoryPacket.isEnabled()) { - final PacketWrapper clientStatus = PacketWrapper.create(ServerboundPackets1_9_3.CLIENT_STATUS, ProtocolHack.getPlayNetworkUserConnection()); + final PacketWrapper clientStatus = PacketWrapper.create(ServerboundPackets1_9_3.CLIENT_STATUS, ProtocolTranslator.getPlayNetworkUserConnection()); clientStatus.write(Type.VAR_INT, 2); // Open Inventory Achievement clientStatus.scheduleSendToServer(Protocol1_12To1_11_1.class); } @@ -130,19 +130,19 @@ private void sendOpenInventoryPacket(CallbackInfo ci) throws Exception { @Inject(method = "doAttack", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;crosshairTarget:Lnet/minecraft/util/hit/HitResult;", shift = At.Shift.BEFORE, ordinal = 0)) private void fixSwingPacketOrder(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { this.player.swingHand(Hand.MAIN_HAND); } } @WrapWithCondition(method = "doAttack", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V")) private boolean fixSwingPacketOrder(ClientPlayerEntity instance, Hand hand) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_8); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_8); } @Redirect(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;attackCooldown:I", ordinal = 1)) private int moveCooldownIncrement(MinecraftClient instance) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { return 0; } else { return attackCooldown; @@ -151,7 +151,7 @@ private int moveCooldownIncrement(MinecraftClient instance) { @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;handleInputEvents()V", shift = At.Shift.BEFORE)) private void moveCooldownIncrement(CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { if (this.attackCooldown > 0) { --this.attackCooldown; } @@ -160,7 +160,7 @@ private void moveCooldownIncrement(CallbackInfo ci) { @ModifyExpressionValue(method = "handleBlockBreaking", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isUsingItem()Z")) private boolean allowBlockBreakAndItemUsageAtTheSameTime(boolean original) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_7_6) && original; + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_7_6) && original; } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMouse.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMouse.java index 2c8bff1b8..8c69c9977 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMouse.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMouse.java @@ -23,8 +23,8 @@ import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.injection.access.IMouseKeyboard; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; -import de.florianmichael.viafabricplus.protocolhack.util.MathUtil; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; +import de.florianmichael.viafabricplus.protocoltranslator.util.MathUtil; import de.florianmichael.viafabricplus.settings.impl.DebugSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.Mouse; @@ -62,7 +62,7 @@ private void storeEvent(MinecraftClient instance, Runnable runnable) { private Object adjustMouseSensitivity1_13_2(SimpleOption instance, Operation original) { final Double value = original.call(instance); - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { return (double) MathUtil.get1_13SliderValue(value.floatValue()).keyFloat(); } else { return value; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinPlayerInventory.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinPlayerInventory.java index 65cc81423..5e34f69a1 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinPlayerInventory.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinPlayerInventory.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.util.collection.DefaultedList; import org.spongepowered.asm.mixin.Mixin; @@ -35,7 +35,7 @@ public abstract class MixinPlayerInventory { @Redirect(method = "", slice = @Slice(from = @At(value = "CONSTANT", args = "intValue=1")), at = @At(value = "INVOKE", target = "Lnet/minecraft/util/collection/DefaultedList;ofSize(ILjava/lang/Object;)Lnet/minecraft/util/collection/DefaultedList;", ordinal = 0)) private DefaultedList redirectOffhandInventory(int size, T def) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { //noinspection MixinInnerClass return new DefaultedList<>(new AbstractList() { @Override diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinPlayerListEntry.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinPlayerListEntry.java index 96f5982ca..feea68362 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinPlayerListEntry.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinPlayerListEntry.java @@ -22,7 +22,7 @@ import com.mojang.authlib.GameProfile; import com.mojang.authlib.yggdrasil.ProfileResult; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.PlayerListEntry; import net.minecraft.client.texture.PlayerSkinProvider; @@ -39,7 +39,7 @@ public abstract class MixinPlayerListEntry { @Redirect(method = "texturesSupplier", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/PlayerSkinProvider;fetchSkinTextures(Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture;")) private static CompletableFuture fetchGameProfileProperties(PlayerSkinProvider instance, GameProfile profile) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20) && !profile.getProperties().containsKey("textures")) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20) && !profile.getProperties().containsKey("textures")) { return CompletableFuture.supplyAsync(() -> { final ProfileResult profileResult = MinecraftClient.getInstance().getSessionService().fetchProfile(profile.getId(), true); return profileResult == null ? profile : profileResult.profile(); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinRedirectResolver.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinRedirectResolver.java index be1b006ac..88dbb9d03 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinRedirectResolver.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinRedirectResolver.java @@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.network.RedirectResolver; import net.minecraft.client.network.ServerAddress; import net.raphimc.vialegacy.api.LegacyProtocolVersion; @@ -36,7 +36,7 @@ public interface MixinRedirectResolver { @Inject(method = "method_36911", at = @At("HEAD"), cancellable = true) private static void disableSrvForPre1_3(DirContext context, ServerAddress address, CallbackInfoReturnable> cir) { - if (ProtocolHack.getTargetVersion().olderThan(LegacyProtocolVersion.r1_3_1tor1_3_2)) { + if (ProtocolTranslator.getTargetVersion().olderThan(LegacyProtocolVersion.r1_3_1tor1_3_2)) { cir.setReturnValue(Optional.empty()); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinServerAddress.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinServerAddress.java index 12d49eefc..5891c53d3 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinServerAddress.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinServerAddress.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.network.AllowedAddressResolver; import net.minecraft.client.network.ServerAddress; import org.spongepowered.asm.mixin.Final; @@ -39,7 +39,7 @@ public abstract class MixinServerAddress { @Inject(method = "parse", at = @At("RETURN"), cancellable = true) private static void resolveSrv(String address, CallbackInfoReturnable cir) { - if (!cir.getReturnValue().equals(INVALID) && ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + if (!cir.getReturnValue().equals(INVALID) && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { cir.setReturnValue(AllowedAddressResolver.DEFAULT.redirectResolver.lookupRedirect(cir.getReturnValue()).orElse(cir.getReturnValue())); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinServerResourcePackLoader_4.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinServerResourcePackLoader_4.java index c8fc38c33..7d041bbc2 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinServerResourcePackLoader_4.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinServerResourcePackLoader_4.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.fixes.data.ResourcePackHeaderDiff; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.GameVersion; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -37,15 +37,15 @@ public abstract class MixinServerResourcePackLoader_4 { @Redirect(method = "getHeaders", at = @At(value = "INVOKE", target = "Lnet/minecraft/SharedConstants;getGameVersion()Lnet/minecraft/GameVersion;")) private GameVersion editHeaders() { - return ResourcePackHeaderDiff.get(ProtocolHack.getTargetVersion()); + return ResourcePackHeaderDiff.get(ProtocolTranslator.getTargetVersion()); } @Inject(method = "getHeaders", at = @At("TAIL"), cancellable = true) private void removeHeaders(CallbackInfoReturnable> cir) { final LinkedHashMap modifiableMap = new LinkedHashMap<>(cir.getReturnValue()); - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_3)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_3)) { modifiableMap.remove("X-Minecraft-Version-ID"); - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { modifiableMap.remove("X-Minecraft-Pack-Format"); modifiableMap.remove("User-Agent"); } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinTextRenderer.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinTextRenderer.java index 077a57e9d..c08a4b043 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinTextRenderer.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinTextRenderer.java @@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.render.VertexConsumerProvider; @@ -62,7 +62,7 @@ public abstract class MixinTextRenderer { @Inject(method = "draw(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;IIZ)I", at = @At("HEAD"), cancellable = true) private void allowNewLines_String(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light, boolean rightToLeft, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion() == BedrockProtocolVersion.bedrockLatest) { + if (ProtocolTranslator.getTargetVersion() == BedrockProtocolVersion.bedrockLatest) { final List lines = wrapLines(StringVisitable.plain(rightToLeft ? this.mirror(text) : text), Integer.MAX_VALUE); if (lines.size() > 1) { int offsetX = 0; @@ -76,7 +76,7 @@ private void allowNewLines_String(String text, float x, float y, int color, bool @Inject(method = "draw(Lnet/minecraft/text/Text;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)I", at = @At("HEAD"), cancellable = true) private void allowNewLines_Text(Text text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion() == BedrockProtocolVersion.bedrockLatest) { + if (ProtocolTranslator.getTargetVersion() == BedrockProtocolVersion.bedrockLatest) { final List lines = wrapLines(text, Integer.MAX_VALUE); if (lines.size() > 1) { int offsetX = 0; @@ -90,7 +90,7 @@ private void allowNewLines_Text(Text text, float x, float y, int color, boolean @Inject(method = "getWidth(Lnet/minecraft/text/StringVisitable;)I", at = @At("HEAD"), cancellable = true) private void allowNewLines_getWidth(StringVisitable text, CallbackInfoReturnable cir) { - if (MinecraftClient.getInstance().world != null && ProtocolHack.getTargetVersion() == BedrockProtocolVersion.bedrockLatest) { + if (MinecraftClient.getInstance().world != null && ProtocolTranslator.getTargetVersion() == BedrockProtocolVersion.bedrockLatest) { int i = 0; for (OrderedText wrapLine : this.wrapLines(text, Integer.MAX_VALUE)) { if (getWidth(wrapLine) >= i) i = getWidth(wrapLine); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAbstractBlock_AbstractBlockState.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAbstractBlock_AbstractBlockState.java index 713b07c20..76b3999a0 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAbstractBlock_AbstractBlockState.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAbstractBlock_AbstractBlockState.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.*; import net.minecraft.util.math.BlockPos; import net.minecraft.world.BlockView; @@ -49,7 +49,7 @@ public abstract class MixinAbstractBlock_AbstractBlockState { */ @Overwrite public boolean isToolRequired() { - if (this.getBlock() instanceof ShulkerBoxBlock && ProtocolHack.getTargetVersion().olderThan(ProtocolVersion.v1_14)) { + if (this.getBlock() instanceof ShulkerBoxBlock && ProtocolTranslator.getTargetVersion().olderThan(ProtocolVersion.v1_14)) { return true; } else { return this.toolRequired; @@ -61,21 +61,21 @@ private void changeHardness(BlockView world, BlockPos pos, CallbackInfoReturnabl final Block block = this.getBlock(); if (block.equals(Blocks.END_STONE_BRICKS) || block.equals(Blocks.END_STONE_BRICK_SLAB) || block.equals(Blocks.END_STONE_BRICK_STAIRS) || block.equals(Blocks.END_STONE_BRICK_WALL)) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { cir.setReturnValue(0.8F); } } else if (block.equals(Blocks.PISTON) || block.equals(Blocks.STICKY_PISTON) || block.equals(Blocks.PISTON_HEAD)) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { cir.setReturnValue(0.5F); } } else if (block instanceof InfestedBlock) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(0.75F); - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { cir.setReturnValue(0F); } } else if (block.equals(Blocks.OBSIDIAN)) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { cir.setReturnValue(10.0F); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAbstractSignBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAbstractSignBlock.java index 59e26905b..4a1a19439 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAbstractSignBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAbstractSignBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.AbstractSignBlock; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; @@ -47,10 +47,10 @@ private void changeInteractionCalculation(BlockState state, World world, BlockPo return; } - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { // <= 1.14.4 doesn't have any sign interactions. cir.setReturnValue(ActionResult.SUCCESS); - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_4)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_4)) { // Removes the isWaxed() condition and reverts the interaction changes from 1.19.4 -> 1.20 when signs // got a front and back side. final ItemStack itemStack = player.getStackInHand(hand); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAnvilBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAnvilBlock.java index 33c58712c..4e3cb814b 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAnvilBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAnvilBlock.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.injection.ViaFabricPlusMixinPlugin; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.*; import net.minecraft.state.property.DirectionProperty; import net.minecraft.util.math.BlockPos; @@ -60,7 +60,7 @@ public MixinAnvilBlock(Settings settings) { private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { if (ViaFabricPlusMixinPlugin.MORE_CULLING_PRESENT && viaFabricPlus$requireOriginalShape) { viaFabricPlus$requireOriginalShape = false; - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(state.get(FACING).getAxis() == Direction.Axis.X ? viaFabricPlus$x_axis_shape_r1_12_2 : viaFabricPlus$z_axis_shape_r1_12_2); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBambooBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBambooBlock.java index 641ab4be6..bfa9d825f 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBambooBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBambooBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.BambooBlock; import net.minecraft.block.BlockState; import net.minecraft.util.math.BlockPos; @@ -35,7 +35,7 @@ public abstract class MixinBambooBlock { @Inject(method = "isShapeFullCube", at = @At("HEAD"), cancellable = true) private void changeBlockBoundingBox(BlockState state, BlockView world, BlockPos pos, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_17)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_17)) { cir.setReturnValue(true); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBedBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBedBlock.java index a9789cd60..3861ec0b5 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBedBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBedBlock.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.injection.ViaFabricPlusMixinPlugin; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.*; import net.minecraft.entity.Entity; import net.minecraft.util.math.BlockPos; @@ -51,14 +51,14 @@ protected MixinBedBlock(Settings settings) { private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { if (ViaFabricPlusMixinPlugin.MORE_CULLING_PRESENT && viaFabricPlus$requireOriginalShape) { viaFabricPlus$requireOriginalShape = false; - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { cir.setReturnValue(viaFabricPlus$shape_r1_13_2); } } @Inject(method = "bounceEntity", at = @At("HEAD"), cancellable = true) private void cancelEntityBounce(Entity entity, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { ci.cancel(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBrewingStandBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBrewingStandBlock.java index 8322fe2b1..be30cee21 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBrewingStandBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBrewingStandBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.BrewingStandBlock; @@ -46,7 +46,7 @@ public abstract class MixinBrewingStandBlock { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(viaFabricPlus$shape_r1_12_2); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinCarpetBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinCarpetBlock.java index 7daaf73f4..0cc6ab025 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinCarpetBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinCarpetBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.CarpetBlock; @@ -43,7 +43,7 @@ public MixinCarpetBlock(Settings settings) { @Override public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) { return viaFabricPlus$shape_r1_7_10; } else { return super.getCollisionShape(state, world, pos, context); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinCauldronBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinCauldronBlock.java index 3ea5e383a..1d5ac418b 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinCauldronBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinCauldronBlock.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.injection.ViaFabricPlusMixinPlugin; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.*; import net.minecraft.block.cauldron.CauldronBehavior; import net.minecraft.util.function.BooleanBiFunction; @@ -53,7 +53,7 @@ public MixinCauldronBlock(Settings settings, CauldronBehavior.CauldronBehaviorMa public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { if (ViaFabricPlusMixinPlugin.MORE_CULLING_PRESENT && viaFabricPlus$requireOriginalShape) { viaFabricPlus$requireOriginalShape = false; - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { return viaFabricPlus$shape_r1_12_2; } return super.getOutlineShape(state, world, pos, context); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinChestBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinChestBlock.java index b0011e76e..0d269f47b 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinChestBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinChestBlock.java @@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.AbstractChestBlock; import net.minecraft.block.BlockState; import net.minecraft.block.ChestBlock; @@ -70,14 +70,14 @@ protected MixinChestBlock(Settings settings, Supplier cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_2)) { cir.setReturnValue(VoxelShapes.fullCube()); } } @Override public VoxelShape getCullingShape(BlockState state, BlockView view, BlockPos pos) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_2)) { if (state.get(ChestBlock.CHEST_TYPE) == ChestType.SINGLE) { return SINGLE_SHAPE; } else { diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinCropBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinCropBlock.java index 7aba95e0f..54d39400b 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinCropBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinCropBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.CropBlock; import net.minecraft.util.shape.VoxelShape; @@ -38,7 +38,7 @@ public abstract class MixinCropBlock { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) private void changeOutlineShape(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { cir.setReturnValue(viaFabricPlus$shape_r1_8_x); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinDecoratedPotBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinDecoratedPotBlock.java index aad433564..5b0a0a20b 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinDecoratedPotBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinDecoratedPotBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.BlockState; import net.minecraft.block.DecoratedPotBlock; import net.minecraft.entity.player.PlayerEntity; @@ -39,7 +39,7 @@ public abstract class MixinDecoratedPotBlock { @Inject(method = "onUse", at = @At("HEAD"), cancellable = true) private void alwaysPass(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) { cir.setReturnValue(ActionResult.PASS); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinEndPortalBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinEndPortalBlock.java index b74ccb4f1..c68c8f99c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinEndPortalBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinEndPortalBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.shape.VoxelShape; @@ -46,9 +46,9 @@ protected MixinEndPortalBlock(Settings settings) { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { cir.setReturnValue(viaFabricPlus$shape_r1_8_x); - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { cir.setReturnValue(viaFabricPlus$shape_r1_16_5); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinEndPortalFrameBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinEndPortalFrameBlock.java index 8e718564e..65330afc0 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinEndPortalFrameBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinEndPortalFrameBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.EndPortalFrameBlock; @@ -61,14 +61,14 @@ public MixinEndPortalFrameBlock(Settings settings) { @Inject(method = "getOutlineShape", at = @At(value = "HEAD"), cancellable = true) private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(FRAME_SHAPE); } } @Override public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { return state.get(EYE) ? viaFabricPlus$frame_with_eye_shape_r1_12_2 : FRAME_SHAPE; } else { return super.getCollisionShape(state, world, pos, context); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinEnderChestBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinEnderChestBlock.java index 80cb0ce30..d5a59eafb 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinEnderChestBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinEnderChestBlock.java @@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.BlockState; import net.minecraft.block.BlockWithEntity; import net.minecraft.block.EnderChestBlock; @@ -49,14 +49,14 @@ protected MixinEnderChestBlock(Settings settings) { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_2)) { cir.setReturnValue(VoxelShapes.fullCube()); } } @Override public VoxelShape getCullingShape(BlockState state, BlockView view, BlockPos pos) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_2)) { return SHAPE; } else { return super.getCullingShape(state, view, pos); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFarmlandBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFarmlandBlock.java index 3963c3b02..cdc217813 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFarmlandBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFarmlandBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.FarmlandBlock; @@ -49,14 +49,14 @@ public MixinFarmlandBlock(Settings settings) { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_9_3)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_9_3)) { cir.setReturnValue(VoxelShapes.fullCube()); } } @Override public VoxelShape getCullingShape(BlockState state, BlockView view, BlockPos pos) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_9_3)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_9_3)) { return SHAPE; } else { return super.getCullingShape(state, view, pos); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFenceBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFenceBlock.java index 4e7c3487f..916163420 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFenceBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFenceBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.*; import net.minecraft.util.ActionResult; import net.minecraft.util.math.BlockPos; @@ -53,7 +53,7 @@ protected MixinFenceBlock(float radius1, float radius2, float boundingHeight1, f @Inject(method = "onUse", at = @At("HEAD"), cancellable = true) private void alwaysSuccess(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_10)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_10)) { cir.setReturnValue(ActionResult.SUCCESS); } } @@ -66,9 +66,9 @@ private void init1_4_7Shapes(Settings settings, CallbackInfo ci) { @Override public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { return VoxelShapes.fullCube(); - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_6tor1_4_7)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_6tor1_4_7)) { return this.viaFabricPlus$outline_shape_r1_4_7[this.getShapeIndex(state)]; } else { return super.getOutlineShape(state, world, pos, context); @@ -77,9 +77,9 @@ public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos po @Override public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { return viaFabricPlus$shape_b1_8_1; - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_6tor1_4_7)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_6tor1_4_7)) { return this.viaFabricPlus$collision_shape_r1_4_7[this.getShapeIndex(state)]; } else { return super.getCollisionShape(state, world, pos, context); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFenceGateBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFenceGateBlock.java index 6ae3afc50..cd4f68365 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFenceGateBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFenceGateBlock.java @@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.shape.VoxelShape; @@ -44,14 +44,14 @@ protected MixinFenceGateBlock(Settings settings) { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (!state.get(FenceGateBlock.IN_WALL) && ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { + if (!state.get(FenceGateBlock.IN_WALL) && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { cir.setReturnValue(VoxelShapes.fullCube()); } } @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) private void changeCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (!state.get(FenceGateBlock.OPEN) && ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { + if (!state.get(FenceGateBlock.OPEN) && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { cir.setReturnValue(viaFabricPlus$x_and_z_axis_collision_shape_b1_8_1); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFireBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFireBlock.java index 7fe5d46c8..65614fcee 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFireBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFireBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.BlockState; import net.minecraft.block.FireBlock; import net.minecraft.block.ShapeContext; @@ -38,7 +38,7 @@ public abstract class MixinFireBlock { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { cir.setReturnValue(VoxelShapes.empty()); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFlowerPotBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFlowerPotBlock.java index c72eff543..071864f39 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFlowerPotBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFlowerPotBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.FlowerPotBlock; @@ -41,7 +41,7 @@ public abstract class MixinFlowerPotBlock { @Inject(method = "onUse", at = @At(value = "FIELD", target = "Lnet/minecraft/block/FlowerPotBlock;content:Lnet/minecraft/block/Block;", ordinal = 0), cancellable = true) private void alwaysConsume(CallbackInfoReturnable ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_10) && content != Blocks.AIR) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_10) && content != Blocks.AIR) { ci.setReturnValue(ActionResult.CONSUME); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFlowerbedBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFlowerbedBlock.java index 5fd7f4452..8eb00d841 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFlowerbedBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFlowerbedBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.FlowerbedBlock; @@ -42,7 +42,7 @@ public abstract class MixinFlowerbedBlock { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) { cir.setReturnValue(viaFabricPlus$shape_r1_20_1); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinHopperBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinHopperBlock.java index 5b148b553..913013e69 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinHopperBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinHopperBlock.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.injection.ViaFabricPlusMixinPlugin; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.*; import net.minecraft.util.function.BooleanBiFunction; import net.minecraft.util.math.BlockPos; @@ -54,14 +54,14 @@ public MixinHopperBlock(Settings settings) { private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { if (ViaFabricPlusMixinPlugin.MORE_CULLING_PRESENT && viaFabricPlus$requireOriginalShape) { viaFabricPlus$requireOriginalShape = false; - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(viaFabricPlus$hopper_shape_r1_12_2); } } @Inject(method = "getRaycastShape", at = @At("HEAD"), cancellable = true) private void changeRaycastShape(BlockState state, BlockView world, BlockPos pos, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(viaFabricPlus$inside_shape_r1_12_2); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinLadderBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinLadderBlock.java index 0c05f0840..d2cd079fa 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinLadderBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinLadderBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.LadderBlock; @@ -51,7 +51,7 @@ public abstract class MixinLadderBlock { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { switch (state.get(LadderBlock.FACING)) { case NORTH -> ci.setReturnValue(viaFabricPlus$north_shape_r1_8_x); case SOUTH -> ci.setReturnValue(viaFabricPlus$south_shape_r1_8_x); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinLeavesBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinLeavesBlock.java index 410b48384..6579a5dd3 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinLeavesBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinLeavesBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.LeavesBlock; @@ -41,7 +41,7 @@ public MixinLeavesBlock(Settings settings) { @Inject(method = "getSidesShape", at = @At("HEAD"), cancellable = true) private void changeSidesShape(BlockState state, BlockView world, BlockPos pos, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().betweenInclusive(ProtocolVersion.v1_14, ProtocolVersion.v1_15_2)) { + if (ProtocolTranslator.getTargetVersion().betweenInclusive(ProtocolVersion.v1_14, ProtocolVersion.v1_15_2)) { cir.setReturnValue(super.getSidesShape(state, world, pos)); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinLilyPadBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinLilyPadBlock.java index e2a3d58ed..6845e526f 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinLilyPadBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinLilyPadBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.LilyPadBlock; @@ -42,7 +42,7 @@ public abstract class MixinLilyPadBlock { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { cir.setReturnValue(viaFabricPlus$shape_r1_8_x); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinNoteBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinNoteBlock.java index 028dc2137..f19a69b22 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinNoteBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinNoteBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.NoteBlock; import net.minecraft.util.ActionResult; import org.spongepowered.asm.mixin.Mixin; @@ -33,7 +33,7 @@ public abstract class MixinNoteBlock { @Inject(method = "onUse", at = @At("HEAD"), cancellable = true) private void cancelMobHeadUsage(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_4)) { cir.setReturnValue(ActionResult.SUCCESS); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinPaneBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinPaneBlock.java index 86a2dfaf5..da81dfc80 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinPaneBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinPaneBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.shape.VoxelShape; @@ -85,7 +85,7 @@ private void initShapes1_8(Settings settings, CallbackInfo ci) { @Override public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { return this.viaFabricPlus$shape_r1_8[this.getShapeIndex(state)]; } else { return super.getOutlineShape(state, world, pos, context); @@ -94,7 +94,7 @@ public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos po @Override public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { return this.viaFabricPlus$shape_r1_8[this.getShapeIndex(state)]; } else { return super.getCollisionShape(state, world, pos, context); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinPistonBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinPistonBlock.java index 3350c79e3..7c5f0fd10 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinPistonBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinPistonBlock.java @@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.BlockState; import net.minecraft.block.FacingBlock; import net.minecraft.block.PistonBlock; @@ -69,14 +69,14 @@ protected MixinPistonBlock(Settings settings) { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_1)) { cir.setReturnValue(VoxelShapes.fullCube()); } } @Override public VoxelShape getCullingShape(BlockState state, BlockView world, BlockPos pos) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_1)) { if (state.get(PistonBlock.EXTENDED)) { return switch (state.get(FACING)) { case DOWN -> EXTENDED_DOWN_SHAPE; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinPistonHeadBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinPistonHeadBlock.java index e673ca662..4d8849374 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinPistonHeadBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinPistonHeadBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.shape.VoxelShape; @@ -85,7 +85,7 @@ protected MixinPistonHeadBlock(Settings settings) { @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(switch (state.get(PistonHeadBlock.FACING)) { case DOWN -> DOWN_HEAD_SHAPE; case UP -> UP_HEAD_SHAPE; @@ -99,7 +99,7 @@ private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, @Override public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { return switch (state.get(PistonHeadBlock.FACING)) { case DOWN -> VoxelShapes.union(DOWN_HEAD_SHAPE, viaFabricPlus$down_arm_shape_r1_8_x); case UP -> VoxelShapes.union(UP_HEAD_SHAPE, viaFabricPlus$up_arm_shape_r1_8_x); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinSnowBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinSnowBlock.java index 54d65267a..413341896 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinSnowBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinSnowBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.ShapeContext; @@ -59,7 +59,7 @@ public abstract class MixinSnowBlock { @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) private void changeCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(viaFabricPlus$layers_to_shape_r1_12_2[state.get(LAYERS) - 1]); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinSoulSandBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinSoulSandBlock.java index 8e2f17983..2f87addf7 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinSoulSandBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinSoulSandBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.SoulSandBlock; @@ -44,21 +44,21 @@ public MixinSoulSandBlock(Settings settings) { @Inject(method = "getSidesShape", at = @At("HEAD"), cancellable = true) private void changeSidesShape(BlockState state, BlockView world, BlockPos pos, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().betweenInclusive(ProtocolVersion.v1_13, ProtocolVersion.v1_15_2)) { + if (ProtocolTranslator.getTargetVersion().betweenInclusive(ProtocolVersion.v1_13, ProtocolVersion.v1_15_2)) { cir.setReturnValue(VoxelShapes.empty()); } } @Override public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { entity.setVelocity(entity.getVelocity().multiply(0.4D, 1, 0.4D)); } } @Override public float getVelocityMultiplier() { - return ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4) ? 1F : super.getVelocityMultiplier(); + return ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4) ? 1F : super.getVelocityMultiplier(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinWallBlock.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinWallBlock.java index 61fe348f1..b6abd4169 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinWallBlock.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinWallBlock.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import net.minecraft.block.Block; @@ -72,35 +72,35 @@ private void initShapes1_12_2(Settings settings, CallbackInfo ci) { @Inject(method = "getPlacementState", at = @At("RETURN"), cancellable = true) private void modifyPlacementState(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { cir.setReturnValue(viaFabricPlus$oldWallPlacementLogic(cir.getReturnValue())); } } @Inject(method = "getStateForNeighborUpdate", at = @At("RETURN"), cancellable = true) private void modifyBlockState(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { cir.setReturnValue(viaFabricPlus$oldWallPlacementLogic(cir.getReturnValue())); } } @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) private void changeCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (state.get(WallBlock.UP) && ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (state.get(WallBlock.UP) && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(this.viaFabricPlus$collision_shape_r1_12_2[this.viaFabricPlus$getShapeIndex(state)]); } } @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) private void changeOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (state.get(WallBlock.UP) && ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (state.get(WallBlock.UP) && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(this.viaFabricPlus$outline_shape_r1_12_2[this.viaFabricPlus$getShapeIndex(state)]); } } @Override public VoxelShape getCullingShape(BlockState state, BlockView world, BlockPos pos) { - if (state.get(WallBlock.UP) && ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (state.get(WallBlock.UP) && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { return this.shapeMap.get(state); } else { return super.getCullingShape(state, world, pos); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinAbstractClientPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinAbstractClientPlayerEntity.java index 3667c0efc..650482ae8 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinAbstractClientPlayerEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinAbstractClientPlayerEntity.java @@ -21,7 +21,7 @@ import com.mojang.authlib.GameProfile; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.BlockPos; @@ -40,7 +40,7 @@ public MixinAbstractClientPlayerEntity(World world, BlockPos pos, float yaw, Gam @Inject(method = "isCreative", at = @At("HEAD"), cancellable = true) private void fixCreativeCheck(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { cir.setReturnValue(this.getAbilities().creativeMode); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinAbstractHorseEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinAbstractHorseEntity.java index 0b6ecef93..fd302a76c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinAbstractHorseEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinAbstractHorseEntity.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.passive.AbstractHorseEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -37,7 +37,7 @@ public abstract class MixinAbstractHorseEntity { @Redirect(method = "interactHorse", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/AbstractHorseEntity;receiveFood(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/item/ItemStack;)Z")) private boolean decrementFoodItemClientside(AbstractHorseEntity instance, PlayerEntity player, ItemStack item) { - return ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2) || this.receiveFood(player, item); + return ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2) || this.receiveFood(player, item); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinAnimalEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinAnimalEntity.java index d14edac8d..e6023dde2 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinAnimalEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinAnimalEntity.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; @@ -32,7 +32,7 @@ public abstract class MixinAnimalEntity { @Redirect(method = "interactMob", at = @At(value = "FIELD", target = "Lnet/minecraft/world/World;isClient:Z")) private boolean fixIsClientCheck(World instance) { - return instance.isClient && ProtocolHack.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_15); + return instance.isClient && ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_15); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinBoatEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinBoatEntity.java index 607c4f620..33c6efa25 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinBoatEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinBoatEntity.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.fixes.versioned.visual.EntityRidingOffsetsPre1_20_2; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -86,7 +86,7 @@ public MixinBoatEntity(EntityType type, World world) { @Inject(method = "pushAwayFrom", at = @At("HEAD"), cancellable = true) private void pushAwayFrom1_8(Entity entity, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { ci.cancel(); super.pushAwayFrom(entity); } @@ -94,9 +94,9 @@ private void pushAwayFrom1_8(Entity entity, CallbackInfo ci) { @Inject(method = "updateTrackedPositionAndAngles", at = @At("HEAD"), cancellable = true) private void updateTrackedPositionAndAngles1_8(double x, double y, double z, float yaw, float pitch, int interpolationSteps, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { ci.cancel(); - if (/*interpolate &&*/ this.hasPassengers() && ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_7_6)) { + if (/*interpolate &&*/ this.hasPassengers() && ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_7_6)) { this.prevX = x; this.prevY = y; this.prevZ = z; @@ -129,14 +129,14 @@ private void updateTrackedPositionAndAngles1_8(double x, double y, double z, flo public void setVelocityClient(double x, double y, double z) { super.setVelocityClient(x, y, z); - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { this.viaFabricPlus$boatVelocity = new Vec3d(x, y, z); } } @Inject(method = "tick", at = @At("HEAD"), cancellable = true) private void tick1_8(CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { ci.cancel(); super.tick(); @@ -162,7 +162,7 @@ private void tick1_8(CallbackInfo ci) { } final double oldHorizontalSpeed = this.getVelocity().horizontalLength(); - if (oldHorizontalSpeed > (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6) ? 0.2625D : 0.2975D)) { + if (oldHorizontalSpeed > (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6) ? 0.2625D : 0.2975D)) { final double rx = Math.cos(this.getYaw() * Math.PI / 180); final double rz = Math.sin(this.getYaw() * Math.PI / 180); for (int i = 0; i < 1 + oldHorizontalSpeed * 60; i++) { @@ -210,11 +210,11 @@ private void tick1_8(CallbackInfo ci) { if (this.getControllingPassenger() != null) { final LivingEntity passenger = this.getControllingPassenger(); - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_5_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_5_2)) { final double xAcceleration = passenger.getVelocity().x * this.viaFabricPlus$speedMultiplier; final double zAcceleration = passenger.getVelocity().z * this.viaFabricPlus$speedMultiplier; this.setVelocity(this.getVelocity().add(xAcceleration, 0, zAcceleration)); - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { if (passenger.forwardSpeed > 0) { final double xAcceleration = -Math.sin(passenger.getYaw() * Math.PI / 180) * this.viaFabricPlus$speedMultiplier * 0.05D; final double zAcceleration = Math.cos(passenger.getYaw() * Math.PI / 180) * this.viaFabricPlus$speedMultiplier * 0.05D; @@ -247,7 +247,7 @@ private void tick1_8(CallbackInfo ci) { } } - if (ProtocolHack.getTargetVersion().newerThan(LegacyProtocolVersion.r1_6_4)) { + if (ProtocolTranslator.getTargetVersion().newerThan(LegacyProtocolVersion.r1_6_4)) { for (int i = 0; i < 4; i++) { final int dx = MathHelper.floor(this.getX() + ((i % 2) - 0.5D) * 0.8D); //noinspection IntegerDivisionInFloatingPointContext @@ -290,7 +290,7 @@ private void tick1_8(CallbackInfo ci) { @Inject(method = "updatePassengerPosition", at = @At(value = "HEAD"), cancellable = true) private void updatePassengerPosition1_8(Entity passenger, PositionUpdater positionUpdater, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { final Vec3d newPosition = new Vec3d(EntityRidingOffsetsPre1_20_2.getMountedHeightOffset(this, passenger)).add(this.getPos()); positionUpdater.accept(passenger, newPosition.x, newPosition.y + EntityRidingOffsetsPre1_20_2.getHeightOffset(passenger), newPosition.z); ci.cancel(); @@ -299,7 +299,7 @@ private void updatePassengerPosition1_8(Entity passenger, PositionUpdater positi @Inject(method = "onPassengerLookAround", at = @At("HEAD"), cancellable = true) private void onPassengerLookAround1_8(Entity passenger, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { ci.cancel(); super.onPassengerLookAround(passenger); } @@ -307,17 +307,17 @@ private void onPassengerLookAround1_8(Entity passenger, CallbackInfo ci) { @Inject(method = "fall", at = @At("HEAD"), cancellable = true) private void fall1_8(double heightDifference, boolean onGround, BlockState state, BlockPos landedPosition, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { ci.cancel(); super.fall(heightDifference, onGround, state, landedPosition); - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { this.location = BoatEntity.Location.ON_LAND; } } @Inject(method = "canAddPassenger", at = @At("HEAD"), cancellable = true) private void canAddPassenger1_8(Entity passenger, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { cir.setReturnValue(super.canAddPassenger(passenger)); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinCamelEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinCamelEntity.java index 11816cbbd..c2fc40510 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinCamelEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinCamelEntity.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.passive.AbstractHorseEntity; @@ -39,7 +39,7 @@ public MixinCamelEntity(EntityType entityType, Wo @Override public void onPassengerLookAround(Entity passenger) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20) && this.getControllingPassenger() != passenger) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20) && this.getControllingPassenger() != passenger) { this.viaFabricPlus$clampPassengerYaw1_20_1(passenger); } } @@ -48,7 +48,7 @@ public void onPassengerLookAround(Entity passenger) { protected void updatePassengerPosition(Entity passenger, PositionUpdater positionUpdater) { super.updatePassengerPosition(passenger, positionUpdater); - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) { this.viaFabricPlus$clampPassengerYaw1_20_1(passenger); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java index a6fae43cd..10e17e727 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java @@ -25,7 +25,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.api.type.Type; import de.florianmichael.viafabricplus.injection.access.IClientConnection; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.settings.impl.DebugSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.input.Input; @@ -74,17 +74,17 @@ public MixinClientPlayerEntity(ClientWorld world, GameProfile profile) { @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z", ordinal = 0)) private boolean removeVehicleRequirement(ClientPlayerEntity instance) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_20) && instance.hasVehicle(); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_20) && instance.hasVehicle(); } @WrapWithCondition(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendSprintingPacket()V")) private boolean removeSprintingPacket(ClientPlayerEntity instance) { - return ProtocolHack.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_19_3); + return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_19_3); } @Redirect(method = "autoJump", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;inverseSqrt(F)F")) private float useFastInverseSqrt(float x) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3)) { x = Float.intBitsToFloat(1597463007 - (Float.floatToIntBits(x) >> 1)); return x * (1.5F - (0.5F * x) * x * x); } else { @@ -94,22 +94,22 @@ private float useFastInverseSqrt(float x) { @Redirect(method = "canStartSprinting", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z")) private boolean removeVehicleCheck(ClientPlayerEntity instance) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_19_3) && instance.hasVehicle(); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_19_3) && instance.hasVehicle(); } @Redirect(method = "canStartSprinting", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isFallFlying()Z")) private boolean removeFallFlyingCheck(ClientPlayerEntity instance) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_19_3) && instance.isFallFlying(); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_19_3) && instance.isFallFlying(); } @Redirect(method = "canSprint", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z")) private boolean dontAllowSprintingAsPassenger(ClientPlayerEntity instance) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_19_1) && instance.hasVehicle(); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_19_1) && instance.hasVehicle(); } @Redirect(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;square(D)D")) private double changeMagnitude(double n) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) { return 9.0E-4D; } else { return MathHelper.square(n); @@ -118,7 +118,7 @@ private double changeMagnitude(double n) { @Inject(method = "startRiding", at = @At("RETURN")) private void setRotationsWhenInBoat(Entity entity, boolean force, CallbackInfoReturnable cir) { - if (cir.getReturnValueZ() && entity instanceof BoatEntity && ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) { + if (cir.getReturnValueZ() && entity instanceof BoatEntity && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) { this.prevYaw = entity.getYaw(); this.setYaw(entity.getYaw()); this.setHeadYaw(entity.getYaw()); @@ -127,24 +127,24 @@ private void setRotationsWhenInBoat(Entity entity, boolean force, CallbackInfoRe @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isClimbing()Z")) private boolean allowElytraWhenClimbing(ClientPlayerEntity instance) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_15_1) && instance.isClimbing(); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_15_1) && instance.isClimbing(); } @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z", ordinal = 3)) private boolean allowElytraInVehicle(ClientPlayerEntity instance) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_14_4) && instance.hasVehicle(); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_14_4) && instance.hasVehicle(); } @ModifyVariable(method = "tickMovement", at = @At(value = "LOAD", ordinal = 4), ordinal = 4) private boolean removeBl8Boolean(boolean value) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_14_4) && value; + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_14_4) && value; } @Inject(method = "tickMovement()V", slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isCamera()Z")), at = @At(value = "FIELD", target = "Lnet/minecraft/client/input/Input;sneaking:Z", ordinal = 0)) private void injectTickMovement(CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { if (this.input.sneaking) { this.input.movementSideways = (float) ((double) this.input.movementSideways / 0.3D); this.input.movementForward = (float) ((double) this.input.movementForward / 0.3D); @@ -154,14 +154,14 @@ private void injectTickMovement(CallbackInfo ci) { @Inject(method = "isWalking", at = @At("HEAD"), cancellable = true) private void easierUnderwaterSprinting(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_1)) { cir.setReturnValue(((ClientPlayerEntity) (Object) this).input.movementForward >= 0.8); } } @Redirect(method = "tickMovement()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;hasForwardMovement()Z", ordinal = 0)) private boolean disableSprintSneak(Input input) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_1)) { return input.movementForward >= 0.8F; } else { return input.hasForwardMovement(); @@ -172,17 +172,17 @@ private boolean disableSprintSneak(Input input) { slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isWalking()Z")), at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSwimming()Z", ordinal = 0)) private boolean dontAllowSneakingWhileSwimming(ClientPlayerEntity instance) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_14_1) && instance.isSwimming(); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_14_1) && instance.isSwimming(); } @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isTouchingWater()Z")) private boolean disableWaterRelatedMovement(ClientPlayerEntity self) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_12_2) && self.isTouchingWater(); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_12_2) && self.isTouchingWater(); } @Redirect(method = "sendMovementPackets", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;ticksSinceLastPositionPacketSent:I", ordinal = 0)) private int moveLastPosPacketIncrement(ClientPlayerEntity instance) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { return ticksSinceLastPositionPacketSent - 1; // Reverting original operation } else { return ticksSinceLastPositionPacketSent; @@ -191,7 +191,7 @@ private int moveLastPosPacketIncrement(ClientPlayerEntity instance) { @Inject(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z")) private void moveLastPosPacketIncrement(CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { this.ticksSinceLastPositionPacketSent++; } } @@ -207,7 +207,7 @@ private boolean sendIdlePacket(ClientPlayerEntity instance) { @Redirect(method = "tick", slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z")), at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V", ordinal = 0)) private void modifyPositionPacket(ClientPlayNetworkHandler instance, Packet packet) throws Exception { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_5_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_5_2)) { final PacketWrapper playerPosition = PacketWrapper.create(ServerboundPackets1_5_2.PLAYER_POSITION_AND_ROTATION, ((IClientConnection) this.networkHandler.getConnection()).viaFabricPlus$getUserConnection()); playerPosition.write(Type.DOUBLE, this.getVelocity().x); // x playerPosition.write(Type.DOUBLE, -999.0D); // y diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinCowEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinCowEntity.java index e8d713d42..0ba511af7 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinCowEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinCowEntity.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.EntityType; import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.passive.CowEntity; @@ -42,7 +42,7 @@ public MixinCowEntity(EntityType entityType, World world @Inject(method = "interactMob", at = @At("HEAD"), cancellable = true) private void disableMilkingInCreative(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2) && player.getAbilities().creativeMode) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2) && player.getAbilities().creativeMode) { cir.setReturnValue(super.interactMob(player, hand)); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinCreeperEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinCreeperEntity.java index a8e6482da..a28daed08 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinCreeperEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinCreeperEntity.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.mob.CreeperEntity; import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvents; @@ -33,7 +33,7 @@ public abstract class MixinCreeperEntity { @Redirect(method = "interactMob", at = @At(value = "FIELD", target = "Lnet/minecraft/sound/SoundEvents;ITEM_FIRECHARGE_USE:Lnet/minecraft/sound/SoundEvent;")) private SoundEvent changeSound() { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_1)) { return SoundEvents.ITEM_FLINTANDSTEEL_USE; } else { return SoundEvents.ITEM_FIRECHARGE_USE; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntity.java index 40b1e9c9f..786fc1585 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntity.java @@ -22,7 +22,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.fixes.versioned.visual.EntityRidingOffsetsPre1_20_2; import de.florianmichael.viafabricplus.injection.access.IEntity; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.settings.impl.DebugSettings; import it.unimi.dsi.fastutil.objects.Object2DoubleMap; import net.minecraft.block.BlockState; @@ -77,14 +77,14 @@ public abstract class MixinEntity implements IEntity { @Inject(method = "getRidingOffset", at = @At("HEAD"), cancellable = true) private void getRidingOffset1_20_1(Entity vehicle, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) { cir.setReturnValue((float) EntityRidingOffsetsPre1_20_2.getHeightOffset((Entity) (Object) this)); } } @Redirect(method = "getPassengerRidingPos", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getPassengerAttachmentPos(Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/EntityDimensions;F)Lorg/joml/Vector3f;")) private Vector3f getPassengerRidingPos1_20_1(Entity instance, Entity passenger, EntityDimensions dimensions, float scaleFactor) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) { return EntityRidingOffsetsPre1_20_2.getMountedHeightOffset(instance, passenger); } else { return getPassengerAttachmentPos(passenger, dimensions, scaleFactor); @@ -93,9 +93,9 @@ private Vector3f getPassengerRidingPos1_20_1(Entity instance, Entity passenger, @Inject(method = "getPosWithYOffset", at = @At("HEAD"), cancellable = true) private void modifyPosWithYOffset(float offset, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_4)) { int i = MathHelper.floor(this.pos.x); - int j = MathHelper.floor(this.pos.y - (double) (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18_2) && offset == 1.0E-5F ? 0.2F : offset)); + int j = MathHelper.floor(this.pos.y - (double) (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18_2) && offset == 1.0E-5F ? 0.2F : offset)); int k = MathHelper.floor(this.pos.z); BlockPos blockPos = new BlockPos(i, j, k); if (this.world.getBlockState(blockPos).isAir()) { @@ -113,7 +113,7 @@ private void modifyPosWithYOffset(float offset, CallbackInfoReturnable @ModifyConstant(method = "checkBlockCollision", constant = @Constant(doubleValue = 1.0E-7)) private double fixBlockCollisionMargin(double constant) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_1)) { return 1E-3; } else { return constant; @@ -122,7 +122,7 @@ private double fixBlockCollisionMargin(double constant) { @Inject(method = "getVelocityAffectingPos", at = @At("HEAD"), cancellable = true) private void modifyVelocityAffectingPos(CallbackInfoReturnable cir) { - final ProtocolVersion target = ProtocolHack.getTargetVersion(); + final ProtocolVersion target = ProtocolTranslator.getTargetVersion(); if (target.olderThanOrEqualTo(ProtocolVersion.v1_19_4)) { cir.setReturnValue(BlockPos.ofFloored(pos.x, getBoundingBox().minY - (target.olderThanOrEqualTo(ProtocolVersion.v1_14_4) ? 1 : 0.5000001), pos.z)); @@ -131,12 +131,12 @@ private void modifyVelocityAffectingPos(CallbackInfoReturnable cir) { @Redirect(method = {"setYaw", "setPitch"}, at = @At(value = "INVOKE", target = "Ljava/lang/Float;isFinite(F)Z")) private boolean allowInfiniteValues(float f) { - return Float.isFinite(f) || ((Object) this instanceof ClientPlayerEntity && ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)); + return Float.isFinite(f) || ((Object) this instanceof ClientPlayerEntity && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)); } @ModifyConstant(method = "movementInputToVelocity", constant = @Constant(doubleValue = 1E-7)) private static double fixVelocityEpsilon(double epsilon) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { return 1E-4; } else { return epsilon; @@ -145,7 +145,7 @@ private static double fixVelocityEpsilon(double epsilon) { @Redirect(method = "adjustMovementForCollisions(Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Box;Ljava/util/List;)Lnet/minecraft/util/math/Vec3d;", at = @At(value = "INVOKE", target = "Ljava/lang/Math;abs(D)D", ordinal = 0)) private static double alwaysSortYXZ(double a) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { return Double.MAX_VALUE; } else { return Math.abs(a); @@ -154,21 +154,21 @@ private static double alwaysSortYXZ(double a) { @Inject(method = "getRotationVector(FF)Lnet/minecraft/util/math/Vec3d;", at = @At("HEAD"), cancellable = true) private void revertCalculation(float pitch, float yaw, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(Vec3d.fromPolar(pitch, yaw)); } } @Inject(method = "setSwimming", at = @At("HEAD"), cancellable = true) private void cancelSwimming(boolean swimming, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2) && swimming) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2) && swimming) { ci.cancel(); } } @Inject(method = "updateMovementInFluid", at = @At("HEAD"), cancellable = true) private void modifyFluidMovementBoundingBox(TagKey fluidTag, double d, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_12_2)) { return; } @@ -220,7 +220,7 @@ private void modifyFluidMovementBoundingBox(TagKey fluidTag, double d, Ca @Inject(method = "getTargetingMargin", at = @At("HEAD"), cancellable = true) private void expandHitBox(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { cir.setReturnValue(0.1F); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntityIndex.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntityIndex.java index f34d5af2d..78ba6eafa 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntityIndex.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntityIndex.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.world.entity.EntityIndex; import net.minecraft.world.entity.EntityLike; @@ -44,12 +44,12 @@ public abstract class MixinEntityIndex { @Redirect(method = "add", at = @At(value = "INVOKE", target = "Ljava/util/Map;containsKey(Ljava/lang/Object;)Z", remap = false)) private boolean allowDuplicateUuid(Map instance, Object o) { - return instance.containsKey(o) && ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_16_4); + return instance.containsKey(o) && ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_16_4); } @Inject(method = "size", at = @At("HEAD"), cancellable = true) private void returnRealSize(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { cir.setReturnValue(this.idToEntity.size()); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntityRenderDispatcher.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntityRenderDispatcher.java index 7a699f38b..1143e611a 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntityRenderDispatcher.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntityRenderDispatcher.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.fixes.versioned.visual.BoatRenderer1_8; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderer; import net.minecraft.client.render.entity.EntityRendererFactory; @@ -50,7 +50,7 @@ private void createBoatRenderer1_8(ResourceManager manager, CallbackInfo ci, Ent @SuppressWarnings("unchecked") @Inject(method = "getRenderer", at = @At("HEAD"), cancellable = true) private void useBoatRenderer1_8(T entity, CallbackInfoReturnable> ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8) && entity instanceof BoatEntity) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8) && entity instanceof BoatEntity) { ci.setReturnValue((EntityRenderer) viaFabricPlus$boatRenderer); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinItemEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinItemEntity.java index cf068b2cc..03047ea11 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinItemEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinItemEntity.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.ItemEntity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -32,7 +32,7 @@ public abstract class MixinItemEntity { @Inject(method = "applyWaterBuoyancy", at = @At("HEAD"), cancellable = true) private void dontApplyWaterBuoyancy(CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { ci.cancel(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinLivingEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinLivingEntity.java index 4cccf704a..d15a4329e 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinLivingEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinLivingEntity.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.fixes.versioned.visual.EntityRidingOffsetsPre1_20_2; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.settings.impl.DebugSettings; import net.minecraft.block.BlockState; import net.minecraft.block.TrapdoorBlock; @@ -77,14 +77,14 @@ public MixinLivingEntity(EntityType type, World world) { @Inject(method = "getRidingOffset", at = @At("HEAD"), cancellable = true) private void getRidingOffset1_20_1(Entity vehicle, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) { cir.setReturnValue((float) EntityRidingOffsetsPre1_20_2.getHeightOffset(this)); } } @Redirect(method = "getPassengerRidingPos", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getPassengerAttachmentPos(Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/EntityDimensions;F)Lorg/joml/Vector3f;")) private Vector3f getPassengerRidingPos1_20_1(LivingEntity instance, Entity entity, EntityDimensions entityDimensions, float v) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) { return EntityRidingOffsetsPre1_20_2.getMountedHeightOffset(instance, entity); } else { return getPassengerAttachmentPos(entity, entityDimensions, v); @@ -93,7 +93,7 @@ private Vector3f getPassengerRidingPos1_20_1(LivingEntity instance, Entity entit @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isLogicalSideForUpdatingMovement()Z")) private boolean allowPlayerToBeMovedByEntityPackets(LivingEntity instance) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3) || ProtocolHack.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3) || ProtocolTranslator.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) { return instance.getControllingPassenger() instanceof PlayerEntity player ? player.isMainPlayer() : !instance.getWorld().isClient; } else { return instance.isLogicalSideForUpdatingMovement(); @@ -109,7 +109,7 @@ private void preventEntityPush(CallbackInfo ci) { @Redirect(method = "travel", at = @At(value = "INVOKE", target = "Ljava/lang/Math;cos(D)D", remap = false)) private double fixCosTable(double a) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) { return MathHelper.cos((float) a); } else { return Math.cos(a); @@ -118,7 +118,7 @@ private double fixCosTable(double a) { @Redirect(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getFluidHeight(Lnet/minecraft/registry/tag/TagKey;)D")) private double dontApplyLavaMovement(LivingEntity instance, TagKey tagKey) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { return Double.MAX_VALUE; } else { return instance.getFluidHeight(tagKey); @@ -127,7 +127,7 @@ private double dontApplyLavaMovement(LivingEntity instance, TagKey tagKey @Redirect(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;isChunkLoaded(Lnet/minecraft/util/math/BlockPos;)Z")) private boolean modify1_13LoadedCheck(World instance, BlockPos blockPos) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { return this.getWorld().isChunkLoaded(blockPos) && instance.getChunkManager().isChunkLoaded(blockPos.getX() >> 4, blockPos.getZ() >> 4); } else { return this.getWorld().isChunkLoaded(blockPos); @@ -136,36 +136,36 @@ private boolean modify1_13LoadedCheck(World instance, BlockPos blockPos) { @Redirect(method = "applyMovementInput", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;jumping:Z")) private boolean disableJumpOnLadder(LivingEntity self) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_13_2) && jumping; + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_13_2) && jumping; } @Redirect(method = "travel", slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;DOLPHINS_GRACE:Lnet/minecraft/entity/effect/StatusEffect;")), at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;horizontalCollision:Z", ordinal = 0)) private boolean disableClimbing(LivingEntity instance) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_13_2) && instance.horizontalCollision; + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_13_2) && instance.horizontalCollision; } @ModifyVariable(method = "applyFluidMovingSpeed", ordinal = 0, at = @At("HEAD"), argsOnly = true) private boolean modifyMovingDown(boolean movingDown) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_13_2) && movingDown; + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_13_2) && movingDown; } @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;onLanding()V")) private void dontResetLevitationFallDistance(LivingEntity instance) { - if (this.hasStatusEffect(StatusEffects.SLOW_FALLING) || ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_12_2)) { + if (this.hasStatusEffect(StatusEffects.SLOW_FALLING) || ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_12_2)) { instance.onLanding(); } } @Redirect(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isSprinting()Z", ordinal = 0)) private boolean modifySwimSprintSpeed(LivingEntity instance) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_12_2) && instance.isSprinting(); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_12_2) && instance.isSprinting(); } @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getFluidHeight(Lnet/minecraft/registry/tag/TagKey;)D")) private double redirectFluidHeight(LivingEntity instance, TagKey tagKey) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2) && tagKey == FluidTags.WATER) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2) && tagKey == FluidTags.WATER) { if (instance.getFluidHeight(tagKey) > 0) return 1; } return instance.getFluidHeight(tagKey); @@ -173,14 +173,14 @@ private double redirectFluidHeight(LivingEntity instance, TagKey tagKey) @Inject(method = "applyFluidMovingSpeed", at = @At("HEAD"), cancellable = true) private void modifySwimSprintFallSpeed(double gravity, boolean movingDown, Vec3d velocity, CallbackInfoReturnable ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2) && !this.hasNoGravity()) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2) && !this.hasNoGravity()) { ci.setReturnValue(new Vec3d(velocity.x, velocity.y - 0.02, velocity.z)); } } @ModifyConstant(method = "travel", constant = @Constant(floatValue = 0.9F)) private float modifySwimFriction(float constant) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { return this.getBaseMovementSpeedMultiplier(); } else { return constant; @@ -189,14 +189,14 @@ private float modifySwimFriction(float constant) { @Inject(method = "getPreferredEquipmentSlot", at = @At("HEAD"), cancellable = true) private static void removeShieldSlotPreference(ItemStack stack, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_9_3) && stack.isOf(Items.SHIELD)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_9_3) && stack.isOf(Items.SHIELD)) { cir.setReturnValue(EquipmentSlot.MAINHAND); } } @ModifyConstant(method = "tickMovement", constant = @Constant(doubleValue = 0.003D)) private double modifyVelocityZero(final double constant) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { return 0.005D; } else { return constant; @@ -205,28 +205,28 @@ private double modifyVelocityZero(final double constant) { @Inject(method = "canEnterTrapdoor", at = @At("HEAD"), cancellable = true) private void disableCrawling(CallbackInfoReturnable ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { ci.setReturnValue(false); } } @Inject(method = "", at = @At("RETURN")) private void modify1_7StepHeight(EntityType type, World world, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) { this.setStepHeight(0.5F); } } @Inject(method = "tickMovement", at = @At("HEAD")) private void removeJumpDelay1_0(CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThan(LegacyProtocolVersion.r1_0_0tor1_0_1)) { + if (ProtocolTranslator.getTargetVersion().olderThan(LegacyProtocolVersion.r1_0_0tor1_0_1)) { this.jumpingCooldown = 0; } } @Inject(method = "isClimbing", at = @At("RETURN"), cancellable = true) private void allowGappedLadderClimb(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThan(LegacyProtocolVersion.b1_5tob1_5_2) && !cir.getReturnValueZ() && !this.isSpectator()) { + if (ProtocolTranslator.getTargetVersion().olderThan(LegacyProtocolVersion.b1_5tob1_5_2) && !cir.getReturnValueZ() && !this.isSpectator()) { final BlockPos blockPos = this.getBlockPos().up(); final BlockState blockState = this.getWorld().getBlockState(blockPos); if (blockState.isIn(BlockTags.CLIMBABLE)) { diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinOtherClientPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinOtherClientPlayerEntity.java index 45879edfa..14be1c28a 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinOtherClientPlayerEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinOtherClientPlayerEntity.java @@ -21,7 +21,7 @@ import com.mojang.authlib.GameProfile; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.network.OtherClientPlayerEntity; import net.minecraft.client.world.ClientWorld; @@ -39,7 +39,7 @@ public MixinOtherClientPlayerEntity(ClientWorld world, GameProfile profile) { @Inject(method = "updatePose", at = @At("HEAD")) private void onUpdatePose(CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { super.updatePose(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java index d500b21a3..453bc2fdf 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java @@ -23,7 +23,7 @@ import com.llamalad7.mixinextras.sugar.Local; import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.settings.impl.VisualSettings; import net.minecraft.block.BlockState; import net.minecraft.enchantment.EnchantmentHelper; @@ -80,7 +80,7 @@ protected MixinPlayerEntity(EntityType entityType, World @Redirect(method = "getMaxRelativeHeadRotation", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isBlocking()Z")) private boolean dontModifyHeadRotationWhenBlocking(PlayerEntity instance) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_20_2) && instance.isBlocking(); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_20_2) && instance.isBlocking(); } @Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;setMovementSpeed(F)V")) @@ -90,7 +90,7 @@ private void storeSprintingState(CallbackInfo ci) { @Redirect(method = "getOffGroundSpeed", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isSprinting()Z")) private boolean useLastSprintingState(PlayerEntity instance) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3)) { return viaFabricPlus$isSprinting; } else { return instance.isSprinting(); @@ -99,17 +99,17 @@ private boolean useLastSprintingState(PlayerEntity instance) { @WrapWithCondition(method = "dropItem(Lnet/minecraft/item/ItemStack;ZZ)Lnet/minecraft/entity/ItemEntity;", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V")) private boolean dontSwingHand(PlayerEntity instance, Hand hand) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_15_2); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_15_2); } @Redirect(method = "checkFallFlying", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;hasStatusEffect(Lnet/minecraft/entity/effect/StatusEffect;)Z")) private boolean allowElytraWhenLevitating(PlayerEntity instance, StatusEffect statusEffect) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_15_2) && instance.hasStatusEffect(statusEffect); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_15_2) && instance.hasStatusEffect(statusEffect); } @Inject(method = "checkFallFlying", at = @At("HEAD"), cancellable = true) private void replaceFallFlyingCondition(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { if (!this.isOnGround() && this.getVelocity().y < 0D && !this.isFallFlying()) { final ItemStack itemStack = this.getEquippedStack(EquipmentSlot.CHEST); if (itemStack.isOf(Items.ELYTRA) && ElytraItem.isUsable(itemStack)) { @@ -123,7 +123,7 @@ private void replaceFallFlyingCondition(CallbackInfoReturnable cir) { @ModifyConstant(method = "getActiveEyeHeight", constant = @Constant(floatValue = 1.27f)) private float modifySneakEyeHeight(float prevEyeHeight) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { return 1.54F; } else { return prevEyeHeight; @@ -132,7 +132,7 @@ private float modifySneakEyeHeight(float prevEyeHeight) { @Inject(method = "updatePose", at = @At("HEAD"), cancellable = true) private void onUpdatePose(CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { final EntityPose pose; if (this.isFallFlying()) { pose = EntityPose.FALL_FLYING; @@ -155,9 +155,9 @@ private void onUpdatePose(CallbackInfo ci) { @Inject(method = "getDimensions", at = @At("HEAD"), cancellable = true) private void modifyDimensions(EntityPose pose, CallbackInfoReturnable cir) { if (pose == EntityPose.CROUCHING) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { cir.setReturnValue(PlayerEntity.STANDING_DIMENSIONS); - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { cir.setReturnValue(viaFabricPlus$sneaking_dimensions_v1_13_2); } } @@ -165,7 +165,7 @@ private void modifyDimensions(EntityPose pose, CallbackInfoReturnable ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { ci.setReturnValue(1F); } } @@ -193,11 +193,11 @@ private void changeSpeedCalculation(BlockState block, CallbackInfoReturnable 1F || ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_6tor1_4_7)) { + } else if (speed > 1F || ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_6tor1_4_7)) { if (!this.getMainHandStack().isEmpty()) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) { if (speed <= 1.0 && !this.canHarvest(block)) { f.set(speed + effLevel * 0.08F); } else { @@ -211,7 +211,7 @@ private void changeSpeedCalculation(BlockState block, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThan(LegacyProtocolVersion.r1_0_0tor1_0_1) && !creative) { + if (ProtocolTranslator.getTargetVersion().olderThan(LegacyProtocolVersion.r1_0_0tor1_0_1) && !creative) { cir.setReturnValue(4F); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntityRenderer.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntityRenderer.java index e07ab4642..985166d3b 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntityRenderer.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntityRenderer.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.render.entity.PlayerEntityRenderer; import net.minecraft.entity.EntityPose; @@ -41,13 +41,13 @@ private void modifySleepingOffset(AbstractClientPlayerEntity player, float delta if (player.getPose() == EntityPose.SLEEPING) { final Direction sleepingDir = player.getSleepingDirection(); if (sleepingDir != null) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { cir.setReturnValue(cir.getReturnValue().subtract(sleepingDir.getOffsetX() * 0.4, 0, sleepingDir.getOffsetZ() * 0.4)); } - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_5tob1_5_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_5tob1_5_2)) { cir.setReturnValue(cir.getReturnValue().subtract(sleepingDir.getOffsetX() * 0.1, 0, sleepingDir.getOffsetZ() * 0.1)); } - if (ProtocolHack.getTargetVersion().betweenInclusive(LegacyProtocolVersion.b1_6tob1_6_6, ProtocolVersion.v1_7_6)) { + if (ProtocolTranslator.getTargetVersion().betweenInclusive(LegacyProtocolVersion.b1_6tob1_6_6, ProtocolVersion.v1_7_6)) { cir.setReturnValue(cir.getReturnValue().subtract(0, 0.3F, 0)); } } @@ -57,7 +57,7 @@ private void modifySleepingOffset(AbstractClientPlayerEntity player, float delta @Redirect(method = "getPositionOffset(Lnet/minecraft/client/network/AbstractClientPlayerEntity;F)Lnet/minecraft/util/math/Vec3d;", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;isInSneakingPose()Z")) private boolean disableSneakPositionOffset(AbstractClientPlayerEntity player) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_11_1) && player.isInSneakingPose(); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_11_1) && player.isInSneakingPose(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinSkeletonHorseEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinSkeletonHorseEntity.java index cdfad71b2..5a5e0da23 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinSkeletonHorseEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinSkeletonHorseEntity.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.EntityType; import net.minecraft.entity.mob.SkeletonHorseEntity; import net.minecraft.entity.passive.AbstractHorseEntity; @@ -39,7 +39,7 @@ protected MixinSkeletonHorseEntity(EntityType ent @Inject(method = "getBaseMovementSpeedMultiplier", at = @At("HEAD"), cancellable = true) private void modifyBaseMovementSpeedMultiplier(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(super.getBaseMovementSpeedMultiplier()); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinSquidEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinSquidEntity.java index 600030418..1c741ad2d 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinSquidEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinSquidEntity.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.passive.SquidEntity; import net.minecraft.entity.player.PlayerEntity; import org.spongepowered.asm.mixin.Mixin; @@ -33,7 +33,7 @@ public abstract class MixinSquidEntity { @Inject(method = "canBeLeashedBy", at = @At("HEAD"), cancellable = true) private void cancelLeashing(PlayerEntity player, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { cir.setReturnValue(false); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinWolfEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinWolfEntity.java index 20938fe38..e1068f8c0 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinWolfEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinWolfEntity.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.fixes.tracker.WolfHealthTracker; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.EntityType; import net.minecraft.entity.mob.Angerable; import net.minecraft.entity.passive.TameableEntity; @@ -58,7 +58,7 @@ protected MixinWolfEntity(EntityType entityType, World @Inject(method = "interactMob", at = @At("HEAD"), cancellable = true) private void fixWolfInteract(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { final ItemStack itemStack = player.getStackInHand(hand); final Item item = itemStack.getItem(); if (this.isTamed()) { @@ -90,7 +90,7 @@ private void fixWolfInteract(PlayerEntity player, Hand hand, CallbackInfoReturna @Redirect(method = "*", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/WolfEntity;getHealth()F")) private float fixWolfHealth(WolfEntity instance) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) { return this.viaFabricPlus$getWolfHealth(); } else { return instance.getHealth(); @@ -99,7 +99,7 @@ private float fixWolfHealth(WolfEntity instance) { @Unique private float viaFabricPlus$getWolfHealth() { - return WolfHealthTracker.get(ProtocolHack.getPlayNetworkUserConnection()).getWolfHealth(this.getId(), this.getHealth()); + return WolfHealthTracker.get(ProtocolTranslator.getPlayNetworkUserConnection()).getWolfHealth(this.getId(), this.getHealth()); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinArmorItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinArmorItem.java index bd437baab..90be9acb6 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinArmorItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinArmorItem.java @@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ArmorItem; import net.minecraft.item.ItemStack; @@ -38,7 +38,7 @@ public abstract class MixinArmorItem { @Inject(method = "use", at = @At("HEAD"), cancellable = true) private void disableRightClick(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable> cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_6tor1_4_7)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_6tor1_4_7)) { cir.setReturnValue(new TypedActionResult<>(ActionResult.FAIL, user.getStackInHand(hand))); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinAxeItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinAxeItem.java index 3565e6e24..a1b72dc7d 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinAxeItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinAxeItem.java @@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableSet; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.fixes.data.Material1_19_4; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -56,7 +56,7 @@ public MixinAxeItem(float attackDamage, float attackSpeed, ToolMaterial material @Override public boolean isSuitableFor(BlockState state) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { return false; } else { return super.isSuitableFor(state); @@ -65,16 +65,16 @@ public boolean isSuitableFor(BlockState state) { @Inject(method = "useOnBlock", at = @At("HEAD"), cancellable = true) private void disableUse(ItemUsageContext context, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(ActionResult.PASS); } } @Override public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { return viaFabricPlus$effective_blocks_b1_8_1.contains(state.getBlock()) ? this.miningSpeed : 1.0F; - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { return viaFabricPlus$effective_materials_r1_16_5.contains(Material1_19_4.getMaterial(state)) ? this.miningSpeed : viaFabricPlus$effective_blocks_r1_16_5.contains(state.getBlock()) ? this.miningSpeed : 1.0F; } else { return super.getMiningSpeedMultiplier(stack, state); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinBlockItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinBlockItem.java index 4c650e7f0..3d64f8dd9 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinBlockItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinBlockItem.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -41,7 +41,7 @@ public abstract class MixinBlockItem { @Inject(method = "canPlace", at = @At("HEAD"), cancellable = true) private void checkChestPlacement(ItemPlacementContext context, BlockState state, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { Block block = state.getBlock(); if (block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST) { World world = context.getWorld(); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinBowItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinBowItem.java index 057674f48..5adf275cc 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinBowItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinBowItem.java @@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BowItem; import net.minecraft.item.ItemStack; @@ -38,21 +38,21 @@ public abstract class MixinBowItem { @Inject(method = "getMaxUseTime", at = @At("HEAD"), cancellable = true) private void makeInstantUsable(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_7tob1_7_3)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_7tob1_7_3)) { cir.setReturnValue(0); } } @Inject(method = "getUseAction", at = @At("HEAD"), cancellable = true) private void makeInstantUsable2(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_7tob1_7_3)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_7tob1_7_3)) { cir.setReturnValue(UseAction.NONE); } } @Inject(method = "use", at = @At("HEAD"), cancellable = true) private void makeInstantUsable(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable> cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_7tob1_7_3)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_7tob1_7_3)) { final ItemStack stack = user.getStackInHand(hand); final ItemStack arrowStack = user.getProjectileType(stack); if (arrowStack.isEmpty()) { diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinBrushItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinBrushItem.java index ecf23acdd..76fcf7df5 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinBrushItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinBrushItem.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BrushItem; import org.spongepowered.asm.mixin.Mixin; @@ -32,7 +32,7 @@ public abstract class MixinBrushItem { @Redirect(method = "getHitResult", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;getReachDistance(Z)F")) private float modifyReachDistance(boolean creative) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) { return 5F; } else { return PlayerEntity.getReachDistance(creative); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinEnderPearlItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinEnderPearlItem.java index 584e4f067..d1dea2158 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinEnderPearlItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinEnderPearlItem.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnderPearlItem; import net.minecraft.item.ItemStack; @@ -37,7 +37,7 @@ public abstract class MixinEnderPearlItem { @Inject(method = "use", at = @At("HEAD"), cancellable = true) private void removeCreativeModeEnderPearl(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable> ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8) && user.getAbilities().creativeMode) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8) && user.getAbilities().creativeMode) { ci.setReturnValue(TypedActionResult.pass(user.getStackInHand(hand))); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinEquipment.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinEquipment.java index 4f73fa469..db3b7530c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinEquipment.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinEquipment.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.mob.MobEntity; import net.minecraft.entity.player.PlayerEntity; @@ -41,12 +41,12 @@ public interface MixinEquipment { @Redirect(method = "equipAndSwap", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isCreative()Z")) default boolean removeCreativeCondition(PlayerEntity instance) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_20) && instance.isCreative(); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_20) && instance.isCreative(); } @Inject(method = "equipAndSwap", at = @At("HEAD"), cancellable = true) private void cancelArmorSwap(Item item, World world, PlayerEntity user, Hand hand, CallbackInfoReturnable> cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3)) { final ItemStack heldItem = user.getStackInHand(hand); final EquipmentSlot targetSlot = MobEntity.getPreferredEquipmentSlot(heldItem); final ItemStack targetItem = user.getEquippedStack(targetSlot); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinFireworkRocketItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinFireworkRocketItem.java index 109f072c5..2dfaac3d6 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinFireworkRocketItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinFireworkRocketItem.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.FireworkRocketItem; import org.spongepowered.asm.mixin.Mixin; @@ -32,7 +32,7 @@ public abstract class MixinFireworkRocketItem { @Redirect(method = "use", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isFallFlying()Z", ordinal = 0)) private boolean disableFireworkElytraBoost(PlayerEntity player) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_11) && player.isFallFlying(); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_11) && player.isFallFlying(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinHoeItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinHoeItem.java index a9658aab2..816cba0c9 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinHoeItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinHoeItem.java @@ -21,7 +21,7 @@ import com.google.common.collect.ImmutableSet; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -62,14 +62,14 @@ protected MixinHoeItem(float attackDamage, float attackSpeed, ToolMaterial mater @Override public boolean isSuitableFor(BlockState state) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_16_4) && super.isSuitableFor(state); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_16_4) && super.isSuitableFor(state); } @Override public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { return 1.0F; - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { return viaFabricPlus$effective_blocks_r1_16_5.contains(state.getBlock()) ? this.miningSpeed : 1.0F; } else { return super.getMiningSpeedMultiplier(stack, state); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItem.java index 1be6c8421..822bcfbaf 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItem.java @@ -21,7 +21,7 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.item.CrossbowItem; import net.minecraft.item.Item; import net.raphimc.vialegacy.api.LegacyProtocolVersion; @@ -45,7 +45,7 @@ public abstract class MixinItem { @Redirect(method = {"getMaxDamage", "isDamageable", "getItemBarStep", "getItemBarColor"}, at = @At(value = "FIELD", target = "Lnet/minecraft/item/Item;maxDamage:I")) private int changeCrossbowDamage(Item instance) { - if (instance instanceof CrossbowItem && ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_17_1)) { + if (instance instanceof CrossbowItem && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_17_1)) { return 326; } else { return maxDamage; @@ -54,14 +54,14 @@ private int changeCrossbowDamage(Item instance) { @Inject(method = "getMaxCount", at = @At("HEAD"), cancellable = true) private void dontStackFood(CallbackInfoReturnable cir) { - if (this.isFood() && ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_7tob1_7_3)) { + if (this.isFood() && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_7tob1_7_3)) { cir.setReturnValue(1); } } @ModifyExpressionValue(method = {"use", "finishUsing", "getUseAction", "getMaxUseTime"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;isFood()Z")) private boolean makeFoodInstantConsumable(boolean original) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_7tob1_7_3)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_7tob1_7_3)) { return false; } else { return original; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemGroups.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemGroups.java index 3d78e0f95..3836b2ad6 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemGroups.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemGroups.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.settings.impl.GeneralSettings; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroups; @@ -53,8 +53,8 @@ private static void updateEntries(ItemGroup.DisplayContext displayContext) { @Inject(method = "updateDisplayContext", at = @At("HEAD"), cancellable = true) private static void trackLastVersion(FeatureSet enabledFeatures, boolean operatorEnabled, RegistryWrapper.WrapperLookup lookup, CallbackInfoReturnable cir) { - if (viaFabricPlus$version != ProtocolHack.getTargetVersion() || viaFabricPlus$state != GeneralSettings.global().removeNotAvailableItemsFromCreativeTab.getIndex()) { - viaFabricPlus$version = ProtocolHack.getTargetVersion(); + if (viaFabricPlus$version != ProtocolTranslator.getTargetVersion() || viaFabricPlus$state != GeneralSettings.global().removeNotAvailableItemsFromCreativeTab.getIndex()) { + viaFabricPlus$version = ProtocolTranslator.getTargetVersion(); viaFabricPlus$state = GeneralSettings.global().removeNotAvailableItemsFromCreativeTab.getIndex(); displayContext = new ItemGroup.DisplayContext(enabledFeatures, operatorEnabled, lookup); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemPlacementContext.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemPlacementContext.java index 52b303593..29c374db8 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemPlacementContext.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemPlacementContext.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.fixes.data.Material1_19_4; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.entity.player.PlayerEntity; @@ -48,9 +48,9 @@ private void getPlayerLookDirection1_12_2(CallbackInfoReturnable cir) final ItemPlacementContext self = (ItemPlacementContext) (Object) this; final PlayerEntity player = self.getPlayer(); - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { final BlockPos placementPos = self.getBlockPos(); - final double blockPosCenterFactor = ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_10) ? 0.5 : 0; + final double blockPosCenterFactor = ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_10) ? 0.5 : 0; if (Math.abs(player.getX() - (placementPos.getX() + blockPosCenterFactor)) < 2 && Math.abs(player.getZ() - (placementPos.getZ() + blockPosCenterFactor)) < 2) { final double eyeY = player.getY() + player.getEyeHeight(player.getPose()); @@ -72,7 +72,7 @@ private void getPlayerLookDirection1_12_2(CallbackInfoReturnable cir) @Inject(method = "canPlace", at = @At("RETURN"), cancellable = true) private void canPlace1_12_2(CallbackInfoReturnable cir) { - if (!cir.getReturnValueZ() && ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (!cir.getReturnValueZ() && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { cir.setReturnValue(Material1_19_4.getMaterial(this.getWorld().getBlockState(this.getBlockPos())).equals(Material1_19_4.DECORATION) && Block.getBlockFromItem(this.getStack().getItem()).equals(Blocks.ANVIL)); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemStack.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemStack.java index 4d5b7c018..3a4536d50 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemStack.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemStack.java @@ -23,7 +23,7 @@ import com.google.common.collect.Multimap; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.injection.access.IItemStack; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.settings.impl.DebugSettings; import net.minecraft.entity.attribute.EntityAttribute; import net.minecraft.entity.attribute.EntityAttributeModifier; @@ -54,7 +54,7 @@ public abstract class MixinItemStack implements IItemStack { slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/attribute/EntityAttributes;GENERIC_ATTACK_DAMAGE:Lnet/minecraft/entity/attribute/EntityAttribute;", ordinal = 0)), at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;getAttributeBaseValue(Lnet/minecraft/entity/attribute/EntityAttribute;)D", ordinal = 0)) private double fixDamageCalculation(PlayerEntity player, EntityAttribute attribute) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { return 0; } else { return player.getAttributeBaseValue(attribute); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinPickaxeItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinPickaxeItem.java index 5ed918604..970b68f24 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinPickaxeItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinPickaxeItem.java @@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableSet; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.fixes.data.Material1_19_4; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.fabricmc.yarn.constants.MiningLevels; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -59,7 +59,7 @@ protected MixinPickaxeItem(float attackDamage, float attackSpeed, ToolMaterial m @Override public boolean isSuitableFor(BlockState state) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { final int miningLevel = this.getMaterial().getMiningLevel(); if (state.isOf(Blocks.OBSIDIAN) || state.isOf(Blocks.CRYING_OBSIDIAN) || state.isOf(Blocks.NETHERITE_BLOCK) || state.isOf(Blocks.RESPAWN_ANCHOR) || state.isOf(Blocks.ANCIENT_DEBRIS)) { return miningLevel >= MiningLevels.DIAMOND; @@ -77,11 +77,11 @@ public boolean isSuitableFor(BlockState state) { @Override public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { return viaFabricPlus$effective_blocks_b1_8_1.contains(state.getBlock()) ? this.miningSpeed : 1.0F; - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { return viaFabricPlus$effective_materials_r1_16_5.contains(Material1_19_4.getMaterial(state)) ? this.miningSpeed : viaFabricPlus$effective_blocks_r1_15_2.contains(state.getBlock()) ? this.miningSpeed : 1.0F; - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { return viaFabricPlus$effective_materials_r1_16_5.contains(Material1_19_4.getMaterial(state)) ? this.miningSpeed : viaFabricPlus$effective_blocks_r1_16_5.contains(state.getBlock()) ? this.miningSpeed : 1.0F; } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinShearsItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinShearsItem.java index 1f70926e4..8f5450e86 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinShearsItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinShearsItem.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.item.Item; @@ -42,7 +42,7 @@ public MixinShearsItem(Settings settings) { @Inject(method = "getMiningSpeedMultiplier", at = @At("HEAD"), cancellable = true) private void changeMiningSpeed(ItemStack stack, BlockState state, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { if (!state.isOf(Blocks.COBWEB) && !state.isIn(BlockTags.LEAVES)) { cir.setReturnValue(state.isIn(BlockTags.WOOL) ? 5.0F : super.getMiningSpeedMultiplier(stack, state)); } else { @@ -53,7 +53,7 @@ private void changeMiningSpeed(ItemStack stack, BlockState state, CallbackInfoRe @Inject(method = "isSuitableFor", at = @At("HEAD"), cancellable = true) private void changeEffectiveBlocks(BlockState state, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { cir.setReturnValue(state.isOf(Blocks.COBWEB)); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinShovelItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinShovelItem.java index 0dca4e422..e7b0d3969 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinShovelItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinShovelItem.java @@ -21,7 +21,7 @@ import com.google.common.collect.ImmutableSet; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -52,7 +52,7 @@ protected MixinShovelItem(float attackDamage, float attackSpeed, ToolMaterial ma @Override public boolean isSuitableFor(BlockState state) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { return state.isOf(Blocks.SNOW) || state.isOf(Blocks.SNOW_BLOCK); } else { return super.isSuitableFor(state); @@ -61,7 +61,7 @@ public boolean isSuitableFor(BlockState state) { @Redirect(method = "useOnBlock", slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/item/ShovelItem;PATH_STATES:Ljava/util/Map;")), at = @At(value = "INVOKE", target = "Ljava/util/Map;get(Ljava/lang/Object;)Ljava/lang/Object;", ordinal = 0, remap = false)) private Object disablePathAction(Map instance, Object grassBlock) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { return null; } else { return instance.get(grassBlock); @@ -70,9 +70,9 @@ private Object disablePathAction(Map instance, Object grassBlock @Override public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { return viaFabricPlus$effective_blocks_b1_8_1.contains(state.getBlock()) ? this.miningSpeed : 1.0F; - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) { return viaFabricPlus$effective_blocks_r1_16_5.contains(state.getBlock()) ? this.miningSpeed : 1.0F; } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinSwordItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinSwordItem.java index e8f05a8ca..136de7b8b 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinSwordItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinSwordItem.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.entity.player.PlayerEntity; @@ -47,7 +47,7 @@ public MixinSwordItem(ToolMaterial material, Settings settings) { @Override public TypedActionResult use(World world, PlayerEntity user, Hand hand) { - if (ProtocolHack.getTargetVersion().betweenInclusive(LegacyProtocolVersion.b1_8tob1_8_1, ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().betweenInclusive(LegacyProtocolVersion.b1_8tob1_8_1, ProtocolVersion.v1_8)) { ItemStack itemStack = user.getStackInHand(hand); user.setCurrentHand(hand); return TypedActionResult.consume(itemStack); @@ -58,7 +58,7 @@ public TypedActionResult use(World world, PlayerEntity user, Hand han @Override public UseAction getUseAction(ItemStack stack) { - if (ProtocolHack.getTargetVersion().betweenInclusive(LegacyProtocolVersion.b1_8tob1_8_1, ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().betweenInclusive(LegacyProtocolVersion.b1_8tob1_8_1, ProtocolVersion.v1_8)) { return UseAction.BLOCK; } else { return super.getUseAction(stack); @@ -67,7 +67,7 @@ public UseAction getUseAction(ItemStack stack) { @Override public int getMaxUseTime(ItemStack stack) { - if (ProtocolHack.getTargetVersion().betweenInclusive(LegacyProtocolVersion.b1_8tob1_8_1, ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().betweenInclusive(LegacyProtocolVersion.b1_8tob1_8_1, ProtocolVersion.v1_8)) { return 72000; } else { return super.getMaxUseTime(stack); @@ -76,7 +76,7 @@ public int getMaxUseTime(ItemStack stack) { @Inject(method = "getMiningSpeedMultiplier", at = @At("HEAD"), cancellable = true) private void changeMiningSpeed(ItemStack stack, BlockState state, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) { cir.setReturnValue(state.isOf(Blocks.COBWEB) ? 15.0F : 1.5F); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientCommonNetworkHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientCommonNetworkHandler.java index 26fc228bd..c305d3dcf 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientCommonNetworkHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientCommonNetworkHandler.java @@ -23,7 +23,7 @@ import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.storage.InventoryAcknowledgements; import de.florianmichael.viafabricplus.fixes.ClientsideFixes; import de.florianmichael.viafabricplus.injection.access.IClientConnection; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.fabricmc.fabric.impl.networking.payload.ResolvablePayload; import net.fabricmc.fabric.impl.networking.payload.UntypedPayload; import net.minecraft.client.MinecraftClient; @@ -75,7 +75,7 @@ private static URL getParsedResourcePackUrl(String url) { @Redirect(method = "onKeepAlive", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientCommonNetworkHandler;send(Lnet/minecraft/network/packet/Packet;Ljava/util/function/BooleanSupplier;Ljava/time/Duration;)V")) private void forceSendKeepAlive(ClientCommonNetworkHandler instance, Packet packet, BooleanSupplier sendCondition, Duration expiry) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3)) { sendPacket(packet); } else { send(packet, sendCondition, expiry); @@ -84,7 +84,7 @@ private void forceSendKeepAlive(ClientCommonNetworkHandler instance, Packet> 16) & 0xFF); @@ -112,7 +112,7 @@ private void handleSyncTask(CustomPayloadS2CPacket packet, CallbackInfo ci) { @Inject(method = "onResourcePackSend", at = @At("HEAD"), cancellable = true) private void validateUrlInNetworkThread(ResourcePackSendS2CPacket packet, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) { if (getParsedResourcePackUrl(packet.url()) == null) { this.connection.send(new ResourcePackStatusC2SPacket(packet.id(), ResourcePackStatusC2SPacket.Status.INVALID_URL)); ci.cancel(); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientConfigurationNetworkHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientConfigurationNetworkHandler.java index 3d48adce2..3bad9cabb 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientConfigurationNetworkHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientConfigurationNetworkHandler.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.network; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.util.ChatUtil; import net.minecraft.client.network.ClientConfigurationNetworkHandler; import net.minecraft.network.packet.s2c.config.FeaturesS2CPacket; @@ -37,7 +37,7 @@ public abstract class MixinClientConfigurationNetworkHandler { @Inject(method = "onFeatures", at = @At(value = "HEAD")) private void notifyAboutFeatures(FeaturesS2CPacket packet, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThan(ProtocolVersion.v1_20) && packet.features().contains(new Identifier("update_1_20"))) { + if (ProtocolTranslator.getTargetVersion().olderThan(ProtocolVersion.v1_20) && packet.features().contains(new Identifier("update_1_20"))) { ChatUtil.sendPrefixedMessage(Text.literal("This server has the update_1_20 features enabled. This is not fully supported and may cause issues.").formatted(Formatting.RED)); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientLoginNetworkHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientLoginNetworkHandler.java index 39c289d5c..b9dd1f62f 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientLoginNetworkHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientLoginNetworkHandler.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.network; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.network.ClientLoginNetworkHandler; import net.minecraft.network.ClientConnection; import org.spongepowered.asm.mixin.Mixin; @@ -32,7 +32,7 @@ public abstract class MixinClientLoginNetworkHandler { @Redirect(method = "onCompression", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;setCompressionThreshold(IZ)V")) private void pre1_17_1CompressionBehaviour(ClientConnection instance, int compressionThreshold, boolean rejectsBadPackets) { - instance.setCompressionThreshold(compressionThreshold, ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_17)); + instance.setCompressionThreshold(compressionThreshold, ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_17)); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayNetworkHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayNetworkHandler.java index 4e5937a97..3d05eb861 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayNetworkHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayNetworkHandler.java @@ -24,7 +24,7 @@ import de.florianmichael.viafabricplus.fixes.data.recipe.RecipeInfo; import de.florianmichael.viafabricplus.fixes.data.recipe.Recipes1_11_2; import de.florianmichael.viafabricplus.injection.access.IDownloadingTerrainScreen; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.*; @@ -79,29 +79,29 @@ protected MixinClientPlayNetworkHandler(MinecraftClient client, ClientConnection @WrapWithCondition(method = "onChatMessage", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;)V", remap = false)) private boolean removeChatPacketError(Logger instance, String s, Object o) { - return ProtocolHack.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_20_2); + return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_20_2); } @Redirect(method = "handlePlayerListAction", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;onGameModeChanged(Lnet/minecraft/world/GameMode;)V")) private void dontResetVelocity(ClientPlayerEntity instance, GameMode gameMode) { - if (ProtocolHack.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_20)) { + if (ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_20)) { instance.onGameModeChanged(gameMode); } } @WrapWithCondition(method = "setPublicSession", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false)) private boolean removeInvalidSignatureWarning(Logger instance, String s, Object o) { - return ProtocolHack.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_19_4); + return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_19_4); } @WrapWithCondition(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false)) private boolean removeUnknownPlayerListEntryWarning(Logger instance, String s, Object object1, Object object2) { - return ProtocolHack.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_19_3); + return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_19_3); } @Redirect(method = {"onEntityPosition", "onEntity"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;isLogicalSideForUpdatingMovement()Z")) private boolean allowPlayerToBeMovedByEntityPackets(Entity instance) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3) || ProtocolHack.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3) || ProtocolTranslator.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) { return instance.getControllingPassenger() instanceof PlayerEntity player ? player.isMainPlayer() : !instance.getWorld().isClient; } else { return instance.isLogicalSideForUpdatingMovement(); @@ -110,7 +110,7 @@ private boolean allowPlayerToBeMovedByEntityPackets(Entity instance) { @Inject(method = "", at = @At("RETURN")) private void fixPlayerListOrdering(MinecraftClient client, ClientConnection clientConnection, ClientConnectionState clientConnectionState, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_1)) { this.listedPlayerListEntries = new LinkedHashSet<>(); } } @@ -122,14 +122,14 @@ private boolean removeSecureChatWarning(ClientPlayNetworkHandler instance) { @Inject(method = "onPlayerSpawnPosition", at = @At("RETURN")) private void moveDownloadingTerrainClosing(PlayerSpawnPositionS2CPacket packet, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().betweenInclusive(ProtocolVersion.v1_18_2, ProtocolVersion.v1_20_2) && this.client.currentScreen instanceof IDownloadingTerrainScreen mixinDownloadingTerrainScreen) { + 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 (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18) && this.client.currentScreen instanceof IDownloadingTerrainScreen mixinDownloadingTerrainScreen) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18) && this.client.currentScreen instanceof IDownloadingTerrainScreen mixinDownloadingTerrainScreen) { mixinDownloadingTerrainScreen.viaFabricPlus$setReady(); } } @@ -137,7 +137,7 @@ private void closeDownloadingTerrain(PlayerPositionLookS2CPacket packet, Callbac @SuppressWarnings({"InvalidInjectorMethodSignature"}) @ModifyConstant(method = "onEntityPassengersSet", constant = @Constant(classValue = BoatEntity.class)) private Class dontChangeYawWhenMountingBoats(Object entity, Class boatClass) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) { return Integer.class; // Dummy class file to false the instanceof check } else { return boatClass; @@ -146,15 +146,15 @@ private Class dontChangeYawWhenMountingBoats(Object entity, Class boatClas @Inject(method = "onChunkLoadDistance", at = @At("RETURN")) private void emulateSimulationDistance(ChunkLoadDistanceS2CPacket packet, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_17_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_17_1)) { this.onSimulationDistance(new SimulationDistanceS2CPacket(packet.getDistance())); } } @Redirect(method = "onEntityPosition", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;updateTrackedPositionAndAngles(DDDFFI)V")) private void cancelSmallChanges(Entity instance, double x, double y, double z, float yaw, float pitch, int interpolationSteps) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_1) && Math.abs(instance.getX() - x) < 0.03125 && Math.abs(instance.getY() - y) < 0.015625 && Math.abs(instance.getZ() - z) < 0.03125) { - instance.updateTrackedPositionAndAngles(instance.getX(), instance.getY(), instance.getZ(), yaw, pitch, ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2) ? 0 : interpolationSteps); + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_1) && Math.abs(instance.getX() - x) < 0.03125 && Math.abs(instance.getY() - y) < 0.015625 && Math.abs(instance.getZ() - z) < 0.03125) { + instance.updateTrackedPositionAndAngles(instance.getX(), instance.getY(), instance.getZ(), yaw, pitch, ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2) ? 0 : interpolationSteps); } else { instance.updateTrackedPositionAndAngles(x, y, z, yaw, pitch, interpolationSteps); } @@ -162,15 +162,15 @@ private void cancelSmallChanges(Entity instance, double x, double y, double z, f @Inject(method = "onGameJoin", at = @At("RETURN")) private void sendAdditionalData(CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { final List> recipes = new ArrayList<>(); - final List recipeInfos = Recipes1_11_2.getRecipes(ProtocolHack.getTargetVersion()); + final List recipeInfos = Recipes1_11_2.getRecipes(ProtocolTranslator.getTargetVersion()); for (int i = 0; i < recipeInfos.size(); i++) { recipes.add(recipeInfos.get(i).create(new Identifier("viafabricplus", "recipe/" + i))); } this.onSynchronizeRecipes(new SynchronizeRecipesS2CPacket(recipes)); - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { this.onEntityStatus(new EntityStatusS2CPacket(this.client.player, (byte) 28)); // Op-level 4 } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayerInteractionManager.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayerInteractionManager.java index 029866a9b..6302e7659 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayerInteractionManager.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayerInteractionManager.java @@ -31,9 +31,9 @@ import de.florianmichael.viafabricplus.injection.access.IClientConnection; import de.florianmichael.viafabricplus.injection.access.IClientPlayerInteractionManager; import de.florianmichael.viafabricplus.injection.access.IScreenHandler; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; -import de.florianmichael.viafabricplus.protocolhack.impl.provider.viaversion.ViaFabricPlusHandItemProvider; -import de.florianmichael.viafabricplus.protocolhack.translator.ItemTranslator; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; +import de.florianmichael.viafabricplus.protocoltranslator.impl.provider.viaversion.ViaFabricPlusHandItemProvider; +import de.florianmichael.viafabricplus.protocoltranslator.translator.ItemTranslator; import de.florianmichael.viafabricplus.settings.impl.VisualSettings; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -110,21 +110,21 @@ public abstract class MixinClientPlayerInteractionManager implements IClientPlay @Inject(method = "getBlockBreakingProgress", at = @At("HEAD"), cancellable = true) private void changeCalculation(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_4)) { cir.setReturnValue((int) (this.currentBreakingProgress * 10.0F) - 1); } } @Inject(method = "sendSequencedPacket", at = @At("HEAD")) private void trackPlayerAction(ClientWorld world, SequencedPacketCreator packetCreator, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().betweenInclusive(ProtocolVersion.v1_14_4, ProtocolVersion.v1_18_2) && packetCreator instanceof PlayerActionC2SPacket playerActionC2SPacket) { + if (ProtocolTranslator.getTargetVersion().betweenInclusive(ProtocolVersion.v1_14_4, ProtocolVersion.v1_18_2) && packetCreator instanceof PlayerActionC2SPacket playerActionC2SPacket) { this.viaFabricPlus$1_18_2InteractionManager.trackPlayerAction(playerActionC2SPacket.getAction(), playerActionC2SPacket.getPos()); } } @Redirect(method = {"attackBlock", "cancelBlockBreaking"}, at = @At(value = "NEW", target = "(Lnet/minecraft/network/packet/c2s/play/PlayerActionC2SPacket$Action;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;)Lnet/minecraft/network/packet/c2s/play/PlayerActionC2SPacket;")) private PlayerActionC2SPacket trackPlayerAction(PlayerActionC2SPacket.Action action, BlockPos pos, Direction direction) { - if (ProtocolHack.getTargetVersion().betweenInclusive(ProtocolVersion.v1_14_4, ProtocolVersion.v1_18_2)) { + if (ProtocolTranslator.getTargetVersion().betweenInclusive(ProtocolVersion.v1_14_4, ProtocolVersion.v1_18_2)) { this.viaFabricPlus$1_18_2InteractionManager.trackPlayerAction(action, pos); } return new PlayerActionC2SPacket(action, pos, direction); @@ -132,7 +132,7 @@ private PlayerActionC2SPacket trackPlayerAction(PlayerActionC2SPacket.Action act @WrapWithCondition(method = "interactItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V", ordinal = 0)) private boolean redirectPlayerPosPacket(ClientPlayNetworkHandler instance, Packet packet) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_16_4); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_16_4); } @ModifyVariable(method = "clickSlot", at = @At(value = "STORE"), ordinal = 0) @@ -143,7 +143,7 @@ private List captureOldItems(List oldItems) { @WrapWithCondition(method = "clickSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V")) private boolean handleWindowClick1_16_5(ClientPlayNetworkHandler instance, Packet packet) throws Exception { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4) && packet instanceof ClickSlotC2SPacket clickSlot) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4) && packet instanceof ClickSlotC2SPacket clickSlot) { ItemStack slotItemBeforeModification; if (this.viaFabricPlus$shouldBeEmpty(clickSlot.getActionType(), clickSlot.getSlot())) { slotItemBeforeModification = ItemStack.EMPTY; @@ -172,7 +172,7 @@ private boolean handleWindowClick1_16_5(ClientPlayNetworkHandler instance, Packe @Redirect(method = {"method_41936", "method_41935"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;breakBlock(Lnet/minecraft/util/math/BlockPos;)Z")) private boolean checkFireBlock(ClientPlayerInteractionManager instance, BlockPos pos, @Local Direction direction) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { return !this.viaFabricPlus$extinguishFire(pos, direction) && instance.breakBlock(pos); } else { return instance.breakBlock(pos); @@ -181,14 +181,14 @@ private boolean checkFireBlock(ClientPlayerInteractionManager instance, BlockPos @Inject(method = "breakBlock", at = @At("TAIL")) private void resetBlockBreaking(BlockPos pos, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_3)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_3)) { this.currentBreakingPos = new BlockPos(this.currentBreakingPos.getX(), -1, this.currentBreakingPos.getZ()); } } @Inject(method = "interactBlockInternal", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;isEmpty()Z", ordinal = 2, shift = At.Shift.BEFORE)) private void interactBlock1_12_2(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { final ItemStack itemStack = player.getStackInHand(hand); BlockHitResult checkHitResult = hitResult; if (itemStack.getItem() instanceof BlockItem) { @@ -227,21 +227,21 @@ private void interactBlock1_12_2(ClientPlayerEntity player, Hand hand, BlockHitR @Inject(method = "method_41929", at = @At("HEAD")) private void trackLastUsedItem(Hand hand, PlayerEntity playerEntity, MutableObject mutableObject, int sequence, CallbackInfoReturnable> cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { ViaFabricPlusHandItemProvider.lastUsedItem = playerEntity.getStackInHand(hand).copy(); } } @Inject(method = "interactItem", at = @At("HEAD"), cancellable = true) private void cancelOffHandItemInteract(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8) && !Hand.MAIN_HAND.equals(hand)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8) && !Hand.MAIN_HAND.equals(hand)) { cir.setReturnValue(ActionResult.PASS); } } @Inject(method = "interactBlock", at = @At("HEAD"), cancellable = true) private void cancelOffHandBlockPlace(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8) && !Hand.MAIN_HAND.equals(hand)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8) && !Hand.MAIN_HAND.equals(hand)) { cir.setReturnValue(ActionResult.PASS); } } @@ -252,7 +252,7 @@ private void cancelOffHandBlockPlace(ClientPlayerEntity player, Hand hand, Block */ @Overwrite private Packet method_41933(MutableObject mutableObject, ClientPlayerEntity clientPlayerEntity, Hand hand, BlockHitResult blockHitResult, int sequence) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { ViaFabricPlusHandItemProvider.lastUsedItem = clientPlayerEntity.getStackInHand(hand).copy(); } try { @@ -274,12 +274,12 @@ private void catchPacketCancelException(ClientPlayerInteractionManager instance, @Inject(method = "clickSlot", at = @At("HEAD"), cancellable = true) private void removeClickActions(int syncId, int slotId, int button, SlotActionType actionType, PlayerEntity player, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_5tob1_5_2) && !actionType.equals(SlotActionType.PICKUP)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_5tob1_5_2) && !actionType.equals(SlotActionType.PICKUP)) { ci.cancel(); - } else if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_6tor1_4_7) && !actionType.equals(SlotActionType.PICKUP) && !actionType.equals(SlotActionType.QUICK_MOVE) && !actionType.equals(SlotActionType.SWAP) && !actionType.equals(SlotActionType.CLONE)) { + } else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_6tor1_4_7) && !actionType.equals(SlotActionType.PICKUP) && !actionType.equals(SlotActionType.QUICK_MOVE) && !actionType.equals(SlotActionType.SWAP) && !actionType.equals(SlotActionType.CLONE)) { ci.cancel(); } - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8) && actionType == SlotActionType.SWAP && button == 40) { // Pressing 'F' in inventory + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8) && actionType == SlotActionType.SWAP && button == 40) { // Pressing 'F' in inventory ci.cancel(); } } @@ -311,7 +311,7 @@ private void removeExperienceBar(CallbackInfoReturnable cir) { if (type == SlotActionType.THROW) return true; // quick move always uses empty stack for verification since 1.12 - if (type == SlotActionType.QUICK_MOVE && ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_11_1)) return true; + if (type == SlotActionType.QUICK_MOVE && ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_11_1)) return true; // pickup with slot -999 (outside window) to throw items always uses empty stack for verification return type == SlotActionType.PICKUP && slot == -999; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinCustomPayloadS2CPacket.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinCustomPayloadS2CPacket.java index 0fd6d5f46..0f2f0ba9c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinCustomPayloadS2CPacket.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinCustomPayloadS2CPacket.java @@ -21,7 +21,7 @@ import com.google.common.collect.ImmutableMap; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.network.PacketByteBuf; import net.minecraft.network.packet.BrandCustomPayload; import net.minecraft.network.packet.CustomPayload; @@ -50,12 +50,12 @@ public abstract class MixinCustomPayloadS2CPacket { @Redirect(method = "readPayload", at = @At(value = "INVOKE", target = "Ljava/util/Map;get(Ljava/lang/Object;)Ljava/lang/Object;", remap = false)) private static Object filterAllowedCustomPayloads(Map instance, Object identifier) { if (instance.containsKey(identifier)) { - if (!viaFabricPlus$PAYLOAD_DIFF.containsKey(identifier) || ProtocolHack.getTargetVersion().olderThan(viaFabricPlus$PAYLOAD_DIFF.get(identifier))) { + if (!viaFabricPlus$PAYLOAD_DIFF.containsKey(identifier) || ProtocolTranslator.getTargetVersion().olderThan(viaFabricPlus$PAYLOAD_DIFF.get(identifier))) { return null; } final PacketByteBuf.PacketReader reader = (PacketByteBuf.PacketReader) instance.get(identifier); - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) { return (PacketByteBuf.PacketReader) packetByteBuf -> { final CustomPayload result = reader.apply(packetByteBuf); packetByteBuf.skipBytes(packetByteBuf.readableBytes()); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinPacketByteBuf.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinPacketByteBuf.java index 8530753c7..72887488d 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinPacketByteBuf.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinPacketByteBuf.java @@ -22,7 +22,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.fixes.ClientsideFixes; import de.florianmichael.viafabricplus.injection.access.IItemStack; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; @@ -36,7 +36,7 @@ public abstract class MixinPacketByteBuf { @Redirect(method = "readItemStack", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;setNbt(Lnet/minecraft/nbt/NbtCompound;)V")) private void removeViaFabricPlusTag(ItemStack instance, NbtCompound tag) { - if (tag != null && tag.contains(ClientsideFixes.ITEM_COUNT_NBT_TAG, NbtElement.BYTE_TYPE) && ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_10)) { + if (tag != null && tag.contains(ClientsideFixes.ITEM_COUNT_NBT_TAG, NbtElement.BYTE_TYPE) && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_10)) { final IItemStack mixinItemStack = ((IItemStack) (Object) instance); mixinItemStack.viaFabricPlus$set1_10Count(tag.getByte(ClientsideFixes.ITEM_COUNT_NBT_TAG)); tag.remove(ClientsideFixes.ITEM_COUNT_NBT_TAG); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinUpdatePlayerAbilitiesC2SPacket.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinUpdatePlayerAbilitiesC2SPacket.java index 32551edbd..5c527619a 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinUpdatePlayerAbilitiesC2SPacket.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinUpdatePlayerAbilitiesC2SPacket.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.network; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.entity.player.PlayerAbilities; import net.minecraft.network.PacketByteBuf; import net.minecraft.network.packet.c2s.play.UpdatePlayerAbilitiesC2SPacket; @@ -44,7 +44,7 @@ private void capturePlayerAbilities(PlayerAbilities abilities, CallbackInfo ci) @Redirect(method = "write", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/PacketByteBuf;writeByte(I)Lnet/minecraft/network/PacketByteBuf;")) private PacketByteBuf implementFlags(PacketByteBuf instance, int value) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { if (viaFabricPlus$abilities.invulnerable) value |= 1; if (viaFabricPlus$abilities.allowFlying) value |= 4; if (viaFabricPlus$abilities.creativeMode) value |= 8; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinAbstractCommandBlockScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinAbstractCommandBlockScreen.java index 0d4665020..775045dc7 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinAbstractCommandBlockScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinAbstractCommandBlockScreen.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.gui.screen.ChatInputSuggestor; import net.minecraft.client.gui.screen.ingame.AbstractCommandBlockScreen; import org.spongepowered.asm.mixin.Mixin; @@ -32,7 +32,7 @@ public abstract class MixinAbstractCommandBlockScreen { @Redirect(method = "*", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ChatInputSuggestor;refresh()V")) private void cancelAutoComplete(ChatInputSuggestor instance) { - if (ProtocolHack.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_13)) { + if (ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_13)) { instance.refresh(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinAbstractSignEditScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinAbstractSignEditScreen.java index 8c075ad26..6452af008 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinAbstractSignEditScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinAbstractSignEditScreen.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.entity.SignBlockEntity; import net.minecraft.client.gui.screen.ingame.AbstractSignEditScreen; import org.spongepowered.asm.mixin.Final; @@ -39,7 +39,7 @@ public abstract class MixinAbstractSignEditScreen { @Inject(method = "canEdit", at = @At("HEAD"), cancellable = true) private void dontCloseTooFarAwaySigns(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_4)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_4)) { cir.setReturnValue(this.blockEntity.getType().supports(this.blockEntity.getCachedState())); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinBookEditScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinBookEditScreen.java index 6dd64ff55..892cf22be 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinBookEditScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinBookEditScreen.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.gui.screen.ingame.BookEditScreen; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.Constant; @@ -31,7 +31,7 @@ public abstract class MixinBookEditScreen { @ModifyConstant(method = "method_27596", constant = @Constant(intValue = 1024)) private int modifyPageLength(int constant) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { return 256; } else { return constant; @@ -40,7 +40,7 @@ private int modifyPageLength(int constant) { @ModifyConstant(method = "appendNewPage", constant = @Constant(intValue = 100)) private int modifyPageCount(int constant) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { return 50; } else { return constant; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinChatScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinChatScreen.java index 83280eaeb..976cdff5b 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinChatScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinChatScreen.java @@ -22,7 +22,7 @@ import com.llamalad7.mixinextras.injector.WrapWithCondition; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.fixes.ClientsideFixes; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.gui.hud.ChatHud; import net.minecraft.client.gui.hud.MessageIndicator; @@ -65,12 +65,12 @@ private MessageIndicator removeIndicator(ChatHud instance, double mouseX, double @WrapWithCondition(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/TextFieldWidget;setText(Ljava/lang/String;)V")) public boolean moveSetTextDown(TextFieldWidget instance, String text) { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_12_2); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_12_2); } @Inject(method = "init", at = @At("RETURN")) private void moveSetTextDown(CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { this.chatField.setText(this.originalChatText); this.chatInputSuggestor.refresh(); } @@ -92,7 +92,7 @@ private boolean disableAutoTabComplete(ChatInputSuggestor instance) { @Unique private boolean viaFabricPlus$keepTabComplete() { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_12_2) || !this.chatField.getText().startsWith("/"); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_12_2) || !this.chatField.getText().startsWith("/"); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinConnectScreen_1.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinConnectScreen_1.java index b776d5fd5..f44598355 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinConnectScreen_1.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinConnectScreen_1.java @@ -28,7 +28,7 @@ import de.florianmichael.viafabricplus.ViaFabricPlus; import de.florianmichael.viafabricplus.injection.access.IClientConnection; import de.florianmichael.viafabricplus.injection.access.ILegacyKeySignatureStorage; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ServerAddress; import net.minecraft.network.ClientConnection; @@ -62,7 +62,7 @@ public abstract class MixinConnectScreen_1 { @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/net/InetSocketAddress;getHostName()Ljava/lang/String;", remap = false)) private String getRealAddress(InetSocketAddress instance) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_17)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_17)) { return field_33737.getAddress(); } else { return instance.getHostName(); @@ -71,7 +71,7 @@ private String getRealAddress(InetSocketAddress instance) { @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/net/InetSocketAddress;getPort()I", remap = false)) private int getRealPort(InetSocketAddress instance) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_17)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_17)) { return field_33737.getPort(); } else { return instance.getPort(); @@ -82,7 +82,7 @@ private int getRealPort(InetSocketAddress instance) { private void setupConnectionSessions(CallbackInfo ci, @Local ClientConnection clientConnection) { final UserConnection userConnection = ((IClientConnection) clientConnection).viaFabricPlus$getUserConnection(); - if (ProtocolHack.getTargetVersion().betweenInclusive(ProtocolVersion.v1_19, ProtocolVersion.v1_19_1)) { + if (ProtocolTranslator.getTargetVersion().betweenInclusive(ProtocolVersion.v1_19, ProtocolVersion.v1_19_1)) { final PlayerKeyPair keyPair = MinecraftClient.getInstance().getProfileKeys().fetchKeyPair().join().orElse(null); if (keyPair != null) { final PlayerPublicKey.PublicKeyData publicKeyData = keyPair.publicKey().data(); @@ -92,7 +92,7 @@ private void setupConnectionSessions(CallbackInfo ci, @Local ClientConnection cl final UUID uuid = this.field_33738.getSession().getUuidOrNull(); userConnection.put(new ChatSession1_19_1(uuid, privateKey, new ProfileKey(expiresAt, publicKey, publicKeyData.keySignature()))); - if (ProtocolHack.getTargetVersion() == ProtocolVersion.v1_19) { + if (ProtocolTranslator.getTargetVersion() == ProtocolVersion.v1_19) { final var legacyKeySignature = ((ILegacyKeySignatureStorage) (Object) publicKeyData).viafabricplus$getLegacyPublicKeySignature(); if (legacyKeySignature != null) { userConnection.put(new ChatSession1_19_0(uuid, privateKey, new ProfileKey(expiresAt, publicKey, legacyKeySignature))); @@ -101,7 +101,7 @@ private void setupConnectionSessions(CallbackInfo ci, @Local ClientConnection cl } else { ViaFabricPlus.global().getLogger().error("Could not get public key signature. Joining servers with enforce-secure-profiles enabled will not work!"); } - } else if (ProtocolHack.getTargetVersion() == BedrockProtocolVersion.bedrockLatest) { + } else if (ProtocolTranslator.getTargetVersion() == BedrockProtocolVersion.bedrockLatest) { final var bedrockSession = ViaFabricPlus.global().getSaveManager().getAccountsSave().refreshAndGetBedrockAccount(); if (bedrockSession != null) { final StepMCChain.MCChain mcChain = bedrockSession.getMcChain(); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinDownloadingTerrainScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinDownloadingTerrainScreen.java index fae57d8e2..d28836f38 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinDownloadingTerrainScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinDownloadingTerrainScreen.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.injection.access.IDownloadingTerrainScreen; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.gui.screen.DownloadingTerrainScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.network.packet.c2s.common.KeepAliveC2SPacket; @@ -57,15 +57,15 @@ public MixinDownloadingTerrainScreen(Text title) { @Inject(method = "tick", at = @At("HEAD"), cancellable = true) private void modifyCloseCondition(CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) { ci.cancel(); - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) { if (this.viaFabricPlus$ready) { this.close(); } - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) { this.viaFabricPlus$tickCounter++; if (this.viaFabricPlus$tickCounter % 20 == 0) { this.client.getNetworkHandler().sendPacket(new KeepAliveC2SPacket(0)); @@ -84,7 +84,7 @@ private void modifyCloseCondition(CallbackInfo ci) { this.close(); } } else { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_1)) { this.viaFabricPlus$closeOnNextTick = this.viaFabricPlus$ready || System.currentTimeMillis() > this.loadStartTime + 2000; } else { this.viaFabricPlus$closeOnNextTick = this.viaFabricPlus$ready; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen.java index da8060109..18c0a8b39 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.gui.screen.GameModeSelectionScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.text.Text; @@ -51,11 +51,11 @@ public MixinGameModeSelectionScreen(Text title) { @Inject(method = "", at = @At("RETURN")) private void fixUIWidth(CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) { final var gameModeSelections = new ArrayList<>(Arrays.stream(GameModeSelectionScreen.GameModeSelection.values()).toList()); gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.SPECTATOR); - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_2_4tor1_2_5)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_2_4tor1_2_5)) { gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.ADVENTURE); } @@ -66,7 +66,7 @@ private void fixUIWidth(CallbackInfo ci) { @Redirect(method = "init", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;VALUES:[Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;")) private GameModeSelectionScreen.GameModeSelection[] removeNewerGameModes() { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) { return viaFabricPlus$unwrappedGameModes; } else { return GameModeSelectionScreen.GameModeSelection.values(); @@ -75,7 +75,7 @@ private GameModeSelectionScreen.GameModeSelection[] removeNewerGameModes() { @Inject(method = "init", at = @At("HEAD")) private void disableInClassic(CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { // survival mode was added in a1.0.15 + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { // survival mode was added in a1.0.15 this.close(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen_GameModeSelection.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen_GameModeSelection.java index 9b69f053e..893a87250 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen_GameModeSelection.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen_GameModeSelection.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.GameModeSelectionScreen; import net.raphimc.vialegacy.api.LegacyProtocolVersion; @@ -45,11 +45,11 @@ public abstract class MixinGameModeSelectionScreen_GameModeSelection { @Inject(method = "next", at = @At("HEAD"), cancellable = true) private void unwrapGameModes(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) { switch ((GameModeSelectionScreen.GameModeSelection) (Object) this) { case CREATIVE -> cir.setReturnValue(SURVIVAL); case SURVIVAL -> { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_2_4tor1_2_5)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_2_4tor1_2_5)) { cir.setReturnValue(CREATIVE); } else { cir.setReturnValue(GameModeSelectionScreen.GameModeSelection.ADVENTURE); @@ -62,7 +62,7 @@ private void unwrapGameModes(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_2_4tor1_2_5)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_2_4tor1_2_5)) { cir.setReturnValue( "gamemode " + MinecraftClient.getInstance().getSession().getUsername() + ' ' + switch (((Enum) (Object) this).ordinal()) { case 0, 3 -> 1; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinJigsawBlockScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinJigsawBlockScreen.java index b586071fd..064a6f8dc 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinJigsawBlockScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinJigsawBlockScreen.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.settings.impl.VisualSettings; import net.minecraft.block.entity.JigsawBlockEntity; import net.minecraft.client.gui.DrawContext; @@ -61,7 +61,7 @@ public MixinJigsawBlockScreen(Text title) { @Inject(method = "init", at = @At("RETURN")) private void disableWidgets(CallbackInfo ci) { if (VisualSettings.global().removeNewerFeaturesFromJigsawScreen.isEnabled()) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { nameField.active = false; jointRotationButton.active = false; int index = children().indexOf(jointRotationButton); @@ -77,7 +77,7 @@ private void disableWidgets(CallbackInfo ci) { @Inject(method = "render", at = @At("HEAD")) private void copyText(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { - if (VisualSettings.global().removeNewerFeaturesFromJigsawScreen.isEnabled() && ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { + if (VisualSettings.global().removeNewerFeaturesFromJigsawScreen.isEnabled() && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { nameField.setText(targetField.getText()); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinMouseOptionsScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinMouseOptionsScreen.java index 3ee6219c1..56ec7fe04 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinMouseOptionsScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinMouseOptionsScreen.java @@ -20,8 +20,8 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; -import de.florianmichael.viafabricplus.protocolhack.util.MathUtil; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; +import de.florianmichael.viafabricplus.protocoltranslator.util.MathUtil; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.option.GameOptionsScreen; @@ -47,7 +47,7 @@ public MixinMouseOptionsScreen(Screen parent, GameOptions gameOptions, Text titl @Inject(method = "render", at = @At("RETURN")) private void render1_13SliderValue(DrawContext drawContext, int mouseX, int mouseY, float delta, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2) && this.buttonList.getWidgetFor(this.gameOptions.getMouseSensitivity()).isHovered()) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2) && this.buttonList.getWidgetFor(this.gameOptions.getMouseSensitivity()).isHovered()) { drawContext.drawTooltip(textRenderer, Text.of("<=1.13.2 Sensitivity: " + MathUtil.get1_13SliderValue(this.gameOptions.getMouseSensitivity().getValue().floatValue()).valueInt() + "%"), mouseX, mouseY); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinScreen.java index adfec91eb..ef9b37b04 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinScreen.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.SharedConstants; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; @@ -41,7 +41,7 @@ public abstract class MixinScreen { @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 (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19)) { this.client.player.networkHandler.sendChatMessage(SharedConstants.stripInvalidChars(style.getClickEvent().getValue())); cir.setReturnValue(true); } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinStructureBlockScreen_1.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinStructureBlockScreen_1.java index 79a6707bb..9cf9eb9c9 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinStructureBlockScreen_1.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinStructureBlockScreen_1.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.text.Text; @@ -38,7 +38,7 @@ public MixinStructureBlockScreen_1(TextRenderer textRenderer, int x, int y, int @Inject(method = "charTyped(CI)Z", at = @At("HEAD"), cancellable = true) private void removeValidation(char chr, int keyCode, CallbackInfoReturnable ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { ci.setReturnValue(super.charTyped(chr, keyCode)); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinAbstractFurnaceScreenHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinAbstractFurnaceScreenHandler.java index 6ccb49ba9..554e7f032 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinAbstractFurnaceScreenHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinAbstractFurnaceScreenHandler.java @@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen.screenhandler; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.item.ItemStack; import net.minecraft.screen.AbstractFurnaceScreenHandler; import net.raphimc.vialegacy.api.LegacyProtocolVersion; @@ -39,12 +39,12 @@ public abstract class MixinAbstractFurnaceScreenHandler { @Redirect(method = "quickMove", at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/AbstractFurnaceScreenHandler;isSmeltable(Lnet/minecraft/item/ItemStack;)Z")) private boolean disableShiftClickSmeltingSlot(AbstractFurnaceScreenHandler instance, ItemStack itemStack) { - return this.isSmeltable(itemStack) && ProtocolHack.getTargetVersion().newerThan(LegacyProtocolVersion.r1_2_1tor1_2_3); + return this.isSmeltable(itemStack) && ProtocolTranslator.getTargetVersion().newerThan(LegacyProtocolVersion.r1_2_1tor1_2_3); } @Redirect(method = "quickMove", at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/AbstractFurnaceScreenHandler;isFuel(Lnet/minecraft/item/ItemStack;)Z")) private boolean disableShiftClickFuelSlot(AbstractFurnaceScreenHandler instance, ItemStack itemStack) { - return this.isFuel(itemStack) && ProtocolHack.getTargetVersion().newerThan(LegacyProtocolVersion.r1_2_1tor1_2_3); + return this.isFuel(itemStack) && ProtocolTranslator.getTargetVersion().newerThan(LegacyProtocolVersion.r1_2_1tor1_2_3); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinBrewingStandScreenHandler_FuelSlot.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinBrewingStandScreenHandler_FuelSlot.java index 6ed9526be..aca2e1fa5 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinBrewingStandScreenHandler_FuelSlot.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinBrewingStandScreenHandler_FuelSlot.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen.screenhandler; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.inventory.Inventory; import net.minecraft.screen.slot.Slot; import org.spongepowered.asm.mixin.Mixin; @@ -37,14 +37,14 @@ public MixinBrewingStandScreenHandler_FuelSlot(Inventory inventory, int index, i @Inject(method = "matches(Lnet/minecraft/item/ItemStack;)Z", at = @At("HEAD"), cancellable = true) private static void removeFuelSlot(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { cir.setReturnValue(false); } } @Override public boolean isEnabled() { - return ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_8); + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_8); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinCraftingScreenHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinCraftingScreenHandler.java index 44db022d8..484ebfc65 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinCraftingScreenHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinCraftingScreenHandler.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.fixes.data.recipe.Recipes1_11_2; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.inventory.Inventory; import net.minecraft.inventory.RecipeInputInventory; import net.minecraft.item.ItemStack; @@ -49,12 +49,12 @@ public MixinCraftingScreenHandler(ScreenHandlerType screenHandlerType, int i) @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 ProtocolHack.getTargetVersion().newerThan(ProtocolVersion.v1_14_4) && this.insertItem(itemStack, startIndex, endIndex, 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 (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { Recipes1_11_2.setCraftingResultSlot(syncId, this, input); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinMerchantScreenHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinMerchantScreenHandler.java index 7339c7b77..f566406f1 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinMerchantScreenHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinMerchantScreenHandler.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen.screenhandler; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.network.ClientPlayerInteractionManager; @@ -58,7 +58,7 @@ protected MixinMerchantScreenHandler(@Nullable ScreenHandlerType type, int sy @Inject(method = "switchTo", at = @At("HEAD"), cancellable = true) private void onSwitchTo(int recipeId, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { ci.cancel(); if (recipeId >= this.getRecipes().size()) return; @@ -90,7 +90,7 @@ private void onSwitchTo(int recipeId, CallbackInfo ci) { @Inject(method = "canInsertIntoSlot", at = @At("HEAD"), cancellable = true) private void modifyCanInsertIntoSlot(ItemStack stack, Slot slot, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { cir.setReturnValue(true); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinPlayerScreenHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinPlayerScreenHandler.java index ebce3cb36..f2cd35f9c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinPlayerScreenHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinPlayerScreenHandler.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.fixes.data.recipe.Recipes1_11_2; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.inventory.CraftingInventory; import net.minecraft.inventory.Inventory; import net.minecraft.inventory.RecipeInputInventory; @@ -51,7 +51,7 @@ public MixinPlayerScreenHandler(ScreenHandlerType screenHandlerType, int i) { @Inject(method = "onContentChanged", at = @At("HEAD")) private void clientSideCrafting(Inventory inventory, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { Recipes1_11_2.setCraftingResultSlot(syncId, this, craftingInput); } } @@ -60,7 +60,7 @@ private void clientSideCrafting(Inventory inventory, CallbackInfo ci) { slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/screen/PlayerScreenHandler$2;(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)) private Slot removeOffhandSlot(PlayerScreenHandler screenHandler, Slot slot) { - return ProtocolHack.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8) ? null : addSlot(slot); + return ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8) ? null : addSlot(slot); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinScreenHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinScreenHandler.java index 670bb2b5d..1707e08f0 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinScreenHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/screenhandler/MixinScreenHandler.java @@ -21,7 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.injection.access.IScreenHandler; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.item.ItemStack; import net.minecraft.screen.ScreenHandler; import org.spongepowered.asm.mixin.Mixin; @@ -41,7 +41,7 @@ public abstract class MixinScreenHandler implements IScreenHandler { @Redirect(method = "updateSlotStacks", at = @At(value = "FIELD", target = "Lnet/minecraft/screen/ScreenHandler;cursorStack:Lnet/minecraft/item/ItemStack;")) private void preventUpdate(ScreenHandler instance, ItemStack value) { - if (ProtocolHack.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_17_1)) { + if (ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_17_1)) { this.cursorStack = value; } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinInventoryPackets.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinInventoryPackets.java index 36d6124d1..81f74e79f 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinInventoryPackets.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinInventoryPackets.java @@ -25,7 +25,7 @@ import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.packets.InventoryPackets; import de.florianmichael.viafabricplus.fixes.ClientsideFixes; -import de.florianmichael.viafabricplus.protocolhack.translator.TextComponentTranslator; +import de.florianmichael.viafabricplus.protocoltranslator.translator.TextComponentTranslator; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ingame.GenericContainerScreen; import net.minecraft.inventory.SimpleInventory; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinUserConnectionImpl.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinUserConnectionImpl.java index 75b5372d3..08ce9e75d 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinUserConnectionImpl.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinUserConnectionImpl.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion; import com.viaversion.viaversion.connection.UserConnectionImpl; -import de.florianmichael.viafabricplus.protocolhack.util.NoPacketSendChannel; +import de.florianmichael.viafabricplus.protocoltranslator.util.NoPacketSendChannel; import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; import org.spongepowered.asm.mixin.Final; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinWorldPackets1_19.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinWorldPackets1_19.java index 6302da07c..9f9f35129 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinWorldPackets1_19.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinWorldPackets1_19.java @@ -27,7 +27,7 @@ import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.packets.WorldPackets; import de.florianmichael.viafabricplus.fixes.ClientsideFixes; import de.florianmichael.viafabricplus.injection.access.IClientPlayerInteractionManager; -import de.florianmichael.viafabricplus.protocolhack.translator.BlockStateTranslator; +import de.florianmichael.viafabricplus.protocoltranslator.translator.BlockStateTranslator; import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/viaversion/MixinConfig.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/viaversion/MixinConfig.java index c9e643200..c9bcfab3f 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/viaversion/MixinConfig.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/viaversion/MixinConfig.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.viaversion; import com.viaversion.viaversion.util.Config; -import de.florianmichael.viafabricplus.protocolhack.util.ConfigPatcher; +import de.florianmichael.viafabricplus.protocoltranslator.util.ConfigPatcher; 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/de/florianmichael/viafabricplus/protocolhack/ProtocolHack.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/ProtocolTranslator.java similarity index 91% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/ProtocolHack.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/ProtocolTranslator.java index afdf20187..ed8827de8 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/ProtocolHack.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/ProtocolTranslator.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack; +package de.florianmichael.viafabricplus.protocoltranslator; import com.mojang.authlib.GameProfile; import com.mojang.brigadier.arguments.StringArgumentType; @@ -36,14 +36,14 @@ import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback; import de.florianmichael.viafabricplus.event.PostViaVersionLoadCallback; import de.florianmichael.viafabricplus.injection.access.IClientConnection; -import de.florianmichael.viafabricplus.protocolhack.impl.command.ViaFabricPlusVLCommandHandler; -import de.florianmichael.viafabricplus.protocolhack.impl.platform.ViaFabricPlusViaLegacyPlatformImpl; -import de.florianmichael.viafabricplus.protocolhack.impl.platform.ViaFabricPlusViaVersionPlatformImpl; -import de.florianmichael.viafabricplus.protocolhack.impl.viaversion.ViaFabricPlusVLInjector; -import de.florianmichael.viafabricplus.protocolhack.impl.viaversion.ViaFabricPlusVLLoader; -import de.florianmichael.viafabricplus.protocolhack.netty.ViaFabricPlusVLLegacyPipeline; -import de.florianmichael.viafabricplus.protocolhack.util.ConfigPatcher; -import de.florianmichael.viafabricplus.protocolhack.util.NoPacketSendChannel; +import de.florianmichael.viafabricplus.protocoltranslator.impl.command.ViaFabricPlusVLCommandHandler; +import de.florianmichael.viafabricplus.protocoltranslator.impl.platform.ViaFabricPlusViaLegacyPlatformImpl; +import de.florianmichael.viafabricplus.protocoltranslator.impl.platform.ViaFabricPlusViaVersionPlatformImpl; +import de.florianmichael.viafabricplus.protocoltranslator.impl.viaversion.ViaFabricPlusVLInjector; +import de.florianmichael.viafabricplus.protocoltranslator.impl.viaversion.ViaFabricPlusVLLoader; +import de.florianmichael.viafabricplus.protocoltranslator.netty.ViaFabricPlusVLLegacyPipeline; +import de.florianmichael.viafabricplus.protocoltranslator.util.ConfigPatcher; +import de.florianmichael.viafabricplus.protocoltranslator.util.NoPacketSendChannel; import io.netty.channel.Channel; import io.netty.util.AttributeKey; import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; @@ -70,7 +70,7 @@ /** * This class represents the whole Protocol Translator, here all important variables are stored */ -public class ProtocolHack { +public class ProtocolTranslator { /** * These attribute keys are used to track the main connections of Minecraft and ViaVersion, so that they can be used later during the connection to send packets. @@ -129,9 +129,9 @@ public static void injectViaPipeline(final ClientConnection connection, final Ch final IClientConnection mixinClientConnection = (IClientConnection) connection; final ProtocolVersion serverVersion = mixinClientConnection.viaFabricPlus$getTargetVersion(); - if (serverVersion != ProtocolHack.NATIVE_VERSION) { - channel.attr(ProtocolHack.CLIENT_CONNECTION_ATTRIBUTE_KEY).set(connection); - channel.attr(ProtocolHack.TARGET_VERSION_ATTRIBUTE_KEY).set(serverVersion); + if (serverVersion != ProtocolTranslator.NATIVE_VERSION) { + channel.attr(ProtocolTranslator.CLIENT_CONNECTION_ATTRIBUTE_KEY).set(connection); + channel.attr(ProtocolTranslator.TARGET_VERSION_ATTRIBUTE_KEY).set(serverVersion); if (serverVersion.equals(BedrockProtocolVersion.bedrockLatest)) { channel.config().setOption(RakChannelOption.RAK_PROTOCOL_VERSION, ProtocolConstants.BEDROCK_RAKNET_PROTOCOL_VERSION); diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/command/VFPViaSubCommand.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/command/VFPViaSubCommand.java similarity index 87% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/command/VFPViaSubCommand.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/command/VFPViaSubCommand.java index 7fe7eaaf6..66b34b891 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/command/VFPViaSubCommand.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/command/VFPViaSubCommand.java @@ -17,12 +17,12 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.command; +package de.florianmichael.viafabricplus.protocoltranslator.impl.command; import com.viaversion.viaversion.api.command.ViaCommandSender; import com.viaversion.viaversion.api.command.ViaSubCommand; import com.viaversion.viaversion.api.connection.UserConnection; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.util.ChatUtil; public abstract class VFPViaSubCommand extends ViaSubCommand { @@ -35,7 +35,7 @@ public void sendMessage(final ViaCommandSender sender, final String message) { } public UserConnection getUser() { - return ProtocolHack.getPlayNetworkUserConnection(); + return ProtocolTranslator.getPlayNetworkUserConnection(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/command/ViaFabricPlusVLCommandHandler.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusVLCommandHandler.java similarity index 97% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/command/ViaFabricPlusVLCommandHandler.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusVLCommandHandler.java index d107419c2..d1afd7d09 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/command/ViaFabricPlusVLCommandHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusVLCommandHandler.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.command; +package de.florianmichael.viafabricplus.protocoltranslator.impl.command; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.context.CommandContext; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/command/ViaFabricPlusViaCommandSender.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusViaCommandSender.java similarity index 96% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/command/ViaFabricPlusViaCommandSender.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusViaCommandSender.java index d3bed361d..ad1d6318c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/command/ViaFabricPlusViaCommandSender.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/command/ViaFabricPlusViaCommandSender.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.command; +package de.florianmichael.viafabricplus.protocoltranslator.impl.command; import com.viaversion.viaversion.api.command.ViaCommandSender; import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/platform/ViaFabricPlusViaLegacyPlatformImpl.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/platform/ViaFabricPlusViaLegacyPlatformImpl.java similarity index 93% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/platform/ViaFabricPlusViaLegacyPlatformImpl.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/platform/ViaFabricPlusViaLegacyPlatformImpl.java index 7a08b35be..7f966e962 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/platform/ViaFabricPlusViaLegacyPlatformImpl.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/platform/ViaFabricPlusViaLegacyPlatformImpl.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.platform; +package de.florianmichael.viafabricplus.protocoltranslator.impl.platform; import net.raphimc.vialoader.impl.platform.ViaLegacyPlatformImpl; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/platform/ViaFabricPlusViaVersionPlatformImpl.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/platform/ViaFabricPlusViaVersionPlatformImpl.java similarity index 88% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/platform/ViaFabricPlusViaVersionPlatformImpl.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/platform/ViaFabricPlusViaVersionPlatformImpl.java index da506a3a0..30650e166 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/platform/ViaFabricPlusViaVersionPlatformImpl.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/platform/ViaFabricPlusViaVersionPlatformImpl.java @@ -17,10 +17,10 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.platform; +package de.florianmichael.viafabricplus.protocoltranslator.impl.platform; import com.viaversion.viaversion.configuration.AbstractViaConfig; -import de.florianmichael.viafabricplus.protocolhack.impl.viaversion.ViaFabricPlusVLViaConfig; +import de.florianmichael.viafabricplus.protocoltranslator.impl.viaversion.ViaFabricPlusVLViaConfig; import net.raphimc.vialoader.impl.platform.ViaVersionPlatformImpl; import java.io.File; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viabedrock/ViaFabricPlusNettyPipelineProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viabedrock/ViaFabricPlusNettyPipelineProvider.java similarity index 93% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viabedrock/ViaFabricPlusNettyPipelineProvider.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viabedrock/ViaFabricPlusNettyPipelineProvider.java index d355d9974..e0bb8450f 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viabedrock/ViaFabricPlusNettyPipelineProvider.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viabedrock/ViaFabricPlusNettyPipelineProvider.java @@ -17,10 +17,10 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.provider.viabedrock; +package de.florianmichael.viafabricplus.protocoltranslator.impl.provider.viabedrock; import com.viaversion.viaversion.api.connection.UserConnection; -import de.florianmichael.viafabricplus.protocolhack.netty.ViaFabricPlusVLLegacyPipeline; +import de.florianmichael.viafabricplus.protocoltranslator.netty.ViaFabricPlusVLLegacyPipeline; import io.netty.channel.Channel; import net.raphimc.viabedrock.api.io.compression.ProtocolCompression; import net.raphimc.viabedrock.netty.AesEncryptionCodec; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viabedrock/ViaFabricPlusTransferProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viabedrock/ViaFabricPlusTransferProvider.java similarity index 97% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viabedrock/ViaFabricPlusTransferProvider.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viabedrock/ViaFabricPlusTransferProvider.java index 13892993e..3c076115e 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viabedrock/ViaFabricPlusTransferProvider.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viabedrock/ViaFabricPlusTransferProvider.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.provider.viabedrock; +package de.florianmichael.viafabricplus.protocoltranslator.impl.provider.viabedrock; import com.viaversion.viaversion.api.connection.UserConnection; import de.florianmichael.viafabricplus.settings.impl.BedrockSettings; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusAlphaInventoryProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusAlphaInventoryProvider.java similarity index 95% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusAlphaInventoryProvider.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusAlphaInventoryProvider.java index bd7f1e28b..bf8b311c4 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusAlphaInventoryProvider.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusAlphaInventoryProvider.java @@ -17,11 +17,11 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.provider.vialegacy; +package de.florianmichael.viafabricplus.protocoltranslator.impl.provider.vialegacy; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.item.Item; -import de.florianmichael.viafabricplus.protocolhack.translator.ItemTranslator; +import de.florianmichael.viafabricplus.protocoltranslator.translator.ItemTranslator; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.item.ItemStack; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java similarity index 97% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java index 540d023cc..4a4261c54 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusClassicMPPassProvider.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.provider.vialegacy; +package de.florianmichael.viafabricplus.protocoltranslator.impl.provider.vialegacy; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.UserConnection; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusClassicWorldHeightProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusClassicWorldHeightProvider.java similarity index 93% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusClassicWorldHeightProvider.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusClassicWorldHeightProvider.java index ade210cb9..fd57fb947 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusClassicWorldHeightProvider.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusClassicWorldHeightProvider.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.provider.vialegacy; +package de.florianmichael.viafabricplus.protocoltranslator.impl.provider.vialegacy; import com.viaversion.viaversion.api.connection.UserConnection; import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicWorldHeightProvider; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusEncryptionProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusEncryptionProvider.java similarity index 80% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusEncryptionProvider.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusEncryptionProvider.java index 0bed6f8ea..656411da9 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusEncryptionProvider.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusEncryptionProvider.java @@ -17,18 +17,18 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.provider.vialegacy; +package de.florianmichael.viafabricplus.protocoltranslator.impl.provider.vialegacy; import com.viaversion.viaversion.api.connection.UserConnection; import de.florianmichael.viafabricplus.injection.access.IClientConnection; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.providers.EncryptionProvider; public class ViaFabricPlusEncryptionProvider extends EncryptionProvider { @Override public void enableDecryption(UserConnection user) { - ((IClientConnection) user.getChannel().attr(ProtocolHack.CLIENT_CONNECTION_ATTRIBUTE_KEY).get()).viaFabricPlus$setupPreNettyDecryption(); + ((IClientConnection) user.getChannel().attr(ProtocolTranslator.CLIENT_CONNECTION_ATTRIBUTE_KEY).get()).viaFabricPlus$setupPreNettyDecryption(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusGameProfileFetcher.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusGameProfileFetcher.java similarity index 96% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusGameProfileFetcher.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusGameProfileFetcher.java index 739e1eff5..0bb60a03c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusGameProfileFetcher.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusGameProfileFetcher.java @@ -17,13 +17,12 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.provider.vialegacy; +package de.florianmichael.viafabricplus.protocoltranslator.impl.provider.vialegacy; import com.mojang.authlib.GameProfileRepository; import com.mojang.authlib.HttpAuthenticationService; import com.mojang.authlib.ProfileLookupCallback; import com.mojang.authlib.minecraft.MinecraftSessionService; -import com.mojang.authlib.properties.Property; import com.mojang.authlib.yggdrasil.ProfileNotFoundException; import com.mojang.authlib.yggdrasil.ProfileResult; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusOldAuthProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusOldAuthProvider.java similarity index 84% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusOldAuthProvider.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusOldAuthProvider.java index b82b4d479..3ffef076d 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/vialegacy/ViaFabricPlusOldAuthProvider.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/vialegacy/ViaFabricPlusOldAuthProvider.java @@ -17,11 +17,11 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.provider.vialegacy; +package de.florianmichael.viafabricplus.protocoltranslator.impl.provider.vialegacy; import com.viaversion.viaversion.api.connection.UserConnection; import de.florianmichael.viafabricplus.ViaFabricPlus; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.settings.impl.AuthenticationSettings; import de.florianmichael.viafabricplus.util.ChatUtil; import net.minecraft.client.MinecraftClient; @@ -38,7 +38,7 @@ public void sendAuthRequest(UserConnection user, String serverId) { final var mc = MinecraftClient.getInstance(); mc.getSessionService().joinServer(mc.getSession().getUuidOrNull(), mc.getSession().getAccessToken(), serverId); } catch (Exception e) { - user.getChannel().attr(ProtocolHack.CLIENT_CONNECTION_ATTRIBUTE_KEY).get().disconnect(ChatUtil.prefixText(Text.translatable("authentication.viafabricplus.failed_to_verify_session"))); + user.getChannel().attr(ProtocolTranslator.CLIENT_CONNECTION_ATTRIBUTE_KEY).get().disconnect(ChatUtil.prefixText(Text.translatable("authentication.viafabricplus.failed_to_verify_session"))); ViaFabricPlus.global().getLogger().error("Error occurred while calling join server to verify session", e); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusAckSequenceProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusAckSequenceProvider.java similarity index 93% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusAckSequenceProvider.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusAckSequenceProvider.java index 347879b36..7ced71db4 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusAckSequenceProvider.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusAckSequenceProvider.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.provider.viaversion; +package de.florianmichael.viafabricplus.protocoltranslator.impl.provider.viaversion; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.provider.AckSequenceProvider; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusBaseVersionProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusBaseVersionProvider.java similarity index 84% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusBaseVersionProvider.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusBaseVersionProvider.java index 173aa503a..eccae2c97 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusBaseVersionProvider.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusBaseVersionProvider.java @@ -17,19 +17,19 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.provider.viaversion; +package de.florianmichael.viafabricplus.protocoltranslator.impl.provider.viaversion; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.protocols.base.BaseVersionProvider; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; public class ViaFabricPlusBaseVersionProvider extends BaseVersionProvider { @Override public ProtocolVersion getClosestServerProtocol(UserConnection connection) throws Exception { if (connection.isClientSide()) { - return connection.getChannel().attr(ProtocolHack.TARGET_VERSION_ATTRIBUTE_KEY).get(); + return connection.getChannel().attr(ProtocolTranslator.TARGET_VERSION_ATTRIBUTE_KEY).get(); } else { return super.getClosestServerProtocol(connection); } diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusCommandArgumentsProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusCommandArgumentsProvider.java similarity index 95% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusCommandArgumentsProvider.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusCommandArgumentsProvider.java index 908f231fa..cea2f6982 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusCommandArgumentsProvider.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusCommandArgumentsProvider.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.provider.viaversion; +package de.florianmichael.viafabricplus.protocoltranslator.impl.provider.viaversion; import com.viaversion.viaversion.api.minecraft.signature.SignableCommandArgumentsProvider; import com.viaversion.viaversion.util.Pair; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusHandItemProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusHandItemProvider.java similarity index 90% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusHandItemProvider.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusHandItemProvider.java index 43e08b334..d7f27daf1 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusHandItemProvider.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusHandItemProvider.java @@ -17,13 +17,13 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.provider.viaversion; +package de.florianmichael.viafabricplus.protocoltranslator.impl.provider.viaversion; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.HandItemProvider; -import de.florianmichael.viafabricplus.protocolhack.translator.ItemTranslator; +import de.florianmichael.viafabricplus.protocoltranslator.translator.ItemTranslator; import net.minecraft.item.ItemStack; public class ViaFabricPlusHandItemProvider extends HandItemProvider { diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusPlayerAbilitiesProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPlayerAbilitiesProvider.java similarity index 94% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusPlayerAbilitiesProvider.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPlayerAbilitiesProvider.java index 315a05d05..4401ea9cd 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusPlayerAbilitiesProvider.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPlayerAbilitiesProvider.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.provider.viaversion; +package de.florianmichael.viafabricplus.protocoltranslator.impl.provider.viaversion; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.provider.PlayerAbilitiesProvider; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusPlayerLookTargetProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPlayerLookTargetProvider.java similarity index 95% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusPlayerLookTargetProvider.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPlayerLookTargetProvider.java index 3fb9208f4..41be49c30 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viaversion/ViaFabricPlusPlayerLookTargetProvider.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/provider/viaversion/ViaFabricPlusPlayerLookTargetProvider.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.provider.viaversion; +package de.florianmichael.viafabricplus.protocoltranslator.impl.provider.viaversion; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.Position; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/viaversion/ViaFabricPlusVLInjector.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLInjector.java similarity index 97% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/viaversion/ViaFabricPlusVLInjector.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLInjector.java index 4fcc46f00..a8d7d0e73 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/viaversion/ViaFabricPlusVLInjector.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLInjector.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.viaversion; +package de.florianmichael.viafabricplus.protocoltranslator.impl.viaversion; import com.viaversion.viaversion.libs.gson.JsonArray; import com.viaversion.viaversion.libs.gson.JsonObject; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/viaversion/ViaFabricPlusVLLoader.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLLoader.java similarity index 89% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/viaversion/ViaFabricPlusVLLoader.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLLoader.java index 677f8c528..fe0897ae0 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/viaversion/ViaFabricPlusVLLoader.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLLoader.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.viaversion; +package de.florianmichael.viafabricplus.protocoltranslator.impl.viaversion; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.minecraft.signature.SignableCommandArgumentsProvider; @@ -27,10 +27,10 @@ import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.provider.PlayerAbilitiesProvider; import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.provider.AckSequenceProvider; import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.HandItemProvider; -import de.florianmichael.viafabricplus.protocolhack.impl.provider.viabedrock.ViaFabricPlusNettyPipelineProvider; -import de.florianmichael.viafabricplus.protocolhack.impl.provider.viabedrock.ViaFabricPlusTransferProvider; -import de.florianmichael.viafabricplus.protocolhack.impl.provider.vialegacy.*; -import de.florianmichael.viafabricplus.protocolhack.impl.provider.viaversion.*; +import de.florianmichael.viafabricplus.protocoltranslator.impl.provider.viabedrock.ViaFabricPlusNettyPipelineProvider; +import de.florianmichael.viafabricplus.protocoltranslator.impl.provider.viabedrock.ViaFabricPlusTransferProvider; +import de.florianmichael.viafabricplus.protocoltranslator.impl.provider.vialegacy.*; +import de.florianmichael.viafabricplus.protocoltranslator.impl.provider.viaversion.*; import de.florianmichael.viafabricplus.settings.impl.GeneralSettings; import net.raphimc.viabedrock.protocol.providers.NettyPipelineProvider; import net.raphimc.viabedrock.protocol.providers.TransferProvider; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/viaversion/ViaFabricPlusVLViaConfig.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLViaConfig.java similarity index 94% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/viaversion/ViaFabricPlusVLViaConfig.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLViaConfig.java index cd65b4bb1..226e61fb4 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/viaversion/ViaFabricPlusVLViaConfig.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/impl/viaversion/ViaFabricPlusVLViaConfig.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.impl.viaversion; +package de.florianmichael.viafabricplus.protocoltranslator.impl.viaversion; import net.raphimc.vialoader.impl.viaversion.VLViaConfig; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/netty/ViaFabricPlusVLLegacyPipeline.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/netty/ViaFabricPlusVLLegacyPipeline.java similarity index 97% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/netty/ViaFabricPlusVLLegacyPipeline.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/netty/ViaFabricPlusVLLegacyPipeline.java index 6abc49225..0fc3e631b 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/netty/ViaFabricPlusVLLegacyPipeline.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/netty/ViaFabricPlusVLLegacyPipeline.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.netty; +package de.florianmichael.viafabricplus.protocoltranslator.netty; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/netty/ViaFabricPlusViaDecoder.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/netty/ViaFabricPlusViaDecoder.java similarity index 97% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/netty/ViaFabricPlusViaDecoder.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/netty/ViaFabricPlusViaDecoder.java index 44fbb31d0..ef650f82f 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/netty/ViaFabricPlusViaDecoder.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/netty/ViaFabricPlusViaDecoder.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.netty; +package de.florianmichael.viafabricplus.protocoltranslator.netty; import com.viaversion.viaversion.api.connection.UserConnection; import de.florianmichael.viafabricplus.ViaFabricPlus; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/translator/BlockStateTranslator.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/translator/BlockStateTranslator.java similarity index 91% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/translator/BlockStateTranslator.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/translator/BlockStateTranslator.java index 56bac6282..131383006 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/translator/BlockStateTranslator.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/translator/BlockStateTranslator.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.translator; +package de.florianmichael.viafabricplus.protocoltranslator.translator; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.Position; @@ -28,14 +28,14 @@ import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18; import de.florianmichael.viafabricplus.ViaFabricPlus; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; public class BlockStateTranslator { - private static final UserConnection DUMMY_USER_CONNECTION = ProtocolHack.createDummyUserConnection(ProtocolHack.NATIVE_VERSION, ProtocolVersion.v1_18_2); + private static final UserConnection DUMMY_USER_CONNECTION = ProtocolTranslator.createDummyUserConnection(ProtocolTranslator.NATIVE_VERSION, ProtocolVersion.v1_18_2); /** * Converts a 1.18.2 block state to a native block state (the current version) diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/translator/ItemTranslator.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/translator/ItemTranslator.java similarity index 93% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/translator/ItemTranslator.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/translator/ItemTranslator.java index b2d68147d..a68278748 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/translator/ItemTranslator.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/translator/ItemTranslator.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.translator; +package de.florianmichael.viafabricplus.protocoltranslator.translator; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.item.Item; @@ -27,7 +27,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.api.type.Type; import de.florianmichael.viafabricplus.ViaFabricPlus; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import io.netty.buffer.Unpooled; import net.minecraft.item.ItemStack; import net.minecraft.network.NetworkSide; @@ -42,7 +42,7 @@ public class ItemTranslator { - private static final UserConnection VIA_B1_8_TO_MC_USER_CONNECTION = ProtocolHack.createDummyUserConnection(ProtocolHack.NATIVE_VERSION, LegacyProtocolVersion.b1_8tob1_8_1); + private static final UserConnection VIA_B1_8_TO_MC_USER_CONNECTION = ProtocolTranslator.createDummyUserConnection(ProtocolTranslator.NATIVE_VERSION, LegacyProtocolVersion.b1_8tob1_8_1); private static final int CREATIVE_INVENTORY_ACTION_ID = NetworkState.PLAY.getHandler(NetworkSide.SERVERBOUND).getId(new CreativeInventoryActionC2SPacket(0, ItemStack.EMPTY)); /** @@ -53,7 +53,7 @@ public class ItemTranslator { * @return The ViaVersion item stack for the target version */ public static Item mcToVia(final ItemStack stack, final ProtocolVersion targetVersion) { - final UserConnection user = ProtocolHack.createDummyUserConnection(ProtocolHack.NATIVE_VERSION, targetVersion); + final UserConnection user = ProtocolTranslator.createDummyUserConnection(ProtocolTranslator.NATIVE_VERSION, targetVersion); try { final PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer()); diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/translator/TextComponentTranslator.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/translator/TextComponentTranslator.java similarity index 91% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/translator/TextComponentTranslator.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/translator/TextComponentTranslator.java index 8a8af9e43..2dc35136b 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/translator/TextComponentTranslator.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/translator/TextComponentTranslator.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.translator; +package de.florianmichael.viafabricplus.protocoltranslator.translator; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.protocol.packet.Direction; @@ -29,11 +29,11 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14; import de.florianmichael.viafabricplus.ViaFabricPlus; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; public class TextComponentTranslator { - private static final UserConnection DUMMY_USER_CONNECTION = ProtocolHack.createDummyUserConnection(ProtocolHack.NATIVE_VERSION, ProtocolVersion.v1_14); + private static final UserConnection DUMMY_USER_CONNECTION = ProtocolTranslator.createDummyUserConnection(ProtocolTranslator.NATIVE_VERSION, ProtocolVersion.v1_14); /** * Converts a ViaVersion 1.14 text component to a native text component, both in JSON format diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/ConfigPatcher.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/util/ConfigPatcher.java similarity index 96% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/util/ConfigPatcher.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/util/ConfigPatcher.java index d6d007e16..fcbd7bf2d 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/ConfigPatcher.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/util/ConfigPatcher.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.util; +package de.florianmichael.viafabricplus.protocoltranslator.util; import com.viaversion.viaversion.util.Config; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/MathUtil.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/util/MathUtil.java similarity index 95% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/util/MathUtil.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/util/MathUtil.java index 7cde7ca31..d05d1e275 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/MathUtil.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/util/MathUtil.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.util; +package de.florianmichael.viafabricplus.protocoltranslator.util; import it.unimi.dsi.fastutil.floats.FloatIntPair; diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/NoPacketSendChannel.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/util/NoPacketSendChannel.java similarity index 92% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/util/NoPacketSendChannel.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/util/NoPacketSendChannel.java index 663751548..6a5a3cfd7 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/NoPacketSendChannel.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/util/NoPacketSendChannel.java @@ -17,14 +17,14 @@ * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.util; +package de.florianmichael.viafabricplus.protocoltranslator.util; import io.netty.channel.local.LocalChannel; /** * This class can be used when creating dummy {@link com.viaversion.viaversion.api.connection.UserConnection} instances. * This class will prevent packets created by ViaVersion from being sent to the server. This is mainly used in the - * translator system. See {@link de.florianmichael.viafabricplus.protocolhack.translator} for more information. + * translator system. See {@link de.florianmichael.viafabricplus.protocoltranslator.translator} for more information. */ public class NoPacketSendChannel extends LocalChannel { diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/ProtocolVersionDetector.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/util/ProtocolVersionDetector.java similarity index 97% rename from src/main/java/de/florianmichael/viafabricplus/protocolhack/util/ProtocolVersionDetector.java rename to src/main/java/de/florianmichael/viafabricplus/protocoltranslator/util/ProtocolVersionDetector.java index 16adfddd6..979c18d93 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/ProtocolVersionDetector.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/util/ProtocolVersionDetector.java @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package de.florianmichael.viafabricplus.protocolhack.util; +package de.florianmichael.viafabricplus.protocoltranslator.util; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import net.lenni0451.mcping.MCPing; diff --git a/src/main/java/de/florianmichael/viafabricplus/save/impl/SettingsSave.java b/src/main/java/de/florianmichael/viafabricplus/save/impl/SettingsSave.java index 4d7a3c7f9..e260e22be 100644 --- a/src/main/java/de/florianmichael/viafabricplus/save/impl/SettingsSave.java +++ b/src/main/java/de/florianmichael/viafabricplus/save/impl/SettingsSave.java @@ -21,7 +21,7 @@ import com.google.gson.JsonObject; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.save.AbstractSave; import de.florianmichael.viafabricplus.settings.SettingsManager; import de.florianmichael.viafabricplus.settings.base.AbstractSetting; @@ -51,7 +51,7 @@ public void write(JsonObject object) { object.add(AbstractSetting.mapTranslationKey(ChatUtil.uncoverTranslationKey(group.getName())), groupObject); } - object.addProperty("selected-protocol-version", ProtocolHack.getTargetVersion().getName()); + object.addProperty("selected-protocol-version", ProtocolTranslator.getTargetVersion().getName()); } @Override @@ -69,10 +69,10 @@ public void read(JsonObject object) { if (GeneralSettings.global().saveSelectedProtocolVersion.getValue() && object.has("selected-protocol-version")) { final ProtocolVersion protocolVersion = ProtocolVersion.getClosest(object.get("selected-protocol-version").getAsString()); if (protocolVersion != null) { - ProtocolHack.setTargetVersion(protocolVersion); + ProtocolTranslator.setTargetVersion(protocolVersion); } } else { - ProtocolHack.setTargetVersion(ProtocolHack.NATIVE_VERSION); + ProtocolTranslator.setTargetVersion(ProtocolTranslator.NATIVE_VERSION); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/base/ProtocolSelectionScreen.java b/src/main/java/de/florianmichael/viafabricplus/screen/base/ProtocolSelectionScreen.java index feba9bf0e..3caf2a9bb 100644 --- a/src/main/java/de/florianmichael/viafabricplus/screen/base/ProtocolSelectionScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/screen/base/ProtocolSelectionScreen.java @@ -22,7 +22,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.classic4j.BetaCraftHandler; import de.florianmichael.viafabricplus.ViaFabricPlus; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.screen.VFPScreen; import de.florianmichael.viafabricplus.screen.classic4j.BetaCraftScreen; import de.florianmichael.viafabricplus.screen.classic4j.ClassiCubeLoginScreen; @@ -132,14 +132,14 @@ public Text getNarration() { @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { - ProtocolHack.setTargetVersion(this.protocolVersion); + ProtocolTranslator.setTargetVersion(this.protocolVersion); playClickSound(); return super.mouseClicked(mouseX, mouseY, button); } @Override public void render(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { - final boolean isSelected = ProtocolHack.getTargetVersion().getVersion() == protocolVersion.getVersion(); + final boolean isSelected = ProtocolTranslator.getTargetVersion().getVersion() == protocolVersion.getVersion(); final MatrixStack matrices = context.getMatrices(); diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/classic4j/ClassiCubeServerListScreen.java b/src/main/java/de/florianmichael/viafabricplus/screen/classic4j/ClassiCubeServerListScreen.java index 34dad15ba..9a562b2b0 100644 --- a/src/main/java/de/florianmichael/viafabricplus/screen/classic4j/ClassiCubeServerListScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/screen/classic4j/ClassiCubeServerListScreen.java @@ -25,7 +25,7 @@ import de.florianmichael.classic4j.model.classicube.server.CCServerInfo; import de.florianmichael.viafabricplus.ViaFabricPlus; import de.florianmichael.viafabricplus.injection.access.IServerInfo; -import de.florianmichael.viafabricplus.protocolhack.impl.provider.vialegacy.ViaFabricPlusClassicMPPassProvider; +import de.florianmichael.viafabricplus.protocoltranslator.impl.provider.vialegacy.ViaFabricPlusClassicMPPassProvider; import de.florianmichael.viafabricplus.screen.VFPListEntry; import de.florianmichael.viafabricplus.screen.VFPScreen; import de.florianmichael.viafabricplus.screen.base.ProtocolSelectionScreen; diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/base/VersionedBooleanSetting.java b/src/main/java/de/florianmichael/viafabricplus/settings/base/VersionedBooleanSetting.java index 1eb40ab88..bcd394431 100644 --- a/src/main/java/de/florianmichael/viafabricplus/settings/base/VersionedBooleanSetting.java +++ b/src/main/java/de/florianmichael/viafabricplus/settings/base/VersionedBooleanSetting.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.settings.base; import com.google.gson.JsonObject; -import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.screen.VFPListEntry; import de.florianmichael.viafabricplus.screen.settings.VersionedBooleanSettingRenderer; import net.minecraft.text.MutableText; @@ -63,7 +63,7 @@ public boolean isAuto() { public boolean isEnabled() { if (isAuto()) { - return protocolRange.contains(ProtocolHack.getTargetVersion()); + return protocolRange.contains(ProtocolTranslator.getTargetVersion()); } return getValue() == ENABLED_INDEX;