From 2269da25605383701f97312ed04dfd9aeeadaa26 Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Fri, 25 Oct 2024 23:29:00 +0200 Subject: [PATCH] Comment out even more code, mark all porting TODOs for easier searching --- .../fixes/data/recipe/RecipeInfo.java | 2 +- .../fixes/data/recipe/Recipes1_11_2.java | 8 +-- ...ltiplayerServerListWidget_ServerEntry.java | 9 ++-- .../entity/MixinClientPlayerEntity.java | 22 ++++---- .../fixes/minecraft/entity/MixinEntity.java | 2 +- .../minecraft/entity/MixinLivingEntity.java | 2 +- .../minecraft/item/MixinMilkBucketItem.java | 2 +- .../MixinClientPlayNetworkHandler.java | 19 +++---- .../minecraft/screen/hud/MixinInGameHud.java | 51 ++++++++++--------- 9 files changed, 61 insertions(+), 56 deletions(-) diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/data/recipe/RecipeInfo.java b/src/main/java/de/florianmichael/viafabricplus/fixes/data/recipe/RecipeInfo.java index 2221478e..d0c6aacd 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/data/recipe/RecipeInfo.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/data/recipe/RecipeInfo.java @@ -317,7 +317,7 @@ public final class RecipeInfo { * @return The recipe info */ public RecipeEntry create(Identifier id) { - // return new RecipeEntry>(id, this.creator.get()); + // return new RecipeEntry>(id, this.creator.get()); TODO UPDATE-1.21.3 return null; } diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/data/recipe/Recipes1_11_2.java b/src/main/java/de/florianmichael/viafabricplus/fixes/data/recipe/Recipes1_11_2.java index 6688abc7..a0eb8295 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/data/recipe/Recipes1_11_2.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/data/recipe/Recipes1_11_2.java @@ -57,7 +57,7 @@ public class Recipes1_11_2 { recipes.add(RecipeInfo.of(() -> new FireworkRocketRecipe(CraftingRecipeCategory.MISC))); } if (targetVersion.newerThanOrEqualTo(ProtocolVersion.v1_11)) { - // recipes.add(RecipeInfo.of(() -> new ShulkerBoxColoringRecipe(CraftingRecipeCategory.MISC))); + // recipes.add(RecipeInfo.of(() -> new ShulkerBoxColoringRecipe(CraftingRecipeCategory.MISC))); TODO UPDATE-1.21.3 } if (targetVersion.newerThanOrEqualTo(ProtocolVersion.v1_9)) { recipes.add(RecipeInfo.of(() -> new TippedArrowRecipe(CraftingRecipeCategory.MISC))); @@ -625,7 +625,7 @@ public class Recipes1_11_2 { recipes.add(RecipeInfo.smelting(Items.IRON_INGOT, Items.IRON_ORE, 0.7F)); recipes.add(RecipeInfo.smelting(Items.GOLD_INGOT, Items.GOLD_ORE, 1.0F)); recipes.add(RecipeInfo.smelting(Items.DIAMOND, Items.DIAMOND_ORE, 1.0F)); - // recipes.add(RecipeInfo.smelting(Items.GLASS, Ingredient.fromTag(ItemTags.SAND), 0.1F)); + // recipes.add(RecipeInfo.smelting(Items.GLASS, Ingredient.fromTag(ItemTags.SAND), 0.1F)); TODO UPDATE-1.21.3 recipes.add(RecipeInfo.smelting(Items.COOKED_PORKCHOP, Items.PORKCHOP, 0.35F)); recipes.add(RecipeInfo.smelting(Items.STONE, Items.COBBLESTONE, 0.1F)); recipes.add(RecipeInfo.smelting(Items.BRICK, Items.CLAY_BALL, 0.3F)); @@ -685,7 +685,7 @@ public class Recipes1_11_2 { recipes.add(RecipeInfo.smelting(Items.COOKED_BEEF, Items.BEEF, 0.35F)); } if (targetVersion.newerThanOrEqualTo(LegacyProtocolVersion.b1_2_0tob1_2_2)) { - // recipes.add(RecipeInfo.smelting(Items.CHARCOAL, Ingredient.fromTag(ItemTags.LOGS), 0.15F)); + // recipes.add(RecipeInfo.smelting(Items.CHARCOAL, Ingredient.fromTag(ItemTags.LOGS), 0.15F)); TODO UPDATE-1.21.3 recipes.add(RecipeInfo.smelting(Items.GREEN_DYE, Items.CACTUS, 0.2F)); } if (targetVersion.newerThanOrEqualTo(LegacyProtocolVersion.a1_2_0toa1_2_1_1)) { @@ -710,7 +710,7 @@ public class Recipes1_11_2 { final var world = MinecraftClient.getInstance().world; final var craftingRecipeInput = inventory.createRecipeInput(); -// final var result = network.getRecipeManager() +// final var result = network.getRecipeManager() TODO UPDATE-1.21.3 // .getFirstMatch(RecipeType.CRAFTING, craftingRecipeInput, world) // Get the first matching recipe // .map(recipe -> recipe.value().craft(craftingRecipeInput, network.getRegistryManager())) // Craft the recipe to get the result // .orElse(ItemStack.EMPTY); // If there is no recipe, set the result to air diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinMultiplayerServerListWidget_ServerEntry.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinMultiplayerServerListWidget_ServerEntry.java index 4f0d7605..758a11a9 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinMultiplayerServerListWidget_ServerEntry.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinMultiplayerServerListWidget_ServerEntry.java @@ -98,10 +98,11 @@ public abstract class MixinMultiplayerServerListWidget_ServerEntry { return x; } - @WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V", ordinal = 0)) - private boolean disableServerPinging(DrawContext instance, Identifier texture, int x, int y, int width, int height) { - return !viaFabricPlus$disableServerPinging; // Remove ping bar - } + // TODO UPDATE-1.21.3 +// @WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V", ordinal = 0)) +// private boolean disableServerPinging(DrawContext instance, Identifier texture, int x, int y, int width, int height) { +// return !viaFabricPlus$disableServerPinging; // Remove ping bar +// } @WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/multiplayer/MultiplayerScreen;setTooltip(Ljava/util/List;)V")) private boolean disableServerPinging(MultiplayerScreen instance, List tooltip) { 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 f38fe0c1..2b72ff94 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 @@ -140,10 +140,11 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_15_1) && original; } - @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z", ordinal = 3)) - private boolean allowElytraInVehicle(ClientPlayerEntity instance) { - return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_14_4) && instance.hasVehicle(); - } + // TODO UPDATE-1.21.3 +// @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z", ordinal = 3)) +// private boolean allowElytraInVehicle(ClientPlayerEntity instance) { +// return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_14_4) && instance.hasVehicle(); +// } @Inject(method = "tickMovement()V", slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isCamera()Z")), @@ -208,12 +209,13 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity } } - @Inject(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z")) - private void moveLastPosPacketIncrement(CallbackInfo ci) { - if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { - this.ticksSinceLastPositionPacketSent++; - } - } + // TODO UPDATE-1.21.3 +// @Inject(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z")) +// private void moveLastPosPacketIncrement(CallbackInfo ci) { +// if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { +// this.ticksSinceLastPositionPacketSent++; +// } +// } @Redirect(method = "sendMovementPackets", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;lastOnGround:Z", ordinal = 0)) private boolean sendIdlePacket(ClientPlayerEntity instance) { 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 943dad51..f9682995 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 @@ -163,7 +163,7 @@ public abstract class MixinEntity implements IEntity { } } - // TODO/NOTE: No longer subtracts 1.0E-7 from the box values, instead the boundingBox is contracted + // TODO UPDATE-1.21.3: No longer subtracts 1.0E-7 from the box values, instead the boundingBox is contracted // @ModifyConstant(method = "checkBlockCollision", constant = @Constant(doubleValue = 1.0E-7)) // private double fixBlockCollisionMargin(double constant) { // if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_1)) { 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 2be941cc..df9e06bd 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 @@ -137,7 +137,7 @@ public abstract class MixinLivingEntity extends Entity { } // @Redirect(method = "travel", at = @At(value = "INVOKE", target = "Ljava/lang/Math;cos(D)D", remap = false)) -// private double fixCosTable(double a) { +// private double fixCosTable(double a) { TODO UPDATE-1.21.3 // if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) { // return MathHelper.cos((float) a); // } else { diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinMilkBucketItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinMilkBucketItem.java index c7209951..c102ead8 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinMilkBucketItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinMilkBucketItem.java @@ -18,7 +18,7 @@ */ //package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item; -// +// TODO UPDATE-1.21.3 //import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; //import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; //import net.minecraft.entity.LivingEntity; 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 2cd97330..4ef3ef6d 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 @@ -238,18 +238,19 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH } } - @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 (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); - } - } + // TODO UPDATE-1.21.3 +// @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 (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); +// } +// } @Inject(method = "onGameJoin", at = @At("RETURN")) private void sendRecipes(GameJoinS2CPacket packet, CallbackInfo ci) { -// if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { +// if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) { TODO UPDATE-1.21.3 // final List> recipes = new ArrayList<>(); // final List recipeInfos = Recipes1_11_2.getRecipes(ProtocolTranslator.getTargetVersion()); // for (int i = 0; i < recipeInfos.size(); i++) { diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/hud/MixinInGameHud.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/hud/MixinInGameHud.java index 3617b276..fa4e596c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/hud/MixinInGameHud.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/hud/MixinInGameHud.java @@ -61,30 +61,31 @@ public abstract class MixinInGameHud { } } - @ModifyArgs(method = "renderArmor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V"), require = 0) - private static void moveArmorPositions(Args args, @Local(ordinal = 3, argsOnly = true) int x, @Local(ordinal = 6) int n) { - if (!VisualSettings.global().hideModernHUDElements.isEnabled()) { - return; - } - final MinecraftClient client = MinecraftClient.getInstance(); - - final int armorWidth = 10 * viaFabricPlus$ARMOR_ICON_WIDTH; - final int offset = n * viaFabricPlus$ARMOR_ICON_WIDTH; - - args.set(1, client.getWindow().getScaledWidth() - x - armorWidth + offset - 1); - args.set(2, (int) args.get(2) + client.textRenderer.fontHeight + 1); - } - - @ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V"), slice = @Slice( - from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 2), - to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V")), index = 1, require = 0) - private int moveAir(int value) { - if (VisualSettings.global().hideModernHUDElements.isEnabled()) { - final MinecraftClient client = MinecraftClient.getInstance(); - return client.getWindow().getScaledWidth() - value - client.textRenderer.fontHeight; - } else { - return value; - } - } + // TODO UPDATE-1.21.3 +// @ModifyArgs(method = "renderArmor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V"), require = 0) +// private static void moveArmorPositions(Args args, @Local(ordinal = 3, argsOnly = true) int x, @Local(ordinal = 6) int n) { +// if (!VisualSettings.global().hideModernHUDElements.isEnabled()) { +// return; +// } +// final MinecraftClient client = MinecraftClient.getInstance(); +// +// final int armorWidth = 10 * viaFabricPlus$ARMOR_ICON_WIDTH; +// final int offset = n * viaFabricPlus$ARMOR_ICON_WIDTH; +// +// args.set(1, client.getWindow().getScaledWidth() - x - armorWidth + offset - 1); +// args.set(2, (int) args.get(2) + client.textRenderer.fontHeight + 1); +// } +// +// @ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V"), slice = @Slice( +// from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 2), +// to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V")), index = 1, require = 0) +// private int moveAir(int value) { +// if (VisualSettings.global().hideModernHUDElements.isEnabled()) { +// final MinecraftClient client = MinecraftClient.getInstance(); +// return client.getWindow().getScaledWidth() - value - client.textRenderer.fontHeight; +// } else { +// return value; +// } +// } } \ No newline at end of file