Search in sources :

Example 1 with DiversionTransporter

use of mekanism.common.content.network.transmitter.DiversionTransporter in project Mekanism by mekanism.

the class RenderLogisticalTransporter method render.

@Override
protected void render(TileEntityLogisticalTransporterBase tile, float partialTick, MatrixStack matrix, IRenderTypeBuffer renderer, int light, int overlayLight, IProfiler profiler) {
    LogisticalTransporterBase transporter = tile.getTransmitter();
    Collection<TransporterStack> inTransit = transporter.getTransit();
    BlockPos pos = tile.getBlockPos();
    if (!inTransit.isEmpty()) {
        matrix.pushPose();
        itemRenderer.init(tile.getLevel(), pos);
        float partial = partialTick * transporter.tier.getSpeed();
        Collection<TransporterStack> reducedTransit = getReducedTransit(inTransit);
        for (TransporterStack stack : reducedTransit) {
            float[] stackPos = TransporterUtils.getStackPosition(transporter, stack, partial);
            matrix.pushPose();
            matrix.translate(stackPos[0], stackPos[1], stackPos[2]);
            matrix.scale(0.75F, 0.75F, 0.75F);
            itemRenderer.renderAsStack(matrix, renderer, stack.itemStack);
            matrix.popPose();
            if (stack.color != null) {
                modelBox.render(matrix, renderer, MekanismRenderer.FULL_LIGHT, overlayLight, stackPos[0], stackPos[1], stackPos[2], stack.color);
            }
        }
        matrix.popPose();
    }
    if (transporter instanceof DiversionTransporter) {
        PlayerEntity player = Minecraft.getInstance().player;
        ItemStack itemStack = player.inventory.getSelected();
        if (!itemStack.isEmpty() && itemStack.getItem() instanceof ItemConfigurator) {
            BlockRayTraceResult rayTraceResult = MekanismUtils.rayTrace(player);
            if (!rayTraceResult.getType().equals(Type.MISS) && rayTraceResult.getBlockPos().equals(pos)) {
                Direction side = tile.getSideLookingAt(player, rayTraceResult.getDirection());
                matrix.pushPose();
                matrix.scale(0.5F, 0.5F, 0.5F);
                matrix.translate(0.5, 0.5, 0.5);
                MekanismRenderer.renderObject(getOverlayModel((DiversionTransporter) transporter, side), matrix, renderer.getBuffer(Atlases.translucentCullBlockSheet()), MekanismRenderer.getColorARGB(255, 255, 255, 0.8F), MekanismRenderer.FULL_LIGHT, overlayLight, FaceDisplay.FRONT);
                matrix.popPose();
            }
        }
    }
}
Also used : TransporterStack(mekanism.common.content.transporter.TransporterStack) ItemConfigurator(mekanism.common.item.ItemConfigurator) BlockPos(net.minecraft.util.math.BlockPos) BlockRayTraceResult(net.minecraft.util.math.BlockRayTraceResult) LogisticalTransporterBase(mekanism.common.content.network.transmitter.LogisticalTransporterBase) TileEntityLogisticalTransporterBase(mekanism.common.tile.transmitter.TileEntityLogisticalTransporterBase) DiversionTransporter(mekanism.common.content.network.transmitter.DiversionTransporter) ItemStack(net.minecraft.item.ItemStack) Direction(net.minecraft.util.Direction) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Example 2 with DiversionTransporter

use of mekanism.common.content.network.transmitter.DiversionTransporter in project Mekanism by mekanism.

the class TileEntityDiversionTransporter method incrementMode.

@ComputerMethod
private void incrementMode(Direction side) {
    DiversionTransporter transmitter = getTransmitter();
    transmitter.updateMode(side, transmitter.modes[side.ordinal()].getNext());
}
Also used : DiversionTransporter(mekanism.common.content.network.transmitter.DiversionTransporter) ComputerMethod(mekanism.common.integration.computer.annotation.ComputerMethod)

Example 3 with DiversionTransporter

use of mekanism.common.content.network.transmitter.DiversionTransporter in project Mekanism by mekanism.

the class TileEntityDiversionTransporter method decrementMode.

@ComputerMethod
private void decrementMode(Direction side) {
    DiversionTransporter transmitter = getTransmitter();
    transmitter.updateMode(side, transmitter.modes[side.ordinal()].getPrevious());
}
Also used : DiversionTransporter(mekanism.common.content.network.transmitter.DiversionTransporter) ComputerMethod(mekanism.common.integration.computer.annotation.ComputerMethod)

Aggregations

DiversionTransporter (mekanism.common.content.network.transmitter.DiversionTransporter)3 ComputerMethod (mekanism.common.integration.computer.annotation.ComputerMethod)2 LogisticalTransporterBase (mekanism.common.content.network.transmitter.LogisticalTransporterBase)1 TransporterStack (mekanism.common.content.transporter.TransporterStack)1 ItemConfigurator (mekanism.common.item.ItemConfigurator)1 TileEntityLogisticalTransporterBase (mekanism.common.tile.transmitter.TileEntityLogisticalTransporterBase)1 PlayerEntity (net.minecraft.entity.player.PlayerEntity)1 ItemStack (net.minecraft.item.ItemStack)1 Direction (net.minecraft.util.Direction)1 BlockPos (net.minecraft.util.math.BlockPos)1 BlockRayTraceResult (net.minecraft.util.math.BlockRayTraceResult)1