Preprocessor cleanup + colored beacons for 1.12.2
This commit is contained in:
+27
-10
@@ -119,7 +119,11 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
// constructors //
|
// constructors //
|
||||||
//==============//
|
//==============//
|
||||||
|
|
||||||
public static BiomeWrapper getBiomeWrapper(#if MC_VER < MC_1_18_2 Biome #else Holder<Biome> #endif biome, ILevelWrapper levelWrapper)
|
#if MC_VER < MC_1_18_2
|
||||||
|
public static BiomeWrapper getBiomeWrapper(Biome biome, ILevelWrapper levelWrapper)
|
||||||
|
#else
|
||||||
|
public static BiomeWrapper getBiomeWrapper(Holder<Biome> biome, ILevelWrapper levelWrapper)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (biome == null)
|
if (biome == null)
|
||||||
{
|
{
|
||||||
@@ -139,7 +143,12 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
return newWrapper;
|
return newWrapper;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private BiomeWrapper(#if MC_VER < MC_1_18_2 Biome #else Holder<Biome> #endif biome, ILevelWrapper levelWrapper)
|
|
||||||
|
#if MC_VER < MC_1_18_2
|
||||||
|
private BiomeWrapper(Biome biome, ILevelWrapper levelWrapper)
|
||||||
|
#else
|
||||||
|
private BiomeWrapper(Holder<Biome> biome, ILevelWrapper levelWrapper)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
this.biome = biome;
|
this.biome = biome;
|
||||||
this.serialString = this.serialize(levelWrapper);
|
this.serialString = this.serialize(levelWrapper);
|
||||||
@@ -312,9 +321,11 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
BiomeDeserializeResult deserializeResult = deserializeBiome(resourceLocationString #if MC_VER > MC_1_12_2, registryAccess #endif);
|
BiomeDeserializeResult deserializeResult = deserializeBiome(resourceLocationString);
|
||||||
|
#else
|
||||||
|
BiomeDeserializeResult deserializeResult = deserializeBiome(resourceLocationString, registryAccess);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (!deserializeResult.success)
|
if (!deserializeResult.success)
|
||||||
@@ -342,9 +353,11 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BiomeDeserializeResult deserializeBiome(String resourceLocationString
|
#if MC_VER <= MC_1_12_2
|
||||||
#if MC_VER > MC_1_12_2, net.minecraft.core.RegistryAccess registryAccess #endif
|
public static BiomeDeserializeResult deserializeBiome(String resourceLocationString) throws IOException
|
||||||
) throws IOException
|
#else
|
||||||
|
public static BiomeDeserializeResult deserializeBiome(String resourceLocationString, net.minecraft.core.RegistryAccess registryAccess) throws IOException
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// parse the resource location
|
// parse the resource location
|
||||||
int separatorIndex = resourceLocationString.indexOf(":");
|
int separatorIndex = resourceLocationString.indexOf(":");
|
||||||
@@ -435,9 +448,13 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
public final Biome biome;
|
public final Biome biome;
|
||||||
#else
|
#else
|
||||||
public final Holder<Biome> biome;
|
public final Holder<Biome> biome;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public BiomeDeserializeResult(boolean success, #if MC_VER < MC_1_18_2 Biome #else Holder<Biome> #endif biome)
|
#if MC_VER < MC_1_18_2
|
||||||
|
public BiomeDeserializeResult(boolean success, Biome biome)
|
||||||
|
#else
|
||||||
|
public BiomeDeserializeResult(boolean success, Holder<Biome> biome)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
this.success = success;
|
this.success = success;
|
||||||
this.biome = biome;
|
this.biome = biome;
|
||||||
|
|||||||
+116
-40
@@ -33,11 +33,8 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
|||||||
import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector;
|
import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.block.BlockLeaves;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.block.BlockLiquid;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraftforge.fluids.IFluidBlock;
|
import net.minecraftforge.fluids.IFluidBlock;
|
||||||
@@ -101,7 +98,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
// must be defined before AIR, otherwise a null pointer will be thrown
|
// must be defined before AIR, otherwise a null pointer will be thrown
|
||||||
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||||
|
|
||||||
public static final ConcurrentHashMap<#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif, BlockStateWrapper> WRAPPER_BY_BLOCK_STATE = new ConcurrentHashMap<>();
|
#if MC_VER <= MC_1_12_2
|
||||||
|
public static final ConcurrentHashMap<IBlockState, BlockStateWrapper> WRAPPER_BY_BLOCK_STATE = new ConcurrentHashMap<>();
|
||||||
|
#else
|
||||||
|
public static final ConcurrentHashMap<BlockState, BlockStateWrapper> WRAPPER_BY_BLOCK_STATE = new ConcurrentHashMap<>();
|
||||||
|
#endif
|
||||||
public static final ConcurrentHashMap<String, BlockStateWrapper> WRAPPER_BY_RESOURCE_LOCATION = new ConcurrentHashMap<>();
|
public static final ConcurrentHashMap<String, BlockStateWrapper> WRAPPER_BY_RESOURCE_LOCATION = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public static final String AIR_STRING = "AIR";
|
public static final String AIR_STRING = "AIR";
|
||||||
@@ -128,7 +129,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
// properties //
|
// properties //
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public final #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState;
|
#if MC_VER <= MC_1_12_2
|
||||||
|
public final IBlockState blockState;
|
||||||
|
#else
|
||||||
|
public final BlockState blockState;
|
||||||
|
#endif
|
||||||
/** technically final, but since it requires a method call to generate it can't be marked as such */
|
/** technically final, but since it requires a method call to generate it can't be marked as such */
|
||||||
private String serialString;
|
private String serialString;
|
||||||
private final int hashCode;
|
private final int hashCode;
|
||||||
@@ -157,9 +162,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
* Can be faster than BlockStateWrapper#fromBlockState(BlockState, ILevelWrapper)
|
* Can be faster than BlockStateWrapper#fromBlockState(BlockState, ILevelWrapper)
|
||||||
* in cases where the same block state is expected to be referenced multiple times.
|
* in cases where the same block state is expected to be referenced multiple times.
|
||||||
*/
|
*/
|
||||||
public static BlockStateWrapper fromBlockState(
|
#if MC_VER <= MC_1_12_2
|
||||||
#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState,
|
public static BlockStateWrapper fromBlockState(IBlockState blockState, ILevelWrapper levelWrapper, IBlockStateWrapper guess)
|
||||||
ILevelWrapper levelWrapper, IBlockStateWrapper guess)
|
#else
|
||||||
|
public static BlockStateWrapper fromBlockState(BlockState blockState, ILevelWrapper levelWrapper, IBlockStateWrapper guess)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (guess == null)
|
if (guess == null)
|
||||||
{
|
{
|
||||||
@@ -169,7 +176,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
|
|
||||||
// guess block state
|
// guess block state
|
||||||
BlockStateWrapper wrapperGuess = (BlockStateWrapper) guess;
|
BlockStateWrapper wrapperGuess = (BlockStateWrapper) guess;
|
||||||
#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif guessBlockState;
|
#if MC_VER <= MC_1_12_2
|
||||||
|
IBlockState guessBlockState;
|
||||||
|
#else
|
||||||
|
BlockState guessBlockState;
|
||||||
|
#endif
|
||||||
if(isAir(wrapperGuess.blockState))
|
if(isAir(wrapperGuess.blockState))
|
||||||
{
|
{
|
||||||
guessBlockState = null;
|
guessBlockState = null;
|
||||||
@@ -184,7 +195,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// input block state
|
// input block state
|
||||||
#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif inputBlockState;
|
#if MC_VER <= MC_1_12_2
|
||||||
|
IBlockState inputBlockState;
|
||||||
|
#else
|
||||||
|
BlockState inputBlockState;
|
||||||
|
#endif
|
||||||
if (isAir(blockState))
|
if (isAir(blockState))
|
||||||
{
|
{
|
||||||
inputBlockState = null;
|
inputBlockState = null;
|
||||||
@@ -202,9 +217,12 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
|
|
||||||
return fromBlockState(blockState, levelWrapper);
|
return fromBlockState(blockState, levelWrapper);
|
||||||
}
|
}
|
||||||
public static BlockStateWrapper fromBlockState(
|
|
||||||
@Nullable #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState,
|
#if MC_VER <= MC_1_12_2
|
||||||
ILevelWrapper levelWrapper)
|
public static BlockStateWrapper fromBlockState(@Nullable IBlockState blockState, ILevelWrapper levelWrapper)
|
||||||
|
#else
|
||||||
|
public static BlockStateWrapper fromBlockState(@Nullable BlockState blockState, ILevelWrapper levelWrapper)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// air is a special case
|
// air is a special case
|
||||||
if (isAir(blockState))
|
if (isAir(blockState))
|
||||||
@@ -253,9 +271,12 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private BlockStateWrapper(
|
|
||||||
@Nullable #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState, ILevelWrapper levelWrapper,
|
#if MC_VER <= MC_1_12_2
|
||||||
@Nullable DhApiBlockStateWrapperCreatedEvent.EventParam overrideEventParam)
|
private BlockStateWrapper(@Nullable IBlockState blockState, ILevelWrapper levelWrapper, @Nullable DhApiBlockStateWrapperCreatedEvent.EventParam overrideEventParam)
|
||||||
|
#else
|
||||||
|
private BlockStateWrapper(@Nullable BlockState blockState, ILevelWrapper levelWrapper, @Nullable DhApiBlockStateWrapperCreatedEvent.EventParam overrideEventParam)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
this.blockState = blockState;
|
this.blockState = blockState;
|
||||||
this.serialString = serialize(blockState, levelWrapper);
|
this.serialString = serialize(blockState, levelWrapper);
|
||||||
@@ -374,16 +395,26 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
|
|
||||||
// beacon tint color
|
// beacon tint color
|
||||||
Color beaconTintColor = null;
|
Color beaconTintColor = null;
|
||||||
// 1.12.2 doesn't support changing the beacon beam color
|
|
||||||
#if MC_VER > MC_1_12_2
|
|
||||||
if (this.blockState != null
|
if (this.blockState != null
|
||||||
// beacon blocks also show up here, but since they block the beacon beam we don't want their color
|
// beacon blocks also show up here, but since they block the beacon beam we don't want their color
|
||||||
&& !this.isBeaconBlock)
|
&& !this.isBeaconBlock)
|
||||||
{
|
{
|
||||||
Block block = this.blockState.getBlock();
|
Block block = this.blockState.getBlock();
|
||||||
|
int colorInt;
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
if (block instanceof BlockStainedGlass)
|
||||||
|
{
|
||||||
|
colorInt = blockState.getValue(BlockStainedGlass.COLOR).getColorValue();
|
||||||
|
beaconTintColor = ColorUtil.toColorObjRGB(colorInt);
|
||||||
|
}
|
||||||
|
else if (block instanceof BlockStainedGlassPane)
|
||||||
|
{
|
||||||
|
colorInt = blockState.getValue(BlockStainedGlassPane.COLOR).getColorValue();
|
||||||
|
beaconTintColor = ColorUtil.toColorObjRGB(colorInt);
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (block instanceof BeaconBeamBlock)
|
if (block instanceof BeaconBeamBlock)
|
||||||
{
|
{
|
||||||
int colorInt;
|
|
||||||
#if MC_VER <= MC_1_19_4
|
#if MC_VER <= MC_1_19_4
|
||||||
colorInt = ((BeaconBeamBlock) block).getColor().getMaterialColor().col;
|
colorInt = ((BeaconBeamBlock) block).getColor().getMaterialColor().col;
|
||||||
#else
|
#else
|
||||||
@@ -392,8 +423,8 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
|
|
||||||
beaconTintColor = ColorUtil.toColorObjRGB(colorInt);
|
beaconTintColor = ColorUtil.toColorObjRGB(colorInt);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
this.beaconTintColor = beaconTintColor;
|
this.beaconTintColor = beaconTintColor;
|
||||||
|
|
||||||
|
|
||||||
@@ -483,11 +514,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
// static constructor helpers //
|
// static constructor helpers //
|
||||||
//region
|
//region
|
||||||
|
|
||||||
private static EDhApiBlockMaterial calculateEDhApiBlockMaterialId(
|
#if MC_VER <= MC_1_12_2
|
||||||
@Nullable #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState,
|
private static EDhApiBlockMaterial calculateEDhApiBlockMaterialId(@Nullable IBlockState blockState, String lowercaseSerialString, boolean isLiquid)
|
||||||
String lowercaseSerialString,
|
#else
|
||||||
boolean isLiquid
|
private static EDhApiBlockMaterial calculateEDhApiBlockMaterialId(@Nullable BlockState blockState, String lowercaseSerialString, boolean isLiquid)
|
||||||
)
|
#endif
|
||||||
{
|
{
|
||||||
if (isAir(blockState))
|
if (isAir(blockState))
|
||||||
{
|
{
|
||||||
@@ -741,10 +772,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
return EDhApiBlockMaterial.UNKNOWN;
|
return EDhApiBlockMaterial.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int calculateOpacity(
|
#if MC_VER <= MC_1_12_2
|
||||||
@Nullable #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState,
|
private static int calculateOpacity(@Nullable IBlockState blockState, boolean isAir, boolean isLiquid)
|
||||||
boolean isAir, boolean isLiquid
|
#else
|
||||||
)
|
private static int calculateOpacity(@Nullable BlockState blockState, boolean isAir, boolean isLiquid)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// get block properties (defaults to the values used by air)
|
// get block properties (defaults to the values used by air)
|
||||||
boolean canOcclude = getCanOcclude(blockState);
|
boolean canOcclude = getCanOcclude(blockState);
|
||||||
@@ -783,7 +815,12 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
|
|
||||||
return opacity;
|
return opacity;
|
||||||
}
|
}
|
||||||
private static boolean getCanOcclude(@Nullable #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState)
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
private static boolean getCanOcclude(@Nullable IBlockState blockState)
|
||||||
|
#else
|
||||||
|
private static boolean getCanOcclude(@Nullable BlockState blockState)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// defaults to the value used by air
|
// defaults to the value used by air
|
||||||
boolean canOcclude = false;
|
boolean canOcclude = false;
|
||||||
@@ -798,7 +835,12 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
|
|
||||||
return canOcclude;
|
return canOcclude;
|
||||||
}
|
}
|
||||||
private static boolean getPropagatesSkyLightDown(@Nullable #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState)
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
private static boolean getPropagatesSkyLightDown(@Nullable IBlockState blockState)
|
||||||
|
#else
|
||||||
|
private static boolean getPropagatesSkyLightDown(@Nullable BlockState blockState)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// defaults to the value used by air
|
// defaults to the value used by air
|
||||||
boolean propagatesSkyLightDown = true;
|
boolean propagatesSkyLightDown = true;
|
||||||
@@ -958,7 +1000,12 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
#else
|
#else
|
||||||
List<BlockState> blockStatesToIgnore = defaultBlockStateToIgnore.blockState.getBlock().getStateDefinition().getPossibleStates();
|
List<BlockState> blockStatesToIgnore = defaultBlockStateToIgnore.blockState.getBlock().getStateDefinition().getPossibleStates();
|
||||||
#endif
|
#endif
|
||||||
for (#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState : blockStatesToIgnore)
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
for (IBlockState blockState : blockStatesToIgnore)
|
||||||
|
#else
|
||||||
|
for (BlockState blockState : blockStatesToIgnore)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
BlockStateWrapper newBlockToIgnore = fromBlockState(blockState, levelWrapper);
|
BlockStateWrapper newBlockToIgnore = fromBlockState(blockState, levelWrapper);
|
||||||
blockStateWrappers.add(newBlockToIgnore);
|
blockStateWrappers.add(newBlockToIgnore);
|
||||||
@@ -1006,7 +1053,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightEmission() { return getLightEmission(this.blockState); }
|
public int getLightEmission() { return getLightEmission(this.blockState); }
|
||||||
public static int getLightEmission(#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState)
|
#if MC_VER <= MC_1_12_2
|
||||||
|
public static int getLightEmission(IBlockState blockState)
|
||||||
|
#else
|
||||||
|
public static int getLightEmission(BlockState blockState)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (blockState == null)
|
if (blockState == null)
|
||||||
{
|
{
|
||||||
@@ -1029,7 +1080,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAir() { return isAir(this.blockState); }
|
public boolean isAir() { return isAir(this.blockState); }
|
||||||
public static boolean isAir(#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState)
|
#if MC_VER <= MC_1_12_2
|
||||||
|
public static boolean isAir(IBlockState blockState)
|
||||||
|
#else
|
||||||
|
public static boolean isAir(BlockState blockState)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (blockState == null)
|
if (blockState == null)
|
||||||
{
|
{
|
||||||
@@ -1075,7 +1130,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
//=======================//
|
//=======================//
|
||||||
//region
|
//region
|
||||||
|
|
||||||
private static String serialize(#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState, ILevelWrapper levelWrapper)
|
#if MC_VER <= MC_1_12_2
|
||||||
|
private static String serialize(IBlockState blockState, ILevelWrapper levelWrapper)
|
||||||
|
#else
|
||||||
|
private static String serialize(BlockState blockState, ILevelWrapper levelWrapper)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (blockState == null)
|
if (blockState == null)
|
||||||
{
|
{
|
||||||
@@ -1229,7 +1288,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
|
|
||||||
|
|
||||||
// attempt to find the blockstate from all possibilities
|
// attempt to find the blockstate from all possibilities
|
||||||
#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif foundState = null;
|
#if MC_VER <= MC_1_12_2
|
||||||
|
IBlockState foundState = null;
|
||||||
|
#else
|
||||||
|
BlockState foundState = null;
|
||||||
|
#endif
|
||||||
if (blockStatePropertiesString != null)
|
if (blockStatePropertiesString != null)
|
||||||
{
|
{
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
@@ -1237,7 +1300,12 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
#else
|
#else
|
||||||
List<BlockState> possibleStateList = block.getStateDefinition().getPossibleStates();
|
List<BlockState> possibleStateList = block.getStateDefinition().getPossibleStates();
|
||||||
#endif
|
#endif
|
||||||
for (#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif possibleState : possibleStateList)
|
|
||||||
|
#if MC_VER <= MC_1_12_2
|
||||||
|
for (IBlockState possibleState : possibleStateList)
|
||||||
|
#else
|
||||||
|
for (BlockState possibleState : possibleStateList)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
String possibleStatePropertiesString = serializeBlockStateProperties(possibleState);
|
String possibleStatePropertiesString = serializeBlockStateProperties(possibleState);
|
||||||
if (possibleStatePropertiesString.equals(blockStatePropertiesString))
|
if (possibleStatePropertiesString.equals(blockStatePropertiesString))
|
||||||
@@ -1291,7 +1359,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** used to compare and save BlockStates based on their properties */
|
/** used to compare and save BlockStates based on their properties */
|
||||||
private static String serializeBlockStateProperties(#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState)
|
#if MC_VER <= MC_1_12_2
|
||||||
|
private static String serializeBlockStateProperties(IBlockState blockState)
|
||||||
|
#else
|
||||||
|
private static String serializeBlockStateProperties(BlockState blockState)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// get the property list for this block (doesn't contain this block state's values, just the names and possible values)
|
// get the property list for this block (doesn't contain this block state's values, just the names and possible values)
|
||||||
#if MC_VER <= MC_1_12_2
|
#if MC_VER <= MC_1_12_2
|
||||||
@@ -1307,7 +1379,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
|
|
||||||
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
for (#if MC_VER <= MC_1_12_2 IProperty<?> #else net.minecraft.world.level.block.state.properties.Property<?> #endif property : sortedBlockPropteryList)
|
#if MC_VER <= MC_1_12_2
|
||||||
|
for (IProperty<?> property : sortedBlockPropteryList)
|
||||||
|
#else
|
||||||
|
for (net.minecraft.world.level.block.state.properties.Property<?> property : sortedBlockPropteryList)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
String propertyName = property.getName();
|
String propertyName = property.getName();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user