continue porting to MC 26 (2)
This commit is contained in:
@@ -357,8 +357,8 @@ if (isNotCommonProject) {
|
|||||||
// JVM args
|
// JVM args
|
||||||
runTask.jvmArgs(
|
runTask.jvmArgs(
|
||||||
"-Dio.netty.leakDetection.level=advanced",
|
"-Dio.netty.leakDetection.level=advanced",
|
||||||
"-XX:+UseZGC",
|
//"-XX:+UseZGC",
|
||||||
"-XX:+ZGenerational",
|
//"-XX:+ZGenerational",
|
||||||
)
|
)
|
||||||
if (isClient) {
|
if (isClient) {
|
||||||
runTask.jvmArgs(
|
runTask.jvmArgs(
|
||||||
|
|||||||
+14
-3
@@ -4,6 +4,7 @@ import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
|||||||
import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper;
|
import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper;
|
||||||
import com.seibel.distanthorizons.core.api.internal.ServerApi;
|
import com.seibel.distanthorizons.core.api.internal.ServerApi;
|
||||||
import com.seibel.distanthorizons.core.api.internal.SharedApi;
|
import com.seibel.distanthorizons.core.api.internal.SharedApi;
|
||||||
|
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapper;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
@@ -17,8 +18,18 @@ public class MixinChunkMapCommon
|
|||||||
{
|
{
|
||||||
IServerLevelWrapper levelWrapper = ServerLevelWrapper.getWrapper(level);
|
IServerLevelWrapper levelWrapper = ServerLevelWrapper.getWrapper(level);
|
||||||
|
|
||||||
|
int chunkPosX;
|
||||||
|
int chunkPosZ;
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
|
chunkPosX = chunk.getPos().x;
|
||||||
|
chunkPosZ = chunk.getPos().z;
|
||||||
|
#else
|
||||||
|
chunkPosX = chunk.getPos().x();
|
||||||
|
chunkPosZ = chunk.getPos().z();
|
||||||
|
#endif
|
||||||
|
|
||||||
// is this position already being updated?
|
// is this position already being updated?
|
||||||
if (SharedApi.isChunkAtChunkPosAlreadyUpdating(levelWrapper, chunk.getPos().x, chunk.getPos().z))
|
if (SharedApi.isChunkAtChunkPosAlreadyUpdating(levelWrapper, chunkPosX, chunkPosZ))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -39,7 +50,7 @@ public class MixinChunkMapCommon
|
|||||||
|
|
||||||
// MC has a tendency to try saving incomplete or corrupted chunks (which show up as empty or black chunks)
|
// MC has a tendency to try saving incomplete or corrupted chunks (which show up as empty or black chunks)
|
||||||
// this logic should prevent that from happening
|
// this logic should prevent that from happening
|
||||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
#if MC_VER <= MC_1_17_1
|
||||||
if (chunk.isUnsaved() || chunk.getUpgradeData() != null || !chunk.isLightCorrect())
|
if (chunk.isUnsaved() || chunk.getUpgradeData() != null || !chunk.isLightCorrect())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -56,7 +67,7 @@ public class MixinChunkMapCommon
|
|||||||
// biome validation //
|
// biome validation //
|
||||||
|
|
||||||
// some chunks may be missing their biomes, which cause issues when attempting to save them
|
// some chunks may be missing their biomes, which cause issues when attempting to save them
|
||||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
#if MC_VER <= MC_1_17_1
|
||||||
if (chunk.getBiomes() == null)
|
if (chunk.getBiomes() == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
+4
-4
@@ -100,10 +100,10 @@ public class BlazeDhFarFadeRenderer implements IDhFarFadeRenderer
|
|||||||
RenderPipeline.Builder pipelineBuilder = RenderPipeline.builder();
|
RenderPipeline.Builder pipelineBuilder = RenderPipeline.builder();
|
||||||
{
|
{
|
||||||
pipelineBuilder.withCull(false);
|
pipelineBuilder.withCull(false);
|
||||||
pipelineBuilder.withDepthWrite(false);
|
//pipelineBuilder.withDepthWrite(false);
|
||||||
pipelineBuilder.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST);
|
//pipelineBuilder.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST);
|
||||||
pipelineBuilder.withColorWrite(true);
|
//pipelineBuilder.withColorWrite(true);
|
||||||
pipelineBuilder.withoutBlend();
|
//pipelineBuilder.withoutBlend();
|
||||||
pipelineBuilder.withPolygonMode(PolygonMode.FILL);
|
pipelineBuilder.withPolygonMode(PolygonMode.FILL);
|
||||||
pipelineBuilder.withLocation(Identifier.parse("distanthorizons:far_fade"));
|
pipelineBuilder.withLocation(Identifier.parse("distanthorizons:far_fade"));
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -121,10 +121,10 @@ public class BlazeDhFogRenderer implements IDhFogRenderer
|
|||||||
RenderPipeline.Builder pipelineBuilder = RenderPipeline.builder();
|
RenderPipeline.Builder pipelineBuilder = RenderPipeline.builder();
|
||||||
{
|
{
|
||||||
pipelineBuilder.withCull(false);
|
pipelineBuilder.withCull(false);
|
||||||
pipelineBuilder.withDepthWrite(false);
|
//pipelineBuilder.withDepthWrite(false);
|
||||||
pipelineBuilder.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST);
|
//pipelineBuilder.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST);
|
||||||
pipelineBuilder.withColorWrite(true);
|
//pipelineBuilder.withColorWrite(true);
|
||||||
pipelineBuilder.withoutBlend();
|
//pipelineBuilder.withoutBlend();
|
||||||
pipelineBuilder.withPolygonMode(PolygonMode.FILL);
|
pipelineBuilder.withPolygonMode(PolygonMode.FILL);
|
||||||
pipelineBuilder.withLocation(Identifier.parse("distanthorizons:fog_render"));
|
pipelineBuilder.withLocation(Identifier.parse("distanthorizons:fog_render"));
|
||||||
|
|
||||||
|
|||||||
+9
-9
@@ -57,18 +57,18 @@ public class BlazeDhVertexFormatUtil
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SCREEN_POS = VertexFormatElement.register(/*id*/22, /*index*/0, VertexFormatElement.Type.FLOAT, VertexFormatElement.Usage.POSITION, /*count*/ 2);
|
SCREEN_POS = null;//VertexFormatElement.register(/*id*/22, /*index*/0, VertexFormatElement.Type.FLOAT, VertexFormatElement.Usage.POSITION, /*count*/ 2);
|
||||||
RGBA_FLOAT_COLOR = VertexFormatElement.register(/*id*/23, /*index*/0, VertexFormatElement.Type.FLOAT, VertexFormatElement.Usage.COLOR, /*count*/ 4);
|
RGBA_FLOAT_COLOR = null;//VertexFormatElement.register(/*id*/23, /*index*/0, VertexFormatElement.Type.FLOAT, VertexFormatElement.Usage.COLOR, /*count*/ 4);
|
||||||
|
|
||||||
SHORT_XYZ_POS = VertexFormatElement.register(/*id*/24, /*index*/0, VertexFormatElement.Type.USHORT, VertexFormatElement.Usage.POSITION, /*count*/ 3);
|
SHORT_XYZ_POS = null;//VertexFormatElement.register(/*id*/24, /*index*/0, VertexFormatElement.Type.USHORT, VertexFormatElement.Usage.POSITION, /*count*/ 3);
|
||||||
BYTE_PAD = VertexFormatElement.register(/*id*/25, /*index*/0, VertexFormatElement.Type.BYTE, VertexFormatElement.Usage.GENERIC, /*count*/ 1);
|
BYTE_PAD = null;//VertexFormatElement.register(/*id*/25, /*index*/0, VertexFormatElement.Type.BYTE, VertexFormatElement.Usage.GENERIC, /*count*/ 1);
|
||||||
|
|
||||||
META = VertexFormatElement.register(/*id*/26, /*index*/0, VertexFormatElement.Type.USHORT, VertexFormatElement.Usage.GENERIC, /*count*/ 1);
|
META = null;//VertexFormatElement.register(/*id*/26, /*index*/0, VertexFormatElement.Type.USHORT, VertexFormatElement.Usage.GENERIC, /*count*/ 1);
|
||||||
RGBA_UBYTE_COLOR = VertexFormatElement.register(/*id*/27, /*index*/0, VertexFormatElement.Type.UBYTE, VertexFormatElement.Usage.COLOR, /*count*/ 4);
|
RGBA_UBYTE_COLOR = null;//VertexFormatElement.register(/*id*/27, /*index*/0, VertexFormatElement.Type.UBYTE, VertexFormatElement.Usage.COLOR, /*count*/ 4);
|
||||||
IRIS_MATERIAL = VertexFormatElement.register(/*id*/28, /*index*/0, VertexFormatElement.Type.BYTE, VertexFormatElement.Usage.GENERIC, /*count*/ 1);
|
IRIS_MATERIAL = null;//VertexFormatElement.register(/*id*/28, /*index*/0, VertexFormatElement.Type.BYTE, VertexFormatElement.Usage.GENERIC, /*count*/ 1);
|
||||||
IRIS_NORMAL = VertexFormatElement.register(/*id*/29, /*index*/0, VertexFormatElement.Type.BYTE, VertexFormatElement.Usage.GENERIC, /*count*/ 1);
|
IRIS_NORMAL = null;//VertexFormatElement.register(/*id*/29, /*index*/0, VertexFormatElement.Type.BYTE, VertexFormatElement.Usage.GENERIC, /*count*/ 1);
|
||||||
|
|
||||||
FLOAT_XYZ_POS = VertexFormatElement.register(/*id*/30, /*index*/0, VertexFormatElement.Type.FLOAT, VertexFormatElement.Usage.POSITION, /*count*/ 3);
|
FLOAT_XYZ_POS = null;//VertexFormatElement.register(/*id*/30, /*index*/0, VertexFormatElement.Type.FLOAT, VertexFormatElement.Usage.POSITION, /*count*/ 3);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -139,7 +139,16 @@ public class McObjectConverter
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static BlockPos Convert(DhBlockPos wrappedPos) { return new BlockPos(wrappedPos.getX(), wrappedPos.getY(), wrappedPos.getZ()); }
|
public static BlockPos Convert(DhBlockPos wrappedPos) { return new BlockPos(wrappedPos.getX(), wrappedPos.getY(), wrappedPos.getZ()); }
|
||||||
|
|
||||||
public static ChunkPos Convert(DhChunkPos wrappedPos) { return new ChunkPos(wrappedPos.getX(), wrappedPos.getZ()); }
|
public static ChunkPos Convert(DhChunkPos wrappedPos) { return new ChunkPos(wrappedPos.getX(), wrappedPos.getZ()); }
|
||||||
|
public static DhChunkPos Convert(ChunkPos mcPos)
|
||||||
|
{
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
|
return new DhChunkPos(mcPos.x, mcPos.z);
|
||||||
|
#else
|
||||||
|
return new DhChunkPos(mcPos.x(), mcPos.z());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
public static Direction Convert(EDhDirection lodDirection) { return directions[lodDirection.ordinal()]; }
|
public static Direction Convert(EDhDirection lodDirection) { return directions[lodDirection.ordinal()]; }
|
||||||
public static EDhDirection Convert(Direction direction) { return lodDirections[direction.ordinal()]; }
|
public static EDhDirection Convert(Direction direction) { return lodDirections[direction.ordinal()]; }
|
||||||
|
|||||||
+24
-9
@@ -49,6 +49,7 @@ import net.minecraft.core.registries.Registries;
|
|||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
#else
|
#else
|
||||||
import net.minecraft.resources.Identifier;
|
import net.minecraft.resources.Identifier;
|
||||||
|
import net.minecraft.core.component.DataComponentMap;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
@@ -221,17 +222,17 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
Level level = (Level)levelWrapper.getWrappedMcObject();
|
Level level = (Level)levelWrapper.getWrappedMcObject();
|
||||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||||
|
|
||||||
#if MC_VER < MC_1_21_11
|
#if MC_VER <= MC_1_21_10
|
||||||
ResourceLocation resourceLocation;
|
ResourceLocation resourceLocation;
|
||||||
#else
|
#else
|
||||||
Identifier resourceLocation;
|
Identifier resourceLocation;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
#if MC_VER <= MC_1_17_1
|
||||||
resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome);
|
resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome);
|
||||||
#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2
|
#elif MC_VER <= MC_1_19_2
|
||||||
resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome.value());
|
resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome.value());
|
||||||
#elif MC_VER < MC_1_21_3
|
#elif MC_VER <= MC_1_21_4
|
||||||
resourceLocation = registryAccess.registryOrThrow(Registries.BIOME).getKey(this.biome.value());
|
resourceLocation = registryAccess.registryOrThrow(Registries.BIOME).getKey(this.biome.value());
|
||||||
#else
|
#else
|
||||||
resourceLocation = registryAccess.lookupOrThrow(Registries.BIOME).getKey(this.biome.value());
|
resourceLocation = registryAccess.lookupOrThrow(Registries.BIOME).getKey(this.biome.value());
|
||||||
@@ -240,7 +241,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
if (resourceLocation == null)
|
if (resourceLocation == null)
|
||||||
{
|
{
|
||||||
String biomeName;
|
String biomeName;
|
||||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
#if MC_VER <= MC_1_17_1
|
||||||
biomeName = this.biome.toString();
|
biomeName = this.biome.toString();
|
||||||
#else
|
#else
|
||||||
biomeName = this.biome.value().toString();
|
biomeName = this.biome.value().toString();
|
||||||
@@ -354,18 +355,18 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
|
|
||||||
|
|
||||||
boolean success;
|
boolean success;
|
||||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
#if MC_VER <= MC_1_17_1
|
||||||
Biome biome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation);
|
Biome biome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation);
|
||||||
success = (biome != null);
|
success = (biome != null);
|
||||||
#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2
|
#elif MC_VER <= MC_1_19_2
|
||||||
Biome unwrappedBiome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation);
|
Biome unwrappedBiome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation);
|
||||||
success = (unwrappedBiome != null);
|
success = (unwrappedBiome != null);
|
||||||
Holder<Biome> biome = new Holder.Direct<>(unwrappedBiome);
|
Holder<Biome> biome = new Holder.Direct<>(unwrappedBiome);
|
||||||
#elif MC_VER < MC_1_21_3
|
#elif MC_VER <= MC_1_21_4
|
||||||
Biome unwrappedBiome = registryAccess.registryOrThrow(Registries.BIOME).get(resourceLocation);
|
Biome unwrappedBiome = registryAccess.registryOrThrow(Registries.BIOME).get(resourceLocation);
|
||||||
success = (unwrappedBiome != null);
|
success = (unwrappedBiome != null);
|
||||||
Holder<Biome> biome = new Holder.Direct<>(unwrappedBiome);
|
Holder<Biome> biome = new Holder.Direct<>(unwrappedBiome);
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
Holder<Biome> biome;
|
Holder<Biome> biome;
|
||||||
Optional<Holder.Reference<Biome>> optionalBiomeHolder = registryAccess.lookupOrThrow(Registries.BIOME).get(resourceLocation);
|
Optional<Holder.Reference<Biome>> optionalBiomeHolder = registryAccess.lookupOrThrow(Registries.BIOME).get(resourceLocation);
|
||||||
if (optionalBiomeHolder.isPresent())
|
if (optionalBiomeHolder.isPresent())
|
||||||
@@ -379,6 +380,20 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
success = false;
|
success = false;
|
||||||
biome = null;
|
biome = null;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
Holder<Biome> biome;
|
||||||
|
Optional<Holder.Reference<Biome>> optionalBiomeHolder = registryAccess.lookupOrThrow(Registries.BIOME).get(resourceLocation);
|
||||||
|
if (optionalBiomeHolder.isPresent())
|
||||||
|
{
|
||||||
|
Biome unwrappedBiome = optionalBiomeHolder.get().value();
|
||||||
|
success = (unwrappedBiome != null);
|
||||||
|
biome = new Holder.Direct<>(unwrappedBiome, DataComponentMap.EMPTY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
|
biome = null;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return new BiomeDeserializeResult(success, biome);
|
return new BiomeDeserializeResult(success, biome);
|
||||||
|
|||||||
+19
-10
@@ -214,7 +214,14 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
if (blockState != null)
|
if (blockState != null)
|
||||||
{
|
{
|
||||||
// check if this block has any tags
|
// check if this block has any tags
|
||||||
Stream<TagKey<Block>> tags = blockState.getTags();
|
|
||||||
|
Stream<TagKey<Block>> tags;
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
|
tags = blockState.getTags();
|
||||||
|
#else
|
||||||
|
tags = blockState.tags();
|
||||||
|
#endif
|
||||||
|
|
||||||
this.isBeaconBaseBlock = tags.anyMatch((TagKey<Block> tag) -> tag.location().getPath().toLowerCase().contains("beacon_base_blocks"));
|
this.isBeaconBaseBlock = tags.anyMatch((TagKey<Block> tag) -> tag.location().getPath().toLowerCase().contains("beacon_base_blocks"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -667,22 +674,23 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
|
|
||||||
|
|
||||||
// older versions of MC have a static registry
|
// older versions of MC have a static registry
|
||||||
#if MC_VER > MC_1_17_1
|
#if MC_VER <= MC_1_16_5
|
||||||
|
#else
|
||||||
Level level = (Level)levelWrapper.getWrappedMcObject();
|
Level level = (Level)levelWrapper.getWrappedMcObject();
|
||||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER < MC_1_21_11
|
#if MC_VER <= MC_1_21_10
|
||||||
ResourceLocation resourceLocation;
|
ResourceLocation resourceLocation;
|
||||||
#else
|
#else
|
||||||
Identifier resourceLocation;
|
Identifier resourceLocation;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
#if MC_VER <= MC_1_17_1
|
||||||
resourceLocation = Registry.BLOCK.getKey(this.blockState.getBlock());
|
resourceLocation = Registry.BLOCK.getKey(this.blockState.getBlock());
|
||||||
#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2
|
#elif MC_VER <= MC_1_19_2
|
||||||
resourceLocation = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).getKey(this.blockState.getBlock());
|
resourceLocation = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).getKey(this.blockState.getBlock());
|
||||||
#elif MC_VER < MC_1_21_3
|
#elif MC_VER <= MC_1_21_4
|
||||||
resourceLocation = registryAccess.registryOrThrow(Registries.BLOCK).getKey(this.blockState.getBlock());
|
resourceLocation = registryAccess.registryOrThrow(Registries.BLOCK).getKey(this.blockState.getBlock());
|
||||||
#else
|
#else
|
||||||
resourceLocation = registryAccess.lookupOrThrow(Registries.BLOCK).getKey(this.blockState.getBlock());
|
resourceLocation = registryAccess.lookupOrThrow(Registries.BLOCK).getKey(this.blockState.getBlock());
|
||||||
@@ -771,18 +779,19 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
#if MC_VER > MC_1_17_1
|
#if MC_VER <= MC_1_16_5
|
||||||
|
#else
|
||||||
LodUtil.assertTrue(levelWrapper != null && levelWrapper.getWrappedMcObject() != null);
|
LodUtil.assertTrue(levelWrapper != null && levelWrapper.getWrappedMcObject() != null);
|
||||||
Level level = (Level)levelWrapper.getWrappedMcObject();
|
Level level = (Level)levelWrapper.getWrappedMcObject();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Block block;
|
Block block;
|
||||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
#if MC_VER <= MC_1_17_1
|
||||||
block = Registry.BLOCK.get(resourceLocation);
|
block = Registry.BLOCK.get(resourceLocation);
|
||||||
#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2
|
#elif MC_VER <= MC_1_19_2
|
||||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||||
block = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).get(resourceLocation);
|
block = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).get(resourceLocation);
|
||||||
#elif MC_VER < MC_1_21_3
|
#elif MC_VER <= MC_1_21_4
|
||||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||||
block = registryAccess.registryOrThrow(Registries.BLOCK).get(resourceLocation);
|
block = registryAccess.registryOrThrow(Registries.BLOCK).get(resourceLocation);
|
||||||
#else
|
#else
|
||||||
|
|||||||
+1
@@ -46,6 +46,7 @@ import java.util.List;
|
|||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
#if MC_VER < MC_1_21_5
|
#if MC_VER < MC_1_21_5
|
||||||
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
#elif MC_VER <= MC_1_21_11
|
#elif MC_VER <= MC_1_21_11
|
||||||
import net.minecraft.client.renderer.block.model.BlockModelPart;
|
import net.minecraft.client.renderer.block.model.BlockModelPart;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
|
|||||||
+1
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.seibel.distanthorizons.common.wrappers.block;
|
package com.seibel.distanthorizons.common.wrappers.block;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
|
||||||
#if MC_VER < MC_1_17_1
|
#if MC_VER < MC_1_17_1
|
||||||
|
|||||||
+9
@@ -63,8 +63,10 @@ public class TintGetterOverride extends AbstractDhTintGetter
|
|||||||
// methods //
|
// methods //
|
||||||
//=========//
|
//=========//
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
@Override
|
@Override
|
||||||
public float getShade(Direction direction, boolean bl) { return this.parent.getShade(direction, bl); }
|
public float getShade(Direction direction, boolean bl) { return this.parent.getShade(direction, bl); }
|
||||||
|
#endif
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LevelLightEngine getLightEngine() { return this.parent.getLightEngine(); }
|
public LevelLightEngine getLightEngine() { return this.parent.getLightEngine(); }
|
||||||
@@ -175,6 +177,13 @@ public class TintGetterOverride extends AbstractDhTintGetter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSectionYFromSectionIndex(int i) { return this.parent.getSectionYFromSectionIndex(i); }
|
public int getSectionYFromSectionIndex(int i) { return this.parent.getSectionYFromSectionIndex(i); }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
|
#else
|
||||||
|
@Override
|
||||||
|
public CardinalLighting cardinalLighting() { return CardinalLighting.DEFAULT; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+23
-2
@@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
package com.seibel.distanthorizons.common.wrappers.block;
|
package com.seibel.distanthorizons.common.wrappers.block;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.level.LevelReader;
|
import net.minecraft.world.level.LevelReader;
|
||||||
@@ -30,6 +28,12 @@ import net.minecraft.world.level.lighting.LevelLightEngine;
|
|||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.CardinalLighting;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
public class TintWithoutLevelOverrider extends AbstractDhTintGetter
|
public class TintWithoutLevelOverrider extends AbstractDhTintGetter
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -46,9 +50,12 @@ public class TintWithoutLevelOverrider extends AbstractDhTintGetter
|
|||||||
// methods //
|
// methods //
|
||||||
//=========//
|
//=========//
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
@Override
|
@Override
|
||||||
public float getShade(Direction direction, boolean shade)
|
public float getShade(Direction direction, boolean shade)
|
||||||
{ throw new UnsupportedOperationException("ERROR: getShade() called on TintWithoutLevelOverrider. Object is for tinting only."); }
|
{ throw new UnsupportedOperationException("ERROR: getShade() called on TintWithoutLevelOverrider. Object is for tinting only."); }
|
||||||
|
#endif
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LevelLightEngine getLightEngine()
|
public LevelLightEngine getLightEngine()
|
||||||
{ throw new UnsupportedOperationException("ERROR: getLightEngine() called on TintWithoutLevelOverrider. Object is for tinting only."); }
|
{ throw new UnsupportedOperationException("ERROR: getLightEngine() called on TintWithoutLevelOverrider. Object is for tinting only."); }
|
||||||
@@ -87,4 +94,18 @@ public class TintWithoutLevelOverrider extends AbstractDhTintGetter
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//=================//
|
||||||
|
// post MC 1.21.11 //
|
||||||
|
//=================//
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
|
#else
|
||||||
|
@Override
|
||||||
|
public CardinalLighting cardinalLighting()
|
||||||
|
{ throw new UnsupportedOperationException("ERROR: cardinalLighting() called on TintWithoutLevelOverrider. Object is for tinting only."); }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -122,7 +122,12 @@ public class ChunkWrapper implements IChunkWrapper
|
|||||||
{
|
{
|
||||||
this.chunk = chunk;
|
this.chunk = chunk;
|
||||||
this.wrappedLevel = wrappedLevel;
|
this.wrappedLevel = wrappedLevel;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
this.chunkPos = new DhChunkPos(chunk.getPos().x, chunk.getPos().z);
|
this.chunkPos = new DhChunkPos(chunk.getPos().x, chunk.getPos().z);
|
||||||
|
#else
|
||||||
|
this.chunkPos = new DhChunkPos(chunk.getPos().x(), chunk.getPos().z());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+39
-9
@@ -46,8 +46,10 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
#if MC_VER < MC_1_20_1
|
#if MC_VER < MC_1_20_1
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiComponent;
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
#else
|
||||||
|
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER >= MC_1_17_1
|
#if MC_VER >= MC_1_17_1
|
||||||
@@ -581,7 +583,7 @@ public class ClassicConfigGUI
|
|||||||
widget.insertText(String.valueOf(configEntry.get()));
|
widget.insertText(String.valueOf(configEntry.get()));
|
||||||
|
|
||||||
Predicate<String> processor = configGuiInfo.tooltipFunction.apply(widget, this.doneButton);
|
Predicate<String> processor = configGuiInfo.tooltipFunction.apply(widget, this.doneButton);
|
||||||
widget.setFilter(processor);
|
//widget.setFilter(processor);
|
||||||
|
|
||||||
this.configListWidget.addButton(this, configEntry, widget, resetButton, null, textComponent);
|
this.configListWidget.addButton(this, configEntry, widget, resetButton, null, textComponent);
|
||||||
|
|
||||||
@@ -698,17 +700,26 @@ public class ClassicConfigGUI
|
|||||||
@Override
|
@Override
|
||||||
#if MC_VER < MC_1_20_1
|
#if MC_VER < MC_1_20_1
|
||||||
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||||
|
#else
|
||||||
|
public void extractRenderState(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if MC_VER < MC_1_20_2 // 1.20.2 now enables this by default in the `this.list.render` function
|
#if MC_VER < MC_1_20_2 // 1.20.2 now enables this by default in the `this.list.render` function
|
||||||
this.renderBackground(matrices); // Renders background
|
this.renderBackground(matrices);
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
super.render(matrices, mouseX, mouseY, delta);
|
super.render(matrices, mouseX, mouseY, delta);
|
||||||
|
#else
|
||||||
|
super.extractRenderState(matrices, mouseX, mouseY, delta);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
this.configListWidget.render(matrices, mouseX, mouseY, delta); // Render buttons
|
// Render buttons
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
|
this.configListWidget.render(matrices, mouseX, mouseY, delta);
|
||||||
|
#else
|
||||||
|
this.configListWidget.extractRenderState(matrices, mouseX, mouseY, delta);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Render config title
|
// Render config title
|
||||||
@@ -751,7 +762,7 @@ public class ClassicConfigGUI
|
|||||||
#if MC_VER < MC_1_20_1
|
#if MC_VER < MC_1_20_1
|
||||||
private void renderTooltip(PoseStack matrices, int mouseX, int mouseY, float delta)
|
private void renderTooltip(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||||
#else
|
#else
|
||||||
private void renderTooltip(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
private void renderTooltip(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
AbstractWidget hoveredWidget = this.configListWidget.getHoveredButton(mouseX, mouseY);
|
AbstractWidget hoveredWidget = this.configListWidget.getHoveredButton(mouseX, mouseY);
|
||||||
@@ -953,8 +964,10 @@ public class ClassicConfigGUI
|
|||||||
public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta)
|
public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta)
|
||||||
#elif MC_VER < MC_1_21_9
|
#elif MC_VER < MC_1_21_9
|
||||||
public void render(GuiGraphics matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta)
|
public void render(GuiGraphics matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta)
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
public void renderContent(GuiGraphics matrices, int mouseX, int mouseY, boolean hovered, float tickDelta)
|
public void renderContent(GuiGraphics matrices, int mouseX, int mouseY, boolean hovered, float tickDelta)
|
||||||
|
#else
|
||||||
|
public void extractContent(GuiGraphicsExtractor matrices, int mouseX, int mouseY, boolean hovered, float tickDelta)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -973,19 +986,31 @@ public class ClassicConfigGUI
|
|||||||
if (this.button != null)
|
if (this.button != null)
|
||||||
{
|
{
|
||||||
SetY(this.button, y);
|
SetY(this.button, y);
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
this.button.render(matrices, mouseX, mouseY, tickDelta);
|
this.button.render(matrices, mouseX, mouseY, tickDelta);
|
||||||
|
#else
|
||||||
|
this.button.extractRenderState(matrices, mouseX, mouseY, tickDelta);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.resetButton != null)
|
if (this.resetButton != null)
|
||||||
{
|
{
|
||||||
SetY(this.resetButton, y);
|
SetY(this.resetButton, y);
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
this.resetButton.render(matrices, mouseX, mouseY, tickDelta);
|
this.resetButton.render(matrices, mouseX, mouseY, tickDelta);
|
||||||
|
#else
|
||||||
|
this.resetButton.extractRenderState(matrices, mouseX, mouseY, tickDelta);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.indexButton != null)
|
if (this.indexButton != null)
|
||||||
{
|
{
|
||||||
SetY(this.indexButton, y);
|
SetY(this.indexButton, y);
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
this.indexButton.render(matrices, mouseX, mouseY, tickDelta);
|
this.indexButton.render(matrices, mouseX, mouseY, tickDelta);
|
||||||
|
#else
|
||||||
|
this.indexButton.extractRenderState(matrices, mouseX, mouseY, tickDelta);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.text != null)
|
if (this.text != null)
|
||||||
@@ -1034,11 +1059,16 @@ public class ClassicConfigGUI
|
|||||||
this.text,
|
this.text,
|
||||||
textXPos, y + 5,
|
textXPos, y + 5,
|
||||||
0xFFFFFF);
|
0xFFFFFF);
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
matrices.drawString(textRenderer,
|
matrices.drawString(textRenderer,
|
||||||
this.text,
|
this.text,
|
||||||
textXPos, y + 5,
|
textXPos, y + 5,
|
||||||
0xFFFFFFFF);
|
0xFFFFFFFF);
|
||||||
|
#else
|
||||||
|
matrices.text(textRenderer,
|
||||||
|
this.text,
|
||||||
|
textXPos, y + 5,
|
||||||
|
0xFFFFFFFF);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
@@ -3,6 +3,7 @@ package com.seibel.distanthorizons.common.wrappers.gui;
|
|||||||
#if MC_VER < MC_1_21_9
|
#if MC_VER < MC_1_21_9
|
||||||
// not supported for older MC versions
|
// not supported for older MC versions
|
||||||
#else
|
#else
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
||||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||||
|
|
||||||
@@ -19,6 +20,8 @@ import net.minecraft.world.level.chunk.LevelChunk;
|
|||||||
|
|
||||||
#if MC_VER <= MC_1_21_10
|
#if MC_VER <= MC_1_21_10
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
#else
|
||||||
|
import net.minecraft.resources.Identifier;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -32,6 +35,7 @@ public class DhDebugScreenEntry implements net.minecraft.client.gui.components.d
|
|||||||
{
|
{
|
||||||
public static void register()
|
public static void register()
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
// This method is private, so its access will need to be widened
|
// This method is private, so its access will need to be widened
|
||||||
DebugScreenEntries.register(
|
DebugScreenEntries.register(
|
||||||
// The id, this will be displayed on the options screen
|
// The id, this will be displayed on the options screen
|
||||||
@@ -44,6 +48,15 @@ public class DhDebugScreenEntry implements net.minecraft.client.gui.components.d
|
|||||||
// The screen entry
|
// The screen entry
|
||||||
new DhDebugScreenEntry()
|
new DhDebugScreenEntry()
|
||||||
);
|
);
|
||||||
|
#else
|
||||||
|
DebugScreenEntries.allEntries().put(
|
||||||
|
// The id, this will be displayed on the options screen
|
||||||
|
Identifier.fromNamespaceAndPath(ModInfo.RESOURCE_NAMESPACE, "distant_horizons"),
|
||||||
|
|
||||||
|
// The screen entry
|
||||||
|
new DhDebugScreenEntry()
|
||||||
|
);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,19 @@
|
|||||||
package com.seibel.distanthorizons.common.wrappers.gui;
|
package com.seibel.distanthorizons.common.wrappers.gui;
|
||||||
|
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
#if MC_VER < MC_1_20_1
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
#else
|
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
|
||||||
#endif
|
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
|
#if MC_VER < MC_1_20_1
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
#elif MC_VER <= MC_1_21_11
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
#else
|
||||||
|
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||||
|
#endif
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DhScreen extends Screen
|
public class DhScreen extends Screen
|
||||||
@@ -73,7 +77,7 @@ public class DhScreen extends Screen
|
|||||||
{
|
{
|
||||||
guiStack.renderTooltip(font, text, x, y);
|
guiStack.renderTooltip(font, text, x, y);
|
||||||
}
|
}
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
protected void DhDrawCenteredString(GuiGraphics guiStack, Font font, Component text, int x, int y, int color)
|
protected void DhDrawCenteredString(GuiGraphics guiStack, Font font, Component text, int x, int y, int color)
|
||||||
{
|
{
|
||||||
guiStack.drawCenteredString(font, text, x, y, color);
|
guiStack.drawCenteredString(font, text, x, y, color);
|
||||||
@@ -82,10 +86,6 @@ public class DhScreen extends Screen
|
|||||||
{
|
{
|
||||||
guiStack.drawString(font, text, x, y, color);
|
guiStack.drawString(font, text, x, y, color);
|
||||||
}
|
}
|
||||||
//protected void DhRenderTooltip(GuiGraphics guiStack, Font font, List<? extends net.minecraft.util.FormattedCharSequence> text, int x, int y)
|
|
||||||
//{
|
|
||||||
// //guiStack.renderTooltip(font, text, x, y);
|
|
||||||
//}
|
|
||||||
protected void DhRenderComponentTooltip(GuiGraphics guiStack, Font font, List<Component> comp, int x, int y)
|
protected void DhRenderComponentTooltip(GuiGraphics guiStack, Font font, List<Component> comp, int x, int y)
|
||||||
{
|
{
|
||||||
guiStack.setComponentTooltipForNextFrame(font, comp, x, y);
|
guiStack.setComponentTooltipForNextFrame(font, comp, x, y);
|
||||||
@@ -94,6 +94,23 @@ public class DhScreen extends Screen
|
|||||||
{
|
{
|
||||||
guiStack.setTooltipForNextFrame(font, text, x, y);
|
guiStack.setTooltipForNextFrame(font, text, x, y);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
protected void DhDrawCenteredString(GuiGraphicsExtractor guiStack, Font font, Component text, int x, int y, int color)
|
||||||
|
{
|
||||||
|
guiStack.centeredText(font, text, x, y, color);
|
||||||
|
}
|
||||||
|
protected void DhDrawString(GuiGraphicsExtractor guiStack, Font font, Component text, int x, int y, int color)
|
||||||
|
{
|
||||||
|
guiStack.text(font, text, x, y, color);
|
||||||
|
}
|
||||||
|
protected void DhRenderComponentTooltip(GuiGraphicsExtractor guiStack, Font font, List<Component> comp, int x, int y)
|
||||||
|
{
|
||||||
|
guiStack.setComponentTooltipForNextFrame(font, comp, x, y);
|
||||||
|
}
|
||||||
|
protected void DhRenderTooltip(GuiGraphicsExtractor guiStack, Font font, Component text, int x, int y)
|
||||||
|
{
|
||||||
|
guiStack.setTooltipForNextFrame(font, text, x, y);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+24
-6
@@ -1,16 +1,24 @@
|
|||||||
package com.seibel.distanthorizons.common.wrappers.gui;
|
package com.seibel.distanthorizons.common.wrappers.gui;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.Window;
|
import com.mojang.blaze3d.platform.Window;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.config.gui.AbstractScreen;
|
import com.seibel.distanthorizons.core.config.gui.AbstractScreen;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
#if MC_VER >= MC_1_20_1
|
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
|
||||||
#endif
|
|
||||||
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
#if MC_VER < MC_1_20_1
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
#elif MC_VER <= MC_1_21_11
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
#else
|
||||||
|
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||||
|
#endif
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -74,8 +82,10 @@ public class MinecraftScreen
|
|||||||
@Override
|
@Override
|
||||||
#if MC_VER < MC_1_20_1
|
#if MC_VER < MC_1_20_1
|
||||||
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||||
|
#else
|
||||||
|
public void extractRenderState(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if MC_VER < MC_1_20_2
|
#if MC_VER < MC_1_20_2
|
||||||
@@ -86,13 +96,21 @@ public class MinecraftScreen
|
|||||||
// background blur is already being rendered, rendering again causes the game to crash
|
// background blur is already being rendered, rendering again causes the game to crash
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
this.configListWidget.render(matrices, mouseX, mouseY, delta); // Renders the items in the render list (currently only used to tint background darker)
|
this.configListWidget.render(matrices, mouseX, mouseY, delta); // Renders the items in the render list (currently only used to tint background darker)
|
||||||
|
#else
|
||||||
|
this.configListWidget.extractRenderState(matrices, mouseX, mouseY, delta); // Renders the items in the render list (currently only used to tint background darker)
|
||||||
|
#endif
|
||||||
|
|
||||||
this.screen.mouseX = mouseX;
|
this.screen.mouseX = mouseX;
|
||||||
this.screen.mouseY = mouseY;
|
this.screen.mouseY = mouseY;
|
||||||
this.screen.render(delta); // Render everything on the main screen
|
this.screen.render(delta); // Render everything on the main screen
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
super.render(matrices, mouseX, mouseY, delta); // Render the vanilla stuff (currently only used for the background and tint)
|
super.render(matrices, mouseX, mouseY, delta); // Render the vanilla stuff (currently only used for the background and tint)
|
||||||
|
#else
|
||||||
|
super.extractRenderState(matrices, mouseX, mouseY, delta); // Renders the items in the render list (currently only used to tint background darker)
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MC_VER <= MC_1_21_10
|
#if MC_VER <= MC_1_21_10
|
||||||
|
|||||||
+13
-7
@@ -45,9 +45,12 @@ import net.minecraft.client.renderer.RenderType;
|
|||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.client.renderer.RenderPipelines;
|
import net.minecraft.client.renderer.RenderPipelines;
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.renderer.RenderPipelines;
|
import net.minecraft.client.renderer.RenderPipelines;
|
||||||
|
#else
|
||||||
|
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||||
|
import net.minecraft.client.renderer.RenderPipelines;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER <= MC_1_21_10
|
#if MC_VER <= MC_1_21_10
|
||||||
@@ -196,9 +199,12 @@ public class TexturedButtonWidget extends Button
|
|||||||
#if MC_VER < MC_1_21_11
|
#if MC_VER < MC_1_21_11
|
||||||
@Override
|
@Override
|
||||||
public void renderWidget(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
public void renderWidget(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
@Override
|
@Override
|
||||||
protected void renderContents(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
protected void renderContents(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||||
|
#else
|
||||||
|
@Override
|
||||||
|
protected void extractContents(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (this.renderBackground)
|
if (this.renderBackground)
|
||||||
@@ -212,11 +218,11 @@ public class TexturedButtonWidget extends Button
|
|||||||
this.getX(), this.getY(),
|
this.getX(), this.getY(),
|
||||||
this.getWidth(), this.getHeight());
|
this.getWidth(), this.getHeight());
|
||||||
#else
|
#else
|
||||||
matrices.blitSprite(
|
//matrices.blitSprite(
|
||||||
RenderPipelines.GUI_TEXTURED,
|
// RenderPipelines.GUI_TEXTURED,
|
||||||
SPRITES.get(this.active, this.isHoveredOrFocused()),
|
// SPRITES.get(this.active, this.isHoveredOrFocused()),
|
||||||
this.getX(), this.getY(),
|
// this.getX(), this.getY(),
|
||||||
this.getWidth(), this.getHeight());
|
// this.getWidth(), this.getHeight());
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-3
@@ -23,8 +23,10 @@ import net.minecraft.client.gui.narration.NarratableEntry;
|
|||||||
#if MC_VER < MC_1_20_1
|
#if MC_VER < MC_1_20_1
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiComponent;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
#else
|
||||||
|
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -168,8 +170,10 @@ public class ChangelogScreen extends DhScreen
|
|||||||
@Override
|
@Override
|
||||||
#if MC_VER < MC_1_20_1
|
#if MC_VER < MC_1_20_1
|
||||||
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||||
|
#else
|
||||||
|
public void extractRenderState(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if MC_VER < MC_1_20_2
|
#if MC_VER < MC_1_20_2
|
||||||
@@ -206,8 +210,14 @@ public class ChangelogScreen extends DhScreen
|
|||||||
|
|
||||||
|
|
||||||
// render order matters, otherwise on 1.20.6+ the blurred background will render on top of the text
|
// render order matters, otherwise on 1.20.6+ the blurred background will render on top of the text
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
super.render(matrices, mouseX, mouseY, delta); // Render the buttons
|
super.render(matrices, mouseX, mouseY, delta); // Render the buttons
|
||||||
this.changelogArea.render(matrices, mouseX, mouseY, delta); // Render the changelog
|
this.changelogArea.render(matrices, mouseX, mouseY, delta); // Render the changelog
|
||||||
|
#else
|
||||||
|
super.extractRenderState(matrices, mouseX, mouseY, delta); // Render the buttons
|
||||||
|
this.changelogArea.extractRenderState(matrices, mouseX, mouseY, delta); // Render the changelog
|
||||||
|
#endif
|
||||||
|
|
||||||
this.DhDrawCenteredString(matrices, this.font, this.title, this.width / 2, 15, 0xFFFFFF); // Render title
|
this.DhDrawCenteredString(matrices, this.font, this.title, this.width / 2, 15, 0xFFFFFF); // Render title
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,10 +274,14 @@ public class ChangelogScreen extends DhScreen
|
|||||||
@Override
|
@Override
|
||||||
public void render(GuiGraphics matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta)
|
public void render(GuiGraphics matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta)
|
||||||
{ matrices.drawString(textRenderer, this.text, 12, y + 5, 0xFFFFFF); }
|
{ matrices.drawString(textRenderer, this.text, 12, y + 5, 0xFFFFFF); }
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
@Override
|
@Override
|
||||||
public void renderContent(GuiGraphics matrices, int y, int x, boolean hovered, float tickDelta)
|
public void renderContent(GuiGraphics matrices, int y, int x, boolean hovered, float tickDelta)
|
||||||
{ matrices.drawString(textRenderer, this.text, 12, y + 5, 0xFFFFFF); }
|
{ matrices.drawString(textRenderer, this.text, 12, y + 5, 0xFFFFFF); }
|
||||||
|
#else
|
||||||
|
@Override
|
||||||
|
public void extractContent(GuiGraphicsExtractor matrices, int y, int x, boolean hovered, float tickDelta)
|
||||||
|
{ matrices.text(textRenderer, this.text, 12, y + 5, 0xFFFFFF); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+12
-4
@@ -13,10 +13,12 @@ import com.seibel.distanthorizons.core.logging.DhLogger;
|
|||||||
|
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
|
|
||||||
#if MC_VER >= MC_1_20_1
|
#if MC_VER < MC_1_20_1
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
#elif MC_VER <= MC_1_21_11
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
#else
|
#else
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER <= MC_1_21_10
|
#if MC_VER <= MC_1_21_10
|
||||||
@@ -172,8 +174,10 @@ public class UpdateModScreen extends DhScreen
|
|||||||
@Override
|
@Override
|
||||||
#if MC_VER < MC_1_20_1
|
#if MC_VER < MC_1_20_1
|
||||||
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||||
|
#else
|
||||||
|
public void extractRenderState(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if MC_VER < MC_1_20_2
|
#if MC_VER < MC_1_20_2
|
||||||
@@ -184,8 +188,12 @@ public class UpdateModScreen extends DhScreen
|
|||||||
// background blur is already being rendered, rendering again causes the game to crash
|
// background blur is already being rendered, rendering again causes the game to crash
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
super.render(matrices, mouseX, mouseY, delta); // Render the buttons
|
super.render(matrices, mouseX, mouseY, delta); // Render the buttons
|
||||||
|
#else
|
||||||
|
super.extractRenderState(matrices, mouseX, mouseY, delta);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Render the text's
|
// Render the text's
|
||||||
this.DhDrawCenteredString(matrices, this.font,
|
this.DhDrawCenteredString(matrices, this.font,
|
||||||
Translatable(ModInfo.ID + ".updater.text1"),
|
Translatable(ModInfo.ID + ".updater.text1"),
|
||||||
|
|||||||
+12
-1
@@ -172,7 +172,12 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
|||||||
#else
|
#else
|
||||||
ChunkPos playerPos = player.chunkPosition();
|
ChunkPos playerPos = player.chunkPosition();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
return new DhChunkPos(playerPos.x, playerPos.z);
|
return new DhChunkPos(playerPos.x, playerPos.z);
|
||||||
|
#else
|
||||||
|
return new DhChunkPos(playerPos.x(), playerPos.z());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
@@ -227,7 +232,11 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
|||||||
|
|
||||||
RenderThreadTaskHandler.INSTANCE.queueRunningOnRenderThread("MinecraftClientWrapper sendChatMessage", () ->
|
RenderThreadTaskHandler.INSTANCE.queueRunningOnRenderThread("MinecraftClientWrapper sendChatMessage", () ->
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
player.displayClientMessage(net.minecraft.network.chat.Component.translatable(string), /*isOverlay*/false);
|
player.displayClientMessage(net.minecraft.network.chat.Component.translatable(string), /*isOverlay*/false);
|
||||||
|
#else
|
||||||
|
player.sendSystemMessage(net.minecraft.network.chat.Component.translatable(string));
|
||||||
|
#endif
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -243,8 +252,10 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
|||||||
|
|
||||||
#if MC_VER < MC_1_19_2
|
#if MC_VER < MC_1_19_2
|
||||||
player.displayClientMessage(new TextComponent(string), /*isOverlay*/true);
|
player.displayClientMessage(new TextComponent(string), /*isOverlay*/true);
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
player.displayClientMessage(net.minecraft.network.chat.Component.translatable(string), /*isOverlay*/true);
|
player.displayClientMessage(net.minecraft.network.chat.Component.translatable(string), /*isOverlay*/true);
|
||||||
|
#else
|
||||||
|
player.sendOverlayMessage(net.minecraft.network.chat.Component.translatable(string));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -182,8 +182,10 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
return MC.getFrameTime();
|
return MC.getFrameTime();
|
||||||
#elif MC_VER < MC_1_21_3
|
#elif MC_VER < MC_1_21_3
|
||||||
return MC.getTimer().getRealtimeDeltaTicks();
|
return MC.getTimer().getRealtimeDeltaTicks();
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
return MC.deltaTracker.getRealtimeDeltaTicks();
|
return MC.deltaTracker.getRealtimeDeltaTicks();
|
||||||
|
#else
|
||||||
|
return MC.getDeltaTracker().getRealtimeDeltaTicks();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,7 +515,11 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
if (MC.level != null)
|
if (MC.level != null)
|
||||||
{
|
{
|
||||||
Direction mcDir = McObjectConverter.Convert(lodDirection);
|
Direction mcDir = McObjectConverter.Convert(lodDirection);
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
return MC.level.getShade(mcDir, true);
|
return MC.level.getShade(mcDir, true);
|
||||||
|
#else
|
||||||
|
return MC.level.cardinalLighting().byFace(mcDir);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+6
-2
@@ -1,6 +1,7 @@
|
|||||||
package com.seibel.distanthorizons.common.wrappers.worldGeneration;
|
package com.seibel.distanthorizons.common.wrappers.worldGeneration;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.api.DhApi;
|
import com.seibel.distanthorizons.api.DhApi;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||||
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
||||||
import com.seibel.distanthorizons.common.wrappers.worldGeneration.params.GlobalWorldGenParams;
|
import com.seibel.distanthorizons.common.wrappers.worldGeneration.params.GlobalWorldGenParams;
|
||||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||||
@@ -245,7 +246,7 @@ public class InternalServerGenerator
|
|||||||
// ignore chunk update events for this position
|
// ignore chunk update events for this position
|
||||||
if (this.updateManager != null)
|
if (this.updateManager != null)
|
||||||
{
|
{
|
||||||
this.updateManager.addPosToIgnore(new DhChunkPos(chunkPos.x, chunkPos.z));
|
this.updateManager.addPosToIgnore(McObjectConverter.Convert(chunkPos));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MC_VER < MC_1_21_5
|
#if MC_VER < MC_1_21_5
|
||||||
@@ -258,7 +259,10 @@ public class InternalServerGenerator
|
|||||||
// probably not the most optimal to run updates here, but fast enough
|
// probably not the most optimal to run updates here, but fast enough
|
||||||
level.getChunkSource().distanceManager.runAllUpdates(level.getChunkSource().chunkMap);
|
level.getChunkSource().distanceManager.runAllUpdates(level.getChunkSource().chunkMap);
|
||||||
|
|
||||||
ChunkHolder chunkHolder = level.getChunkSource().chunkMap.getUpdatingChunkIfPresent(chunkPos.toLong());
|
ChunkHolder chunkHolder = level.getChunkSource().chunkMap
|
||||||
|
.getUpdatingChunkIfPresent(
|
||||||
|
#if MC_VER <= MC_1_21_11 chunkPos.toLong() #else chunkPos.pack() #endif
|
||||||
|
);
|
||||||
if (chunkHolder == null)
|
if (chunkHolder == null)
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("No chunk chunkHolder for pos ["+chunkPos+"] after ticket has been added.");
|
throw new IllegalStateException("No chunk chunkHolder for pos ["+chunkPos+"] after ticket has been added.");
|
||||||
|
|||||||
+8
-2
@@ -20,12 +20,14 @@
|
|||||||
package com.seibel.distanthorizons.common.wrappers.worldGeneration.chunkFileHandling;
|
package com.seibel.distanthorizons.common.wrappers.worldGeneration.chunkFileHandling;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||||
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
import com.seibel.distanthorizons.core.config.Config;
|
||||||
import com.seibel.distanthorizons.core.level.IDhServerLevel;
|
import com.seibel.distanthorizons.core.level.IDhServerLevel;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
|
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.ChunkLightStorage;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.ChunkLightStorage;
|
||||||
|
|
||||||
@@ -673,7 +675,9 @@ public class ChunkCompoundTagParser
|
|||||||
{
|
{
|
||||||
LOGGED_ERROR_MESSAGE_MAP.computeIfAbsent(message, (newMessage) ->
|
LOGGED_ERROR_MESSAGE_MAP.computeIfAbsent(message, (newMessage) ->
|
||||||
{
|
{
|
||||||
LOGGER.warn("Unable to deserialize blocks for chunk section [" + chunkPos.x + ", " + sectionYIndex + ", " + chunkPos.z + "], error: ["+newMessage+"]. " +
|
DhChunkPos dhChunkPos = McObjectConverter.Convert(chunkPos);
|
||||||
|
|
||||||
|
LOGGER.warn("Unable to deserialize blocks for chunk section [" + dhChunkPos.getX() + ", " + sectionYIndex + ", " + dhChunkPos.getZ() + "], error: ["+newMessage+"]. " +
|
||||||
"This can probably be ignored, although if your world looks wrong, optimizing it via the single player menu then deleting your DH database(s) should fix the problem.");
|
"This can probably be ignored, although if your world looks wrong, optimizing it via the single player menu then deleting your DH database(s) should fix the problem.");
|
||||||
|
|
||||||
return newMessage;
|
return newMessage;
|
||||||
@@ -683,7 +687,9 @@ public class ChunkCompoundTagParser
|
|||||||
{
|
{
|
||||||
LOGGED_ERROR_MESSAGE_MAP.computeIfAbsent(message, (newMessage) ->
|
LOGGED_ERROR_MESSAGE_MAP.computeIfAbsent(message, (newMessage) ->
|
||||||
{
|
{
|
||||||
LOGGER.warn("Unable to deserialize biomes for chunk section [" + chunkPos.x + ", " + sectionYIndex + ", " + chunkPos.z + "], error: ["+newMessage+"]. " +
|
DhChunkPos dhChunkPos = McObjectConverter.Convert(chunkPos);
|
||||||
|
|
||||||
|
LOGGER.warn("Unable to deserialize biomes for chunk section [" + dhChunkPos.getX() + ", " + sectionYIndex + ", " + dhChunkPos.getZ() + "], error: ["+newMessage+"]. " +
|
||||||
"This can probably be ignored, although if your world looks wrong, optimizing it via the single player menu then deleting your DH database(s) should fix the problem.");
|
"This can probably be ignored, although if your world looks wrong, optimizing it via the single player menu then deleting your DH database(s) should fix the problem.");
|
||||||
|
|
||||||
return newMessage;
|
return newMessage;
|
||||||
|
|||||||
+25
-15
@@ -22,9 +22,12 @@ package com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject;
|
|||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||||
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
||||||
import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
|
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||||
import net.minecraft.world.level.block.EntityBlock;
|
import net.minecraft.world.level.block.EntityBlock;
|
||||||
import net.minecraft.world.level.block.SpawnerBlock;
|
import net.minecraft.world.level.block.SpawnerBlock;
|
||||||
@@ -89,7 +92,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
|||||||
public final int writeRadius;
|
public final int writeRadius;
|
||||||
public final int size;
|
public final int size;
|
||||||
|
|
||||||
private final ChunkPos firstPos;
|
private final DhChunkPos firstPos;
|
||||||
private final List<ChunkAccess> cache;
|
private final List<ChunkAccess> cache;
|
||||||
private final Long2ObjectOpenHashMap<ChunkAccess> chunkMap = new Long2ObjectOpenHashMap<ChunkAccess>();
|
private final Long2ObjectOpenHashMap<ChunkAccess> chunkMap = new Long2ObjectOpenHashMap<ChunkAccess>();
|
||||||
|
|
||||||
@@ -149,7 +152,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
|||||||
centerChunk);
|
centerChunk);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
this.firstPos = chunkList.get(0).getPos();
|
this.firstPos = McObjectConverter.Convert(chunkList.get(0).getPos());
|
||||||
this.serverLevel = serverLevel;
|
this.serverLevel = serverLevel;
|
||||||
this.generator = generator;
|
this.generator = generator;
|
||||||
this.lightEngine = lightEngine;
|
this.lightEngine = lightEngine;
|
||||||
@@ -165,17 +168,22 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
|||||||
@Override
|
@Override
|
||||||
public boolean ensureCanWrite(BlockPos blockPos)
|
public boolean ensureCanWrite(BlockPos blockPos)
|
||||||
{
|
{
|
||||||
int i = SectionPos.blockToSectionCoord(blockPos.getX());
|
DhChunkPos chunkPos = McObjectConverter.Convert(this.getCenter());
|
||||||
int j = SectionPos.blockToSectionCoord(blockPos.getZ());
|
|
||||||
ChunkPos chunkPos = this.getCenter();
|
int sectionCoordX = SectionPos.blockToSectionCoord(blockPos.getX());
|
||||||
ChunkAccess center = this.getChunk(chunkPos.x, chunkPos.z);
|
int sectionCoordZ = SectionPos.blockToSectionCoord(blockPos.getZ());
|
||||||
int k = Math.abs(chunkPos.x - i);
|
|
||||||
int l = Math.abs(chunkPos.z - j);
|
// TODO what do these "abs" positions mean?
|
||||||
if (k > this.writeRadius || l > this.writeRadius)
|
int absX = Math.abs(chunkPos.getX() - sectionCoordX);
|
||||||
|
int absZ = Math.abs(chunkPos.getZ() - sectionCoordZ);
|
||||||
|
if (absX > this.writeRadius
|
||||||
|
|| absZ > this.writeRadius)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MC_VER >= MC_1_18_2
|
#if MC_VER >= MC_1_18_2
|
||||||
|
ChunkAccess center = this.getChunk(chunkPos.getX(), chunkPos.getZ());
|
||||||
if (center.isUpgrading())
|
if (center.isUpgrading())
|
||||||
{
|
{
|
||||||
LevelHeightAccessor levelHeightAccessor = center.getHeightAccessorForGeneration();
|
LevelHeightAccessor levelHeightAccessor = center.getHeightAccessorForGeneration();
|
||||||
@@ -196,6 +204,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -401,17 +410,18 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
|||||||
/** Use this instead of super.hasChunk() to bypass C2ME concurrency checks */
|
/** Use this instead of super.hasChunk() to bypass C2ME concurrency checks */
|
||||||
public boolean superHasChunk(int x, int z)
|
public boolean superHasChunk(int x, int z)
|
||||||
{
|
{
|
||||||
int k = x - this.firstPos.x;
|
int xOffset = x - this.firstPos.getX();
|
||||||
int l = z - this.firstPos.z;
|
int zOffset = z - this.firstPos.getZ();
|
||||||
return l >= 0 && l < this.size && k >= 0 && k < this.size;
|
return zOffset >= 0 && zOffset < this.size
|
||||||
|
&& xOffset >= 0 && xOffset < this.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Use this instead of super.getChunk() to bypass C2ME concurrency checks */
|
/** Use this instead of super.getChunk() to bypass C2ME concurrency checks */
|
||||||
private ChunkAccess superGetChunk(int x, int z)
|
private ChunkAccess superGetChunk(int x, int z)
|
||||||
{
|
{
|
||||||
int k = x - this.firstPos.x;
|
int xOffset = x - this.firstPos.getX();
|
||||||
int l = z - this.firstPos.z;
|
int zOffset = z - this.firstPos.getZ();
|
||||||
return this.cache.get(k + l * this.size);
|
return this.cache.get(xOffset + zOffset * this.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+7
-2
@@ -69,8 +69,13 @@ public class RegionFileStorageExternalCache implements AutoCloseable
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
long chunkPosLong;
|
||||||
|
#if MC_VER <= MC_1_21_11
|
||||||
|
chunkPosLong = ChunkPos.asLong(chunkPos.getRegionX(), chunkPos.getRegionZ());
|
||||||
|
#else
|
||||||
|
chunkPosLong = ChunkPos.pack(chunkPos.getRegionX(), chunkPos.getRegionZ());
|
||||||
|
#endif
|
||||||
|
|
||||||
long chunkPosLong = ChunkPos.asLong(chunkPos.getRegionX(), chunkPos.getRegionZ());
|
|
||||||
RegionFile regionFile = null;
|
RegionFile regionFile = null;
|
||||||
|
|
||||||
// Check vanilla cache
|
// Check vanilla cache
|
||||||
@@ -179,7 +184,7 @@ public class RegionFileStorageExternalCache implements AutoCloseable
|
|||||||
regionFile = new RegionFile(new RegionStorageInfo("level", null, "level type"), regionFilePath, storageFolderPath, false);
|
regionFile = new RegionFile(new RegionStorageInfo("level", null, "level type"), regionFilePath, storageFolderPath, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
this.regionFileCache.add(new RegionFileCache(ChunkPos.asLong(chunkPos.getRegionX(), chunkPos.getRegionZ()), regionFile));
|
this.regionFileCache.add(new RegionFileCache(chunkPosLong, regionFile));
|
||||||
while (this.regionFileCache.size() > MAX_CACHE_SIZE)
|
while (this.regionFileCache.size() > MAX_CACHE_SIZE)
|
||||||
{
|
{
|
||||||
this.regionFileCache.poll().file.close();
|
this.regionFileCache.poll().file.close();
|
||||||
|
|||||||
+5
-2
@@ -28,6 +28,8 @@ import java.util.stream.Stream;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||||
|
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||||
import it.unimi.dsi.fastutil.longs.LongSet;
|
import it.unimi.dsi.fastutil.longs.LongSet;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.SectionPos;
|
import net.minecraft.core.SectionPos;
|
||||||
@@ -222,9 +224,10 @@ public class WorldGenStructFeatManager extends #if MC_VER < MC_1_19_2 StructureF
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@Override
|
@Override
|
||||||
public List<StructureStart> startsForStructure(ChunkPos sectionPos, Predicate<Structure> predicate)
|
public List<StructureStart> startsForStructure(ChunkPos chunkPos, Predicate<Structure> predicate)
|
||||||
{
|
{
|
||||||
ChunkAccess chunk = _getChunk(sectionPos.x, sectionPos.z, ChunkStatus.STRUCTURE_REFERENCES);
|
DhChunkPos dhChunkPos = McObjectConverter.Convert(chunkPos);
|
||||||
|
ChunkAccess chunk = _getChunk(dhChunkPos.getX(), dhChunkPos.getZ(), ChunkStatus.STRUCTURE_REFERENCES);
|
||||||
if (chunk == null) return List.of();
|
if (chunk == null) return List.of();
|
||||||
|
|
||||||
// Copied from StructureFeatureManager::startsForFeature(...)
|
// Copied from StructureFeatureManager::startsForFeature(...)
|
||||||
|
|||||||
+5
-1
@@ -113,10 +113,14 @@ public final class GlobalWorldGenParams
|
|||||||
this.worldOptions = worldData.worldGenOptions();
|
this.worldOptions = worldData.worldGenOptions();
|
||||||
this.biomes = registry.registryOrThrow(Registries.BIOME);
|
this.biomes = registry.registryOrThrow(Registries.BIOME);
|
||||||
this.worldSeed = worldOptions.seed();
|
this.worldSeed = worldOptions.seed();
|
||||||
#else
|
#elif MC_VER <= MC_1_21_11
|
||||||
this.worldOptions = worldData.worldGenOptions();
|
this.worldOptions = worldData.worldGenOptions();
|
||||||
this.biomes = this.registry.lookupOrThrow(Registries.BIOME);
|
this.biomes = this.registry.lookupOrThrow(Registries.BIOME);
|
||||||
this.worldSeed = this.worldOptions.seed();
|
this.worldSeed = this.worldOptions.seed();
|
||||||
|
#else
|
||||||
|
this.worldOptions = null;//worldData.worldGenOptions();
|
||||||
|
this.biomes = this.registry.lookupOrThrow(Registries.BIOME);
|
||||||
|
this.worldSeed = this.worldOptions.seed();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER >= MC_1_18_2
|
#if MC_VER >= MC_1_18_2
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ versionStr=
|
|||||||
|
|
||||||
# This defines what MC version Intellij will use for the preprocessor
|
# This defines what MC version Intellij will use for the preprocessor
|
||||||
# and what version is used automatically by build and run commands
|
# and what version is used automatically by build and run commands
|
||||||
mcVer=1.26.1
|
mcVer=1.21.11
|
||||||
|
|
||||||
# Defines the maximum amount of memory Minecraft is allowed when run in a development environment
|
# Defines the maximum amount of memory Minecraft is allowed when run in a development environment
|
||||||
#minecraftMemoryJavaArg="-Xmx4G"
|
#minecraftMemoryJavaArg="-Xmx4G"
|
||||||
|
|||||||
Reference in New Issue
Block a user