From 7e2f2ce1d2af02a31368662a3e465ea1581e9112 Mon Sep 17 00:00:00 2001 From: Anthony Hilyard Date: Mon, 1 May 2023 10:19:06 -0700 Subject: Fixed Sodium crash. Fixed tooltip shadow bug. --- .../java/com/anthonyhilyard/iceberg/mixin/ScreenMixin.java | 4 ++-- .../anthonyhilyard/iceberg/renderer/CheckedBufferSource.java | 6 +++--- .../iceberg/renderer/CheckedBufferSourceSodium.java | 4 ++-- .../com/anthonyhilyard/iceberg/renderer/VertexCollector.java | 6 +++--- .../iceberg/renderer/VertexCollectorSodium.java | 12 ++++++------ .../iceberg/renderer/VertexConsumerSodium.java | 2 +- src/main/resources/fabric.mod.json | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/main/java/com/anthonyhilyard/iceberg/mixin/ScreenMixin.java b/src/main/java/com/anthonyhilyard/iceberg/mixin/ScreenMixin.java index 1b1d67d..3ce65ac 100644 --- a/src/main/java/com/anthonyhilyard/iceberg/mixin/ScreenMixin.java +++ b/src/main/java/com/anthonyhilyard/iceberg/mixin/ScreenMixin.java @@ -189,8 +189,8 @@ public class ScreenMixin extends AbstractContainerEventHandler if (!containerStack.isEmpty() && !components.isEmpty()) { - RenderTooltipEvents.POSTEXT.invoker().onPost(containerStack, components, poseStack, postPos.x(), postPos.y(), font, tooltipWidth, tooltipHeight, false, 0); - RenderTooltipEvents.POST.invoker().onPost(containerStack, components, poseStack, postPos.x(), postPos.y(), font, tooltipWidth, tooltipHeight, false); + RenderTooltipEvents.POSTEXT.invoker().onPost(containerStack, components, poseStack, postPos.x(), postPos.y(), font, tooltipWidth2, tooltipHeight2, false, 0); + RenderTooltipEvents.POST.invoker().onPost(containerStack, components, poseStack, postPos.x(), postPos.y(), font, tooltipWidth2, tooltipHeight2, false); } tooltipStack = ItemStack.EMPTY; diff --git a/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSource.java b/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSource.java index 2140178..d97eca2 100644 --- a/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSource.java +++ b/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSource.java @@ -6,7 +6,7 @@ import com.anthonyhilyard.iceberg.Loader; import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.loader.api.FabricLoader; -import net.fabricmc.loader.impl.util.version.VersionPredicateParser; +import net.fabricmc.loader.api.metadata.version.VersionPredicate; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; @@ -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") && VersionPredicateParser.parse("0.4.10").test(FabricLoader.getInstance().getModContainer("sodium").get().getMetadata().getVersion()); + // 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()); } 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..d4e1156 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 me.jellysquid.mods.sodium.client.render.vertex.VertexBufferWriter; -import me.jellysquid.mods.sodium.client.render.vertex.VertexFormatDescription; +import net.caffeinemc.mods.sodium.api.vertex.buffer.VertexBufferWriter; +import net.caffeinemc.mods.sodium.api.vertex.format.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 47ff098..07ce9be 100644 --- a/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollector.java +++ b/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollector.java @@ -10,7 +10,7 @@ import com.google.common.collect.Sets; import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.loader.api.FabricLoader; -import net.fabricmc.loader.impl.util.version.VersionPredicateParser; +import net.fabricmc.loader.api.metadata.version.VersionPredicate; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; @@ -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") && VersionPredicateParser.parse("0.4.10").test(FabricLoader.getInstance().getModContainer("sodium").get().getMetadata().getVersion()); + // 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()); } 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..dab44b2 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 me.jellysquid.mods.sodium.client.render.vertex.VertexFormatDescription; -import me.jellysquid.mods.sodium.client.render.vertex.transform.CommonVertexElement; +import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription; +import net.caffeinemc.mods.sodium.api.vertex.attributes.CommonVertexAttribute; 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 { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 8f4e5a0..d943c8c 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.10" + "sodium": "0.4.11" }, "custom": { "modupdater": { -- cgit