Unbotch the batch
- Contraptions now render properly with batching - Belts can be placed sideways again
This commit is contained in:
parent
3517f04a70
commit
fa51b68709
12 changed files with 91 additions and 63 deletions
|
@ -9,6 +9,7 @@ import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.FlwContraption;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.MultiBufferSource;
|
import net.minecraft.client.renderer.MultiBufferSource;
|
||||||
|
@ -38,7 +39,7 @@ public class DrillMovementBehaviour extends BlockBreakingMovementBehaviour {
|
||||||
@OnlyIn(value = Dist.CLIENT)
|
@OnlyIn(value = Dist.CLIENT)
|
||||||
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
|
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
|
||||||
ContraptionMatrices matrices, MultiBufferSource buffer) {
|
ContraptionMatrices matrices, MultiBufferSource buffer) {
|
||||||
if (!Backend.isOn())
|
if (!FlwContraption.canInstance())
|
||||||
DrillRenderer.renderInContraption(context, renderWorld, matrices, buffer);
|
DrillRenderer.renderInContraption(context, renderWorld, matrices, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.FlwContraption;
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
@ -58,7 +59,7 @@ public class HarvesterMovementBehaviour implements MovementBehaviour {
|
||||||
@Override
|
@Override
|
||||||
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
|
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
|
||||||
ContraptionMatrices matrices, MultiBufferSource buffers) {
|
ContraptionMatrices matrices, MultiBufferSource buffers) {
|
||||||
if (!Backend.isOn())
|
if (!FlwContraption.canInstance())
|
||||||
HarvesterRenderer.renderInContraption(context, renderWorld, matrices, buffers);
|
HarvesterRenderer.renderInContraption(context, renderWorld, matrices, buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.FlwContraption;
|
||||||
import com.simibubi.create.content.logistics.trains.entity.CarriageContraption;
|
import com.simibubi.create.content.logistics.trains.entity.CarriageContraption;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
|
@ -55,7 +56,7 @@ public class PortableStorageInterfaceMovement implements MovementBehaviour {
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
|
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
|
||||||
ContraptionMatrices matrices, MultiBufferSource buffer) {
|
ContraptionMatrices matrices, MultiBufferSource buffer) {
|
||||||
if (!Backend.isOn())
|
if (!FlwContraption.canInstance())
|
||||||
PortableStorageInterfaceRenderer.renderInContraption(context, renderWorld, matrices, buffer);
|
PortableStorageInterfaceRenderer.renderInContraption(context, renderWorld, matrices, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.OrientedContraptionEntity;
|
import com.simibubi.create.content.contraptions.components.structureMovement.OrientedContraptionEntity;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.FlwContraption;
|
||||||
import com.simibubi.create.content.logistics.item.filter.FilterItem;
|
import com.simibubi.create.content.logistics.item.filter.FilterItem;
|
||||||
import com.simibubi.create.content.logistics.trains.entity.CarriageContraptionEntity;
|
import com.simibubi.create.content.logistics.trains.entity.CarriageContraptionEntity;
|
||||||
import com.simibubi.create.content.schematics.ItemRequirement;
|
import com.simibubi.create.content.schematics.ItemRequirement;
|
||||||
|
@ -290,7 +291,7 @@ public class DeployerMovementBehaviour implements MovementBehaviour {
|
||||||
@Override
|
@Override
|
||||||
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
|
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
|
||||||
ContraptionMatrices matrices, MultiBufferSource buffers) {
|
ContraptionMatrices matrices, MultiBufferSource buffers) {
|
||||||
if (!Backend.isOn())
|
if (!FlwContraption.canInstance())
|
||||||
DeployerRenderer.renderInContraption(context, renderWorld, matrices, buffers);
|
DeployerRenderer.renderInContraption(context, renderWorld, matrices, buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -849,7 +849,9 @@ public abstract class Contraption {
|
||||||
|
|
||||||
this.blocks.put(info.pos, info);
|
this.blocks.put(info.pos, info);
|
||||||
|
|
||||||
if (world.isClientSide) {
|
if (!world.isClientSide)
|
||||||
|
return;
|
||||||
|
|
||||||
Block block = info.state.getBlock();
|
Block block = info.state.getBlock();
|
||||||
CompoundTag tag = info.nbt;
|
CompoundTag tag = info.nbt;
|
||||||
MovementBehaviour movementBehaviour = AllMovementBehaviours.of(block);
|
MovementBehaviour movementBehaviour = AllMovementBehaviours.of(block);
|
||||||
|
@ -876,8 +878,6 @@ public abstract class Contraption {
|
||||||
|
|
||||||
presentTileEntities.put(info.pos, te);
|
presentTileEntities.put(info.pos, te);
|
||||||
specialRenderedTileEntities.add(te);
|
specialRenderedTileEntities.add(te);
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Ori
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.FlwContraption;
|
||||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
@ -34,7 +35,7 @@ public class StabilizedBearingMovementBehaviour implements MovementBehaviour {
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
|
public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld,
|
||||||
ContraptionMatrices matrices, MultiBufferSource buffer) {
|
ContraptionMatrices matrices, MultiBufferSource buffer) {
|
||||||
if (Backend.isOn())
|
if (FlwContraption.canInstance())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Direction facing = context.state.getValue(BlockStateProperties.FACING);
|
Direction facing = context.state.getValue(BlockStateProperties.FACING);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.Backend;
|
import com.jozufozu.flywheel.backend.Backend;
|
||||||
import com.jozufozu.flywheel.backend.gl.error.GlError;
|
import com.jozufozu.flywheel.backend.gl.error.GlError;
|
||||||
|
import com.jozufozu.flywheel.config.BackendType;
|
||||||
import com.jozufozu.flywheel.core.model.ModelUtil;
|
import com.jozufozu.flywheel.core.model.ModelUtil;
|
||||||
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
|
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
|
||||||
import com.jozufozu.flywheel.event.BeginFrameEvent;
|
import com.jozufozu.flywheel.event.BeginFrameEvent;
|
||||||
|
@ -119,7 +120,12 @@ public class ContraptionRenderDispatcher {
|
||||||
BlockPos origin = c.anchor;
|
BlockPos origin = c.anchor;
|
||||||
int height = contraptionWorld.getHeight();
|
int height = contraptionWorld.getHeight();
|
||||||
int minBuildHeight = contraptionWorld.getMinBuildHeight();
|
int minBuildHeight = contraptionWorld.getMinBuildHeight();
|
||||||
VirtualRenderWorld renderWorld = new VirtualRenderWorld(world, origin, height, minBuildHeight);
|
VirtualRenderWorld renderWorld = new VirtualRenderWorld(world, origin, height, minBuildHeight) {
|
||||||
|
@Override
|
||||||
|
public boolean supportsFlywheel() {
|
||||||
|
return Backend.getBackendType() == BackendType.INSTANCING;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
renderWorld.setBlockEntities(c.presentTileEntities.values());
|
renderWorld.setBlockEntities(c.presentTileEntities.values());
|
||||||
for (StructureTemplate.StructureBlockInfo info : c.getBlocks()
|
for (StructureTemplate.StructureBlockInfo info : c.getBlocks()
|
||||||
|
|
|
@ -13,6 +13,7 @@ import com.jozufozu.flywheel.backend.instancing.SerialTaskEngine;
|
||||||
import com.jozufozu.flywheel.backend.instancing.batching.BatchingEngine;
|
import com.jozufozu.flywheel.backend.instancing.batching.BatchingEngine;
|
||||||
import com.jozufozu.flywheel.backend.instancing.instancing.InstancingEngine;
|
import com.jozufozu.flywheel.backend.instancing.instancing.InstancingEngine;
|
||||||
import com.jozufozu.flywheel.backend.model.ArrayModelRenderer;
|
import com.jozufozu.flywheel.backend.model.ArrayModelRenderer;
|
||||||
|
import com.jozufozu.flywheel.config.BackendType;
|
||||||
import com.jozufozu.flywheel.core.model.Model;
|
import com.jozufozu.flywheel.core.model.Model;
|
||||||
import com.jozufozu.flywheel.core.model.WorldModel;
|
import com.jozufozu.flywheel.core.model.WorldModel;
|
||||||
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
|
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
|
||||||
|
@ -53,13 +54,17 @@ public class FlwContraption extends ContraptionRenderInfo {
|
||||||
|
|
||||||
var restoreState = GlStateTracker.getRestoreState();
|
var restoreState = GlStateTracker.getRestoreState();
|
||||||
buildLayers();
|
buildLayers();
|
||||||
if (Backend.isOn()) {
|
if (canInstance()) {
|
||||||
buildInstancedTiles();
|
buildInstancedTiles();
|
||||||
buildActors();
|
buildActors();
|
||||||
}
|
}
|
||||||
restoreState.restore();
|
restoreState.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean canInstance() {
|
||||||
|
return Backend.getBackendType() == BackendType.INSTANCING;
|
||||||
|
}
|
||||||
|
|
||||||
public ContraptionLighter<?> getLighter() {
|
public ContraptionLighter<?> getLighter() {
|
||||||
return lighter;
|
return lighter;
|
||||||
}
|
}
|
||||||
|
@ -147,18 +152,17 @@ public class FlwContraption extends ContraptionRenderInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildInstancedTiles() {
|
private void buildInstancedTiles() {
|
||||||
Collection<BlockEntity> tileEntities = contraption.maybeInstancedTileEntities;
|
for (BlockEntity te : contraption.maybeInstancedTileEntities) {
|
||||||
if (!tileEntities.isEmpty()) {
|
if (!InstancedRenderRegistry.canInstance(te.getType())) {
|
||||||
for (BlockEntity te : tileEntities) {
|
continue;
|
||||||
if (InstancedRenderRegistry.canInstance(te.getType())) {
|
}
|
||||||
|
|
||||||
Level world = te.getLevel();
|
Level world = te.getLevel();
|
||||||
te.setLevel(renderWorld);
|
te.setLevel(renderWorld);
|
||||||
instanceWorld.tileInstanceManager.add(te);
|
instanceWorld.tileInstanceManager.add(te);
|
||||||
te.setLevel(world);
|
te.setLevel(world);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buildActors() {
|
private void buildActors() {
|
||||||
contraption.getActors().forEach(instanceWorld.tileInstanceManager::createActor);
|
contraption.getActors().forEach(instanceWorld.tileInstanceManager::createActor);
|
||||||
|
|
|
@ -43,11 +43,12 @@ public class FlwContraptionManager extends ContraptionRenderingWorld<FlwContrapt
|
||||||
GlStateTracker.State restoreState = GlStateTracker.getRestoreState();
|
GlStateTracker.State restoreState = GlStateTracker.getRestoreState();
|
||||||
GlTextureUnit active = GlTextureUnit.getActive();
|
GlTextureUnit active = GlTextureUnit.getActive();
|
||||||
|
|
||||||
if (Backend.getBackendType() != BackendType.BATCHING) {
|
var backendType = Backend.getBackendType();
|
||||||
|
if (backendType != BackendType.OFF) {
|
||||||
renderStructures(event);
|
renderStructures(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getLayer() != null) {
|
if (backendType != BackendType.BATCHING && event.getLayer() != null) {
|
||||||
for (FlwContraption renderer : visible) {
|
for (FlwContraption renderer : visible) {
|
||||||
renderer.renderInstanceLayer(event);
|
renderer.renderInstanceLayer(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,10 +143,6 @@ public class BeltConnectorItem extends BlockItem {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!existingBlock.getMaterial()
|
|
||||||
.isReplaceable())
|
|
||||||
world.destroyBlock(pos, false);
|
|
||||||
|
|
||||||
BeltPart part = pos.equals(start) ? BeltPart.START : pos.equals(end) ? BeltPart.END : BeltPart.MIDDLE;
|
BeltPart part = pos.equals(start) ? BeltPart.START : pos.equals(end) ? BeltPart.END : BeltPart.MIDDLE;
|
||||||
BlockState shaftState = world.getBlockState(pos);
|
BlockState shaftState = world.getBlockState(pos);
|
||||||
boolean pulley = ShaftBlock.isShaft(shaftState);
|
boolean pulley = ShaftBlock.isShaft(shaftState);
|
||||||
|
@ -154,6 +150,11 @@ public class BeltConnectorItem extends BlockItem {
|
||||||
part = BeltPart.PULLEY;
|
part = BeltPart.PULLEY;
|
||||||
if (pulley && shaftState.getValue(AbstractSimpleShaftBlock.AXIS) == Axis.Y)
|
if (pulley && shaftState.getValue(AbstractSimpleShaftBlock.AXIS) == Axis.Y)
|
||||||
slope = BeltSlope.SIDEWAYS;
|
slope = BeltSlope.SIDEWAYS;
|
||||||
|
|
||||||
|
if (!existingBlock.getMaterial()
|
||||||
|
.isReplaceable())
|
||||||
|
world.destroyBlock(pos, false);
|
||||||
|
|
||||||
KineticTileEntity.switchToBlockState(world, pos, beltBlock.setValue(BeltBlock.SLOPE, slope)
|
KineticTileEntity.switchToBlockState(world, pos, beltBlock.setValue(BeltBlock.SLOPE, slope)
|
||||||
.setValue(BeltBlock.PART, part)
|
.setValue(BeltBlock.PART, part)
|
||||||
.setValue(BeltBlock.HORIZONTAL_FACING, facing));
|
.setValue(BeltBlock.HORIZONTAL_FACING, facing));
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class CarriageContraptionEntityRenderer extends ContraptionEntityRenderer
|
||||||
: BlockPos.ZERO.relative(entity.getInitialOrientation()
|
: BlockPos.ZERO.relative(entity.getInitialOrientation()
|
||||||
.getCounterClockWise(), bogeySpacing);
|
.getCounterClockWise(), bogeySpacing);
|
||||||
|
|
||||||
if (!Backend.isOn() && !entity.getContraption()
|
if (!Backend.canUseInstancing(entity.level) && !entity.getContraption()
|
||||||
.isHiddenInPortal(bogeyPos)) {
|
.isHiddenInPortal(bogeyPos)) {
|
||||||
|
|
||||||
ms.pushPose();
|
ms.pushPose();
|
||||||
|
|
|
@ -6,6 +6,7 @@ import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.Backend;
|
import com.jozufozu.flywheel.backend.Backend;
|
||||||
import com.jozufozu.flywheel.backend.instancing.InstancedRenderRegistry;
|
import com.jozufozu.flywheel.backend.instancing.InstancedRenderRegistry;
|
||||||
|
import com.jozufozu.flywheel.config.BackendType;
|
||||||
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
|
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
|
||||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
@ -48,7 +49,7 @@ public class TileEntityRenderHelper {
|
||||||
Iterator<BlockEntity> iterator = customRenderTEs.iterator();
|
Iterator<BlockEntity> iterator = customRenderTEs.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
BlockEntity tileEntity = iterator.next();
|
BlockEntity tileEntity = iterator.next();
|
||||||
if (Backend.canUseInstancing(renderWorld) && InstancedRenderRegistry.shouldSkipRender(tileEntity))
|
if (Backend.getBackendType() == BackendType.INSTANCING && Backend.isFlywheelWorld(renderWorld) && InstancedRenderRegistry.shouldSkipRender(tileEntity))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BlockEntityRenderer<BlockEntity> renderer = Minecraft.getInstance().getBlockEntityRenderDispatcher().getRenderer(tileEntity);
|
BlockEntityRenderer<BlockEntity> renderer = Minecraft.getInstance().getBlockEntityRenderDispatcher().getRenderer(tileEntity);
|
||||||
|
@ -63,16 +64,16 @@ public class TileEntityRenderHelper {
|
||||||
.translate(pos);
|
.translate(pos);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
BlockPos lightPos;
|
int worldLight = getCombinedLight(world, getLightPos(lightTransform, pos), renderWorld, pos);
|
||||||
if (lightTransform != null) {
|
|
||||||
Vector4f lightVec = new Vector4f(pos.getX() + .5f, pos.getY() + .5f, pos.getZ() + .5f, 1);
|
if (renderWorld != null) {
|
||||||
lightVec.transform(lightTransform);
|
// Swap the real world for the render world so that the renderer gets contraption-local information
|
||||||
lightPos = new BlockPos(lightVec.x(), lightVec.y(), lightVec.z());
|
tileEntity.setLevel(renderWorld);
|
||||||
} else {
|
|
||||||
lightPos = pos;
|
|
||||||
}
|
|
||||||
int worldLight = getCombinedLight(world, lightPos, renderWorld, pos);
|
|
||||||
renderer.render(tileEntity, pt, ms, buffer, worldLight, OverlayTexture.NO_OVERLAY);
|
renderer.render(tileEntity, pt, ms, buffer, worldLight, OverlayTexture.NO_OVERLAY);
|
||||||
|
tileEntity.setLevel(world);
|
||||||
|
} else {
|
||||||
|
renderer.render(tileEntity, pt, ms, buffer, worldLight, OverlayTexture.NO_OVERLAY);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
|
@ -90,6 +91,16 @@ public class TileEntityRenderHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static BlockPos getLightPos(@Nullable Matrix4f lightTransform, BlockPos contraptionPos) {
|
||||||
|
if (lightTransform != null) {
|
||||||
|
Vector4f lightVec = new Vector4f(contraptionPos.getX() + .5f, contraptionPos.getY() + .5f, contraptionPos.getZ() + .5f, 1);
|
||||||
|
lightVec.transform(lightTransform);
|
||||||
|
return new BlockPos(lightVec.x(), lightVec.y(), lightVec.z());
|
||||||
|
} else {
|
||||||
|
return contraptionPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static int getCombinedLight(Level world, BlockPos worldPos, @Nullable VirtualRenderWorld renderWorld,
|
public static int getCombinedLight(Level world, BlockPos worldPos, @Nullable VirtualRenderWorld renderWorld,
|
||||||
BlockPos renderWorldPos) {
|
BlockPos renderWorldPos) {
|
||||||
int worldLight = LevelRenderer.getLightColor(world, worldPos);
|
int worldLight = LevelRenderer.getLightColor(world, worldPos);
|
||||||
|
|
Loading…
Reference in a new issue