@Override
    protected void renderInViewport(PoseStack renderStack, Vec2 ndcMouse, float partialFrame, boolean isFirstHit) {

        CCRenderState ccrs = CCRenderState.instance();
        MultiBufferSource.BufferSource getter = Minecraft.getInstance().renderBuffers().bufferSource();

        Vector3 worldPos = ndcMouseToWorld(ndcMouse);

        // At most, render 1 layer below and 1 render above (for transition effects)
        for (int y = currentLayer-1; y <= currentLayer+1; y++) {

            ccrs.reset();
            // Linearly ramp down alpha as we move away from the current layer
            ccrs.alphaOverride = 255 - (int) (255 * Math.min(Math.abs(y - cameraLayerAnimator.vector.y), 1));
            ccrs.brightness = LightTexture.pack(15, 15);

            // Render grid
            renderStack.pushPose();
            renderStack.translate(0, y, 0);
            TileCoord minBounds = editor.getTileMap().getMinBounds();
            TileCoord maxBounds = editor.getTileMap().getMaxBounds();
            Cuboid6 bounds = new Cuboid6(minBounds.x, minBounds.y, minBounds.z, maxBounds.x + 1, maxBounds.y + 1, maxBounds.z + 1);

            ICRenderTypes.renderICGrid(renderStack, getter, bounds, ccrs); //TODO the cuboid going in here is kinda awkward

            renderStack.popPose();

            // Render tiles
            for (var entry : editor.getTileMap().getTilesOnLayer(y)) {
                renderStack.pushPose();
                renderStack.translate(entry.getKey().x, y, entry.getKey().z);
                ccrs.bind(ICRenderTypes.layersRenderType, getter, renderStack);

                entry.getValue().renderTile(ccrs, RedundantTransformation.INSTANCE, Minecraft.getInstance().getPartialTick());

                renderStack.popPose();
            }

            if (y == currentLayer) {
                eventReceiver.onRenderOverlay(this, worldPos, isFirstHit, ccrs, getter, renderStack);
            }
        }

        // Edit mode grid effect
        if (!editor.getStateMachine().isSimulating()) {
            TileCoord minBounds = editor.getTileMap().getMinBounds();
            TileCoord maxBounds = editor.getTileMap().getMaxBounds();
            double girdHeight = 2;
            Cuboid6 bounds = new Cuboid6(minBounds.x, currentLayer - girdHeight - 1, minBounds.z, maxBounds.x + 1, currentLayer + girdHeight, maxBounds.z + 1).expand(0.01);
            ICRenderTypes.renderGridInBounds(renderStack, getter, bounds, 0x7);
        }

        // Force-end the batch to make sure it happens before the custom viewport is altered
        getter.endBatch();
    }
Apply a camera delta based on NDC delta
@param delta Amount to pan camera in frame NDC units
fabrication/src/main/java/mrtjp/projectred/fabrication/gui/ICRenderNode.java