use of com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack in project Create by Creators-of-Create.
the class DepotRenderer method renderItemsOf.
public static void renderItemsOf(SmartTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay, DepotBehaviour depotBehaviour) {
TransportedItemStack transported = depotBehaviour.heldItem;
TransformStack msr = TransformStack.cast(ms);
Vec3 itemPosition = VecHelper.getCenterOf(te.getBlockPos());
ms.pushPose();
ms.translate(.5f, 15 / 16f, .5f);
if (transported != null)
depotBehaviour.incoming.add(transported);
// Render main items
for (TransportedItemStack tis : depotBehaviour.incoming) {
ms.pushPose();
msr.nudge(0);
float offset = Mth.lerp(partialTicks, tis.prevBeltPosition, tis.beltPosition);
float sideOffset = Mth.lerp(partialTicks, tis.prevSideOffset, tis.sideOffset);
if (tis.insertedFrom.getAxis().isHorizontal()) {
Vec3 offsetVec = Vec3.atLowerCornerOf(tis.insertedFrom.getOpposite().getNormal()).scale(.5f - offset);
ms.translate(offsetVec.x, offsetVec.y, offsetVec.z);
boolean alongX = tis.insertedFrom.getClockWise().getAxis() == Axis.X;
if (!alongX)
sideOffset *= -1;
ms.translate(alongX ? sideOffset : 0, 0, alongX ? 0 : sideOffset);
}
ItemStack itemStack = tis.stack;
int angle = tis.angle;
Random r = new Random(0);
renderItem(ms, buffer, light, overlay, itemStack, angle, r, itemPosition);
ms.popPose();
}
if (transported != null)
depotBehaviour.incoming.remove(transported);
// Render output items
for (int i = 0; i < depotBehaviour.processingOutputBuffer.getSlots(); i++) {
ItemStack stack = depotBehaviour.processingOutputBuffer.getStackInSlot(i);
if (stack.isEmpty())
continue;
ms.pushPose();
msr.nudge(i);
boolean renderUpright = BeltHelper.isItemUpright(stack);
msr.rotateY(360 / 8f * i);
ms.translate(.35f, 0, 0);
if (renderUpright)
msr.rotateY(-(360 / 8f * i));
Random r = new Random(i + 1);
int angle = (int) (360 * r.nextFloat());
renderItem(ms, buffer, light, overlay, stack, renderUpright ? angle + 90 : angle, r, itemPosition);
ms.popPose();
}
ms.popPose();
}
Aggregations