Skip to content

Commit

Permalink
Comment out recipe fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Oct 25, 2024
1 parent d3b139f commit babdc95
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ResourcePackHeaderDiff {
private final static Map<ProtocolVersion, GameVersion> GAME_VERSION_DIFF = new HashMap<>();

static {
registerVersion(ProtocolVersion.v1_21_2, 42, "1.21.2");
registerVersion(ProtocolVersion.v1_21_2, 42, "1.21.3");
registerVersion(ProtocolVersion.v1_21, 34, "1.21.1");
registerVersion(ProtocolVersion.v1_20_5, 32, "1.20.6");
registerVersion(ProtocolVersion.v1_20_3, 22, "1.20.4");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ 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());
return null;
}

}
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)));
}
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));
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));
recipes.add(RecipeInfo.smelting(Items.GREEN_DYE, Items.CACTUS, 0.2F));
}
if (targetVersion.newerThanOrEqualTo(LegacyProtocolVersion.a1_2_0toa1_2_1_1)) {
Expand All @@ -710,13 +710,13 @@ 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()
.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
// final var result = network.getRecipeManager()
// .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

// Update the result slot
network.onScreenHandlerSlotUpdate(new ScreenHandlerSlotUpdateS2CPacket(syncId, screenHandler.getRevision(), 0, result));
//network.onScreenHandlerSlotUpdate(new ScreenHandlerSlotUpdateS2CPacket(syncId, screenHandler.getRevision(), 0, result));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,14 @@ private void cancelSmallChanges(Entity instance, double x, double y, double z, f

@Inject(method = "onGameJoin", at = @At("RETURN"))
private void sendRecipes(GameJoinS2CPacket packet, CallbackInfo ci) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) {
final List<RecipeEntry<?>> recipes = new ArrayList<>();
final List<RecipeInfo> recipeInfos = Recipes1_11_2.getRecipes(ProtocolTranslator.getTargetVersion());
for (int i = 0; i < recipeInfos.size(); i++) {
recipes.add(recipeInfos.get(i).create(Identifier.of("viafabricplus", "recipe/" + i)));
}
this.onSynchronizeRecipes(new SynchronizeRecipesS2CPacket(recipes));
}
// if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) {
// final List<RecipeEntry<?>> recipes = new ArrayList<>();
// final List<RecipeInfo> recipeInfos = Recipes1_11_2.getRecipes(ProtocolTranslator.getTargetVersion());
// for (int i = 0; i < recipeInfos.size(); i++) {
// recipes.add(recipeInfos.get(i).create(Identifier.of("viafabricplus", "recipe/" + i)));
// }
// this.onSynchronizeRecipes(new SynchronizeRecipesS2CPacket(recipes));
// }
ClientsideFixes.globalTablistIndex = 0;
((IPlayerListHud) MinecraftClient.getInstance().inGameHud.getPlayerListHud()).viaFabricPlus$setMaxPlayers(packet.maxPlayers());
}
Expand Down

0 comments on commit babdc95

Please sign in to comment.