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();
}
}
}
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));
}
}
}
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;
}
Aggregations