Comment out even more code, mark all porting TODOs for easier searching

This commit is contained in:
FlorianMichael 2024-10-25 23:29:00 +02:00
parent 3d8e23f62a
commit 2269da2560
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
9 changed files with 61 additions and 56 deletions

View File

@ -317,7 +317,7 @@ public final class RecipeInfo {
* @return The recipe info
*/
public RecipeEntry<?> create(Identifier id) {
// return new RecipeEntry<Recipe<?>>(id, this.creator.get());
// return new RecipeEntry<Recipe<?>>(id, this.creator.get()); TODO UPDATE-1.21.3
return null;
}

View File

@ -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

View File

@ -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<Text> tooltip) {

View File

@ -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) {

View File

@ -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)) {

View File

@ -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 {

View File

@ -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;

View File

@ -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<RecipeEntry<?>> recipes = new ArrayList<>();
// final List<RecipeInfo> recipeInfos = Recipes1_11_2.getRecipes(ProtocolTranslator.getTargetVersion());
// for (int i = 0; i < recipeInfos.size(); i++) {

View File

@ -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;
// }
// }
}