Move IBlockStateWrapper constants into LodUtil
This commit is contained in:
+2
-1
@@ -32,6 +32,7 @@ import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.util.ColorUtil;
|
||||
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;
|
||||
@@ -236,7 +237,7 @@ public class FullDataToRenderDataTransformer
|
||||
|
||||
|
||||
// solid block check
|
||||
if (avoidSolidBlocks && !block.isSolid() && !block.isLiquid() && block.getOpacity() != IBlockStateWrapper.FULLY_OPAQUE)
|
||||
if (avoidSolidBlocks && !block.isSolid() && !block.isLiquid() && block.getOpacity() != LodUtil.BLOCK_FULLY_OPAQUE)
|
||||
{
|
||||
if (colorBelowWithAvoidedBlocks)
|
||||
{
|
||||
|
||||
+1
-1
@@ -297,7 +297,7 @@ public class LodDataBuilder
|
||||
|
||||
// this block isn't on a chunk boundary, check if it is next to a transparent/air block
|
||||
IBlockStateWrapper blockState = chunkWrapper.getBlockState(testBlockPos);
|
||||
return blockState.isAir() || blockState.getOpacity() != IBlockStateWrapper.FULLY_OPAQUE;
|
||||
return blockState.isAir() || blockState.getOpacity() != LodUtil.BLOCK_FULLY_OPAQUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
import com.seibel.distanthorizons.coreapi.util.BitShiftUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.*;
|
||||
@@ -152,7 +151,7 @@ public class DhLightingEngine
|
||||
for (int y = maxY; y >= minY; y--)
|
||||
{
|
||||
IBlockStateWrapper block = chunk.getBlockState(relX, y, relZ);
|
||||
if (block != null && block.getOpacity() != IBlockStateWrapper.FULLY_TRANSPARENT)
|
||||
if (block != null && block.getOpacity() != LodUtil.BLOCK_FULLY_TRANSPARENT)
|
||||
{
|
||||
// keep moving down until we find a non-transparent block
|
||||
break;
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.CompletionException;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
@@ -33,6 +35,7 @@ import com.seibel.distanthorizons.core.render.vertexFormat.DefaultLodVertexForma
|
||||
import com.seibel.distanthorizons.core.render.vertexFormat.LodVertexFormat;
|
||||
import com.seibel.distanthorizons.core.util.gridList.EdgeDistanceBooleanGrid;
|
||||
import com.seibel.distanthorizons.core.util.objects.UncheckedInterruptedException;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IDimensionTypeWrapper;
|
||||
@@ -66,9 +69,6 @@ public class LodUtil
|
||||
|
||||
|
||||
|
||||
/** The maximum number of LODs that can be rendered vertically */
|
||||
public static final int MAX_NUMBER_OF_VERTICAL_LODS = 32;
|
||||
|
||||
/**
|
||||
* alpha used when drawing chunks in debug mode
|
||||
*/
|
||||
@@ -123,6 +123,23 @@ public class LodUtil
|
||||
/** lowest possible light level handled by Minecraft */
|
||||
public static final byte MIN_MC_LIGHT = 0;
|
||||
|
||||
/** the opacity value returned by {@link IBlockStateWrapper#getOpacity()} if a block is fully transparent */
|
||||
public static final int BLOCK_FULLY_TRANSPARENT = 0;
|
||||
/** the opacity value returned by {@link IBlockStateWrapper#getOpacity()} if a block is fully opaque */
|
||||
public static final int BLOCK_FULLY_OPAQUE = 16;
|
||||
|
||||
/**
|
||||
* List of every block that can be used in a beacon's base. <br>
|
||||
* Should be all lowercase
|
||||
*/
|
||||
public static final List<String> BEACON_BASE_BLOCK_NAME_LIST = Arrays.asList(
|
||||
"iron_block",
|
||||
"gold_block",
|
||||
"diamond_block",
|
||||
"emerald_block",
|
||||
"netherite_block"
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+3
-16
@@ -20,10 +20,9 @@
|
||||
package com.seibel.distanthorizons.core.wrapperInterfaces.block;
|
||||
|
||||
import com.seibel.distanthorizons.api.interfaces.block.IDhApiBlockStateWrapper;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/** A Minecraft version independent way of handling Blocks. */
|
||||
public interface IBlockStateWrapper extends IDhApiBlockStateWrapper
|
||||
@@ -32,18 +31,6 @@ public interface IBlockStateWrapper extends IDhApiBlockStateWrapper
|
||||
// constants //
|
||||
//===========//
|
||||
|
||||
int FULLY_TRANSPARENT = 0;
|
||||
int FULLY_OPAQUE = 16;
|
||||
|
||||
/** should be all lowercase */
|
||||
List<String> BEACON_BASE_BLOCK_NAME_LIST = Arrays.asList(
|
||||
"iron_block",
|
||||
"gold_block",
|
||||
"diamond_block",
|
||||
"emerald_block",
|
||||
"netherite_block"
|
||||
);
|
||||
|
||||
/** contains the indices used by Iris to determine how different block types should be rendered */
|
||||
class IrisBlockMaterial
|
||||
{
|
||||
@@ -81,8 +68,8 @@ public interface IBlockStateWrapper extends IDhApiBlockStateWrapper
|
||||
* Returning a value of 0 means the block is completely transparent. <br.
|
||||
* Returning a value of 15 means the block is completely opaque.
|
||||
*
|
||||
* @see IBlockStateWrapper#FULLY_OPAQUE
|
||||
* @see IBlockStateWrapper#FULLY_TRANSPARENT
|
||||
* @see LodUtil#BLOCK_FULLY_OPAQUE
|
||||
* @see LodUtil#BLOCK_FULLY_TRANSPARENT
|
||||
*/
|
||||
int getOpacity();
|
||||
|
||||
|
||||
+1
-1
@@ -326,7 +326,7 @@ public interface IChunkWrapper extends IBindable
|
||||
for (int y = beaconRelPos.y+1; y <= maxY; y++)
|
||||
{
|
||||
IBlockStateWrapper block = centerChunk.getBlockState(beaconRelPos.x, y, beaconRelPos.z);
|
||||
if (!block.isAir() && block.getOpacity() == IBlockStateWrapper.FULLY_OPAQUE)
|
||||
if (!block.isAir() && block.getOpacity() == LodUtil.BLOCK_FULLY_OPAQUE)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class LightingTestChunkWrapper implements IChunkWrapper
|
||||
IBlockStateWrapper block = chunkWrapper.getBlockState(x,y,z);
|
||||
|
||||
int opacity = block.getOpacity();
|
||||
if (opacity >= IBlockStateWrapper.FULLY_OPAQUE)
|
||||
if (opacity >= LodUtil.BLOCK_FULLY_OPAQUE)
|
||||
{
|
||||
opacity = 3;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user