3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-20 06:50:08 +01:00

Replace empty items in recipes

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-04-08 10:53:39 +02:00
Ursprung 8c5752bb4c
Commit 510747a7cd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F

Datei anzeigen

@ -251,7 +251,17 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
} }
}); });
final RecipeRewriter1_20_3<ClientboundPacket1_20_3> recipeRewriter = new RecipeRewriter1_20_3<>(protocol); final RecipeRewriter1_20_3<ClientboundPacket1_20_3> recipeRewriter = new RecipeRewriter1_20_3<ClientboundPacket1_20_3>(protocol) {
@Override
protected Item rewrite(@Nullable Item item) {
item = super.rewrite(item);
if (item == null || item.isEmpty()) {
// Does not allow empty items
return new StructuredItem(1, 1);
}
return item;
}
};
protocol.registerClientbound(ClientboundPackets1_20_3.DECLARE_RECIPES, wrapper -> { protocol.registerClientbound(ClientboundPackets1_20_3.DECLARE_RECIPES, wrapper -> {
final int size = wrapper.passthrough(Type.VAR_INT); final int size = wrapper.passthrough(Type.VAR_INT);
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {