mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 01:55:47 +01:00
Fix recipe removal array index
This commit is contained in:
parent
0a56e57aec
commit
4871977681
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user