From dbc84cc0f32b64376ef3044f771a0a16ac95580d Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 3 Nov 2023 19:43:00 -0500 Subject: [PATCH 1/3] Add invalid fullData ID handling --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 0b3958eb5..4b8f27ed7 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 0b3958eb58386e76fd380e161cc22e251ad113b0 +Subproject commit 4b8f27ed78c4440d4cc76b66433d4deb30bfdaa0 From 34565992ea51119ad1f4945a1253097fba50f0e2 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 4 Nov 2023 15:42:16 -0500 Subject: [PATCH 2/3] Only log broken BlockState and Biomes deserializations once --- .../common/wrappers/block/BiomeWrapper.java | 10 +++++++++- .../common/wrappers/block/BlockStateWrapper.java | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java index ff03efcab..63fd98561 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java @@ -20,6 +20,7 @@ package com.seibel.distanthorizons.common.wrappers.block; import java.io.IOException; +import java.util.HashSet; import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -74,6 +75,9 @@ public class BiomeWrapper implements IBiomeWrapper public static final String EMPTY_STRING = "EMPTY"; public static final BiomeWrapper EMPTY_WRAPPER = new BiomeWrapper(null, null); + /** keep track of broken biomes so we don't log every time */ + private static final HashSet BrokenResourceLocationStrings = new HashSet<>(); + // properties // @@ -266,7 +270,11 @@ public class BiomeWrapper implements IBiomeWrapper if (!success) { - LOGGER.warn("Unable to deserialize biome from string: [" + resourceLocationString + "]"); + if (!BrokenResourceLocationStrings.contains(resourceLocationString)) + { + BrokenResourceLocationStrings.add(resourceLocationString); + LOGGER.warn("Unable to deserialize biome from string: [" + resourceLocationString + "]"); + } return EMPTY_WRAPPER; } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 87fcfc854..ccd1e4fe2 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -67,9 +67,11 @@ public class BlockStateWrapper implements IBlockStateWrapper // TODO: Make this changeable through the config public static final String[] RENDERER_IGNORED_BLOCKS_RESOURCE_LOCATIONS = { AIR_STRING, "minecraft:barrier", "minecraft:structure_void", "minecraft:light", "minecraft:tripwire" }; - public static HashSet rendererIgnoredBlocks = null; + /** keep track of broken blocks so we don't log every time */ + private static final HashSet BrokenResourceLocations = new HashSet<>(); + // properties // @@ -347,7 +349,11 @@ public class BlockStateWrapper implements IBlockStateWrapper if (block == null) { // shouldn't normally happen, but here to make the compiler happy - LOGGER.warn("Unable to find BlockState with the resourceLocation [" + resourceLocation + "] and properties: [" + blockStatePropertiesString + "]. Air will be used instead, some data may be lost."); + if (!BrokenResourceLocations.contains(resourceLocation)) + { + BrokenResourceLocations.add(resourceLocation); + LOGGER.warn("Unable to find BlockState with the resourceLocation [" + resourceLocation + "] and properties: [" + blockStatePropertiesString + "]. Air will be used instead, some data may be lost."); + } return AIR; } @@ -374,7 +380,11 @@ public class BlockStateWrapper implements IBlockStateWrapper if (blockStatePropertiesString != null) { // we should have found a blockstate, but didn't - LOGGER.warn("Unable to find BlockState for Block [" + resourceLocation + "] with properties: [" + blockStatePropertiesString + "]. Using the default block state."); + if (!BrokenResourceLocations.contains(resourceLocation)) + { + BrokenResourceLocations.add(resourceLocation); + LOGGER.warn("Unable to find BlockState for Block [" + resourceLocation + "] with properties: [" + blockStatePropertiesString + "]. Using the default block state."); + } } foundState = block.defaultBlockState(); From 924b2b7e8e66f8ee738c1439d0811896661deea6 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 4 Nov 2023 15:42:32 -0500 Subject: [PATCH 3/3] Update coreSubProjects --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index 4b8f27ed7..d07a28532 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 4b8f27ed78c4440d4cc76b66433d4deb30bfdaa0 +Subproject commit d07a2853239e4ff1a9e04793a9a4fc054248cd42