diff --git a/.editorconfig b/.editorconfig index f37b585c9..1eeca6433 100644 --- a/.editorconfig +++ b/.editorconfig @@ -16,6 +16,7 @@ indent_size = 2 [*.java] indent_style = tab +ij_java_else_on_new_line = false ij_continuation_indent_size = 8 ij_java_class_count_to_use_import_on_demand = 99 ij_java_names_count_to_use_import_on_demand = 99 diff --git a/gradle.properties b/gradle.properties index b104f63f3..da9c12f49 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,14 +1,11 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false - # mod version info mod_version=0.0.3 mc_update_version=1.16 minecraft_version=1.16.5 - forge_version=36.0.42 mcp_mappings=20200920-mixed-1.16.3 - projectId=486392 curse_type=beta github_project=Jozufozu/Flywheel diff --git a/src/main/java/com/jozufozu/flywheel/backend/OptifineHandler.java b/src/main/java/com/jozufozu/flywheel/backend/OptifineHandler.java index 50f4c1ba6..c4d825c90 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/OptifineHandler.java +++ b/src/main/java/com/jozufozu/flywheel/backend/OptifineHandler.java @@ -45,8 +45,7 @@ public class OptifineHandler { if (optifine == null) { Backend.log.info("Optifine not detected."); - } - else { + } else { Backend.log.info("Optifine detected."); refresh(); diff --git a/src/main/java/com/jozufozu/flywheel/backend/ShaderSources.java b/src/main/java/com/jozufozu/flywheel/backend/ShaderSources.java index 6f99c2590..ede6c9b81 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/ShaderSources.java +++ b/src/main/java/com/jozufozu/flywheel/backend/ShaderSources.java @@ -207,8 +207,7 @@ public class ShaderSources implements ISelectiveResourceReloadListener { while (filechannel.read(bytebuffer) != -1) { } - } - else { + } else { bytebuffer = MemoryUtil.memAlloc(8192); ReadableByteChannel readablebytechannel = Channels.newChannel(is); diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/GlNumericType.java b/src/main/java/com/jozufozu/flywheel/backend/gl/GlNumericType.java index 8679a376d..29baffd7f 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/gl/GlNumericType.java +++ b/src/main/java/com/jozufozu/flywheel/backend/gl/GlNumericType.java @@ -53,11 +53,9 @@ public enum GlNumericType { public void castAndBuffer(ByteBuffer buf, int val) { if (this == UBYTE || this == BYTE) { buf.put((byte) val); - } - else if (this == USHORT || this == SHORT) { + } else if (this == USHORT || this == SHORT) { buf.putShort((short) val); - } - else if (this == UINT || this == INT) { + } else if (this == UINT || this == INT) { buf.putInt(val); } } diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java b/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java index a9bca56ef..d52804652 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java +++ b/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java @@ -56,8 +56,7 @@ public class GlBuffer extends GlObject { public MappedBuffer getBuffer(int offset, int length) { if (Backend.getInstance().compat.mapBufferRange != MapBufferRange.UNSUPPORTED) { return new MappedBufferRange(this, offset, length, GL30.GL_MAP_WRITE_BIT); - } - else { + } else { MappedFullBuffer fullBuffer = new MappedFullBuffer(this, MappedBufferUsage.WRITE_ONLY); fullBuffer.position(offset); return fullBuffer; diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceManager.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceManager.java index 2aa92094d..2c6a24f14 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceManager.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstanceManager.java @@ -125,8 +125,7 @@ public abstract class InstanceManager implements MaterialManager.OriginShiftL removeInternal(obj, instance); createInternal(obj); - } - else { + } else { instance.update(); } } @@ -177,11 +176,9 @@ public abstract class InstanceManager implements MaterialManager.OriginShiftL if (instance != null) { return instance; - } - else if (create && canCreateInstance(obj)) { + } else if (create && canCreateInstance(obj)) { return createInternal(obj); - } - else { + } else { return null; } } diff --git a/src/main/java/com/jozufozu/flywheel/backend/loading/ShaderTemplate.java b/src/main/java/com/jozufozu/flywheel/backend/loading/ShaderTemplate.java index 95082d44b..cb7bdbad0 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/loading/ShaderTemplate.java +++ b/src/main/java/com/jozufozu/flywheel/backend/loading/ShaderTemplate.java @@ -47,8 +47,7 @@ public class ShaderTemplate { if (struct != null) { s = s.replace(name, struct.name); - } - else { + } else { missing.add(name); } } diff --git a/src/main/java/com/jozufozu/flywheel/core/QuadConverter.java b/src/main/java/com/jozufozu/flywheel/core/QuadConverter.java index d524f0d77..1c717bee6 100644 --- a/src/main/java/com/jozufozu/flywheel/core/QuadConverter.java +++ b/src/main/java/com/jozufozu/flywheel/core/QuadConverter.java @@ -101,8 +101,7 @@ public class QuadConverter { ByteBuffer indices; if (bytes > stack.getSize()) { indices = MemoryUtil.memAlloc(bytes); // not enough space on the preallocated stack - } - else { + } else { stack.push(); indices = stack.malloc(bytes); } @@ -119,8 +118,7 @@ public class QuadConverter { if (bytes > stack.getSize()) { MemoryUtil.memFree(indices); - } - else { + } else { stack.pop(); } diff --git a/src/main/java/com/jozufozu/flywheel/core/instancing/ConditionalInstance.java b/src/main/java/com/jozufozu/flywheel/core/instancing/ConditionalInstance.java index 761199780..251b00db6 100644 --- a/src/main/java/com/jozufozu/flywheel/core/instancing/ConditionalInstance.java +++ b/src/main/java/com/jozufozu/flywheel/core/instancing/ConditionalInstance.java @@ -38,8 +38,7 @@ public class ConditionalInstance { if (shouldShow && instance == null) { instance = model.createInstance(); if (setupFunc != null) setupFunc.accept(instance); - } - else if (!shouldShow && instance != null) { + } else if (!shouldShow && instance != null) { instance.delete(); instance = null; } diff --git a/src/main/java/com/jozufozu/flywheel/core/instancing/GroupInstance.java b/src/main/java/com/jozufozu/flywheel/core/instancing/GroupInstance.java index 0063be74e..c9084b6c0 100644 --- a/src/main/java/com/jozufozu/flywheel/core/instancing/GroupInstance.java +++ b/src/main/java/com/jozufozu/flywheel/core/instancing/GroupInstance.java @@ -46,8 +46,7 @@ public class GroupInstance extends AbstractCollection for (int i = size; i < count; i++) { addInstance(); } - } - else { + } else { List unnecessary = backing.subList(count, size); unnecessary.forEach(InstanceData::delete); unnecessary.clear(); diff --git a/src/main/java/com/jozufozu/flywheel/core/instancing/SelectInstance.java b/src/main/java/com/jozufozu/flywheel/core/instancing/SelectInstance.java index c1077ac10..c865c4c0b 100644 --- a/src/main/java/com/jozufozu/flywheel/core/instancing/SelectInstance.java +++ b/src/main/java/com/jozufozu/flywheel/core/instancing/SelectInstance.java @@ -37,8 +37,7 @@ public class SelectInstance { current.delete(); current = null; } - } - else if (i != last) { + } else if (i != last) { if (current != null) current.delete(); current = models.get(i) diff --git a/src/main/java/com/jozufozu/flywheel/core/materials/BasicData.java b/src/main/java/com/jozufozu/flywheel/core/materials/BasicData.java index 24445b2f2..2fc7fc285 100644 --- a/src/main/java/com/jozufozu/flywheel/core/materials/BasicData.java +++ b/src/main/java/com/jozufozu/flywheel/core/materials/BasicData.java @@ -44,8 +44,7 @@ public abstract class BasicData extends InstanceData implements IFlatLight> 24) & 0xFF); return setColor(r, g, b, a); - } - else { + } else { return setColor(r, g, b); } } diff --git a/src/main/java/com/jozufozu/flywheel/core/shader/ExtensibleGlProgram.java b/src/main/java/com/jozufozu/flywheel/core/shader/ExtensibleGlProgram.java index 3d60666a7..b3a93c33f 100644 --- a/src/main/java/com/jozufozu/flywheel/core/shader/ExtensibleGlProgram.java +++ b/src/main/java/com/jozufozu/flywheel/core/shader/ExtensibleGlProgram.java @@ -35,8 +35,7 @@ public class ExtensibleGlProgram extends GlProgram { list.add(extension); } this.extensions = list; - } - else { + } else { this.extensions = Collections.emptyList(); } } diff --git a/src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java b/src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java index 07cab0441..279d6b44e 100644 --- a/src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java +++ b/src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java @@ -29,8 +29,7 @@ public class ForgeEvents { if (right.size() < 10) { right.add(""); right.add(text); - } - else { + } else { right.add(9, ""); right.add(10, text); } diff --git a/src/main/java/com/jozufozu/flywheel/light/LightUpdater.java b/src/main/java/com/jozufozu/flywheel/light/LightUpdater.java index e92d0ee23..3f1123258 100644 --- a/src/main/java/com/jozufozu/flywheel/light/LightUpdater.java +++ b/src/main/java/com/jozufozu/flywheel/light/LightUpdater.java @@ -150,8 +150,7 @@ public class LightUpdater { if (set == null) { set = new LongRBTreeSet(); listeners.put(listener, set); - } - else { + } else { set.forEach((LongConsumer) l -> { WeakHashSet listeningSections = lookup.get(l); diff --git a/src/main/java/com/jozufozu/flywheel/light/LightVolume.java b/src/main/java/com/jozufozu/flywheel/light/LightVolume.java index d144ce7d4..ae41c7f55 100644 --- a/src/main/java/com/jozufozu/flywheel/light/LightVolume.java +++ b/src/main/java/com/jozufozu/flywheel/light/LightVolume.java @@ -126,13 +126,11 @@ public class LightVolume { sampleVolume = newSampleVolume; copyLight(world, newArea); - } - else { + } else { sampleVolume = newSampleVolume; initialize(world); } - } - else { + } else { setSampleVolume(newSampleVolume); int volume = textureVolume.volume(); if (volume * 2 > lightData.capacity()) { diff --git a/src/main/java/com/jozufozu/flywheel/mixin/RenderHooksMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/RenderHooksMixin.java index 6d6289565..c28b21686 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/RenderHooksMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/RenderHooksMixin.java @@ -1,7 +1,5 @@ package com.jozufozu.flywheel.mixin; -import com.jozufozu.flywheel.backend.OptifineHandler; - import org.lwjgl.opengl.GL20; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -10,6 +8,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import com.jozufozu.flywheel.backend.Backend; +import com.jozufozu.flywheel.backend.OptifineHandler; import com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher; import com.jozufozu.flywheel.event.BeginFrameEvent; import com.jozufozu.flywheel.event.ReloadRenderersEvent; @@ -56,7 +55,8 @@ public class RenderHooksMixin { .getProjectionMatrix()); MinecraftForge.EVENT_BUS.post(new RenderLayerEvent(world, type, viewProjection, camX, camY, camZ)); - GL20.glUseProgram(0); + + if (!OptifineHandler.usingShaders()) GL20.glUseProgram(0); } @Inject(at = @At("TAIL"), method = "loadRenderers") @@ -83,8 +83,7 @@ public class RenderHooksMixin { Vector3d cameraPos = info.getProjectedView(); InstancedRenderDispatcher.renderBreaking(world, viewProjection, cameraPos.x, cameraPos.y, cameraPos.z); - if (!OptifineHandler.usingShaders()) - GL20.glUseProgram(0); + if (!OptifineHandler.usingShaders()) GL20.glUseProgram(0); } // Instancing diff --git a/src/main/java/com/jozufozu/flywheel/util/AnimationTickHolder.java b/src/main/java/com/jozufozu/flywheel/util/AnimationTickHolder.java index 91e9f2837..52718181d 100644 --- a/src/main/java/com/jozufozu/flywheel/util/AnimationTickHolder.java +++ b/src/main/java/com/jozufozu/flywheel/util/AnimationTickHolder.java @@ -16,8 +16,7 @@ public class AnimationTickHolder { if (!Minecraft.getInstance() .isGamePaused()) { ticks = (ticks + 1) % 1_728_000; // wrap around every 24 hours so we maintain enough floating point precision - } - else { + } else { paused_ticks = (paused_ticks + 1) % 1_728_000; } } diff --git a/src/main/java/com/jozufozu/flywheel/util/BakedQuadWrapper.java b/src/main/java/com/jozufozu/flywheel/util/BakedQuadWrapper.java index 1c63b9583..e31aacdb1 100644 --- a/src/main/java/com/jozufozu/flywheel/util/BakedQuadWrapper.java +++ b/src/main/java/com/jozufozu/flywheel/util/BakedQuadWrapper.java @@ -201,19 +201,15 @@ public class BakedQuadWrapper { int intOffset = FORMAT.getOffset(elementId) / Integer.BYTES; if (element.getUsage() == VertexFormatElement.Usage.POSITION) { position = intOffset; - } - else if (element.getUsage() == VertexFormatElement.Usage.COLOR) { + } else if (element.getUsage() == VertexFormatElement.Usage.COLOR) { color = intOffset; - } - else if (element.getUsage() == VertexFormatElement.Usage.UV) { + } else if (element.getUsage() == VertexFormatElement.Usage.UV) { if (element.getIndex() == 0) { texture = intOffset; - } - else if (element.getIndex() == 2) { + } else if (element.getIndex() == 2) { light = intOffset; } - } - else if (element.getUsage() == VertexFormatElement.Usage.NORMAL) { + } else if (element.getUsage() == VertexFormatElement.Usage.NORMAL) { normal = intOffset; } } diff --git a/src/main/java/com/jozufozu/flywheel/util/CodecUtil.java b/src/main/java/com/jozufozu/flywheel/util/CodecUtil.java index 8bad66b93..8263ce501 100644 --- a/src/main/java/com/jozufozu/flywheel/util/CodecUtil.java +++ b/src/main/java/com/jozufozu/flywheel/util/CodecUtil.java @@ -16,8 +16,7 @@ public class CodecUtil { .xmap(either -> either.map(l -> l, Collections::singletonList), list -> { if (list.size() == 1) { return Either.right(list.get(0)); - } - else { + } else { return Either.left(list); } });