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

@ -30,7 +30,7 @@ import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
@SupportedAnnotationTypes("*")
@SupportedSourceVersion(SourceVersion.RELEASE_16)
@SupportedSourceVersion(SourceVersion.RELEASE_17)
public class BlockEntityProcessor extends ClassProcessor {
public BlockEntityProcessor() {
super("org.geysermc.geyser.translator.level.block.entity.BlockEntity");

View File

@ -30,7 +30,7 @@ import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
@SupportedAnnotationTypes("*")
@SupportedSourceVersion(SourceVersion.RELEASE_16)
@SupportedSourceVersion(SourceVersion.RELEASE_17)
public class CollisionRemapperProcessor extends ClassProcessor {
public CollisionRemapperProcessor() {
super("org.geysermc.geyser.translator.collision.CollisionRemapper");

View File

@ -30,7 +30,7 @@ import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
@SupportedAnnotationTypes("*")
@SupportedSourceVersion(SourceVersion.RELEASE_16)
@SupportedSourceVersion(SourceVersion.RELEASE_17)
public class PacketTranslatorProcessor extends ClassProcessor {
public PacketTranslatorProcessor() {
super("org.geysermc.geyser.translator.protocol.Translator");

View File

@ -30,7 +30,7 @@ import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
@SupportedAnnotationTypes("*")
@SupportedSourceVersion(SourceVersion.RELEASE_16)
@SupportedSourceVersion(SourceVersion.RELEASE_17)
public class SoundHandlerProcessor extends ClassProcessor {
public SoundHandlerProcessor() {
super("org.geysermc.geyser.translator.sound.SoundTranslator");

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) {