3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Fix recipe removal array index

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-10-06 09:32:25 +02:00
Ursprung 0a56e57aec
Commit 4871977681
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F

Datei anzeigen

@ -247,7 +247,8 @@ public final class BlockItemPacketRewriter1_21_2 extends StructuredItemRewriter<
wrapper.setPacketType(ClientboundPackets1_21_2.RECIPE_BOOK_REMOVE); wrapper.setPacketType(ClientboundPackets1_21_2.RECIPE_BOOK_REMOVE);
final int[] ids = new int[recipes.length]; final int[] ids = new int[recipes.length];
for (final String recipeKey : recipes) { for (int i = 0; i < recipes.length; i++) {
final String recipeKey = recipes[i];
final RecipeRewriter1_21_2.Recipe recipe = recipeRewriter.recipe(recipeKey); final RecipeRewriter1_21_2.Recipe recipe = recipeRewriter.recipe(recipeKey);
if (recipe == null) { if (recipe == null) {
protocol.getLogger().severe("Recipe not found for key " + recipeKey); protocol.getLogger().severe("Recipe not found for key " + recipeKey);
@ -255,7 +256,7 @@ public final class BlockItemPacketRewriter1_21_2 extends StructuredItemRewriter<
return; return;
} }
ids[recipe.index()] = recipe.index(); ids[i] = recipe.index();
} }
wrapper.write(Types.VAR_INT_ARRAY_PRIMITIVE, ids); wrapper.write(Types.VAR_INT_ARRAY_PRIMITIVE, ids);
@ -268,7 +269,7 @@ public final class BlockItemPacketRewriter1_21_2 extends StructuredItemRewriter<
for (final String recipeKey : recipes) { for (final String recipeKey : recipes) {
final RecipeRewriter1_21_2.Recipe recipe = recipeRewriter.recipe(recipeKey); final RecipeRewriter1_21_2.Recipe recipe = recipeRewriter.recipe(recipeKey);
if (recipe == null) { if (recipe == null) {
// Special recipes, or bad data // Stonecutting and smithing recipes, or bad data
size--; size--;
continue; continue;
} }