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