Fix 1.13 recipe ingredient writing

This commit is contained in:
Nassim Jahnke 2024-11-26 16:29:44 +01:00
parent 1785677901
commit 896c6accfb
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F

View File

@ -775,7 +775,10 @@ public class Protocol1_12_2To1_13 extends AbstractProtocol<ClientboundPackets1_1
for (Item[] ingredient : recipe.ingredients()) { for (Item[] ingredient : recipe.ingredients()) {
Item[] clone = new Item[ingredient.length]; Item[] clone = new Item[ingredient.length];
for (int i = 0; i < ingredient.length; i++) { for (int i = 0; i < ingredient.length; i++) {
if (clone[i] == null) continue; if (ingredient[i] == null) {
continue;
}
clone[i] = ingredient[i].copy(); clone[i] = ingredient[i].copy();
} }
recipesPacket.write(Types.ITEM1_13_ARRAY, clone); recipesPacket.write(Types.ITEM1_13_ARRAY, clone);
@ -789,7 +792,10 @@ public class Protocol1_12_2To1_13 extends AbstractProtocol<ClientboundPackets1_1
for (Item[] ingredient : recipe.ingredients()) { for (Item[] ingredient : recipe.ingredients()) {
Item[] clone = new Item[ingredient.length]; Item[] clone = new Item[ingredient.length];
for (int i = 0; i < ingredient.length; i++) { for (int i = 0; i < ingredient.length; i++) {
if (clone[i] == null) continue; if (ingredient[i] == null) {
continue;
}
clone[i] = ingredient[i].copy(); clone[i] = ingredient[i].copy();
} }
recipesPacket.write(Types.ITEM1_13_ARRAY, clone); recipesPacket.write(Types.ITEM1_13_ARRAY, clone);
@ -800,7 +806,10 @@ public class Protocol1_12_2To1_13 extends AbstractProtocol<ClientboundPackets1_1
recipesPacket.write(Types.STRING, recipe.group()); recipesPacket.write(Types.STRING, recipe.group());
Item[] ingredient = new Item[recipe.ingredient().length]; Item[] ingredient = new Item[recipe.ingredient().length];
for (int i = 0; i < ingredient.length; i++) { for (int i = 0; i < ingredient.length; i++) {
if (recipe.ingredient()[i] == null) continue; if (recipe.ingredient()[i] == null) {
continue;
}
ingredient[i] = recipe.ingredient()[i].copy(); ingredient[i] = recipe.ingredient()[i].copy();
} }
recipesPacket.write(Types.ITEM1_13_ARRAY, ingredient); recipesPacket.write(Types.ITEM1_13_ARRAY, ingredient);