Merge branch 'steve-ignore-blocks'

This commit is contained in:
James Seibel
2023-08-23 21:28:35 -05:00
3 changed files with 15 additions and 4 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.HashSet;
/**
* Handles converting {@link ChunkSizedFullDataAccessor}, {@link IIncompleteFullDataSource},
* and {@link IFullDataSource}'s to {@link ColumnRenderSource}.
@@ -30,7 +32,6 @@ 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();
@@ -290,6 +291,7 @@ public class FullDataToRenderDataTransformer
boolean colorBelowWithAvoidedBlocks = Config.Client.Advanced.Graphics.Quality.tintWithAvoidedBlocks.get();
FullDataPointIdMap fullDataMapping = data.getMapping();
HashSet<IBlockStateWrapper> blockStatesToIgnore = WRAPPER_FACTORY.getRendererIgnoredBlocks(level.getLevelWrapper());
boolean isVoid = true;
int colorToApplyToNextBlock = -1;
@@ -305,9 +307,10 @@ public class FullDataToRenderDataTransformer
int light = FullDataPointUtil.getLight(fullData);
IBiomeWrapper biome = fullDataMapping.getBiomeWrapper(id);
IBlockStateWrapper block = fullDataMapping.getBlockStateWrapper(id);
if (block.equals(AIR))
if (blockStatesToIgnore.contains(block))
{
// we don't render air
// Don't render: air, barriers, light blocks, etc.
continue;
}
@@ -23,10 +23,12 @@ import com.seibel.distanthorizons.core.level.IDhLevel;
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.worldGeneration.AbstractBatchGenerationEnvironmentWrapper;
import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindable;
import java.io.IOException;
import java.util.HashSet;
/**
* This handles creating abstract wrapper objects.
@@ -40,6 +42,11 @@ public interface IWrapperFactory extends IBindable
IBiomeWrapper deserializeBiomeWrapper(String str) throws IOException;
IBlockStateWrapper deserializeBlockStateWrapper(String str) throws IOException;
IBlockStateWrapper getAirBlockStateWrapper();
/**
* Returns the set of {@link IBlockStateWrapper}'s that shouldn't be rendered. <br>
* Generally this contains blocks like: air, barriers, light blocks, etc.
*/
HashSet<IBlockStateWrapper> getRendererIgnoredBlocks(ILevelWrapper levelWrapper);
/**
* Specifically designed to be used with the API.
@@ -5,6 +5,7 @@ import com.seibel.distanthorizons.api.interfaces.block.IDhApiBlockStateWrapper;
/** A Minecraft version independent way of handling Blocks. */
public interface IBlockStateWrapper extends IDhApiBlockStateWrapper
{
/** will only work if a level is currently loaded */
String serialize();
/**