feat: Update rendering block ignores

Barrier blocks, structure void blocks, light blocks, and air blocks now share 2 `HashMap`s that define blocks that should be ignored by the LOD builder.
This commit is contained in:
Steveplays28
2023-08-21 03:41:27 +02:00
parent ce4d50654d
commit d9283e938b
3 changed files with 15 additions and 9 deletions
@@ -18,11 +18,13 @@ import com.seibel.distanthorizons.core.pos.DhSectionPos;
import com.seibel.distanthorizons.core.util.FullDataPointUtil;
import com.seibel.distanthorizons.core.util.LodUtil;
import com.seibel.distanthorizons.core.util.RenderDataPointUtil;
import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory;
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory;
import com.seibel.distanthorizons.coreapi.util.BitShiftUtil;
import java.util.HashMap;
/**
* Handles converting {@link ChunkSizedFullDataAccessor}, {@link IIncompleteFullDataSource},
* and {@link IFullDataSource}'s to {@link ColumnRenderSource}.
@@ -30,7 +32,7 @@ import com.seibel.distanthorizons.coreapi.util.BitShiftUtil;
public class FullDataToRenderDataTransformer
{
private static final IWrapperFactory WRAPPER_FACTORY = SingletonInjector.INSTANCE.get(IWrapperFactory.class);
private static final IBlockStateWrapper AIR = WRAPPER_FACTORY.getAirBlockStateWrapper();
private static final HashMap<String, ? extends IBlockStateWrapper> RENDERER_IGNORED_BLOCKS = WRAPPER_FACTORY.getRendererIgnoredBlocks();
@@ -305,9 +307,11 @@ public class FullDataToRenderDataTransformer
int light = FullDataPointUtil.getLight(fullData);
IBiomeWrapper biome = fullDataMapping.getBiomeWrapper(id);
IBlockStateWrapper block = fullDataMapping.getBlockStateWrapper(id);
if (block.equals(AIR))
if (RENDERER_IGNORED_BLOCKS.containsValue(block))
{
// we don't render air
// Don't render a block that's marked as ignored by the renderer
// This map should include air (if it doesn't, the map either got refactored or something is wrong)
continue;
}
@@ -28,6 +28,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.worldGeneration.Abstrac
import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindable;
import java.io.IOException;
import java.util.HashMap;
/**
* This handles creating abstract wrapper objects.
@@ -41,6 +42,7 @@ public interface IWrapperFactory extends IBindable
IBiomeWrapper deserializeBiomeWrapper(String str, ILevelWrapper levelWrapper) throws IOException;
IBlockStateWrapper deserializeBlockStateWrapper(String str, ILevelWrapper levelWrapper) throws IOException;
IBlockStateWrapper getAirBlockStateWrapper();
HashMap<String, ? extends IBlockStateWrapper> getRendererIgnoredBlocks();
/**
* Specifically designed to be used with the API.
@@ -6,16 +6,16 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
/** A Minecraft version independent way of handling Blocks. */
public interface IBlockStateWrapper extends IDhApiBlockStateWrapper
{
String serialize();
String serialize();
ILevelWrapper getLevelWrapper();
/**
* Returning a value of 0 means the block is completely transparent. <br.
* Returning a value of 15 means the block is completely opaque.
*/
int getOpacity();
int getLightEmission();
}