mirror of
				https://github.com/GeyserMC/Geyser.git
				synced 2024-08-14 23:57:35 +00: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
This commit is contained in:
		
							parent
							
								
									16f9f0d94f
								
							
						
					
					
						commit
						87779dca88
					
				
					 6 changed files with 11 additions and 5 deletions
				
			
		| 
						 | 
					@ -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");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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()));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue