This commit is contained in:
s809
2023-11-11 19:20:50 +05:00
6 changed files with 27 additions and 11 deletions
@@ -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<String> 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;
}
@@ -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<IBlockStateWrapper> rendererIgnoredBlocks = null;
/** keep track of broken blocks so we don't log every time */
private static final HashSet<ResourceLocation> BrokenResourceLocations = new HashSet<>();
// properties //
@@ -345,7 +347,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;
}
@@ -372,7 +378,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();