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
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_version = 9.5.3.143
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 com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
import com.simibubi.create.AllBlocks;
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.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 net.minecraft.client.renderer.MultiBufferSource;
@ -39,7 +38,7 @@ public class DrillMovementBehaviour extends BlockBreakingMovementBehaviour {
@OnlyIn(value = Dist.CLIENT)
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
ContraptionMatrices matrices, MultiBufferSource buffer) {
if (!FlwContraption.canInstance())
if (!ContraptionRenderDispatcher.canInstance())
DrillRenderer.renderInContraption(context, renderWorld, matrices, buffer);
}

View file

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

View file

@ -5,13 +5,12 @@ import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
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.render.ActorInstance;
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.foundation.utility.VecHelper;
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
@ -56,7 +55,7 @@ public class PortableStorageInterfaceMovement implements MovementBehaviour {
@OnlyIn(Dist.CLIENT)
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
ContraptionMatrices matrices, MultiBufferSource buffer) {
if (!FlwContraption.canInstance())
if (!ContraptionRenderDispatcher.canInstance())
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.render.ActorInstance;
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.trains.entity.CarriageContraption;
import com.simibubi.create.content.logistics.trains.entity.CarriageContraptionEntity;
@ -298,7 +298,7 @@ public class DeployerMovementBehaviour implements MovementBehaviour {
@Override
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
ContraptionMatrices matrices, MultiBufferSource buffers) {
if (!FlwContraption.canInstance())
if (!ContraptionRenderDispatcher.canInstance())
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 com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.core.PartialModel;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
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.ContraptionMatrices;
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.SuperByteBuffer;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
@ -35,7 +33,7 @@ public class StabilizedBearingMovementBehaviour implements MovementBehaviour {
@OnlyIn(Dist.CLIENT)
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
ContraptionMatrices matrices, MultiBufferSource buffer) {
if (FlwContraption.canInstance())
if (ContraptionRenderDispatcher.canInstance())
return;
Direction facing = context.state.getValue(BlockStateProperties.FACING);

View file

@ -123,7 +123,7 @@ public class ContraptionRenderDispatcher {
VirtualRenderWorld renderWorld = new VirtualRenderWorld(world, origin, height, minBuildHeight) {
@Override
public boolean supportsFlywheel() {
return Backend.getBackendType() == BackendType.INSTANCING;
return canInstance();
}
};
@ -204,4 +204,8 @@ public class ContraptionRenderDispatcher {
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.instancing.InstancingEngine;
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.WorldModel;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
@ -54,17 +53,13 @@ public class FlwContraption extends ContraptionRenderInfo {
var restoreState = GlStateTracker.getRestoreState();
buildLayers();
if (canInstance()) {
if (ContraptionRenderDispatcher.canInstance()) {
buildInstancedTiles();
buildActors();
}
restoreState.restore();
}
public static boolean canInstance() {
return Backend.getBackendType() == BackendType.INSTANCING;
}
public ContraptionLighter<?> getLighter() {
return lighter;
}
@ -186,7 +181,7 @@ public class FlwContraption extends ContraptionRenderInfo {
private final ContraptionInstanceManager tileInstanceManager;
public ContraptionInstanceWorld(FlwContraption parent) {
switch (Backend.getEngine()) {
switch (Backend.getBackendType()) {
case INSTANCING -> {
InstancingEngine<ContraptionProgram> engine = InstancingEngine.builder(CreateContexts.CWORLD)
.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.gl.GlStateTracker;
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.Materials;
import com.jozufozu.flywheel.core.compile.ProgramContext;
@ -43,12 +43,12 @@ public class FlwContraptionManager extends ContraptionRenderingWorld<FlwContrapt
GlStateTracker.State restoreState = GlStateTracker.getRestoreState();
GlTextureUnit active = GlTextureUnit.getActive();
var backendType = Backend.getEngine();
if (backendType != FlwEngine.OFF) {
var backendType = Backend.getBackendType();
if (backendType != BackendType.OFF) {
renderStructures(event);
}
if (backendType != FlwEngine.BATCHING && event.getLayer() != null) {
if (backendType != BackendType.BATCHING && event.getLayer() != null) {
for (FlwContraption renderer : visible) {
renderer.renderInstanceLayer(event);
}