A little back and forth

- Clean up the revert
This commit is contained in:
Jozufozu 2022-06-20 09:23:54 -07:00
parent 86dd1cd624
commit 3d8fdc69de
9 changed files with 21 additions and 27 deletions

View file

@ -19,7 +19,7 @@ parchment_version = 2022.03.13
# dependency versions # dependency versions
registrate_version = MC1.18.2-1.0.25 registrate_version = MC1.18.2-1.0.25
flywheel_version = 1.18-0.6.2.64 flywheel_version = 1.18-0.6.2.66
jei_minecraft_version = 1.18.2 jei_minecraft_version = 1.18.2
jei_version = 9.5.3.143 jei_version = 9.5.3.143
curios_minecraft_version = 1.18.2 curios_minecraft_version = 1.18.2

View file

@ -3,13 +3,12 @@ package com.simibubi.create.content.contraptions.components.actors;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
import com.simibubi.create.content.contraptions.components.structureMovement.render.FlwContraption; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
@ -39,7 +38,7 @@ public class DrillMovementBehaviour extends BlockBreakingMovementBehaviour {
@OnlyIn(value = Dist.CLIENT) @OnlyIn(value = Dist.CLIENT)
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld, public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
ContraptionMatrices matrices, MultiBufferSource buffer) { ContraptionMatrices matrices, MultiBufferSource buffer) {
if (!FlwContraption.canInstance()) if (!ContraptionRenderDispatcher.canInstance())
DrillRenderer.renderInContraption(context, renderWorld, matrices, buffer); DrillRenderer.renderInContraption(context, renderWorld, matrices, buffer);
} }

View file

@ -5,13 +5,12 @@ import javax.annotation.Nullable;
import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.commons.lang3.mutable.MutableBoolean;
import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
import com.simibubi.create.content.contraptions.components.structureMovement.render.FlwContraption; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
@ -59,7 +58,7 @@ public class HarvesterMovementBehaviour implements MovementBehaviour {
@Override @Override
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld, public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
ContraptionMatrices matrices, MultiBufferSource buffers) { ContraptionMatrices matrices, MultiBufferSource buffers) {
if (!FlwContraption.canInstance()) if (!ContraptionRenderDispatcher.canInstance())
HarvesterRenderer.renderInContraption(context, renderWorld, matrices, buffers); HarvesterRenderer.renderInContraption(context, renderWorld, matrices, buffers);
} }

View file

@ -5,13 +5,12 @@ import java.util.Optional;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
import com.simibubi.create.content.contraptions.components.structureMovement.render.FlwContraption; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
import com.simibubi.create.content.logistics.trains.entity.CarriageContraption; import com.simibubi.create.content.logistics.trains.entity.CarriageContraption;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.foundation.utility.animation.LerpedFloat; import com.simibubi.create.foundation.utility.animation.LerpedFloat;
@ -56,7 +55,7 @@ public class PortableStorageInterfaceMovement implements MovementBehaviour {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld, public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
ContraptionMatrices matrices, MultiBufferSource buffer) { ContraptionMatrices matrices, MultiBufferSource buffer) {
if (!FlwContraption.canInstance()) if (!ContraptionRenderDispatcher.canInstance())
PortableStorageInterfaceRenderer.renderInContraption(context, renderWorld, matrices, buffer); PortableStorageInterfaceRenderer.renderInContraption(context, renderWorld, matrices, buffer);
} }

View file

@ -20,7 +20,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Ori
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.MountedContraption; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.MountedContraption;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
import com.simibubi.create.content.contraptions.components.structureMovement.render.FlwContraption; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
import com.simibubi.create.content.logistics.item.filter.FilterItem; import com.simibubi.create.content.logistics.item.filter.FilterItem;
import com.simibubi.create.content.logistics.trains.entity.CarriageContraption; import com.simibubi.create.content.logistics.trains.entity.CarriageContraption;
import com.simibubi.create.content.logistics.trains.entity.CarriageContraptionEntity; import com.simibubi.create.content.logistics.trains.entity.CarriageContraptionEntity;
@ -298,7 +298,7 @@ public class DeployerMovementBehaviour implements MovementBehaviour {
@Override @Override
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld, public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
ContraptionMatrices matrices, MultiBufferSource buffers) { ContraptionMatrices matrices, MultiBufferSource buffers) {
if (!FlwContraption.canInstance()) if (!ContraptionRenderDispatcher.canInstance())
DeployerRenderer.renderInContraption(context, renderWorld, matrices, buffers); DeployerRenderer.renderInContraption(context, renderWorld, matrices, buffers);
} }

View file

@ -3,7 +3,6 @@ package com.simibubi.create.content.contraptions.components.structureMovement.be
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.PartialModel;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
import com.mojang.math.Quaternion; import com.mojang.math.Quaternion;
@ -16,7 +15,6 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Ori
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
import com.simibubi.create.content.contraptions.components.structureMovement.render.FlwContraption;
import com.simibubi.create.foundation.render.CachedBufferer; import com.simibubi.create.foundation.render.CachedBufferer;
import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.SuperByteBuffer;
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
@ -35,7 +33,7 @@ public class StabilizedBearingMovementBehaviour implements MovementBehaviour {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld, public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
ContraptionMatrices matrices, MultiBufferSource buffer) { ContraptionMatrices matrices, MultiBufferSource buffer) {
if (FlwContraption.canInstance()) if (ContraptionRenderDispatcher.canInstance())
return; return;
Direction facing = context.state.getValue(BlockStateProperties.FACING); Direction facing = context.state.getValue(BlockStateProperties.FACING);

View file

@ -123,7 +123,7 @@ public class ContraptionRenderDispatcher {
VirtualRenderWorld renderWorld = new VirtualRenderWorld(world, origin, height, minBuildHeight) { VirtualRenderWorld renderWorld = new VirtualRenderWorld(world, origin, height, minBuildHeight) {
@Override @Override
public boolean supportsFlywheel() { public boolean supportsFlywheel() {
return Backend.getBackendType() == BackendType.INSTANCING; return canInstance();
} }
}; };
@ -204,4 +204,8 @@ public class ContraptionRenderDispatcher {
WORLDS = new WorldAttached<>(SBBContraptionManager::new); WORLDS = new WorldAttached<>(SBBContraptionManager::new);
} }
} }
public static boolean canInstance() {
return Backend.getBackendType() == BackendType.INSTANCING;
}
} }

View file

@ -13,7 +13,6 @@ import com.jozufozu.flywheel.backend.instancing.SerialTaskEngine;
import com.jozufozu.flywheel.backend.instancing.batching.BatchingEngine; import com.jozufozu.flywheel.backend.instancing.batching.BatchingEngine;
import com.jozufozu.flywheel.backend.instancing.instancing.InstancingEngine; import com.jozufozu.flywheel.backend.instancing.instancing.InstancingEngine;
import com.jozufozu.flywheel.backend.model.ArrayModelRenderer; import com.jozufozu.flywheel.backend.model.ArrayModelRenderer;
import com.jozufozu.flywheel.config.BackendType;
import com.jozufozu.flywheel.core.model.Model; import com.jozufozu.flywheel.core.model.Model;
import com.jozufozu.flywheel.core.model.WorldModel; import com.jozufozu.flywheel.core.model.WorldModel;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
@ -54,17 +53,13 @@ public class FlwContraption extends ContraptionRenderInfo {
var restoreState = GlStateTracker.getRestoreState(); var restoreState = GlStateTracker.getRestoreState();
buildLayers(); buildLayers();
if (canInstance()) { if (ContraptionRenderDispatcher.canInstance()) {
buildInstancedTiles(); buildInstancedTiles();
buildActors(); buildActors();
} }
restoreState.restore(); restoreState.restore();
} }
public static boolean canInstance() {
return Backend.getBackendType() == BackendType.INSTANCING;
}
public ContraptionLighter<?> getLighter() { public ContraptionLighter<?> getLighter() {
return lighter; return lighter;
} }
@ -186,7 +181,7 @@ public class FlwContraption extends ContraptionRenderInfo {
private final ContraptionInstanceManager tileInstanceManager; private final ContraptionInstanceManager tileInstanceManager;
public ContraptionInstanceWorld(FlwContraption parent) { public ContraptionInstanceWorld(FlwContraption parent) {
switch (Backend.getEngine()) { switch (Backend.getBackendType()) {
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

@ -7,7 +7,7 @@ import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.backend.RenderLayer; import com.jozufozu.flywheel.backend.RenderLayer;
import com.jozufozu.flywheel.backend.gl.GlStateTracker; import com.jozufozu.flywheel.backend.gl.GlStateTracker;
import com.jozufozu.flywheel.backend.gl.GlTextureUnit; import com.jozufozu.flywheel.backend.gl.GlTextureUnit;
import com.jozufozu.flywheel.config.FlwEngine; import com.jozufozu.flywheel.config.BackendType;
import com.jozufozu.flywheel.core.Formats; import com.jozufozu.flywheel.core.Formats;
import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.Materials;
import com.jozufozu.flywheel.core.compile.ProgramContext; import com.jozufozu.flywheel.core.compile.ProgramContext;
@ -43,12 +43,12 @@ public class FlwContraptionManager extends ContraptionRenderingWorld<FlwContrapt
GlStateTracker.State restoreState = GlStateTracker.getRestoreState(); GlStateTracker.State restoreState = GlStateTracker.getRestoreState();
GlTextureUnit active = GlTextureUnit.getActive(); GlTextureUnit active = GlTextureUnit.getActive();
var backendType = Backend.getEngine(); var backendType = Backend.getBackendType();
if (backendType != FlwEngine.OFF) { if (backendType != BackendType.OFF) {
renderStructures(event); renderStructures(event);
} }
if (backendType != FlwEngine.BATCHING && event.getLayer() != null) { if (backendType != BackendType.BATCHING && event.getLayer() != null) {
for (FlwContraption renderer : visible) { for (FlwContraption renderer : visible) {
renderer.renderInstanceLayer(event); renderer.renderInstanceLayer(event);
} }