Merge branch 'mc1.18/global-railways' of https://github.com/Creators-of-Create/Create-Concealed into mc1.18/global-railways

This commit is contained in:
simibubi 2022-06-20 21:49:36 +02:00
commit 08c67cc4bc
48 changed files with 104 additions and 110 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.7.0.67
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

@ -16,7 +16,7 @@ public class HalfShaftInstance extends SingleRotatingInstance {
@Override
protected Instancer<RotatingData> getModel() {
Direction dir = getShaftDirection();
return getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, dir);
return getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, blockState, dir);
}
protected Direction getShaftDirection() {

View file

@ -39,14 +39,14 @@ public class DrillActorInstance extends ActorInstance {
else
eulerY = facing.toYRot() + ((axis == Direction.Axis.X) ? 180 : 0);
drillHead = material.getModel(AllBlockPartials.DRILL_HEAD)
.createInstance()
.setPosition(context.localPos)
.setBlockLight(localBlockLight())
.setRotationOffset(0)
.setRotationAxis(0, 0, 1)
.setLocalRotation(new Quaternion(eulerX, eulerY, 0, true))
.setSpeed(getSpeed(facing));
drillHead = material.getModel(AllBlockPartials.DRILL_HEAD, state).createInstance();
drillHead.setPosition(context.localPos)
.setBlockLight(localBlockLight())
.setRotationOffset(0)
.setRotationAxis(0, 0, 1)
.setLocalRotation(new Quaternion(eulerX, eulerY, 0, true))
.setSpeed(getSpeed(facing));
}
@Override

View file

@ -21,6 +21,6 @@ public class DrillInstance extends SingleRotatingInstance {
protected Instancer<RotatingData> getModel() {
BlockState referenceState = blockEntity.getBlockState();
Direction facing = referenceState.getValue(BlockStateProperties.FACING);
return getRotatingMaterial().getModel(AllBlockPartials.DRILL_HEAD, facing);
return getRotatingMaterial().getModel(AllBlockPartials.DRILL_HEAD, referenceState, facing);
}
}

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

@ -3,7 +3,6 @@ package com.simibubi.create.content.contraptions.components.actors;
import com.jozufozu.flywheel.api.Material;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.core.Materials;
import com.jozufozu.flywheel.core.Models;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
import com.simibubi.create.AllBlockPartials;
@ -42,8 +41,7 @@ public class HarvesterActorInstance extends ActorInstance {
facing = state.getValue(BlockStateProperties.HORIZONTAL_FACING);
harvester = material.model(Models.partial(AllBlockPartials.HARVESTER_BLADE))
.createInstance();
harvester = material.getModel(AllBlockPartials.HARVESTER_BLADE, state).createInstance();
horizontalAngle = facing.toYRot() + ((facing.getAxis() == Direction.Axis.X) ? 180 : 0);

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

@ -33,11 +33,11 @@ public class PIInstance {
this.lit = lit;
middle = materialManager.defaultSolid()
.material(Materials.TRANSFORMED)
.getModel(PortableStorageInterfaceRenderer.getMiddleForState(blockState, lit))
.getModel(PortableStorageInterfaceRenderer.getMiddleForState(blockState, lit), blockState)
.createInstance();
top = materialManager.defaultSolid()
.material(Materials.TRANSFORMED)
.getModel(PortableStorageInterfaceRenderer.getTopForState(blockState))
.getModel(PortableStorageInterfaceRenderer.getTopForState(blockState), blockState)
.createInstance();
}
@ -66,7 +66,7 @@ public class PIInstance {
this.lit = lit;
materialManager.defaultSolid()
.material(Materials.TRANSFORMED)
.getModel(PortableStorageInterfaceRenderer.getMiddleForState(blockState, lit))
.getModel(PortableStorageInterfaceRenderer.getMiddleForState(blockState, lit), blockState)
.stealInstance(middle);
}
}

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

@ -23,7 +23,7 @@ public class MechanicalCrafterInstance extends SingleRotatingInstance {
protected Instancer<RotatingData> getModel() {
Direction facing = blockState.getValue(MechanicalCrafterBlock.HORIZONTAL_FACING);
return getRotatingMaterial().getModel(AllBlockPartials.SHAFTLESS_COGWHEEL, facing, rotateToFace(facing));
return getRotatingMaterial().getModel(AllBlockPartials.SHAFTLESS_COGWHEEL, blockState, facing, rotateToFace(facing));
}
private Supplier<PoseStack> rotateToFace(Direction facing) {

View file

@ -31,7 +31,7 @@ public class HandCrankInstance extends SingleRotatingInstance implements Dynamic
facing = blockState.getValue(BlockStateProperties.FACING);
Direction opposite = facing.getOpposite();
Instancer<ModelData> model = getTransformMaterial().getModel(renderedHandle, opposite);
Instancer<ModelData> model = getTransformMaterial().getModel(renderedHandle, blockState, opposite);
crank = model.createInstance();
rotateCrank();

View file

@ -61,8 +61,8 @@ public class DeployerActorInstance extends ActorInstance {
xRot = facing == Direction.UP ? 270 : facing == Direction.DOWN ? 90 : 0;
zRot = rotatePole ? 90 : 0;
pole = mat.getModel(AllBlockPartials.DEPLOYER_POLE).createInstance();
hand = mat.getModel(handPose).createInstance();
pole = mat.getModel(AllBlockPartials.DEPLOYER_POLE, state).createInstance();
hand = mat.getModel(handPose, state).createInstance();
Direction.Axis axis = ((IRotate) state.getBlock()).getRotationAxis(state);
shaft = materialManager.defaultSolid()

View file

@ -47,11 +47,11 @@ public class DeployerInstance extends ShaftInstance implements DynamicInstance,
xRot = facing == Direction.UP ? 270 : facing == Direction.DOWN ? 90 : 0;
zRot = rotatePole ? 90 : 0;
pole = getOrientedMaterial().getModel(AllBlockPartials.DEPLOYER_POLE).createInstance();
pole = getOrientedMaterial().getModel(AllBlockPartials.DEPLOYER_POLE, blockState).createInstance();
currentHand = this.tile.getHandPose();
hand = getOrientedMaterial().getModel(currentHand).createInstance();
hand = getOrientedMaterial().getModel(currentHand, blockState).createInstance();
progress = getProgress(AnimationTickHolder.getPartialTicks());
updateRotation(pole, hand, yRot, xRot, zRot);
@ -64,7 +64,7 @@ public class DeployerInstance extends ShaftInstance implements DynamicInstance,
if (currentHand != handPose) {
currentHand = handPose;
getOrientedMaterial().getModel(currentHand)
getOrientedMaterial().getModel(currentHand, blockState)
.stealInstance(hand);
}
}

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

@ -25,10 +25,10 @@ public class FanInstance extends KineticTileInstance<EncasedFanTileEntity> {
direction = blockState.getValue(FACING);
opposite = direction.getOpposite();
shaft = getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, opposite).createInstance();
shaft = getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, blockState, opposite).createInstance();
fan = modelManager.defaultCutout()
.material(AllMaterialSpecs.ROTATING)
.getModel(AllBlockPartials.ENCASED_FAN_INNER, opposite)
.getModel(AllBlockPartials.ENCASED_FAN_INNER, blockState, opposite)
.createInstance();
setup(shaft);

View file

@ -5,6 +5,7 @@ import com.jozufozu.flywheel.api.instance.DynamicInstance;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.contraptions.base.KineticTileInstance;
import com.simibubi.create.content.contraptions.base.flwdata.RotatingData;
import com.simibubi.create.foundation.utility.AngleHelper;

View file

@ -15,6 +15,6 @@ public class MillStoneCogInstance extends SingleRotatingInstance {
@Override
protected Instancer<RotatingData> getModel() {
return getRotatingMaterial().getModel(AllBlockPartials.MILLSTONE_COG);
return getRotatingMaterial().getModel(AllBlockPartials.MILLSTONE_COG, blockEntity.getBlockState());
}
}

View file

@ -22,13 +22,13 @@ public class MixerInstance extends EncasedCogInstance implements DynamicInstance
super(dispatcher, tile, false);
this.mixer = tile;
mixerHead = getRotatingMaterial().getModel(AllBlockPartials.MECHANICAL_MIXER_HEAD)
mixerHead = getRotatingMaterial().getModel(AllBlockPartials.MECHANICAL_MIXER_HEAD, blockState)
.createInstance();
mixerHead.setRotationAxis(Direction.Axis.Y);
mixerPole = getOrientedMaterial()
.getModel(AllBlockPartials.MECHANICAL_MIXER_POLE)
.getModel(AllBlockPartials.MECHANICAL_MIXER_POLE, blockState)
.createInstance();
@ -42,7 +42,7 @@ public class MixerInstance extends EncasedCogInstance implements DynamicInstance
protected Instancer<RotatingData> getCogModel() {
return materialManager.defaultSolid()
.material(AllMaterialSpecs.ROTATING)
.getModel(AllBlockPartials.SHAFTLESS_COGWHEEL);
.getModel(AllBlockPartials.SHAFTLESS_COGWHEEL, blockEntity.getBlockState());
}
@Override

View file

@ -21,9 +21,9 @@ public class PressInstance extends ShaftInstance implements DynamicInstance {
press = tile;
pressHead = dispatcher.defaultSolid()
.material(Materials.ORIENTED)
.getModel(AllBlockPartials.MECHANICAL_PRESS_HEAD)
.createInstance();
.material(Materials.ORIENTED)
.getModel(AllBlockPartials.MECHANICAL_PRESS_HEAD, blockState)
.createInstance();
Quaternion q = Vector3f.YP
.rotationDegrees(AngleHelper.horizontalAngle(blockState.getValue(MechanicalPressBlock.HORIZONTAL_FACING)));

View file

@ -25,7 +25,7 @@ public class SawInstance extends SingleRotatingInstance {
.isHorizontal()) {
BlockState referenceState = blockState.rotate(blockEntity.getLevel(), blockEntity.getBlockPos(), Rotation.CLOCKWISE_180);
Direction facing = referenceState.getValue(BlockStateProperties.FACING);
return getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, facing);
return getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, referenceState, facing);
} else {
return getRotatingMaterial().getModel(shaft());
}

View file

@ -35,7 +35,7 @@ public class BearingInstance<B extends KineticTileEntity & IBearingTileEntity> e
PartialModel top =
bearing.isWoodenTop() ? AllBlockPartials.BEARING_TOP_WOODEN : AllBlockPartials.BEARING_TOP;
topInstance = getOrientedMaterial().getModel(top).createInstance();
topInstance = getOrientedMaterial().getModel(top, blockState).createInstance();
topInstance.setPosition(getInstancePosition()).setRotation(blockOrientation);
}

View file

@ -38,7 +38,7 @@ public class StabilizedBearingInstance extends ActorInstance {
topInstance = materialManager.defaultSolid()
.material(Materials.ORIENTED)
.getModel(AllBlockPartials.BEARING_TOP)
.getModel(AllBlockPartials.BEARING_TOP, blockState)
.createInstance();
int blockLight = localBlockLight();
@ -48,7 +48,7 @@ public class StabilizedBearingInstance extends ActorInstance {
shaft = materialManager.defaultSolid()
.material(AllMaterialSpecs.ROTATING)
.getModel(AllBlockPartials.SHAFT_HALF, blockState.getValue(BlockStateProperties.FACING).getOpposite())
.getModel(AllBlockPartials.SHAFT_HALF, blockState, blockState.getValue(BlockStateProperties.FACING).getOpposite())
.createInstance();
// not rotating so no need to set speed, axis, etc.

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

@ -17,20 +17,20 @@ public class StickerInstance extends BlockEntityInstance<StickerTileEntity> impl
float lastOffset = Float.NaN;
final Direction facing;
final boolean fakeWorld;
final int extended;
final int offset;
private final ModelData head;
public StickerInstance(MaterialManager modelManager, StickerTileEntity tile) {
super(modelManager, tile);
head = getTransformMaterial().getModel(AllBlockPartials.STICKER_HEAD).createInstance();
head = getTransformMaterial().getModel(AllBlockPartials.STICKER_HEAD, blockState).createInstance();
fakeWorld = tile.getLevel() != Minecraft.getInstance().level;
facing = blockState.getValue(StickerBlock.FACING);
extended = blockState.getValue(StickerBlock.EXTENDED) ? 1 : 0;
offset = blockState.getValue(StickerBlock.EXTENDED) ? 1 : 0;
animateHead(extended);
animateHead(offset);
}
@Override
@ -38,7 +38,7 @@ public class StickerInstance extends BlockEntityInstance<StickerTileEntity> impl
float offset = blockEntity.piston.getValue(AnimationTickHolder.getPartialTicks());
if (fakeWorld)
offset = this.extended;
offset = this.offset;
if (Mth.equal(offset, lastOffset))
return;

View file

@ -30,7 +30,7 @@ public class GantryCarriageInstance extends ShaftInstance implements DynamicInst
super(dispatcher, tile);
gantryCogs = getTransformMaterial()
.getModel(AllBlockPartials.GANTRY_COGS)
.getModel(AllBlockPartials.GANTRY_COGS, blockState)
.createInstance();
facing = blockState.getValue(GantryCarriageBlock.FACING);

View file

@ -15,27 +15,27 @@ public class HosePulleyInstance extends AbstractPulleyInstance {
}
protected Instancer<OrientedData> getRopeModel() {
return getOrientedMaterial().getModel(AllBlockPartials.HOSE);
return getOrientedMaterial().getModel(AllBlockPartials.HOSE, blockState);
}
protected Instancer<OrientedData> getMagnetModel() {
return materialManager.defaultCutout()
.material(Materials.ORIENTED)
.getModel(AllBlockPartials.HOSE_MAGNET);
.getModel(AllBlockPartials.HOSE_MAGNET, blockState);
}
protected Instancer<OrientedData> getHalfMagnetModel() {
return materialManager.defaultCutout()
.material(Materials.ORIENTED)
.getModel(AllBlockPartials.HOSE_HALF_MAGNET);
.getModel(AllBlockPartials.HOSE_HALF_MAGNET, blockState);
}
protected Instancer<OrientedData> getCoilModel() {
return getOrientedMaterial().getModel(AllBlockPartials.HOSE_COIL, rotatingAbout);
return getOrientedMaterial().getModel(AllBlockPartials.HOSE_COIL, blockState, rotatingAbout);
}
protected Instancer<OrientedData> getHalfRopeModel() {
return getOrientedMaterial().getModel(AllBlockPartials.HOSE_HALF);
return getOrientedMaterial().getModel(AllBlockPartials.HOSE_HALF, blockState);
}
protected float getOffset() {

View file

@ -22,15 +22,15 @@ public class RopePulleyInstance extends AbstractPulleyInstance {
}
protected Instancer<OrientedData> getHalfMagnetModel() {
return getOrientedMaterial().getModel(AllBlockPartials.ROPE_HALF_MAGNET);
return getOrientedMaterial().getModel(AllBlockPartials.ROPE_HALF_MAGNET, blockState);
}
protected Instancer<OrientedData> getCoilModel() {
return getOrientedMaterial().getModel(AllBlockPartials.ROPE_COIL, rotatingAbout);
return getOrientedMaterial().getModel(AllBlockPartials.ROPE_COIL, blockState, rotatingAbout);
}
protected Instancer<OrientedData> getHalfRopeModel() {
return getOrientedMaterial().getModel(AllBlockPartials.ROPE_HALF);
return getOrientedMaterial().getModel(AllBlockPartials.ROPE_HALF, blockState);
}
protected float getOffset() {

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;
}

View file

@ -4,7 +4,7 @@ import static org.lwjgl.opengl.GL11.glBindTexture;
import static org.lwjgl.opengl.GL12.GL_TEXTURE_3D;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.api.RenderLayer;
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.BackendType;

View file

@ -32,7 +32,7 @@ public class PumpCogInstance extends SingleRotatingInstance implements DynamicIn
materialManager.defaultSolid()
.material(Materials.TRANSFORMED)
.getModel(AllBlockPartials.MECHANICAL_PUMP_ARROW)
.getModel(AllBlockPartials.MECHANICAL_PUMP_ARROW, blockState)
.createInstances(arrows);
}
@ -63,7 +63,7 @@ public class PumpCogInstance extends SingleRotatingInstance implements DynamicIn
protected Instancer<RotatingData> getModel() {
BlockState referenceState = blockEntity.getBlockState();
Direction facing = referenceState.getValue(BlockStateProperties.FACING);
return getRotatingMaterial().getModel(AllBlockPartials.MECHANICAL_PUMP_COG, facing);
return getRotatingMaterial().getModel(AllBlockPartials.MECHANICAL_PUMP_COG, referenceState, facing);
}
@Override

View file

@ -40,7 +40,7 @@ public class FluidValveInstance extends ShaftInstance implements DynamicInstance
pointer = materialManager.defaultSolid()
.material(Materials.TRANSFORMED)
.getModel(AllBlockPartials.FLUID_VALVE_POINTER).createInstance();
.getModel(AllBlockPartials.FLUID_VALVE_POINTER, blockState).createInstance();
transformPointer();
}

View file

@ -62,9 +62,9 @@ public class BeltInstance extends KineticTileInstance<BeltTileEntity> {
PartialModel beltPartial = BeltRenderer.getBeltPartial(diagonal, start, end, bottom);
SpriteShiftEntry spriteShift = BeltRenderer.getSpriteShiftEntry(color, diagonal, bottom);
Instancer<BeltData> beltModel = materialManager.defaultSolid()
.material(AllMaterialSpecs.BELTS)
.getModel(beltPartial);
Instancer<BeltData> beltModel = materialManager.defaultSolid()
.material(AllMaterialSpecs.BELTS)
.getModel(beltPartial, blockState);
keys.add(setup(beltModel.createInstance(), bottom, spriteShift));
@ -143,7 +143,7 @@ public class BeltInstance extends KineticTileInstance<BeltTileEntity> {
return modelTransform;
};
return getRotatingMaterial().getModel(AllBlockPartials.BELT_PULLEY, dir, ms);
return getRotatingMaterial().getModel(AllBlockPartials.BELT_PULLEY, blockState, dir, ms);
}
private Direction getOrientation() {

View file

@ -38,7 +38,8 @@ public class BracketedKineticTileInstance extends SingleRotatingInstance {
BlockPos pos = blockEntity.getBlockPos();
float offset = BracketedKineticTileRenderer.getShaftAngleOffset(axis, pos);
Direction facing = Direction.fromAxisAndDirection(axis, AxisDirection.POSITIVE);
Instancer<RotatingData> half = getRotatingMaterial().getModel(AllBlockPartials.COGWHEEL_SHAFT, facing, () -> this.rotateToAxis(axis));
Instancer<RotatingData> half = getRotatingMaterial().getModel(AllBlockPartials.COGWHEEL_SHAFT, blockState,
facing, () -> this.rotateToAxis(axis));
additionalShaft = setup(half.createInstance(), speed);
additionalShaft.setRotationOffset(offset);
@ -51,7 +52,7 @@ public class BracketedKineticTileInstance extends SingleRotatingInstance {
Axis axis = KineticTileEntityRenderer.getRotationAxisOf(blockEntity);
Direction facing = Direction.fromAxisAndDirection(axis, AxisDirection.POSITIVE);
return getRotatingMaterial().getModel(AllBlockPartials.SHAFTLESS_LARGE_COGWHEEL, facing,
return getRotatingMaterial().getModel(AllBlockPartials.SHAFTLESS_LARGE_COGWHEEL, blockState, facing,
() -> this.rotateToAxis(axis));
}

View file

@ -58,7 +58,7 @@ public class EncasedCogInstance extends KineticTileInstance<KineticTileEntity> {
for (Direction d : Iterate.directionsInAxis(axis)) {
if (!def.hasShaftTowards(blockEntity.getLevel(), blockEntity.getBlockPos(), blockState, d))
continue;
RotatingData data = setup(getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, d)
RotatingData data = setup(getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, blockState, d)
.createInstance());
if (d.getAxisDirection() == AxisDirection.POSITIVE)
rotatingTopShaft = Optional.of(data);
@ -94,7 +94,7 @@ public class EncasedCogInstance extends KineticTileInstance<KineticTileEntity> {
Direction.fromAxisAndDirection(referenceState.getValue(BlockStateProperties.AXIS), AxisDirection.POSITIVE);
PartialModel partial = large ? AllBlockPartials.SHAFTLESS_LARGE_COGWHEEL : AllBlockPartials.SHAFTLESS_COGWHEEL;
return getRotatingMaterial().getModel(partial, facing, () -> {
return getRotatingMaterial().getModel(partial, referenceState, facing, () -> {
PoseStack poseStack = new PoseStack();
TransformStack.cast(poseStack)
.centre()

View file

@ -30,7 +30,7 @@ public class SplitShaftInstance extends KineticTileInstance<SplitShaftTileEntity
for (Direction dir : Iterate.directionsInAxis(getRotationAxis())) {
Instancer<RotatingData> half = rotatingMaterial.getModel(AllBlockPartials.SHAFT_HALF, dir);
Instancer<RotatingData> half = rotatingMaterial.getModel(AllBlockPartials.SHAFT_HALF, blockState, dir);
float splitSpeed = speed * tile.getRotationSpeedModifier(dir);

View file

@ -32,7 +32,7 @@ public abstract class GaugeInstance extends ShaftInstance implements DynamicInst
GaugeTileEntity gaugeTile = (GaugeTileEntity) tile;
GaugeBlock gaugeBlock = (GaugeBlock) blockState.getBlock();
Instancer<ModelData> dialModel = getTransformMaterial().getModel(AllBlockPartials.GAUGE_DIAL);
Instancer<ModelData> dialModel = getTransformMaterial().getModel(AllBlockPartials.GAUGE_DIAL, blockState);
Instancer<ModelData> headModel = getHeadModel();
ms = new PoseStack();
@ -150,7 +150,7 @@ public abstract class GaugeInstance extends ShaftInstance implements DynamicInst
@Override
protected Instancer<ModelData> getHeadModel() {
return getTransformMaterial().getModel(AllBlockPartials.GAUGE_HEAD_SPEED);
return getTransformMaterial().getModel(AllBlockPartials.GAUGE_HEAD_SPEED, blockState);
}
}
@ -161,7 +161,7 @@ public abstract class GaugeInstance extends ShaftInstance implements DynamicInst
@Override
protected Instancer<ModelData> getHeadModel() {
return getTransformMaterial().getModel(AllBlockPartials.GAUGE_HEAD_STRESS);
return getTransformMaterial().getModel(AllBlockPartials.GAUGE_HEAD_STRESS, blockState);
}
}
}

View file

@ -40,7 +40,7 @@ public class GearboxInstance extends KineticTileInstance<GearboxTileEntity> {
if (boxAxis == axis)
continue;
Instancer<RotatingData> shaft = rotatingMaterial.getModel(AllBlockPartials.SHAFT_HALF, direction);
Instancer<RotatingData> shaft = rotatingMaterial.getModel(AllBlockPartials.SHAFT_HALF, blockState, direction);
RotatingData key = shaft.createInstance();

View file

@ -15,7 +15,7 @@ public class CopperBacktankInstance extends SingleRotatingInstance {
@Override
protected Instancer<RotatingData> getModel() {
return getRotatingMaterial().getModel(AllBlockPartials.COPPER_BACKTANK_SHAFT);
return getRotatingMaterial().getModel(AllBlockPartials.COPPER_BACKTANK_SHAFT, blockState);
}
}

View file

@ -32,12 +32,12 @@ public class ToolBoxInstance extends BlockEntityInstance<ToolboxTileEntity> impl
Instancer<ModelData> drawerModel = materialManager.defaultSolid()
.material(Materials.TRANSFORMED)
.getModel(AllBlockPartials.TOOLBOX_DRAWER);
.getModel(AllBlockPartials.TOOLBOX_DRAWER, blockState);
drawers = new ModelData[]{drawerModel.createInstance(), drawerModel.createInstance()};
lid = materialManager.defaultCutout()
.material(Materials.TRANSFORMED)
.getModel(AllBlockPartials.TOOLBOX_LIDS.get(blockEntity.getColor()))
.getModel(AllBlockPartials.TOOLBOX_LIDS.get(blockEntity.getColor()), blockState)
.createInstance();
}

View file

@ -29,8 +29,8 @@ public class BeltTunnelInstance extends BlockEntityInstance<BeltTunnelTileEntity
tunnelFlaps = new EnumMap<>(Direction.class);
Instancer<FlapData> model = modelManager.defaultSolid()
.material(AllMaterialSpecs.FLAPS)
.getModel(AllBlockPartials.BELT_TUNNEL_FLAP);
.material(AllMaterialSpecs.FLAPS)
.getModel(AllBlockPartials.BELT_TUNNEL_FLAP, blockState);
int blockLight = world.getBrightness(LightLayer.BLOCK, pos);
int skyLight = world.getBrightness(LightLayer.SKY, pos);

View file

@ -21,7 +21,7 @@ public class EjectorInstance extends ShaftInstance implements DynamicInstance {
super(dispatcher, tile);
this.tile = tile;
plate = getTransformMaterial().getModel(AllBlockPartials.EJECTOR_TOP).createInstance();
plate = getTransformMaterial().getModel(AllBlockPartials.EJECTOR_TOP, blockState).createInstance();
pivotPlate();
}

View file

@ -19,7 +19,7 @@ public class BrassDiodeInstance extends BlockEntityInstance<BrassDiodeTileEntity
indicator = modelManager.defaultSolid()
.material(Materials.TRANSFORMED)
.getModel(AllBlockPartials.FLEXPEATER_INDICATOR).createInstance();
.getModel(AllBlockPartials.FLEXPEATER_INDICATOR, blockState).createInstance();
indicator.loadIdentity()
.translate(getInstancePosition())

View file

@ -30,8 +30,8 @@ public class FunnelInstance extends BlockEntityInstance<FunnelTileEntity> implem
PartialModel flapPartial = (blockState.getBlock() instanceof FunnelBlock ? AllBlockPartials.FUNNEL_FLAP
: AllBlockPartials.BELT_FUNNEL_FLAP);
Instancer<FlapData> model = modelManager.defaultSolid()
.material(AllMaterialSpecs.FLAPS)
.getModel(flapPartial);
.material(AllMaterialSpecs.FLAPS)
.getModel(flapPartial, blockState);
int blockLight = world.getBrightness(LightLayer.BLOCK, pos);
int skyLight = world.getBrightness(LightLayer.SKY, pos);

View file

@ -49,13 +49,13 @@ public class ArmInstance extends SingleRotatingInstance implements DynamicInstan
Material<ModelData> mat = getTransformMaterial();
base = mat.getModel(AllBlockPartials.ARM_BASE).createInstance();
lowerBody = mat.getModel(AllBlockPartials.ARM_LOWER_BODY).createInstance();
upperBody = mat.getModel(AllBlockPartials.ARM_UPPER_BODY).createInstance();
head = mat.getModel(AllBlockPartials.ARM_HEAD).createInstance();
claw = mat.getModel(AllBlockPartials.ARM_CLAW_BASE).createInstance();
base = mat.getModel(AllBlockPartials.ARM_BASE, blockState).createInstance();
lowerBody = mat.getModel(AllBlockPartials.ARM_LOWER_BODY, blockState).createInstance();
upperBody = mat.getModel(AllBlockPartials.ARM_UPPER_BODY, blockState).createInstance();
head = mat.getModel(AllBlockPartials.ARM_HEAD, blockState).createInstance();
claw = mat.getModel(AllBlockPartials.ARM_CLAW_BASE, blockState).createInstance();
Instancer<ModelData> clawHalfModel = mat.getModel(AllBlockPartials.ARM_CLAW_GRIP);
Instancer<ModelData> clawHalfModel = mat.getModel(AllBlockPartials.ARM_CLAW_GRIP, blockState);
ModelData clawGrip1 = clawHalfModel.createInstance();
ModelData clawGrip2 = clawHalfModel.createInstance();
@ -172,7 +172,7 @@ public class ArmInstance extends SingleRotatingInstance implements DynamicInstan
@Override
protected Instancer<RotatingData> getModel() {
return getRotatingMaterial().getModel(AllBlockPartials.ARM_COG);
return getRotatingMaterial().getModel(AllBlockPartials.ARM_COG, blockEntity.getBlockState());
}
@Override

View file

@ -28,8 +28,8 @@ public class AnalogLeverInstance extends BlockEntityInstance<AnalogLeverTileEnti
Material<ModelData> mat = getTransformMaterial();
handle = mat.getModel(AllBlockPartials.ANALOG_LEVER_HANDLE).createInstance();
indicator = mat.getModel(AllBlockPartials.ANALOG_LEVER_INDICATOR).createInstance();
handle = mat.getModel(AllBlockPartials.ANALOG_LEVER_HANDLE, blockState).createInstance();
indicator = mat.getModel(AllBlockPartials.ANALOG_LEVER_INDICATOR, blockState).createInstance();
transform(indicator);

View file

@ -22,8 +22,8 @@ public class SchematicannonInstance extends BlockEntityInstance<SchematicannonTi
Material<ModelData> mat = getTransformMaterial();
connector = mat.getModel(AllBlockPartials.SCHEMATICANNON_CONNECTOR).createInstance();
pipe = mat.getModel(AllBlockPartials.SCHEMATICANNON_PIPE).createInstance();
connector = mat.getModel(AllBlockPartials.SCHEMATICANNON_CONNECTOR, blockState).createInstance();
pipe = mat.getModel(AllBlockPartials.SCHEMATICANNON_PIPE, blockState).createInstance();
}
@Override

View file

@ -32,6 +32,6 @@ Technology that empowers the player.'''
[[dependencies.create]]
modId="flywheel"
mandatory=true
versionRange="[1.18-0.7.0,1.18-0.7.1)"
versionRange="[1.18-0.6.2,1.18-0.6.3)"
ordering="AFTER"
side="CLIENT"