diff --git a/build.gradle b/build.gradle index 3d152fce7..ca35855bc 100644 --- a/build.gradle +++ b/build.gradle @@ -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 mcVers, int mcIndex) { +def writeBuildGradlePredefine(List mcVers, int mcIndex) +{ ArrayList redefineList = new ArrayList() - - 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 diff --git a/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java b/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java index 0d9b8da4a..66883973a 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/forge/LodForgeMethodCaller.java @@ -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 getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random); // FIXME: For 1.19 #else List getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random); // FIXME: For 1.19 diff --git a/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java b/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java index 264dc636a..e3d3f142c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java @@ -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(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java index c11e57c77..9d81c9264 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/McObjectConverter.java @@ -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; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/VersionConstants.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/VersionConstants.java index 643a23f25..2853bb0c2 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/VersionConstants.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/VersionConstants.java @@ -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(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/WrapperFactory.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/WrapperFactory.java index 6bc8d7907..5992f67a6 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/WrapperFactory.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/WrapperFactory.java @@ -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 diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java index 1ea448094..3440b5b4d 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BiomeWrapper.java @@ -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 WRAPPER_BY_BIOME = new ConcurrentHashMap<>(); #else public static final ConcurrentMap, 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; @@ -104,7 +104,7 @@ public class BiomeWrapper implements IBiomeWrapper // constructors // //==============// - static public IBiomeWrapper getBiomeWrapper(#if PRE_MC_1_18_2 Biome #else Holder #endif biome, ILevelWrapper levelWrapper) + static public IBiomeWrapper getBiomeWrapper(#if MC_1_16 || MC_1_17 Biome #else Holder #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 #endif biome, ILevelWrapper levelWrapper) + private BiomeWrapper(#if MC_1_16 || MC_1_17 Biome #else Holder #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 = new Holder.Direct<>(unwrappedBiome); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java index 25aa8dd9b..6c6c12999 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/BlockStateWrapper.java @@ -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 diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TextureAtlasSpriteWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TextureAtlasSpriteWrapper.java index b5334f956..da309c851 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TextureAtlasSpriteWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TextureAtlasSpriteWrapper.java @@ -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; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java index 7a8a92e6e..ed4cad81a 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideFast.java @@ -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 Optional getBlockEntity(BlockPos blockPos, BlockEntityType blockEntityType) { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java index 94015d4de..6ff85ee1c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintGetterOverrideSmooth.java @@ -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 Optional getBlockEntity(BlockPos blockPos, BlockEntityType blockEntityType) { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelOverrider.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelOverrider.java index 4f35469ea..c4728dfee 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelOverrider.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelOverrider.java @@ -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 #else Biome #endif biome) + private Biome _unwrap(#if MC_1_18 || MC_1_19 || MC_1_20 Holder #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() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java index c4f4d4438..5aacf7efb 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/TintWithoutLevelSmoothOverrider.java @@ -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 #else Biome #endif biome) + private Biome _unwrap(#if MC_1_18 || MC_1_19 || MC_1_20 Holder #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() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockDetailMap.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockDetailMap.java index e078d6685..864be6cd5 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockDetailMap.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockDetailMap.java @@ -29,7 +29,7 @@ import java.util.concurrent.ConcurrentHashMap; public class ClientBlockDetailMap { private final ConcurrentHashMap blockCache = new ConcurrentHashMap<>(); - //private final ConcurrentHashMap<#if PRE_MC_1_18_2 Biome #else Holder #endif, Biome> biomeMap = new ConcurrentHashMap<>(); + //private final ConcurrentHashMap<#if MC_1_16 || MC_1_17 Biome #else Holder #endif, Biome> biomeMap = new ConcurrentHashMap<>(); private final ClientLevelWrapper level; public ClientBlockDetailMap(ClientLevelWrapper level) { this.level = level; } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockStateCache.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockStateCache.java index a14db741f..9f8de4c95 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockStateCache.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ClientBlockStateCache.java @@ -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 BLOCK_STATES_THAT_NEED_LEVEL = new HashSet<>(); private static final HashSet 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())); } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ServerBlockDetailMap.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ServerBlockDetailMap.java index 453761f53..28b69397f 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ServerBlockDetailMap.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/cache/ServerBlockDetailMap.java @@ -29,7 +29,7 @@ import net.minecraft.world.level.block.state.BlockState; public class ServerBlockDetailMap { private final ConcurrentHashMap blockCache = new ConcurrentHashMap<>(); - //private final ConcurrentHashMap<#if PRE_MC_1_18_2 Biome #else Holder #endif, Biome> biomeMap = new ConcurrentHashMap<>(); + //private final ConcurrentHashMap<#if MC_1_16 || MC_1_17 Biome #else Holder #endif, Biome> biomeMap = new ConcurrentHashMap<>(); private final ServerLevelWrapper level; public ServerBlockDetailMap(ServerLevelWrapper level) { this.level = level; } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java index 0bbb83552..3c5b2a2d4 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/chunk/ChunkWrapper.java @@ -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(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java index ac5a98482..1b041665f 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java @@ -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 narratables() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/DhScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/DhScreen.java index fbeb7f4c3..37e1cc0d9 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/DhScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/DhScreen.java @@ -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); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java index 1bd0655a1..86183b3b2 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/GuiHelper.java @@ -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); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java index aaa804181..572d4ef1d 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java @@ -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); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java index 866ef61c7..037034280 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/TexturedButtonWidget.java @@ -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(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java index 0b3b493db..be2c549a9 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java @@ -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 narratables() { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java index 5addfc306..a03323457 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/UpdateModScreen.java @@ -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 diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java index 208387960..4fc7d68e8 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftClientWrapper.java @@ -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); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftRenderWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftRenderWrapper.java index 6a05e158f..0131998fc 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftRenderWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/minecraft/MinecraftRenderWrapper.java @@ -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 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(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/ServerPlayerWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/ServerPlayerWrapper.java index b327c32a4..eb70a535b 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/ServerPlayerWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/ServerPlayerWrapper.java @@ -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()); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java index 08ffe1656..78138d85b 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ClientLevelWrapper.java @@ -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(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ServerLevelWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ServerLevelWrapper.java index b6fea22b8..28d7c6281 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ServerLevelWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/world/ServerLevelWrapper.java @@ -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(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/BatchGenerationEnvironment.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/BatchGenerationEnvironment.java index 8d238f508..b0549a495 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/BatchGenerationEnvironment.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/BatchGenerationEnvironment.java @@ -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()); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java index aafc01bb3..d3240b09a 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/GlobalParameters.java @@ -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 } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java index d5e391be5..3b6bb23d5 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/ThreadedParameters.java @@ -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) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index dda02fa40..9986c402c 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -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> 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> 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 biomes = level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); #else Registry biomes = level.registryAccess().registryOrThrow(Registries.BIOME); #endif - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 Codec> 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>> 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 blockStateContainer; - #if PRE_MC_1_18_2 + #if MC_1_16 || MC_1_17 PalettedContainer biomeContainer; #else PalettedContainer> 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(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(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>(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 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 == 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 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 == 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 blockTicks = LevelChunkTicks.load(tagLevel.getList(BLOCK_TICKS_TAG_18, 10), string -> Registry.BLOCK.getOptional(ResourceLocation.tryParse(string)), chunkPos); LevelChunkTicks 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 diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DhLitWorldGenRegion.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DhLitWorldGenRegion.java index 34a27482d..b384ca2bb 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DhLitWorldGenRegion.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DhLitWorldGenRegion.java @@ -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 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(); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java index 106af9f4a..ad6334ece 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/DummyLightEngine.java @@ -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 diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/LightGetterAdaptor.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/LightGetterAdaptor.java index b18b8f41b..91add021d 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/LightGetterAdaptor.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/LightGetterAdaptor.java @@ -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; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java index 94fc0a2c3..761241c68 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/RegionFileStorageExternalCache.java @@ -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); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/WorldGenStructFeatManager.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/WorldGenStructFeatManager.java index 79259fd36..096e1ad84 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/WorldGenStructFeatManager.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/WorldGenStructFeatManager.java @@ -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> 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 startsForFeature(SectionPos sectionPos, Predicate> predicate) { diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepBiomes.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepBiomes.java index 0ea6286a2..7d3571264 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepBiomes.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepBiomes.java @@ -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 diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepFeatures.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepFeatures.java index 8f2b94fb8..7d36c5038 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepFeatures.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepFeatures.java @@ -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 diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepNoise.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepNoise.java index f2670d97a..a520c7015 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepNoise.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepNoise.java @@ -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 diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureReference.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureReference.java index e9bc14cfb..1320280f5 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureReference.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureReference.java @@ -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; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureStart.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureStart.java index b4d76c08d..e8a18e566 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureStart.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepStructureStart.java @@ -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()); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepSurface.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepSurface.java index 39c4a6e8d..a50adc7a4 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepSurface.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/step/StepSurface.java @@ -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); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index 6eb5f15e4..9f23e8596 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -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); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java index 5941f54c9..c43b73d85 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java @@ -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")) { diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java index 4343c34a7..a617a6faa 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientLevel.java @@ -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 = "", 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) { diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java index b290d6aad..d86208188 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinClientPacketListener.java @@ -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) { diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinFogRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinFogRenderer.java index ead892c02..d01145bf5 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinFogRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinFogRenderer.java @@ -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 diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java index 27b97fe65..5da0b369e 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinGameRenderer.java @@ -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) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java index 5c687cd4e..8422bebf4 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java @@ -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 diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java index 92d79850a..8c4a32972 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinMinecraft.java @@ -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") diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java index 7fbb823a1..5df2f3cf8 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinOptionsScreen.java @@ -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"))); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/events/MixinServerLevel.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/events/MixinServerLevel.java index a475b61a6..765b8deac 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/events/MixinServerLevel.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/events/MixinServerLevel.java @@ -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(); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java index bb9741d58..6b4c4d2a4 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/mods/sodium/MixinSodiumRenderer.java @@ -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; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkGenerator.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkGenerator.java index e0d28ec86..fce9efd57 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkGenerator.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkGenerator.java @@ -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; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java index 90033b89a..1e9711597 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinChunkMap.java @@ -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; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java index 6e58f36af..fe6b7b4c8 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/MixinUtilBackgroundThread.java @@ -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 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> ci) diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/unsafe/MixinThreadingDetector.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/unsafe/MixinThreadingDetector.java index b6027388f..63f2e345e 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/unsafe/MixinThreadingDetector.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/server/unsafe/MixinThreadingDetector.java @@ -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; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java index a12f1f0a4..3d7ddf888 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/BCLibAccessor.java @@ -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 diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java index 37fe1b2a0..d08de388b 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/IrisAccessor.java @@ -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; diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java index 72289277a..cd340c2e5 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/wrappers/modAccessor/SodiumAccessor.java @@ -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 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 } diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java index c96b8ce10..302475759 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java @@ -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??? diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java index 6ee80e4de..dbf61fcd0 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java @@ -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 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 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); diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java index 46d2f5c6a..b646ecb12 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeServerProxy.java @@ -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) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java index 1bb20e3fa..21ef500a5 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinClientPacketListener.java @@ -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")) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java index 597a9850b..a9e59c9ca 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinFogRenderer.java @@ -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 diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java index 316e89d59..64899ab54 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinGameRenderer.java @@ -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) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java index 2239adb4f..7e1e13eb2 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java @@ -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 diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java index 1aaa81bf7..5a1141d7f 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinMinecraft.java @@ -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") diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java index af33b5db0..a95f9a79e 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinOptionsScreen.java @@ -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"))); diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java index 5b15692ce..134886824 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinChunkGenerator.java @@ -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; diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java index 537592d1b..31d787a62 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinTFChunkGenerator.java @@ -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; diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java index 59904ca04..ad96fc080 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/MixinUtilBackgroundThread.java @@ -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 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> ci) diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/unsafe/MixinThreadingDetector.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/unsafe/MixinThreadingDetector.java index d692a4c49..e3d1c545d 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/unsafe/MixinThreadingDetector.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/server/unsafe/MixinThreadingDetector.java @@ -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;