diff --git a/src/main/java/com/jozufozu/flywheel/Flywheel.java b/src/main/java/com/jozufozu/flywheel/Flywheel.java index aeb110dc4..6214f67f5 100644 --- a/src/main/java/com/jozufozu/flywheel/Flywheel.java +++ b/src/main/java/com/jozufozu/flywheel/Flywheel.java @@ -18,11 +18,11 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -@Mod("flywheel") +@Mod(Flywheel.ID) public class Flywheel { public static final String ID = "flywheel"; - public static final Logger log = LogManager.getLogger(Flywheel.class); + public static final Logger LOGGER = LogManager.getLogger(Flywheel.class); public Flywheel() { FMLJavaModLoadingContext.get() @@ -42,6 +42,6 @@ public class Flywheel { private void setup(final FMLCommonSetupEvent event) { FlwPackets.registerPackets(); - ArgumentTypes.register("flywheel:engine", EngineArgument.class, new EmptyArgumentSerializer<>(EngineArgument::getInstance)); + ArgumentTypes.register(rl("engine").toString(), EngineArgument.class, new EmptyArgumentSerializer<>(EngineArgument::getInstance)); } } diff --git a/src/main/java/com/jozufozu/flywheel/FlywheelClient.java b/src/main/java/com/jozufozu/flywheel/FlywheelClient.java index dc0e7b4e4..3ec94f352 100644 --- a/src/main/java/com/jozufozu/flywheel/FlywheelClient.java +++ b/src/main/java/com/jozufozu/flywheel/FlywheelClient.java @@ -33,6 +33,6 @@ public class FlywheelClient { // Only thing I've seen that's close to a fix is to force the class to load before trying to use it. // From the SpongePowered discord: // https://discord.com/channels/142425412096491520/626802111455297538/675007581168599041 - Flywheel.log.info("Successfully loaded {}", PausedPartialTickAccessor.class.getName()); + Flywheel.LOGGER.info("Successfully loaded {}", PausedPartialTickAccessor.class.getName()); } } diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/error/GlError.java b/src/main/java/com/jozufozu/flywheel/backend/gl/error/GlError.java index 115ca765d..41b9ddf46 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/gl/error/GlError.java +++ b/src/main/java/com/jozufozu/flywheel/backend/gl/error/GlError.java @@ -44,7 +44,7 @@ public enum GlError { // TODO: build flag? to enable or disable this function GlError err = GlError.poll(); if (err != null) { - Flywheel.log.error("{}: {}", err.name(), context.get()); + Flywheel.LOGGER.error("{}: {}", err.name(), context.get()); } } } diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/ParallelTaskEngine.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/ParallelTaskEngine.java index 937567853..316bed471 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/ParallelTaskEngine.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/ParallelTaskEngine.java @@ -139,7 +139,7 @@ public class ParallelTaskEngine implements TaskEngine { try { job.run(); } catch (Exception e) { - Flywheel.log.error(e); + Flywheel.LOGGER.error(e); } finally { ParallelTaskEngine.this.wg.done(); } diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/GPUInstancer.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/GPUInstancer.java index ae9cb845d..1c7f0eb74 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/GPUInstancer.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/GPUInstancer.java @@ -137,7 +137,7 @@ public class GPUInstancer extends AbstractInstancer { try (MappedBuffer buf = instanceVBO.getBuffer(offset, length)) { MemoryUtil.memSet(MemoryUtil.memAddress(buf.unwrap()), 0, length); } catch (Exception e) { - Flywheel.log.error("Error clearing buffer tail:", e); + Flywheel.LOGGER.error("Error clearing buffer tail:", e); } } } @@ -159,7 +159,7 @@ public class GPUInstancer extends AbstractInstancer { } } } catch (Exception e) { - Flywheel.log.error("Error updating GPUInstancer:", e); + Flywheel.LOGGER.error("Error updating GPUInstancer:", e); } } @@ -175,7 +175,7 @@ public class GPUInstancer extends AbstractInstancer { writer.write(datum); } } catch (Exception e) { - Flywheel.log.error("Error reallocating GPUInstancer:", e); + Flywheel.LOGGER.error("Error reallocating GPUInstancer:", e); } glInstanceCount = size; diff --git a/src/main/java/com/jozufozu/flywheel/backend/model/ModelPool.java b/src/main/java/com/jozufozu/flywheel/backend/model/ModelPool.java index feb5815ab..4561577bf 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/model/ModelPool.java +++ b/src/main/java/com/jozufozu/flywheel/backend/model/ModelPool.java @@ -121,7 +121,7 @@ public class ModelPool implements ModelAllocator { } } catch (Exception e) { - Flywheel.log.error("Error uploading pooled models:", e); + Flywheel.LOGGER.error("Error uploading pooled models:", e); } } @@ -133,7 +133,7 @@ public class ModelPool implements ModelAllocator { } pendingUpload.clear(); } catch (Exception e) { - Flywheel.log.error("Error uploading pooled models:", e); + Flywheel.LOGGER.error("Error uploading pooled models:", e); } } diff --git a/src/main/java/com/jozufozu/flywheel/backend/model/VBOModel.java b/src/main/java/com/jozufozu/flywheel/backend/model/VBOModel.java index 06c8d1066..dcc26d234 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/model/VBOModel.java +++ b/src/main/java/com/jozufozu/flywheel/backend/model/VBOModel.java @@ -35,7 +35,7 @@ public class VBOModel implements BufferedModel { try (MappedBuffer buffer = vbo.getBuffer()) { model.writeInto(buffer.unwrap()); } catch (Exception e) { - Flywheel.log.error(String.format("Error uploading model '%s':", model.name()), e); + Flywheel.LOGGER.error(String.format("Error uploading model '%s':", model.name()), e); } vbo.unbind(); diff --git a/src/main/java/com/jozufozu/flywheel/config/FlwPackets.java b/src/main/java/com/jozufozu/flywheel/config/FlwPackets.java index eb968aa52..c3fa59234 100644 --- a/src/main/java/com/jozufozu/flywheel/config/FlwPackets.java +++ b/src/main/java/com/jozufozu/flywheel/config/FlwPackets.java @@ -8,8 +8,8 @@ import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; public class FlwPackets { - public static final ResourceLocation CHANNEL_NAME = new ResourceLocation(Flywheel.ID, "network"); - public static final String NETWORK_VERSION = new ResourceLocation(Flywheel.ID, "1").toString(); + public static final ResourceLocation CHANNEL_NAME = Flywheel.rl("main"); + public static final String NETWORK_VERSION = String.valueOf(1); public static SimpleChannel channel; public static void registerPackets() { @@ -19,13 +19,15 @@ public class FlwPackets { .networkProtocolVersion(() -> NETWORK_VERSION) .simpleChannel(); - channel.messageBuilder(SConfigureBooleanPacket.class, 0, NetworkDirection.PLAY_TO_CLIENT) + int id = 0; + + channel.messageBuilder(SConfigureBooleanPacket.class, id++, NetworkDirection.PLAY_TO_CLIENT) .decoder(SConfigureBooleanPacket::new) .encoder(SConfigureBooleanPacket::encode) .consumer(SConfigureBooleanPacket::execute) .add(); - channel.messageBuilder(SConfigureEnginePacket.class, 1, NetworkDirection.PLAY_TO_CLIENT) + channel.messageBuilder(SConfigureEnginePacket.class, id++, NetworkDirection.PLAY_TO_CLIENT) .decoder(SConfigureEnginePacket::new) .encoder(SConfigureEnginePacket::encode) .consumer(SConfigureEnginePacket::execute) diff --git a/src/main/java/com/jozufozu/flywheel/core/Contexts.java b/src/main/java/com/jozufozu/flywheel/core/Contexts.java index 5c702124a..744ef5ae6 100644 --- a/src/main/java/com/jozufozu/flywheel/core/Contexts.java +++ b/src/main/java/com/jozufozu/flywheel/core/Contexts.java @@ -40,7 +40,7 @@ public class Contexts { } public static class Names { - public static final ResourceLocation CRUMBLING = new ResourceLocation(Flywheel.ID, "context/crumbling"); - public static final ResourceLocation WORLD = new ResourceLocation(Flywheel.ID, "context/world"); + public static final ResourceLocation CRUMBLING = Flywheel.rl("context/crumbling"); + public static final ResourceLocation WORLD = Flywheel.rl("context/world"); } } diff --git a/src/main/java/com/jozufozu/flywheel/core/FullscreenQuad.java b/src/main/java/com/jozufozu/flywheel/core/FullscreenQuad.java index d319a2656..fbabefe94 100644 --- a/src/main/java/com/jozufozu/flywheel/core/FullscreenQuad.java +++ b/src/main/java/com/jozufozu/flywheel/core/FullscreenQuad.java @@ -36,7 +36,7 @@ public class FullscreenQuad { try (MappedBuffer buffer = vbo.getBuffer()) { buffer.putFloatArray(vertices); } catch (Exception e) { - Flywheel.log.error("Could not create fullscreen quad.", e); + Flywheel.LOGGER.error("Could not create fullscreen quad.", e); } vao = new GlVertexArray(); diff --git a/src/main/java/com/jozufozu/flywheel/core/Materials.java b/src/main/java/com/jozufozu/flywheel/core/Materials.java index 3de4d5f1b..f5470dc83 100644 --- a/src/main/java/com/jozufozu/flywheel/core/Materials.java +++ b/src/main/java/com/jozufozu/flywheel/core/Materials.java @@ -1,5 +1,6 @@ package com.jozufozu.flywheel.core; +import com.jozufozu.flywheel.Flywheel; import com.jozufozu.flywheel.api.struct.StructType; import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.core.materials.model.ModelData; @@ -25,7 +26,7 @@ public class Materials { } public static class Names { - public static final ResourceLocation MODEL = new ResourceLocation("create", "model"); - public static final ResourceLocation ORIENTED = new ResourceLocation("create", "oriented"); + public static final ResourceLocation MODEL = Flywheel.rl("model"); + public static final ResourceLocation ORIENTED = Flywheel.rl("oriented"); } } diff --git a/src/main/java/com/jozufozu/flywheel/core/Programs.java b/src/main/java/com/jozufozu/flywheel/core/Programs.java index 5ed04b767..8a00ca79b 100644 --- a/src/main/java/com/jozufozu/flywheel/core/Programs.java +++ b/src/main/java/com/jozufozu/flywheel/core/Programs.java @@ -5,6 +5,6 @@ import com.jozufozu.flywheel.Flywheel; import net.minecraft.resources.ResourceLocation; public class Programs { - public static final ResourceLocation TRANSFORMED = new ResourceLocation(Flywheel.ID, "model"); - public static final ResourceLocation ORIENTED = new ResourceLocation(Flywheel.ID, "oriented"); + public static final ResourceLocation TRANSFORMED = Flywheel.rl("model"); + public static final ResourceLocation ORIENTED = Flywheel.rl("oriented"); } diff --git a/src/main/java/com/jozufozu/flywheel/core/shader/extension/UnitExtensionInstance.java b/src/main/java/com/jozufozu/flywheel/core/shader/extension/UnitExtensionInstance.java index 7b5773aa2..ac3dcc36e 100644 --- a/src/main/java/com/jozufozu/flywheel/core/shader/extension/UnitExtensionInstance.java +++ b/src/main/java/com/jozufozu/flywheel/core/shader/extension/UnitExtensionInstance.java @@ -7,7 +7,7 @@ import net.minecraft.resources.ResourceLocation; public class UnitExtensionInstance implements IExtensionInstance { - public static final ResourceLocation NAME = new ResourceLocation(Flywheel.ID, "unit"); + public static final ResourceLocation NAME = Flywheel.rl("unit"); public UnitExtensionInstance(GlProgram program) { } diff --git a/src/main/java/com/jozufozu/flywheel/core/shader/extension/WorldFog.java b/src/main/java/com/jozufozu/flywheel/core/shader/extension/WorldFog.java index 0aba10b1e..b76c370eb 100644 --- a/src/main/java/com/jozufozu/flywheel/core/shader/extension/WorldFog.java +++ b/src/main/java/com/jozufozu/flywheel/core/shader/extension/WorldFog.java @@ -10,7 +10,7 @@ import net.minecraft.resources.ResourceLocation; public class WorldFog implements IExtensionInstance { - public static final ResourceLocation NAME = new ResourceLocation(Flywheel.ID, "fog"); + public static final ResourceLocation NAME = Flywheel.rl("fog"); private final int uFogColor; private final int uFogRange; @@ -28,6 +28,6 @@ public class WorldFog implements IExtensionInstance { @Override public ResourceLocation name() { - return NAME; - } + return NAME; + } } diff --git a/src/main/java/com/jozufozu/flywheel/core/shader/gamestate/NormalDebugStateProvider.java b/src/main/java/com/jozufozu/flywheel/core/shader/gamestate/NormalDebugStateProvider.java index a1efdbf5f..f7ddbbea0 100644 --- a/src/main/java/com/jozufozu/flywheel/core/shader/gamestate/NormalDebugStateProvider.java +++ b/src/main/java/com/jozufozu/flywheel/core/shader/gamestate/NormalDebugStateProvider.java @@ -9,7 +9,7 @@ import net.minecraft.resources.ResourceLocation; public class NormalDebugStateProvider implements IBooleanStateProvider { public static final NormalDebugStateProvider INSTANCE = new NormalDebugStateProvider(); - public static final ResourceLocation NAME = new ResourceLocation(Flywheel.ID, "normal_debug"); + public static final ResourceLocation NAME = Flywheel.rl("normal_debug"); protected NormalDebugStateProvider() {