Search in sources :

Example 1 with BoxedChemicalNetwork

use of mekanism.common.content.network.BoxedChemicalNetwork in project Mekanism by mekanism.

the class RenderPressurizedTube method render.

@Override
protected void render(TileEntityPressurizedTube tile, float partialTick, MatrixStack matrix, IRenderTypeBuffer renderer, int light, int overlayLight, IProfiler profiler) {
    BoxedPressurizedTube tube = tile.getTransmitter();
    if (tube.hasTransmitterNetwork()) {
        BoxedChemicalNetwork network = tube.getTransmitterNetwork();
        if (!network.lastChemical.isEmpty() && !network.isTankEmpty() && network.currentScale > 0) {
            matrix.pushPose();
            matrix.translate(0.5, 0.5, 0.5);
            Chemical<?> chemical = network.lastChemical.getChemical();
            renderModel(tile, matrix, renderer.getBuffer(Atlases.translucentCullBlockSheet()), chemical.getTint(), Math.max(0.2F, network.currentScale), MekanismRenderer.FULL_LIGHT, overlayLight, MekanismRenderer.getChemicalTexture(chemical));
            matrix.popPose();
        }
    }
}
Also used : BoxedPressurizedTube(mekanism.common.content.network.transmitter.BoxedPressurizedTube) BoxedChemicalNetwork(mekanism.common.content.network.BoxedChemicalNetwork)

Example 2 with BoxedChemicalNetwork

use of mekanism.common.content.network.BoxedChemicalNetwork in project Mekanism by mekanism.

the class BoxedPressurizedTube method takeShare.

@Override
public void takeShare() {
    if (hasTransmitterNetwork()) {
        BoxedChemicalNetwork transmitterNetwork = getTransmitterNetwork();
        Current networkCurrent = transmitterNetwork.chemicalTank.getCurrent();
        if (networkCurrent != Current.EMPTY && !saveShare.isEmpty()) {
            ChemicalStack<?> chemicalStack = saveShare.getChemicalStack();
            long amount = chemicalStack.getAmount();
            MekanismUtils.logMismatchedStackSize(transmitterNetwork.chemicalTank.getTankFromCurrent(networkCurrent).shrinkStack(amount, Action.EXECUTE), amount);
            setStackClearOthers(chemicalStack, chemicalTank.getTankFromCurrent(networkCurrent));
        }
    }
}
Also used : BoxedChemicalNetwork(mekanism.common.content.network.BoxedChemicalNetwork) Current(mekanism.api.chemical.merged.MergedChemicalTank.Current)

Example 3 with BoxedChemicalNetwork

use of mekanism.common.content.network.BoxedChemicalNetwork in project Mekanism by mekanism.

the class TileEntityPressurizedTube method getUpdateTag.

@Nonnull
@Override
public CompoundNBT getUpdateTag() {
    // Note: We add the stored information to the initial update tag and not to the one we sync on side changes which uses getReducedUpdateTag
    CompoundNBT updateTag = super.getUpdateTag();
    if (getTransmitter().hasTransmitterNetwork()) {
        BoxedChemicalNetwork network = getTransmitter().getTransmitterNetwork();
        updateTag.put(NBTConstants.BOXED_CHEMICAL, network.lastChemical.write(new CompoundNBT()));
        updateTag.putFloat(NBTConstants.SCALE, network.currentScale);
    }
    return updateTag;
}
Also used : BoxedChemicalNetwork(mekanism.common.content.network.BoxedChemicalNetwork) CompoundNBT(net.minecraft.nbt.CompoundNBT) Nonnull(javax.annotation.Nonnull)

Aggregations

BoxedChemicalNetwork (mekanism.common.content.network.BoxedChemicalNetwork)3 Nonnull (javax.annotation.Nonnull)1 Current (mekanism.api.chemical.merged.MergedChemicalTank.Current)1 BoxedPressurizedTube (mekanism.common.content.network.transmitter.BoxedPressurizedTube)1 CompoundNBT (net.minecraft.nbt.CompoundNBT)1