Fix up 1.18.2 builds

This commit is contained in:
TomTheFurry
2023-06-24 23:13:53 +08:00
parent 1ef2084e3b
commit 064c69d66c
11 changed files with 20 additions and 15 deletions
@@ -23,7 +23,7 @@ import java.nio.FloatBuffer;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
#if PRE_MC_1_19_3
#if PRE_MC_1_19_4
import com.mojang.math.Matrix4f;
#else
import org.joml.Matrix4f;
@@ -52,7 +52,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_3
#if PRE_MC_1_19_4
matrix.store(buffer);
#else
// Mojang starts to use joml's Matrix4f libary in 1.19.3 so we copy their store method and use it here if its newer than 1.19.3
@@ -75,7 +75,7 @@ public class ClientBlockStateCache
}
private static int getWidth(TextureAtlasSprite texture) {
#if PRE_MC_1_19_3
#if PRE_MC_1_19_4
return texture.getWidth();
#else
return texture.contents().width();
@@ -83,7 +83,7 @@ public class ClientBlockStateCache
}
private static int getHeight(TextureAtlasSprite texture) {
#if PRE_MC_1_19_3
#if PRE_MC_1_19_4
return texture.getHeight();
#else
return texture.contents().height();
@@ -5,6 +5,11 @@ import net.minecraft.client.gui.components.Button;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
#if PRE_MC_1_19
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
#endif
public class GuiHelper {
/**
* Helper static methods for versional compat
@@ -37,7 +37,7 @@ import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper;
#if PRE_MC_1_19_3
#if PRE_MC_1_19_4
import com.mojang.math.Vector3f;
#else
import org.joml.Vector3f;
@@ -310,7 +310,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
return new ProtoChunk(chunkPos, UpgradeData.EMPTY
#if POST_MC_1_17_1, level #endif
#if POST_MC_1_18_1, level.registryAccess().registryOrThrow(
#if PRE_MC_1_19_3
#if PRE_MC_1_19_4
Registry.BIOME_REGISTRY
#else
Registries.BIOME
@@ -56,7 +56,7 @@ public final class GlobalParameters
public final StructureTemplateManager structures;
public final RandomState randomState;
#endif
#if PRE_MC_1_19_3
#if PRE_MC_1_19_4
public final WorldGenSettings worldGenSettings;
#else
public final WorldOptions worldOptions;
@@ -83,7 +83,7 @@ public final class GlobalParameters
WorldData worldData = server.getWorldData();
registry = server.registryAccess();
#if PRE_MC_1_19_3
#if PRE_MC_1_19_4
worldGenSettings = worldData.worldGenSettings();
biomes = registry.registryOrThrow(Registry.BIOME_REGISTRY);
worldSeed = worldGenSettings.seed();
@@ -80,7 +80,7 @@ public final class ThreadedParameters
public void makeStructFeat(WorldGenLevel genLevel, GlobalParameters param)
{
#if PRE_MC_1_19_3
#if PRE_MC_1_19_4
structFeat = new WorldGenStructFeatManager(param.worldGenSettings, genLevel #if POST_MC_1_18_1, structCheck #endif);
#else
structFeat = new WorldGenStructFeatManager(param.worldOptions, genLevel, structCheck);
@@ -20,7 +20,7 @@
package com.seibel.distanthorizons.fabric.mixins.client;
import com.mojang.blaze3d.vertex.PoseStack;
#if PRE_MC_1_19_3
#if PRE_MC_1_19_4
import com.mojang.math.Matrix4f;
#else
import org.joml.Matrix4f;
@@ -161,7 +161,7 @@ public class ForgeMain implements LodForgeMethodCaller
LOGGER.info("Mod Post-Initialized");
}
#if PRE_MC_1_19_1
#if PRE_MC_1_19_2
private final ModelDataMap modelData = new ModelDataMap.Builder().build();
#else
private final ModelData modelData = ModelData.EMPTY;
@@ -95,7 +95,7 @@ public class ForgeServerProxy
// ServerLevelLoadEvent
@SubscribeEvent
#if PRE_MC_1_19_1
#if PRE_MC_1_19_2
public void serverLevelLoadEvent(WorldEvent.Load event)
#else
public void serverLevelLoadEvent(LevelEvent.Load event)
@@ -110,7 +110,7 @@ public class ForgeServerProxy
// ServerLevelUnloadEvent
@SubscribeEvent
#if PRE_MC_1_19_1
#if PRE_MC_1_19_2
public void serverLevelUnloadEvent(WorldEvent.Unload event)
#else
public void serverLevelUnloadEvent(LevelEvent.Unload event)
@@ -20,7 +20,7 @@
package com.seibel.distanthorizons.forge.mixins.client;
import com.mojang.blaze3d.vertex.PoseStack;
#if PRE_MC_1_19_3
#if PRE_MC_1_19_4
import com.mojang.math.Matrix4f;
#else
import org.joml.Matrix4f;
@@ -103,6 +103,7 @@ public class MixinLevelRenderer
// have access to them
previousPartialTicks = tickDelta;
}
#endif
// TODO: Can we move this o forge's client proxy simmilar to how fabric does it
#if PRE_MC_1_17_1
@@ -136,5 +137,4 @@ public class MixinLevelRenderer
callback.cancel();
}
}
#endif
}