From 4916249af135eec5ca9624d9af1716f2c2364682 Mon Sep 17 00:00:00 2001 From: Anthony Hilyard Date: Fri, 9 Jun 2023 14:00:33 -0700 Subject: Reverted sodium support changes. Fixes AHilyard/LegendaryTooltips#79. --- CHANGELOG.md | 3 +++ build.gradle | 2 +- gradle.properties | 2 +- .../anthonyhilyard/iceberg/renderer/CheckedBufferSource.java | 4 ++-- .../iceberg/renderer/CheckedBufferSourceSodium.java | 4 ++-- .../com/anthonyhilyard/iceberg/renderer/VertexCollector.java | 4 ++-- .../iceberg/renderer/VertexCollectorSodium.java | 12 ++++++------ .../iceberg/renderer/VertexConsumerSodium.java | 2 +- src/main/resources/fabric.mod.json | 2 +- 9 files changed, 19 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d1cd7a..3a955cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ - Fixed a conflict when installed with TooltipFix and Legendary Tooltips that caused tooltips to have broken shadows. - Fixed a crash when installed with older versions of Sodium. +### 1.1.9.1 +- Fixed a conflict that prevented mod from working on Quilt loader. + ### 1.1.9 - Fixed a bug that could cause crashes when trying to preview fishing rods. diff --git a/build.gradle b/build.gradle index db427b5..7e0aaaf 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ dependencies { mappings loom.officialMojangMappings() modImplementation "net.fabricmc:fabric-loader:${project.loaderVersion}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabricVersion}" - modImplementation files("libs/sodium-fabric-mc1.19.4-0.4.11+build.26.jar") + modImplementation files("libs/sodium-fabric-mc1.19.4-0.4.10+build.24.jar") } loom { diff --git a/gradle.properties b/gradle.properties index d06ca0d..1e65e2a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.daemon=false name=${rootProject.name} group=com.anthonyhilyard.${name.toLowerCase()} author=anthonyhilyard -version=1.1.10 +version=1.1.9.1 mcVersion=1.19.4 fabricVersion=0.78.0+1.19.4 diff --git a/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSource.java b/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSource.java index d97eca2..4eaab58 100644 --- a/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSource.java +++ b/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSource.java @@ -28,8 +28,8 @@ public class CheckedBufferSource implements MultiBufferSource { try { - // If Sodium 0.4.11 is installed, use the Sodium implementation. - useSodiumVersion = FabricLoader.getInstance().isModLoaded("sodium") && VersionPredicate.parse("0.4.11").test(FabricLoader.getInstance().getModContainer("sodium").get().getMetadata().getVersion()); + // If Sodium 0.4.10 is installed, use the Sodium implementation. + useSodiumVersion = FabricLoader.getInstance().isModLoaded("sodium") && VersionPredicate.parse("0.4.10").test(FabricLoader.getInstance().getModContainer("sodium").get().getMetadata().getVersion()); } catch (Exception e) { diff --git a/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSourceSodium.java b/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSourceSodium.java index d4e1156..2a37254 100644 --- a/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSourceSodium.java +++ b/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSourceSodium.java @@ -7,8 +7,8 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.caffeinemc.mods.sodium.api.vertex.buffer.VertexBufferWriter; -import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription; +import me.jellysquid.mods.sodium.client.render.vertex.VertexBufferWriter; +import me.jellysquid.mods.sodium.client.render.vertex.VertexFormatDescription; public final class CheckedBufferSourceSodium extends CheckedBufferSource { diff --git a/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollector.java b/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollector.java index 07ce9be..0c6b9c9 100644 --- a/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollector.java +++ b/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollector.java @@ -34,8 +34,8 @@ public class VertexCollector implements MultiBufferSource { try { - // If Sodium 0.4.11 is installed, use the Sodium implementation. - useSodiumVersion = FabricLoader.getInstance().isModLoaded("sodium") && VersionPredicate.parse("0.4.11").test(FabricLoader.getInstance().getModContainer("sodium").get().getMetadata().getVersion()); + // If Sodium 0.4.10 is installed, use the Sodium implementation. + useSodiumVersion = FabricLoader.getInstance().isModLoaded("sodium") && VersionPredicate.parse("0.4.10").test(FabricLoader.getInstance().getModContainer("sodium").get().getMetadata().getVersion()); } catch (Exception e) { diff --git a/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollectorSodium.java b/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollectorSodium.java index dab44b2..ed0fb7c 100644 --- a/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollectorSodium.java +++ b/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollectorSodium.java @@ -8,8 +8,8 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.renderer.RenderType; -import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription; -import net.caffeinemc.mods.sodium.api.vertex.attributes.CommonVertexAttribute; +import me.jellysquid.mods.sodium.client.render.vertex.VertexFormatDescription; +import me.jellysquid.mods.sodium.client.render.vertex.transform.CommonVertexElement; public class VertexCollectorSodium extends VertexCollector { @@ -79,12 +79,12 @@ public class VertexCollectorSodium extends VertexCollector for (int i = 0; i < count; i++) { // Get the vertex position. - float x = UnsafeUtil.readFloat(pointer + i * format.stride() + format.getElementOffset(CommonVertexAttribute.POSITION)); - float y = UnsafeUtil.readFloat(pointer + i * format.stride() + format.getElementOffset(CommonVertexAttribute.POSITION) + 4); - float z = UnsafeUtil.readFloat(pointer + i * format.stride() + format.getElementOffset(CommonVertexAttribute.POSITION) + 8); + float x = UnsafeUtil.readFloat(pointer + i * format.stride + format.getOffset(CommonVertexElement.POSITION)); + float y = UnsafeUtil.readFloat(pointer + i * format.stride + format.getOffset(CommonVertexElement.POSITION) + 4); + float z = UnsafeUtil.readFloat(pointer + i * format.stride + format.getOffset(CommonVertexElement.POSITION) + 8); // Get the vertex alpha. - int a = UnsafeUtil.readByte(pointer + i * format.stride() + format.getElementOffset(CommonVertexAttribute.COLOR) + 3) & 0xFF; + int a = UnsafeUtil.readByte(pointer + i * format.stride + format.getOffset(CommonVertexElement.COLOR) + 3) & 0xFF; // Add the vertex to the list if it's opaque. if (a >= 25) diff --git a/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexConsumerSodium.java b/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexConsumerSodium.java index 7322576..c02ef30 100644 --- a/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexConsumerSodium.java +++ b/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexConsumerSodium.java @@ -2,7 +2,7 @@ package com.anthonyhilyard.iceberg.renderer; import com.mojang.blaze3d.vertex.VertexConsumer; -import net.caffeinemc.mods.sodium.api.vertex.buffer.VertexBufferWriter; +import me.jellysquid.mods.sodium.client.render.vertex.VertexBufferWriter; public interface VertexConsumerSodium extends VertexConsumer, VertexBufferWriter { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index d943c8c..8f4e5a0 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -34,7 +34,7 @@ "java": ">=17" }, "suggests": { - "sodium": "0.4.11" + "sodium": "0.4.10" }, "custom": { "modupdater": { -- cgit