1.19.3 99% finished, only a few generation modes left to fix

This commit is contained in:
coolGi
2022-12-20 18:37:34 +10:30
parent 4af31ac5b9
commit 8f48d15b1f
3 changed files with 11 additions and 3 deletions
@@ -48,6 +48,10 @@ public class McObjectConverter
}
/** Taken from Minecraft's com.mojang.math.Matrix4f class from 1.18.2 */
public static void storeMatrix(Matrix4f matrix, FloatBuffer buffer) {
#if PRE_MC_1_19_3
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
buffer.put(bufferIndex(0, 0), matrix.m00());
buffer.put(bufferIndex(0, 1), matrix.m01());
buffer.put(bufferIndex(0, 2), matrix.m02());
@@ -64,6 +68,7 @@ public class McObjectConverter
buffer.put(bufferIndex(3, 1), matrix.m31());
buffer.put(bufferIndex(3, 2), matrix.m32());
buffer.put(bufferIndex(3, 3), matrix.m33());
#endif
}
@@ -74,7 +79,9 @@ public class McObjectConverter
FloatBuffer buffer = FloatBuffer.allocate(16);
storeMatrix(mcMatrix, buffer);
Mat4f matrix = new Mat4f(buffer);
matrix.transpose();
#if PRE_MC_1_19_3
matrix.transpose(); // In 1.19.3 and later, we no longer need to transpose it
#endif
return matrix;
}
@@ -41,7 +41,7 @@ public class TextureAtlasSpriteWrapper {
return sprite.mainImage[0].getPixelRGBA(
x + sprite.framesX[frameIndex] * sprite.getWidth(),
y + sprite.framesY[frameIndex] * sprite.getHeight());
#elif PRE_MC_19_3
#elif PRE_MC_1_19_3
if (sprite.animatedTexture != null) {
x += sprite.animatedTexture.getFrameX(frameIndex) * sprite.width;
y += sprite.animatedTexture.getFrameY(frameIndex) * sprite.height;
@@ -86,11 +86,12 @@ public final class GlobalParameters
#if PRE_MC_1_19_3
worldGenSettings = worldData.worldGenSettings();
biomes = registry.registryOrThrow(Registry.BIOME_REGISTRY);
worldSeed = worldGenSettings.seed();
#else
worldOptions = worldData.worldGenOptions();
biomes = registry.registryOrThrow(Registries.BIOME);
#endif
worldSeed = worldOptions.seed();
#endif
#if POST_MC_1_18_1
biomeManager = new BiomeManager(level, BiomeManager.obfuscateSeed(worldSeed));
chunkScanner = level.getChunkSource().chunkScanner();