diff options
author | Anthony Hilyard <anthony.hilyard@gmail.com> | 2023-12-02 09:46:44 -0800 |
---|---|---|
committer | Anthony Hilyard <anthony.hilyard@gmail.com> | 2023-12-02 09:46:44 -0800 |
commit | 8f249d845ca4e3b00218e4aa71750a478541b524 (patch) | |
tree | 4b65dcb40f8ebd3a4151c8b281c3440813603ba9 /src/main/java/com/anthonyhilyard/iceberg/renderer | |
parent | f37e965d1f2a8d8aa26c9673bc1c1fb732c22ecc (diff) | |
download | Iceberg-8f249d845ca4e3b00218e4aa71750a478541b524.tar.gz Iceberg-8f249d845ca4e3b00218e4aa71750a478541b524.tar.bz2 Iceberg-8f249d845ca4e3b00218e4aa71750a478541b524.zip |
Added support for Sodium 0.5.0.
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/renderer')
5 files changed, 14 insertions, 13 deletions
diff --git a/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSource.java b/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSource.java index 4eaab58..b5e0cf1 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.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()); + // If Sodium 0.5.0+ is installed, use the Sodium implementation. + useSodiumVersion = FabricLoader.getInstance().isModLoaded("sodium") && VersionPredicate.parse(">=0.5.0").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 2a37254..ce8d372 100644 --- a/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSourceSodium.java +++ b/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSourceSodium.java @@ -4,11 +4,12 @@ import org.lwjgl.system.MemoryStack; import com.mojang.blaze3d.vertex.VertexConsumer; +import net.caffeinemc.mods.sodium.api.vertex.buffer.VertexBufferWriter; +import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -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 0c6b9c9..ae7901a 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.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()); + // If Sodium 0.5.0+ is installed, use the Sodium implementation. + useSodiumVersion = FabricLoader.getInstance().isModLoaded("sodium") && VersionPredicate.parse(">=0.5.0").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 ed0fb7c..41d23f9 100644 --- a/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollectorSodium.java +++ b/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollectorSodium.java @@ -6,10 +6,10 @@ import org.lwjgl.system.MemoryStack; import com.anthonyhilyard.iceberg.util.UnsafeUtil; import com.mojang.blaze3d.vertex.VertexConsumer; +import net.caffeinemc.mods.sodium.api.vertex.attributes.CommonVertexAttribute; +import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription; import net.minecraft.client.renderer.RenderType; -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.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); + 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); // Get the vertex alpha. - int a = UnsafeUtil.readByte(pointer + i * format.stride + format.getOffset(CommonVertexElement.COLOR) + 3) & 0xFF; + int a = UnsafeUtil.readByte(pointer + i * format.stride() + format.getElementOffset(CommonVertexAttribute.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 c02ef30..7322576 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 me.jellysquid.mods.sodium.client.render.vertex.VertexBufferWriter; +import net.caffeinemc.mods.sodium.api.vertex.buffer.VertexBufferWriter; public interface VertexConsumerSodium extends VertexConsumer, VertexBufferWriter { |