mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-12-19 14:59:27 +00:00
Fixed invalid recipe (non-vanilla items) (#5596)
* Fixed invalid recipe (non-vanilla item). * Added comments.
This commit is contained in:
@@ -310,6 +310,12 @@ public class JavaRecipeBookAddTranslator extends PacketTranslator<ClientboundRec
|
||||
return ItemDescriptorWithCount.EMPTY;
|
||||
}
|
||||
ItemMapping mapping = session.getItemMappings().getMapping(item);
|
||||
|
||||
// This is likely a modded java item or some item Geyser haven't mapped.
|
||||
if (mapping.getJavaItem().javaId() == Items.AIR_ID) {
|
||||
return ItemDescriptorWithCount.EMPTY;
|
||||
}
|
||||
|
||||
return new ItemDescriptorWithCount(new DefaultDescriptor(mapping.getBedrockDefinition(), mapping.getBedrockData()), 1); // Need to check count
|
||||
}
|
||||
|
||||
@@ -362,6 +368,12 @@ public class JavaRecipeBookAddTranslator extends PacketTranslator<ClientboundRec
|
||||
if (translated == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// As of 1.21.82, Bedrock will crash if we tried to send invalid descriptor.
|
||||
if (translated.contains(ItemDescriptorWithCount.EMPTY)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
inputs.add(translated);
|
||||
if (translated.size() != 1 || translated.get(0) != ItemDescriptorWithCount.EMPTY) {
|
||||
empty = false;
|
||||
|
||||
Reference in New Issue
Block a user