Updated java files to use version numbers

This commit is contained in:
coolGi
2023-12-12 18:18:59 +10:30
parent 14d64d535a
commit 61460f9ac0
77 changed files with 361 additions and 373 deletions
+1 -2
View File
@@ -34,7 +34,7 @@ def writeBuildGradlePredefine(List<String> mcVers, int mcIndex)
for (int i = 0; i < mcVers.size(); i++)
{
String verStr = mcVers[i].replace(".", "_");
sb.append(verStr + "=" + i.toString() + "\n");
sb.append("MC_" + verStr + "=" + i.toString() + "\n");
if (mcIndex == i)
sb.append("MC_VER=" + i.toString() + "\n");
@@ -477,7 +477,6 @@ allprojects { p ->
maven { url "https://maven.architectury.dev" }
// For Git repositories
// navigating to the URL in a web browser allows for testing and viewing possible downloads
maven { url "https://jitpack.io" }
// For Manifold Preprocessor
@@ -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 MC_1_19 || MC_1_20
#if MC_VER > MC_1_19_2
import net.minecraft.util.RandomSource;
#endif
import net.minecraft.world.level.ColorResolver;
@@ -41,7 +41,7 @@ import java.util.Random;
*/
public interface LodForgeMethodCaller
{
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
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
@@ -19,11 +19,9 @@
package com.seibel.distanthorizons.common.rendering;
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
import com.mojang.math.Matrix4f;
#else
import org.joml.Matrix4f;
#endif
import com.seibel.distanthorizons.core.config.Config;
@@ -43,7 +41,7 @@ public class SeamlessOverdraw
{
float[] matrixFloatArray;
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
FloatBuffer matrixFloatBuffer = FloatBuffer.allocate(16);
minecraftProjectionMatrix.store(matrixFloatBuffer);
matrixFloatArray = matrixFloatBuffer.array();
@@ -23,7 +23,7 @@ import java.nio.FloatBuffer;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
matrix.transpose(); // In 1.19.3 and later, we no longer need to transpose it
#endif
return matrix;
@@ -59,7 +59,7 @@ public class VersionConstants implements IVersionConstants
@Override
public String getMinecraftVersion()
{
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
return Minecraft.getInstance().getGame().getVersion().getId();
#else
return SharedConstants.getCurrentVersion().getId();
@@ -106,7 +106,7 @@ public class WrapperFactory implements IWrapperFactory
}
}
#if MC_1_16 || MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER // Always true
else if (objectArray.length == 2)
{
// correct number of parameters from the API
@@ -173,7 +173,7 @@ public class WrapperFactory implements IWrapperFactory
"Chunk wrapper creation failed. \n" +
"Expected parameters: \n");
#if MC_1_16 || MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER // Always true
message.append("[" + ChunkAccess.class.getName() + "], \n");
message.append("[" + ServerLevel.class.getName() + "] or [" + ClientLevel.class.getName() + "]. \n");
#else
@@ -33,18 +33,10 @@ import org.apache.logging.log4j.Logger;
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper;
import net.minecraft.client.Minecraft;
#if POST_MC_1_17
import net.minecraft.core.Holder;
import net.minecraft.resources.RegistryOps;
#endif
#if MC_1_19_4 || MC_1_20
#endif
#if MC_1_16_5 || MC_1_17
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
import net.minecraft.core.Registry;
#elif MC_1_18 || MC_1_19_2
#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistryAccess;
@@ -56,7 +48,7 @@ import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome;
#if !MC_1_16 || MC_1_17
#if MC_VER >= MC_1_18_2
import net.minecraft.world.level.biome.Biomes;
#endif
@@ -66,7 +58,7 @@ public class BiomeWrapper implements IBiomeWrapper
{
private static final Logger LOGGER = LogManager.getLogger();
#if MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
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 +81,7 @@ public class BiomeWrapper implements IBiomeWrapper
// properties //
#if MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
public final Biome biome;
#else
public final Holder<Biome> biome;
@@ -104,7 +96,7 @@ public class BiomeWrapper implements IBiomeWrapper
// constructors //
//==============//
static public IBiomeWrapper getBiomeWrapper(#if MC_1_16 || MC_1_17 Biome #else Holder<Biome> #endif biome, ILevelWrapper levelWrapper)
static public IBiomeWrapper getBiomeWrapper(#if MC_VER < MC_1_18_2 Biome #else Holder<Biome> #endif biome, ILevelWrapper levelWrapper)
{
if (biome == null)
{
@@ -124,7 +116,7 @@ public class BiomeWrapper implements IBiomeWrapper
}
}
private BiomeWrapper(#if MC_1_16 || MC_1_17 Biome #else Holder<Biome> #endif biome, ILevelWrapper levelWrapper)
private BiomeWrapper(#if MC_VER < MC_1_18_2 Biome #else Holder<Biome> #endif biome, ILevelWrapper levelWrapper)
{
this.biome = biome;
this.serialString = this.serialize(levelWrapper);
@@ -145,7 +137,7 @@ public class BiomeWrapper implements IBiomeWrapper
return EMPTY_STRING;
}
#if MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
return biome.toString();
#else
return this.biome.unwrapKey().orElse(Biomes.THE_VOID).registry().toString();
@@ -214,9 +206,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
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome);
#elif MC_1_18 || MC_1_19_2
#elif MC_VER == MC_1_18_2 || MC_VER == 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 +217,7 @@ public class BiomeWrapper implements IBiomeWrapper
if (resourceLocation == null)
{
String biomeName;
#if MC_1_16_5 || MC_1_17
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
biomeName = this.biome.toString();
#else
biomeName = this.biome.value().toString();
@@ -277,10 +269,10 @@ public class BiomeWrapper implements IBiomeWrapper
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
boolean success;
#if MC_1_16_5 || MC_1_17
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
Biome biome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation);
success = (biome != null);
#elif MC_1_18 || MC_1_19_2
#elif MC_VER == MC_1_18_2 || 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);
@@ -32,11 +32,11 @@ import java.io.IOException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
#if MC_1_16_5 || MC_1_17
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
import net.minecraft.core.Registry;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.EmptyBlockGetter;
#elif MC_1_18 || MC_1_19_2
#elif MC_VER == MC_1_18_2 || MC_VER == 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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
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)
#if MC_VER > MC_1_17_1
Level level = (Level)levelWrapper.getWrappedMcObject();
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
#endif
ResourceLocation resourceLocation;
#if MC_1_16_5 || MC_1_17
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
resourceLocation = Registry.BLOCK.getKey(this.blockState.getBlock());
#elif MC_1_18 || MC_1_19_2
#elif MC_VER == MC_1_18_2 || MC_VER == 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)
#if MC_VER > MC_1_17_1
// 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
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
block = Registry.BLOCK.get(resourceLocation);
#elif MC_1_18 || MC_1_19_2
#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
block = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).get(resourceLocation);
#else
@@ -40,11 +40,11 @@ public class TextureAtlasSpriteWrapper
*/
public static int getPixelRGBA(TextureAtlasSprite sprite, int frameIndex, int x, int y)
{
#if MC_1_16
#if MC_VER < MC_1_17_1
return sprite.mainImage[0].getPixelRGBA(
x + sprite.framesX[frameIndex] * sprite.getWidth(),
y + sprite.framesY[frameIndex] * sprite.getHeight());
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#elif MC_VER < MC_1_19_4
if (sprite.animatedTexture != null)
{
x += sprite.animatedTexture.getFrameX(frameIndex) * sprite.width;
@@ -50,7 +50,7 @@ public class TintGetterOverrideFast implements BlockAndTintGetter
private Biome _getBiome(BlockPos pos)
{
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
return parent.getBiome(pos).value();
#else
return parent.getBiome(pos);
@@ -167,7 +167,7 @@ public class TintGetterOverrideFast implements BlockAndTintGetter
return parent.getMaxBuildHeight();
}
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
@Override
public <T extends BlockEntity> Optional<T> getBlockEntity(BlockPos blockPos, BlockEntityType<T> blockEntityType)
{
@@ -53,7 +53,7 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter
private Biome _getBiome(BlockPos pos)
{
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
return parent.getBiome(pos).value();
#else
return parent.getBiome(pos);
@@ -193,7 +193,7 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter
return parent.getMaxBuildHeight();
}
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
@Override
public <T extends BlockEntity> Optional<T> getBlockEntity(BlockPos blockPos, BlockEntityType<T> blockEntityType)
{
@@ -29,7 +29,7 @@ import net.minecraft.world.level.lighting.LevelLightEngine;
import net.minecraft.world.level.material.FluidState;
import org.jetbrains.annotations.Nullable;
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
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 MC_1_18 || MC_1_19 || MC_1_20 Holder<Biome> #else Biome #endif biome)
private Biome _unwrap(#if MC_VER > MC_1_18_2 Holder<Biome> #else Biome #endif biome)
{
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
return biome.value();
#else
return biome;
@@ -84,7 +84,7 @@ public class TintWithoutLevelOverrider implements BlockAndTintGetter
}
#if MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER == MC_1_17_1 || MC_VER > MC_1_18_2
@Override
public int getHeight()
{
@@ -30,7 +30,7 @@ import net.minecraft.world.level.lighting.LevelLightEngine;
import net.minecraft.world.level.material.FluidState;
import org.jetbrains.annotations.Nullable;
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
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 MC_1_18 || MC_1_19 || MC_1_20 Holder<Biome> #else Biome #endif biome)
private Biome _unwrap(#if MC_VER > MC_1_18_2 Holder<Biome> #else Biome #endif biome)
{
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
return biome.value();
#else
return biome;
@@ -116,7 +116,7 @@ public class TintWithoutLevelSmoothOverrider implements BlockAndTintGetter
}
#if MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER >= MC_1_17_1 && MC_VER != MC_1_18_2
@Override
public int getHeight()
{
@@ -29,7 +29,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class ClientBlockDetailMap
{
private final ConcurrentHashMap<BlockState, ClientBlockStateCache> blockCache = new ConcurrentHashMap<>();
//private final ConcurrentHashMap<#if MC_1_16 || MC_1_17 Biome #else Holder<Biome> #endif, Biome> biomeMap = new ConcurrentHashMap<>();
//private final ConcurrentHashMap<#if MC_VER < MC_1_18_2 Biome #else Holder<Biome> #endif, Biome> biomeMap = new ConcurrentHashMap<>();
private final ClientLevelWrapper level;
public ClientBlockDetailMap(ClientLevelWrapper level) { this.level = level; }
@@ -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 MC_1_19 || MC_1_20
#if MC_VER > MC_1_19_2
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 MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
return texture.getWidth();
#else
return texture.contents().width();
@@ -111,7 +111,7 @@ public class ClientBlockStateCache
private static int getHeight(TextureAtlasSprite texture)
{
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
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 MC_1_16 quads.get(0).sprite,
#if MC_VER < MC_1_17_1 quads.get(0).sprite,
#else quads.get(0).getSprite(), #endif
ColorMode.getColorMode(blockState.getBlock()));
}
@@ -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 MC_1_16 || MC_1_17 Biome #else Holder<Biome> #endif, Biome> biomeMap = new ConcurrentHashMap<>();
//private final ConcurrentHashMap<#if MC_VER < MC_1_18_2 Biome #else Holder<Biome> #endif, Biome> biomeMap = new ConcurrentHashMap<>();
private final ServerLevelWrapper level;
public ServerBlockDetailMap(ServerLevelWrapper level) { this.level = level; }
@@ -47,27 +47,27 @@ import org.apache.logging.log4j.Logger;
import java.util.*;
import java.util.concurrent.ConcurrentLinkedQueue;
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
import net.minecraft.core.QuartPos;
#endif
#if MC_1_16_5
#if MC_VER == MC_1_16_5
import net.minecraft.world.level.chunk.LevelChunkSection;
#endif
#if MC_1_17
#if MC_VER == MC_1_17_1
import net.minecraft.world.level.chunk.LevelChunkSection;
#endif
#if MC_1_18
#if MC_VER == MC_1_18_2
import net.minecraft.world.level.chunk.LevelChunkSection;
#endif
#if MC_1_19
#if MC_VER == MC_1_19_2 || MC_VER == MC_1_19_4
import net.minecraft.world.level.chunk.LevelChunkSection;
#endif
#if MC_1_20_2 || MC_1_20_4
#if MC_VER > MC_1_20_1
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 MC_1_16
#if MC_VER < MC_1_17_1
return 255;
#else
return this.chunk.getHeight();
@@ -155,7 +155,7 @@ public class ChunkWrapper implements IChunkWrapper
@Override
public int getMinBuildHeight()
{
#if MC_1_16
#if MC_VER < MC_1_17_1
return 0;
#else
return this.chunk.getMinBuildHeight();
@@ -175,13 +175,13 @@ public class ChunkWrapper implements IChunkWrapper
continue;
}
#if MC_1_16_5
#if MC_VER == MC_1_16_5
if (!sections[index].isEmpty())
{
// convert from an index to a block coordinate
return this.chunk.getSections()[index].bottomBlockY() * 16;
}
#elif MC_1_17
#elif MC_VER == MC_1_17_1
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 MC_1_16
#if MC_VER < MC_1_17_1
return BiomeWrapper.getBiomeWrapper(this.chunk.getBiomes().getNoiseBiome(
relX >> 2, relY >> 2, relZ >> 2),
this.wrappedLevel);
#elif MC_1_16 || MC_1_17
#elif MC_VER < MC_1_18_2
return BiomeWrapper.getBiomeWrapper(this.chunk.getBiomes().getNoiseBiome(
QuartPos.fromBlock(relX), QuartPos.fromBlock(relY), QuartPos.fromBlock(relZ)),
this.wrappedLevel);
#elif MC_1_16 || MC_1_17
#elif MC_VER < MC_1_18_2
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
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
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 MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
// 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
#if MC_VER <= MC_1_17_1
levelChunk.isLightCorrect();
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#elif MC_VER < MC_1_20_1
levelChunk.isClientLightReady();
#else
checkLightSectionsOnChunk(levelChunk, levelChunk.getLevel().getLightEngine());
#endif
}
}
#if MC_1_20_2 || MC_1_20_4
#if MC_VER > MC_1_20_1
private static boolean checkLightSectionsOnChunk(LevelChunk chunk, LevelLightEngine engine)
{
LevelChunkSection[] sections = chunk.getSections();
@@ -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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
import net.minecraft.client.gui.narration.NarratableEntry;
#endif
import net.minecraft.resources.ResourceLocation;
@@ -379,13 +379,13 @@ public class ClassicConfigGUI
}
@Override
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
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 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
#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
super.render(matrices, mouseX, mouseY, delta);
@@ -441,7 +441,7 @@ public class ClassicConfigGUI
}
}
}
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
#if MC_VER < MC_1_20_2
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2
#if MC_VER < MC_1_20_4
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
@Override
public List<? extends NarratableEntry> narratables()
{
@@ -1,7 +1,7 @@
package com.seibel.distanthorizons.common.wrappers.gui;
import net.minecraft.client.gui.Font;
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
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 MC_1_16
#if MC_VER < MC_1_17_1
return this.addButton(button);
#else
return this.addRenderableWidget(button);
#endif
}
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
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 MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
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 MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
return new TextComponent(text);
#else
return Component.literal(text);
@@ -35,7 +35,7 @@ public class GuiHelper
public static MutableComponent TextOrTranslatable(String text)
{
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
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 MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
w.x = x;
#else
w.setX(x);
@@ -62,7 +62,7 @@ public class GuiHelper
public static void SetY(AbstractWidget w, int y)
{
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
w.y = y;
#else
w.setY(y);
@@ -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 MC_1_20_2 || MC_1_20_4
#if MC_VER > MC_1_20_1
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 MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
#if MC_VER < MC_1_20_2
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2
#if MC_VER < MC_1_20_4
super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing);
#else
super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing);
@@ -34,18 +34,17 @@ import net.minecraft.client.gui.components.ImageButton;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
import net.minecraft.client.renderer.GameRenderer;
#endif
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
#else
import net.minecraft.client.gui.GuiGraphics;
#endif
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
#if MC_VER < MC_1_20_2
public class TexturedButtonWidget extends ImageButton
#else
public class TexturedButtonWidget extends Button
@@ -53,7 +52,7 @@ public class TexturedButtonWidget extends Button
{
public final boolean renderBackground;
#if MC_1_20_2 || MC_1_20_4
#if MC_VER >= MC_1_20_2
private final int u;
private final int v;
private final int hoveredVOffset;
@@ -70,7 +69,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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
#if MC_VER < MC_1_20_2
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)
@@ -90,13 +89,13 @@ public class TexturedButtonWidget extends Button
this.renderBackground = renderBackground;
}
#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
#if MC_VER < MC_1_20_2
#if MC_VER < MC_1_19_4
@Override
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) {
if (this.renderBackground) // Renders the background of the button
{
#if MC_1_16
#if MC_VER < MC_1_17_1
Minecraft.getInstance().getTextureManager().bind(WIDGETS_LOCATION);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha);
#else
@@ -109,7 +108,7 @@ public class TexturedButtonWidget extends Button
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.enableDepthTest();
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
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
@@ -121,7 +120,7 @@ public class TexturedButtonWidget extends Button
super.renderButton(matrices, mouseX, mouseY, delta);
}
#else
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
@Override
public void renderWidget(PoseStack matrices, int mouseX, int mouseY, float delta)
{
@@ -139,7 +138,7 @@ public class TexturedButtonWidget extends Button
if (!this.active) i = 0;
else if (this.isHovered) i = 2;
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.enableDepthTest();
@@ -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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
import net.minecraft.client.gui.narration.NarratableEntry;
#endif
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
import net.minecraft.client.gui.GuiComponent;
#else
import net.minecraft.client.gui.GuiGraphics;
@@ -144,13 +144,13 @@ public class ChangelogScreen extends DhScreen
}
@Override
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
#if MC_VER < MC_1_20_2
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
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2
#if MC_VER < MC_1_20_4
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
@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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
@Override
public List<? extends NarratableEntry> narratables()
{
@@ -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 MC_1_20_2 || MC_1_20_4
#if MC_VER > MC_1_20_1
import net.minecraft.client.gui.GuiGraphics;
#else
import com.mojang.blaze3d.vertex.PoseStack;
@@ -146,13 +146,13 @@ public class UpdateModScreen extends DhScreen
}
@Override
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
#if MC_VER < MC_1_20_2
this.renderBackground(matrices); // Render background
#else
this.renderBackground(matrices, mouseX, mouseY, delta); // Render background
@@ -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 MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
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 MC_1_16
#if MC_VER < MC_1_17_1
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 MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1 || MC_1_20_2
#if MC_VER < MC_1_20_4
Minecraft.crash(report);
#else
Minecraft.getInstance().delayCrash(report);
@@ -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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
import com.mojang.math.Vector3f;
#else
import org.joml.Vector3f;
#endif
#if MC_1_20_2 || MC_1_20_4
#if MC_VER >= MC_1_20_2
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 MC_1_16
#if MC_VER < MC_1_17_1
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 MC_1_19 || MC_1_20
#if MC_VER >= MC_1_19_2
|| 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 MC_1_16
#if MC_VER < MC_1_17_1
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 MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
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 MC_1_16
#if MC_VER < MC_1_17_1
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 MC_1_16
#if MC_VER < MC_1_17_1
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 MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
//FIXME: How to resolve this?
return MC.options.renderDistance;
#else
@@ -321,15 +321,15 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
{
try
{
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
#if MC_VER < MC_1_20_2
LevelRenderer levelRenderer = MC.levelRenderer;
Collection<LevelRenderer.RenderChunkInfo> chunks =
#if MC_1_16 || MC_1_17 levelRenderer.renderChunks;
#if MC_VER < MC_1_18_2 levelRenderer.renderChunks;
#else levelRenderer.renderChunkStorage.get().renderChunks; #endif
return (chunks.stream().map((chunk) -> {
AABB chunkBoundingBox =
#if MC_1_16 || MC_1_17 chunk.chunk.bb;
#if MC_VER < MC_1_18_2 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 MC_1_16
#if MC_VER < MC_1_17_1
Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera();
FluidState fluidState = camera.getFluidInCamera();
Entity entity = camera.getEntity();
@@ -33,7 +33,7 @@ public class ServerPlayerWrapper implements IServerPlayerWrapper
public IServerLevelWrapper getLevel()
{
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
return ServerLevelWrapper.getWrapper(this.serverPlayer.getLevel());
#else
return ServerLevelWrapper.getWrapper(this.serverPlayer.serverLevel());
@@ -136,7 +136,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper
@Override
public int getMinHeight()
{
#if MC_1_16
#if MC_VER < MC_1_17_1
return 0;
#else
return this.level.getMinBuildHeight();
@@ -130,7 +130,7 @@ public class ServerLevelWrapper implements IServerLevelWrapper
@Override
public int getMinHeight()
{
#if MC_1_16
#if MC_VER < MC_1_17_1
return 0;
#else
return level.getMinBuildHeight();
@@ -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 MC_1_19_4 || MC_1_20
#if MC_VER > MC_1_19_4
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 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
#if MC_VER > MC_1_17_1 , level #endif
#if MC_VER > MC_1_18_2 , level.registryAccess().registryOrThrow(
#if MC_VER < MC_1_19_4
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 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
#if MC_VER > MC_1_17_1 , params.level #endif
#if MC_VER > MC_1_18_2 , 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
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
((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 MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
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 MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
else if (isPartial)
{
LOAD_LOGGER.info("Detected old existing chunk at {}", target.getPos());
@@ -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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
import net.minecraft.world.level.chunk.storage.ChunkScanAccess;
#endif
import net.minecraft.world.level.levelgen.WorldGenSettings;
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
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 MC_1_19_4 || MC_1_20
#if MC_VER > MC_1_19_4
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 MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
public final StructureManager structures;
#else
public final StructureTemplateManager structures;
public final RandomState randomState;
#endif
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
biomeManager = new BiomeManager(level, BiomeManager.obfuscateSeed(worldSeed));
chunkScanner = level.getChunkSource().chunkScanner();
#endif
structures = server.getStructureManager();
generator = level.getChunkSource().getGenerator();
fixerUpper = server.getFixerUpper();
#if MC_1_19 || MC_1_20
#if MC_VER > MC_1_19_2
randomState = level.getChunkSource().randomState();
#endif
}
@@ -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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
public StructureCheck structCheck;
#endif
boolean isValid = true;
@@ -63,9 +63,9 @@ public final class ThreadedParameters
previousGlobalParameters = param;
this.level = param.level;
#if MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
this.structFeat = new WorldGenStructFeatManager(param.worldGenSettings, level);
#elif MC_1_16 || MC_1_17 || MC_1_18
#elif MC_VER < MC_1_19_2
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 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 );
#if MC_VER < MC_1_19_4
structFeat = new WorldGenStructFeatManager(param.worldGenSettings, genLevel #if MC_VER > MC_1_18_2 , structCheck #endif );
#else
structFeat = new WorldGenStructFeatManager(param.worldOptions, genLevel, structCheck);
#endif
}
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER > MC_1_18_2 && MC_VER < MC_1_19_2
public void recreateStructureCheck()
{
if (previousGlobalParameters != null)
@@ -37,7 +37,7 @@ import java.util.Objects;
import net.minecraft.core.Registry;
import net.minecraft.core.SectionPos;
#if MC_1_19_4 || MC_1_20
#if MC_VER > MC_1_19_4
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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
import net.minecraft.world.level.levelgen.blending.BlendingData;
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
import net.minecraft.core.Holder;
import net.minecraft.core.RegistryAccess;
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
#endif
#endif
#if MC_1_16_5 || MC_1_17
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
import net.minecraft.world.level.material.Fluids;
#endif
@@ -81,9 +81,9 @@ import net.minecraft.world.level.material.Fluid;
public class ChunkLoader
{
#if MC_1_19 || MC_1_20
#if MC_VER > MC_1_19_2
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 MC_1_18 || MC_1_19 || MC_1_20
#elif MC_VER > MC_1_18_2
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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER > MC_1_18_2
#if MC_VER < MC_1_19_4
Registry<Biome> biomes = level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY);
#else
Registry<Biome> biomes = level.registryAccess().registryOrThrow(Registries.BIOME);
#endif
#if MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
Codec<PalettedContainer<Biome>> biomeCodec = PalettedContainer.codec(
biomes, biomes.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getOrThrow(Biomes.PLAINS));
#elif MC_1_16 || MC_1_17 || MC_1_18
#elif MC_VER < MC_1_19_2
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 MC_1_16 16; #else level.getSectionsCount(); #endif
int i = #if MC_VER < MC_1_17_1 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 MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
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 MC_1_16 sectionYPos #else level.getSectionIndexFromSectionY(sectionYPos) #endif ]
chunkSections[#if MC_VER < MC_1_17_1 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 MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
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 MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
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 MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
CompoundTag tagLevel = chunkData.getCompound("Level");
#else
CompoundTag tagLevel = chunkData;
@@ -237,12 +237,12 @@ public class ChunkLoader
}
ChunkStatus.ChunkType chunkType = readChunkType(tagLevel);
#if MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
if (chunkType != ChunkStatus.ChunkType.LEVELCHUNK)
return null;
#else
BlendingData blendingData = readBlendingData(tagLevel);
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
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 MC_1_18 || MC_1_19 || MC_1_20 , level #endif )
? new UpgradeData(tagLevel.getCompound(TAG_UPGRADE_DATA)#if MC_VER > MC_1_17_1 , level #endif )
: UpgradeData.EMPTY;
boolean isLightOn = tagLevel.getBoolean("isLightOn");
#if MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
ChunkBiomeContainer chunkBiomeContainer = new ChunkBiomeContainer(
level.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY)#if MC_1_18 || MC_1_19 || MC_1_20 , level #endif ,
level.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY)#if MC_VER > MC_1_17_1 , 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 MC_1_18 || MC_1_19 || MC_1_20 , level #endif );
tagLevel.getList("ToBeTicked", 9)#if MC_VER > MC_1_17_1 , 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 MC_1_18 || MC_1_19 || MC_1_20 , level #endif );
tagLevel.getList("LiquidsToBeTicked", 9)#if MC_VER > MC_1_17_1 , level #endif );
#else
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
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 MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
LevelChunk chunk = new LevelChunk((Level) level.getLevel(), chunkPos, chunkBiomeContainer, upgradeData, blockTicks,
fluidTicks, inhabitedTime, levelChunkSections, null);
#else
@@ -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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
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 MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
private ChunkPos overrideCenterPos = null;
public void setOverrideCenter(ChunkPos pos) { overrideCenterPos = pos; }
#if MC_1_16
#if MC_VER < MC_1_17_1
@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 MC_1_18 || MC_1_19 || MC_1_20 , chunkStatus, writeRadius #endif );
super(serverLevel, chunkList #if MC_VER > MC_1_17_1 , 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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
// Bypass BCLib mixin overrides.
@Override
public boolean ensureCanWrite(BlockPos blockPos)
@@ -130,7 +130,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion
{
return false;
}
#if MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
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 MC_1_18 || MC_1_19 || MC_1_20 , true #endif );
chunk = new ImposterProtoChunk((LevelChunk) chunk #if MC_VER > MC_1_18_2 , true #endif );
}
return chunk;
}
@@ -331,7 +331,7 @@ public class DhLitWorldGenRegion extends WorldGenRegion
private Biome _getBiome(BlockPos pos)
{
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
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 MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
int i = (Minecraft.getInstance()).options.biomeBlendRadius;
#else
int i = (Minecraft.getInstance()).options.biomeBlendRadius().get();
@@ -39,7 +39,7 @@ public class DummyLightEngine extends LevelLightEngine
}
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#if MC_VER < MC_1_20_1
@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 MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 , boolean bl #endif ) { }
public void queueSectionData(LightLayer lightLayer, SectionPos sectionPos, @Nullable DataLayer dataLayer #if MC_VER < MC_1_20_1 , 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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
@Override
public int getLightSectionCount() { throw new UnsupportedOperationException("This should never be used!"); }
@Override
@@ -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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
import net.minecraft.world.level.LevelHeightAccessor;
#endif
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.LightChunkGetter;
#if MC_1_20_2 || MC_1_20_4
#if MC_VER > MC_1_20_1
import net.minecraft.world.level.chunk.LightChunk;
#endif
@@ -50,7 +50,7 @@ public class LightGetterAdaptor implements LightChunkGetter
}
@Override
public #if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 BlockGetter #else LightChunk #endif getChunkForLighting(int chunkX, int chunkZ)
public #if MC_VER < MC_1_20_1 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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
public LevelHeightAccessor getLevelHeightAccessor()
{
return heightGetter;
@@ -70,7 +70,7 @@ public class RegionFileStorageExternalCache implements AutoCloseable
{
this.getRegionFileLock.lock();
#if MC_1_16_5 || MC_1_17
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
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
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
// 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
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
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
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
rFile = new RegionFile(regionFilePath.toFile(), storageFolderPath.toFile(), false);
#else
rFile = new RegionFile(regionFilePath, storageFolderPath, false);
@@ -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 MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
import net.minecraft.world.level.StructureFeatureManager;
#else
#if MC_1_19_4 || MC_1_20
#if MC_VER > MC_1_19_4
import net.minecraft.world.level.levelgen.WorldOptions;
#endif
import net.minecraft.world.level.levelgen.structure.Structure;
import net.minecraft.world.level.StructureManager;
#endif
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
import net.minecraft.world.level.levelgen.structure.StructureCheck;
#endif
import net.minecraft.world.level.levelgen.structure.StructureStart;
#if MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
import net.minecraft.world.level.levelgen.feature.StructureFeature;
#endif
public class WorldGenStructFeatManager extends #if MC_1_16 || MC_1_17 || MC_1_18 StructureFeatureManager #else StructureManager #endif
public class WorldGenStructFeatManager extends #if MC_VER < MC_1_19_2 StructureFeatureManager #else StructureManager #endif
{
final WorldGenLevel genLevel;
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
WorldGenSettings worldGenSettings;
#else
WorldOptions worldOptions;
#endif
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
StructureCheck structureCheck;
#endif
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
public WorldGenStructFeatManager(
WorldGenSettings worldGenSettings,
WorldGenLevel genLevel #if MC_1_18 || MC_1_19 || MC_1_20 , StructureCheck structureCheck #endif )
WorldGenLevel genLevel #if MC_VER > MC_1_18_2 , StructureCheck structureCheck #endif )
{
super(genLevel, worldGenSettings #if MC_1_18 || MC_1_19 || MC_1_20 , structureCheck #endif );
super(genLevel, worldGenSettings #if MC_VER > MC_1_18_2 , structureCheck #endif );
this.genLevel = genLevel;
this.worldGenSettings = worldGenSettings;
}
@@ -100,8 +100,8 @@ public class WorldGenStructFeatManager extends #if MC_1_16 || MC_1_17 || MC_1_18
{
if (worldGenRegion == genLevel)
return this;
#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 );
#if MC_VER < MC_1_19_4
return new WorldGenStructFeatManager(worldGenSettings, worldGenRegion #if MC_VER > MC_1_18_2 , structureCheck #endif );
#else
return new WorldGenStructFeatManager(worldOptions, worldGenRegion, structureCheck);
#endif
@@ -113,7 +113,7 @@ public class WorldGenStructFeatManager extends #if MC_1_16 || MC_1_17 || MC_1_18
return genLevel.getChunk(x, z, status, false);
}
#if MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
@Override
public Stream<? extends StructureStart<?>> startsForFeature(
SectionPos sectionPos2,
@@ -140,7 +140,7 @@ public class WorldGenStructFeatManager extends #if MC_1_16 || MC_1_17 || MC_1_18
return chunk.hasAnyStructureReferences();
}
#if MC_1_18_1
#if MC_VER == MC_1_18_1
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public List<? extends StructureStart<?>> startsForFeature(SectionPos sectionPos,
@@ -165,7 +165,7 @@ public class WorldGenStructFeatManager extends #if MC_1_16 || MC_1_17 || MC_1_18
return builder.build();
}
#else
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
@Override
public List<StructureStart> startsForFeature(SectionPos sectionPos, Predicate<ConfiguredStructureFeature<?, ?>> predicate)
{
@@ -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 MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
#endif
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.ProtoChunk;
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
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 MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
environment.params.generator.createBiomes(environment.params.biomes, chunk);
#elif MC_1_16 || MC_1_17 || MC_1_18
#elif MC_VER < MC_1_19_2
chunk = environment.joinSync(environment.params.generator.createBiomes(environment.params.biomes, Runnable::run, Blender.of(worldGenRegion),
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#elif MC_VER < MC_1_19_4
chunk = environment.joinSync(environment.params.generator.createBiomes(environment.params.biomes, Runnable::run, environment.params.randomState, Blender.of(worldGenRegion),
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
#else
@@ -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 MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
#endif
public final class StepFeatures
@@ -65,7 +65,7 @@ public final class StepFeatures
{
try
{
#if MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
worldGenRegion.setOverrideCenter(chunk.getPos());
environment.params.generator.applyBiomeDecoration(worldGenRegion, tParams.structFeat);
#else
@@ -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 MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
#endif
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
#endif
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.ProtoChunk;
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
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 MC_1_16
#if MC_VER < MC_1_17_1
environment.params.generator.fillFromNoise(worldGenRegion, tParams.structFeat, chunk);
#elif MC_1_16 || MC_1_17
#elif MC_VER < MC_1_18_2
chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run,
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
#elif MC_1_16 || MC_1_17 || MC_1_18
#elif MC_VER < MC_1_19_2
chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run, Blender.of(worldGenRegion),
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
#else
@@ -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 MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
#endif
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkStatus;
@@ -77,10 +77,10 @@ public final class StepStructureStart
}
}
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
if (environment.params.worldGenSettings.generateFeatures())
{
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#elif MC_VER < MC_1_19_4
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 MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
environment.params.generator.createStructures(environment.params.registry, tParams.structFeat, chunk, environment.params.structures,
environment.params.worldSeed);
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#elif MC_VER < MC_1_19_4
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 MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
try
{
tParams.structCheck.onStructureLoad(chunk.getPos(), chunk.getAllStarts());
@@ -61,9 +61,9 @@ public final class StepSurface
for (ChunkAccess chunk : chunksToDo)
{
// System.out.println("StepSurface: "+chunk.getPos());
#if MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
environment.params.generator.buildSurfaceAndBedrock(worldGenRegion, chunk);
#elif MC_1_16 || MC_1_17 || MC_1_18
#elif MC_VER < MC_1_19_2
environment.params.generator.buildSurface(worldGenRegion, tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk);
#else
environment.params.generator.buildSurface(worldGenRegion, tParams.structFeat.forWorldGenRegion(worldGenRegion), environment.params.randomState, chunk);
@@ -203,9 +203,9 @@ public class FabricClientProxy
{
float[] matrixFloatArray = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(renderContext.projectionMatrix(), renderContext.tickDelta());
#if MC_1_16_5
#if MC_VER == MC_1_16_5
SeamlessOverdraw.applyLegacyProjectionMatrix(matrixFloatArray);
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#elif MC_VER < MC_1_19_4
renderContext.projectionMatrix().load(FloatBuffer.wrap(matrixFloatArray));
#else
renderContext.projectionMatrix().set(matrixFloatArray);
@@ -59,7 +59,7 @@ public class FabricMain
if (Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get() && SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("bclib"))
ModAccessorInjector.INSTANCE.get(IBCLibAccessor.class).setRenderCustomFog(false); // Remove BCLib's fog
#if MC_1_20_2 || MC_1_20_4
#if MC_VER > MC_1_20_1
if (SingletonInjector.INSTANCE.get(IModChecker.class).isModLoaded("sodium"))
ModAccessorInjector.INSTANCE.get(ISodiumAccessor.class).setFogOcclusion(false); // FIXME: This is a tmp fix for sodium 0.5.0, and 0.5.1. This is fixed in sodium 0.5.2
#endif
@@ -118,7 +118,7 @@ public class FabricMain
ModAccessorInjector.INSTANCE.bind(IBCLibAccessor.class, new BCLibAccessor());
}
#if MC_1_16_5 || MC_1_18 || MC_1_19 || MC_1_20_1
#if MC_VER != MC_1_17_1 && MC_VER <= MC_1_20_1
// 1.17.1 won't support this since there isn't a matching Iris version
if (modChecker.isModLoaded("iris"))
{
@@ -24,7 +24,7 @@ import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
import com.seibel.distanthorizons.core.api.internal.ClientApi;
import com.seibel.distanthorizons.core.api.internal.SharedApi;
import net.minecraft.client.multiplayer.ClientLevel;
#if MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
#endif
import net.minecraft.world.level.chunk.LevelChunk;
import org.spongepowered.asm.mixin.Mixin;
@@ -44,14 +44,14 @@ public class MixinClientLevel
// //Moved to MixinClientPacketListener
// @Inject(method = "<init>", at = @At("TAIL"))
// private void loadWorldEvent(ClientPacketListener clientPacketListener, ClientLevel.ClientLevelData clientLevelData, ResourceKey resourceKey,
// #if MC_1_19 || MC_1_20 Holder holder, #else DimensionType dimensionType, #endif int i,
// #if MC_1_19 || MC_1_20 int j, #endif Supplier supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci)
// #if MC_VER > MC_1_18_2 Holder holder, #else DimensionType dimensionType, #endif int i,
// #if MC_VER > MC_1_18_2 int j, #endif Supplier supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci)
// {
// ClientApi.INSTANCE.clientLevelLoadEvent(WorldWrapper.getWorldWrapper((ClientLevel)(Object)this));
// }
// Moved to overriding the enableChunkLight(...) method over at ClientPacketListener for 1.20+
#if (MC_1_19 || MC_1_20) && (MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19) // Only the setLightReady is only available after 1.18. This ensures the light data is ready.
#if MC_VER > MC_1_18_2 && MC_VER < MC_1_20_1 // Only the setLightReady is only available after 1.18. This ensures the light data is ready.
@Inject(method = "setLightReady", at = @At("HEAD"))
private void onChunkLightReady(int x, int z, CallbackInfo ci)
{
@@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
#if MC_1_20_2 || MC_1_20_4
#if MC_VER > MC_1_20_1
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
import net.minecraft.world.level.chunk.LevelChunk;
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
@@ -31,7 +31,7 @@ public class MixinClientPacketListener
@Inject(method = "handleRespawn", at = @At("RETURN"))
void onHandleRespawnEnd(CallbackInfo ci) { ClientApi.INSTANCE.clientLevelLoadEvent(ClientLevelWrapper.getWrapper(this.level)); }
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
@Inject(method = "cleanup", at = @At("HEAD"))
#else
@Inject(method = "close", at = @At("HEAD"))
@@ -45,7 +45,7 @@ public class MixinClientPacketListener
ClientApi.INSTANCE.onClientOnlyDisconnected();
}
#if MC_1_20_2 || MC_1_20_4
#if MC_VER > MC_1_20_1
@Inject(method = "enableChunkLight", at = @At("TAIL"))
void onEnableChunkLight(LevelChunk chunk, int x, int z, CallbackInfo ci)
{
@@ -35,7 +35,7 @@ import net.minecraft.client.renderer.FogRenderer.FogMode;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
#if MC_1_16
#if MC_VER < MC_1_17_1
import net.minecraft.world.level.material.FluidState;
#else
import net.minecraft.world.level.material.FogType;
@@ -50,14 +50,14 @@ public class MixinFogRenderer
private static final float A_EVEN_LARGER_VALUE = 42069420694206942069.F;
@Inject(at = @At("RETURN"), method = "setupFog")
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, CallbackInfo callback)
{
#else
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float g, CallbackInfo callback)
{
#endif
#if MC_1_16
#if MC_VER < MC_1_17_1
FluidState fluidState = camera.getFluidInCamera();
boolean cameraNotInFluid = fluidState.isEmpty();
#else
@@ -71,7 +71,7 @@ public class MixinFogRenderer
&& !SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class).isFogStateSpecial()
&& Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get())
{
#if MC_1_16
#if MC_VER < MC_1_17_1
RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE);
RenderSystem.fogEnd(A_EVEN_LARGER_VALUE);
#else
@@ -16,7 +16,7 @@ public class MixinGameRenderer
private static final Logger LOGGER = LogManager.getLogger(MixinGameRenderer.class.getSimpleName());
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
// FIXME: This I think will dup multiple renderStartupEvent calls...
@Inject(method = {"reloadShaders", "preloadUiShader"}, at = @At("TAIL"))
public void onStartupShaders(CallbackInfo ci)
@@ -20,7 +20,7 @@
package com.seibel.distanthorizons.fabric.mixins.client;
import com.mojang.blaze3d.vertex.PoseStack;
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
import com.mojang.math.Matrix4f;
#else
import net.minecraft.client.Camera;
@@ -67,7 +67,7 @@ public class MixinLevelRenderer
// Inject rendering at first call to renderChunkLayer
// HEAD or RETURN
#if MC_1_16
#if MC_VER < MC_1_17_1
@Inject(at = @At("RETURN"), method = "renderSky(Lcom/mojang/blaze3d/vertex/PoseStack;F)V")
private void renderSky(PoseStack matrixStackIn, float partialTicks, CallbackInfo callback)
{
@@ -84,17 +84,17 @@ public class MixinLevelRenderer
}
#endif
#if MC_1_16
#if MC_VER < MC_1_17_1
@Inject(at = @At("HEAD"),
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDD)V",
cancellable = true)
private void renderChunkLayer(RenderType renderType, PoseStack matrixStackIn, double xIn, double yIn, double zIn, CallbackInfo callback)
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#elif MC_VER < MC_1_19_4
@Inject(at = @At("HEAD"),
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V",
cancellable = true)
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
#elif MC_VER < MC_1_20_2
@Inject(at = @At("HEAD"),
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
cancellable = true)
@@ -113,10 +113,10 @@ public class MixinLevelRenderer
}
}
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
@Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel")
public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci)
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#elif MC_VER < MC_1_20_1
@Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel")
public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci)
#else
@@ -25,8 +25,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Minecraft.class)
public class MixinMinecraft
{
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
#if MC_1_20_1
#if MC_VER < MC_1_20_2
#if MC_VER == MC_1_20_1
@Redirect(
method = "Lnet/minecraft/client/Minecraft;setInitialScreen(Lcom/mojang/realmsclient/client/RealmsClient;Lnet/minecraft/server/packs/resources/ReloadInstance;Lnet/minecraft/client/main/GameConfig$QuickPlayData;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V")
@@ -61,7 +61,7 @@ public class MixinMinecraft
}
#endif
#if MC_1_20_4
#if MC_VER > MC_1_20_2
@Redirect(
method = "Lnet/minecraft/client/Minecraft;onGameLoadFinished(Lnet/minecraft/client/Minecraft$GameLoadCookie;)V",
at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V")
@@ -26,7 +26,7 @@ import com.seibel.distanthorizons.core.config.Config;
import net.minecraft.client.gui.screens.OptionsScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
import net.minecraft.network.chat.TranslatableComponent;
#endif
import net.minecraft.resources.ResourceLocation;
@@ -57,7 +57,7 @@ public class MixinOptionsScreen extends Screen
private void lodconfig$init(CallbackInfo ci)
{
if (Config.Client.optionsButton.get())
this. #if MC_1_16 addButton #else addRenderableWidget #endif
this. #if MC_VER < MC_1_17_1 addButton #else addRenderableWidget #endif
(new TexturedButtonWidget(
// Where the button is on the screen
this.width / 2 - 180, this.height / 6 - 12,
@@ -71,7 +71,7 @@ public class MixinOptionsScreen extends Screen
// For now it goes to the client option by default
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(GetConfigScreen.getScreen(this)),
// Add a title to the utton
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
new TranslatableComponent(ModInfo.ID + ".title")));
#else
Component.translatable(ModInfo.ID + ".title")));
@@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
public class MixinTextureUtil
{
@Redirect(method = "Lcom/mojang/blaze3d/platform/TextureUtil;prepareImage(Lcom/mojang/blaze3d/platform/NativeImage$InternalGlFormat;IIII)V",
at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;_texParameter(IIF)V", #if MC_1_16_5 remap = true #else remap = false #endif))
at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;_texParameter(IIF)V", #if MC_VER == MC_1_16_5 remap = true #else remap = false #endif))
private static void setLodBias(int target, int pname, float param)
{
float biasValue = Config.Client.Advanced.Graphics.AdvancedGraphics.lodBias.get().floatValue();
@@ -31,7 +31,7 @@ import org.spongepowered.asm.mixin.Mixin;
@Deprecated // TODO: Not sure if this is needed anymore
public class MixinServerLevel
{
// #if MC_1_16
// #if MC_VER < MC_1_17_1
// @Inject(method = "save", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerChunkCache;save(Z)V", shift = At.Shift.AFTER))
// private void saveWorldEvent(ProgressListener progressListener, boolean bl, boolean bl2, CallbackInfo ci) {
// Main.client_proxy.worldSaveEvent();
@@ -2,7 +2,7 @@ package com.seibel.distanthorizons.fabric.mixins.mods.sodium;
/* Removed since DH now uses Indium so we can use the Fabric rendering API instead
#if MC_1_20_2 || MC_1_20_4
#if MC_VER > MC_1_20_1
// Sodium 0.5
import com.mojang.blaze3d.vertex.PoseStack;
import com.seibel.distanthorizons.core.api.internal.ClientApi;
@@ -55,7 +55,7 @@ public class MixinSodiumRenderer
}
#elif MC_1_18 || MC_1_19 || MC_1_20
#elif MC_VER > MC_1_17_1
// Sodium 0.3 to 0.4
import com.seibel.distanthorizons.core.api.internal.ClientApi;
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
@@ -22,7 +22,7 @@ package com.seibel.distanthorizons.fabric.mixins.server;
import org.spongepowered.asm.mixin.Mixin;
import net.minecraft.world.level.chunk.ChunkGenerator;
#if MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -37,7 +37,7 @@ public class MixinChunkMap
// 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_1_16_5 || MC_1_17
#if MC_1_16_5 || MC_1_17_1
if (chunk.isUnsaved() || chunk.getUpgradeData() != null || !chunk.isLightCorrect())
{
return;
@@ -55,7 +55,7 @@ public class MixinChunkMap
//==================//
// some chunks may be missing their biomes, which cause issues when attempting to save them
#if MC_1_16_5 || MC_1_17
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
if (chunk.getBiomes() == null)
{
return;
@@ -50,7 +50,7 @@ public class MixinUtilBackgroundThread
}
}
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
@Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;",
at = @At("HEAD"), cancellable = true)
private static void overrideUtil$wrapThreadWithTaskName(String string, Runnable r, CallbackInfoReturnable<Runnable> ci)
@@ -62,7 +62,7 @@ public class MixinUtilBackgroundThread
}
}
#endif
#if MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
@Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;",
at = @At("HEAD"), cancellable = true)
private static void overrideUtil$wrapThreadWithTaskNameForSupplier(String string, Supplier<?> r, CallbackInfoReturnable<Supplier<?>> ci)
@@ -22,7 +22,7 @@ package com.seibel.distanthorizons.fabric.mixins.server.unsafe;
import org.spongepowered.asm.mixin.Mixin;
//FIXME: Is this still needed?
#if MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
import net.minecraft.util.ThreadingDetector;
import org.spongepowered.asm.mixin.Mutable;
@@ -1,8 +1,8 @@
package com.seibel.distanthorizons.fabric.wrappers.modAccessor;
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IBCLibAccessor;
#if MC_1_16_5 || MC_1_17 || MC_1_20_4 // These versions either don't have BCLib, or the implementation is different
#elif MC_1_18
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 || MC_VER == MC_1_20_4 // These versions either don't have BCLib, or the implementation is different
#elif MC_VER == MC_1_18_2
import ru.bclib.config.ClientConfig;
import ru.bclib.config.Configs;
#else
@@ -17,7 +17,7 @@ public class BCLibAccessor implements IBCLibAccessor
public void setRenderCustomFog(boolean newValue)
{
#if !(MC_1_16_5 || MC_1_17 || MC_1_20_4) // These versions either don't have BCLib, or the implementation is different
#if !(MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 || MC_VER == MC_1_20_4) // These versions either don't have BCLib, or the implementation is different
// Change the value of CUSTOM_FOG_RENDERING in the bclib client config
// This disabled fog from rendering within bclib
@@ -19,7 +19,7 @@
package com.seibel.distanthorizons.fabric.wrappers.modAccessor;
#if MC_1_16_5 || MC_1_18 || MC_1_19 || MC_1_20_1
#if MC_VER != MC_1_17_1 && MC_VER <= MC_1_20_1
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor;
import net.coderbot.iris.Iris;
@@ -33,7 +33,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.ISodiumAcce
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
import net.minecraft.client.Minecraft;
#if MC_1_16
#if MC_VER < MC_1_17_1
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.Packet;
import net.minecraft.world.entity.Entity;
@@ -60,21 +60,21 @@ public class SodiumAccessor implements ISodiumAccessor
return "Sodium-Fabric";
}
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
@Override
public HashSet<DhChunkPos> getNormalRenderedChunks()
{
SodiumWorldRenderer renderer = SodiumWorldRenderer.instance();
LevelHeightAccessor height = Minecraft.getInstance().level;
#if MC_1_20_2 || MC_1_20_4
#if MC_VER > MC_1_20_1
// TODO: This is just a tmp solution, use a proper solution later
return MC_RENDER.getMaximumRenderedChunks().stream().filter((DhChunkPos chunk) -> {
return (renderer.isBoxVisible(
chunk.getMinBlockX() + 1, height.getMinBuildHeight() + 1, chunk.getMinBlockZ() + 1,
chunk.getMinBlockX() + 15, height.getMaxBuildHeight() - 1, chunk.getMinBlockZ() + 15));
}).collect(Collectors.toCollection(HashSet::new));
#elif MC_1_19 || MC_1_20
#elif MC_VER > MC_1_18_2
// 0b11 = Lighted chunk & loaded chunk
return renderer.getChunkTracker().getChunks(0b00).filter(
(long l) -> {
@@ -134,7 +134,7 @@ public class SodiumAccessor implements ISodiumAccessor
@Override
public void setFogOcclusion(boolean b)
{
#if MC_1_20_2 || MC_1_20_4
#if MC_VER > MC_1_20_1
me.jellysquid.mods.sodium.client.SodiumClientMod.options().performance.useFogOcclusion = b;
#endif
}
@@ -36,7 +36,7 @@ import com.seibel.distanthorizons.coreapi.ModInfo;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.client.multiplayer.ClientLevel;
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.event.world.WorldEvent;
#else
@@ -44,7 +44,7 @@ import net.minecraftforge.event.level.ChunkEvent;
import net.minecraftforge.event.level.LevelEvent;
#endif
#if MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
import net.minecraftforge.client.event.RenderLevelStageEvent;
#endif
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@@ -79,7 +79,7 @@ public class ForgeClientProxy
// private static SimpleChannel multiversePluginChannel;
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
private static LevelAccessor GetEventLevel(WorldEvent e) { return e.getWorld(); }
#else
private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); }
@@ -107,7 +107,7 @@ public class ForgeClientProxy
//==============//
@SubscribeEvent
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
public void clientLevelLoadEvent(WorldEvent.Load event)
#else
public void clientLevelLoadEvent(LevelEvent.Load event)
@@ -115,7 +115,7 @@ public class ForgeClientProxy
{
LOGGER.info("level load");
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
LevelAccessor level = event.getWorld();
#else
LevelAccessor level = event.getLevel();
@@ -131,7 +131,7 @@ public class ForgeClientProxy
ClientApi.INSTANCE.clientLevelLoadEvent(clientLevelWrapper);
}
@SubscribeEvent
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
public void clientLevelUnloadEvent(WorldEvent.Unload event)
#else
public void clientLevelUnloadEvent(LevelEvent.Load event)
@@ -139,7 +139,7 @@ public class ForgeClientProxy
{
LOGGER.info("level unload");
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
LevelAccessor level = event.getWorld();
#else
LevelAccessor level = event.getLevel();
@@ -165,7 +165,7 @@ public class ForgeClientProxy
{
LOGGER.trace("interact or block place event at blockPos: " + event.getPos());
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
LevelAccessor level = event.getWorld();
#else
LevelAccessor level = event.getLevel();
@@ -179,7 +179,7 @@ public class ForgeClientProxy
{
LOGGER.trace("break or block attack at blockPos: " + event.getPos());
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
LevelAccessor level = event.getWorld();
#else
LevelAccessor level = event.getLevel();
@@ -217,7 +217,7 @@ public class ForgeClientProxy
//==============//
@SubscribeEvent
public void registerKeyBindings(#if MC_1_16 || MC_1_17 || MC_1_18 InputEvent.KeyInputEvent #else InputEvent.Key #endif event)
public void registerKeyBindings(#if MC_VER < MC_1_19_2 InputEvent.KeyInputEvent #else InputEvent.Key #endif event)
{
if (Minecraft.getInstance().player == null)
{
@@ -298,15 +298,15 @@ public class ForgeClientProxy
//===========//
@SubscribeEvent
#if MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
public void afterLevelRenderEvent(RenderLevelStageEvent event)
#else
public void afterLevelRenderEvent(TickEvent.RenderTickEvent event)
#endif
{
#if MC_1_20_2 || MC_1_20_4
#if MC_VER > MC_1_20_1
if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_LEVEL)
#elif MC_1_19 || MC_1_20
#elif MC_VER > MC_1_18_2
if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_SOLID_BLOCKS)
#else
// FIXME: Is this the correct location for 1.16 & 1.17???
@@ -39,7 +39,7 @@ import com.seibel.distanthorizons.forge.wrappers.modAccessor.OptifineAccessor;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.core.Direction;
#if MC_1_19 || MC_1_20
#if MC_VER > MC_1_19_2
import net.minecraft.util.RandomSource;
#endif
import net.minecraft.world.level.ColorResolver;
@@ -51,11 +51,11 @@ import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.*;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
#if MC_1_16
#if MC_VER < MC_1_17_1
import net.minecraftforge.fml.ExtensionPoint;
#elif MC_1_17
#elif MC_VER == MC_1_17_1
import net.minecraftforge.fmlclient.ConfigGuiHandler;
#elif MC_1_18
#elif MC_VER > MC_1_18_2 && MC_VER < MC_1_19_2
import net.minecraftforge.client.ConfigGuiHandler;
#else
import net.minecraftforge.client.ConfigScreenHandler;
@@ -64,7 +64,7 @@ import net.minecraftforge.client.ConfigScreenHandler;
import org.apache.logging.log4j.Logger;
// these imports change due to forge refactoring classes in 1.19
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
import net.minecraftforge.client.model.data.ModelDataMap;
import java.util.Random;
@@ -128,10 +128,10 @@ public class ForgeMain implements LodForgeMethodCaller
ModAccessorInjector.INSTANCE.bind(IOptifineAccessor.class, new OptifineAccessor());
}
#if MC_1_16
#if MC_VER < MC_1_17_1
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY,
() -> (client, parent) -> GetConfigScreen.getScreen(parent));
#elif MC_1_16 || MC_1_17 || MC_1_18
#elif MC_VER >= MC_1_17_1 && MC_VER <= MC_1_19_2
ModLoadingContext.get().registerExtensionPoint(ConfigGuiHandler.ConfigGuiFactory.class,
() -> new ConfigGuiHandler.ConfigGuiFactory((client, parent) -> GetConfigScreen.getScreen(parent)));
#else
@@ -169,14 +169,14 @@ public class ForgeMain implements LodForgeMethodCaller
LOGGER.info("Mod Post-Initialized");
}
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
private final ModelDataMap modelData = new ModelDataMap.Builder().build();
#else
private final ModelData modelData = ModelData.EMPTY;
#endif
@Override
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
public List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random)
{
return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData);
@@ -184,14 +184,14 @@ public class ForgeMain implements LodForgeMethodCaller
#else
public List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random)
{
return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData #if MC_1_19 || MC_1_20 , RenderType.solid() #endif );
return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData #if MC_VER > MC_1_19_2 , RenderType.solid() #endif );
}
#endif
@Override //TODO: Check this if its still needed
public int colorResolverGetColor(ColorResolver resolver, Biome biome, double x, double z)
{
#if MC_1_17______Still_needed
#if MC_1_17_1______Still_needed
return resolver.m_130045_(biome, x, z);
#else
return resolver.getColor(biome, x, z);
@@ -14,7 +14,7 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraftforge.event.TickEvent;
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.event.world.WorldEvent;
#else
@@ -23,10 +23,10 @@ import net.minecraftforge.event.level.LevelEvent;
#endif
import net.minecraftforge.eventbus.api.SubscribeEvent;
#if MC_1_16_5
#if MC_VER == MC_1_16_5
import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
#elif MC_1_17
#elif MC_VER == MC_1_17_1
import net.minecraftforge.fmlserverevents.FMLServerAboutToStartEvent;
import net.minecraftforge.fmlserverevents.FMLServerStoppingEvent;
#else
@@ -41,7 +41,7 @@ import java.util.function.Supplier;
public class ForgeServerProxy
{
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
private static LevelAccessor GetEventLevel(WorldEvent e) { return e.getWorld(); }
#else
private static LevelAccessor GetEventLevel(LevelEvent e) { return e.getLevel(); }
@@ -81,21 +81,21 @@ public class ForgeServerProxy
// ServerWorldLoadEvent
@SubscribeEvent
public void dedicatedWorldLoadEvent(#if MC_1_16_5 || MC_1_17 FMLServerAboutToStartEvent #else ServerAboutToStartEvent #endif event)
public void dedicatedWorldLoadEvent(#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 FMLServerAboutToStartEvent #else ServerAboutToStartEvent #endif event)
{
this.serverApi.serverLoadEvent(this.isDedicated);
}
// ServerWorldUnloadEvent
@SubscribeEvent
public void serverWorldUnloadEvent(#if MC_1_16_5 || MC_1_17 FMLServerStoppingEvent #else ServerStoppingEvent #endif event)
public void serverWorldUnloadEvent(#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1 FMLServerStoppingEvent #else ServerStoppingEvent #endif event)
{
this.serverApi.serverUnloadEvent();
}
// ServerLevelLoadEvent
@SubscribeEvent
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
public void serverLevelLoadEvent(WorldEvent.Load event)
#else
public void serverLevelLoadEvent(LevelEvent.Load event)
@@ -109,7 +109,7 @@ public class ForgeServerProxy
// ServerLevelUnloadEvent
@SubscribeEvent
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
public void serverLevelUnloadEvent(WorldEvent.Unload event)
#else
public void serverLevelUnloadEvent(LevelEvent.Unload event)
@@ -16,7 +16,7 @@ public class MixinClientPacketListener
@Inject(method = "handleLogin", at = @At("RETURN"))
void onHandleLoginEnd(CallbackInfo ci) { ClientApi.INSTANCE.onClientOnlyConnected(); }
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
@Inject(method = "cleanup", at = @At("HEAD"))
#else
@Inject(method = "close", at = @At("HEAD"))
@@ -35,7 +35,7 @@ import net.minecraft.client.renderer.FogRenderer.FogMode;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
#if MC_1_16
#if MC_VER < MC_1_17_1
import net.minecraft.world.level.material.FluidState;
#else
import net.minecraft.world.level.material.FogType;
@@ -53,10 +53,10 @@ public class MixinFogRenderer
@Inject(at = @At("RETURN"),
method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZF)V",
remap = #if MC_1_17 || MC_1_18 false #else true #endif ) // Remap messiness due to this being weird in forge
remap = #if MC_VER == MC_1_17_1 || MC_VER == MC_1_18_2 false #else true #endif ) // Remap messiness due to this being weird in forge
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback)
{
#if MC_1_16
#if MC_VER < MC_1_17_1
FluidState fluidState = camera.getFluidInCamera();
boolean cameraNotInFluid = fluidState.isEmpty();
#else
@@ -71,7 +71,7 @@ public class MixinFogRenderer
&& !SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class).isFogStateSpecial()
&& Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get())
{
#if MC_1_16
#if MC_VER < MC_1_17_1
RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE);
RenderSystem.fogEnd(A_EVEN_LARGER_VALUE);
#else
@@ -16,7 +16,7 @@ public class MixinGameRenderer
{
private static final Logger LOGGER = LogManager.getLogger(MixinGameRenderer.class.getSimpleName());
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
// FIXME: This I think will dup multiple renderStartupEvent calls...
@Inject(method = {"reloadShaders", "preloadUiShader"}, at = @At("TAIL"))
public void onStartupShaders(CallbackInfo ci)
@@ -20,7 +20,7 @@
package com.seibel.distanthorizons.forge.mixins.client;
import com.mojang.blaze3d.vertex.PoseStack;
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
import com.mojang.math.Matrix4f;
#else
import net.minecraft.client.Camera;
@@ -52,7 +52,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.nio.FloatBuffer;
#if MC_1_16
#if MC_VER < MC_1_17_1
import org.lwjgl.opengl.GL15;
#endif
@@ -84,7 +84,7 @@ public class MixinLevelRenderer
throw new NullPointerException("Null cannot be cast to non-null type.");
}
#if MC_1_16
#if MC_VER < MC_1_17_1
@Inject(at = @At("RETURN"), method = "renderSky(Lcom/mojang/blaze3d/vertex/PoseStack;F)V")
private void renderSky(PoseStack matrixStackIn, float partialTicks, CallbackInfo callback)
#else
@@ -99,17 +99,17 @@ public class MixinLevelRenderer
// TODO: Can we move this to forge's client proxy similarly to how fabric does it
#if MC_1_16
#if MC_VER < MC_1_17_1
@Inject(at = @At("HEAD"),
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDD)V",
cancellable = true)
private void renderChunkLayer(RenderType renderType, PoseStack matrixStackIn, double xIn, double yIn, double zIn, CallbackInfo callback)
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#elif MC_VER < MC_1_19_4
@Inject(at = @At("HEAD"),
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V",
cancellable = true)
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
#elif MC_VER < MC_1_20_2
@Inject(at = @At("HEAD"),
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
cancellable = true)
@@ -122,7 +122,7 @@ public class MixinLevelRenderer
#endif
{
// get MC's model view and projection matrices
#if MC_1_16_5
#if MC_VER == MC_1_16_5
// get the matrices from the OpenGL fixed pipeline
float[] mcProjMatrixRaw = new float[16];
GL15.glGetFloatv(GL15.GL_PROJECTION_MATRIX, mcProjMatrixRaw);
@@ -149,9 +149,9 @@ public class MixinLevelRenderer
{
float[] matrixFloatArray = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(mcProjectionMatrix, previousPartialTicks);
#if MC_1_16_5
#if MC_VER == MC_1_16_5
SeamlessOverdraw.applyLegacyProjectionMatrix(matrixFloatArray);
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#elif MC_VER < MC_1_19_4
projectionMatrix.load(FloatBuffer.wrap(matrixFloatArray));
#else
projectionMatrix.set(matrixFloatArray);
@@ -165,10 +165,10 @@ public class MixinLevelRenderer
}
}
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19_2
#if MC_VER < MC_1_19_4
@Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel")
public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci)
#elif MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19
#elif MC_VER < MC_1_20_1
@Inject(at = @At(value = "TAIL", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runUpdates(IZZ)I"), method = "renderLevel")
public void callAfterRunUpdates(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci)
#else
@@ -25,8 +25,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Minecraft.class)
public class MixinMinecraft
{
#if MC_1_16 || MC_1_17 || MC_1_18 || MC_1_19 || MC_1_20_1
#if MC_1_20_1
#if MC_VER < MC_1_20_2
#if MC_VER == MC_1_20_1
@Redirect(
method = "Lnet/minecraft/client/Minecraft;setInitialScreen(Lcom/mojang/realmsclient/client/RealmsClient;Lnet/minecraft/server/packs/resources/ReloadInstance;Lnet/minecraft/client/main/GameConfig$QuickPlayData;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V")
@@ -61,7 +61,7 @@ public class MixinMinecraft
}
#endif
#if MC_1_20_4
#if MC_VER > MC_1_20_2
@Redirect(
method = "Lnet/minecraft/client/Minecraft;onGameLoadFinished(Lnet/minecraft/client/Minecraft$GameLoadCookie;)V",
at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V")
@@ -26,7 +26,7 @@ import com.seibel.distanthorizons.core.config.Config;
import net.minecraft.client.gui.screens.OptionsScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
import net.minecraft.network.chat.TranslatableComponent;
#endif
import net.minecraft.resources.ResourceLocation;
@@ -57,7 +57,7 @@ public class MixinOptionsScreen extends Screen
private void lodconfig$init(CallbackInfo ci)
{
if (Config.Client.optionsButton.get())
this. #if MC_1_16 addButton #else addRenderableWidget #endif
this. #if MC_VER < MC_1_17_1 addButton #else addRenderableWidget #endif
(new TexturedButtonWidget(
// Where the button is on the screen
this.width / 2 - 180, this.height / 6 - 12,
@@ -71,7 +71,7 @@ public class MixinOptionsScreen extends Screen
// For now it goes to the client option by default
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(GetConfigScreen.getScreen(this)),
// Add a title to the button
#if MC_1_16 || MC_1_17 || MC_1_18
#if MC_VER < MC_1_19_2
new TranslatableComponent(ModInfo.ID + ".title")));
#else
Component.translatable(ModInfo.ID + ".title")));
@@ -22,7 +22,7 @@ package com.seibel.distanthorizons.forge.mixins.server;
import org.spongepowered.asm.mixin.Mixin;
import net.minecraft.world.level.chunk.ChunkGenerator;
#if MC_1_16 || MC_1_17
#if MC_VER < MC_1_18_2
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -3,13 +3,13 @@ package com.seibel.distanthorizons.forge.mixins.server;
import net.minecraft.world.level.chunk.ChunkGenerator;
import org.spongepowered.asm.mixin.Mixin;
#if MC_1_16_5
#if MC_VER == MC_1_16_5
@Mixin(ChunkGenerator.class)
class MixinTFChunkGenerator
{
// not currently implemented, attempting to run with the mod enabled in the IDE causes the game to lock up
}
#elif MC_1_16
#elif MC_VER < MC_1_17_1
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -50,7 +50,7 @@ public class MixinUtilBackgroundThread
}
}
#if MC_1_18 || MC_1_19 || MC_1_20
#if MC_VER > MC_1_17_1
@Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;",
at = @At("HEAD"), cancellable = true)
private static void overrideUtil$wrapThreadWithTaskName(String string, Runnable r, CallbackInfoReturnable<Runnable> ci)
@@ -62,7 +62,7 @@ public class MixinUtilBackgroundThread
}
}
#endif
#if MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
@Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;",
at = @At("HEAD"), cancellable = true)
private static void overrideUtil$wrapThreadWithTaskNameForSupplier(String string, Supplier<?> r, CallbackInfoReturnable<Supplier<?>> ci)
@@ -20,7 +20,7 @@
package com.seibel.distanthorizons.forge.mixins.server.unsafe;
import org.spongepowered.asm.mixin.Mixin;
#if MC_1_19 || MC_1_20
#if MC_VER > MC_1_18_2
import net.minecraft.util.ThreadingDetector;
import org.spongepowered.asm.mixin.Mutable;
+1 -1
View File
@@ -47,4 +47,4 @@ versionStr=
mcVer=1.20.2
# Defines the maximum amount of memory Minecraft is allowed when run in a developement environment
minecraftMemoryJavaArg="-Xmx4G"
#minecraftMemoryJavaArg="-Xmx4G"