aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/anthonyhilyard/iceberg/renderer
diff options
context:
space:
mode:
authorAnthony Hilyard <anthony.hilyard@gmail.com>2023-04-20 14:06:02 -0700
committerAnthony Hilyard <anthony.hilyard@gmail.com>2023-04-20 14:06:02 -0700
commitb35061a82bed88966b6efdab39fc3c5b11cb0267 (patch)
treea5e9d6cd5e86a69aa1a03c58897909dda862176c /src/main/java/com/anthonyhilyard/iceberg/renderer
parentde97dac7b449909e46db843aa4e65ccdcc9eb9ff (diff)
downloadIceberg-b35061a82bed88966b6efdab39fc3c5b11cb0267.tar.gz
Iceberg-b35061a82bed88966b6efdab39fc3c5b11cb0267.tar.bz2
Iceberg-b35061a82bed88966b6efdab39fc3c5b11cb0267.zip
Ported changes through 1.1.8.
Fixed crash when previewing fishing rods.
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/renderer')
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSource.java4
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java128
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollector.java2
3 files changed, 73 insertions, 61 deletions
diff --git a/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSource.java b/src/main/java/com/anthonyhilyard/iceberg/renderer/CheckedBufferSource.java
index e0ae33a..706fd9c 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.9 is installed, use the Sodium implementation.
- useSodiumVersion = FabricLoader.getInstance().isModLoaded("sodium") && VersionPredicateParser.parse("0.4.9").test(FabricLoader.getInstance().getModContainer("sodium").get().getMetadata().getVersion());
+ // 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());
}
catch (Exception e)
{
diff --git a/src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java b/src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java
index 70a3481..88b3b6d 100644
--- a/src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java
+++ b/src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java
@@ -19,6 +19,7 @@ import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.datafixers.util.Pair;
+import com.mojang.math.Axis;
import com.mojang.math.MatrixUtil;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.pipeline.MainTarget;
@@ -44,8 +45,6 @@ import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.MultiBufferSource.BufferSource;
import net.minecraft.client.renderer.block.BlockModelShaper;
-import net.minecraft.client.renderer.block.model.ItemTransforms;
-import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.client.resources.model.ModelManager;
@@ -66,6 +65,7 @@ import net.minecraft.world.inventory.InventoryMenu;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.HorseArmorItem;
import net.minecraft.world.item.Item;
+import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
@@ -93,8 +93,8 @@ public class CustomItemRenderer extends ItemRenderer
private static Entity entity = null;
private static Pair<Item, CompoundTag> cachedArmorStandItem = null;
private static Pair<Item, CompoundTag> cachedHorseArmorItem = null;
- private static Item cachedEntityItem = null;
- private static Map<Item, ModelBounds> modelBoundsCache = Maps.newHashMap();
+ private static Pair<Item, CompoundTag> cachedEntityItem = null;
+ private static Map<Pair<Item, CompoundTag>, ModelBounds> modelBoundsCache = Maps.newHashMap();
private static final List<Direction> quadDirections;
static
@@ -103,17 +103,18 @@ public class CustomItemRenderer extends ItemRenderer
quadDirections.add(null);
}
- private Minecraft mc;
+ private Minecraft minecraft;
private final ModelManager modelManager;
private final BlockEntityWithoutLevelRenderer blockEntityRenderer;
+ private float blitOffset = 100.0f;
public CustomItemRenderer(TextureManager textureManagerIn, ModelManager modelManagerIn, ItemColors itemColorsIn, BlockEntityWithoutLevelRenderer blockEntityRendererIn, Minecraft mcIn)
{
- super(textureManagerIn, modelManagerIn, itemColorsIn, blockEntityRendererIn);
- mc = mcIn;
+ super(mcIn, textureManagerIn, modelManagerIn, itemColorsIn, blockEntityRendererIn);
+ minecraft = mcIn;
modelManager = modelManagerIn;
blockEntityRenderer = blockEntityRendererIn;
- if (mc.getResourceManager() instanceof ReloadableResourceManager resourceManager)
+ if (minecraft.getResourceManager() instanceof ReloadableResourceManager resourceManager)
{
resourceManager.registerReloadListener(this);
}
@@ -130,7 +131,7 @@ public class CustomItemRenderer extends ItemRenderer
private void renderGuiModel(ItemStack itemStack, int x, int y, Quaternionf rotation, BakedModel bakedModel)
{
- mc.getTextureManager().getTexture(InventoryMenu.BLOCK_ATLAS).setFilter(false, false);
+ minecraft.getTextureManager().getTexture(InventoryMenu.BLOCK_ATLAS).setFilter(false, false);
RenderSystem.setShaderTexture(0, InventoryMenu.BLOCK_ATLAS);
RenderSystem.enableBlend();
RenderSystem.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
@@ -150,7 +151,7 @@ public class CustomItemRenderer extends ItemRenderer
if (flatLighting) { Lighting.setupForFlatItems(); }
PoseStack poseStack = new PoseStack();
- renderModel(itemStack, ItemTransforms.TransformType.GUI, false, poseStack, rotation, bufferSource, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY, bakedModel);
+ renderModel(itemStack, ItemDisplayContext.GUI, false, poseStack, rotation, bufferSource, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY, bakedModel);
poseStack.popPose();
bufferSource.endBatch();
@@ -171,7 +172,16 @@ public class CustomItemRenderer extends ItemRenderer
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
entityRenderDispatcher.setRenderShadow(false);
- RenderSystem.runAsFancy(() -> entityRenderDispatcher.render(entity, 0.0, 0.0, 0.0, 0.0f, 1.0f, poseStack, bufferSource, packedLight));
+ poseStack.pushPose();
+ poseStack.mulPose(Axis.YP.rotationDegrees(90.0f));
+
+ try
+ {
+ RenderSystem.runAsFancy(() -> entityRenderDispatcher.render(entity, 0.0, 0.0, 0.0, 0.0f, 1.0f, poseStack, bufferSource, packedLight));
+ }
+ catch (Exception e) {}
+
+ poseStack.popPose();
if (bufferSource instanceof BufferSource source)
{
@@ -184,7 +194,7 @@ public class CustomItemRenderer extends ItemRenderer
Lighting.setupFor3DItems();
}
- private <T extends MultiBufferSource> void renderModelInternal(ItemStack itemStack, ItemTransforms.TransformType transformType, boolean leftHanded, PoseStack poseStack,
+ private <T extends MultiBufferSource> void renderModelInternal(ItemStack itemStack, ItemDisplayContext displayContext, boolean leftHanded, PoseStack poseStack,
Quaternionf rotation, T bufferSource, int packedLight, int packedOverlay, BakedModel bakedModel,
Predicate<T> bufferSourceReady)
{
@@ -194,14 +204,17 @@ public class CustomItemRenderer extends ItemRenderer
{
if (updateArmorStand(itemStack))
{
+ poseStack.pushPose();
+ poseStack.mulPose(Axis.YP.rotationDegrees(-90.0f));
renderEntityModel(armorStand, poseStack, bufferSource, packedLight);
+ poseStack.popPose();
}
}
if (!bakedModel.isCustomRenderer() && !itemStack.is(Items.TRIDENT))
{
boolean fabulous;
- if (transformType != ItemTransforms.TransformType.GUI && !transformType.firstPerson() && itemStack.getItem() instanceof BlockItem blockItem)
+ if (displayContext != ItemDisplayContext.GUI && !displayContext.firstPerson() && itemStack.getItem() instanceof BlockItem blockItem)
{
Block block = blockItem.getBlock();
fabulous = !(block instanceof HalfTransparentBlock) && !(block instanceof StainedGlassPaneBlock);
@@ -224,7 +237,7 @@ public class CustomItemRenderer extends ItemRenderer
// First try rendering via the BlockEntityWithoutLevelRenderer.
try
{
- blockEntityRenderer.renderByItem(itemStack, transformType, poseStack, bufferSource, packedLight, packedOverlay);
+ blockEntityRenderer.renderByItem(itemStack, displayContext, poseStack, bufferSource, packedLight, packedOverlay);
}
catch (Exception e)
{
@@ -242,14 +255,14 @@ public class CustomItemRenderer extends ItemRenderer
// First render the bottom half.
BlockState bottomState = block.defaultBlockState().setValue(BlockStateProperties.DOUBLE_BLOCK_HALF, DoubleBlockHalf.LOWER);
BakedModel bottomModel = blockModelShaper.getBlockModel(bottomState);
- renderBakedModel(itemStack, transformType, poseStack, bufferSource, packedLight, packedOverlay, bottomModel, fabulous);
+ renderBakedModel(itemStack, displayContext, poseStack, bufferSource, packedLight, packedOverlay, bottomModel, fabulous);
// Then render the top half.
poseStack.pushPose();
poseStack.translate(0.0f, 1.0f, 0.0f);
BlockState topState = block.defaultBlockState().setValue(BlockStateProperties.DOUBLE_BLOCK_HALF, DoubleBlockHalf.UPPER);
BakedModel topModel = blockModelShaper.getBlockModel(topState);
- renderBakedModel(itemStack, transformType, poseStack, bufferSource, packedLight, packedOverlay, topModel, fabulous);
+ renderBakedModel(itemStack, displayContext, poseStack, bufferSource, packedLight, packedOverlay, topModel, fabulous);
poseStack.popPose();
}
@@ -269,14 +282,14 @@ public class CustomItemRenderer extends ItemRenderer
// If we still haven't rendered anything or this is a block entity, try rendering the block model.
if (blockModel != null && (bufferSourceReady.test(bufferSource) || isBlockEntity))
{
- renderBakedModel(itemStack, transformType, poseStack, bufferSource, packedLight, packedOverlay, blockModel, fabulous);
+ renderBakedModel(itemStack, displayContext, poseStack, bufferSource, packedLight, packedOverlay, blockModel, fabulous);
}
}
// Now try rendering entity models for items that spawn entities.
- if (bufferSourceReady.test(bufferSource) && EntityCollector.itemCreatesEntity(itemStack.getItem(), Entity.class))
+ if (bufferSourceReady.test(bufferSource) && EntityCollector.itemCreatesEntity(itemStack, Entity.class))
{
- if (updateEntity(itemStack.getItem()))
+ if (updateEntity(itemStack))
{
renderEntityModel(entity, poseStack, bufferSource, packedLight);
}
@@ -294,24 +307,24 @@ public class CustomItemRenderer extends ItemRenderer
// Finally, fall back to just rendering the item model.
if (bufferSourceReady.test(bufferSource))
{
- renderBakedModel(itemStack, transformType, poseStack, bufferSource, packedLight, packedOverlay, bakedModel, fabulous);
+ renderBakedModel(itemStack, displayContext, poseStack, bufferSource, packedLight, packedOverlay, bakedModel, fabulous);
}
}
else if (bufferSourceReady.test(bufferSource))
{
- blockEntityRenderer.renderByItem(itemStack, transformType, poseStack, bufferSource, packedLight, packedOverlay);
+ blockEntityRenderer.renderByItem(itemStack, displayContext, poseStack, bufferSource, packedLight, packedOverlay);
}
}
- private void renderModel(ItemStack itemStack, TransformType transformType, boolean leftHanded, PoseStack poseStack, Quaternionf rotation, MultiBufferSource bufferSource, int packedLight, int packedOverlay, BakedModel bakedModel)
+ private void renderModel(ItemStack itemStack, ItemDisplayContext displayContext, boolean leftHanded, PoseStack poseStack, Quaternionf rotation, MultiBufferSource bufferSource, int packedLight, int packedOverlay, BakedModel bakedModel)
{
if (!itemStack.isEmpty())
{
- // If this model doesn't have a special transform for the given transform type (most likely GUI), default to first-person right handed instead.
- TransformType previewTransform = transformType;
- if (!bakedModel.getTransforms().hasTransform(transformType))
+ // If this model doesn't have a special transform for the given context type (most likely GUI), default to ground instead.
+ ItemDisplayContext previewContext = displayContext;
+ if (!bakedModel.getTransforms().hasTransform(displayContext))
{
- previewTransform = TransformType.GROUND;
+ previewContext = ItemDisplayContext.GROUND;
}
boolean isBlockItem = false, spawnsEntity = false, isArmor = false;
@@ -319,7 +332,7 @@ public class CustomItemRenderer extends ItemRenderer
{
isBlockItem = true;
}
- else if (EntityCollector.itemCreatesEntity(itemStack.getItem(), Entity.class))
+ else if (EntityCollector.itemCreatesEntity(itemStack, Entity.class))
{
spawnsEntity = true;
}
@@ -340,12 +353,12 @@ public class CustomItemRenderer extends ItemRenderer
}
else
{
- bakedModel.getTransforms().getTransform(previewTransform).apply(leftHanded, poseStack);
+ bakedModel.getTransforms().getTransform(previewContext).apply(leftHanded, poseStack);
}
poseStack.translate(-0.5f, -0.5f, -0.5f);
// Get the model bounds.
- ModelBounds modelBounds = getModelBounds(itemStack, previewTransform, leftHanded, poseStack, rotation, bufferSource, packedLight, packedOverlay, bakedModel);
+ ModelBounds modelBounds = getModelBounds(itemStack, previewContext, leftHanded, poseStack, rotation, bufferSource, packedLight, packedOverlay, bakedModel);
// Undo the camera transforms now that we have the model bounds.
poseStack.popPose();
@@ -390,13 +403,13 @@ public class CustomItemRenderer extends ItemRenderer
}
else
{
- bakedModel.getTransforms().getTransform(previewTransform).apply(leftHanded, poseStack);
+ bakedModel.getTransforms().getTransform(previewContext).apply(leftHanded, poseStack);
}
poseStack.translate(-0.5f, -0.5f, -0.5f);
CheckedBufferSource checkedBufferSource = CheckedBufferSource.create(bufferSource);
- renderModelInternal(itemStack, previewTransform, leftHanded, poseStack, rotation, checkedBufferSource, packedLight, packedOverlay, bakedModel, b -> !b.hasRendered());
+ renderModelInternal(itemStack, previewContext, leftHanded, poseStack, rotation, checkedBufferSource, packedLight, packedOverlay, bakedModel, b -> !b.hasRendered());
poseStack.popPose();
}
@@ -422,7 +435,7 @@ public class CustomItemRenderer extends ItemRenderer
}
}
- private void renderBakedModel(ItemStack itemStack, ItemTransforms.TransformType transformType, PoseStack poseStack,
+ private void renderBakedModel(ItemStack itemStack, ItemDisplayContext displayContext, PoseStack poseStack,
MultiBufferSource bufferSource, int packedLight, int packedOverlay, BakedModel bakedModel, boolean fabulous)
{
RenderType renderType = ItemBlockRenderTypes.getRenderType(itemStack, fabulous);
@@ -431,11 +444,11 @@ public class CustomItemRenderer extends ItemRenderer
{
poseStack.pushPose();
PoseStack.Pose posestack$pose = poseStack.last();
- if (transformType == ItemTransforms.TransformType.GUI)
+ if (displayContext == ItemDisplayContext.GUI)
{
MatrixUtil.mulComponentWise(posestack$pose.pose(), 0.5F);
}
- else if (transformType.firstPerson())
+ else if (displayContext.firstPerson())
{
MatrixUtil.mulComponentWise(posestack$pose.pose(), 0.75F);
}
@@ -502,10 +515,10 @@ public class CustomItemRenderer extends ItemRenderer
return true;
}
- private Entity getEntityFromItem(Item item)
+ private Entity getEntityFromItem(ItemStack itemStack)
{
Entity collectedEntity = null;
- List<Entity> collectedEntities = EntityCollector.collectEntitiesFromItem(item);
+ List<Entity> collectedEntities = EntityCollector.collectEntitiesFromItem(itemStack);
if (!collectedEntities.isEmpty())
{
// Just return the first entity collected.
@@ -516,12 +529,13 @@ public class CustomItemRenderer extends ItemRenderer
return collectedEntity;
}
- private boolean updateEntity(Item item)
+ private boolean updateEntity(ItemStack itemStack)
{
- if (entity == null || cachedEntityItem != item)
+ Pair<Item, CompoundTag> entityItem = Pair.of(itemStack.getItem(), itemStack.getTag());
+ if (entity == null || cachedEntityItem != entityItem)
{
- entity = getEntityFromItem(item);
- cachedEntityItem = item;
+ entity = getEntityFromItem(itemStack);
+ cachedEntityItem = entityItem;
}
// If somehow the entity is still null, then we can't render anything.
@@ -594,19 +608,20 @@ public class CustomItemRenderer extends ItemRenderer
return new ModelBounds(center, height, radius);
}
- private ModelBounds getModelBounds(ItemStack itemStack, ItemTransforms.TransformType transformType, boolean leftHanded, PoseStack poseStack,
+ private ModelBounds getModelBounds(ItemStack itemStack, ItemDisplayContext displayContext, boolean leftHanded, PoseStack poseStack,
Quaternionf rotation, MultiBufferSource bufferSource, int packedLight, int packedOverlay, BakedModel bakedModel)
{
- if (!modelBoundsCache.containsKey(itemStack.getItem()))
+ Pair<Item, CompoundTag> key = Pair.of(itemStack.getItem(), itemStack.getTag());
+ if (!modelBoundsCache.containsKey(key))
{
VertexCollector vertexCollector = VertexCollector.create();
- renderModelInternal(itemStack, transformType, leftHanded, poseStack, rotation, vertexCollector, packedLight, packedOverlay, bakedModel, b -> b.getVertices().isEmpty());
+ renderModelInternal(itemStack, displayContext, leftHanded, poseStack, rotation, vertexCollector, packedLight, packedOverlay, bakedModel, b -> b.getVertices().isEmpty());
// Now store the bounds in the cache.
- modelBoundsCache.put(itemStack.getItem(), boundsFromVertices(vertexCollector.getVertices()));
+ modelBoundsCache.put(key, boundsFromVertices(vertexCollector.getVertices()));
}
- return modelBoundsCache.get(itemStack.getItem());
+ return modelBoundsCache.get(key);
}
public void renderDetailModelIntoGUI(ItemStack stack, int x, int y, Quaternionf rotation)
@@ -643,10 +658,10 @@ public class CustomItemRenderer extends ItemRenderer
blitOffset -= 50.0f;
}
- public void renderItemModelIntoGUIWithAlpha(ItemStack stack, int x, int y, float alpha)
+ public void renderItemModelIntoGUIWithAlpha(PoseStack poseStack, ItemStack stack, int x, int y, float alpha)
{
- BakedModel bakedModel = mc.getItemRenderer().getModel(stack, null, null, 0);
- RenderTarget lastFrameBuffer = mc.getMainRenderTarget();
+ BakedModel bakedModel = minecraft.getItemRenderer().getModel(stack, null, null, 0);
+ RenderTarget lastFrameBuffer = minecraft.getMainRenderTarget();
// Bind the icon framebuffer so we can render to texture.
iconFrameBuffer.clear(Minecraft.ON_OSX);
@@ -659,7 +674,7 @@ public class CustomItemRenderer extends ItemRenderer
RenderSystem.backupProjectionMatrix();
RenderSystem.setProjectionMatrix(matrix);
- mc.getTextureManager().getTexture(InventoryMenu.BLOCK_ATLAS).setFilter(false, false);
+ minecraft.getTextureManager().getTexture(InventoryMenu.BLOCK_ATLAS).setFilter(false, false);
RenderSystem.setShaderTexture(0, InventoryMenu.BLOCK_ATLAS);
RenderSystem.disableCull();
RenderSystem.enableBlend();
@@ -672,8 +687,8 @@ public class CustomItemRenderer extends ItemRenderer
modelViewStack.translate(48.0f, 48.0f, -2000.0f);
modelViewStack.scale(96.0f, 96.0f, 96.0f);
RenderSystem.applyModelViewMatrix();
- PoseStack poseStack = new PoseStack();
- BufferSource bufferSource = mc.renderBuffers().bufferSource();
+
+ BufferSource bufferSource = minecraft.renderBuffers().bufferSource();
boolean flatLighting = !bakedModel.usesBlockLight();
if (flatLighting)
@@ -681,7 +696,7 @@ public class CustomItemRenderer extends ItemRenderer
Lighting.setupForFlatItems();
}
- render(stack, ItemTransforms.TransformType.GUI, false, poseStack, bufferSource, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY, bakedModel);
+ render(stack, ItemDisplayContext.GUI, false, new PoseStack(), bufferSource, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY, bakedModel);
bufferSource.endBatch();
RenderSystem.enableDepthTest();
if (flatLighting)
@@ -703,15 +718,12 @@ public class CustomItemRenderer extends ItemRenderer
RenderSystem.defaultBlendFunc();
RenderSystem.disableCull();
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, alpha);
- modelViewStack.pushPose();
- modelViewStack.translate(0.0f, 0.0f, 50.0f + this.blitOffset);
- RenderSystem.applyModelViewMatrix();
RenderSystem.setShaderTexture(0, iconFrameBuffer.getColorTextureId());
+ GuiComponent.blit(poseStack, x, y, 16, 16, 0, 0, iconFrameBuffer.width, iconFrameBuffer.height, iconFrameBuffer.width, iconFrameBuffer.height);
+
+ RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
- GuiComponent.blit(new PoseStack(), x, y, 16, 16, 0, 0, iconFrameBuffer.width, iconFrameBuffer.height, iconFrameBuffer.width, iconFrameBuffer.height);
- modelViewStack.popPose();
- RenderSystem.applyModelViewMatrix();
iconFrameBuffer.unbindRead();
}
else
diff --git a/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollector.java b/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollector.java
index ba9d799..22b98e1 100644
--- a/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollector.java
+++ b/src/main/java/com/anthonyhilyard/iceberg/renderer/VertexCollector.java
@@ -35,7 +35,7 @@ public class VertexCollector implements MultiBufferSource
try
{
// If Sodium 0.4.9+ is installed, use the Sodium implementation.
- useSodiumVersion = FabricLoader.getInstance().isModLoaded("sodium") && VersionPredicateParser.parse(">=0.4.9").test(FabricLoader.getInstance().getModContainer("sodium").get().getMetadata().getVersion());
+ useSodiumVersion = FabricLoader.getInstance().isModLoaded("sodium") && VersionPredicateParser.parse("0.4.10").test(FabricLoader.getInstance().getModContainer("sodium").get().getMetadata().getVersion());
}
catch (Exception e)
{