3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-07-01 19:08:07 +02:00

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
Dieser Commit ist enthalten in:
chris 2024-01-22 19:21:12 +01:00 committet von GitHub
Ursprung 16f9f0d94f
Commit 87779dca88
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
6 geänderte Dateien mit 11 neuen und 5 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -169,6 +169,13 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator<ClientboundUpd
} }
case STONECUTTING -> { case STONECUTTING -> {
StoneCuttingRecipeData stoneCuttingData = (StoneCuttingRecipeData) recipe.getData(); 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]; ItemStack ingredient = stoneCuttingData.getIngredient().getOptions()[0];
List<StoneCuttingRecipeData> data = unsortedStonecutterData.get(ingredient.getId()); List<StoneCuttingRecipeData> data = unsortedStonecutterData.get(ingredient.getId());
if (data == null) { if (data == null) {