From 19cd2c14f89c382792f6b3509b045ecbe51487e4 Mon Sep 17 00:00:00 2001 From: jellysquid3 Date: Wed, 19 Jul 2023 21:57:07 -0500 Subject: [PATCH] Code cleanup & formatting Mostly just dead code removal and some automated passes for code style. --- .../api/vertex/buffer/VertexBufferWriter.java | 1 - .../serializer/VertexSerializerRegistry.java | 2 +- .../gl/attribute/GlVertexAttribute.java | 2 +- .../sodium/client/gl/buffer/GlBuffer.java | 2 - .../client/gl/device/GLRenderDevice.java | 5 --- .../sodium/client/gl/device/RenderDevice.java | 2 - .../client/gl/functions/DeviceFunctions.java | 2 +- .../client/gl/shader/ShaderWorkarounds.java | 7 +--- .../client/gl/tessellation/GlIndexType.java | 2 - .../client/gl/util/MemoryUtilHelper.java | 28 -------------- .../sodium/client/gui/SodiumGameOptions.java | 16 -------- .../sodium/client/gui/SodiumOptionsGUI.java | 5 +-- .../sodium/client/gui/options/OptionFlag.java | 2 +- .../sodium/client/gui/options/OptionImpl.java | 2 +- .../gui/options/control/CyclingControl.java | 1 - .../gui/options/control/SliderControl.java | 7 ++-- .../gui/screen/ConfigCorruptedScreen.java | 1 - .../client/gui/widgets/AbstractWidget.java | 14 +++---- .../client/gui/widgets/FlatButtonWidget.java | 4 +- .../model/quad/properties/ModelQuadFlags.java | 1 - .../render/chunk/ChunkGraphicsState.java | 11 ------ .../client/render/chunk/ChunkTracker.java | 1 - .../render/chunk/RenderSectionManager.java | 2 +- .../chunk/compile/ChunkBuildBuffers.java | 2 - .../chunk}/compile/ChunkBuildContext.java | 2 +- .../render/chunk/compile/ChunkBuilder.java | 1 - .../chunk/compile/pipeline/FluidRenderer.java | 37 +++++++++---------- .../render/chunk/region/RenderRegion.java | 4 +- .../chunk/region/RenderRegionManager.java | 2 - .../chunk/tasks/ChunkRenderBuildTask.java | 2 +- .../tasks/ChunkRenderEmptyBuildTask.java | 2 +- .../chunk/tasks/ChunkRenderRebuildTask.java | 2 +- .../builder/ChunkMeshBufferBuilder.java | 4 +- .../sodium/client/util/color/ColorSRGB.java | 1 - .../world/cloned/ClonedChunkSection.java | 9 ++--- .../fast_sort/MixinBufferBuilder.java | 2 +- .../chunk_rendering/MixinClientWorld.java | 17 +++++++-- .../chunk_rendering/MixinWorldRenderer.java | 2 +- .../features/clouds/MixinWorldRenderer.java | 2 +- .../MixinLevelLoadingScreen.java | 1 - .../matrix_stack/MixinMatrixStack.java | 3 -- .../features/mipmaps/MixinMipmapHelper.java | 1 - .../features/options/MixinOptionsScreen.java | 2 - .../features/sky/MixinWorldRenderer.java | 10 ----- .../texture_tracking/MixinDrawableHelper.java | 1 - .../AnimationFrameAccessor.java | 2 - .../sodium/mixin/workarounds/MixinWindow.java | 2 +- 47 files changed, 62 insertions(+), 171 deletions(-) delete mode 100644 src/main/java/me/jellysquid/mods/sodium/client/gl/util/MemoryUtilHelper.java rename src/main/java/me/jellysquid/mods/sodium/client/{gl => render/chunk}/compile/ChunkBuildContext.java (92%) diff --git a/src/api/java/net/caffeinemc/mods/sodium/api/vertex/buffer/VertexBufferWriter.java b/src/api/java/net/caffeinemc/mods/sodium/api/vertex/buffer/VertexBufferWriter.java index d3d1c790eb..024f274232 100644 --- a/src/api/java/net/caffeinemc/mods/sodium/api/vertex/buffer/VertexBufferWriter.java +++ b/src/api/java/net/caffeinemc/mods/sodium/api/vertex/buffer/VertexBufferWriter.java @@ -4,7 +4,6 @@ import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription; import net.minecraft.client.render.VertexConsumer; import org.lwjgl.system.MemoryStack; -import org.slf4j.Logger; public interface VertexBufferWriter { /** diff --git a/src/api/java/net/caffeinemc/mods/sodium/api/vertex/serializer/VertexSerializerRegistry.java b/src/api/java/net/caffeinemc/mods/sodium/api/vertex/serializer/VertexSerializerRegistry.java index ec16d2cdcd..ea8b503129 100644 --- a/src/api/java/net/caffeinemc/mods/sodium/api/vertex/serializer/VertexSerializerRegistry.java +++ b/src/api/java/net/caffeinemc/mods/sodium/api/vertex/serializer/VertexSerializerRegistry.java @@ -5,7 +5,7 @@ public interface VertexSerializerRegistry { VertexSerializerRegistry INSTANCE = DependencyInjection.load(VertexSerializerRegistry.class, - "me.jellysquid.mods.sodium.client.render.vertex.serializers.VertexSerializerRegistryImpl");; + "me.jellysquid.mods.sodium.client.render.vertex.serializers.VertexSerializerRegistryImpl"); static VertexSerializerRegistry instance() { return INSTANCE; diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gl/attribute/GlVertexAttribute.java b/src/main/java/me/jellysquid/mods/sodium/client/gl/attribute/GlVertexAttribute.java index 1b7a296903..c48ae715ed 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gl/attribute/GlVertexAttribute.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gl/attribute/GlVertexAttribute.java @@ -52,7 +52,7 @@ public boolean isNormalized() { } public boolean isIntType() { - return intType; + return this.intType; } public int getStride() { diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gl/buffer/GlBuffer.java b/src/main/java/me/jellysquid/mods/sodium/client/gl/buffer/GlBuffer.java index afb1538076..8c18c122a0 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gl/buffer/GlBuffer.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gl/buffer/GlBuffer.java @@ -4,8 +4,6 @@ import org.lwjgl.opengl.GL20C; public abstract class GlBuffer extends GlObject { - public static final int NULL_BUFFER_ID = 0; - private GlBufferMapping activeMapping; protected GlBuffer() { diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gl/device/GLRenderDevice.java b/src/main/java/me/jellysquid/mods/sodium/client/gl/device/GLRenderDevice.java index 8f99fab34b..1069da4d73 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gl/device/GLRenderDevice.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gl/device/GLRenderDevice.java @@ -51,11 +51,6 @@ public void makeInactive() { this.isActive = false; } - @Override - public boolean isActive() { - return this.isActive; - } - @Override public GLCapabilities getCapabilities() { return GL.getCapabilities(); diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gl/device/RenderDevice.java b/src/main/java/me/jellysquid/mods/sodium/client/gl/device/RenderDevice.java index 3f802fed81..49bcfb3d84 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gl/device/RenderDevice.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gl/device/RenderDevice.java @@ -19,8 +19,6 @@ static void exitManagedCode() { void makeActive(); void makeInactive(); - boolean isActive(); - GLCapabilities getCapabilities(); DeviceFunctions getDeviceFunctions(); diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gl/functions/DeviceFunctions.java b/src/main/java/me/jellysquid/mods/sodium/client/gl/functions/DeviceFunctions.java index 5cde1a0696..36a0250d74 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gl/functions/DeviceFunctions.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gl/functions/DeviceFunctions.java @@ -10,6 +10,6 @@ public DeviceFunctions(RenderDevice device) { } public BufferStorageFunctions getBufferStorageFunctions() { - return bufferStorageFunctions; + return this.bufferStorageFunctions; } } diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gl/shader/ShaderWorkarounds.java b/src/main/java/me/jellysquid/mods/sodium/client/gl/shader/ShaderWorkarounds.java index 06ac2d491b..ef87e5c11c 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gl/shader/ShaderWorkarounds.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gl/shader/ShaderWorkarounds.java @@ -36,18 +36,13 @@ class ShaderWorkarounds { *

Hat tip to fewizz for the find and the fix. */ static void safeShaderSource(int glId, CharSequence source) { - final MemoryStack stack = MemoryStack.stackGet(); - final int stackPointer = stack.getPointer(); - - try { + try (MemoryStack stack = MemoryStack.stackPush()) { final ByteBuffer sourceBuffer = MemoryUtil.memUTF8(source, true); final PointerBuffer pointers = stack.mallocPointer(1); pointers.put(sourceBuffer); GL20C.nglShaderSource(glId, 1, pointers.address0(), 0); org.lwjgl.system.APIUtil.apiArrayFree(pointers.address0(), 1); - } finally { - stack.setPointer(stackPointer); } } } diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gl/tessellation/GlIndexType.java b/src/main/java/me/jellysquid/mods/sodium/client/gl/tessellation/GlIndexType.java index 867bc09010..61cae6e5f1 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gl/tessellation/GlIndexType.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gl/tessellation/GlIndexType.java @@ -22,6 +22,4 @@ public int getFormatId() { public int getStride() { return this.stride; } - - public static final GlIndexType[] VALUES = GlIndexType.values(); } diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gl/util/MemoryUtilHelper.java b/src/main/java/me/jellysquid/mods/sodium/client/gl/util/MemoryUtilHelper.java deleted file mode 100644 index 851b73f7f4..0000000000 --- a/src/main/java/me/jellysquid/mods/sodium/client/gl/util/MemoryUtilHelper.java +++ /dev/null @@ -1,28 +0,0 @@ -package me.jellysquid.mods.sodium.client.gl.util; - -import org.jetbrains.annotations.Nullable; -import org.lwjgl.PointerBuffer; -import org.lwjgl.system.MemoryUtil; - -import java.nio.Buffer; - -/** - * Contains versions of MemoryUtil#memFree that hopefully work on all versions of LWJGL 3 released - * in the past few years. - * - * LWJGL 3.2.3 made breaking changes to memFree, which is why this class is needed: - * https://github.com/LWJGL/lwjgl3/releases/tag/3.2.3 - */ -public class MemoryUtilHelper { - // memFree for custom / pointer buffers *was* changed. - public static void memFree(@Nullable PointerBuffer ptr) { - if (ptr != null) { - MemoryUtil.nmemFree(ptr.address0()); - } - } - - // memFree for normal buffers was not changed. - public static void memFree(@Nullable Buffer ptr) { - MemoryUtil.memFree(ptr); - } -} \ No newline at end of file diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptions.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptions.java index 8203d120ce..98f86867c3 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptions.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptions.java @@ -63,22 +63,6 @@ public static class NotificationSettings { public boolean hideDonationButton = false; } - public enum ArenaMemoryAllocator implements TextProvider { - ASYNC("sodium.options.chunk_memory_allocator.async"), - SWAP("sodium.options.chunk_memory_allocator.swap"); - - private final Text name; - - ArenaMemoryAllocator(String name) { - this.name = Text.translatable(name); - } - - @Override - public Text getLocalizedName() { - return this.name; - } - } - public enum GraphicsQuality implements TextProvider { DEFAULT("options.gamma.default"), FANCY("options.clouds.fancy"), diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumOptionsGUI.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumOptionsGUI.java index 692f31743a..89740cdce8 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumOptionsGUI.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumOptionsGUI.java @@ -12,14 +12,12 @@ import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.option.VideoOptionsScreen; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.OrderedText; import net.minecraft.text.Style; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.minecraft.util.Language; import net.minecraft.util.Util; -import net.minecraft.util.math.MathHelper; import org.lwjgl.glfw.GLFW; import java.io.IOException; @@ -27,7 +25,6 @@ import java.util.EnumSet; import java.util.HashSet; import java.util.List; -import java.util.concurrent.TimeUnit; import java.util.stream.Stream; public class SodiumOptionsGUI extends Screen { @@ -256,7 +253,7 @@ private void renderOptionTooltip(DrawContext drawContext, ControlElement elem drawContext.fillGradient(boxX, boxY, boxX + boxWidth, boxY + boxHeight, 0xE0000000, 0xE0000000); for (int i = 0; i < tooltip.size(); i++) { - drawContext.drawTextWithShadow(textRenderer, tooltip.get(i), boxX + textPadding, boxY + textPadding + (i * 12), 0xFFFFFFFF); + drawContext.drawTextWithShadow(this.textRenderer, tooltip.get(i), boxX + textPadding, boxY + textPadding + (i * 12), 0xFFFFFFFF); } } diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/options/OptionFlag.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/options/OptionFlag.java index 833d743313..ea87bddd88 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/options/OptionFlag.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/options/OptionFlag.java @@ -4,5 +4,5 @@ public enum OptionFlag { REQUIRES_RENDERER_RELOAD, REQUIRES_RENDERER_UPDATE, REQUIRES_ASSET_RELOAD, - REQUIRES_GAME_RESTART; + REQUIRES_GAME_RESTART } diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/options/OptionImpl.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/options/OptionImpl.java index 72905ddeb5..95ad50b433 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/options/OptionImpl.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/options/OptionImpl.java @@ -113,7 +113,7 @@ public Collection getFlags() { return this.flags; } - public static OptionImpl.Builder createBuilder(Class type, OptionStorage storage) { + public static OptionImpl.Builder createBuilder(@SuppressWarnings("unused") Class type, OptionStorage storage) { return new Builder<>(storage); } diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/options/control/CyclingControl.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/options/control/CyclingControl.java index ee6cdc0def..051415c77c 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/options/control/CyclingControl.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/options/control/CyclingControl.java @@ -6,7 +6,6 @@ import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.InputUtil; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import org.apache.commons.lang3.Validate; diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/options/control/SliderControl.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/options/control/SliderControl.java index 049095a6a4..99e496ab47 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/options/control/SliderControl.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/options/control/SliderControl.java @@ -4,7 +4,6 @@ import me.jellysquid.mods.sodium.client.util.Dim2i; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.util.InputUtil; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.Rect2i; import net.minecraft.text.Text; import net.minecraft.util.math.MathHelper; @@ -103,7 +102,7 @@ private void renderSlider(DrawContext drawContext) { int sliderWidth = this.sliderBounds.getWidth(); int sliderHeight = this.sliderBounds.getHeight(); - this.thumbPosition = this.getThumbPositionForValue(option.getValue()); + this.thumbPosition = this.getThumbPositionForValue(this.option.getValue()); double thumbOffset = MathHelper.clamp((double) (this.getIntValue() - this.min) / this.range * sliderWidth, 0, sliderWidth); @@ -167,10 +166,10 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) { if (!isFocused()) return false; if (keyCode == InputUtil.GLFW_KEY_LEFT) { - this.option.setValue(MathHelper.clamp(this.option.getValue() - interval, min, max)); + this.option.setValue(MathHelper.clamp(this.option.getValue() - this.interval, this.min, this.max)); return true; } else if (keyCode == InputUtil.GLFW_KEY_RIGHT) { - this.option.setValue(MathHelper.clamp(this.option.getValue() + interval, min, max)); + this.option.setValue(MathHelper.clamp(this.option.getValue() + this.interval, this.min, this.max)); return true; } diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/screen/ConfigCorruptedScreen.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/screen/ConfigCorruptedScreen.java index d7b7314e49..f9ea181b93 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/screen/ConfigCorruptedScreen.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/screen/ConfigCorruptedScreen.java @@ -5,7 +5,6 @@ import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import java.util.Arrays; diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/widgets/AbstractWidget.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/widgets/AbstractWidget.java index 7cda4ebeb3..01068234ab 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/widgets/AbstractWidget.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/widgets/AbstractWidget.java @@ -26,11 +26,11 @@ protected AbstractWidget() { } protected void drawString(DrawContext drawContext, String str, int x, int y, int color) { - drawContext.drawTextWithShadow(font, str, x, y, color); + drawContext.drawTextWithShadow(this.font, str, x, y, color); } protected void drawString(DrawContext drawContext, Text text, int x, int y, int color) { - drawContext.drawTextWithShadow(font, text, x, y, color); + drawContext.drawTextWithShadow(this.font, text, x, y, color); } public boolean isHovered() { @@ -46,10 +46,6 @@ protected void playClickSound() { .play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK.value(), 1.0F)); } - protected int getStringWidth(String text) { - return this.font.getWidth(text); - } - protected int getStringWidth(StringVisitable text) { return this.font.getWidth(text); } @@ -66,9 +62,9 @@ public Selectable.SelectionType getType() { @Override public void appendNarrations(NarrationMessageBuilder builder) { - if (focused) { + if (this.focused) { builder.put(NarrationPart.USAGE, Text.translatable("narration.button.usage.focused")); - } else if (hovered) { + } else if (this.hovered) { builder.put(NarrationPart.USAGE, Text.translatable("narration.button.usage.hovered")); } } @@ -80,7 +76,7 @@ public GuiNavigationPath getNavigationPath(GuiNavigation navigation) { @Override public boolean isFocused() { - return focused; + return this.focused; } @Override diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/widgets/FlatButtonWidget.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/widgets/FlatButtonWidget.java index 7982e14a08..54d8ac968c 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/widgets/FlatButtonWidget.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/widgets/FlatButtonWidget.java @@ -34,7 +34,7 @@ public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) this.hovered = this.dim.containsCursor(mouseX, mouseY); - int backgroundColor = this.enabled ? (hovered ? 0xE0000000 : 0x90000000) : 0x60000000; + int backgroundColor = this.enabled ? (this.hovered ? 0xE0000000 : 0x90000000) : 0x60000000; int textColor = this.enabled ? 0xFFFFFFFF : 0x90FFFFFF; int strWidth = this.font.getWidth(this.label); @@ -105,7 +105,7 @@ public Text getLabel() { @Override public @Nullable GuiNavigationPath getNavigationPath(GuiNavigation navigation) { - if (!enabled || !visible) + if (!this.enabled || !this.visible) return null; return super.getNavigationPath(navigation); } diff --git a/src/main/java/me/jellysquid/mods/sodium/client/model/quad/properties/ModelQuadFlags.java b/src/main/java/me/jellysquid/mods/sodium/client/model/quad/properties/ModelQuadFlags.java index d6f76ed21b..52b602038b 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/model/quad/properties/ModelQuadFlags.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/model/quad/properties/ModelQuadFlags.java @@ -1,7 +1,6 @@ package me.jellysquid.mods.sodium.client.model.quad.properties; import me.jellysquid.mods.sodium.client.model.quad.ModelQuadView; -import net.minecraft.client.render.model.BakedQuad; import net.minecraft.util.math.Direction; public class ModelQuadFlags { diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/ChunkGraphicsState.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/ChunkGraphicsState.java index e683dd559d..9a064a9bc5 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/ChunkGraphicsState.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/ChunkGraphicsState.java @@ -13,8 +13,6 @@ public class ChunkGraphicsState { private final VertexRange[] parts; - private final int largestPrimitiveBatchSize; - public ChunkGraphicsState(GlBufferSegment vertexSegment, ChunkMeshData data) { Validate.notNull(vertexSegment); @@ -22,14 +20,9 @@ public ChunkGraphicsState(GlBufferSegment vertexSegment, ChunkMeshData data) { this.parts = new VertexRange[ModelQuadFacing.COUNT]; - int largestPrimitiveBatchSize = 0; - for (Map.Entry entry : data.getParts().entrySet()) { this.parts[entry.getKey().ordinal()] = entry.getValue(); - largestPrimitiveBatchSize = Math.max(largestPrimitiveBatchSize, vertexSegment.getLength() / 4); } - - this.largestPrimitiveBatchSize = largestPrimitiveBatchSize; } public void delete() { @@ -43,8 +36,4 @@ public VertexRange getModelPart(ModelQuadFacing facing) { public GlBufferSegment getVertexSegment() { return this.vertexSegment; } - - public int getLargestPrimitiveBatchSize() { - return this.largestPrimitiveBatchSize; - } } diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/ChunkTracker.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/ChunkTracker.java index 53e3798d79..bcb4fa0f72 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/ChunkTracker.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/ChunkTracker.java @@ -1,7 +1,6 @@ package me.jellysquid.mods.sodium.client.render.chunk; import it.unimi.dsi.fastutil.longs.*; -import me.jellysquid.mods.sodium.client.SodiumClientMod; import net.minecraft.util.math.ChunkPos; import java.util.stream.LongStream; diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/RenderSectionManager.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/RenderSectionManager.java index de9e816b7b..6caa8306f2 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/RenderSectionManager.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/RenderSectionManager.java @@ -78,7 +78,7 @@ public class RenderSectionManager { private final ObjectList tickableChunks = new ObjectArrayList<>(); private final ObjectList visibleBlockEntities = new ObjectArrayList<>(); - private final RegionChunkRenderer chunkRenderer; + private final ChunkRenderer chunkRenderer; private final SodiumWorldRenderer worldRenderer; private final ClientWorld world; diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildBuffers.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildBuffers.java index 41d94eaada..d0fde84e75 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildBuffers.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildBuffers.java @@ -1,6 +1,5 @@ package me.jellysquid.mods.sodium.client.render.chunk.compile; -import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; import me.jellysquid.mods.sodium.client.gl.util.VertexRange; import me.jellysquid.mods.sodium.client.render.chunk.terrain.DefaultTerrainRenderPasses; @@ -14,7 +13,6 @@ import me.jellysquid.mods.sodium.client.render.chunk.vertex.builder.ChunkMeshBufferBuilder; import me.jellysquid.mods.sodium.client.render.chunk.vertex.format.ChunkVertexType; import me.jellysquid.mods.sodium.client.util.NativeBuffer; -import org.lwjgl.system.MemoryUtil; import java.nio.ByteBuffer; import java.util.ArrayList; diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gl/compile/ChunkBuildContext.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildContext.java similarity index 92% rename from src/main/java/me/jellysquid/mods/sodium/client/gl/compile/ChunkBuildContext.java rename to src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildContext.java index 74d45e9714..ae8f7b36c9 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gl/compile/ChunkBuildContext.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildContext.java @@ -1,4 +1,4 @@ -package me.jellysquid.mods.sodium.client.gl.compile; +package me.jellysquid.mods.sodium.client.render.chunk.compile; import me.jellysquid.mods.sodium.client.render.chunk.vertex.format.ChunkVertexType; import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildBuffers; diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuilder.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuilder.java index eee4ba56ba..0a3baebce6 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuilder.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuilder.java @@ -1,7 +1,6 @@ package me.jellysquid.mods.sodium.client.render.chunk.compile; import me.jellysquid.mods.sodium.client.SodiumClientMod; -import me.jellysquid.mods.sodium.client.gl.compile.ChunkBuildContext; import me.jellysquid.mods.sodium.client.render.chunk.tasks.ChunkRenderBuildTask; import me.jellysquid.mods.sodium.client.render.chunk.vertex.format.ChunkVertexType; import me.jellysquid.mods.sodium.client.util.task.CancellationSource; diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/pipeline/FluidRenderer.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/pipeline/FluidRenderer.java index 095ef6f718..f5506db933 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/pipeline/FluidRenderer.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/pipeline/FluidRenderer.java @@ -260,56 +260,53 @@ public void render(WorldSlice world, FluidState fluidState, BlockPos pos, BlockP float z2; switch (dir) { - case NORTH: + case NORTH -> { if (sfNorth) { continue; } - c1 = h1; c2 = h4; x1 = 0.0f; x2 = 1.0F; z1 = EPSILON; z2 = z1; - break; - case SOUTH: + } + case SOUTH -> { if (sfSouth) { continue; } - c1 = h3; c2 = h2; x1 = 1.0F; x2 = 0.0f; z1 = 1.0f - EPSILON; z2 = z1; - break; - case WEST: + } + case WEST -> { if (sfWest) { continue; } - c1 = h2; c2 = h1; x1 = EPSILON; x2 = x1; z1 = 1.0F; z2 = 0.0f; - break; - case EAST: + } + case EAST -> { if (sfEast) { continue; } - c1 = h4; c2 = h3; x1 = 1.0f - EPSILON; x2 = x1; z1 = 0.0f; z2 = 1.0F; - break; - default: + } + default -> { continue; + } } if (this.isSideExposed(world, posX, posY, posZ, dir, Math.max(c1, c2))) { @@ -442,16 +439,16 @@ private float fluidCornerHeight(BlockRenderView world, Fluid fluid, float fluidH return 1.0f; } - modifyHeight(scratchHeight, scratchSamples, height); + modifyHeight(this.scratchHeight, this.scratchSamples, height); } - modifyHeight(scratchHeight, scratchSamples, fluidHeight); - modifyHeight(scratchHeight, scratchSamples, fluidHeightY); - modifyHeight(scratchHeight, scratchSamples, fluidHeightX); + modifyHeight(this.scratchHeight, this.scratchSamples, fluidHeight); + modifyHeight(this.scratchHeight, this.scratchSamples, fluidHeightY); + modifyHeight(this.scratchHeight, this.scratchSamples, fluidHeightX); - float result = scratchHeight.floatValue() / scratchSamples.intValue(); - scratchHeight.setValue(0); - scratchSamples.setValue(0); + float result = this.scratchHeight.floatValue() / this.scratchSamples.intValue(); + this.scratchHeight.setValue(0); + this.scratchSamples.setValue(0); return result; } diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/region/RenderRegion.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/region/RenderRegion.java index f649449f4c..029c1616d0 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/region/RenderRegion.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/region/RenderRegion.java @@ -32,8 +32,6 @@ public class RenderRegion { public static final int REGION_SIZE = REGION_WIDTH * REGION_HEIGHT * REGION_LENGTH; - private static final int REGION_EXCESS = 8; - static { Validate.isTrue(MathUtil.isPowerOfTwo(REGION_WIDTH)); Validate.isTrue(MathUtil.isPowerOfTwo(REGION_HEIGHT)); @@ -178,7 +176,7 @@ public void delete(CommandList commandList) { public void deleteTessellation(CommandList commandList) { for (var tessellation : this.tessellations.values()) { - tessellation.delete(commandList); + commandList.deleteTessellation(tessellation); } this.tessellations.clear(); diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/region/RenderRegionManager.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/region/RenderRegionManager.java index c96ed21fc2..f1cde8b27b 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/region/RenderRegionManager.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/region/RenderRegionManager.java @@ -7,7 +7,6 @@ import me.jellysquid.mods.sodium.client.gl.arena.staging.FallbackStagingBuffer; import me.jellysquid.mods.sodium.client.gl.arena.staging.MappedStagingBuffer; import me.jellysquid.mods.sodium.client.gl.arena.staging.StagingBuffer; -import me.jellysquid.mods.sodium.client.gl.buffer.IndexedVertexData; import me.jellysquid.mods.sodium.client.gl.device.CommandList; import me.jellysquid.mods.sodium.client.gl.device.RenderDevice; import me.jellysquid.mods.sodium.client.render.chunk.terrain.DefaultTerrainRenderPasses; @@ -16,7 +15,6 @@ import me.jellysquid.mods.sodium.client.render.chunk.RenderSection; import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildResult; import me.jellysquid.mods.sodium.client.render.chunk.data.ChunkMeshData; -import me.jellysquid.mods.sodium.client.util.NativeBuffer; import java.util.*; diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderBuildTask.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderBuildTask.java index 2fe3fc9855..bb279c380e 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderBuildTask.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderBuildTask.java @@ -1,6 +1,6 @@ package me.jellysquid.mods.sodium.client.render.chunk.tasks; -import me.jellysquid.mods.sodium.client.gl.compile.ChunkBuildContext; +import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildContext; import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildResult; import me.jellysquid.mods.sodium.client.util.task.CancellationSource; diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderEmptyBuildTask.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderEmptyBuildTask.java index bc3331c23d..23f995ff9e 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderEmptyBuildTask.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderEmptyBuildTask.java @@ -1,6 +1,6 @@ package me.jellysquid.mods.sodium.client.render.chunk.tasks; -import me.jellysquid.mods.sodium.client.gl.compile.ChunkBuildContext; +import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildContext; import me.jellysquid.mods.sodium.client.render.chunk.RenderSection; import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildResult; import me.jellysquid.mods.sodium.client.render.chunk.data.ChunkRenderData; diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderRebuildTask.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderRebuildTask.java index 40c084e4c9..fcdfcb7b02 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderRebuildTask.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderRebuildTask.java @@ -1,7 +1,7 @@ package me.jellysquid.mods.sodium.client.render.chunk.tasks; import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; -import me.jellysquid.mods.sodium.client.gl.compile.ChunkBuildContext; +import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildContext; import me.jellysquid.mods.sodium.client.render.chunk.terrain.DefaultTerrainRenderPasses; import me.jellysquid.mods.sodium.client.render.chunk.terrain.TerrainRenderPass; import me.jellysquid.mods.sodium.client.render.chunk.RenderSection; diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/vertex/builder/ChunkMeshBufferBuilder.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/vertex/builder/ChunkMeshBufferBuilder.java index 580d5a8871..01e9e8a632 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/vertex/builder/ChunkMeshBufferBuilder.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/vertex/builder/ChunkMeshBufferBuilder.java @@ -28,7 +28,7 @@ public ChunkMeshBufferBuilder(ChunkVertexType vertexType, int initialCapacity) { this.initialCapacity = initialCapacity; } - public int push(ChunkVertexEncoder.Vertex[] vertices, Material material) { + public void push(ChunkVertexEncoder.Vertex[] vertices, Material material) { var vertexStart = this.count; var vertexCount = vertices.length; @@ -43,8 +43,6 @@ public int push(ChunkVertexEncoder.Vertex[] vertices, Material material) { } this.count += vertexCount; - - return vertexStart; } private void grow(int len) { diff --git a/src/main/java/me/jellysquid/mods/sodium/client/util/color/ColorSRGB.java b/src/main/java/me/jellysquid/mods/sodium/client/util/color/ColorSRGB.java index d245e285b6..e65678bb97 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/util/color/ColorSRGB.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/util/color/ColorSRGB.java @@ -1,7 +1,6 @@ package me.jellysquid.mods.sodium.client.util.color; -import net.minecraft.client.texture.NativeImage; import net.minecraft.util.math.ColorHelper; /** diff --git a/src/main/java/me/jellysquid/mods/sodium/client/world/cloned/ClonedChunkSection.java b/src/main/java/me/jellysquid/mods/sodium/client/world/cloned/ClonedChunkSection.java index da4737c10f..38f7ae5f37 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/world/cloned/ClonedChunkSection.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/world/cloned/ClonedChunkSection.java @@ -11,15 +11,12 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.registry.BuiltinRegistries; import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.tag.TagKey; import net.minecraft.util.collection.PackedIntegerArray; import net.minecraft.util.math.BlockBox; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkSectionPos; -import net.minecraft.registry.Registry; import net.minecraft.world.LightType; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; @@ -32,7 +29,7 @@ public class ClonedChunkSection { private static final LightType[] LIGHT_TYPES = LightType.values(); - private static final PalettedContainer EMPTY_CONTAINER = new PalettedContainer(Block.STATE_IDS, Blocks.AIR.getDefaultState(), PalettedContainer.PaletteProvider.BLOCK_STATE); + private static final PalettedContainer EMPTY_CONTAINER = new PalettedContainer<>(Block.STATE_IDS, Blocks.AIR.getDefaultState(), PalettedContainer.PaletteProvider.BLOCK_STATE); private ChunkSection EMPTY_SECTION; private final AtomicInteger referenceCount = new AtomicInteger(0); @@ -58,7 +55,7 @@ public class ClonedChunkSection { } public void init(World world, ChunkSectionPos pos) { - EMPTY_SECTION = new ChunkSection(EMPTY_CONTAINER, new PalettedContainer>(world.getRegistryManager().get(RegistryKeys.BIOME).getIndexedEntries(), world.getRegistryManager().get(RegistryKeys.BIOME).entryOf(BiomeKeys.PLAINS), PalettedContainer.PaletteProvider.BIOME)); + this.EMPTY_SECTION = new ChunkSection(EMPTY_CONTAINER, new PalettedContainer<>(world.getRegistryManager().get(RegistryKeys.BIOME).getIndexedEntries(), world.getRegistryManager().get(RegistryKeys.BIOME).entryOf(BiomeKeys.PLAINS), PalettedContainer.PaletteProvider.BIOME)); WorldChunk chunk = world.getChunk(pos.getX(), pos.getZ()); @@ -69,7 +66,7 @@ public void init(World world, ChunkSectionPos pos) { ChunkSection section = getChunkSection(world, chunk, pos); if (section == null) { - section = EMPTY_SECTION; + section = this.EMPTY_SECTION; } this.reset(pos); diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/features/buffer_builder/fast_sort/MixinBufferBuilder.java b/src/main/java/me/jellysquid/mods/sodium/mixin/features/buffer_builder/fast_sort/MixinBufferBuilder.java index e5c2522995..995b96e9ba 100644 --- a/src/main/java/me/jellysquid/mods/sodium/mixin/features/buffer_builder/fast_sort/MixinBufferBuilder.java +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/features/buffer_builder/fast_sort/MixinBufferBuilder.java @@ -76,7 +76,7 @@ private Vector3f[] buildPrimitiveCenters() { */ @Overwrite private void writeSortedIndices(VertexFormat.IndexType indexType) { - if (sorter != null) { + if (this.sorter != null) { int[] indices = this.sorter.sort(this.sortingPrimitiveCenters); this.writePrimitiveIndices(indexType, indices); } diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/features/chunk_rendering/MixinClientWorld.java b/src/main/java/me/jellysquid/mods/sodium/mixin/features/chunk_rendering/MixinClientWorld.java index d6e73c49f9..1060749cc3 100644 --- a/src/main/java/me/jellysquid/mods/sodium/mixin/features/chunk_rendering/MixinClientWorld.java +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/features/chunk_rendering/MixinClientWorld.java @@ -1,13 +1,14 @@ package me.jellysquid.mods.sodium.mixin.features.chunk_rendering; -import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer; import me.jellysquid.mods.sodium.client.world.BiomeSeedProvider; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.render.WorldRenderer; import net.minecraft.client.world.ClientWorld; import net.minecraft.registry.RegistryKey; import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.util.profiler.Profiler; import net.minecraft.world.World; +import net.minecraft.world.dimension.DimensionType; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; @@ -22,12 +23,22 @@ public class MixinClientWorld implements BiomeSeedProvider { private long biomeSeed; @Inject(method = "", at = @At("RETURN")) - private void captureSeed(ClientPlayNetworkHandler netHandler, ClientWorld.Properties properties, RegistryKey registryRef, RegistryEntry registryEntry, int loadDistance, int simulationDistance, Supplier profiler, WorldRenderer worldRenderer, boolean debugWorld, long seed, CallbackInfo ci) { + private void captureSeed(ClientPlayNetworkHandler networkHandler, + ClientWorld.Properties properties, + RegistryKey registryRef, + RegistryEntry dimensionTypeEntry, + int loadDistance, + int simulationDistance, + Supplier profiler, + WorldRenderer worldRenderer, + boolean debugWorld, + long seed, + CallbackInfo ci) { this.biomeSeed = seed; } @Override public long getBiomeSeed() { - return biomeSeed; + return this.biomeSeed; } } \ No newline at end of file diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/features/chunk_rendering/MixinWorldRenderer.java b/src/main/java/me/jellysquid/mods/sodium/mixin/features/chunk_rendering/MixinWorldRenderer.java index 50a7a4202f..589677fe6b 100644 --- a/src/main/java/me/jellysquid/mods/sodium/mixin/features/chunk_rendering/MixinWorldRenderer.java +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/features/chunk_rendering/MixinWorldRenderer.java @@ -45,7 +45,7 @@ public abstract class MixinWorldRenderer implements WorldRendererExtended { @Override public SodiumWorldRenderer getSodiumWorldRenderer() { - return renderer; + return this.renderer; } @Redirect(method = "reload()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/GameOptions;getClampedViewDistance()I", ordinal = 1)) diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/features/clouds/MixinWorldRenderer.java b/src/main/java/me/jellysquid/mods/sodium/mixin/features/clouds/MixinWorldRenderer.java index e4ff7fcece..8e03b69069 100644 --- a/src/main/java/me/jellysquid/mods/sodium/mixin/features/clouds/MixinWorldRenderer.java +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/features/clouds/MixinWorldRenderer.java @@ -36,7 +36,7 @@ public class MixinWorldRenderer { @Overwrite public void renderClouds(MatrixStack matrices, Matrix4f projectionMatrix, float tickDelta, double x, double y, double z) { if (this.cloudRenderer == null) { - this.cloudRenderer = new CloudRenderer(client.getResourceManager()); + this.cloudRenderer = new CloudRenderer(this.client.getResourceManager()); } this.cloudRenderer.render(this.world, this.client.player, matrices, projectionMatrix, this.ticks, tickDelta, x, y, z); diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/features/gui/fast_loading_screen/MixinLevelLoadingScreen.java b/src/main/java/me/jellysquid/mods/sodium/mixin/features/gui/fast_loading_screen/MixinLevelLoadingScreen.java index 5e6b30a042..d33b9cda6c 100644 --- a/src/main/java/me/jellysquid/mods/sodium/mixin/features/gui/fast_loading_screen/MixinLevelLoadingScreen.java +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/features/gui/fast_loading_screen/MixinLevelLoadingScreen.java @@ -12,7 +12,6 @@ import net.minecraft.client.gui.WorldGenerationProgressTracker; import net.minecraft.client.gui.screen.LevelLoadingScreen; import net.minecraft.client.render.*; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.world.chunk.ChunkStatus; import org.joml.Matrix4f; diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/features/matrix_stack/MixinMatrixStack.java b/src/main/java/me/jellysquid/mods/sodium/mixin/features/matrix_stack/MixinMatrixStack.java index a78a1a9c32..c6019d2e52 100644 --- a/src/main/java/me/jellysquid/mods/sodium/mixin/features/matrix_stack/MixinMatrixStack.java +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/features/matrix_stack/MixinMatrixStack.java @@ -7,9 +7,6 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; 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.ArrayDeque; import java.util.Deque; diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/features/mipmaps/MixinMipmapHelper.java b/src/main/java/me/jellysquid/mods/sodium/mixin/features/mipmaps/MixinMipmapHelper.java index 989bcf7163..13c13827c6 100644 --- a/src/main/java/me/jellysquid/mods/sodium/mixin/features/mipmaps/MixinMipmapHelper.java +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/features/mipmaps/MixinMipmapHelper.java @@ -2,7 +2,6 @@ import me.jellysquid.mods.sodium.client.util.color.ColorSRGB; import net.minecraft.client.texture.MipmapHelper; -import net.minecraft.client.texture.NativeImage; import net.minecraft.util.math.ColorHelper; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/features/options/MixinOptionsScreen.java b/src/main/java/me/jellysquid/mods/sodium/mixin/features/options/MixinOptionsScreen.java index c9072359a1..d9b8f74141 100644 --- a/src/main/java/me/jellysquid/mods/sodium/mixin/features/options/MixinOptionsScreen.java +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/features/options/MixinOptionsScreen.java @@ -3,13 +3,11 @@ import me.jellysquid.mods.sodium.client.gui.SodiumOptionsGUI; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.option.OptionsScreen; -import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.Text; import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(OptionsScreen.class) diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/features/sky/MixinWorldRenderer.java b/src/main/java/me/jellysquid/mods/sodium/mixin/features/sky/MixinWorldRenderer.java index 3fc3816026..f8e36a0163 100644 --- a/src/main/java/me/jellysquid/mods/sodium/mixin/features/sky/MixinWorldRenderer.java +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/features/sky/MixinWorldRenderer.java @@ -13,19 +13,9 @@ import net.minecraft.client.render.CameraSubmersionType; import net.minecraft.client.render.WorldRenderer; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.util.math.MathHelper; - -import net.minecraft.util.math.Vec3d; @Mixin(WorldRenderer.class) public class MixinWorldRenderer { - @Shadow - @Final - private MinecraftClient client; - /** *

Prevents the sky layer from rendering when the fog distance is reduced * from the default. This helps prevent situations where the sky can be seen diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/features/texture_tracking/MixinDrawableHelper.java b/src/main/java/me/jellysquid/mods/sodium/mixin/features/texture_tracking/MixinDrawableHelper.java index edeb456a9c..60ecec9629 100644 --- a/src/main/java/me/jellysquid/mods/sodium/mixin/features/texture_tracking/MixinDrawableHelper.java +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/features/texture_tracking/MixinDrawableHelper.java @@ -3,7 +3,6 @@ import me.jellysquid.mods.sodium.client.render.texture.SpriteUtil; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.util.math.MatrixStack; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/features/texture_updates/AnimationFrameAccessor.java b/src/main/java/me/jellysquid/mods/sodium/mixin/features/texture_updates/AnimationFrameAccessor.java index 8b16c1a709..dc0aecbafc 100644 --- a/src/main/java/me/jellysquid/mods/sodium/mixin/features/texture_updates/AnimationFrameAccessor.java +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/features/texture_updates/AnimationFrameAccessor.java @@ -4,8 +4,6 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -import java.util.List; - @Mixin(SpriteContents.AnimationFrame.class) public interface AnimationFrameAccessor { @Accessor diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/workarounds/MixinWindow.java b/src/main/java/me/jellysquid/mods/sodium/mixin/workarounds/MixinWindow.java index 7938eaece5..672506c176 100644 --- a/src/main/java/me/jellysquid/mods/sodium/mixin/workarounds/MixinWindow.java +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/workarounds/MixinWindow.java @@ -11,7 +11,7 @@ @Mixin(Window.class) public class MixinWindow { @Redirect(method = "", at = @At(value = "INVOKE", target = "Lorg/lwjgl/glfw/GLFW;glfwCreateWindow(IILjava/lang/CharSequence;JJ)J")) - private long wrapGlfwCreateWindow(int width, int height, CharSequence title, long monitor, long share) throws Exception { + private long wrapGlfwCreateWindow(int width, int height, CharSequence title, long monitor, long share) { DriverWorkarounds.beforeContextCreation(); try {