continue porting to MC 26 (2)
This commit is contained in:
@@ -357,8 +357,8 @@ if (isNotCommonProject) {
|
||||
// JVM args
|
||||
runTask.jvmArgs(
|
||||
"-Dio.netty.leakDetection.level=advanced",
|
||||
"-XX:+UseZGC",
|
||||
"-XX:+ZGenerational",
|
||||
//"-XX:+UseZGC",
|
||||
//"-XX:+ZGenerational",
|
||||
)
|
||||
if (isClient) {
|
||||
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.core.api.internal.ServerApi;
|
||||
import com.seibel.distanthorizons.core.api.internal.SharedApi;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapper;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
@@ -17,8 +18,18 @@ public class MixinChunkMapCommon
|
||||
{
|
||||
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?
|
||||
if (SharedApi.isChunkAtChunkPosAlreadyUpdating(levelWrapper, chunk.getPos().x, chunk.getPos().z))
|
||||
if (SharedApi.isChunkAtChunkPosAlreadyUpdating(levelWrapper, chunkPosX, chunkPosZ))
|
||||
{
|
||||
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)
|
||||
// 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())
|
||||
{
|
||||
return;
|
||||
@@ -56,7 +67,7 @@ public class MixinChunkMapCommon
|
||||
// biome validation //
|
||||
|
||||
// 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)
|
||||
{
|
||||
return;
|
||||
|
||||
+4
-4
@@ -100,10 +100,10 @@ public class BlazeDhFarFadeRenderer implements IDhFarFadeRenderer
|
||||
RenderPipeline.Builder pipelineBuilder = RenderPipeline.builder();
|
||||
{
|
||||
pipelineBuilder.withCull(false);
|
||||
pipelineBuilder.withDepthWrite(false);
|
||||
pipelineBuilder.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST);
|
||||
pipelineBuilder.withColorWrite(true);
|
||||
pipelineBuilder.withoutBlend();
|
||||
//pipelineBuilder.withDepthWrite(false);
|
||||
//pipelineBuilder.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST);
|
||||
//pipelineBuilder.withColorWrite(true);
|
||||
//pipelineBuilder.withoutBlend();
|
||||
pipelineBuilder.withPolygonMode(PolygonMode.FILL);
|
||||
pipelineBuilder.withLocation(Identifier.parse("distanthorizons:far_fade"));
|
||||
|
||||
|
||||
+4
-4
@@ -121,10 +121,10 @@ public class BlazeDhFogRenderer implements IDhFogRenderer
|
||||
RenderPipeline.Builder pipelineBuilder = RenderPipeline.builder();
|
||||
{
|
||||
pipelineBuilder.withCull(false);
|
||||
pipelineBuilder.withDepthWrite(false);
|
||||
pipelineBuilder.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST);
|
||||
pipelineBuilder.withColorWrite(true);
|
||||
pipelineBuilder.withoutBlend();
|
||||
//pipelineBuilder.withDepthWrite(false);
|
||||
//pipelineBuilder.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST);
|
||||
//pipelineBuilder.withColorWrite(true);
|
||||
//pipelineBuilder.withoutBlend();
|
||||
pipelineBuilder.withPolygonMode(PolygonMode.FILL);
|
||||
pipelineBuilder.withLocation(Identifier.parse("distanthorizons:fog_render"));
|
||||
|
||||
|
||||
+9
-9
@@ -57,18 +57,18 @@ public class BlazeDhVertexFormatUtil
|
||||
|
||||
try
|
||||
{
|
||||
SCREEN_POS = 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);
|
||||
SCREEN_POS = null;//VertexFormatElement.register(/*id*/22, /*index*/0, VertexFormatElement.Type.FLOAT, VertexFormatElement.Usage.POSITION, /*count*/ 2);
|
||||
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);
|
||||
BYTE_PAD = VertexFormatElement.register(/*id*/25, /*index*/0, VertexFormatElement.Type.BYTE, VertexFormatElement.Usage.GENERIC, /*count*/ 1);
|
||||
SHORT_XYZ_POS = null;//VertexFormatElement.register(/*id*/24, /*index*/0, VertexFormatElement.Type.USHORT, VertexFormatElement.Usage.POSITION, /*count*/ 3);
|
||||
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);
|
||||
RGBA_UBYTE_COLOR = 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_NORMAL = VertexFormatElement.register(/*id*/29, /*index*/0, VertexFormatElement.Type.BYTE, VertexFormatElement.Usage.GENERIC, /*count*/ 1);
|
||||
META = null;//VertexFormatElement.register(/*id*/26, /*index*/0, VertexFormatElement.Type.USHORT, VertexFormatElement.Usage.GENERIC, /*count*/ 1);
|
||||
RGBA_UBYTE_COLOR = null;//VertexFormatElement.register(/*id*/27, /*index*/0, VertexFormatElement.Type.UBYTE, VertexFormatElement.Usage.COLOR, /*count*/ 4);
|
||||
IRIS_MATERIAL = null;//VertexFormatElement.register(/*id*/28, /*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)
|
||||
{
|
||||
|
||||
@@ -139,7 +139,16 @@ public class McObjectConverter
|
||||
}
|
||||
|
||||
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 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 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;
|
||||
#else
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.core.component.DataComponentMap;
|
||||
#endif
|
||||
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
@@ -221,17 +222,17 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
Level level = (Level)levelWrapper.getWrappedMcObject();
|
||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||
|
||||
#if MC_VER < MC_1_21_11
|
||||
#if MC_VER <= MC_1_21_10
|
||||
ResourceLocation resourceLocation;
|
||||
#else
|
||||
Identifier resourceLocation;
|
||||
#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);
|
||||
#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());
|
||||
#elif MC_VER < MC_1_21_3
|
||||
#elif MC_VER <= MC_1_21_4
|
||||
resourceLocation = registryAccess.registryOrThrow(Registries.BIOME).getKey(this.biome.value());
|
||||
#else
|
||||
resourceLocation = registryAccess.lookupOrThrow(Registries.BIOME).getKey(this.biome.value());
|
||||
@@ -240,7 +241,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
if (resourceLocation == null)
|
||||
{
|
||||
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();
|
||||
#else
|
||||
biomeName = this.biome.value().toString();
|
||||
@@ -354,18 +355,18 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
|
||||
|
||||
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);
|
||||
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);
|
||||
success = (unwrappedBiome != null);
|
||||
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);
|
||||
success = (unwrappedBiome != null);
|
||||
Holder<Biome> biome = new Holder.Direct<>(unwrappedBiome);
|
||||
#else
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
Holder<Biome> biome;
|
||||
Optional<Holder.Reference<Biome>> optionalBiomeHolder = registryAccess.lookupOrThrow(Registries.BIOME).get(resourceLocation);
|
||||
if (optionalBiomeHolder.isPresent())
|
||||
@@ -379,6 +380,20 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
success = false;
|
||||
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
|
||||
|
||||
return new BiomeDeserializeResult(success, biome);
|
||||
|
||||
+19
-10
@@ -214,7 +214,14 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
if (blockState != null)
|
||||
{
|
||||
// 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"));
|
||||
}
|
||||
else
|
||||
@@ -667,22 +674,23 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
|
||||
|
||||
// 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();
|
||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||
#endif
|
||||
|
||||
#if MC_VER < MC_1_21_11
|
||||
#if MC_VER <= MC_1_21_10
|
||||
ResourceLocation resourceLocation;
|
||||
#else
|
||||
Identifier resourceLocation;
|
||||
#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());
|
||||
#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());
|
||||
#elif MC_VER < MC_1_21_3
|
||||
#elif MC_VER <= MC_1_21_4
|
||||
resourceLocation = registryAccess.registryOrThrow(Registries.BLOCK).getKey(this.blockState.getBlock());
|
||||
#else
|
||||
resourceLocation = registryAccess.lookupOrThrow(Registries.BLOCK).getKey(this.blockState.getBlock());
|
||||
@@ -771,18 +779,19 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
try
|
||||
{
|
||||
|
||||
#if MC_VER > MC_1_17_1
|
||||
#if MC_VER <= MC_1_16_5
|
||||
#else
|
||||
LodUtil.assertTrue(levelWrapper != null && levelWrapper.getWrappedMcObject() != null);
|
||||
Level level = (Level)levelWrapper.getWrappedMcObject();
|
||||
#endif
|
||||
|
||||
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);
|
||||
#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();
|
||||
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();
|
||||
block = registryAccess.registryOrThrow(Registries.BLOCK).get(resourceLocation);
|
||||
#else
|
||||
|
||||
+1
@@ -46,6 +46,7 @@ import java.util.List;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
#if MC_VER < MC_1_21_5
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
import net.minecraft.client.renderer.block.model.BlockModelPart;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
|
||||
+1
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.common.wrappers.block;
|
||||
|
||||
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
#if MC_VER < MC_1_17_1
|
||||
|
||||
+9
@@ -63,8 +63,10 @@ public class TintGetterOverride extends AbstractDhTintGetter
|
||||
// methods //
|
||||
//=========//
|
||||
|
||||
#if MC_VER <= MC_1_21_11
|
||||
@Override
|
||||
public float getShade(Direction direction, boolean bl) { return this.parent.getShade(direction, bl); }
|
||||
#endif
|
||||
|
||||
@Override
|
||||
public LevelLightEngine getLightEngine() { return this.parent.getLightEngine(); }
|
||||
@@ -178,5 +180,12 @@ public class TintGetterOverride extends AbstractDhTintGetter
|
||||
#endif
|
||||
|
||||
|
||||
#if MC_VER <= MC_1_21_11
|
||||
#else
|
||||
@Override
|
||||
public CardinalLighting cardinalLighting() { return CardinalLighting.DEFAULT; }
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+23
-2
@@ -19,8 +19,6 @@
|
||||
|
||||
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.Direction;
|
||||
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 org.jetbrains.annotations.Nullable;
|
||||
|
||||
#if MC_VER <= MC_1_21_11
|
||||
#else
|
||||
import net.minecraft.world.level.CardinalLighting;
|
||||
#endif
|
||||
|
||||
|
||||
public class TintWithoutLevelOverrider extends AbstractDhTintGetter
|
||||
{
|
||||
|
||||
@@ -46,9 +50,12 @@ public class TintWithoutLevelOverrider extends AbstractDhTintGetter
|
||||
// methods //
|
||||
//=========//
|
||||
|
||||
#if MC_VER <= MC_1_21_11
|
||||
@Override
|
||||
public float getShade(Direction direction, boolean shade)
|
||||
{ throw new UnsupportedOperationException("ERROR: getShade() called on TintWithoutLevelOverrider. Object is for tinting only."); }
|
||||
#endif
|
||||
|
||||
@Override
|
||||
public LevelLightEngine getLightEngine()
|
||||
{ throw new UnsupportedOperationException("ERROR: getLightEngine() called on TintWithoutLevelOverrider. Object is for tinting only."); }
|
||||
@@ -87,4 +94,18 @@ public class TintWithoutLevelOverrider extends AbstractDhTintGetter
|
||||
|
||||
#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.wrappedLevel = wrappedLevel;
|
||||
|
||||
#if MC_VER <= MC_1_21_11
|
||||
this.chunkPos = new DhChunkPos(chunk.getPos().x, chunk.getPos().z);
|
||||
#else
|
||||
this.chunkPos = new DhChunkPos(chunk.getPos().x(), chunk.getPos().z());
|
||||
#endif
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+39
-9
@@ -46,8 +46,10 @@ import org.jetbrains.annotations.Nullable;
|
||||
#if MC_VER < MC_1_20_1
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
#else
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
#else
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
#endif
|
||||
|
||||
#if MC_VER >= MC_1_17_1
|
||||
@@ -581,7 +583,7 @@ public class ClassicConfigGUI
|
||||
widget.insertText(String.valueOf(configEntry.get()));
|
||||
|
||||
Predicate<String> processor = configGuiInfo.tooltipFunction.apply(widget, this.doneButton);
|
||||
widget.setFilter(processor);
|
||||
//widget.setFilter(processor);
|
||||
|
||||
this.configListWidget.addButton(this, configEntry, widget, resetButton, null, textComponent);
|
||||
|
||||
@@ -698,17 +700,26 @@ public class ClassicConfigGUI
|
||||
@Override
|
||||
#if MC_VER < MC_1_20_1
|
||||
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)
|
||||
#else
|
||||
public void extractRenderState(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
#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
|
||||
#else
|
||||
this.renderBackground(matrices);
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
#else
|
||||
super.extractRenderState(matrices, mouseX, mouseY, delta);
|
||||
#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
|
||||
@@ -751,7 +762,7 @@ public class ClassicConfigGUI
|
||||
#if MC_VER < MC_1_20_1
|
||||
private void renderTooltip(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||
#else
|
||||
private void renderTooltip(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||
private void renderTooltip(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
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)
|
||||
#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)
|
||||
#else
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
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
|
||||
{
|
||||
try
|
||||
@@ -973,19 +986,31 @@ public class ClassicConfigGUI
|
||||
if (this.button != null)
|
||||
{
|
||||
SetY(this.button, y);
|
||||
#if MC_VER <= MC_1_21_11
|
||||
this.button.render(matrices, mouseX, mouseY, tickDelta);
|
||||
#else
|
||||
this.button.extractRenderState(matrices, mouseX, mouseY, tickDelta);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (this.resetButton != null)
|
||||
{
|
||||
SetY(this.resetButton, y);
|
||||
#if MC_VER <= MC_1_21_11
|
||||
this.resetButton.render(matrices, mouseX, mouseY, tickDelta);
|
||||
#else
|
||||
this.resetButton.extractRenderState(matrices, mouseX, mouseY, tickDelta);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (this.indexButton != null)
|
||||
{
|
||||
SetY(this.indexButton, y);
|
||||
#if MC_VER <= MC_1_21_11
|
||||
this.indexButton.render(matrices, mouseX, mouseY, tickDelta);
|
||||
#else
|
||||
this.indexButton.extractRenderState(matrices, mouseX, mouseY, tickDelta);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (this.text != null)
|
||||
@@ -1034,11 +1059,16 @@ public class ClassicConfigGUI
|
||||
this.text,
|
||||
textXPos, y + 5,
|
||||
0xFFFFFF);
|
||||
#else
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
matrices.drawString(textRenderer,
|
||||
this.text,
|
||||
textXPos, y + 5,
|
||||
0xFFFFFFFF);
|
||||
#else
|
||||
matrices.text(textRenderer,
|
||||
this.text,
|
||||
textXPos, y + 5,
|
||||
0xFFFFFFFF);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
+13
@@ -3,6 +3,7 @@ package com.seibel.distanthorizons.common.wrappers.gui;
|
||||
#if MC_VER < MC_1_21_9
|
||||
// not supported for older MC versions
|
||||
#else
|
||||
|
||||
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
|
||||
@@ -19,6 +20,8 @@ import net.minecraft.world.level.chunk.LevelChunk;
|
||||
|
||||
#if MC_VER <= MC_1_21_10
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
#else
|
||||
import net.minecraft.resources.Identifier;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -32,6 +35,7 @@ public class DhDebugScreenEntry implements net.minecraft.client.gui.components.d
|
||||
{
|
||||
public static void register()
|
||||
{
|
||||
#if MC_VER <= MC_1_21_11
|
||||
// This method is private, so its access will need to be widened
|
||||
DebugScreenEntries.register(
|
||||
// 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
|
||||
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;
|
||||
|
||||
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.screens.Screen;
|
||||
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;
|
||||
|
||||
public class DhScreen extends Screen
|
||||
@@ -73,7 +77,7 @@ public class DhScreen extends Screen
|
||||
{
|
||||
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)
|
||||
{
|
||||
guiStack.drawCenteredString(font, text, x, y, color);
|
||||
@@ -82,10 +86,6 @@ public class DhScreen extends Screen
|
||||
{
|
||||
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)
|
||||
{
|
||||
guiStack.setComponentTooltipForNextFrame(font, comp, x, y);
|
||||
@@ -94,6 +94,23 @@ public class DhScreen extends Screen
|
||||
{
|
||||
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
|
||||
|
||||
|
||||
|
||||
+23
-5
@@ -1,16 +1,24 @@
|
||||
package com.seibel.distanthorizons.common.wrappers.gui;
|
||||
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
|
||||
import com.seibel.distanthorizons.core.config.gui.AbstractScreen;
|
||||
|
||||
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.screens.Screen;
|
||||
|
||||
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.util.*;
|
||||
|
||||
@@ -74,8 +82,10 @@ public class MinecraftScreen
|
||||
@Override
|
||||
#if MC_VER < MC_1_20_1
|
||||
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)
|
||||
#else
|
||||
public void extractRenderState(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
#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
|
||||
#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)
|
||||
#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.mouseY = mouseY;
|
||||
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)
|
||||
#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
|
||||
|
||||
+13
-7
@@ -45,9 +45,12 @@ import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
#else
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
#else
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_21_10
|
||||
@@ -196,9 +199,12 @@ public class TexturedButtonWidget extends Button
|
||||
#if MC_VER < MC_1_21_11
|
||||
@Override
|
||||
public void renderWidget(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||
#else
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
@Override
|
||||
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
|
||||
{
|
||||
if (this.renderBackground)
|
||||
@@ -212,11 +218,11 @@ public class TexturedButtonWidget extends Button
|
||||
this.getX(), this.getY(),
|
||||
this.getWidth(), this.getHeight());
|
||||
#else
|
||||
matrices.blitSprite(
|
||||
RenderPipelines.GUI_TEXTURED,
|
||||
SPRITES.get(this.active, this.isHoveredOrFocused()),
|
||||
this.getX(), this.getY(),
|
||||
this.getWidth(), this.getHeight());
|
||||
//matrices.blitSprite(
|
||||
// RenderPipelines.GUI_TEXTURED,
|
||||
// SPRITES.get(this.active, this.isHoveredOrFocused()),
|
||||
// this.getX(), this.getY(),
|
||||
// this.getWidth(), this.getHeight());
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
+17
-3
@@ -23,8 +23,10 @@ import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
#if MC_VER < MC_1_20_1
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
#else
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
#else
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -168,8 +170,10 @@ public class ChangelogScreen extends DhScreen
|
||||
@Override
|
||||
#if MC_VER < MC_1_20_1
|
||||
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)
|
||||
#else
|
||||
public void extractRenderState(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
#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
|
||||
#if MC_VER <= MC_1_21_11
|
||||
super.render(matrices, mouseX, mouseY, delta); // Render the buttons
|
||||
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
|
||||
}
|
||||
|
||||
@@ -264,10 +274,14 @@ public class ChangelogScreen extends DhScreen
|
||||
@Override
|
||||
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); }
|
||||
#else
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
@Override
|
||||
public void renderContent(GuiGraphics matrices, int y, int x, boolean hovered, float tickDelta)
|
||||
{ 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
|
||||
|
||||
@Override
|
||||
|
||||
+11
-3
@@ -13,10 +13,12 @@ import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
|
||||
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;
|
||||
#else
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_21_10
|
||||
@@ -172,8 +174,10 @@ public class UpdateModScreen extends DhScreen
|
||||
@Override
|
||||
#if MC_VER < MC_1_20_1
|
||||
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)
|
||||
#else
|
||||
public void extractRenderState(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
#if MC_VER < MC_1_20_2
|
||||
@@ -184,7 +188,11 @@ public class UpdateModScreen extends DhScreen
|
||||
// background blur is already being rendered, rendering again causes the game to crash
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_21_11
|
||||
super.render(matrices, mouseX, mouseY, delta); // Render the buttons
|
||||
#else
|
||||
super.extractRenderState(matrices, mouseX, mouseY, delta);
|
||||
#endif
|
||||
|
||||
// Render the text's
|
||||
this.DhDrawCenteredString(matrices, this.font,
|
||||
|
||||
+12
-1
@@ -172,7 +172,12 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
#else
|
||||
ChunkPos playerPos = player.chunkPosition();
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_21_11
|
||||
return new DhChunkPos(playerPos.x, playerPos.z);
|
||||
#else
|
||||
return new DhChunkPos(playerPos.x(), playerPos.z());
|
||||
#endif
|
||||
}
|
||||
|
||||
//endregion
|
||||
@@ -227,7 +232,11 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
|
||||
RenderThreadTaskHandler.INSTANCE.queueRunningOnRenderThread("MinecraftClientWrapper sendChatMessage", () ->
|
||||
{
|
||||
#if MC_VER <= MC_1_21_11
|
||||
player.displayClientMessage(net.minecraft.network.chat.Component.translatable(string), /*isOverlay*/false);
|
||||
#else
|
||||
player.sendSystemMessage(net.minecraft.network.chat.Component.translatable(string));
|
||||
#endif
|
||||
});
|
||||
#endif
|
||||
}
|
||||
@@ -243,8 +252,10 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
|
||||
#if MC_VER < MC_1_19_2
|
||||
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);
|
||||
#else
|
||||
player.sendOverlayMessage(net.minecraft.network.chat.Component.translatable(string));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -182,8 +182,10 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
return MC.getFrameTime();
|
||||
#elif MC_VER < MC_1_21_3
|
||||
return MC.getTimer().getRealtimeDeltaTicks();
|
||||
#else
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
return MC.deltaTracker.getRealtimeDeltaTicks();
|
||||
#else
|
||||
return MC.getDeltaTracker().getRealtimeDeltaTicks();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -513,7 +515,11 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
if (MC.level != null)
|
||||
{
|
||||
Direction mcDir = McObjectConverter.Convert(lodDirection);
|
||||
#if MC_VER <= MC_1_21_11
|
||||
return MC.level.getShade(mcDir, true);
|
||||
#else
|
||||
return MC.level.cardinalLighting().byFace(mcDir);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+6
-2
@@ -1,6 +1,7 @@
|
||||
package com.seibel.distanthorizons.common.wrappers.worldGeneration;
|
||||
|
||||
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.worldGeneration.params.GlobalWorldGenParams;
|
||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||
@@ -245,7 +246,7 @@ public class InternalServerGenerator
|
||||
// ignore chunk update events for this position
|
||||
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
|
||||
@@ -258,7 +259,10 @@ public class InternalServerGenerator
|
||||
// probably not the most optimal to run updates here, but fast enough
|
||||
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)
|
||||
{
|
||||
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;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
||||
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.level.IDhServerLevel;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
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.wrapperInterfaces.chunk.ChunkLightStorage;
|
||||
|
||||
@@ -673,7 +675,9 @@ public class ChunkCompoundTagParser
|
||||
{
|
||||
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.");
|
||||
|
||||
return newMessage;
|
||||
@@ -683,7 +687,9 @@ public class ChunkCompoundTagParser
|
||||
{
|
||||
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.");
|
||||
|
||||
return newMessage;
|
||||
|
||||
+25
-15
@@ -22,9 +22,12 @@ package com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.util.List;
|
||||
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.worldGeneration.BatchGenerationEnvironment;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import net.minecraft.world.level.block.EntityBlock;
|
||||
import net.minecraft.world.level.block.SpawnerBlock;
|
||||
@@ -89,7 +92,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
public final int writeRadius;
|
||||
public final int size;
|
||||
|
||||
private final ChunkPos firstPos;
|
||||
private final DhChunkPos firstPos;
|
||||
private final List<ChunkAccess> cache;
|
||||
private final Long2ObjectOpenHashMap<ChunkAccess> chunkMap = new Long2ObjectOpenHashMap<ChunkAccess>();
|
||||
|
||||
@@ -149,7 +152,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
centerChunk);
|
||||
#endif
|
||||
|
||||
this.firstPos = chunkList.get(0).getPos();
|
||||
this.firstPos = McObjectConverter.Convert(chunkList.get(0).getPos());
|
||||
this.serverLevel = serverLevel;
|
||||
this.generator = generator;
|
||||
this.lightEngine = lightEngine;
|
||||
@@ -165,17 +168,22 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
@Override
|
||||
public boolean ensureCanWrite(BlockPos blockPos)
|
||||
{
|
||||
int i = SectionPos.blockToSectionCoord(blockPos.getX());
|
||||
int j = SectionPos.blockToSectionCoord(blockPos.getZ());
|
||||
ChunkPos chunkPos = this.getCenter();
|
||||
ChunkAccess center = this.getChunk(chunkPos.x, chunkPos.z);
|
||||
int k = Math.abs(chunkPos.x - i);
|
||||
int l = Math.abs(chunkPos.z - j);
|
||||
if (k > this.writeRadius || l > this.writeRadius)
|
||||
DhChunkPos chunkPos = McObjectConverter.Convert(this.getCenter());
|
||||
|
||||
int sectionCoordX = SectionPos.blockToSectionCoord(blockPos.getX());
|
||||
int sectionCoordZ = SectionPos.blockToSectionCoord(blockPos.getZ());
|
||||
|
||||
// TODO what do these "abs" positions mean?
|
||||
int absX = Math.abs(chunkPos.getX() - sectionCoordX);
|
||||
int absZ = Math.abs(chunkPos.getZ() - sectionCoordZ);
|
||||
if (absX > this.writeRadius
|
||||
|| absZ > this.writeRadius)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#if MC_VER >= MC_1_18_2
|
||||
ChunkAccess center = this.getChunk(chunkPos.getX(), chunkPos.getZ());
|
||||
if (center.isUpgrading())
|
||||
{
|
||||
LevelHeightAccessor levelHeightAccessor = center.getHeightAccessorForGeneration();
|
||||
@@ -196,6 +204,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@@ -401,17 +410,18 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
/** Use this instead of super.hasChunk() to bypass C2ME concurrency checks */
|
||||
public boolean superHasChunk(int x, int z)
|
||||
{
|
||||
int k = x - this.firstPos.x;
|
||||
int l = z - this.firstPos.z;
|
||||
return l >= 0 && l < this.size && k >= 0 && k < this.size;
|
||||
int xOffset = x - this.firstPos.getX();
|
||||
int zOffset = z - this.firstPos.getZ();
|
||||
return zOffset >= 0 && zOffset < this.size
|
||||
&& xOffset >= 0 && xOffset < this.size;
|
||||
}
|
||||
|
||||
/** Use this instead of super.getChunk() to bypass C2ME concurrency checks */
|
||||
private ChunkAccess superGetChunk(int x, int z)
|
||||
{
|
||||
int k = x - this.firstPos.x;
|
||||
int l = z - this.firstPos.z;
|
||||
return this.cache.get(k + l * this.size);
|
||||
int xOffset = x - this.firstPos.getX();
|
||||
int zOffset = z - this.firstPos.getZ();
|
||||
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;
|
||||
|
||||
// Check vanilla cache
|
||||
@@ -179,7 +184,7 @@ public class RegionFileStorageExternalCache implements AutoCloseable
|
||||
regionFile = new RegionFile(new RegionStorageInfo("level", null, "level type"), regionFilePath, storageFolderPath, false);
|
||||
#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)
|
||||
{
|
||||
this.regionFileCache.poll().file.close();
|
||||
|
||||
+5
-2
@@ -28,6 +28,8 @@ import java.util.stream.Stream;
|
||||
|
||||
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 net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.SectionPos;
|
||||
@@ -222,9 +224,10 @@ public class WorldGenStructFeatManager extends #if MC_VER < MC_1_19_2 StructureF
|
||||
}
|
||||
#else
|
||||
@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();
|
||||
|
||||
// Copied from StructureFeatureManager::startsForFeature(...)
|
||||
|
||||
+5
-1
@@ -113,10 +113,14 @@ public final class GlobalWorldGenParams
|
||||
this.worldOptions = worldData.worldGenOptions();
|
||||
this.biomes = registry.registryOrThrow(Registries.BIOME);
|
||||
this.worldSeed = worldOptions.seed();
|
||||
#else
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
this.worldOptions = worldData.worldGenOptions();
|
||||
this.biomes = this.registry.lookupOrThrow(Registries.BIOME);
|
||||
this.worldSeed = this.worldOptions.seed();
|
||||
#else
|
||||
this.worldOptions = null;//worldData.worldGenOptions();
|
||||
this.biomes = this.registry.lookupOrThrow(Registries.BIOME);
|
||||
this.worldSeed = this.worldOptions.seed();
|
||||
#endif
|
||||
|
||||
#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
|
||||
# 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
|
||||
#minecraftMemoryJavaArg="-Xmx4G"
|
||||
|
||||
Reference in New Issue
Block a user