Gracefully handle invalid stone cutter recipes (#4406)

* Gracefully handle invalid stone cutter recipes

Further various little fixes:
- bump source version in AP to 17 to silence build log spam
- remove unneeded close() on auto-closable resource
This commit is contained in:
chris 2024-01-22 19:21:12 +01:00 committed by GitHub
parent 16f9f0d94f
commit 87779dca88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 11 additions and 5 deletions

View file

@ -196,7 +196,6 @@ public class MinecraftLocale {
Map.Entry<String, JsonNode> entry = localeIterator.next();
langMap.put(entry.getKey(), entry.getValue().asText());
}
localeStream.close();
return langMap;
} catch (FileNotFoundException e){
throw new AssertionError(GeyserLocale.getLocaleStringLog("geyser.locale.fail.file", locale, e.getMessage()));

View file

@ -169,6 +169,13 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator<ClientboundUpd
}
case STONECUTTING -> {
StoneCuttingRecipeData stoneCuttingData = (StoneCuttingRecipeData) recipe.getData();
if (stoneCuttingData.getIngredient().getOptions().length == 0) {
if (GeyserImpl.getInstance().getConfig().isDebugMode()) {
GeyserImpl.getInstance().getLogger().debug("Received broken stone cutter recipe: " + stoneCuttingData + " " +
recipe.getIdentifier() + " " + Registries.JAVA_ITEMS.get().get(stoneCuttingData.getResult().getId()).javaIdentifier());
}
continue;
}
ItemStack ingredient = stoneCuttingData.getIngredient().getOptions()[0];
List<StoneCuttingRecipeData> data = unsortedStonecutterData.get(ingredient.getId());
if (data == null) {