Reorganize and simplify

- Remove AllMaterialSpecs#flwInit
This commit is contained in:
Jozufozu 2022-01-12 21:26:00 -08:00
parent 74a147db30
commit d3bbeb5a7a
5 changed files with 6 additions and 29 deletions

View file

@ -20,7 +20,6 @@ import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.gui.UIRenderHelper; import com.simibubi.create.foundation.gui.UIRenderHelper;
import com.simibubi.create.foundation.ponder.content.PonderIndex; import com.simibubi.create.foundation.ponder.content.PonderIndex;
import com.simibubi.create.foundation.ponder.element.WorldSectionElement; 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.CachedBufferer;
import com.simibubi.create.foundation.render.CreateContexts; import com.simibubi.create.foundation.render.CreateContexts;
import com.simibubi.create.foundation.render.SuperByteBufferCache; import com.simibubi.create.foundation.render.SuperByteBufferCache;
@ -65,7 +64,6 @@ public class CreateClient {
modEventBus.addListener(CreateClient::clientInit); modEventBus.addListener(CreateClient::clientInit);
modEventBus.addListener(AllParticleTypes::registerFactories); modEventBus.addListener(AllParticleTypes::registerFactories);
modEventBus.addListener(CreateContexts::flwInit); modEventBus.addListener(CreateContexts::flwInit);
modEventBus.addListener(AllMaterialSpecs::flwInit);
modEventBus.addListener(ContraptionRenderDispatcher::gatherContext); modEventBus.addListener(ContraptionRenderDispatcher::gatherContext);
MODEL_SWAPPER.registerListeners(modEventBus); MODEL_SWAPPER.registerListeners(modEventBus);
@ -83,7 +81,7 @@ public class CreateClient {
BUFFER_CACHE.registerCompartment(WorldSectionElement.DOC_WORLD_SECTION, 20); BUFFER_CACHE.registerCompartment(WorldSectionElement.DOC_WORLD_SECTION, 20);
ShippedResourcePacks.extractFiles("Copper Legacy Pack"); ShippedResourcePacks.extractFiles("Copper Legacy Pack");
AllKeys.register(); AllKeys.register();
// AllFluids.assignRenderLayers(); // AllFluids.assignRenderLayers();
AllBlockPartials.init(); AllBlockPartials.init();

View file

@ -182,7 +182,7 @@ public class FlwContraption extends ContraptionRenderInfo {
private final ContraptionInstanceManager tileInstanceManager; private final ContraptionInstanceManager tileInstanceManager;
public ContraptionInstanceWorld(FlwContraption parent) { public ContraptionInstanceWorld(FlwContraption parent) {
switch (Backend.getInstance().getEngine()) { switch (Backend.getEngine()) {
case INSTANCING -> { case INSTANCING -> {
InstancingEngine<ContraptionProgram> engine = InstancingEngine.builder(CreateContexts.CWORLD) InstancingEngine<ContraptionProgram> engine = InstancingEngine.builder(CreateContexts.CWORLD)
.setGroupFactory(ContraptionGroup.forContraption(parent)) .setGroupFactory(ContraptionGroup.forContraption(parent))

View file

@ -1,7 +1,6 @@
package com.simibubi.create.foundation.render; package com.simibubi.create.foundation.render;
import com.jozufozu.flywheel.api.struct.StructType; import com.jozufozu.flywheel.api.struct.StructType;
import com.jozufozu.flywheel.event.GatherContextEvent;
import com.simibubi.create.Create; import com.simibubi.create.Create;
import com.simibubi.create.content.contraptions.base.flwdata.BeltData; import com.simibubi.create.content.contraptions.base.flwdata.BeltData;
import com.simibubi.create.content.contraptions.base.flwdata.BeltType; import com.simibubi.create.content.contraptions.base.flwdata.BeltType;
@ -18,22 +17,12 @@ import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class AllMaterialSpecs { public class AllMaterialSpecs {
public static void init() {
// noop, make sure the static field are loaded.
}
public static final StructType<RotatingData> ROTATING = new RotatingType(); public static final StructType<RotatingData> ROTATING = new RotatingType();
public static final StructType<BeltData> BELTS = new BeltType(); public static final StructType<BeltData> BELTS = new BeltType();
public static final StructType<ActorData> ACTORS = new ActorType(); public static final StructType<ActorData> ACTORS = new ActorType();
public static final StructType<FlapData> FLAPS = new FlapType(); public static final StructType<FlapData> 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 class Locations {
public static final ResourceLocation ROTATING = Create.asResource("rotating"); public static final ResourceLocation ROTATING = Create.asResource("rotating");
public static final ResourceLocation BELTS = Create.asResource("belts"); public static final ResourceLocation BELTS = Create.asResource("belts");

View file

@ -1,10 +1,10 @@
package com.simibubi.create.foundation.render; package com.simibubi.create.foundation.render;
import com.jozufozu.flywheel.backend.GameStateRegistry; import com.jozufozu.flywheel.core.GameStateRegistry;
import com.jozufozu.flywheel.backend.source.FileResolution;
import com.jozufozu.flywheel.backend.source.Resolver;
import com.jozufozu.flywheel.core.Templates; import com.jozufozu.flywheel.core.Templates;
import com.jozufozu.flywheel.core.compile.ProgramCompiler; 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.event.GatherContextEvent;
import com.jozufozu.flywheel.util.ResourceUtil; import com.jozufozu.flywheel.util.ResourceUtil;
import com.simibubi.create.Create; import com.simibubi.create.Create;

View file

@ -2,28 +2,18 @@ package com.simibubi.create.foundation.render;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import com.jozufozu.flywheel.core.compile.ShaderConstants;
import com.jozufozu.flywheel.core.shader.GameStateProvider; 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 com.simibubi.create.content.contraptions.KineticDebugger;
import net.minecraft.resources.ResourceLocation;
public enum RainbowDebugStateProvider implements GameStateProvider { public enum RainbowDebugStateProvider implements GameStateProvider {
INSTANCE; INSTANCE;
public static final ResourceLocation NAME = Create.asResource("rainbow_debug");
@Override @Override
public boolean isTrue() { public boolean isTrue() {
return KineticDebugger.isActive(); return KineticDebugger.isActive();
} }
@Nonnull
@Override
public ResourceLocation getID() {
return NAME;
}
@Override @Override
public void alterConstants(@Nonnull ShaderConstants constants) { public void alterConstants(@Nonnull ShaderConstants constants) {
constants.define("DEBUG_RAINBOW"); constants.define("DEBUG_RAINBOW");