Skip to content

Commit

Permalink
Comment out even more code, mark all porting TODOs for easier searching
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Oct 25, 2024
1 parent ef85f86 commit 78d5c0f
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public static RecipeInfo smelting(ItemConvertible output, Ingredient input, floa
* @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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static List<RecipeInfo> getRecipes(final ProtocolVersion targetVersion) {
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)));
Expand Down Expand Up @@ -625,7 +625,7 @@ public static List<RecipeInfo> getRecipes(final ProtocolVersion targetVersion) {
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));
Expand Down Expand Up @@ -685,7 +685,7 @@ public static List<RecipeInfo> getRecipes(final ProtocolVersion targetVersion) {
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)) {
Expand All @@ -710,7 +710,7 @@ public static void setCraftingResultSlot(final int syncId, final ScreenHandler s
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@ private int disableServerPinging(int x) {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,11 @@ private boolean allowElytraWhenClimbing(boolean original) {
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")),
Expand Down Expand Up @@ -208,12 +209,13 @@ 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 (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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private void modifyPosWithYOffset(float offset, CallbackInfoReturnable<BlockPos>
}
}

// 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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,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) {
// private double fixCosTable(double a) { TODO UPDATE-1.21.3
// if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_18)) {
// return MathHelper.cos((float) a);
// } else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,18 +238,19 @@ private void emulateSimulationDistance(ChunkLoadDistanceS2CPacket packet, Callba
}
}

@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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,31 @@ private int moveHealthDown(int value) {
}
}

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

}

0 comments on commit 78d5c0f

Please sign in to comment.