From bda318c332921b26f866a4acc13ed4b764606f43 Mon Sep 17 00:00:00 2001
From: IMS212
Date: Sun, 19 May 2024 20:31:44 -0700
Subject: [PATCH] Port to 1.20.1
---
build.gradle.kts | 16 +-
.../sodium/client/gui/SodiumOptionsGUI.java | 8 +-
.../model/color/ColorProviderRegistry.java | 2 +-
.../client/render/SodiumWorldRenderer.java | 2 +-
.../render/chunk/NonStoringBuilderPool.java | 33 ---
.../pipeline/DefaultFluidRenderer.java | 30 +--
.../tasks/ChunkBuilderMeshingTask.java | 5 +-
.../frapi/render/ItemRenderContext.java | 2 +-
.../render/NonTerrainBlockRenderContext.java | 2 +-
.../immediate/model/BakedModelEncoder.java | 4 +-
.../immediate/model/EntityRenderer.java | 12 +-
.../services/SodiumPlatformHelpers.java | 11 +-
.../mods/sodium/client/world/LevelSlice.java | 5 +-
.../world/cloned/ChunkRenderContext.java | 8 +-
.../world/cloned/ClonedChunkSection.java | 4 +-
.../sodium/mixin/core/MinecraftMixin.java | 7 +-
...in.java => ReceivingLevelScreenMixin.java} | 6 +-
.../immediate/consumer/BufferSourceMixin.java | 3 +-
.../world/ChunkRenderDispatcherMixin.java | 21 ++
.../core/render/world/LevelRendererMixin.java | 19 +-
.../core/render/world/RenderBuffersMixin.java | 16 --
.../core/world/map/ClientChunkCacheMixin.java | 4 +-
.../world/map/ClientPacketListenerMixin.java | 2 +-
.../hooks/settings/OptionsScreenMixin.java | 3 +-
.../gui/screen/LevelLoadingScreenMixin.java | 2 +-
.../features/options/overlays/GuiMixin.java | 2 +-
.../render_layers/LeavesBlockMixin.java | 2 +-
.../shadows/EntityRenderDispatcherMixin.java | 2 +-
.../render/gui/font/BakedGlyphMixin.java | 10 +-
.../intrinsics/BufferBuilderMixin.java | 12 +-
.../matrix_stack/PoseStackMixin.java | 2 -
.../matrix_stack/VertexConsumerMixin.java | 12 +-
.../world/clouds/LevelRendererMixin.java | 3 +-
.../render/world/sky/LevelRendererMixin.java | 2 +-
.../context_creation/WindowMixin.java | 13 +-
common/src/main/resources/sodium.mixins.json | 4 +-
.../client/platform/windows/api/Gdi32.java | 7 +-
.../platform/windows/api/d3dkmt/D3DKMT.java | 7 +-
.../api/d3dkmt/D3DKMTAdapterInfoStruct.java | 7 +-
.../D3DKMTAdapterRegistryInfoStruct.java | 7 +-
.../api/d3dkmt/D3DKMTEnumAdaptersStruct.java | 7 +-
.../api/d3dkmt/D3DKMTOpenGLInfoStruct.java | 7 +-
.../d3dkmt/D3DKMTQueryAdapterInfoStruct.java | 7 +-
.../windows/api/msgbox/MsgBoxParamSw.java | 7 +-
.../version/VersionFixedFileInfoStruct.java | 7 +-
neoforge/build.gradle.kts | 207 ++++++++++--------
.../model/MultiPartBakedModelMixin.java | 10 +-
.../model/WeightedBakedModelMixin.java | 12 +-
.../model/block/ModelBlockRendererMixin.java | 4 +-
.../textures/mipmaps/SpriteContentsMixin.java | 2 +-
.../sodium/neoforge/BlockSpriteFinder.java | 4 +-
.../mods/sodium/neoforge/MixinConfigImpl.java | 4 +-
.../mods/sodium/neoforge/SodiumForgeMod.java | 20 +-
.../neoforge/SodiumNeoforgeHelpers.java | 48 ++--
.../iecompat/ImmersiveEngineeringCompat.java | 2 +-
.../mixin/ChunkRenderTypeSetAccessor.java | 2 +-
.../neoforge/mixin/ClientHooksMixin.java | 17 --
.../sodium/neoforge/mixin/ForgeGUIMixin.java | 87 ++++++++
.../neoforge/mixin/LevelSliceMixin.java | 64 ------
.../mixin/SimpleBakedModelAccessor.java | 2 +-
.../neoforge/render/FluidRendererImpl.java | 10 +-
.../neoforge/render/ForgeColorProviders.java | 2 +-
.../neoforge/render/SpriteFinderCache.java | 2 +-
.../resources/META-INF/accesstransformer.cfg | 6 +-
.../{neoforge.mods.toml => mods.toml} | 15 +-
neoforge/src/main/resources/pack.mcmeta | 10 +
.../main/resources/sodium-forge.mixins.json | 3 +-
.../mods/sodium/service/ModLocator.java | 10 +-
.../sodium/service/SodiumWorkarounds.java | 2 +-
settings.gradle.kts | 2 +-
70 files changed, 412 insertions(+), 489 deletions(-)
delete mode 100644 common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/NonStoringBuilderPool.java
rename common/src/main/java/net/caffeinemc/mods/sodium/mixin/core/gui/{LevelLoadStatusManagerMixin.java => ReceivingLevelScreenMixin.java} (87%)
create mode 100644 common/src/main/java/net/caffeinemc/mods/sodium/mixin/core/render/world/ChunkRenderDispatcherMixin.java
delete mode 100644 common/src/main/java/net/caffeinemc/mods/sodium/mixin/core/render/world/RenderBuffersMixin.java
rename {common => neoforge}/src/main/java/net/caffeinemc/mods/sodium/mixin/features/textures/mipmaps/SpriteContentsMixin.java (91%)
delete mode 100644 neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/ClientHooksMixin.java
create mode 100644 neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/ForgeGUIMixin.java
delete mode 100644 neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/LevelSliceMixin.java
rename neoforge/src/main/resources/META-INF/{neoforge.mods.toml => mods.toml} (59%)
create mode 100644 neoforge/src/main/resources/pack.mcmeta
diff --git a/build.gradle.kts b/build.gradle.kts
index ba4084ed72..2002d2edcd 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -4,10 +4,10 @@ plugins {
id("fabric-loom") version("1.6.6") apply(false)
}
-val MINECRAFT_VERSION by extra { "1.20.6" }
-val NEOFORGE_VERSION by extra { "20.6.57-beta" }
-val FABRIC_LOADER_VERSION by extra { "0.15.10" }
-val FABRIC_API_VERSION by extra { "0.97.5+1.20.5" }
+val MINECRAFT_VERSION by extra { "1.20.1" }
+val NEOFORGE_VERSION by extra { "47.2.23" }
+val FABRIC_LOADER_VERSION by extra { "0.15.6" }
+val FABRIC_API_VERSION by extra { "0.92.0+1.20.1" }
// https://semver.org/
val MOD_VERSION by extra { "0.6.0" }
@@ -24,7 +24,7 @@ tasks.withType {
subprojects {
apply(plugin = "maven-publish")
- java.toolchain.languageVersion = JavaLanguageVersion.of(21)
+ java.toolchain.languageVersion = JavaLanguageVersion.of(17)
fun createVersionString(): String {
@@ -54,7 +54,7 @@ subprojects {
}
tasks.processResources {
- filesMatching("META-INF/neoforge.mods.toml") {
+ filesMatching("META-INF/mods.toml") {
expand(mapOf("version" to createVersionString()))
}
}
@@ -64,7 +64,7 @@ subprojects {
tasks.withType {
options.encoding = "UTF-8"
- options.release.set(21)
+ options.release.set(17)
}
// Disables Gradle's custom module metadata from being published to maven. The
@@ -73,4 +73,4 @@ subprojects {
tasks.withType().configureEach {
enabled = false
}
-}
+}
\ No newline at end of file
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/SodiumOptionsGUI.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/SodiumOptionsGUI.java
index 81e78f6fe9..0ee4c982da 100644
--- a/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/SodiumOptionsGUI.java
+++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/gui/SodiumOptionsGUI.java
@@ -24,6 +24,7 @@
import net.minecraft.locale.Language;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.FormattedText;
+import net.minecraft.network.chat.Style;
import net.minecraft.util.FormattedCharSequence;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW;
@@ -241,6 +242,7 @@ private void rebuildGUIOptions() {
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
this.updateControls();
+ super.renderBackground(graphics);
super.render(graphics, this.prompt != null ? -1 : mouseX, this.prompt != null ? -1 : mouseY, delta);
if (this.hoveredElement != null) {
@@ -442,9 +444,9 @@ public Dim2i getDimensions() {
static {
DONATION_PROMPT_MESSAGE = List.of(
FormattedText.composite(Component.literal("Hello!")),
- FormattedText.composite(Component.literal("It seems that you've been enjoying "), Component.literal("Sodium").withColor(0x27eb92), Component.literal(", the free and open-source optimization mod for Minecraft.")),
- FormattedText.composite(Component.literal("Mods like these are complex. They require "), Component.literal("thousands of hours").withColor(0xff6e00), Component.literal(" of development, debugging, and tuning to create the experience that players have come to expect.")),
- FormattedText.composite(Component.literal("If you'd like to show your token of appreciation, and support the development of our mod in the process, then consider "), Component.literal("buying us a coffee").withColor(0xed49ce), Component.literal(".")),
+ FormattedText.composite(Component.literal("It seems that you've been enjoying "), Component.literal("Sodium").withStyle(Style.EMPTY.withColor(0x27eb92)), Component.literal(", the free and open-source optimization mod for Minecraft.")),
+ FormattedText.composite(Component.literal("Mods like these are complex. They require "), Component.literal("thousands of hours").withStyle(Style.EMPTY.withColor(0xff6e00)), Component.literal(" of development, debugging, and tuning to create the experience that players have come to expect.")),
+ FormattedText.composite(Component.literal("If you'd like to show your token of appreciation, and support the development of our mod in the process, then consider "), Component.literal("buying us a coffee").withStyle(Style.EMPTY.withColor(0xed49ce)), Component.literal(".")),
FormattedText.composite(Component.literal("And thanks again for using our mod! We hope it helps you (and your computer.)"))
);
}
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/model/color/ColorProviderRegistry.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/model/color/ColorProviderRegistry.java
index efc349e062..7fa81e346b 100644
--- a/common/src/main/java/net/caffeinemc/mods/sodium/client/model/color/ColorProviderRegistry.java
+++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/model/color/ColorProviderRegistry.java
@@ -35,7 +35,7 @@ public ColorProviderRegistry(BlockColors blockColors) {
// TODO: Allow mods to install their own color resolvers here
private void installOverrides() {
this.registerBlocks(DefaultColorProviders.GrassColorProvider.BLOCKS,
- Blocks.GRASS_BLOCK, Blocks.FERN, Blocks.SHORT_GRASS, Blocks.POTTED_FERN,
+ Blocks.GRASS_BLOCK, Blocks.FERN, Blocks.GRASS, Blocks.POTTED_FERN,
Blocks.PINK_PETALS, Blocks.SUGAR_CANE, Blocks.LARGE_FERN, Blocks.TALL_GRASS);
this.registerBlocks(DefaultColorProviders.FoliageColorProvider.BLOCKS,
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/SodiumWorldRenderer.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/SodiumWorldRenderer.java
index 8d152d294e..47b5d8d177 100644
--- a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/SodiumWorldRenderer.java
+++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/SodiumWorldRenderer.java
@@ -379,7 +379,7 @@ private static void renderBlockEntity(PoseStack matrices,
PoseStack.Pose entry = matrices.last();
VertexConsumer transformer = new SheetedDecalTextureGenerator(bufferBuilder,
- entry, 1.0f);
+ entry.pose(), entry.normal(), 1.0f);
consumer = (layer) -> layer.affectsCrumbling() ? VertexMultiConsumer.create(transformer, immediate.getBuffer(layer)) : immediate.getBuffer(layer);
}
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/NonStoringBuilderPool.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/NonStoringBuilderPool.java
deleted file mode 100644
index aa9d01f155..0000000000
--- a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/NonStoringBuilderPool.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package net.caffeinemc.mods.sodium.client.render.chunk;
-
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collections;
-import net.minecraft.client.renderer.SectionBufferBuilderPack;
-import net.minecraft.client.renderer.SectionBufferBuilderPool;
-
-public class NonStoringBuilderPool extends SectionBufferBuilderPool {
- public NonStoringBuilderPool() {
- super(Collections.emptyList());
- }
-
- @Nullable
- @Override
- public SectionBufferBuilderPack acquire() {
- return null;
- }
-
- @Override
- public void release(SectionBufferBuilderPack blockBufferBuilderStorage) {
- }
-
- @Override
- public boolean isEmpty() {
- return true;
- }
-
- @Override
- public int getFreeBufferCount() {
- return 0;
- }
-}
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/compile/pipeline/DefaultFluidRenderer.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/compile/pipeline/DefaultFluidRenderer.java
index d9137957f2..9c3ddcb338 100644
--- a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/compile/pipeline/DefaultFluidRenderer.java
+++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/compile/pipeline/DefaultFluidRenderer.java
@@ -172,8 +172,8 @@ public void render(LevelSlice level, FluidState fluidState, BlockPos blockPos, B
u1 = sprite.getU(0.0f);
v1 = sprite.getV(0.0f);
u2 = u1;
- v2 = sprite.getV(1.0f);
- u3 = sprite.getU(1.0f);
+ v2 = sprite.getV(16.0f);
+ u3 = sprite.getU(16.0f);
v3 = v2;
u4 = u3;
v4 = v1;
@@ -182,14 +182,14 @@ public void render(LevelSlice level, FluidState fluidState, BlockPos blockPos, B
float dir = (float) Mth.atan2(velocity.z, velocity.x) - (1.5707964f);
float sin = Mth.sin(dir) * 0.25F;
float cos = Mth.cos(dir) * 0.25F;
- u1 = sprite.getU(0.5F + (-cos - sin));
- v1 = sprite.getV(0.5F + -cos + sin);
- u2 = sprite.getU(0.5F + -cos + sin);
- v2 = sprite.getV(0.5F + cos + sin);
- u3 = sprite.getU(0.5F + cos + sin);
- v3 = sprite.getV(0.5F + (cos - sin));
- u4 = sprite.getU(0.5F + (cos - sin));
- v4 = sprite.getV(0.5F + (-cos - sin));
+ u1 = sprite.getU(8.0F + (-cos - sin) * 16.0F);
+ v1 = sprite.getV(8.0F + (-cos + sin) * 16.0F);
+ u2 = sprite.getU(8.0F + (-cos + sin) * 16.0F);
+ v2 = sprite.getV(8.0F + (cos + sin) * 16.0F);
+ u3 = sprite.getU(8.0F + (cos + sin) * 16.0F);
+ v3 = sprite.getV(8.0F + (cos - sin) * 16.0F);
+ u4 = sprite.getU(8.0F + (cos - sin) * 16.0F);
+ v4 = sprite.getV(8.0F + (-cos - sin) * 16.0F);
}
float uAvg = (u1 + u2 + u3 + u4) / 4.0F;
@@ -337,11 +337,11 @@ && isAlignedEquals(southEastHeight, southWestHeight)
}
}
- float u1 = sprite.getU(0.0F);
- float u2 = sprite.getU(0.5F);
- float v1 = sprite.getV((1.0F - c1) * 0.5F);
- float v2 = sprite.getV((1.0F - c2) * 0.5F);
- float v3 = sprite.getV(0.5F);
+ float u1 = sprite.getU(0.0D);
+ float u2 = sprite.getU(8.0D);
+ float v1 = sprite.getV((1.0F - c1) * 16.0F * 0.5F);
+ float v2 = sprite.getV((1.0F - c2) * 16.0F * 0.5F);
+ float v3 = sprite.getV(8.0D);
quad.setSprite(sprite);
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/compile/tasks/ChunkBuilderMeshingTask.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/compile/tasks/ChunkBuilderMeshingTask.java
index ed54a3d975..b22b7960a6 100644
--- a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/compile/tasks/ChunkBuilderMeshingTask.java
+++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/compile/tasks/ChunkBuilderMeshingTask.java
@@ -144,8 +144,9 @@ public ChunkBuildOutput execute(ChunkBuildContext buildContext, CancellationToke
throw fillCrashInfo(CrashReport.forThrowable(ex, "Encountered exception while building chunk meshes"), slice, blockPos);
}
- SodiumPlatformHelpers.INSTANCE.renderAdditionalRenderers(renderContext.getRenderers(), type -> buffers.get(DefaultMaterials.forRenderLayer(type)).asFallbackVertexConsumer(DefaultMaterials.forRenderLayer(type), collector),
- slice);
+ if (SodiumPlatformHelpers.INSTANCE.shouldRenderIE(renderContext.getOrigin())) {
+ SodiumPlatformHelpers.INSTANCE.renderConnectionsInSection(buffers, slice, renderContext.getOrigin());
+ }
blockRenderer.release();
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/frapi/render/ItemRenderContext.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/frapi/render/ItemRenderContext.java
index 863b93039f..ed99576da2 100644
--- a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/frapi/render/ItemRenderContext.java
+++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/frapi/render/ItemRenderContext.java
@@ -132,7 +132,7 @@ public void renderModel(ItemStack itemStack, ItemDisplayContext transformMode, b
this.transformMode = transformMode;
this.poseStack = poseStack;
matPosition = poseStack.last().pose();
- trustedNormals = poseStack.last().trustedNormals;
+ trustedNormals = true;
matNormal = poseStack.last().normal();
this.bufferSource = bufferSource;
this.lightmap = lightmap;
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/frapi/render/NonTerrainBlockRenderContext.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/frapi/render/NonTerrainBlockRenderContext.java
index 41b9830fa9..8ea3988ec4 100644
--- a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/frapi/render/NonTerrainBlockRenderContext.java
+++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/frapi/render/NonTerrainBlockRenderContext.java
@@ -63,7 +63,7 @@ public void renderModel(BlockAndTintGetter blockView, BakedModel model, BlockSta
this.vertexConsumer = buffer;
this.matPosition = poseStack.last().pose();
- this.trustedNormals = poseStack.last().trustedNormals;
+ this.trustedNormals = true;
this.matNormal = poseStack.last().normal();
this.overlay = overlay;
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/immediate/model/BakedModelEncoder.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/immediate/model/BakedModelEncoder.java
index 539e8ad3a6..707fabcaf5 100644
--- a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/immediate/model/BakedModelEncoder.java
+++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/immediate/model/BakedModelEncoder.java
@@ -38,7 +38,7 @@ public static void writeQuadVertices(VertexBufferWriter writer, PoseStack.Pose m
int newLight = mergeLighting(quad.getLight(i), light);
// The packed transformed normal vector
- int normal = MatrixHelper.transformNormal(matNormal, matrices.trustedNormals, quad.getAccurateNormal(i));
+ int normal = MatrixHelper.transformNormal(matNormal, true, quad.getAccurateNormal(i));
// The transformed position vector
float xt = MatrixHelper.transformPositionX(matPosition, x, y, z);
@@ -76,7 +76,7 @@ public static void writeQuadVertices(VertexBufferWriter writer, PoseStack.Pose m
float fG;
float fB;
- var normal = MatrixHelper.transformNormal(matNormal, matrices.trustedNormals, quad.getAccurateNormal(i));
+ var normal = MatrixHelper.transformNormal(matNormal, true, quad.getAccurateNormal(i));
float brightness = brightnessTable[i];
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/immediate/model/EntityRenderer.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/immediate/model/EntityRenderer.java
index 8dffd7ef4f..017b74151f 100644
--- a/common/src/main/java/net/caffeinemc/mods/sodium/client/render/immediate/model/EntityRenderer.java
+++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/render/immediate/model/EntityRenderer.java
@@ -181,12 +181,12 @@ private static void prepareVertices(PoseStack.Pose matrices, ModelCuboid cuboid)
}
private static void prepareNormals(PoseStack.Pose matrices) {
- CUBE_NORMALS[FACE_NEG_Y] = MatrixHelper.transformNormal(matrices.normal(), matrices.trustedNormals, Direction.DOWN);
- CUBE_NORMALS[FACE_POS_Y] = MatrixHelper.transformNormal(matrices.normal(), matrices.trustedNormals, Direction.UP);
- CUBE_NORMALS[FACE_NEG_Z] = MatrixHelper.transformNormal(matrices.normal(), matrices.trustedNormals, Direction.NORTH);
- CUBE_NORMALS[FACE_POS_Z] = MatrixHelper.transformNormal(matrices.normal(), matrices.trustedNormals, Direction.SOUTH);
- CUBE_NORMALS[FACE_POS_X] = MatrixHelper.transformNormal(matrices.normal(), matrices.trustedNormals, Direction.WEST);
- CUBE_NORMALS[FACE_NEG_X] = MatrixHelper.transformNormal(matrices.normal(), matrices.trustedNormals, Direction.EAST);
+ CUBE_NORMALS[FACE_NEG_Y] = MatrixHelper.transformNormal(matrices.normal(), true, Direction.DOWN);
+ CUBE_NORMALS[FACE_POS_Y] = MatrixHelper.transformNormal(matrices.normal(), true, Direction.UP);
+ CUBE_NORMALS[FACE_NEG_Z] = MatrixHelper.transformNormal(matrices.normal(), true, Direction.NORTH);
+ CUBE_NORMALS[FACE_POS_Z] = MatrixHelper.transformNormal(matrices.normal(), true, Direction.SOUTH);
+ CUBE_NORMALS[FACE_POS_X] = MatrixHelper.transformNormal(matrices.normal(), true, Direction.WEST);
+ CUBE_NORMALS[FACE_NEG_X] = MatrixHelper.transformNormal(matrices.normal(), true, Direction.EAST);
// When mirroring is used, the normals for EAST and WEST are swapped.
CUBE_NORMALS_MIRRORED[FACE_NEG_Y] = CUBE_NORMALS[FACE_NEG_Y];
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/services/SodiumPlatformHelpers.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/services/SodiumPlatformHelpers.java
index 3e56f38ad6..df433cb4c0 100644
--- a/common/src/main/java/net/caffeinemc/mods/sodium/client/services/SodiumPlatformHelpers.java
+++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/services/SodiumPlatformHelpers.java
@@ -1,5 +1,6 @@
package net.caffeinemc.mods.sodium.client.services;
+import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.caffeinemc.mods.sodium.client.model.color.ColorProviderRegistry;
import net.caffeinemc.mods.sodium.client.model.light.LightPipelineProvider;
@@ -41,7 +42,7 @@ public interface SodiumPlatformHelpers {
Path getConfigDir();
- Object getRenderData(Level level, BoundingBox pos, BlockEntity value);
+ Object getRenderData(Level level, ChunkPos pos, BlockEntity value);
boolean isDevelopmentEnvironment();
@@ -63,7 +64,7 @@ public interface SodiumPlatformHelpers {
boolean renderFluidFromVanilla();
- void runChunkLayerEvents(RenderType renderLayer, LevelRenderer levelRenderer, Matrix4f modelMatrix, Matrix4f projectionMatrix, int ticks, Camera mainCamera, Frustum cullingFrustum);
+ void runChunkLayerEvents(RenderType renderLayer, LevelRenderer levelRenderer, PoseStack modelMatrix, Matrix4f projectionMatrix, int ticks, Camera mainCamera, Frustum cullingFrustum);
FluidRenderer createPlatformFluidRenderer(ColorProviderRegistry colorRegistry, LightPipelineProvider lightPipelineProvider);
@@ -76,10 +77,4 @@ public interface SodiumPlatformHelpers {
void renderConnectionsInSection(ChunkBuildBuffers buffers, LevelSlice worldSlice, SectionPos position);
boolean shouldRenderIE(SectionPos position);
-
- void renderAdditionalRenderers(List> renderers, Function typeToConsumer, LevelSlice slice);
-
- List> getExtraRenderers(Level level, BlockPos origin);
-
- Object getLightManager(LevelChunk chunk, SectionPos pos);
}
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/world/LevelSlice.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/world/LevelSlice.java
index 79edb768d6..aca516233b 100644
--- a/common/src/main/java/net/caffeinemc/mods/sodium/client/world/LevelSlice.java
+++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/world/LevelSlice.java
@@ -143,10 +143,9 @@ public static ChunkRenderContext prepare(Level level, SectionPos pos, ClonedChun
}
}
- Object modelData = SodiumPlatformHelpers.INSTANCE.getRenderData(level, box, null);
- List> renderers = SodiumPlatformHelpers.INSTANCE.getExtraRenderers(level, pos.origin());
+ Object modelData = SodiumPlatformHelpers.INSTANCE.getRenderData(level, pos.chunk(), null);
- return new ChunkRenderContext(pos, sections, box, modelData, renderers);
+ return new ChunkRenderContext(pos, sections, box, modelData);
}
@SuppressWarnings("unchecked")
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/world/cloned/ChunkRenderContext.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/world/cloned/ChunkRenderContext.java
index 5026ec4a61..efe9cc76b4 100644
--- a/common/src/main/java/net/caffeinemc/mods/sodium/client/world/cloned/ChunkRenderContext.java
+++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/world/cloned/ChunkRenderContext.java
@@ -10,14 +10,12 @@ public class ChunkRenderContext {
private final ClonedChunkSection[] sections;
private final BoundingBox volume;
private final Object modelData;
- private final List> renderers;
- public ChunkRenderContext(SectionPos origin, ClonedChunkSection[] sections, BoundingBox volume, Object modelData, List> renderers) {
+ public ChunkRenderContext(SectionPos origin, ClonedChunkSection[] sections, BoundingBox volume, Object modelData) {
this.origin = origin;
this.sections = sections;
this.volume = volume;
this.modelData = modelData;
- this.renderers = renderers;
}
public ClonedChunkSection[] getSections() {
@@ -35,8 +33,4 @@ public BoundingBox getVolume() {
public Object getModelData() {
return modelData;
}
-
- public List> getRenderers() {
- return renderers;
- }
}
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/world/cloned/ClonedChunkSection.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/world/cloned/ClonedChunkSection.java
index f19b17f76d..ce3800b909 100644
--- a/common/src/main/java/net/caffeinemc/mods/sodium/client/world/cloned/ClonedChunkSection.java
+++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/world/cloned/ClonedChunkSection.java
@@ -56,7 +56,9 @@ public ClonedChunkSection(Level level, LevelChunk chunk, @Nullable LevelChunkSec
Int2ReferenceMap blockEntityMap = null;
Int2ReferenceMap
*/
@Inject(method = "renderSky", at = @At("HEAD"), cancellable = true)
- private void preRenderSky(Matrix4f matrix4f, Matrix4f matrix4f2, float f, Camera camera, boolean bl, Runnable runnable, CallbackInfo ci) {
+ private void preRenderSky(PoseStack poseStack, Matrix4f matrix4f, float f, Camera camera, boolean bl, Runnable runnable, CallbackInfo ci) {
// Cancels sky rendering when the camera is submersed underwater.
// This prevents the sky from being visible through chunks culled by Sodium's fog occlusion.
// Fixes https://bugs.mojang.com/browse/MC-152504.
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/mixin/workarounds/context_creation/WindowMixin.java b/common/src/main/java/net/caffeinemc/mods/sodium/mixin/workarounds/context_creation/WindowMixin.java
index 165dd65399..31f89eb812 100644
--- a/common/src/main/java/net/caffeinemc/mods/sodium/mixin/workarounds/context_creation/WindowMixin.java
+++ b/common/src/main/java/net/caffeinemc/mods/sodium/mixin/workarounds/context_creation/WindowMixin.java
@@ -2,10 +2,7 @@
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
-import com.mojang.blaze3d.platform.DisplayData;
-import com.mojang.blaze3d.platform.ScreenManager;
import com.mojang.blaze3d.platform.Window;
-import com.mojang.blaze3d.platform.WindowEventHandler;
import net.caffeinemc.mods.sodium.client.compatibility.checks.PostLaunchChecks;
import net.caffeinemc.mods.sodium.client.compatibility.checks.ModuleScanner;
import net.caffeinemc.mods.sodium.client.compatibility.environment.GLContextInfo;
@@ -14,6 +11,8 @@
import net.caffeinemc.mods.sodium.client.services.SodiumPlatformHelpers;
import net.minecraft.Util;
import org.lwjgl.glfw.GLFW;
+import org.lwjgl.opengl.GL;
+import org.lwjgl.opengl.GLCapabilities;
import org.lwjgl.opengl.WGL;
import org.lwjgl.system.MemoryUtil;
import org.slf4j.Logger;
@@ -75,8 +74,10 @@ private long wrapGlfwCreateWindowForge(final IntSupplier width, final IntSupplie
}
}
- @Inject(method = "", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL;createCapabilities()Lorg/lwjgl/opengl/GLCapabilities;", shift = At.Shift.AFTER))
- private void postContextReady(WindowEventHandler eventHandler, ScreenManager monitorTracker, DisplayData settings, String videoMode, String title, CallbackInfo ci) {
+ @Redirect(method = "", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL;createCapabilities()Lorg/lwjgl/opengl/GLCapabilities;"))
+ private GLCapabilities postContextReady() {
+ GLCapabilities capabilities = GL.createCapabilities();
+
GLContextInfo driver = GLContextInfo.create();
if (driver == null) {
@@ -96,6 +97,8 @@ private void postContextReady(WindowEventHandler eventHandler, ScreenManager mon
PostLaunchChecks.onContextInitialized();
ModuleScanner.checkModules();
+
+ return capabilities;
}
@Inject(method = "updateDisplay", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;flipFrame(J)V", shift = At.Shift.AFTER))
diff --git a/common/src/main/resources/sodium.mixins.json b/common/src/main/resources/sodium.mixins.json
index 443d259a9d..4687b32771 100644
--- a/common/src/main/resources/sodium.mixins.json
+++ b/common/src/main/resources/sodium.mixins.json
@@ -13,7 +13,7 @@
"client": [
"core.MinecraftMixin",
"core.WindowMixin",
- "core.gui.LevelLoadStatusManagerMixin",
+ "core.gui.ReceivingLevelScreenMixin",
"core.model.colors.BlockColorsMixin",
"core.model.colors.ItemColorsMixin",
"core.model.quad.BakedQuadMixin",
@@ -28,7 +28,7 @@
"core.render.immediate.consumer.BufferSourceMixin",
"core.render.immediate.consumer.VertexMultiConsumerMixin$DoubleMixin",
"core.render.immediate.consumer.VertexMultiConsumerMixin$MultipleMixin",
- "core.render.world.RenderBuffersMixin",
+ "core.render.world.ChunkRenderDispatcherMixin",
"core.render.world.LevelRendererMixin",
"core.world.biome.ClientLevelMixin",
"core.world.chunk.ZeroBitStorageMixin",
diff --git a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/Gdi32.java b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/Gdi32.java
index 3341963a38..7a4188b920 100644
--- a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/Gdi32.java
+++ b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/Gdi32.java
@@ -5,15 +5,14 @@
import org.lwjgl.system.SharedLibrary;
import static org.lwjgl.system.APIUtil.apiCreateLibrary;
-import static org.lwjgl.system.APIUtil.apiGetFunctionAddressOptional;
import static org.lwjgl.system.MemoryUtil.NULL;
public class Gdi32 {
private static final SharedLibrary LIBRARY = apiCreateLibrary("gdi32");
- public static final long PFN_D3DKMTQueryAdapterInfo = apiGetFunctionAddressOptional(LIBRARY, "D3DKMTQueryAdapterInfo");
- public static final long PFN_D3DKMTCloseAdapter = apiGetFunctionAddressOptional(LIBRARY, "D3DKMTCloseAdapter");
- public static final long PFN_D3DKMTEnumAdapters = apiGetFunctionAddressOptional(LIBRARY, "D3DKMTEnumAdapters");
+ public static final long PFN_D3DKMTQueryAdapterInfo = LIBRARY.getFunctionAddress("D3DKMTQueryAdapterInfo");
+ public static final long PFN_D3DKMTCloseAdapter = LIBRARY.getFunctionAddress("D3DKMTCloseAdapter");
+ public static final long PFN_D3DKMTEnumAdapters = LIBRARY.getFunctionAddress("D3DKMTEnumAdapters");
public static boolean isD3DKMTSupported() {
return PFN_D3DKMTQueryAdapterInfo != NULL && PFN_D3DKMTCloseAdapter != NULL && PFN_D3DKMTEnumAdapters != NULL;
diff --git a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMT.java b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMT.java
index a18c4f6423..afd9695e51 100644
--- a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMT.java
+++ b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMT.java
@@ -19,8 +19,7 @@
import static net.caffeinemc.mods.sodium.client.platform.windows.api.Gdi32.*;
import static net.caffeinemc.mods.sodium.client.platform.windows.api.d3dkmt.D3DKMTQueryAdapterInfoType.WDDM12.*;
-import static org.lwjgl.system.MemoryUtil.memAddress;
-import static org.lwjgl.system.MemoryUtil.memByteBuffer;
+import static org.lwjgl.system.MemoryUtil.*;
public class D3DKMT {
private static final Logger LOGGER = LoggerFactory.getLogger("Sodium-D3DKMT");
@@ -117,7 +116,7 @@ private static boolean isSupportedAdapterType(int adapterType) {
private static @Nullable String queryDriverFileName(int adapter) {
try (MemoryStack stack = MemoryStack.stackPush()) {
D3DKMTOpenGLInfoStruct info = D3DKMTOpenGLInfoStruct.calloc(stack);
- d3dkmtQueryAdapterInfo(adapter, KMTQAITYPE_UMOPENGLINFO, memByteBuffer(info));
+ d3dkmtQueryAdapterInfo(adapter, KMTQAITYPE_UMOPENGLINFO, memByteBuffer(info.address(), info.sizeof()));
return info.getUserModeDriverFileName();
}
@@ -142,7 +141,7 @@ private static boolean isSupportedAdapterType(int adapterType) {
private static @NotNull String queryFriendlyName(int adapter) {
try (MemoryStack stack = MemoryStack.stackPush()) {
D3DKMTAdapterRegistryInfoStruct registryInfo = D3DKMTAdapterRegistryInfoStruct.calloc(stack);
- d3dkmtQueryAdapterInfo(adapter, KMTQAITYPE_ADAPTERREGISTRYINFO, memByteBuffer(registryInfo));
+ d3dkmtQueryAdapterInfo(adapter, KMTQAITYPE_ADAPTERREGISTRYINFO, memByteBuffer(registryInfo.address(), registryInfo.sizeof()));
String name = registryInfo.getAdapterString();
diff --git a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTAdapterInfoStruct.java b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTAdapterInfoStruct.java
index d57327a80f..d21f8712e4 100644
--- a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTAdapterInfoStruct.java
+++ b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTAdapterInfoStruct.java
@@ -16,7 +16,7 @@
// ULONG NumOfSources;
// BOOL bPrecisePresentRegionsPreferred;
// } D3DKMT_ADAPTERINFO;
-class D3DKMTAdapterInfoStruct extends Struct {
+class D3DKMTAdapterInfoStruct extends Struct {
public static final int SIZEOF, ALIGNOF;
private static final int OFFSET_HADAPTER;
@@ -45,11 +45,6 @@ class D3DKMTAdapterInfoStruct extends Struct {
super(address, container);
}
- @Override
- protected D3DKMTAdapterInfoStruct create(long address, ByteBuffer container) {
- return new D3DKMTAdapterInfoStruct(address, container);
- }
-
public static D3DKMTAdapterInfoStruct create(long address) {
return new D3DKMTAdapterInfoStruct(address, null);
}
diff --git a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTAdapterRegistryInfoStruct.java b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTAdapterRegistryInfoStruct.java
index 1dba5ac999..22ea3287ed 100644
--- a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTAdapterRegistryInfoStruct.java
+++ b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTAdapterRegistryInfoStruct.java
@@ -15,7 +15,7 @@
// WCHAR DacType[MAX_PATH];
// WCHAR ChipType[MAX_PATH];
// } D3DKMT_ADAPTERREGISTRYINFO;
-class D3DKMTAdapterRegistryInfoStruct extends Struct {
+class D3DKMTAdapterRegistryInfoStruct extends Struct {
private static final int MAX_PATH = 260;
private static final int SIZEOF, ALIGNOF;
@@ -45,11 +45,6 @@ private D3DKMTAdapterRegistryInfoStruct(long address, ByteBuffer container) {
super(address, container);
}
- @Override
- protected D3DKMTAdapterRegistryInfoStruct create(long address, ByteBuffer container) {
- return new D3DKMTAdapterRegistryInfoStruct(address, container);
- }
-
public static D3DKMTAdapterRegistryInfoStruct calloc(MemoryStack stack) {
return new D3DKMTAdapterRegistryInfoStruct(stack.ncalloc(ALIGNOF, 1, SIZEOF), null);
}
diff --git a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTEnumAdaptersStruct.java b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTEnumAdaptersStruct.java
index de36d44164..8b101e9866 100644
--- a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTEnumAdaptersStruct.java
+++ b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTEnumAdaptersStruct.java
@@ -15,7 +15,7 @@
// [in] ULONG NumAdapters;
// D3DKMT_ADAPTERINFO Adapters[MAX_ENUM_ADAPTERS];
//} D3DKMT_ENUMADAPTERS;
-class D3DKMTEnumAdaptersStruct extends Struct {
+class D3DKMTEnumAdaptersStruct extends Struct {
private static final int SIZEOF, ALIGNOF;
private static final int MAX_ENUM_ADAPTERS = 16;
@@ -39,11 +39,6 @@ private D3DKMTEnumAdaptersStruct(long address, @Nullable ByteBuffer container) {
super(address, container);
}
- @Override
- protected @NotNull D3DKMTEnumAdaptersStruct create(long address, ByteBuffer container) {
- return new D3DKMTEnumAdaptersStruct(address, container);
- }
-
public static D3DKMTEnumAdaptersStruct calloc(MemoryStack stack) {
return new D3DKMTEnumAdaptersStruct(stack.ncalloc(ALIGNOF, 1, SIZEOF), null);
}
diff --git a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTOpenGLInfoStruct.java b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTOpenGLInfoStruct.java
index b7008787d9..f27c763781 100644
--- a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTOpenGLInfoStruct.java
+++ b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTOpenGLInfoStruct.java
@@ -16,7 +16,7 @@
// [out] ULONG Version;
// [in] ULONG Flags;
// } D3DKMT_OPENGLINFO;
-public class D3DKMTOpenGLInfoStruct extends Struct {
+public class D3DKMTOpenGLInfoStruct extends Struct {
private static final int MAX_PATH = 260;
private static final int SIZEOF, ALIGNOF;
@@ -43,11 +43,6 @@ private D3DKMTOpenGLInfoStruct(long address, @Nullable ByteBuffer container) {
super(address, container);
}
- @Override
- protected @NotNull D3DKMTOpenGLInfoStruct create(long address, ByteBuffer container) {
- return new D3DKMTOpenGLInfoStruct(address, container);
- }
-
public static D3DKMTOpenGLInfoStruct calloc() {
return new D3DKMTOpenGLInfoStruct(MemoryUtil.nmemCalloc(1, SIZEOF), null);
}
diff --git a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTQueryAdapterInfoStruct.java b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTQueryAdapterInfoStruct.java
index f211b8a241..338ce76165 100644
--- a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTQueryAdapterInfoStruct.java
+++ b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/d3dkmt/D3DKMTQueryAdapterInfoStruct.java
@@ -18,7 +18,7 @@
// VOID *pPrivateDriverData;
// UINT PrivateDriverDataSize;
// } D3DKMT_QUERYADAPTERINFO;
-class D3DKMTQueryAdapterInfoStruct extends Struct {
+class D3DKMTQueryAdapterInfoStruct extends Struct {
private static final int SIZEOF, ALIGNOF;
private static final int OFFSET_ADAPTER_HANDLE;
@@ -47,11 +47,6 @@ private D3DKMTQueryAdapterInfoStruct(long address, @Nullable ByteBuffer containe
super(address, container);
}
- @Override
- protected @NotNull D3DKMTAdapterInfoStruct create(long address, ByteBuffer container) {
- return new D3DKMTAdapterInfoStruct(address, container);
- }
-
public static D3DKMTQueryAdapterInfoStruct malloc(MemoryStack stack) {
return new D3DKMTQueryAdapterInfoStruct(stack.nmalloc(ALIGNOF, SIZEOF), null);
}
diff --git a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/msgbox/MsgBoxParamSw.java b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/msgbox/MsgBoxParamSw.java
index 5108bb138a..09e7302750 100644
--- a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/msgbox/MsgBoxParamSw.java
+++ b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/msgbox/MsgBoxParamSw.java
@@ -9,7 +9,7 @@
import java.nio.ByteBuffer;
-public class MsgBoxParamSw extends Struct {
+public class MsgBoxParamSw extends Struct {
public static final int SIZEOF;
public static final int ALIGNOF;
public static final int
@@ -61,11 +61,6 @@ private MsgBoxParamSw(long address, @Nullable ByteBuffer container) {
super(address, container);
}
- @Override
- protected @NotNull MsgBoxParamSw create(long address, ByteBuffer container) {
- return new MsgBoxParamSw(address, container);
- }
-
@Override
public int sizeof() {
return SIZEOF;
diff --git a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/version/VersionFixedFileInfoStruct.java b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/version/VersionFixedFileInfoStruct.java
index 9e714c7840..660bdd0fc7 100644
--- a/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/version/VersionFixedFileInfoStruct.java
+++ b/common/src/workarounds/java/net/caffeinemc/mods/sodium/client/platform/windows/api/version/VersionFixedFileInfoStruct.java
@@ -21,7 +21,7 @@
// DWORD dwFileDateLS;
// } VS_FIXEDFILEINFO;
-public class VersionFixedFileInfoStruct extends Struct {
+public class VersionFixedFileInfoStruct extends Struct {
private static final int SIZEOF, ALIGNOF;
private static final int OFFSET_DW_SIGNATURE;
@@ -80,11 +80,6 @@ public static VersionFixedFileInfoStruct from(long address) {
return new VersionFixedFileInfoStruct(address, null);
}
- @Override
- protected VersionFixedFileInfoStruct create(long address, ByteBuffer container) {
- return new VersionFixedFileInfoStruct(address, container);
- }
-
public int getFileVersionMostSignificantBits() {
return MemoryUtil.memGetInt(this.address + OFFSET_DW_FILE_VERSION_MS);
}
diff --git a/neoforge/build.gradle.kts b/neoforge/build.gradle.kts
index fe03fa0125..cd40758c59 100644
--- a/neoforge/build.gradle.kts
+++ b/neoforge/build.gradle.kts
@@ -1,30 +1,30 @@
+import net.minecraftforge.artifactural.api.artifact.ArtifactIdentifier
+
plugins {
id("idea")
id("maven-publish")
- id("net.neoforged.gradle.userdev") version "7.0.105"
+ id("net.minecraftforge.gradle") version "[6.0,6.2)"
id("java-library")
+ id("org.spongepowered.mixin") version "0.7-SNAPSHOT"
}
base {
- archivesName = "sodium-neoforge-1.20.5"
+ archivesName = "sodium-forge-1.20.1"
}
val MINECRAFT_VERSION: String by rootProject.extra
val NEOFORGE_VERSION: String by rootProject.extra
val MOD_VERSION: String by rootProject.extra
-base {
- archivesName = "sodium-neoforge-${MINECRAFT_VERSION}"
-}
+jarJar.enable()
-if (file("src/main/resources/META-INF/accesstransformer.cfg").exists()) {
- minecraft.accessTransformers {
- file("src/main/resources/META-INF/accesstransformer.cfg")
- }
+mixin {
+ add(sourceSets.main.get(), "sodium.refmap.json")
+ add(project(":common").sourceSets.main.get(), "sodium.refmap.json")
+ config("sodium.mixins.json")
+ config("sodium-forge.mixins.json")
}
-jarJar.enable()
-
sourceSets {
val service = create("service")
@@ -38,141 +38,158 @@ sourceSets {
}
test.get().apply {
+ compileClasspath += main.get().compileClasspath
compileClasspath += project(":common").sourceSets.getByName("workarounds").output
}
}
repositories {
+ mavenCentral()
+
exclusiveContent {
forRepository {
maven {
- url = uri("https://maven.pkg.github.com/ims212/forge-frapi")
- credentials {
- username = "IMS212"
- // Read only token
- password = "ghp_" + "DEuGv0Z56vnSOYKLCXdsS9svK4nb9K39C1Hn"
- }
+ name = "Modrinth"
+ url = uri("https://api.modrinth.com/maven")
}
}
+ forRepositories(fg.repository) // Only add this if you're using ForgeGradle, otherwise remove this line
filter {
- includeGroup("net.caffeinemc.new2")
+ includeGroup("maven.modrinth")
}
}
+
exclusiveContent {
forRepository {
maven {
- name = "Modrinth"
- url = uri("https://api.modrinth.com/maven")
+ url = uri("https://maven.pkg.github.com/ims212/forge-frapi")
+ credentials {
+ username = "IMS212"
+ // Read only token
+ password = "ghp_" + "DEuGv0Z56vnSOYKLCXdsS9svK4nb9K39C1Hn"
+ }
}
}
- //forRepositories(fg.repository) // Only add this if you're using ForgeGradle, otherwise remove this line
filter {
- includeGroup("maven.modrinth")
+ includeGroup("net.caffeinemc.lts")
}
}
-}
-
-val fullJar: Jar by tasks.creating(Jar::class) {
- duplicatesStrategy = DuplicatesStrategy.WARN
- dependsOn(tasks.jarJar)
- from(sourceSets.getByName("service").output)
- from(project(":common").sourceSets.getByName("desktop").output)
- from(project(":common").sourceSets.getByName("workarounds").output)
+ maven { url = uri("https://maven.fabricmc.net/") }
+ maven { url = uri("https://maven.architectury.dev/") }
+ maven { url = uri("https://files.minecraftforge.net/maven/") }
+ maven { url = uri("https://maven.neoforged.net/releases/") }
+ mavenLocal()
+ maven("https://repo.spongepowered.org/repository/maven-public/") { name = "Sponge Snapshots" }
- into("META-INF/jarjar/") {
- from(tasks.jarJar.get().archiveFile)
- }
+}
- into("META-INF") {
- from(projectDir.resolve("src").resolve("main").resolve("resources").resolve("sodium-icon.png"))
+minecraft {
+ mappings("official", "1.20.1")
+ copyIdeResources = true //Calls processResources when in dev
- from(projectDir.resolve("src").resolve("main").resolve("resources").resolve("META-INF").resolve("neoforge.mods.toml"))
+ val transformerFile = file("src/main/resources/META-INF/accesstransformer.cfg")
+ if (transformerFile.exists()) {
+ accessTransformer(transformerFile)
}
- from(rootDir.resolve("LICENSE.md"))
+ runs {
+ create("client") {
+ workingDirectory(project.file("run"))
+ ideaModule("${rootProject.name}.${project.name}.main")
+ property("mixin.env.remapRefMap", "true")
+ property("mixin.env.refMapRemappingFile", "${projectDir}/build/createSrgToMcp/output.srg")
+ mods {
+ create("modRun") {
+ source(sourceSets.main.get())
+ source(project(":common").sourceSets.main.get())
+ }
+ }
+ }
- filesMatching("neoforge.mods.toml") {
- expand(mapOf("version" to MOD_VERSION))
+ create("data") {
+ //programArguments.addAll("--mod", "sodium", "--all", "--output", file("src/generated/resources/").getAbsolutePath(), "--existing", file("src/main/resources/").getAbsolutePath())
+ }
}
-
- manifest.attributes["Main-Class"] = "net.caffeinemc.mods.sodium.desktop.LaunchWarn"
- manifest.attributes["FMLModType"] = "LIBRARY"
-
}
-tasks.build {
- dependsOn(fullJar)
-}
-
-tasks.jar {
- from(rootDir.resolve("LICENSE.md"))
-
- archiveClassifier = "modonly"
-}
+dependencies {
+ minecraft("net.minecraftforge:forge:${MINECRAFT_VERSION}-${NEOFORGE_VERSION}")
+ compileOnly(project(":common"))
+ annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT:processor")
-runs {
- configureEach {
- modSource(project.sourceSets.main.get())
+ compileOnly("io.github.llamalad7:mixinextras-common:0.3.5")
+ annotationProcessor("io.github.llamalad7:mixinextras-common:0.3.5")
+ implementation(jarJar("io.github.llamalad7:mixinextras-forge:0.3.5")) {
+ jarJar.ranged(this, "[0.3.5,)")
}
- create("client") {
- dependencies {
- runtime("com.lodborg:interval-tree:1.0.0")
- runtime(project(":common").sourceSets.getByName("workarounds").output)
- }
+ implementation("net.caffeinemc.lts:fabric_api_base:0.4.32")
+ jarJar("net.caffeinemc.lts:fabric_api_base:[0.4.32,0.4.33)") {
+ isTransitive = false
}
-
- create("data") {
- programArguments.addAll("--mod", "sodium", "--all", "--output", file("src/generated/resources/").getAbsolutePath(), "--existing", file("src/main/resources/").getAbsolutePath())
+ implementation("net.caffeinemc.lts:fabric_renderer_api_v1:3.2.1")
+ jarJar("net.caffeinemc.lts:fabric_renderer_api_v1:[3.2.1,3.2.2)"){
+ isTransitive = false
+ }
+ implementation("net.caffeinemc.lts:fabric_rendering_data_attachment_v1:0.3.37")
+ jarJar("net.caffeinemc.lts:fabric_rendering_data_attachment_v1:[0.3.37,0.3.38)"){
+ isTransitive = false
}
-}
-
-dependencies {
- implementation("net.neoforged:neoforge:${NEOFORGE_VERSION}")
- compileOnly(project(":common"))
- implementation("net.caffeinemc.new2:fabric_api_base:0.4.31")
- jarJar("net.caffeinemc.new2:fabric_api_base:[0.4.31,0.4.33)")
- implementation("net.caffeinemc.new2:fabric_renderer_api_v1:3.2.1")
- jarJar("net.caffeinemc.new2:fabric_renderer_api_v1:[3.2.1, 3.2.2)")
- implementation("net.caffeinemc.new2:fabric_rendering_data_attachment_v1:0.3.37")
- jarJar("net.caffeinemc.new2:fabric_rendering_data_attachment_v1:[0.3.37,0.3.38)")
implementation("com.lodborg:interval-tree:1.0.0")
jarJar("com.lodborg:interval-tree:[1.0.0,1.0.1)")
- implementation("net.caffeinemc.new2:fabric_block_view_api_v2:1.0.1")
- jarJar("net.caffeinemc.new2:fabric_block_view_api_v2:[1.0.1, 1.0.2)")
-
- compileOnly("maven.modrinth:immersiveengineering:11mMmtHT")
+ implementation("net.caffeinemc.lts:fabric_block_view_api_v2:1.0.1")
+ jarJar("net.caffeinemc.lts:fabric_block_view_api_v2:[1.0.1,1.0.2)") {
+ isTransitive = false
+ }
+ compileOnly(fg.deobf("maven.modrinth:immersiveengineering:MAqXk6P8"))
}
+
tasks.jarJar {
- archiveClassifier = "jarJar"
+ dependsOn("reobfJar")
+ archiveClassifier = ""
}
-// NeoGradle compiles the game, but we don't want to add our common code to the game's code
-val notNeoTask: (Task) -> Boolean = { it: Task -> !it.name.startsWith("neo") && !it.name.startsWith("compileService") }
-
-tasks.withType().matching(notNeoTask).configureEach {
- source(project(":common").sourceSets.main.get().allSource)
- source(project(":common").sourceSets.getByName("api").allSource)
+tasks.jar {
+ archiveClassifier = "std"
}
-tasks.withType().matching(notNeoTask).configureEach {
- source(project(":common").sourceSets.main.get().allJava)
- source(project(":common").sourceSets.getByName("api").allJava)
+val notNeoTask: (Task) -> Boolean = { it: Task ->
+ !it.name.startsWith("compileService")
}
-tasks.withType().matching(notNeoTask).configureEach {
- from(project(":common").sourceSets.main.get().resources)
+tasks {
+ withType().matching(notNeoTask).configureEach {
+ source(project(":common").sourceSets.main.get().allSource)
+ source(project(":common").sourceSets.getByName("api").allSource)
+ source(project(":common").sourceSets.getByName("workarounds").allSource)
+ }
+
+ javadoc { source(project(":common").sourceSets.main.get().allJava) }
+
+ processResources { from(project(":common").sourceSets.main.get().resources) }
+
+ jar { finalizedBy("reobfJar") }
}
-java.toolchain.languageVersion = JavaLanguageVersion.of(21)
+java.toolchain.languageVersion = JavaLanguageVersion.of(17)
publishing {
publications {
-
+ register("mavenJava", MavenPublication::class) {
+ artifactId = base.archivesName.get()
+ artifact(tasks.jar)
+ fg.component(this)
+ }
}
+
repositories {
- maven {
- url = uri("file://" + System.getenv("local_maven"))
- }
+ maven("file://${System.getenv("local_maven")}")
}
+}
+
+
+sourceSets.forEach {
+ val dir = layout.buildDirectory.dir("sourceSets/${it.name}")
+ it.output.setResourcesDir(dir)
+ it.java.destinationDirectory.set(dir)
}
\ No newline at end of file
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/mixin/features/model/MultiPartBakedModelMixin.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/mixin/features/model/MultiPartBakedModelMixin.java
index 09a6f4c8dc..f33e9fad02 100644
--- a/neoforge/src/main/java/net/caffeinemc/mods/sodium/mixin/features/model/MultiPartBakedModelMixin.java
+++ b/neoforge/src/main/java/net/caffeinemc/mods/sodium/mixin/features/model/MultiPartBakedModelMixin.java
@@ -13,9 +13,9 @@
import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.block.state.BlockState;
-import net.neoforged.neoforge.client.ChunkRenderTypeSet;
-import net.neoforged.neoforge.client.model.data.ModelData;
-import net.neoforged.neoforge.client.model.data.MultipartModelData;
+import net.minecraftforge.client.ChunkRenderTypeSet;
+import net.minecraftforge.client.model.data.ModelData;
+import net.minecraftforge.client.model.data.MultipartModelData;
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.*;
@@ -51,7 +51,7 @@ private void storeClassInfo(List, BakedModel>> list,
* @author JellySquid
* @reason Avoid expensive allocations and replace bitfield indirection
*/
- @Overwrite
+ @Overwrite(remap = false)
public List getQuads(@Nullable BlockState state, @Nullable Direction direction, RandomSource random, ModelData modelData, @org.jetbrains.annotations.Nullable RenderType renderType) {
if (state == null) {
return Collections.emptyList();
@@ -102,7 +102,7 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction
* @author embeddedt, IMS
* @reason Optimize render type lookup using existing cache
*/
- @Overwrite
+ @Overwrite(remap = false)
public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource random, @NotNull ModelData data) {
long seed = random.nextLong();
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/mixin/features/model/WeightedBakedModelMixin.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/mixin/features/model/WeightedBakedModelMixin.java
index 29863fc9c3..c20c187d7e 100644
--- a/neoforge/src/main/java/net/caffeinemc/mods/sodium/mixin/features/model/WeightedBakedModelMixin.java
+++ b/neoforge/src/main/java/net/caffeinemc/mods/sodium/mixin/features/model/WeightedBakedModelMixin.java
@@ -8,8 +8,8 @@
import net.minecraft.util.RandomSource;
import net.minecraft.util.random.WeightedEntry;
import net.minecraft.world.level.block.state.BlockState;
-import net.neoforged.neoforge.client.ChunkRenderTypeSet;
-import net.neoforged.neoforge.client.model.data.ModelData;
+import net.minecraftforge.client.ChunkRenderTypeSet;
+import net.minecraftforge.client.model.data.ModelData;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.*;
@@ -49,12 +49,12 @@ private static T getAt(List pool, int totalWeight)
* @author JellySquid
* @reason Avoid excessive object allocations
*/
- @Overwrite
+ @Overwrite(remap = false)
public List getQuads(@javax.annotation.Nullable BlockState state, @javax.annotation.Nullable Direction face, RandomSource random, ModelData modelData, @org.jetbrains.annotations.Nullable RenderType renderType) {
WeightedEntry.Wrapper quad = getAt(this.list, Math.abs((int) random.nextLong()) % this.totalWeight);
if (quad != null) {
- return quad.data()
+ return quad.getData()
.getQuads(state, face, random, modelData, renderType);
}
@@ -65,12 +65,12 @@ public List getQuads(@javax.annotation.Nullable BlockState state, @ja
* @author JellySquid
* @reason Avoid excessive object allocations
*/
- @Overwrite
+ @Overwrite(remap = false)
public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
WeightedEntry.Wrapper quad = getAt(this.list, Math.abs((int) rand.nextLong()) % this.totalWeight);
if (quad != null) {
- return quad.data()
+ return quad.getData()
.getRenderTypes(state, rand, data);
}
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/mixin/features/render/model/block/ModelBlockRendererMixin.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/mixin/features/render/model/block/ModelBlockRendererMixin.java
index 4932ad7adc..aacad514e7 100644
--- a/neoforge/src/main/java/net/caffeinemc/mods/sodium/mixin/features/render/model/block/ModelBlockRendererMixin.java
+++ b/neoforge/src/main/java/net/caffeinemc/mods/sodium/mixin/features/render/model/block/ModelBlockRendererMixin.java
@@ -16,7 +16,7 @@
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.SingleThreadedRandomSource;
-import net.neoforged.neoforge.client.model.data.ModelData;
+import net.minecraftforge.client.model.data.ModelData;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
@@ -35,7 +35,7 @@ public class ModelBlockRendererMixin {
* @reason Use optimized vertex writer intrinsics, avoid allocations
* @author JellySquid
*/
- @Inject(method = "renderModel(Lcom/mojang/blaze3d/vertex/PoseStack$Pose;Lcom/mojang/blaze3d/vertex/VertexConsumer;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/client/resources/model/BakedModel;FFFIILnet/neoforged/neoforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)V", at = @At("HEAD"), cancellable = true)
+ @Inject(remap = false, method = "renderModel(Lcom/mojang/blaze3d/vertex/PoseStack$Pose;Lcom/mojang/blaze3d/vertex/VertexConsumer;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/client/resources/model/BakedModel;FFFIILnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)V", at = @At("HEAD"), cancellable = true)
private void renderFast(PoseStack.Pose entry, VertexConsumer vertexConsumer, BlockState blockState, BakedModel bakedModel, float red, float green, float blue, int light, int overlay, ModelData modelData, RenderType renderType, CallbackInfo ci) {
var writer = VertexConsumerUtils.convertOrLog(vertexConsumer);
if(writer == null) {
diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/mixin/features/textures/mipmaps/SpriteContentsMixin.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/mixin/features/textures/mipmaps/SpriteContentsMixin.java
similarity index 91%
rename from common/src/main/java/net/caffeinemc/mods/sodium/mixin/features/textures/mipmaps/SpriteContentsMixin.java
rename to neoforge/src/main/java/net/caffeinemc/mods/sodium/mixin/features/textures/mipmaps/SpriteContentsMixin.java
index c59a26dec7..e64472d7ff 100644
--- a/common/src/main/java/net/caffeinemc/mods/sodium/mixin/features/textures/mipmaps/SpriteContentsMixin.java
+++ b/neoforge/src/main/java/net/caffeinemc/mods/sodium/mixin/features/textures/mipmaps/SpriteContentsMixin.java
@@ -34,7 +34,7 @@ public class SpriteContentsMixin {
// support Forge, since this works well on Fabric too, it's fine to ensure that the diff between Fabric and Forge
// can remain minimal. Being less dependent on specific details of Fabric is good, since it means we can be more
// cross-platform.
- @Redirect(method = "", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/texture/SpriteContents;originalImage:Lcom/mojang/blaze3d/platform/NativeImage;", opcode = Opcodes.PUTFIELD))
+ @Redirect(method = "(Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/resources/metadata/animation/FrameSize;Lcom/mojang/blaze3d/platform/NativeImage;Lnet/minecraft/client/resources/metadata/animation/AnimationMetadataSection;Lnet/minecraftforge/client/textures/ForgeTextureMetadata;)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/texture/SpriteContents;originalImage:Lcom/mojang/blaze3d/platform/NativeImage;", opcode = Opcodes.PUTFIELD))
private void sodium$beforeGenerateMipLevels(SpriteContents instance, NativeImage nativeImage, ResourceLocation identifier) {
// We're injecting after the "info" field has been set, so this is safe even though we're in a constructor.
sodium$fillInTransparentPixelColors(nativeImage);
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/BlockSpriteFinder.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/BlockSpriteFinder.java
index cfcc36028c..2b237e7e04 100644
--- a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/BlockSpriteFinder.java
+++ b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/BlockSpriteFinder.java
@@ -39,10 +39,10 @@ public class BlockSpriteFinder {
private final TextureAtlas spriteAtlasTexture;
private int badSpriteCount = 0;
- public BlockSpriteFinder(Map sprites, TextureAtlas spriteAtlasTexture) {
+ public BlockSpriteFinder(TextureAtlas spriteAtlasTexture) {
root = new Node(0.5f, 0.5f, 0.25f);
this.spriteAtlasTexture = spriteAtlasTexture;
- sprites.values().forEach(root::add);
+ spriteAtlasTexture.getTextureLocations().forEach((loc) -> root.add(spriteAtlasTexture.getSprite(loc)));
}
public TextureAtlasSprite find(float u, float v) {
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/MixinConfigImpl.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/MixinConfigImpl.java
index c42e48cf10..a547567ffc 100644
--- a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/MixinConfigImpl.java
+++ b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/MixinConfigImpl.java
@@ -1,8 +1,8 @@
package net.caffeinemc.mods.sodium.neoforge;
import net.caffeinemc.mods.sodium.client.data.config.MixinConfig;
-import net.neoforged.fml.loading.FMLLoader;
-import net.neoforged.fml.loading.moddiscovery.ModInfo;
+import net.minecraftforge.fml.loading.FMLLoader;
+import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import java.util.Map;
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/SodiumForgeMod.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/SodiumForgeMod.java
index f5eb52dd4f..ef8930c90c 100644
--- a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/SodiumForgeMod.java
+++ b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/SodiumForgeMod.java
@@ -9,19 +9,21 @@
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
-import net.neoforged.bus.api.IEventBus;
-import net.neoforged.fml.ModList;
-import net.neoforged.fml.ModLoadingContext;
-import net.neoforged.fml.common.Mod;
-import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent;
-import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
+import net.minecraftforge.client.ConfigScreenHandler;
+import net.minecraftforge.fml.ModList;
+import net.minecraftforge.fml.ModLoadingContext;
+import net.minecraftforge.fml.common.Mod;
+import net.minecraftforge.client.event.RegisterClientReloadListenersEvent;
+import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
+
+import java.util.function.Supplier;
@Mod("sodium")
public class SodiumForgeMod {
- public SodiumForgeMod(IEventBus bus) {
+ public SodiumForgeMod() {
SodiumClientMod.onInitialization(ModList.get().getModContainerById("sodium").get().getModInfo().getVersion().toString());
- bus.addListener(this::onResourceReload);
- ModLoadingContext.get().registerExtensionPoint(IConfigScreenFactory.class, () -> (minecraft, screen) -> SodiumOptionsGUI.createScreen(screen));
+ FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onResourceReload);
+ ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () -> new ConfigScreenHandler.ConfigScreenFactory((mc, screen) -> SodiumOptionsGUI.createScreen(screen)));
RendererAccess.INSTANCE.registerRenderer(SodiumRenderer.INSTANCE);
}
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/SodiumNeoforgeHelpers.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/SodiumNeoforgeHelpers.java
index 8dc1c25c23..ce46382aa9 100644
--- a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/SodiumNeoforgeHelpers.java
+++ b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/SodiumNeoforgeHelpers.java
@@ -33,16 +33,16 @@
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.levelgen.structure.BoundingBox;
import net.minecraft.world.level.material.FluidState;
-import net.neoforged.fml.loading.FMLConfig;
-import net.neoforged.fml.loading.FMLLoader;
-import net.neoforged.fml.loading.FMLPaths;
-import net.neoforged.neoforge.client.ClientHooks;
-import net.neoforged.neoforge.client.event.AddSectionGeometryEvent;
-import net.neoforged.neoforge.client.model.data.ModelData;
+import net.minecraftforge.client.ForgeHooksClient;
+import net.minecraftforge.fml.loading.FMLConfig;
+import net.minecraftforge.fml.loading.FMLLoader;
+import net.minecraftforge.fml.loading.FMLPaths;
+import net.minecraftforge.client.model.data.ModelData;
import org.joml.Matrix4f;
import java.nio.file.Path;
import java.util.List;
+import java.util.Map;
import java.util.function.Function;
public class SodiumNeoforgeHelpers implements SodiumPlatformHelpers {
@@ -62,9 +62,8 @@ public Path getConfigDir() {
}
@Override
- public Object getRenderData(Level level, BoundingBox pos, BlockEntity value) {
- return level.getModelDataManager().snapshotSectionRegion(pos.minX() >> 4, pos.minY() >> 4, pos.minZ() >> 4,
- pos.maxX() >> 4, pos.maxY() >> 4, pos.maxZ() >> 4);
+ public Object getRenderData(Level level, ChunkPos pos, BlockEntity value) {
+ return level.getModelDataManager().getAt(pos);
}
@Override
@@ -89,8 +88,10 @@ public List getQuads(BlockAndTintGetter level, BlockPos pos, BakedMod
@Override
public Object getModelData(Object o, BlockPos pos) {
- if ((o instanceof Long2ObjectFunction>)) {
- return ((Long2ObjectFunction) o).apply(pos.asLong());
+ if ((o instanceof Map,?>)) {
+ return ((Map) o).getOrDefault(pos, ModelData.EMPTY);
+ } else if (o != null) {
+ throw new IllegalStateException("Model data map was somehow an " + o.getClass().getName());
} else {
return ModelData.EMPTY;
}
@@ -122,8 +123,8 @@ public boolean renderFluidFromVanilla() {
}
@Override
- public void runChunkLayerEvents(RenderType renderType, LevelRenderer levelRenderer, Matrix4f modelMatrix, Matrix4f projectionMatrix, int renderTick, Camera camera, Frustum frustum) {
- ClientHooks.dispatchRenderStage(renderType, levelRenderer, modelMatrix, projectionMatrix, renderTick, camera, frustum);
+ public void runChunkLayerEvents(RenderType renderType, LevelRenderer levelRenderer, PoseStack modelMatrix, Matrix4f projectionMatrix, int renderTick, Camera camera, Frustum frustum) {
+ ForgeHooksClient.dispatchRenderStage(renderType, levelRenderer, modelMatrix, projectionMatrix, renderTick, camera, frustum);
}
@Override
@@ -155,25 +156,4 @@ public void renderConnectionsInSection(ChunkBuildBuffers buffers, LevelSlice wor
public boolean shouldRenderIE(SectionPos position) {
return ImmersiveEngineeringCompat.isLoaded && ImmersiveEngineeringCompat.sectionNeedsRendering(position);
}
-
- @Override
- public List> getExtraRenderers(Level level, BlockPos origin) {
- return ClientHooks.gatherAdditionalRenderers(origin, level);
- }
-
- @Override
- public Object getLightManager(LevelChunk chunk, SectionPos pos) {
- return chunk.getAuxLightManager(pos.origin());
- }
-
- private static final ThreadLocal emptyStack = ThreadLocal.withInitial(PoseStack::new);
-
- @Override
- public void renderAdditionalRenderers(List> renderers, Function typeToConsumer, LevelSlice slice) {
- AddSectionGeometryEvent.SectionRenderingContext context = new AddSectionGeometryEvent.SectionRenderingContext(typeToConsumer, slice, emptyStack.get());
- for (int i = 0, renderersSize = renderers.size(); i < renderersSize; i++) {
- AddSectionGeometryEvent.AdditionalSectionRenderer renderer = (AddSectionGeometryEvent.AdditionalSectionRenderer) renderers.get(i);
- renderer.render(context);
- }
- }
}
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/iecompat/ImmersiveEngineeringCompat.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/iecompat/ImmersiveEngineeringCompat.java
index 8e4ffa467d..3ddcea0cae 100644
--- a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/iecompat/ImmersiveEngineeringCompat.java
+++ b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/iecompat/ImmersiveEngineeringCompat.java
@@ -3,7 +3,7 @@
import net.caffeinemc.mods.sodium.client.render.chunk.compile.ChunkBuildBuffers;
import net.caffeinemc.mods.sodium.client.world.LevelSlice;
import net.minecraft.core.SectionPos;
-import net.neoforged.fml.loading.FMLLoader;
+import net.minecraftforge.fml.loading.FMLLoader;
public class ImmersiveEngineeringCompat {
public static boolean isLoaded = FMLLoader.getLoadingModList().getModFileById("immersiveengineering") != null;
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/ChunkRenderTypeSetAccessor.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/ChunkRenderTypeSetAccessor.java
index 08770fd51a..e68ceed9c7 100644
--- a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/ChunkRenderTypeSetAccessor.java
+++ b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/ChunkRenderTypeSetAccessor.java
@@ -1,6 +1,6 @@
package net.caffeinemc.mods.sodium.neoforge.mixin;
-import net.neoforged.neoforge.client.ChunkRenderTypeSet;
+import net.minecraftforge.client.ChunkRenderTypeSet;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.gen.Invoker;
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/ClientHooksMixin.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/ClientHooksMixin.java
deleted file mode 100644
index 81c5a286a6..0000000000
--- a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/ClientHooksMixin.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package net.caffeinemc.mods.sodium.neoforge.mixin;
-
-import net.minecraft.client.renderer.texture.TextureAtlasSprite;
-import net.neoforged.neoforge.client.ClientHooks;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Redirect;
-
-@Mixin(ClientHooks.class)
-public class ClientHooksMixin {
- // TODO: This is not a proper fix at all. Figure out why Forge is causing the UV shrink ratio to go insane.
- @Redirect(method = "fixItemModelSeams", at = @At(value = "INVOKE", target =
- "Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;uvShrinkRatio()F"))
- private static float alterUvShrinkRatio(TextureAtlasSprite sprite) {
- return 0.0f;
- }
-}
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/ForgeGUIMixin.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/ForgeGUIMixin.java
new file mode 100644
index 0000000000..7b98e8453a
--- /dev/null
+++ b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/ForgeGUIMixin.java
@@ -0,0 +1,87 @@
+package net.caffeinemc.mods.sodium.neoforge.mixin;
+
+import com.google.common.base.Strings;
+import com.llamalad7.mixinextras.sugar.Local;
+import com.mojang.blaze3d.systems.RenderSystem;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Font;
+import net.minecraft.client.gui.GuiGraphics;
+import net.minecraftforge.client.gui.overlay.ForgeGui;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Fixes a bug exclusive to Forge 1.20.1 that makes it not render text efficiently.
+ */
+@Mixin(value = ForgeGui.class, remap = false)
+public abstract class ForgeGUIMixin {
+ @Shadow
+ private Font font;
+
+ @Shadow
+ public abstract Minecraft getMinecraft();
+
+ @Inject(method = "renderHUDText", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/eventbus/api/IEventBus;post(Lnet/minecraftforge/eventbus/api/Event;)Z", shift = At.Shift.AFTER), cancellable = true)
+ private void sodium$rewriteForgeHUD(int width, int height, GuiGraphics guiGraphics, CallbackInfo ci, @Local(ordinal = 0) ArrayList listL, @Local(ordinal = 1) ArrayList listR) {
+ ci.cancel();
+
+ guiGraphics.drawManaged(() -> {
+ renderBackdrop(guiGraphics, listL, true);
+ renderBackdrop(guiGraphics, listR, false);
+ renderText(guiGraphics, listL, true);
+ renderText(guiGraphics, listR, false);
+ });
+
+ this.getMinecraft().getProfiler().pop();
+ }
+
+ private void renderText(GuiGraphics guiGraphics, ArrayList list, boolean left) {
+ for (int i = 0; i < list.size(); ++i) {
+ String string = list.get(i);
+
+ if (!Strings.isNullOrEmpty(string)) {
+ int height = 9;
+ int width = this.font.width(string);
+
+ int x1 = left ? 2 : this.getMinecraft().getWindow().getGuiScaledWidth() - 2 - width;
+ int y1 = 2 + (height * i);
+
+ guiGraphics.drawString(font, string, x1, y1, 0xe0e0e0, false);
+ }
+ }
+ }
+
+ private void renderBackdrop(GuiGraphics guiGraphics, List list, boolean left) {
+ RenderSystem.enableBlend();
+ RenderSystem.defaultBlendFunc();
+
+ int color = 0x90505050;
+
+ for (int i = 0; i < list.size(); ++i) {
+ String string = list.get(i);
+
+ if (Strings.isNullOrEmpty(string)) {
+ continue;
+ }
+
+ int height = 9;
+ int width = this.font.width(string);
+
+ int x = left ? 2 : this.getMinecraft().getWindow().getGuiScaledWidth() - 2 - width;
+ int y = 2 + height * i;
+
+ int x1 = x - 1;
+ int y1 = y - 1;
+ int x2 = x + width + 1;
+ int y2 = y + height - 1;
+
+ guiGraphics.fill(x1, y1, x2, y2, -1873784752);
+ }
+ }
+}
\ No newline at end of file
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/LevelSliceMixin.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/LevelSliceMixin.java
deleted file mode 100644
index d9c54c7717..0000000000
--- a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/LevelSliceMixin.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package net.caffeinemc.mods.sodium.neoforge.mixin;
-
-
-import net.caffeinemc.mods.sodium.client.world.LevelSlice;
-import net.minecraft.core.BlockPos;
-import net.minecraft.world.level.BlockAndTintGetter;
-import net.minecraft.world.level.ChunkPos;
-import net.neoforged.neoforge.client.model.data.ModelDataManager;
-import net.neoforged.neoforge.common.world.AuxiliaryLightManager;
-import org.jetbrains.annotations.Nullable;
-import org.spongepowered.asm.mixin.Final;
-import net.neoforged.neoforge.client.model.data.ModelData;
-import net.neoforged.neoforge.common.extensions.IBlockGetterExtension;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Shadow;
-
-/**
- * This is a self-mixin to implement Forge interfaces into LevelSlice.
- */
-@Mixin(LevelSlice.class)
-public abstract class LevelSliceMixin implements BlockAndTintGetter {
- @Shadow
- @Final
- private Object[] auxLightManager;
-
- @Shadow
- private @Nullable Object modelDataSnapshot;
-
- @Shadow
- private int originBlockX, originBlockY, originBlockZ;
-
- @Shadow
- public Object getPlatformModelData(BlockPos pos) {
- return null;
- }
-
- @Override
- public ModelData getModelData(BlockPos pos) {
- Object modelData = getPlatformModelData(pos);
- return modelData != null ? (ModelData) modelData : null;
- }
-
- @Shadow
- public static int getLocalSectionIndex(int sectionX, int sectionY, int sectionZ) {
- throw new IllegalStateException("Not shadowed!");
- }
-
- @Override
- public @Nullable AuxiliaryLightManager getAuxLightManager(ChunkPos pos) {
- int relChunkX = pos.x - (this.originBlockX >> 4);
- int relChunkZ = pos.z - (this.originBlockZ >> 4);
-
- return (AuxiliaryLightManager) auxLightManager[getLocalSectionIndex(relChunkX, 0, relChunkZ)];
- }
-
- @Override
- public @Nullable AuxiliaryLightManager getAuxLightManager(BlockPos pos) {
- int relBlockX = pos.getX() - this.originBlockX;
- int relBlockY = pos.getY() - this.originBlockY;
- int relBlockZ = pos.getZ() - this.originBlockZ;
-
- return (AuxiliaryLightManager) auxLightManager[getLocalSectionIndex(relBlockX >> 4, relBlockY >> 4, relBlockZ >> 4)];
- }
-}
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/SimpleBakedModelAccessor.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/SimpleBakedModelAccessor.java
index 9b4c2e1c04..e396a743f7 100644
--- a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/SimpleBakedModelAccessor.java
+++ b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/mixin/SimpleBakedModelAccessor.java
@@ -1,7 +1,7 @@
package net.caffeinemc.mods.sodium.neoforge.mixin;
import net.minecraft.client.resources.model.SimpleBakedModel;
-import net.neoforged.neoforge.client.ChunkRenderTypeSet;
+import net.minecraftforge.client.ChunkRenderTypeSet;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/render/FluidRendererImpl.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/render/FluidRendererImpl.java
index 38e99f005e..6689e9d309 100644
--- a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/render/FluidRendererImpl.java
+++ b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/render/FluidRendererImpl.java
@@ -17,8 +17,8 @@
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
-import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions;
-import net.neoforged.neoforge.client.textures.FluidSpriteCache;
+import net.minecraftforge.client.ForgeHooksClient;
+import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
public class FluidRendererImpl extends FluidRenderer {
// The current default context is set up before invoking FluidRenderHandler#renderFluid and cleared afterwards.
@@ -78,9 +78,7 @@ public void render(LevelSlice level, BlockState blockState, FluidState fluidStat
defaultContext.setUp(this.colorProviderRegistry, this.defaultRenderer, level, fluidState, blockPos, offset, collector, meshBuilder, material, handler);
try {
- if (!handler.renderFluid(fluidState, level, blockPos, meshBuilder.asFallbackVertexConsumer(material, collector), blockState)) {
- defaultContext.renderIfSetUp();
- }
+ defaultContext.renderIfSetUp();
} finally {
defaultContext.clear();
}
@@ -136,7 +134,7 @@ public ColorProvider getColorProvider(Fluid fluid) {
public boolean renderIfSetUp() {
if (this.renderer != null) {
this.renderer.render(this.level, this.fluidState, this.blockPos, this.offset, this.collector, this.meshBuilder, this.material,
- getColorProvider(fluidState.getType()), FluidSpriteCache.getFluidSprites(level, blockPos, fluidState));
+ getColorProvider(fluidState.getType()), ForgeHooksClient.getFluidSprites(level, blockPos, fluidState));
return true;
}
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/render/ForgeColorProviders.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/render/ForgeColorProviders.java
index 3e4fed7d7d..a1fa1311d2 100644
--- a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/render/ForgeColorProviders.java
+++ b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/render/ForgeColorProviders.java
@@ -6,7 +6,7 @@
import net.caffeinemc.mods.sodium.client.world.LevelSlice;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.material.FluidState;
-import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions;
+import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
import java.util.Arrays;
diff --git a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/render/SpriteFinderCache.java b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/render/SpriteFinderCache.java
index 46beb04789..d1322c3333 100644
--- a/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/render/SpriteFinderCache.java
+++ b/neoforge/src/main/java/net/caffeinemc/mods/sodium/neoforge/render/SpriteFinderCache.java
@@ -32,7 +32,7 @@ private ReloadListener() {
public void onResourceManagerReload(ResourceManager manager) {
ModelManager modelManager = Minecraft.getInstance().getModelManager();
TextureAtlas atlas = modelManager.getAtlas(TextureAtlas.LOCATION_BLOCKS);
- blockAtlasSpriteFinder = new BlockSpriteFinder(atlas.getTextures(), atlas);
+ blockAtlasSpriteFinder = new BlockSpriteFinder(atlas);
}
}
}
diff --git a/neoforge/src/main/resources/META-INF/accesstransformer.cfg b/neoforge/src/main/resources/META-INF/accesstransformer.cfg
index 62d286afca..3d84cf87c8 100644
--- a/neoforge/src/main/resources/META-INF/accesstransformer.cfg
+++ b/neoforge/src/main/resources/META-INF/accesstransformer.cfg
@@ -15,6 +15,6 @@ public net.minecraft.client.renderer.SectionBufferBuilderPool (Ljava/util/
public com.mojang.blaze3d.vertex.PoseStack$Pose (Lorg/joml/Matrix4f;Lorg/joml/Matrix3f;)V
public com.mojang.blaze3d.vertex.PoseStack$Pose trustedNormals # trustedNormals
-public net.minecraft.world.level.GrassColor pixels
-public net.minecraft.world.level.FoliageColor pixels
-public net.minecraft.client.renderer.FogRenderer getPriorityFogFunction(Lnet/minecraft/world/entity/Entity;F)Lnet/minecraft/client/renderer/FogRenderer$MobEffectFogFunction;
\ No newline at end of file
+public net.minecraft.world.level.GrassColor f_46413_
+public net.minecraft.world.level.FoliageColor f_46104_
+public net.minecraft.client.renderer.FogRenderer m_234165_(Lnet/minecraft/world/entity/Entity;F)Lnet/minecraft/client/renderer/FogRenderer$MobEffectFogFunction;
\ No newline at end of file
diff --git a/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/neoforge/src/main/resources/META-INF/mods.toml
similarity index 59%
rename from neoforge/src/main/resources/META-INF/neoforge.mods.toml
rename to neoforge/src/main/resources/META-INF/mods.toml
index 335e1e1906..b9339ffe4b 100644
--- a/neoforge/src/main/resources/META-INF/neoforge.mods.toml
+++ b/neoforge/src/main/resources/META-INF/mods.toml
@@ -19,17 +19,4 @@ Sodium is a powerful rendering engine for Minecraft which improves frame rates a
provides = ["indium"]
[modproperties.sodium]
-"fabric-renderer-api-v1:contains_renderer"=true
-
-[[dependencies.sodium]]
-modId="minecraft"
-type="required"
-versionRange="[1.20.4,1.21)"
-ordering="NONE"
-side="CLIENT"
-
-[[mixins]]
-config = "sodium.mixins.json"
-
-[[mixins]]
-config = "sodium-forge.mixins.json"
\ No newline at end of file
+"fabric-renderer-api-v1:contains_renderer"=true
\ No newline at end of file
diff --git a/neoforge/src/main/resources/pack.mcmeta b/neoforge/src/main/resources/pack.mcmeta
new file mode 100644
index 0000000000..e17076d5f7
--- /dev/null
+++ b/neoforge/src/main/resources/pack.mcmeta
@@ -0,0 +1,10 @@
+{
+ "pack": {
+ "pack_format": 7,
+ "supported_formats": {
+ "min_inclusive": 16,
+ "max_inclusive": 90000
+ },
+ "description": "Sodium"
+ }
+}
\ No newline at end of file
diff --git a/neoforge/src/main/resources/sodium-forge.mixins.json b/neoforge/src/main/resources/sodium-forge.mixins.json
index 2a4da195fa..12615cf6da 100644
--- a/neoforge/src/main/resources/sodium-forge.mixins.json
+++ b/neoforge/src/main/resources/sodium-forge.mixins.json
@@ -10,9 +10,8 @@
"conformVisibility": true
},
"client" : [
- "ClientHooksMixin",
+ "ForgeGUIMixin",
"ChunkRenderTypeSetAccessor",
- "LevelSliceMixin",
"SimpleBakedModelAccessor"
]
}
\ No newline at end of file
diff --git a/neoforge/src/service/java/net/caffeinemc/mods/sodium/service/ModLocator.java b/neoforge/src/service/java/net/caffeinemc/mods/sodium/service/ModLocator.java
index 28a9b2dbaf..4e8bd48767 100644
--- a/neoforge/src/service/java/net/caffeinemc/mods/sodium/service/ModLocator.java
+++ b/neoforge/src/service/java/net/caffeinemc/mods/sodium/service/ModLocator.java
@@ -5,11 +5,11 @@
import net.neoforged.fml.ModLoadingException;
import net.neoforged.fml.ModLoadingIssue;
import net.neoforged.fml.loading.StringUtils;
-import net.neoforged.neoforgespi.ILaunchContext;
-import net.neoforged.neoforgespi.locating.IDiscoveryPipeline;
-import net.neoforged.neoforgespi.locating.IModFileCandidateLocator;
-import net.neoforged.neoforgespi.locating.IncompatibleFileReporting;
-import net.neoforged.neoforgespi.locating.ModFileDiscoveryAttributes;
+import net.minecraftforgespi.ILaunchContext;
+import net.minecraftforgespi.locating.IDiscoveryPipeline;
+import net.minecraftforgespi.locating.IModFileCandidateLocator;
+import net.minecraftforgespi.locating.IncompatibleFileReporting;
+import net.minecraftforgespi.locating.ModFileDiscoveryAttributes;
import org.lwjgl.system.Configuration;
import java.io.IOException;
diff --git a/neoforge/src/service/java/net/caffeinemc/mods/sodium/service/SodiumWorkarounds.java b/neoforge/src/service/java/net/caffeinemc/mods/sodium/service/SodiumWorkarounds.java
index 163a58a7b7..f49559a082 100644
--- a/neoforge/src/service/java/net/caffeinemc/mods/sodium/service/SodiumWorkarounds.java
+++ b/neoforge/src/service/java/net/caffeinemc/mods/sodium/service/SodiumWorkarounds.java
@@ -4,7 +4,7 @@
import net.caffeinemc.mods.sodium.client.compatibility.environment.probe.GraphicsAdapterProbe;
import net.caffeinemc.mods.sodium.client.compatibility.workarounds.Workarounds;
import net.caffeinemc.mods.sodium.client.compatibility.workarounds.nvidia.NvidiaWorkarounds;
-import net.neoforged.neoforgespi.earlywindow.GraphicsBootstrapper;
+import net.minecraftforgespi.earlywindow.GraphicsBootstrapper;
public class SodiumWorkarounds implements GraphicsBootstrapper {
@Override
diff --git a/settings.gradle.kts b/settings.gradle.kts
index cf5c8ba9fe..380947dfef 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -3,9 +3,9 @@ rootProject.name = "sodium"
pluginManagement {
repositories {
maven { url = uri("https://maven.fabricmc.net/") }
- maven { url = uri("https://maven.architectury.dev/") }
maven { url = uri("https://files.minecraftforge.net/maven/") }
maven { url = uri("https://maven.neoforged.net/releases/") }
+ maven { url = uri("https://repo.spongepowered.org/repository/maven-public/") }
gradlePluginPortal()
}
}