Remove PRE and POST preprocessor MC versions
This commit is contained in:
+2
-2
@@ -22,7 +22,7 @@ package com.seibel.distanthorizons.common.forge;
|
||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.core.Direction;
|
||||
#if POST_MC_1_19_2
|
||||
#if MC_1_19 || MC_1_20
|
||||
import net.minecraft.util.RandomSource;
|
||||
#endif
|
||||
import net.minecraft.world.level.ColorResolver;
|
||||
@@ -41,7 +41,7 @@ import java.util.Random;
|
||||
*/
|
||||
public interface LodForgeMethodCaller
|
||||
{
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random); // FIXME: For 1.19
|
||||
#else
|
||||
List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random); // FIXME: For 1.19
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.common.rendering;
|
||||
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
|
||||
import com.mojang.math.Matrix4f;
|
||||
#else
|
||||
@@ -43,7 +43,7 @@ public class SeamlessOverdraw
|
||||
{
|
||||
float[] matrixFloatArray;
|
||||
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
FloatBuffer matrixFloatBuffer = FloatBuffer.allocate(16);
|
||||
minecraftProjectionMatrix.store(matrixFloatBuffer);
|
||||
matrixFloatArray = matrixFloatBuffer.array();
|
||||
|
||||
+3
-3
@@ -23,7 +23,7 @@ import java.nio.FloatBuffer;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
import com.mojang.math.Matrix4f;
|
||||
#else
|
||||
import org.joml.Matrix4f;
|
||||
@@ -54,7 +54,7 @@ public class McObjectConverter
|
||||
/** Taken from Minecraft's com.mojang.math.Matrix4f class from 1.18.2 */
|
||||
private static void storeMatrix(Matrix4f matrix, FloatBuffer buffer)
|
||||
{
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
matrix.store(buffer);
|
||||
#else
|
||||
// Mojang starts to use joml's Matrix4f libary in 1.19.3 so we copy their store method and use it here if its newer than 1.19.3
|
||||
@@ -83,7 +83,7 @@ public class McObjectConverter
|
||||
FloatBuffer buffer = FloatBuffer.allocate(16);
|
||||
storeMatrix(mcMatrix, buffer);
|
||||
Mat4f matrix = new Mat4f(buffer);
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
matrix.transpose(); // In 1.19.3 and later, we no longer need to transpose it
|
||||
#endif
|
||||
return matrix;
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ public class VersionConstants implements IVersionConstants
|
||||
@Override
|
||||
public String getMinecraftVersion()
|
||||
{
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
return Minecraft.getInstance().getGame().getVersion().getId();
|
||||
#else
|
||||
return SharedConstants.getCurrentVersion().getId();
|
||||
|
||||
@@ -106,8 +106,7 @@ public class WrapperFactory implements IWrapperFactory
|
||||
}
|
||||
}
|
||||
|
||||
// MC 1.16, 1.18, 1.19, 1.20
|
||||
#if POST_MC_1_17_1 || MC_1_16_5
|
||||
#if MC_1_16 || MC_1_18 || MC_1_19 || MC_1_20
|
||||
else if (objectArray.length == 2)
|
||||
{
|
||||
// correct number of parameters from the API
|
||||
@@ -174,8 +173,7 @@ public class WrapperFactory implements IWrapperFactory
|
||||
"Chunk wrapper creation failed. \n" +
|
||||
"Expected parameters: \n");
|
||||
|
||||
// MC 1.16, 1.18, 1.19, 1.20
|
||||
#if POST_MC_1_17_1 || MC_1_16_5
|
||||
#if MC_1_16 || MC_1_18 || MC_1_19 || MC_1_20
|
||||
message.append("[" + ChunkAccess.class.getName() + "], \n");
|
||||
message.append("[" + ServerLevel.class.getName() + "] or [" + ClientLevel.class.getName() + "]. \n");
|
||||
#else
|
||||
|
||||
+14
-14
@@ -38,13 +38,13 @@ import net.minecraft.core.Holder;
|
||||
import net.minecraft.resources.RegistryOps;
|
||||
#endif
|
||||
|
||||
#if POST_MC_1_19_2
|
||||
#if MC_1_19_4 || MC_1_20
|
||||
#endif
|
||||
|
||||
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
import net.minecraft.core.Registry;
|
||||
#elif MC_1_18_2 || MC_1_19_2
|
||||
#elif MC_1_18 || MC_1_19_2
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
@@ -56,7 +56,7 @@ import net.minecraft.core.registries.Registries;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
#if !PRE_MC_1_18_2
|
||||
#if !MC_1_16 || MC_1_17
|
||||
import net.minecraft.world.level.biome.Biomes;
|
||||
#endif
|
||||
|
||||
@@ -66,7 +66,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
public static final ConcurrentMap<Biome, BiomeWrapper> WRAPPER_BY_BIOME = new ConcurrentHashMap<>();
|
||||
#else
|
||||
public static final ConcurrentMap<Holder<Biome>, BiomeWrapper> WRAPPER_BY_BIOME = new ConcurrentHashMap<>();
|
||||
@@ -89,7 +89,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
|
||||
// properties //
|
||||
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
public final Biome biome;
|
||||
#else
|
||||
public final Holder<Biome> biome;
|
||||
@@ -104,7 +104,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
// constructors //
|
||||
//==============//
|
||||
|
||||
static public IBiomeWrapper getBiomeWrapper(#if PRE_MC_1_18_2 Biome #else Holder<Biome> #endif biome, ILevelWrapper levelWrapper)
|
||||
static public IBiomeWrapper getBiomeWrapper(#if MC_1_16 || MC_1_17 Biome #else Holder<Biome> #endif biome, ILevelWrapper levelWrapper)
|
||||
{
|
||||
if (biome == null)
|
||||
{
|
||||
@@ -124,7 +124,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
}
|
||||
}
|
||||
|
||||
private BiomeWrapper(#if PRE_MC_1_18_2 Biome #else Holder<Biome> #endif biome, ILevelWrapper levelWrapper)
|
||||
private BiomeWrapper(#if MC_1_16 || MC_1_17 Biome #else Holder<Biome> #endif biome, ILevelWrapper levelWrapper)
|
||||
{
|
||||
this.biome = biome;
|
||||
this.serialString = this.serialize(levelWrapper);
|
||||
@@ -145,7 +145,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
return biome.toString();
|
||||
#else
|
||||
return this.biome.unwrapKey().orElse(Biomes.THE_VOID).registry().toString();
|
||||
@@ -214,9 +214,9 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
net.minecraft.core.RegistryAccess registryAccess = Minecraft.getInstance().level.registryAccess();
|
||||
|
||||
ResourceLocation resourceLocation;
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome);
|
||||
#elif MC_1_18_2 || MC_1_19_2
|
||||
#elif MC_1_18 || MC_1_19_2
|
||||
resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome.value());
|
||||
#else
|
||||
resourceLocation = registryAccess.registryOrThrow(Registries.BIOME).getKey(this.biome.value());
|
||||
@@ -225,7 +225,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
if (resourceLocation == null)
|
||||
{
|
||||
String biomeName;
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
biomeName = this.biome.toString();
|
||||
#else
|
||||
biomeName = this.biome.value().toString();
|
||||
@@ -277,10 +277,10 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||
|
||||
boolean success;
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
Biome biome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation);
|
||||
success = (biome != null);
|
||||
#elif MC_1_18_2 || MC_1_19_2
|
||||
#elif MC_1_18 || MC_1_19_2
|
||||
Biome unwrappedBiome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation);
|
||||
success = (unwrappedBiome != null);
|
||||
Holder<Biome> biome = new Holder.Direct<>(unwrappedBiome);
|
||||
|
||||
+10
-10
@@ -32,11 +32,11 @@ import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.EmptyBlockGetter;
|
||||
#elif MC_1_18_2 || MC_1_19_2
|
||||
#elif MC_1_18 || MC_1_19_2
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -252,7 +252,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
@Override
|
||||
public boolean isSolid()
|
||||
{
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
return this.blockState.getMaterial().isSolid();
|
||||
#else
|
||||
return !this.blockState.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO).isEmpty();
|
||||
@@ -267,7 +267,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
return false;
|
||||
}
|
||||
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
return this.blockState.getMaterial().isLiquid() || !this.blockState.getFluidState().isEmpty();
|
||||
#else
|
||||
return !this.blockState.getFluidState().isEmpty();
|
||||
@@ -293,15 +293,15 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
|
||||
|
||||
// older versions of MC have a static registry
|
||||
#if !(MC_1_16_5 || MC_1_17_1)
|
||||
#if !(MC_1_16_5 || MC_1_17)
|
||||
Level level = (Level)levelWrapper.getWrappedMcObject();
|
||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||
#endif
|
||||
|
||||
ResourceLocation resourceLocation;
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
resourceLocation = Registry.BLOCK.getKey(this.blockState.getBlock());
|
||||
#elif MC_1_18_2 || MC_1_19_2
|
||||
#elif MC_1_18 || MC_1_19_2
|
||||
resourceLocation = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).getKey(this.blockState.getBlock());
|
||||
#else
|
||||
resourceLocation = registryAccess.registryOrThrow(Registries.BLOCK).getKey(this.blockState.getBlock());
|
||||
@@ -356,16 +356,16 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
try
|
||||
{
|
||||
|
||||
#if !(MC_1_16_5 || MC_1_17_1)
|
||||
#if !(MC_1_16_5 || MC_1_17)
|
||||
// use the given level if possible, otherwise try using the currently loaded one
|
||||
Level level = (levelWrapper != null ? (Level)levelWrapper.getWrappedMcObject() : null);
|
||||
level = (level == null ? Minecraft.getInstance().level : level);
|
||||
#endif
|
||||
|
||||
Block block;
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
block = Registry.BLOCK.get(resourceLocation);
|
||||
#elif MC_1_18_2 || MC_1_19_2
|
||||
#elif MC_1_18 || MC_1_19_2
|
||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||
block = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).get(resourceLocation);
|
||||
#else
|
||||
|
||||
+2
-2
@@ -40,11 +40,11 @@ public class TextureAtlasSpriteWrapper
|
||||
*/
|
||||
public static int getPixelRGBA(TextureAtlasSprite sprite, int frameIndex, int x, int y)
|
||||
{
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
return sprite.mainImage[0].getPixelRGBA(
|
||||
x + sprite.framesX[frameIndex] * sprite.getWidth(),
|
||||
y + sprite.framesY[frameIndex] * sprite.getHeight());
|
||||
#elif PRE_MC_1_19_4
|
||||
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
if (sprite.animatedTexture != null)
|
||||
{
|
||||
x += sprite.animatedTexture.getFrameX(frameIndex) * sprite.width;
|
||||
|
||||
+2
-2
@@ -50,7 +50,7 @@ public class TintGetterOverrideFast implements BlockAndTintGetter
|
||||
|
||||
private Biome _getBiome(BlockPos pos)
|
||||
{
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
return parent.getBiome(pos).value();
|
||||
#else
|
||||
return parent.getBiome(pos);
|
||||
@@ -167,7 +167,7 @@ public class TintGetterOverrideFast implements BlockAndTintGetter
|
||||
return parent.getMaxBuildHeight();
|
||||
}
|
||||
|
||||
#if POST_MC_1_17_1
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
@Override
|
||||
public <T extends BlockEntity> Optional<T> getBlockEntity(BlockPos blockPos, BlockEntityType<T> blockEntityType)
|
||||
{
|
||||
|
||||
+2
-2
@@ -53,7 +53,7 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter
|
||||
|
||||
private Biome _getBiome(BlockPos pos)
|
||||
{
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
return parent.getBiome(pos).value();
|
||||
#else
|
||||
return parent.getBiome(pos);
|
||||
@@ -193,7 +193,7 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter
|
||||
return parent.getMaxBuildHeight();
|
||||
}
|
||||
|
||||
#if POST_MC_1_17_1
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
@Override
|
||||
public <T extends BlockEntity> Optional<T> getBlockEntity(BlockPos blockPos, BlockEntityType<T> blockEntityType)
|
||||
{
|
||||
|
||||
+4
-4
@@ -29,7 +29,7 @@ import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
import net.minecraft.core.Holder;
|
||||
#endif
|
||||
|
||||
@@ -46,9 +46,9 @@ public class TintWithoutLevelOverrider implements BlockAndTintGetter
|
||||
{
|
||||
return colorResolver.getColor(_unwrap(biome.biome), blockPos.getX(), blockPos.getZ());
|
||||
}
|
||||
private Biome _unwrap(#if POST_MC_1_18_2 Holder<Biome> #else Biome #endif biome)
|
||||
private Biome _unwrap(#if MC_1_18 || MC_1_19 || MC_1_20 Holder<Biome> #else Biome #endif biome)
|
||||
{
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
return biome.value();
|
||||
#else
|
||||
return biome;
|
||||
@@ -84,7 +84,7 @@ public class TintWithoutLevelOverrider implements BlockAndTintGetter
|
||||
}
|
||||
|
||||
|
||||
#if MC_1_17_1 || POST_MC_1_18_2
|
||||
#if MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20
|
||||
@Override
|
||||
public int getHeight()
|
||||
{
|
||||
|
||||
+4
-4
@@ -30,7 +30,7 @@ import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
import net.minecraft.core.Holder;
|
||||
#endif
|
||||
|
||||
@@ -49,9 +49,9 @@ public class TintWithoutLevelSmoothOverrider implements BlockAndTintGetter
|
||||
{
|
||||
return colorResolver.getColor(_unwrap(biome.biome), blockPos.getX(), blockPos.getZ());
|
||||
}
|
||||
private Biome _unwrap(#if POST_MC_1_18_2 Holder<Biome> #else Biome #endif biome)
|
||||
private Biome _unwrap(#if MC_1_18 || MC_1_19 || MC_1_20 Holder<Biome> #else Biome #endif biome)
|
||||
{
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
return biome.value();
|
||||
#else
|
||||
return biome;
|
||||
@@ -116,7 +116,7 @@ public class TintWithoutLevelSmoothOverrider implements BlockAndTintGetter
|
||||
}
|
||||
|
||||
|
||||
#if MC_1_17_1 || POST_MC_1_18_2
|
||||
#if MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20
|
||||
@Override
|
||||
public int getHeight()
|
||||
{
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
public class ClientBlockDetailMap
|
||||
{
|
||||
private final ConcurrentHashMap<BlockState, ClientBlockStateCache> blockCache = new ConcurrentHashMap<>();
|
||||
//private final ConcurrentHashMap<#if PRE_MC_1_18_2 Biome #else Holder<Biome> #endif, Biome> biomeMap = new ConcurrentHashMap<>();
|
||||
//private final ConcurrentHashMap<#if MC_1_16 || MC_1_17 Biome #else Holder<Biome> #endif, Biome> biomeMap = new ConcurrentHashMap<>();
|
||||
private final ClientLevelWrapper level;
|
||||
public ClientBlockDetailMap(ClientLevelWrapper level) { this.level = level; }
|
||||
|
||||
|
||||
+5
-5
@@ -38,7 +38,7 @@ import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.FlowerBlock;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.RotatedPillarBlock;
|
||||
#if POST_MC_1_19_2
|
||||
#if MC_1_19 || MC_1_20
|
||||
import net.minecraft.util.RandomSource;
|
||||
#else
|
||||
import java.util.Random;
|
||||
@@ -60,7 +60,7 @@ public class ClientBlockStateCache
|
||||
private static final HashSet<BlockState> BLOCK_STATES_THAT_NEED_LEVEL = new HashSet<>();
|
||||
private static final HashSet<BlockState> BROKEN_BLOCK_STATES = new HashSet<>();
|
||||
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
public static final Random random = new Random(0);
|
||||
#else
|
||||
public static final RandomSource random = RandomSource.create();
|
||||
@@ -102,7 +102,7 @@ public class ClientBlockStateCache
|
||||
|
||||
private static int getWidth(TextureAtlasSprite texture)
|
||||
{
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
return texture.getWidth();
|
||||
#else
|
||||
return texture.contents().width();
|
||||
@@ -111,7 +111,7 @@ public class ClientBlockStateCache
|
||||
|
||||
private static int getHeight(TextureAtlasSprite texture)
|
||||
{
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
return texture.getHeight();
|
||||
#else
|
||||
return texture.contents().height();
|
||||
@@ -211,7 +211,7 @@ public class ClientBlockStateCache
|
||||
needShade = quads.get(0).isShade();
|
||||
tintIndex = quads.get(0).getTintIndex();
|
||||
baseColor = calculateColorFromTexture(
|
||||
#if PRE_MC_1_17_1 quads.get(0).sprite,
|
||||
#if MC_1_16 quads.get(0).sprite,
|
||||
#else quads.get(0).getSprite(), #endif
|
||||
ColorMode.getColorMode(blockState.getBlock()));
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
public class ServerBlockDetailMap
|
||||
{
|
||||
private final ConcurrentHashMap<BlockState, ServerBlockStateCache> blockCache = new ConcurrentHashMap<>();
|
||||
//private final ConcurrentHashMap<#if PRE_MC_1_18_2 Biome #else Holder<Biome> #endif, Biome> biomeMap = new ConcurrentHashMap<>();
|
||||
//private final ConcurrentHashMap<#if MC_1_16 || MC_1_17 Biome #else Holder<Biome> #endif, Biome> biomeMap = new ConcurrentHashMap<>();
|
||||
private final ServerLevelWrapper level;
|
||||
public ServerBlockDetailMap(ServerLevelWrapper level) { this.level = level; }
|
||||
|
||||
|
||||
+17
-17
@@ -47,7 +47,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
#if POST_MC_1_17_1
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
import net.minecraft.core.QuartPos;
|
||||
#endif
|
||||
|
||||
@@ -55,19 +55,19 @@ import net.minecraft.core.QuartPos;
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
#endif
|
||||
|
||||
#if MC_1_17_1
|
||||
#if MC_1_17
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
#endif
|
||||
|
||||
#if MC_1_18_2
|
||||
#if MC_1_18
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
#endif
|
||||
|
||||
#if MC_1_19_2 || MC_1_19_4
|
||||
#if MC_1_19
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
#endif
|
||||
|
||||
#if POST_MC_1_20_1
|
||||
#if MC_1_20_2 || MC_1_20_4
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
import net.minecraft.core.SectionPos;
|
||||
@@ -145,7 +145,7 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
@Override
|
||||
public int getHeight()
|
||||
{
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
return 255;
|
||||
#else
|
||||
return this.chunk.getHeight();
|
||||
@@ -155,7 +155,7 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
@Override
|
||||
public int getMinBuildHeight()
|
||||
{
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
return 0;
|
||||
#else
|
||||
return this.chunk.getMinBuildHeight();
|
||||
@@ -181,7 +181,7 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
// convert from an index to a block coordinate
|
||||
return this.chunk.getSections()[index].bottomBlockY() * 16;
|
||||
}
|
||||
#elif MC_1_17_1
|
||||
#elif MC_1_17
|
||||
if (!sections[index].isEmpty())
|
||||
{
|
||||
// convert from an index to a block coordinate
|
||||
@@ -210,15 +210,15 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
@Override
|
||||
public IBiomeWrapper getBiome(int relX, int relY, int relZ)
|
||||
{
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
return BiomeWrapper.getBiomeWrapper(this.chunk.getBiomes().getNoiseBiome(
|
||||
relX >> 2, relY >> 2, relZ >> 2),
|
||||
this.wrappedLevel);
|
||||
#elif PRE_MC_1_18_2
|
||||
#elif MC_1_16 || MC_1_17
|
||||
return BiomeWrapper.getBiomeWrapper(this.chunk.getBiomes().getNoiseBiome(
|
||||
QuartPos.fromBlock(relX), QuartPos.fromBlock(relY), QuartPos.fromBlock(relZ)),
|
||||
this.wrappedLevel);
|
||||
#elif PRE_MC_1_18_2
|
||||
#elif MC_1_16 || MC_1_17
|
||||
return BiomeWrapper.getBiomeWrapper(this.chunk.getNoiseBiome(
|
||||
QuartPos.fromBlock(relX), QuartPos.fromBlock(relY), QuartPos.fromBlock(relZ)),
|
||||
this.wrappedLevel);
|
||||
@@ -264,7 +264,7 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
}
|
||||
|
||||
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
return false; // MC's lighting engine doesn't work consistently enough to trust for 1.16 or 1.17
|
||||
#else
|
||||
if (this.chunk instanceof LevelChunk)
|
||||
@@ -387,7 +387,7 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
this.blockLightPosList = new ArrayList<>();
|
||||
|
||||
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
this.chunk.getLights().forEach((blockPos) ->
|
||||
{
|
||||
this.blockLightPosList.add(new DhBlockPos(blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||
@@ -454,7 +454,7 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
|
||||
public static void syncedUpdateClientLightStatus()
|
||||
{
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
// TODO: Check what to do in 1.18.1 and older
|
||||
|
||||
// since we don't currently handle this list,
|
||||
@@ -481,16 +481,16 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
LevelChunk levelChunk = (LevelChunk) this.chunk;
|
||||
ClientChunkCache clientChunkCache = ((ClientLevel) levelChunk.getLevel()).getChunkSource();
|
||||
this.isMcClientLightingCorrect = clientChunkCache.getChunkForLighting(this.chunk.getPos().x, this.chunk.getPos().z) != null &&
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
levelChunk.isLightCorrect();
|
||||
#elif PRE_MC_1_20_1
|
||||
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
levelChunk.isClientLightReady();
|
||||
#else
|
||||
checkLightSectionsOnChunk(levelChunk, levelChunk.getLevel().getLightEngine());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if POST_MC_1_20_1
|
||||
#if MC_1_20_2 || MC_1_20_4
|
||||
private static boolean checkLightSectionsOnChunk(LevelChunk chunk, LevelLightEngine engine)
|
||||
{
|
||||
LevelChunkSection[] sections = chunk.getSections();
|
||||
|
||||
+9
-9
@@ -35,7 +35,7 @@ import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
#else
|
||||
@@ -49,7 +49,7 @@ import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.client.resources.language.I18n; // translation
|
||||
#if POST_MC_1_17_1
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
#endif
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@@ -379,13 +379,13 @@ public class ClassicConfigGUI
|
||||
}
|
||||
|
||||
@Override
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||
#else
|
||||
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
#if PRE_MC_1_20_2 // 1.20.2 now enables this by default in the `this.list.render` function
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 // 1.20.2 now enables this by default in the `this.list.render` function
|
||||
this.renderBackground(matrices); // Renders background
|
||||
#else
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
@@ -441,7 +441,7 @@ public class ClassicConfigGUI
|
||||
}
|
||||
}
|
||||
}
|
||||
#if PRE_MC_1_20_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
#endif
|
||||
}
|
||||
@@ -539,7 +539,7 @@ public class ClassicConfigGUI
|
||||
|
||||
public ConfigListWidget(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing)
|
||||
{
|
||||
#if PRE_MC_1_20_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2
|
||||
super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing);
|
||||
#else
|
||||
super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing);
|
||||
@@ -605,7 +605,7 @@ public class ClassicConfigGUI
|
||||
}
|
||||
|
||||
@Override
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta)
|
||||
#else
|
||||
public void render(GuiGraphics matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta)
|
||||
@@ -627,7 +627,7 @@ public class ClassicConfigGUI
|
||||
indexButton.render(matrices, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
if (text != null && (!text.getString().contains("spacer") || button != null))
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
GuiComponent.drawString(matrices, textRenderer, text, 12, y + 5, 0xFFFFFF);
|
||||
#else
|
||||
matrices.drawString(textRenderer, text, 12, y + 5, 0xFFFFFF);
|
||||
@@ -642,7 +642,7 @@ public class ClassicConfigGUI
|
||||
|
||||
// Only for 1.17 and over
|
||||
// Remove in 1.16 and below
|
||||
#if POST_MC_1_17_1
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
@Override
|
||||
public List<? extends NarratableEntry> narratables()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.seibel.distanthorizons.common.wrappers.gui;
|
||||
|
||||
import net.minecraft.client.gui.Font;
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
#else
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
@@ -24,14 +24,14 @@ public class DhScreen extends Screen
|
||||
// addButton in 1.16 and below
|
||||
protected Button addBtn(Button button)
|
||||
{
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
return this.addButton(button);
|
||||
#else
|
||||
return this.addRenderableWidget(button);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
protected void DhDrawCenteredString(PoseStack guiStack, Font font, Component text, int x, int y, int color)
|
||||
{
|
||||
drawCenteredString(guiStack, font, text, x, y, color);
|
||||
|
||||
@@ -5,7 +5,7 @@ import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
#endif
|
||||
@@ -17,7 +17,7 @@ public class GuiHelper
|
||||
*/
|
||||
public static Button MakeBtn(Component base, int a, int b, int c, int d, Button.OnPress action)
|
||||
{
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
return new Button(a, b, c, d, base, action);
|
||||
#else
|
||||
return Button.builder(base, action).bounds(a, b, c, d).build();
|
||||
@@ -26,7 +26,7 @@ public class GuiHelper
|
||||
|
||||
public static MutableComponent TextOrLiteral(String text)
|
||||
{
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
return new TextComponent(text);
|
||||
#else
|
||||
return Component.literal(text);
|
||||
@@ -35,7 +35,7 @@ public class GuiHelper
|
||||
|
||||
public static MutableComponent TextOrTranslatable(String text)
|
||||
{
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
return new TextComponent(text);
|
||||
#else
|
||||
return Component.translatable(text);
|
||||
@@ -44,7 +44,7 @@ public class GuiHelper
|
||||
|
||||
public static MutableComponent Translatable(String text, Object... args)
|
||||
{
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
return new TranslatableComponent(text, args);
|
||||
#else
|
||||
return Component.translatable(text, args);
|
||||
@@ -53,7 +53,7 @@ public class GuiHelper
|
||||
|
||||
public static void SetX(AbstractWidget w, int x)
|
||||
{
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
w.x = x;
|
||||
#else
|
||||
w.setX(x);
|
||||
@@ -62,7 +62,7 @@ public class GuiHelper
|
||||
|
||||
public static void SetY(AbstractWidget w, int y)
|
||||
{
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
w.y = y;
|
||||
#else
|
||||
w.setY(y);
|
||||
|
||||
+5
-5
@@ -4,7 +4,7 @@ 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 POST_MC_1_20_1
|
||||
#if MC_1_20_2 || MC_1_20_4
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
#endif
|
||||
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
||||
@@ -28,7 +28,7 @@ public class MinecraftScreen
|
||||
private AbstractScreen screen;
|
||||
|
||||
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
public static net.minecraft.network.chat.TranslatableComponent translate(String str, Object... args)
|
||||
{
|
||||
return new net.minecraft.network.chat.TranslatableComponent(str, args);
|
||||
@@ -66,13 +66,13 @@ public class MinecraftScreen
|
||||
}
|
||||
|
||||
@Override
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||
#else
|
||||
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
#if PRE_MC_1_20_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
|
||||
this.renderBackground(matrices); // Render background
|
||||
#else
|
||||
this.renderBackground(matrices, mouseX, mouseY, delta); // Render background
|
||||
@@ -133,7 +133,7 @@ public class MinecraftScreen
|
||||
{
|
||||
public ConfigListWidget(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing)
|
||||
{
|
||||
#if PRE_MC_1_20_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2
|
||||
super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing);
|
||||
#else
|
||||
super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing);
|
||||
|
||||
+12
-11
@@ -34,17 +34,18 @@ import net.minecraft.client.gui.components.ImageButton;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
#if POST_MC_1_17_1
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
#endif
|
||||
#if PRE_MC_1_20_1
|
||||
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
#else
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
#endif
|
||||
|
||||
#if PRE_MC_1_20_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
|
||||
public class TexturedButtonWidget extends ImageButton
|
||||
#else
|
||||
public class TexturedButtonWidget extends Button
|
||||
@@ -52,7 +53,7 @@ public class TexturedButtonWidget extends Button
|
||||
{
|
||||
public final boolean renderBackground;
|
||||
|
||||
#if POST_MC_1_20_2
|
||||
#if MC_1_20_2 || MC_1_20_4
|
||||
private final int u;
|
||||
private final int v;
|
||||
private final int hoveredVOffset;
|
||||
@@ -69,7 +70,7 @@ public class TexturedButtonWidget extends Button
|
||||
}
|
||||
public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, ResourceLocation texture, int textureWidth, int textureHeight, OnPress pressAction, Component text, boolean renderBackground)
|
||||
{
|
||||
#if PRE_MC_1_20_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
|
||||
super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, text);
|
||||
#else
|
||||
// We don't pass on the text option as otherwise it will render (we normally pass it for narration)
|
||||
@@ -89,13 +90,13 @@ public class TexturedButtonWidget extends Button
|
||||
this.renderBackground = renderBackground;
|
||||
}
|
||||
|
||||
#if PRE_MC_1_20_2
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
@Override
|
||||
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) {
|
||||
if (this.renderBackground) // Renders the background of the button
|
||||
{
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
Minecraft.getInstance().getTextureManager().bind(WIDGETS_LOCATION);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha);
|
||||
#else
|
||||
@@ -108,7 +109,7 @@ public class TexturedButtonWidget extends Button
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.enableDepthTest();
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
this.blit(matrices, this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height);
|
||||
this.blit(matrices, this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
|
||||
#else
|
||||
@@ -120,7 +121,7 @@ public class TexturedButtonWidget extends Button
|
||||
super.renderButton(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
#else
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
@Override
|
||||
public void renderWidget(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||
{
|
||||
@@ -138,7 +139,7 @@ public class TexturedButtonWidget extends Button
|
||||
if (!this.active) i = 0;
|
||||
else if (this.isHovered) i = 2;
|
||||
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.enableDepthTest();
|
||||
|
||||
+8
-8
@@ -15,11 +15,11 @@ import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
#if POST_MC_1_17_1
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
#endif
|
||||
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
#else
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
@@ -144,13 +144,13 @@ public class ChangelogScreen extends DhScreen
|
||||
}
|
||||
|
||||
@Override
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||
#else
|
||||
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
#if PRE_MC_1_20_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
|
||||
this.renderBackground(matrices); // Render background
|
||||
#else
|
||||
this.renderBackground(matrices, mouseX, mouseY, delta); // Render background
|
||||
@@ -161,7 +161,7 @@ public class ChangelogScreen extends DhScreen
|
||||
// Set the scroll position to the mouse height relative to the screen
|
||||
// This is a bit of a hack as we cannot scroll on this area
|
||||
double scrollAmount = ((double) mouseY) / ((double) this.height) * 1.1 * this.changelogArea.getMaxScroll();
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
this.changelogArea.setScrollAmount(scrollAmount);
|
||||
#else
|
||||
this.changelogArea.scrollAmount = scrollAmount;
|
||||
@@ -187,7 +187,7 @@ public class ChangelogScreen extends DhScreen
|
||||
|
||||
public TextArea(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing)
|
||||
{
|
||||
#if PRE_MC_1_20_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2
|
||||
super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing);
|
||||
#else
|
||||
super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing);
|
||||
@@ -225,7 +225,7 @@ public class ChangelogScreen extends DhScreen
|
||||
return new ButtonEntry(text);
|
||||
}
|
||||
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
@Override
|
||||
public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta)
|
||||
{
|
||||
@@ -244,7 +244,7 @@ public class ChangelogScreen extends DhScreen
|
||||
{
|
||||
return children;
|
||||
}
|
||||
#if POST_MC_1_17_1
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
@Override
|
||||
public List<? extends NarratableEntry> narratables()
|
||||
{
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@ import com.seibel.distanthorizons.core.jar.JarUtils;
|
||||
import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter;
|
||||
import com.seibel.distanthorizons.core.jar.updater.SelfUpdater;
|
||||
import net.minecraft.client.Minecraft;
|
||||
#if POST_MC_1_20_1
|
||||
#if MC_1_20_2 || MC_1_20_4
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
#else
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
@@ -146,13 +146,13 @@ public class UpdateModScreen extends DhScreen
|
||||
}
|
||||
|
||||
@Override
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||
#else
|
||||
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
#if PRE_MC_1_20_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
|
||||
this.renderBackground(matrices); // Render background
|
||||
#else
|
||||
this.renderBackground(matrices, mouseX, mouseY, delta); // Render background
|
||||
|
||||
+4
-4
@@ -47,7 +47,7 @@ import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.client.resources.model.ModelManager;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
#endif
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
@@ -197,7 +197,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
@Override
|
||||
public DhChunkPos getPlayerChunkPos()
|
||||
{
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
ChunkPos playerPos = new ChunkPos(getPlayer().blockPosition());
|
||||
#else
|
||||
ChunkPos playerPos = getPlayer().chunkPosition();
|
||||
@@ -262,7 +262,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
{
|
||||
LocalPlayer p = getPlayer();
|
||||
if (p == null) return;
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
p.sendMessage(new TextComponent(string), getPlayer().getUUID());
|
||||
#else
|
||||
p.sendSystemMessage(net.minecraft.network.chat.Component.translatable(string));
|
||||
@@ -282,7 +282,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
{
|
||||
LOGGER.error(ModInfo.READABLE_NAME + " had the following error: [" + errorMessage + "]. Crashing Minecraft...", exception);
|
||||
CrashReport report = new CrashReport(errorMessage, exception);
|
||||
#if PRE_MC_1_20_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2
|
||||
Minecraft.crash(report);
|
||||
#else
|
||||
Minecraft.getInstance().delayCrash(report);
|
||||
|
||||
+13
-13
@@ -39,12 +39,12 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.render.DhApiRenderProxy;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper;
|
||||
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
import com.mojang.math.Vector3f;
|
||||
#else
|
||||
import org.joml.Vector3f;
|
||||
#endif
|
||||
#if POST_MC_1_20_2
|
||||
#if MC_1_20_2 || MC_1_20_4
|
||||
import net.minecraft.client.renderer.chunk.SectionRenderDispatcher;
|
||||
#endif
|
||||
|
||||
@@ -67,7 +67,7 @@ import net.minecraft.client.renderer.FogRenderer;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
@@ -133,7 +133,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
public boolean playerHasBlindingEffect()
|
||||
{
|
||||
return MC.player.getActiveEffectsMap().get(MobEffects.BLINDNESS) != null
|
||||
#if POST_AND_MC_1_19_2
|
||||
#if MC_1_19 || MC_1_20
|
||||
|| MC.player.getActiveEffectsMap().get(MobEffects.DARKNESS) != null // Deep dark effect
|
||||
#endif
|
||||
;
|
||||
@@ -151,7 +151,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public Mat4f getDefaultProjectionMatrix(float partialTicks)
|
||||
{
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
return McObjectConverter.Convert(Minecraft.getInstance().gameRenderer.getProjectionMatrix(Minecraft.getInstance().gameRenderer.getMainCamera(), partialTicks, true));
|
||||
#else
|
||||
return McObjectConverter.Convert(MC.gameRenderer.getProjectionMatrix(MC.gameRenderer.getFov(MC.gameRenderer.getMainCamera(), partialTicks, true)));
|
||||
@@ -161,7 +161,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public double getGamma()
|
||||
{
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
return MC.options.gamma;
|
||||
#else
|
||||
return MC.options.gamma().get();
|
||||
@@ -171,7 +171,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public Color getFogColor(float partialTicks)
|
||||
{
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
float[] colorValues = new float[4];
|
||||
GL15.glGetFloatv(GL15.GL_FOG_COLOR, colorValues);
|
||||
#else
|
||||
@@ -192,7 +192,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
{
|
||||
if (MC.level.dimensionType().hasSkyLight())
|
||||
{
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getBlockPosition(), MC.getFrameTime());
|
||||
#else
|
||||
Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), MC.getFrameTime());
|
||||
@@ -213,7 +213,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public int getRenderDistance()
|
||||
{
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
//FIXME: How to resolve this?
|
||||
return MC.options.renderDistance;
|
||||
#else
|
||||
@@ -321,15 +321,15 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
{
|
||||
try
|
||||
{
|
||||
#if PRE_MC_1_20_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
|
||||
LevelRenderer levelRenderer = MC.levelRenderer;
|
||||
Collection<LevelRenderer.RenderChunkInfo> chunks =
|
||||
#if PRE_MC_1_18_2 levelRenderer.renderChunks;
|
||||
#if MC_1_16 || MC_1_17 levelRenderer.renderChunks;
|
||||
#else levelRenderer.renderChunkStorage.get().renderChunks; #endif
|
||||
|
||||
return (chunks.stream().map((chunk) -> {
|
||||
AABB chunkBoundingBox =
|
||||
#if PRE_MC_1_18_2 chunk.chunk.bb;
|
||||
#if MC_1_16 || MC_1_17 chunk.chunk.bb;
|
||||
#else chunk.chunk.getBoundingBox(); #endif
|
||||
return new DhChunkPos(Math.floorDiv((int) chunkBoundingBox.minX, 16),
|
||||
Math.floorDiv((int) chunkBoundingBox.minZ, 16));
|
||||
@@ -371,7 +371,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public boolean isFogStateSpecial()
|
||||
{
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera();
|
||||
FluidState fluidState = camera.getFluidInCamera();
|
||||
Entity entity = camera.getEntity();
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public class ServerPlayerWrapper implements IServerPlayerWrapper
|
||||
|
||||
public IServerLevelWrapper getLevel()
|
||||
{
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
return ServerLevelWrapper.getWrapper(this.serverPlayer.getLevel());
|
||||
#else
|
||||
return ServerLevelWrapper.getWrapper(this.serverPlayer.serverLevel());
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
||||
@Override
|
||||
public int getMinHeight()
|
||||
{
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
return 0;
|
||||
#else
|
||||
return this.level.getMinBuildHeight();
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ public class ServerLevelWrapper implements IServerLevelWrapper
|
||||
@Override
|
||||
public int getMinHeight()
|
||||
{
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
return 0;
|
||||
#else
|
||||
return level.getMinBuildHeight();
|
||||
|
||||
+9
-9
@@ -56,7 +56,7 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.step.StepStruc
|
||||
import com.seibel.distanthorizons.common.wrappers.worldGeneration.step.StepStructureStart;
|
||||
import com.seibel.distanthorizons.common.wrappers.worldGeneration.step.StepSurface;
|
||||
|
||||
#if POST_MC_1_19_4
|
||||
#if MC_1_19_4 || MC_1_20
|
||||
import net.minecraft.core.registries.Registries;
|
||||
#else
|
||||
import net.minecraft.core.Registry;
|
||||
@@ -365,9 +365,9 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
private static ProtoChunk EmptyChunk(ServerLevel level, ChunkPos chunkPos)
|
||||
{
|
||||
return new ProtoChunk(chunkPos, UpgradeData.EMPTY
|
||||
#if POST_MC_1_17_1 , level #endif
|
||||
#if POST_MC_1_18_2 , level.registryAccess().registryOrThrow(
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20 , level #endif
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20 , level.registryAccess().registryOrThrow(
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
Registry.BIOME_REGISTRY
|
||||
#else
|
||||
Registries.BIOME
|
||||
@@ -463,8 +463,8 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
if (target == null)
|
||||
{
|
||||
target = new ProtoChunk(chunkPos, UpgradeData.EMPTY
|
||||
#if POST_MC_1_17_1 , params.level #endif
|
||||
#if POST_MC_1_18_2 , params.biomes, null #endif
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20 , params.level #endif
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20 , params.biomes, null #endif
|
||||
);
|
||||
}
|
||||
return target;
|
||||
@@ -507,7 +507,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
ChunkAccess target = wrappedChunk.getChunk();
|
||||
if (target instanceof LevelChunk)
|
||||
{
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
((LevelChunk) target).setLoaded(true);
|
||||
#else
|
||||
((LevelChunk) target).loaded = true;
|
||||
@@ -520,7 +520,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
}
|
||||
|
||||
boolean isFull = target.getStatus() == ChunkStatus.FULL || target instanceof LevelChunk;
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_19 || MC_1_20
|
||||
boolean isPartial = target.isOldNoiseGeneration();
|
||||
#endif
|
||||
if (isFull)
|
||||
@@ -528,7 +528,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
LOAD_LOGGER.info("Detected full existing chunk at {}", target.getPos());
|
||||
genEvent.resultConsumer.accept(wrappedChunk);
|
||||
}
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_19 || MC_1_20
|
||||
else if (isPartial)
|
||||
{
|
||||
LOAD_LOGGER.info("Detected old existing chunk at {}", target.getPos());
|
||||
|
||||
+9
-9
@@ -31,16 +31,16 @@ import net.minecraft.server.level.ThreadedLevelLightEngine;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.BiomeManager;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
import net.minecraft.world.level.chunk.storage.ChunkScanAccess;
|
||||
#endif
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
||||
#else
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager;
|
||||
import net.minecraft.world.level.levelgen.RandomState;
|
||||
#if POST_MC_1_19_4
|
||||
#if MC_1_19_4 || MC_1_20
|
||||
import net.minecraft.world.level.levelgen.WorldOptions;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
#endif
|
||||
@@ -50,13 +50,13 @@ import net.minecraft.world.level.storage.WorldData;
|
||||
public final class GlobalParameters
|
||||
{
|
||||
public final ChunkGenerator generator;
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
public final StructureManager structures;
|
||||
#else
|
||||
public final StructureTemplateManager structures;
|
||||
public final RandomState randomState;
|
||||
#endif
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
public final WorldGenSettings worldGenSettings;
|
||||
#else
|
||||
public final WorldOptions worldOptions;
|
||||
@@ -67,7 +67,7 @@ public final class GlobalParameters
|
||||
public final RegistryAccess registry;
|
||||
public final long worldSeed;
|
||||
public final DataFixer fixerUpper;
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
public final BiomeManager biomeManager;
|
||||
public final ChunkScanAccess chunkScanner; // FIXME: Figure out if this is actually needed
|
||||
#endif
|
||||
@@ -81,7 +81,7 @@ public final class GlobalParameters
|
||||
WorldData worldData = server.getWorldData();
|
||||
registry = server.registryAccess();
|
||||
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
worldGenSettings = worldData.worldGenSettings();
|
||||
biomes = registry.registryOrThrow(Registry.BIOME_REGISTRY);
|
||||
worldSeed = worldGenSettings.seed();
|
||||
@@ -90,14 +90,14 @@ public final class GlobalParameters
|
||||
biomes = registry.registryOrThrow(Registries.BIOME);
|
||||
worldSeed = worldOptions.seed();
|
||||
#endif
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
biomeManager = new BiomeManager(level, BiomeManager.obfuscateSeed(worldSeed));
|
||||
chunkScanner = level.getChunkSource().chunkScanner();
|
||||
#endif
|
||||
structures = server.getStructureManager();
|
||||
generator = level.getChunkSource().getGenerator();
|
||||
fixerUpper = server.getFixerUpper();
|
||||
#if POST_MC_1_19_2
|
||||
#if MC_1_19 || MC_1_20
|
||||
randomState = level.getChunkSource().randomState();
|
||||
#endif
|
||||
}
|
||||
|
||||
+7
-7
@@ -25,7 +25,7 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject.Wo
|
||||
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
import net.minecraft.world.level.levelgen.structure.StructureCheck;
|
||||
#endif
|
||||
|
||||
@@ -35,7 +35,7 @@ public final class ThreadedParameters
|
||||
|
||||
final ServerLevel level;
|
||||
public WorldGenStructFeatManager structFeat = null;
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
public StructureCheck structCheck;
|
||||
#endif
|
||||
boolean isValid = true;
|
||||
@@ -63,9 +63,9 @@ public final class ThreadedParameters
|
||||
previousGlobalParameters = param;
|
||||
|
||||
this.level = param.level;
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
this.structFeat = new WorldGenStructFeatManager(param.worldGenSettings, level);
|
||||
#elif PRE_MC_1_19_2
|
||||
#elif MC_1_16 || MC_1_17 || MC_1_18
|
||||
this.structCheck = this.createStructureCheck(param);
|
||||
#else
|
||||
this.structCheck = new StructureCheck(param.chunkScanner, param.registry, param.structures,
|
||||
@@ -80,15 +80,15 @@ public final class ThreadedParameters
|
||||
|
||||
public void makeStructFeat(WorldGenLevel genLevel, GlobalParameters param)
|
||||
{
|
||||
#if PRE_MC_1_19_4
|
||||
structFeat = new WorldGenStructFeatManager(param.worldGenSettings, genLevel #if POST_MC_1_18_2 , structCheck #endif );
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
structFeat = new WorldGenStructFeatManager(param.worldGenSettings, genLevel #if MC_1_18 || MC_1_19 || MC_1_20 , structCheck #endif );
|
||||
#else
|
||||
structFeat = new WorldGenStructFeatManager(param.worldOptions, genLevel, structCheck);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if POST_MC_1_18_2 && PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
public void recreateStructureCheck()
|
||||
{
|
||||
if (previousGlobalParameters != null)
|
||||
|
||||
+29
-29
@@ -37,7 +37,7 @@ import java.util.Objects;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.SectionPos;
|
||||
#if POST_MC_1_19_4
|
||||
#if MC_1_19_4 || MC_1_20
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
#endif
|
||||
@@ -55,24 +55,24 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.*;
|
||||
import net.minecraft.world.level.chunk.storage.ChunkSerializer;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
import net.minecraft.world.level.levelgen.blending.BlendingData;
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
#endif
|
||||
import net.minecraft.world.level.levelgen.structure.StructureStart;
|
||||
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||
import net.minecraft.world.ticks.LevelChunkTicks;
|
||||
#endif
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
#endif
|
||||
|
||||
@@ -81,9 +81,9 @@ import net.minecraft.world.level.material.Fluid;
|
||||
|
||||
public class ChunkLoader
|
||||
{
|
||||
#if POST_MC_1_19_2
|
||||
#if MC_1_19 || MC_1_20
|
||||
private static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState());
|
||||
#elif POST_MC_1_18_2
|
||||
#elif MC_1_18 || MC_1_19 || MC_1_20
|
||||
private static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.codec(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState());
|
||||
#endif
|
||||
private static final String TAG_UPGRADE_DATA = "UpgradeData";
|
||||
@@ -93,7 +93,7 @@ public class ChunkLoader
|
||||
private static final String FLUID_TICKS_TAG_PRE18 = "LiquidTicks";
|
||||
private static final ConfigBasedLogger LOGGER = BatchGenerationEnvironment.LOAD_LOGGER;
|
||||
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
private static BlendingData readBlendingData(CompoundTag chunkData)
|
||||
{
|
||||
BlendingData blendingData = null;
|
||||
@@ -109,16 +109,16 @@ public class ChunkLoader
|
||||
|
||||
private static LevelChunkSection[] readSections(LevelAccessor level, ChunkPos chunkPos, CompoundTag chunkData)
|
||||
{
|
||||
#if POST_MC_1_18_2
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
Registry<Biome> biomes = level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY);
|
||||
#else
|
||||
Registry<Biome> biomes = level.registryAccess().registryOrThrow(Registries.BIOME);
|
||||
#endif
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
Codec<PalettedContainer<Biome>> biomeCodec = PalettedContainer.codec(
|
||||
biomes, biomes.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getOrThrow(Biomes.PLAINS));
|
||||
#elif PRE_MC_1_19_2
|
||||
#elif MC_1_16 || MC_1_17 || MC_1_18
|
||||
Codec<PalettedContainer<Holder<Biome>>> biomeCodec = PalettedContainer.codec(
|
||||
biomes.asHolderIdMap(), biomes.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getHolderOrThrow(Biomes.PLAINS));
|
||||
#else
|
||||
@@ -126,7 +126,7 @@ public class ChunkLoader
|
||||
biomes.asHolderIdMap(), biomes.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getHolderOrThrow(Biomes.PLAINS));
|
||||
#endif
|
||||
#endif
|
||||
int i = #if PRE_MC_1_17_1 16; #else level.getSectionsCount(); #endif
|
||||
int i = #if MC_1_16 16; #else level.getSectionsCount(); #endif
|
||||
LevelChunkSection[] chunkSections = new LevelChunkSection[i];
|
||||
|
||||
boolean isLightOn = chunkData.getBoolean("isLightOn");
|
||||
@@ -139,7 +139,7 @@ public class ChunkLoader
|
||||
CompoundTag tagSection = tagSections.getCompound(j);
|
||||
int sectionYPos = tagSection.getByte("Y");
|
||||
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
if (tagSection.contains("Palette", 9) && tagSection.contains("BlockStates", 12))
|
||||
{
|
||||
LevelChunkSection levelChunkSection = new LevelChunkSection(sectionYPos << 4);
|
||||
@@ -147,7 +147,7 @@ public class ChunkLoader
|
||||
tagSection.getLongArray("BlockStates"));
|
||||
levelChunkSection.recalcBlockCounts();
|
||||
if (!levelChunkSection.isEmpty())
|
||||
chunkSections[#if PRE_MC_1_17_1 sectionYPos #else level.getSectionIndexFromSectionY(sectionYPos) #endif ]
|
||||
chunkSections[#if MC_1_16 sectionYPos #else level.getSectionIndexFromSectionY(sectionYPos) #endif ]
|
||||
= levelChunkSection;
|
||||
}
|
||||
#else
|
||||
@@ -155,7 +155,7 @@ public class ChunkLoader
|
||||
if (sectionId >= 0 && sectionId < chunkSections.length)
|
||||
{
|
||||
PalettedContainer<BlockState> blockStateContainer;
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
PalettedContainer<Biome> biomeContainer;
|
||||
#else
|
||||
PalettedContainer<Holder<Biome>> biomeContainer;
|
||||
@@ -165,7 +165,7 @@ public class ChunkLoader
|
||||
? BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, tagSection.getCompound("block_states")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error)
|
||||
: new PalettedContainer<BlockState>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES);
|
||||
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
biomeContainer = tagSection.contains("biomes", 10)
|
||||
? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error)
|
||||
: new PalettedContainer<Biome>(biomes, biomes.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES);
|
||||
@@ -174,7 +174,7 @@ public class ChunkLoader
|
||||
? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, i, (String) string)).getOrThrow(false, LOGGER::error)
|
||||
: new PalettedContainer<Holder<Biome>>(biomes.asHolderIdMap(), biomes.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES);
|
||||
#endif
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
chunkSections[sectionId] = new LevelChunkSection(sectionYPos, blockStateContainer, biomeContainer);
|
||||
#else
|
||||
chunkSections[sectionId] = new LevelChunkSection(blockStateContainer, biomeContainer);
|
||||
@@ -223,7 +223,7 @@ public class ChunkLoader
|
||||
|
||||
public static LevelChunk read(WorldGenLevel level, ChunkPos chunkPos, CompoundTag chunkData)
|
||||
{
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
CompoundTag tagLevel = chunkData.getCompound("Level");
|
||||
#else
|
||||
CompoundTag tagLevel = chunkData;
|
||||
@@ -237,12 +237,12 @@ public class ChunkLoader
|
||||
}
|
||||
|
||||
ChunkStatus.ChunkType chunkType = readChunkType(tagLevel);
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
if (chunkType != ChunkStatus.ChunkType.LEVELCHUNK)
|
||||
return null;
|
||||
#else
|
||||
BlendingData blendingData = readBlendingData(tagLevel);
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && (blendingData == null || !blendingData.oldNoise()))
|
||||
return null;
|
||||
#else
|
||||
@@ -255,27 +255,27 @@ public class ChunkLoader
|
||||
|
||||
//================== Read params for making the LevelChunk ==================
|
||||
UpgradeData upgradeData = tagLevel.contains(TAG_UPGRADE_DATA, 10)
|
||||
? new UpgradeData(tagLevel.getCompound(TAG_UPGRADE_DATA)#if POST_MC_1_17_1 , level #endif )
|
||||
? new UpgradeData(tagLevel.getCompound(TAG_UPGRADE_DATA)#if MC_1_18 || MC_1_19 || MC_1_20 , level #endif )
|
||||
: UpgradeData.EMPTY;
|
||||
|
||||
boolean isLightOn = tagLevel.getBoolean("isLightOn");
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
ChunkBiomeContainer chunkBiomeContainer = new ChunkBiomeContainer(
|
||||
level.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY)#if POST_MC_1_17_1 , level #endif ,
|
||||
level.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY)#if MC_1_18 || MC_1_19 || MC_1_20 , level #endif ,
|
||||
chunkPos, level.getLevel().getChunkSource().getGenerator().getBiomeSource(),
|
||||
tagLevel.contains("Biomes", 11) ? tagLevel.getIntArray("Biomes") : null);
|
||||
|
||||
TickList<Block> blockTicks = tagLevel.contains(BLOCK_TICKS_TAG_PRE18, 9)
|
||||
? ChunkTickList.create(tagLevel.getList(BLOCK_TICKS_TAG_PRE18, 10), Registry.BLOCK::getKey, Registry.BLOCK::get)
|
||||
: new ProtoTickList<Block>(block -> (block == null || block.defaultBlockState().isAir()), chunkPos,
|
||||
tagLevel.getList("ToBeTicked", 9)#if POST_MC_1_17_1 , level #endif );
|
||||
tagLevel.getList("ToBeTicked", 9)#if MC_1_18 || MC_1_19 || MC_1_20 , level #endif );
|
||||
|
||||
TickList<Fluid> fluidTicks = tagLevel.contains(FLUID_TICKS_TAG_PRE18, 9)
|
||||
? ChunkTickList.create(tagLevel.getList(FLUID_TICKS_TAG_PRE18, 10), Registry.FLUID::getKey, Registry.FLUID::get)
|
||||
: new ProtoTickList<Fluid>(fluid -> (fluid == null || fluid == Fluids.EMPTY), chunkPos,
|
||||
tagLevel.getList("LiquidsToBeTicked", 9)#if POST_MC_1_17_1 , level #endif );
|
||||
tagLevel.getList("LiquidsToBeTicked", 9)#if MC_1_18 || MC_1_19 || MC_1_20 , level #endif );
|
||||
#else
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
LevelChunkTicks<Block> blockTicks = LevelChunkTicks.load(tagLevel.getList(BLOCK_TICKS_TAG_18, 10),
|
||||
string -> Registry.BLOCK.getOptional(ResourceLocation.tryParse(string)), chunkPos);
|
||||
LevelChunkTicks<Fluid> fluidTicks = LevelChunkTicks.load(tagLevel.getList(FLUID_TICKS_TAG_18, 10),
|
||||
@@ -291,7 +291,7 @@ public class ChunkLoader
|
||||
LevelChunkSection[] levelChunkSections = readSections(level, chunkPos, tagLevel);
|
||||
|
||||
// ====================== Make the chunk =========================
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
LevelChunk chunk = new LevelChunk((Level) level.getLevel(), chunkPos, chunkBiomeContainer, upgradeData, blockTicks,
|
||||
fluidTicks, inhabitedTime, levelChunkSections, null);
|
||||
#else
|
||||
|
||||
+10
-10
@@ -41,7 +41,7 @@ import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.ColorResolver;
|
||||
#if POST_MC_1_17_1
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
#endif
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
@@ -73,11 +73,11 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
*/
|
||||
ReentrantLock getChunkLock = new ReentrantLock();
|
||||
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
private ChunkPos overrideCenterPos = null;
|
||||
|
||||
public void setOverrideCenter(ChunkPos pos) { overrideCenterPos = pos; }
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
@Override
|
||||
public int getCenterX()
|
||||
{
|
||||
@@ -104,7 +104,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
List<ChunkAccess> chunkList, ChunkStatus chunkStatus, int writeRadius,
|
||||
BatchGenerationEnvironment.EmptyChunkGenerator generator)
|
||||
{
|
||||
super(serverLevel, chunkList #if POST_MC_1_17_1 , chunkStatus, writeRadius #endif );
|
||||
super(serverLevel, chunkList #if MC_1_18 || MC_1_19 || MC_1_20 , chunkStatus, writeRadius #endif );
|
||||
this.firstPos = chunkList.get(0).getPos();
|
||||
this.generator = generator;
|
||||
this.lightEngine = lightEngine;
|
||||
@@ -115,7 +115,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
|
||||
|
||||
|
||||
#if POST_MC_1_17_1
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
// Bypass BCLib mixin overrides.
|
||||
@Override
|
||||
public boolean ensureCanWrite(BlockPos blockPos)
|
||||
@@ -130,7 +130,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_19 || MC_1_20
|
||||
if (center.isUpgrading())
|
||||
{
|
||||
LevelHeightAccessor levelHeightAccessor = center.getHeightAccessorForGeneration();
|
||||
@@ -185,7 +185,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
BlockState blockState = this.getBlockState(blockPos);
|
||||
|
||||
// This is a bypass for the spawner block since MC complains about not having it
|
||||
#if POST_MC_1_17_1
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
if (blockState.getBlock() instanceof SpawnerBlock)
|
||||
{
|
||||
return ((EntityBlock) blockState.getBlock()).newBlockEntity(blockPos, blockState);
|
||||
@@ -269,7 +269,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
ChunkAccess chunk = getChunkAccess(i, j, chunkStatus, bl);
|
||||
if (chunk instanceof LevelChunk)
|
||||
{
|
||||
chunk = new ImposterProtoChunk((LevelChunk) chunk #if POST_MC_1_18_2 , true #endif );
|
||||
chunk = new ImposterProtoChunk((LevelChunk) chunk #if MC_1_18 || MC_1_19 || MC_1_20 , true #endif );
|
||||
}
|
||||
return chunk;
|
||||
}
|
||||
@@ -331,7 +331,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
|
||||
private Biome _getBiome(BlockPos pos)
|
||||
{
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
return getBiome(pos).value();
|
||||
#else
|
||||
return getBiome(pos);
|
||||
@@ -340,7 +340,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
|
||||
public int calculateBlockTint(BlockPos blockPos, ColorResolver colorResolver)
|
||||
{
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
int i = (Minecraft.getInstance()).options.biomeBlendRadius;
|
||||
#else
|
||||
int i = (Minecraft.getInstance()).options.biomeBlendRadius().get();
|
||||
|
||||
+3
-3
@@ -39,7 +39,7 @@ public class DummyLightEngine extends LevelLightEngine
|
||||
}
|
||||
|
||||
|
||||
#if PRE_MC_1_20_1
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
|
||||
@Override
|
||||
public void onBlockEmissionIncrease(BlockPos blockPos, int i) { }
|
||||
|
||||
@@ -63,7 +63,7 @@ public class DummyLightEngine extends LevelLightEngine
|
||||
#endif
|
||||
|
||||
@Override
|
||||
public void queueSectionData(LightLayer lightLayer, SectionPos sectionPos, @Nullable DataLayer dataLayer #if PRE_MC_1_20_1 , boolean bl #endif ) { }
|
||||
public void queueSectionData(LightLayer lightLayer, SectionPos sectionPos, @Nullable DataLayer dataLayer #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 , boolean bl #endif ) { }
|
||||
|
||||
@Override
|
||||
public void checkBlock(BlockPos blockPos) { }
|
||||
@@ -87,7 +87,7 @@ public class DummyLightEngine extends LevelLightEngine
|
||||
@Override
|
||||
public void retainData(ChunkPos chunkPos, boolean bl) { }
|
||||
|
||||
#if POST_MC_1_17_1
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
@Override
|
||||
public int getLightSectionCount() { throw new UnsupportedOperationException("This should never be used!"); }
|
||||
@Override
|
||||
|
||||
+4
-4
@@ -23,12 +23,12 @@ import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IStarlightAccessor;
|
||||
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
#if POST_MC_1_17_1
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
#endif
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.LightChunkGetter;
|
||||
#if POST_MC_1_20_1
|
||||
#if MC_1_20_2 || MC_1_20_4
|
||||
import net.minecraft.world.level.chunk.LightChunk;
|
||||
#endif
|
||||
|
||||
@@ -50,7 +50,7 @@ public class LightGetterAdaptor implements LightChunkGetter
|
||||
}
|
||||
|
||||
@Override
|
||||
public #if PRE_MC_1_20_1 BlockGetter #else LightChunk #endif getChunkForLighting(int chunkX, int chunkZ)
|
||||
public #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 BlockGetter #else LightChunk #endif getChunkForLighting(int chunkX, int chunkZ)
|
||||
{
|
||||
if (genRegion == null)
|
||||
throw new IllegalStateException("World Gen region has not been set!");
|
||||
@@ -64,7 +64,7 @@ public class LightGetterAdaptor implements LightChunkGetter
|
||||
return shouldReturnNull ? null : (genRegion != null ? genRegion : heightGetter);
|
||||
}
|
||||
|
||||
#if POST_MC_1_17_1
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
public LevelHeightAccessor getLevelHeightAccessor()
|
||||
{
|
||||
return heightGetter;
|
||||
|
||||
+4
-4
@@ -70,7 +70,7 @@ public class RegionFileStorageExternalCache implements AutoCloseable
|
||||
{
|
||||
this.getRegionFileLock.lock();
|
||||
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
rFile = this.storage.getRegionFile(pos);
|
||||
|
||||
// keeping the region cache size low helps prevent concurrency issues
|
||||
@@ -90,7 +90,7 @@ public class RegionFileStorageExternalCache implements AutoCloseable
|
||||
}
|
||||
catch (ArrayIndexOutOfBoundsException e)
|
||||
{
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
// the file just wasn't cached
|
||||
break;
|
||||
#else
|
||||
@@ -145,7 +145,7 @@ public class RegionFileStorageExternalCache implements AutoCloseable
|
||||
|
||||
// Otherwise, check if file exist, and if so, add it to the cache
|
||||
Path storageFolderPath;
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
storageFolderPath = this.storage.folder.toPath();
|
||||
#else
|
||||
storageFolderPath = this.storage.folder;
|
||||
@@ -157,7 +157,7 @@ public class RegionFileStorageExternalCache implements AutoCloseable
|
||||
}
|
||||
|
||||
Path regionFilePath = storageFolderPath.resolve("r." + pos.getRegionX() + "." + pos.getRegionZ() + ".mca");
|
||||
#if MC_1_16_5 || MC_1_17_1
|
||||
#if MC_1_16_5 || MC_1_17
|
||||
rFile = new RegionFile(regionFilePath.toFile(), storageFolderPath.toFile(), false);
|
||||
#else
|
||||
rFile = new RegionFile(regionFilePath, storageFolderPath, false);
|
||||
|
||||
+14
-14
@@ -37,49 +37,49 @@ import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
#else
|
||||
#if POST_MC_1_19_4
|
||||
#if MC_1_19_4 || MC_1_20
|
||||
import net.minecraft.world.level.levelgen.WorldOptions;
|
||||
#endif
|
||||
import net.minecraft.world.level.levelgen.structure.Structure;
|
||||
import net.minecraft.world.level.StructureManager;
|
||||
#endif
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
import net.minecraft.world.level.levelgen.structure.StructureCheck;
|
||||
#endif
|
||||
|
||||
import net.minecraft.world.level.levelgen.structure.StructureStart;
|
||||
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
public class WorldGenStructFeatManager extends #if PRE_MC_1_19_2 StructureFeatureManager #else StructureManager #endif
|
||||
public class WorldGenStructFeatManager extends #if MC_1_16 || MC_1_17 || MC_1_18 StructureFeatureManager #else StructureManager #endif
|
||||
{
|
||||
final WorldGenLevel genLevel;
|
||||
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
WorldGenSettings worldGenSettings;
|
||||
#else
|
||||
WorldOptions worldOptions;
|
||||
#endif
|
||||
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
StructureCheck structureCheck;
|
||||
#endif
|
||||
|
||||
#if PRE_MC_1_19_4
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
public WorldGenStructFeatManager(
|
||||
WorldGenSettings worldGenSettings,
|
||||
WorldGenLevel genLevel #if POST_MC_1_18_2 , StructureCheck structureCheck #endif )
|
||||
WorldGenLevel genLevel #if MC_1_18 || MC_1_19 || MC_1_20 , StructureCheck structureCheck #endif )
|
||||
{
|
||||
|
||||
super(genLevel, worldGenSettings #if POST_MC_1_18_2 , structureCheck #endif );
|
||||
super(genLevel, worldGenSettings #if MC_1_18 || MC_1_19 || MC_1_20 , structureCheck #endif );
|
||||
this.genLevel = genLevel;
|
||||
this.worldGenSettings = worldGenSettings;
|
||||
}
|
||||
@@ -100,8 +100,8 @@ public class WorldGenStructFeatManager extends #if PRE_MC_1_19_2 StructureFeatur
|
||||
{
|
||||
if (worldGenRegion == genLevel)
|
||||
return this;
|
||||
#if PRE_MC_1_19_4
|
||||
return new WorldGenStructFeatManager(worldGenSettings, worldGenRegion #if POST_MC_1_18_2 , structureCheck #endif );
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
return new WorldGenStructFeatManager(worldGenSettings, worldGenRegion #if MC_1_18 || MC_1_19 || MC_1_20 , structureCheck #endif );
|
||||
#else
|
||||
return new WorldGenStructFeatManager(worldOptions, worldGenRegion, structureCheck);
|
||||
#endif
|
||||
@@ -113,7 +113,7 @@ public class WorldGenStructFeatManager extends #if PRE_MC_1_19_2 StructureFeatur
|
||||
return genLevel.getChunk(x, z, status, false);
|
||||
}
|
||||
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
@Override
|
||||
public Stream<? extends StructureStart<?>> startsForFeature(
|
||||
SectionPos sectionPos2,
|
||||
@@ -165,7 +165,7 @@ public class WorldGenStructFeatManager extends #if PRE_MC_1_19_2 StructureFeatur
|
||||
return builder.build();
|
||||
}
|
||||
#else
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
@Override
|
||||
public List<StructureStart> startsForFeature(SectionPos sectionPos, Predicate<ConfiguredStructureFeature<?, ?>> predicate)
|
||||
{
|
||||
|
||||
+5
-5
@@ -27,12 +27,12 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGeneratio
|
||||
import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParameters;
|
||||
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
#endif
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
import net.minecraft.world.level.levelgen.blending.Blender;
|
||||
#endif
|
||||
|
||||
@@ -65,12 +65,12 @@ public final class StepBiomes
|
||||
for (ChunkAccess chunk : chunksToDo)
|
||||
{
|
||||
// System.out.println("StepBiomes: "+chunk.getPos());
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
environment.params.generator.createBiomes(environment.params.biomes, chunk);
|
||||
#elif PRE_MC_1_19_2
|
||||
#elif MC_1_16 || MC_1_17 || MC_1_18
|
||||
chunk = environment.joinSync(environment.params.generator.createBiomes(environment.params.biomes, Runnable::run, Blender.of(worldGenRegion),
|
||||
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
|
||||
#elif PRE_MC_1_19_4
|
||||
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
chunk = environment.joinSync(environment.params.generator.createBiomes(environment.params.biomes, Runnable::run, environment.params.randomState, Blender.of(worldGenRegion),
|
||||
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
|
||||
#else
|
||||
|
||||
+2
-2
@@ -32,7 +32,7 @@ import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_19 || MC_1_20
|
||||
#endif
|
||||
|
||||
public final class StepFeatures
|
||||
@@ -65,7 +65,7 @@ public final class StepFeatures
|
||||
{
|
||||
try
|
||||
{
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
worldGenRegion.setOverrideCenter(chunk.getPos());
|
||||
environment.params.generator.applyBiomeDecoration(worldGenRegion, tParams.structFeat);
|
||||
#else
|
||||
|
||||
+6
-6
@@ -28,14 +28,14 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParame
|
||||
|
||||
import com.seibel.distanthorizons.core.util.objects.UncheckedInterruptedException;
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
#if POST_MC_1_17_1
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
#endif
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
#endif
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_18 || MC_1_19 || MC_1_20
|
||||
import net.minecraft.world.level.levelgen.blending.Blender;
|
||||
#endif
|
||||
|
||||
@@ -69,12 +69,12 @@ public final class StepNoise
|
||||
for (ChunkAccess chunk : chunksToDo)
|
||||
{
|
||||
// System.out.println("StepNoise: "+chunk.getPos());
|
||||
#if PRE_MC_1_17_1
|
||||
#if MC_1_16
|
||||
environment.params.generator.fillFromNoise(worldGenRegion, tParams.structFeat, chunk);
|
||||
#elif PRE_MC_1_18_2
|
||||
#elif MC_1_16 || MC_1_17
|
||||
chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run,
|
||||
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
|
||||
#elif PRE_MC_1_19_2
|
||||
#elif MC_1_16 || MC_1_17 || MC_1_18
|
||||
chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run, Blender.of(worldGenRegion),
|
||||
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
|
||||
#else
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGeneratio
|
||||
import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParameters;
|
||||
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
#endif
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
|
||||
+5
-5
@@ -77,10 +77,10 @@ public final class StepStructureStart
|
||||
}
|
||||
}
|
||||
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
if (environment.params.worldGenSettings.generateFeatures())
|
||||
{
|
||||
#elif PRE_MC_1_19_4
|
||||
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
if (environment.params.worldGenSettings.generateStructures()) {
|
||||
#else
|
||||
if (environment.params.worldOptions.generateStructures())
|
||||
@@ -98,10 +98,10 @@ public final class StepStructureStart
|
||||
// and should prevent some concurrency issues
|
||||
STRUCTURE_PLACEMENT_LOCK.lock();
|
||||
|
||||
#if PRE_MC_1_19_2
|
||||
#if MC_1_16 || MC_1_17 || MC_1_18
|
||||
environment.params.generator.createStructures(environment.params.registry, tParams.structFeat, chunk, environment.params.structures,
|
||||
environment.params.worldSeed);
|
||||
#elif PRE_MC_1_19_4
|
||||
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
|
||||
environment.params.generator.createStructures(environment.params.registry, environment.params.randomState, tParams.structFeat, chunk, environment.params.structures,
|
||||
environment.params.worldSeed);
|
||||
#else
|
||||
@@ -110,7 +110,7 @@ public final class StepStructureStart
|
||||
tParams.structFeat, chunk, environment.params.structures);
|
||||
#endif
|
||||
|
||||
#if POST_MC_1_18_2
|
||||
#if MC_1_19 || MC_1_20
|
||||
try
|
||||
{
|
||||
tParams.structCheck.onStructureLoad(chunk.getPos(), chunk.getAllStarts());
|
||||
|
||||
+2
-2
@@ -61,9 +61,9 @@ public final class StepSurface
|
||||
for (ChunkAccess chunk : chunksToDo)
|
||||
{
|
||||
// System.out.println("StepSurface: "+chunk.getPos());
|
||||
#if PRE_MC_1_18_2
|
||||
#if MC_1_16 || MC_1_17
|
||||
environment.params.generator.buildSurfaceAndBedrock(worldGenRegion, chunk);
|
||||
#elif PRE_MC_1_19_2
|
||||
#elif MC_1_16 || MC_1_17 || MC_1_18
|
||||
environment.params.generator.buildSurface(worldGenRegion, tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk);
|
||||
#else
|
||||
environment.params.generator.buildSurface(worldGenRegion, tParams.structFeat.forWorldGenRegion(worldGenRegion), environment.params.randomState, chunk);
|
||||
|
||||
Reference in New Issue
Block a user