From d3bbeb5a7a9a0f3cd17ed82ff51018f4fc645bde Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Wed, 12 Jan 2022 21:26:00 -0800 Subject: [PATCH] Reorganize and simplify - Remove AllMaterialSpecs#flwInit --- src/main/java/com/simibubi/create/CreateClient.java | 4 +--- .../structureMovement/render/FlwContraption.java | 2 +- .../create/foundation/render/AllMaterialSpecs.java | 11 ----------- .../create/foundation/render/CreateContexts.java | 6 +++--- .../foundation/render/RainbowDebugStateProvider.java | 12 +----------- 5 files changed, 6 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/simibubi/create/CreateClient.java b/src/main/java/com/simibubi/create/CreateClient.java index add42fd1f..235db054c 100644 --- a/src/main/java/com/simibubi/create/CreateClient.java +++ b/src/main/java/com/simibubi/create/CreateClient.java @@ -20,7 +20,6 @@ import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.gui.UIRenderHelper; import com.simibubi.create.foundation.ponder.content.PonderIndex; import com.simibubi.create.foundation.ponder.element.WorldSectionElement; -import com.simibubi.create.foundation.render.AllMaterialSpecs; import com.simibubi.create.foundation.render.CachedBufferer; import com.simibubi.create.foundation.render.CreateContexts; import com.simibubi.create.foundation.render.SuperByteBufferCache; @@ -65,7 +64,6 @@ public class CreateClient { modEventBus.addListener(CreateClient::clientInit); modEventBus.addListener(AllParticleTypes::registerFactories); modEventBus.addListener(CreateContexts::flwInit); - modEventBus.addListener(AllMaterialSpecs::flwInit); modEventBus.addListener(ContraptionRenderDispatcher::gatherContext); MODEL_SWAPPER.registerListeners(modEventBus); @@ -83,7 +81,7 @@ public class CreateClient { BUFFER_CACHE.registerCompartment(WorldSectionElement.DOC_WORLD_SECTION, 20); ShippedResourcePacks.extractFiles("Copper Legacy Pack"); - + AllKeys.register(); // AllFluids.assignRenderLayers(); AllBlockPartials.init(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java index 49a6ef06b..01cbb7d95 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java @@ -182,7 +182,7 @@ public class FlwContraption extends ContraptionRenderInfo { private final ContraptionInstanceManager tileInstanceManager; public ContraptionInstanceWorld(FlwContraption parent) { - switch (Backend.getInstance().getEngine()) { + switch (Backend.getEngine()) { case INSTANCING -> { InstancingEngine engine = InstancingEngine.builder(CreateContexts.CWORLD) .setGroupFactory(ContraptionGroup.forContraption(parent)) diff --git a/src/main/java/com/simibubi/create/foundation/render/AllMaterialSpecs.java b/src/main/java/com/simibubi/create/foundation/render/AllMaterialSpecs.java index 930193398..bcf82d29d 100644 --- a/src/main/java/com/simibubi/create/foundation/render/AllMaterialSpecs.java +++ b/src/main/java/com/simibubi/create/foundation/render/AllMaterialSpecs.java @@ -1,7 +1,6 @@ package com.simibubi.create.foundation.render; import com.jozufozu.flywheel.api.struct.StructType; -import com.jozufozu.flywheel.event.GatherContextEvent; import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.base.flwdata.BeltData; import com.simibubi.create.content.contraptions.base.flwdata.BeltType; @@ -18,22 +17,12 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) public class AllMaterialSpecs { - public static void init() { - // noop, make sure the static field are loaded. - } public static final StructType ROTATING = new RotatingType(); public static final StructType BELTS = new BeltType(); public static final StructType ACTORS = new ActorType(); public static final StructType FLAPS = new FlapType(); - public static void flwInit(GatherContextEvent event) { - event.getBackend().register(Locations.ROTATING, ROTATING); - event.getBackend().register(Locations.BELTS, BELTS); - event.getBackend().register(Locations.ACTORS, ACTORS); - event.getBackend().register(Locations.FLAPS, FLAPS); - } - public static class Locations { public static final ResourceLocation ROTATING = Create.asResource("rotating"); public static final ResourceLocation BELTS = Create.asResource("belts"); diff --git a/src/main/java/com/simibubi/create/foundation/render/CreateContexts.java b/src/main/java/com/simibubi/create/foundation/render/CreateContexts.java index c21c5510f..75e9a4798 100644 --- a/src/main/java/com/simibubi/create/foundation/render/CreateContexts.java +++ b/src/main/java/com/simibubi/create/foundation/render/CreateContexts.java @@ -1,10 +1,10 @@ package com.simibubi.create.foundation.render; -import com.jozufozu.flywheel.backend.GameStateRegistry; -import com.jozufozu.flywheel.backend.source.FileResolution; -import com.jozufozu.flywheel.backend.source.Resolver; +import com.jozufozu.flywheel.core.GameStateRegistry; import com.jozufozu.flywheel.core.Templates; import com.jozufozu.flywheel.core.compile.ProgramCompiler; +import com.jozufozu.flywheel.core.source.FileResolution; +import com.jozufozu.flywheel.core.source.Resolver; import com.jozufozu.flywheel.event.GatherContextEvent; import com.jozufozu.flywheel.util.ResourceUtil; import com.simibubi.create.Create; diff --git a/src/main/java/com/simibubi/create/foundation/render/RainbowDebugStateProvider.java b/src/main/java/com/simibubi/create/foundation/render/RainbowDebugStateProvider.java index 339754143..e36af21e3 100644 --- a/src/main/java/com/simibubi/create/foundation/render/RainbowDebugStateProvider.java +++ b/src/main/java/com/simibubi/create/foundation/render/RainbowDebugStateProvider.java @@ -2,28 +2,18 @@ package com.simibubi.create.foundation.render; import javax.annotation.Nonnull; -import com.jozufozu.flywheel.core.compile.ShaderConstants; import com.jozufozu.flywheel.core.shader.GameStateProvider; -import com.simibubi.create.Create; +import com.jozufozu.flywheel.core.shader.ShaderConstants; import com.simibubi.create.content.contraptions.KineticDebugger; -import net.minecraft.resources.ResourceLocation; - public enum RainbowDebugStateProvider implements GameStateProvider { INSTANCE; - public static final ResourceLocation NAME = Create.asResource("rainbow_debug"); @Override public boolean isTrue() { return KineticDebugger.isActive(); } - @Nonnull - @Override - public ResourceLocation getID() { - return NAME; - } - @Override public void alterConstants(@Nonnull ShaderConstants constants) { constants.define("DEBUG_RAINBOW");