mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-14 23:33:42 +01:00
Better config/backend to account for multiple engines
- Rename probably too many things - Needs to be tested with Optifine
This commit is contained in:
parent
97490e51ca
commit
748c25b3ec
38 changed files with 47 additions and 53 deletions
|
@ -38,7 +38,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
|
|||
@Override
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
for (RenderType type : RenderType.chunkBufferLayers())
|
||||
if (ItemBlockRenderTypes.canRenderInLayer(te.getBlockState(), type))
|
||||
|
|
|
@ -37,7 +37,7 @@ public class DrillMovementBehaviour extends BlockBreakingMovementBehaviour {
|
|||
@OnlyIn(value = Dist.CLIENT)
|
||||
public void renderInContraption(MovementContext context, PlacementSimulationWorld renderWorld,
|
||||
ContraptionMatrices matrices, MultiBufferSource buffer) {
|
||||
if (!Backend.getInstance().canUseInstancing())
|
||||
if (!Backend.isOn())
|
||||
DrillRenderer.renderInContraption(context, renderWorld, matrices, buffer);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,8 +58,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
|
|||
@Override
|
||||
public void renderInContraption(MovementContext context, PlacementSimulationWorld renderWorld,
|
||||
ContraptionMatrices matrices, MultiBufferSource buffers) {
|
||||
if (!Backend.getInstance()
|
||||
.canUseInstancing())
|
||||
if (!Backend.isOn())
|
||||
HarvesterRenderer.renderInContraption(context, renderWorld, matrices, buffers);
|
||||
}
|
||||
|
||||
|
|
|
@ -169,8 +169,7 @@ public class MechanicalCrafterRenderer extends SafeTileEntityRenderer<Mechanical
|
|||
BlockState blockState = te.getBlockState();
|
||||
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
|
||||
|
||||
if (!Backend.getInstance()
|
||||
.canUseInstancing(te.getLevel())) {
|
||||
if (!Backend.canUseInstancing(te.getLevel())) {
|
||||
SuperByteBuffer superBuffer = CachedBufferer.partial(AllBlockPartials.SHAFTLESS_COGWHEEL, blockState);
|
||||
standardKineticRotationTransform(superBuffer, te, light);
|
||||
superBuffer.rotateCentered(Direction.UP, (float) (blockState.getValue(HORIZONTAL_FACING)
|
||||
|
|
|
@ -28,7 +28,7 @@ public class HandCrankRenderer extends KineticTileEntityRenderer {
|
|||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
BlockState state = te.getBlockState();
|
||||
Block block = state.getBlock();
|
||||
|
|
|
@ -257,7 +257,7 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
|||
@Override
|
||||
public void renderInContraption(MovementContext context, PlacementSimulationWorld renderWorld,
|
||||
ContraptionMatrices matrices, MultiBufferSource buffers) {
|
||||
if (!Backend.getInstance().canUseInstancing())
|
||||
if (!Backend.isOn())
|
||||
DeployerRenderer.renderInContraption(context, renderWorld, matrices, buffers);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
|||
renderItem(te, partialTicks, ms, buffer, light, overlay);
|
||||
FilteringRenderer.renderOnTileEntity(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
renderComponents(te, partialTicks, ms, buffer, light, overlay);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
|||
protected void renderComponents(DeployerTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
|
||||
if (!Backend.getInstance().canUseInstancing(te.getLevel())) {
|
||||
if (!Backend.canUseInstancing(te.getLevel())) {
|
||||
KineticTileEntityRenderer.renderRotatingKineticBlock(te, getRenderedBlockState(te), ms, vb, light);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public class EncasedFanRenderer extends KineticTileEntityRenderer {
|
|||
@Override
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
Direction direction = te.getBlockState()
|
||||
.getValue(FACING);
|
||||
|
|
|
@ -36,7 +36,7 @@ public class FlywheelRenderer extends KineticTileEntityRenderer {
|
|||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
BlockState blockState = te.getBlockState();
|
||||
FlywheelTileEntity wte = (FlywheelTileEntity) te;
|
||||
|
|
|
@ -22,7 +22,7 @@ public class EngineRenderer<T extends EngineTileEntity> extends SafeTileEntityRe
|
|||
protected void renderSafe(T te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light,
|
||||
int overlay) {
|
||||
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
Block block = te.getBlockState()
|
||||
.getBlock();
|
||||
|
|
|
@ -31,7 +31,7 @@ public class MechanicalMixerRenderer extends KineticTileEntityRenderer {
|
|||
protected void renderSafe(KineticTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
BlockState blockState = te.getBlockState();
|
||||
MechanicalMixerTileEntity mixer = (MechanicalMixerTileEntity) te;
|
||||
|
|
|
@ -31,7 +31,7 @@ public class MechanicalPressRenderer extends KineticTileEntityRenderer {
|
|||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
BlockState blockState = te.getBlockState();
|
||||
float renderedHeadOffset = ((MechanicalPressTileEntity) te).getRenderedHeadOffset(partialTicks);
|
||||
|
|
|
@ -46,8 +46,7 @@ public class SawRenderer extends SafeTileEntityRenderer<SawTileEntity> {
|
|||
renderItems(te, partialTicks, ms, buffer, light, overlay);
|
||||
FilteringRenderer.renderOnTileEntity(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
if (Backend.getInstance()
|
||||
.canUseInstancing(te.getLevel()))
|
||||
if (Backend.canUseInstancing(te.getLevel()))
|
||||
return;
|
||||
|
||||
renderShaft(te, ms, buffer, light, overlay);
|
||||
|
|
|
@ -26,7 +26,7 @@ public class BearingRenderer extends KineticTileEntityRenderer {
|
|||
protected void renderSafe(KineticTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public class StabilizedBearingMovementBehaviour extends MovementBehaviour {
|
|||
@OnlyIn(Dist.CLIENT)
|
||||
public void renderInContraption(MovementContext context, PlacementSimulationWorld renderWorld,
|
||||
ContraptionMatrices matrices, MultiBufferSource buffer) {
|
||||
if (Backend.getInstance().canUseInstancing()) return;
|
||||
if (Backend.isOn()) return;
|
||||
|
||||
Direction facing = context.state.getValue(BlockStateProperties.FACING);
|
||||
PartialModel top = AllBlockPartials.BEARING_TOP;
|
||||
|
|
|
@ -25,7 +25,7 @@ public class StickerRenderer extends SafeTileEntityRenderer<StickerTileEntity> {
|
|||
protected void renderSafe(StickerTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
BlockState state = te.getBlockState();
|
||||
SuperByteBuffer head = CachedBufferer.partial(AllBlockPartials.STICKER_HEAD, state);
|
||||
|
|
|
@ -31,7 +31,7 @@ public class GantryCarriageRenderer extends KineticTileEntityRenderer {
|
|||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
BlockState state = te.getBlockState();
|
||||
Direction facing = state.getValue(GantryCarriageBlock.FACING);
|
||||
|
|
|
@ -44,8 +44,7 @@ public abstract class AbstractPulleyRenderer extends KineticTileEntityRenderer {
|
|||
protected void renderSafe(KineticTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
|
||||
if (Backend.getInstance()
|
||||
.canUseInstancing(te.getLevel()))
|
||||
if (Backend.canUseInstancing(te.getLevel()))
|
||||
return;
|
||||
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
|
|
@ -178,7 +178,7 @@ public class ContraptionRenderDispatcher {
|
|||
public static void reset() {
|
||||
WORLDS.empty(ContraptionRenderManager::delete);
|
||||
|
||||
if (Backend.getInstance().available()) {
|
||||
if (Backend.isOn()) {
|
||||
WORLDS = new WorldAttached<>(FlwContraptionManager::new);
|
||||
} else {
|
||||
WORLDS = new WorldAttached<>(SBBContraptionManager::new);
|
||||
|
|
|
@ -58,7 +58,7 @@ public class FlwContraptionManager extends ContraptionRenderManager<RenderedCont
|
|||
|
||||
GlVertexArray.unbind();
|
||||
|
||||
if (Backend.getInstance().canUseInstancing()) {
|
||||
if (Backend.isOn()) {
|
||||
RenderLayer renderLayer = event.getLayer();
|
||||
if (renderLayer != null) {
|
||||
for (RenderedContraption renderer : visible) {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class RenderedContraption extends ContraptionRenderInfo {
|
|||
this.engine.addListener(this.kinetics);
|
||||
|
||||
buildLayers();
|
||||
if (Backend.getInstance().canUseInstancing()) {
|
||||
if (Backend.isOn()) {
|
||||
buildInstancedTiles();
|
||||
buildActors();
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class FluidValveRenderer extends KineticTileEntityRenderer {
|
|||
protected void renderSafe(KineticTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
BlockState blockState = te.getBlockState();
|
||||
|
|
|
@ -31,7 +31,7 @@ public class SpeedControllerRenderer extends SmartTileEntityRenderer<SpeedContro
|
|||
super.renderSafe(tileEntityIn, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
VertexConsumer builder = buffer.getBuffer(RenderType.solid());
|
||||
if (!Backend.getInstance().canUseInstancing(tileEntityIn.getLevel())) {
|
||||
if (!Backend.canUseInstancing(tileEntityIn.getLevel())) {
|
||||
KineticTileEntityRenderer.renderRotatingBuffer(tileEntityIn, getRotatedModel(tileEntityIn), ms, builder, light);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
|||
protected void renderSafe(BeltTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
|
||||
if (!Backend.getInstance().canUseInstancing(te.getLevel())) {
|
||||
if (!Backend.canUseInstancing(te.getLevel())) {
|
||||
|
||||
BlockState blockState = te.getBlockState();
|
||||
if (!AllBlocks.BELT.has(blockState)) return;
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.relays.elementary;
|
|||
|
||||
import com.jozufozu.flywheel.api.Instancer;
|
||||
import com.jozufozu.flywheel.api.MaterialManager;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
|
@ -59,7 +59,8 @@ public class BracketedKineticTileInstance extends SingleRotatingInstance {
|
|||
private PoseStack rotateToAxis(Axis axis) {
|
||||
Direction facing = Direction.fromAxisAndDirection(axis, AxisDirection.POSITIVE);
|
||||
PoseStack poseStack = new PoseStack();
|
||||
new MatrixTransformStack(poseStack).centre()
|
||||
TransformStack.cast(poseStack)
|
||||
.centre()
|
||||
.rotateToFace(facing)
|
||||
.multiply(Vector3f.XN.rotationDegrees(-90))
|
||||
.unCentre();
|
||||
|
|
|
@ -28,8 +28,7 @@ public class BracketedKineticTileRenderer extends KineticTileEntityRenderer {
|
|||
protected void renderSafe(KineticTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
|
||||
if (Backend.getInstance()
|
||||
.canUseInstancing(te.getLevel()))
|
||||
if (Backend.canUseInstancing(te.getLevel()))
|
||||
return;
|
||||
|
||||
if (!AllBlocks.LARGE_COGWHEEL.has(te.getBlockState())) {
|
||||
|
|
|
@ -39,8 +39,7 @@ public class EncasedCogRenderer extends KineticTileEntityRenderer {
|
|||
protected void renderSafe(KineticTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
if (Backend.getInstance()
|
||||
.canUseInstancing(te.getLevel()))
|
||||
if (Backend.canUseInstancing(te.getLevel()))
|
||||
return;
|
||||
|
||||
BlockState blockState = te.getBlockState();
|
||||
|
|
|
@ -28,7 +28,7 @@ public class SplitShaftRenderer extends KineticTileEntityRenderer {
|
|||
@Override
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
Block block = te.getBlockState().getBlock();
|
||||
final Axis boxAxis = ((IRotate) block).getRotationAxis(te.getBlockState());
|
||||
|
|
|
@ -39,7 +39,7 @@ public class GaugeRenderer extends KineticTileEntityRenderer {
|
|||
@Override
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public class GearboxRenderer extends KineticTileEntityRenderer {
|
|||
@Override
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
final Axis boxAxis = te.getBlockState().getValue(BlockStateProperties.AXIS);
|
||||
final BlockPos pos = te.getBlockPos();
|
||||
|
|
|
@ -31,7 +31,7 @@ public class BeltTunnelRenderer extends SmartTileEntityRenderer<BeltTunnelTileEn
|
|||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
SuperByteBuffer flapBuffer = CachedBufferer.partial(AllBlockPartials.BELT_TUNNEL_FLAP, te.getBlockState());
|
||||
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
|
||||
|
|
|
@ -47,7 +47,7 @@ public class EjectorRenderer extends KineticTileEntityRenderer {
|
|||
float lidProgress = ((EjectorTileEntity) te).getLidProgress(partialTicks);
|
||||
float angle = lidProgress * 70;
|
||||
|
||||
if (!Backend.getInstance().canUseInstancing(te.getLevel())) {
|
||||
if (!Backend.canUseInstancing(te.getLevel())) {
|
||||
SuperByteBuffer model = CachedBufferer.partial(AllBlockPartials.EJECTOR_TOP, te.getBlockState());
|
||||
applyLidAngle(te, angle, model);
|
||||
model.light(light)
|
||||
|
|
|
@ -30,7 +30,7 @@ public class FunnelRenderer extends SmartTileEntityRenderer<FunnelTileEntity> {
|
|||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
if (!te.hasFlap() || Backend.getInstance().canUseInstancing(te.getLevel()))
|
||||
if (!te.hasFlap() || Backend.canUseInstancing(te.getLevel()))
|
||||
return;
|
||||
|
||||
BlockState blockState = te.getBlockState();
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ArmRenderer extends KineticTileEntityRenderer {
|
|||
ArmTileEntity arm = (ArmTileEntity) te;
|
||||
ItemStack item = arm.heldItem;
|
||||
boolean hasItem = !item.isEmpty();
|
||||
boolean usingFlywheel = Backend.getInstance().canUseInstancing(te.getLevel());
|
||||
boolean usingFlywheel = Backend.canUseInstancing(te.getLevel());
|
||||
|
||||
if (usingFlywheel && !hasItem) return;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public class AnalogLeverRenderer extends SafeTileEntityRenderer<AnalogLeverTileE
|
|||
protected void renderSafe(AnalogLeverTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
BlockState leverState = te.getBlockState();
|
||||
float state = te.clientState.get(partialTicks);
|
||||
|
|
|
@ -43,8 +43,7 @@ public class SchematicannonRenderer extends SafeTileEntityRenderer<Schematicanno
|
|||
if (blocksLaunching)
|
||||
renderLaunchedBlocks(tileEntity, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
if (Backend.getInstance()
|
||||
.canUseInstancing(tileEntity.getLevel()))
|
||||
if (Backend.canUseInstancing(tileEntity.getLevel()))
|
||||
return;
|
||||
|
||||
BlockPos pos = tileEntity.getBlockPos();
|
||||
|
|
|
@ -48,7 +48,7 @@ public class TileEntityRenderHelper {
|
|||
Iterator<BlockEntity> iterator = customRenderTEs.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BlockEntity tileEntity = iterator.next();
|
||||
if (Backend.getInstance().canUseInstancing(renderWorld) && InstancedRenderRegistry.getInstance()
|
||||
if (Backend.canUseInstancing(renderWorld) && InstancedRenderRegistry.getInstance()
|
||||
.shouldSkipRender(tileEntity)) continue;
|
||||
|
||||
BlockEntityRenderer<BlockEntity> renderer = Minecraft.getInstance().getBlockEntityRenderDispatcher().getRenderer(tileEntity);
|
||||
|
|
|
@ -18,7 +18,7 @@ public abstract class ColoredOverlayTileEntityRenderer<T extends BlockEntity> ex
|
|||
protected void renderSafe(T te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.canUseInstancing(te.getLevel())) return;
|
||||
|
||||
SuperByteBuffer render = render(getOverlayBuffer(te), getColor(te, partialTicks), light);
|
||||
render.renderInto(ms, buffer.getBuffer(RenderType.solid()));
|
||||
|
|
Loading…
Reference in a new issue