mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-27 20:34:43 +01:00
Unlit
- Remove last bits of FlwContraption rendering - Remove ContraptionLighter
This commit is contained in:
parent
605daed671
commit
7df37f7bff
17 changed files with 6 additions and 560 deletions
|
@ -54,8 +54,6 @@ import com.simibubi.create.content.contraptions.pulley.PulleyBlock;
|
|||
import com.simibubi.create.content.contraptions.pulley.PulleyBlock.MagnetBlock;
|
||||
import com.simibubi.create.content.contraptions.pulley.PulleyBlock.RopeBlock;
|
||||
import com.simibubi.create.content.contraptions.pulley.PulleyBlockEntity;
|
||||
import com.simibubi.create.content.contraptions.render.ContraptionLighter;
|
||||
import com.simibubi.create.content.contraptions.render.EmptyLighter;
|
||||
import com.simibubi.create.content.decoration.slidingDoor.SlidingDoorBlock;
|
||||
import com.simibubi.create.content.fluids.tank.FluidTankBlockEntity;
|
||||
import com.simibubi.create.content.kinetics.base.BlockBreakingMovementBehaviour;
|
||||
|
@ -122,8 +120,6 @@ import net.minecraft.world.phys.shapes.BooleanOp;
|
|||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
|
@ -1303,12 +1299,6 @@ public abstract class Contraption {
|
|||
return interactors;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public ContraptionLighter<?> makeLighter() {
|
||||
// TODO: move lighters to registry
|
||||
return new EmptyLighter(this);
|
||||
}
|
||||
|
||||
public void invalidateColliders() {
|
||||
simplifiedEntityColliders = Optional.empty();
|
||||
gatherBBsOffThread();
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
package com.simibubi.create.content.contraptions.bearing;
|
||||
|
||||
import com.jozufozu.flywheel.lib.box.MutableBox;
|
||||
import com.simibubi.create.content.contraptions.Contraption;
|
||||
import com.simibubi.create.content.contraptions.render.ContraptionLighter;
|
||||
|
||||
public class AnchoredLighter extends ContraptionLighter<Contraption> {
|
||||
|
||||
public AnchoredLighter(Contraption contraption) {
|
||||
super(contraption);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutableBox getContraptionBounds() {
|
||||
MutableBox bb = MutableBox.from(contraption.bounds);
|
||||
bb.translate(contraption.anchor);
|
||||
return bb;
|
||||
}
|
||||
}
|
|
@ -7,7 +7,6 @@ import com.simibubi.create.AllTags.AllBlockTags;
|
|||
import com.simibubi.create.content.contraptions.AssemblyException;
|
||||
import com.simibubi.create.content.contraptions.Contraption;
|
||||
import com.simibubi.create.content.contraptions.ContraptionType;
|
||||
import com.simibubi.create.content.contraptions.render.ContraptionLighter;
|
||||
import com.simibubi.create.content.decoration.copycat.CopycatBlockEntity;
|
||||
import com.simibubi.create.infrastructure.config.AllConfigs;
|
||||
|
||||
|
@ -18,8 +17,6 @@ import net.minecraft.world.level.Level;
|
|||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BearingContraption extends Contraption {
|
||||
|
||||
|
@ -104,9 +101,4 @@ public class BearingContraption extends Contraption {
|
|||
return facing.getAxis() == this.facing.getAxis();
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public ContraptionLighter<?> makeLighter() {
|
||||
return new AnchoredLighter(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,15 +9,12 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||
import com.simibubi.create.content.contraptions.AssemblyException;
|
||||
import com.simibubi.create.content.contraptions.Contraption;
|
||||
import com.simibubi.create.content.contraptions.ContraptionType;
|
||||
import com.simibubi.create.content.contraptions.render.ContraptionLighter;
|
||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class ClockworkContraption extends Contraption {
|
||||
|
||||
|
@ -132,9 +129,4 @@ public class ClockworkContraption extends Contraption {
|
|||
HOUR, MINUTE
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public ContraptionLighter<?> makeLighter() {
|
||||
return new AnchoredLighter(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,15 +3,11 @@ package com.simibubi.create.content.contraptions.bearing;
|
|||
import com.simibubi.create.content.contraptions.AssemblyException;
|
||||
import com.simibubi.create.content.contraptions.Contraption;
|
||||
import com.simibubi.create.content.contraptions.ContraptionType;
|
||||
import com.simibubi.create.content.contraptions.render.ContraptionLighter;
|
||||
import com.simibubi.create.content.contraptions.render.NonStationaryLighter;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class StabilizedContraption extends Contraption {
|
||||
|
||||
|
@ -66,9 +62,4 @@ public class StabilizedContraption extends Contraption {
|
|||
return facing;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public ContraptionLighter<?> makeLighter() {
|
||||
return new NonStationaryLighter<>(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,16 +4,12 @@ import com.simibubi.create.AllBlocks;
|
|||
import com.simibubi.create.content.contraptions.AssemblyException;
|
||||
import com.simibubi.create.content.contraptions.ContraptionType;
|
||||
import com.simibubi.create.content.contraptions.TranslatingContraption;
|
||||
import com.simibubi.create.content.contraptions.render.ContraptionLighter;
|
||||
import com.simibubi.create.content.contraptions.render.NonStationaryLighter;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class GantryContraption extends TranslatingContraption {
|
||||
|
||||
|
@ -65,9 +61,4 @@ public class GantryContraption extends TranslatingContraption {
|
|||
return super.shouldUpdateAfterMovement(info) && !AllBlocks.GANTRY_CARRIAGE.has(info.state());
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public ContraptionLighter<?> makeLighter() {
|
||||
return new NonStationaryLighter<>(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,6 @@ import com.simibubi.create.content.contraptions.AssemblyException;
|
|||
import com.simibubi.create.content.contraptions.Contraption;
|
||||
import com.simibubi.create.content.contraptions.ContraptionType;
|
||||
import com.simibubi.create.content.contraptions.mounted.CartAssemblerBlockEntity.CartMovementMode;
|
||||
import com.simibubi.create.content.contraptions.render.ContraptionLighter;
|
||||
import com.simibubi.create.content.contraptions.render.NonStationaryLighter;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
@ -32,8 +30,6 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
|||
import net.minecraft.world.level.block.state.properties.RailShape;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
|
||||
public class MountedContraption extends Contraption {
|
||||
|
@ -160,9 +156,4 @@ public class MountedContraption extends Contraption {
|
|||
storage.attachExternal(new ContraptionInvWrapper(true, new InvWrapper(container)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public ContraptionLighter<?> makeLighter() {
|
||||
return new NonStationaryLighter<>(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import com.simibubi.create.content.contraptions.BlockMovementChecks;
|
|||
import com.simibubi.create.content.contraptions.ContraptionType;
|
||||
import com.simibubi.create.content.contraptions.TranslatingContraption;
|
||||
import com.simibubi.create.content.contraptions.piston.MechanicalPistonBlock.PistonState;
|
||||
import com.simibubi.create.content.contraptions.render.ContraptionLighter;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import com.simibubi.create.infrastructure.config.AllConfigs;
|
||||
|
||||
|
@ -36,8 +35,6 @@ import net.minecraft.world.level.block.state.properties.PistonType;
|
|||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
|
||||
import net.minecraft.world.level.material.PushReaction;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class PistonContraption extends TranslatingContraption {
|
||||
|
||||
|
@ -244,9 +241,4 @@ public class PistonContraption extends TranslatingContraption {
|
|||
return tag;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public ContraptionLighter<?> makeLighter() {
|
||||
return new PistonLighter(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
package com.simibubi.create.content.contraptions.piston;
|
||||
|
||||
import com.jozufozu.flywheel.lib.box.MutableBox;
|
||||
import com.simibubi.create.content.contraptions.render.ContraptionLighter;
|
||||
|
||||
import net.minecraft.core.Vec3i;
|
||||
|
||||
public class PistonLighter extends ContraptionLighter<PistonContraption> {
|
||||
public PistonLighter(PistonContraption contraption) {
|
||||
super(contraption);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutableBox getContraptionBounds() {
|
||||
MutableBox bounds = MutableBox.from(contraption.bounds);
|
||||
bounds.translate(contraption.anchor);
|
||||
|
||||
int length = contraption.extensionLength;
|
||||
Vec3i direction = contraption.orientation.getNormal();
|
||||
|
||||
int shift = length / 2;
|
||||
int shiftX = direction.getX() * shift;
|
||||
int shiftY = direction.getY() * shift;
|
||||
int shiftZ = direction.getZ() * shift;
|
||||
bounds.translate(shiftX, shiftY, shiftZ);
|
||||
|
||||
int grow = (length + 1) / 2;
|
||||
int extendX = Math.abs(direction.getX() * grow);
|
||||
int extendY = Math.abs(direction.getY() * grow);
|
||||
int extendZ = Math.abs(direction.getZ() * grow);
|
||||
bounds.grow(extendX, extendY, extendZ);
|
||||
|
||||
return bounds;
|
||||
}
|
||||
}
|
|
@ -3,13 +3,10 @@ package com.simibubi.create.content.contraptions.pulley;
|
|||
import com.simibubi.create.content.contraptions.AssemblyException;
|
||||
import com.simibubi.create.content.contraptions.ContraptionType;
|
||||
import com.simibubi.create.content.contraptions.TranslatingContraption;
|
||||
import com.simibubi.create.content.contraptions.render.ContraptionLighter;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class PulleyContraption extends TranslatingContraption {
|
||||
|
||||
|
@ -57,12 +54,6 @@ public class PulleyContraption extends TranslatingContraption {
|
|||
super.readNBT(world, nbt, spawnData);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public ContraptionLighter<?> makeLighter() {
|
||||
return new PulleyLighter(this);
|
||||
}
|
||||
|
||||
public int getInitialOffset() {
|
||||
return initialOffset;
|
||||
}
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
package com.simibubi.create.content.contraptions.pulley;
|
||||
|
||||
import com.jozufozu.flywheel.lib.box.MutableBox;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.contraptions.render.ContraptionLighter;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
public class PulleyLighter extends ContraptionLighter<PulleyContraption> {
|
||||
public PulleyLighter(PulleyContraption contraption) {
|
||||
super(contraption);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutableBox getContraptionBounds() {
|
||||
|
||||
MutableBox bounds = MutableBox.from(contraption.bounds);
|
||||
|
||||
Level world = contraption.entity.level();
|
||||
|
||||
BlockPos.MutableBlockPos pos = contraption.anchor.mutable();
|
||||
while (!AllBlocks.ROPE_PULLEY.has(world.getBlockState(pos)) && pos.getY() < world.getMaxBuildHeight())
|
||||
pos.move(0, 1, 0);
|
||||
|
||||
bounds.translate(pos);
|
||||
bounds.setMinY(world.getMinBuildHeight());
|
||||
return bounds;
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package com.simibubi.create.content.contraptions.render;
|
||||
|
||||
import com.jozufozu.flywheel.lib.box.Box;
|
||||
import com.jozufozu.flywheel.lib.box.MutableBox;
|
||||
import com.jozufozu.flywheel.lib.light.GPULightVolume;
|
||||
import com.simibubi.create.content.contraptions.Contraption;
|
||||
|
||||
import net.minecraft.core.SectionPos;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
|
||||
public abstract class ContraptionLighter<C extends Contraption> {
|
||||
protected final C contraption;
|
||||
public final GPULightVolume lightVolume;
|
||||
|
||||
protected final MutableBox bounds;
|
||||
|
||||
protected boolean scheduleRebuild;
|
||||
|
||||
protected ContraptionLighter(C contraption) {
|
||||
this.contraption = contraption;
|
||||
|
||||
bounds = getContraptionBounds();
|
||||
growBoundsForEdgeData(bounds);
|
||||
|
||||
lightVolume = new GPULightVolume(contraption.entity.level(), bounds);
|
||||
|
||||
lightVolume.initialize();
|
||||
scheduleRebuild = true;
|
||||
}
|
||||
|
||||
public abstract MutableBox getContraptionBounds();
|
||||
|
||||
public boolean isInvalid() {
|
||||
return lightVolume.isInvalid();
|
||||
}
|
||||
|
||||
public void onLightUpdate(LightLayer type, SectionPos pos) {
|
||||
lightVolume.onLightUpdate(type, pos);
|
||||
}
|
||||
|
||||
protected static void growBoundsForEdgeData(MutableBox bounds) {
|
||||
// so we have at least enough data on the edges to avoid artifacts and have smooth lighting
|
||||
bounds.grow(2);
|
||||
}
|
||||
|
||||
public Box getVolume() {
|
||||
return bounds;
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
lightVolume.delete();
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package com.simibubi.create.content.contraptions.render;
|
||||
|
||||
import com.jozufozu.flywheel.lib.box.MutableBox;
|
||||
import com.simibubi.create.content.contraptions.Contraption;
|
||||
|
||||
// so other contraptions don't crash before they have a lighter
|
||||
public class EmptyLighter extends ContraptionLighter<Contraption> {
|
||||
public EmptyLighter(Contraption contraption) {
|
||||
super(contraption);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutableBox getContraptionBounds() {
|
||||
return new MutableBox(0, 0, 0, 1, 1, 1);
|
||||
}
|
||||
}
|
|
@ -1,194 +0,0 @@
|
|||
package com.simibubi.create.content.contraptions.render;
|
||||
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
import com.jozufozu.flywheel.api.event.BeginFrameEvent;
|
||||
import com.jozufozu.flywheel.api.event.RenderStageEvent;
|
||||
import com.jozufozu.flywheel.backend.gl.GlStateTracker;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.content.contraptions.AbstractContraptionEntity;
|
||||
import com.simibubi.create.content.contraptions.Contraption;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.virtualWorld.VirtualRenderWorld;
|
||||
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
|
||||
public class FlwContraption extends ContraptionRenderInfo {
|
||||
|
||||
private final ContraptionLighter<?> lighter;
|
||||
|
||||
// private final Map<RenderType, ArrayModelRenderer> renderLayers = new HashMap<>();
|
||||
|
||||
private final Matrix4f modelViewPartial = new Matrix4f();
|
||||
private final ContraptionInstanceWorld instanceWorld;
|
||||
private boolean modelViewPartialReady;
|
||||
// floats because we upload this to the gpu
|
||||
private AABB lightBox;
|
||||
|
||||
public FlwContraption(Contraption contraption, VirtualRenderWorld renderWorld) {
|
||||
super(contraption, renderWorld);
|
||||
this.lighter = contraption.makeLighter();
|
||||
|
||||
instanceWorld = new ContraptionInstanceWorld(this);
|
||||
|
||||
var restoreState = GlStateTracker.getRestoreState();
|
||||
buildLayers();
|
||||
if (ContraptionRenderDispatcher.canInstance()) {
|
||||
// buildInstancedBlockEntities();
|
||||
buildActors();
|
||||
}
|
||||
restoreState.restore();
|
||||
}
|
||||
|
||||
public ContraptionLighter<?> getLighter() {
|
||||
return lighter;
|
||||
}
|
||||
|
||||
// public void renderStructureLayer(RenderType layer, ContraptionProgram shader) {
|
||||
// ArrayModelRenderer structure = renderLayers.get(layer);
|
||||
// if (structure != null) {
|
||||
// setup(shader);
|
||||
// structure.draw();
|
||||
// }
|
||||
// }
|
||||
|
||||
public void renderInstanceLayer(RenderStageEvent event) {
|
||||
|
||||
// event.stack.pushPose();
|
||||
// float partialTicks = AnimationTickHolder.getPartialTicks();
|
||||
// AbstractContraptionEntity entity = contraption.entity;
|
||||
// double x = Mth.lerp(partialTicks, entity.xOld, entity.getX());
|
||||
// double y = Mth.lerp(partialTicks, entity.yOld, entity.getY());
|
||||
// double z = Mth.lerp(partialTicks, entity.zOld, entity.getZ());
|
||||
// event.stack.translate(x - event.camX, y - event.camY, z - event.camZ);
|
||||
// ContraptionMatrices.transform(event.stack, getMatrices().getModel());
|
||||
// instanceWorld.engine.render(SerialTaskEngine.INSTANCE, event);
|
||||
//
|
||||
// event.stack.popPose();
|
||||
}
|
||||
|
||||
public void beginFrame(BeginFrameEvent event) {
|
||||
// super.beginFrame(event);
|
||||
//
|
||||
// modelViewPartial.identity();
|
||||
// modelViewPartialReady = false;
|
||||
//
|
||||
// if (!isVisible()) return;
|
||||
//
|
||||
// instanceWorld.blockEntityInstanceManager.beginFrame(SerialTaskEngine.INSTANCE, event.getCamera());
|
||||
//
|
||||
// Vec3 cameraPos = event.getCameraPos();
|
||||
//
|
||||
// lightBox = lighter.lightVolume.toAABB()
|
||||
// .move(-cameraPos.x, -cameraPos.y, -cameraPos.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupMatrices(PoseStack viewProjection, double camX, double camY, double camZ) {
|
||||
super.setupMatrices(viewProjection, camX, camY, camZ);
|
||||
|
||||
if (!modelViewPartialReady) {
|
||||
setupModelViewPartial(modelViewPartial, getMatrices().getModel().last().pose(), contraption.entity, camX, camY, camZ, AnimationTickHolder.getPartialTicks());
|
||||
modelViewPartialReady = true;
|
||||
}
|
||||
}
|
||||
|
||||
// void setup(ContraptionProgram shader) {
|
||||
// if (!modelViewPartialReady || lightBox == null) return;
|
||||
// shader.bind(modelViewPartial, lightBox);
|
||||
// lighter.lightVolume.bind();
|
||||
// }
|
||||
|
||||
public void invalidate() {
|
||||
// for (ArrayModelRenderer renderer : renderLayers.values()) {
|
||||
// renderer.delete();
|
||||
// renderer.getModel().delete();
|
||||
// }
|
||||
// renderLayers.clear();
|
||||
//
|
||||
// lighter.delete();
|
||||
//
|
||||
// instanceWorld.delete();
|
||||
}
|
||||
|
||||
private void buildLayers() {
|
||||
// for (ArrayModelRenderer renderer : renderLayers.values()) {
|
||||
// renderer.delete();
|
||||
// renderer.getModel().delete();
|
||||
// }
|
||||
//
|
||||
// renderLayers.clear();
|
||||
//
|
||||
// List<RenderType> blockLayers = RenderType.chunkBufferLayers();
|
||||
// Collection<StructureBlockInfo> renderedBlocks = contraption.getRenderedBlocks();
|
||||
//
|
||||
// for (RenderType layer : blockLayers) {
|
||||
// Model layerModel = new WorldModelBuilder(layer).withRenderWorld(renderWorld)
|
||||
// .withModelData(contraption.modelData)
|
||||
// .withBlocks(renderedBlocks)
|
||||
// .toModel(layer + "_" + contraption.entity.getId());
|
||||
// renderLayers.put(layer, new ArrayModelRenderer(layerModel));
|
||||
// }
|
||||
}
|
||||
|
||||
// private void buildInstancedBlockEntities() {
|
||||
// for (BlockEntity be : contraption.maybeInstancedBlockEntities) {
|
||||
// if (!InstancedRenderRegistry.canInstance(be.getType())) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// Level world = be.getLevel();
|
||||
// be.setLevel(renderWorld);
|
||||
// instanceWorld.blockEntityInstanceManager.add(be);
|
||||
// be.setLevel(world);
|
||||
// }
|
||||
// }
|
||||
|
||||
private void buildActors() {
|
||||
// contraption.getActors().forEach(instanceWorld.blockEntityInstanceManager::createActor);
|
||||
}
|
||||
|
||||
public static void setupModelViewPartial(Matrix4f matrix, Matrix4f modelMatrix, AbstractContraptionEntity entity, double camX, double camY, double camZ, float pt) {
|
||||
float x = (float) (Mth.lerp(pt, entity.xOld, entity.getX()) - camX);
|
||||
float y = (float) (Mth.lerp(pt, entity.yOld, entity.getY()) - camY);
|
||||
float z = (float) (Mth.lerp(pt, entity.zOld, entity.getZ()) - camZ);
|
||||
matrix.setTranslation(x, y, z);
|
||||
matrix.mul(modelMatrix);
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
// instanceWorld.blockEntityInstanceManager.tick();
|
||||
}
|
||||
|
||||
public static class ContraptionInstanceWorld {
|
||||
|
||||
// private final Engine engine;
|
||||
// private final ContraptionInstanceManager blockEntityInstanceManager;
|
||||
|
||||
public ContraptionInstanceWorld(FlwContraption parent) {
|
||||
// switch (Backend.getBackendType()) {
|
||||
// case INSTANCING -> {
|
||||
// InstancingEngine<ContraptionProgram> engine = InstancingEngine.builder(CreateContexts.CWORLD)
|
||||
// .setGroupFactory(ContraptionGroup.forContraption(parent))
|
||||
// .setIgnoreOriginCoordinate(true)
|
||||
// .build();
|
||||
// blockEntityInstanceManager = new ContraptionInstanceManager(engine, parent.renderWorld, parent.contraption);
|
||||
// engine.addListener(blockEntityInstanceManager);
|
||||
//
|
||||
// this.engine = engine;
|
||||
// }
|
||||
// case BATCHING -> {
|
||||
// engine = new BatchingEngine();
|
||||
// blockEntityInstanceManager = new ContraptionInstanceManager(engine, parent.renderWorld, parent.contraption);
|
||||
// }
|
||||
// default -> throw new IllegalArgumentException("Unknown engine type");
|
||||
// }
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
// engine.delete();
|
||||
// blockEntityInstanceManager.invalidate();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
package com.simibubi.create.content.contraptions.render;
|
||||
|
||||
import com.jozufozu.flywheel.api.event.RenderStageEvent;
|
||||
import com.simibubi.create.content.contraptions.Contraption;
|
||||
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
|
||||
public class FlwContraptionManager extends ContraptionRenderingWorld<FlwContraption> {
|
||||
|
||||
public FlwContraptionManager(LevelAccessor world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
for (FlwContraption contraption : visible) {
|
||||
contraption.tick();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderLayer(RenderStageEvent event) {
|
||||
// super.renderLayer(event);
|
||||
//
|
||||
// if (visible.isEmpty()) return;
|
||||
//
|
||||
// GlStateTracker.State restoreState = GlStateTracker.getRestoreState();
|
||||
// GlTextureUnit active = GlTextureUnit.getActive();
|
||||
//
|
||||
// var backendType = Backend.getBackendType();
|
||||
// if (backendType != BackendType.OFF) {
|
||||
// renderStructures(event);
|
||||
// }
|
||||
//
|
||||
// if (backendType != BackendType.BATCHING && event.getLayer() != null) {
|
||||
// for (FlwContraption renderer : visible) {
|
||||
// renderer.renderInstanceLayer(event);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // clear the light volume state
|
||||
// GlTextureUnit.T4.makeActive();
|
||||
// glBindTexture(GL_TEXTURE_3D, 0);
|
||||
//
|
||||
// event.type.clearRenderState();
|
||||
// active.makeActive();
|
||||
// restoreState.restore();
|
||||
}
|
||||
|
||||
private void renderStructures(RenderStageEvent event) {
|
||||
|
||||
// event.type.setupRenderState();
|
||||
// Textures.bindActiveTextures();
|
||||
//
|
||||
// ContraptionProgram structureShader = CreateContexts.STRUCTURE.getProgram(ProgramContext.create(Materials.Names.PASSTHRU, Formats.BLOCK, RenderLayer.getLayer(event.type)));
|
||||
//
|
||||
// structureShader.bind();
|
||||
// structureShader.uploadViewProjection(event.viewProjection);
|
||||
// structureShader.uploadCameraPos(event.camX, event.camY, event.camZ);
|
||||
//
|
||||
// for (FlwContraption flwContraption : visible) {
|
||||
// flwContraption.renderStructureLayer(event.type, structureShader);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FlwContraption create(Contraption c) {
|
||||
// VirtualRenderWorld renderWorld = ContraptionRenderDispatcher.setupRenderWorld(world, c);
|
||||
// return new FlwContraption(c, renderWorld);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDeadRenderers() {
|
||||
boolean removed = renderInfos.values()
|
||||
.removeIf(renderer -> {
|
||||
if (renderer.isDead()) {
|
||||
renderer.invalidate();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// we use visible in #tick() so we have to re-evaluate it if any were removed
|
||||
if (removed) collectVisible();
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package com.simibubi.create.content.contraptions.render;
|
||||
|
||||
import com.jozufozu.flywheel.lib.box.Box;
|
||||
import com.jozufozu.flywheel.lib.box.MutableBox;
|
||||
import com.simibubi.create.content.contraptions.Contraption;
|
||||
import com.simibubi.create.infrastructure.config.AllConfigs;
|
||||
|
||||
public class NonStationaryLighter<C extends Contraption> extends ContraptionLighter<C> {
|
||||
public NonStationaryLighter(C contraption) {
|
||||
super(contraption);
|
||||
}
|
||||
|
||||
public boolean tickLightListener() {
|
||||
if (getVolume().volume() > AllConfigs.client().maxContraptionLightVolume.get())
|
||||
return false;
|
||||
|
||||
Box contraptionBounds = getContraptionBounds();
|
||||
|
||||
if (bounds.sameAs(contraptionBounds, 2)) {
|
||||
return false;
|
||||
}
|
||||
bounds.assign(contraptionBounds);
|
||||
growBoundsForEdgeData(bounds);
|
||||
|
||||
lightVolume.move(bounds);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutableBox getContraptionBounds() {
|
||||
MutableBox bb = MutableBox.from(contraption.bounds);
|
||||
|
||||
bb.translate(contraption.entity.blockPosition());
|
||||
|
||||
return bb;
|
||||
}
|
||||
}
|
|
@ -17,8 +17,6 @@ import com.simibubi.create.content.contraptions.ContraptionType;
|
|||
import com.simibubi.create.content.contraptions.MountedStorageManager;
|
||||
import com.simibubi.create.content.contraptions.actors.trainControls.ControlsBlock;
|
||||
import com.simibubi.create.content.contraptions.minecart.TrainCargoManager;
|
||||
import com.simibubi.create.content.contraptions.render.ContraptionLighter;
|
||||
import com.simibubi.create.content.contraptions.render.NonStationaryLighter;
|
||||
import com.simibubi.create.content.processing.burner.BlazeBurnerBlock;
|
||||
import com.simibubi.create.content.processing.burner.BlazeBurnerBlock.HeatLevel;
|
||||
import com.simibubi.create.content.trains.bogey.AbstractBogeyBlock;
|
||||
|
@ -41,8 +39,6 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
@ -242,12 +238,6 @@ public class CarriageContraption extends Contraption {
|
|||
return ContraptionType.CARRIAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public ContraptionLighter<?> makeLighter() {
|
||||
return new NonStationaryLighter<>(this);
|
||||
}
|
||||
|
||||
public Direction getAssemblyDirection() {
|
||||
return assemblyDirection;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue