Merge branch 'main' into 'main'

feat: Update rendering block ignores

See merge request jeseibel/distant-horizons-core!17
This commit is contained in:
coolGi
2023-08-24 11:49:46 +00:00
3 changed files with 12 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.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;
}
@@ -27,6 +27,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.
@@ -40,6 +41,7 @@ public interface IWrapperFactory extends IBindable
IBiomeWrapper deserializeBiomeWrapper(String str) throws IOException;
IBlockStateWrapper deserializeBlockStateWrapper(String str) throws IOException;
IBlockStateWrapper getAirBlockStateWrapper();
HashMap<String, ? extends IBlockStateWrapper> getRendererIgnoredBlocks();
/**
* Specifically designed to be used with the API.
@@ -2,6 +2,8 @@ package com.seibel.distanthorizons.core.wrapperInterfaces.block;
import com.seibel.distanthorizons.api.interfaces.block.IDhApiBlockStateWrapper;
import java.util.List;
/** A Minecraft version independent way of handling Blocks. */
public interface IBlockStateWrapper extends IDhApiBlockStateWrapper
{