use of logisticspipes.utils.FluidIdentifierStack in project LogisticsPipes by RS485.
the class PipeFluidExtractor method extractFrom.
private void extractFrom(ITankUtil container, EnumFacing side) {
int sideID = side.ordinal();
FluidStack contained = ((PipeFluidTransportLogistics) transport).getTankProperties(side)[0].getContents();
int amountMissing = ((PipeFluidTransportLogistics) transport).getSideCapacity() - (contained != null ? contained.amount : 0);
if (liquidToExtract[sideID] < Math.min(PipeFluidExtractor.flowRate, amountMissing)) {
if (this.useEnergy(PipeFluidExtractor.energyPerFlow)) {
liquidToExtract[sideID] += Math.min(PipeFluidExtractor.flowRate, amountMissing);
}
}
FluidIdentifierStack extracted = container.drain(Math.min(liquidToExtract[sideID], PipeFluidExtractor.flowRate), false);
int inserted = 0;
if (extracted != null) {
inserted = ((PipeFluidTransportLogistics) transport).fill(side, extracted.makeFluidStack(), true);
container.drain(inserted, true);
}
liquidToExtract[sideID] -= inserted;
}
use of logisticspipes.utils.FluidIdentifierStack in project LogisticsPipes by RS485.
the class PipeItemsFluidSupplier method endReached.
public void endReached(LPTravelingItemServer data, TileEntity tile) {
getCacheHolder().trigger(CacheTypes.Inventory);
transport.markChunkModified(tile);
notifyOfItemArival(data.getInfo());
EnumFacing orientation = data.output.getOpposite();
if (getOriginalUpgradeManager().hasSneakyUpgrade()) {
orientation = getOriginalUpgradeManager().getSneakyOrientation();
}
ITankUtil util = SimpleServiceLocator.tankUtilFactory.getTankUtilForTE(tile, orientation);
if (util == null) {
return;
}
if (SimpleServiceLocator.pipeInformationManager.isItemPipe(tile)) {
return;
}
if (data.getItemIdentifierStack() == null) {
return;
}
FluidIdentifierStack liquidId = FluidIdentifierStack.getFromStack(data.getItemIdentifierStack());
if (liquidId == null) {
return;
}
while (data.getItemIdentifierStack().getStackSize() > 0 && util.fill(liquidId, false) == liquidId.getAmount() && this.useEnergy(5)) {
util.fill(liquidId, true);
data.getItemIdentifierStack().lowerStackSize(1);
Item item = data.getItemIdentifierStack().getItem().item;
if (item.hasContainerItem(data.getItemIdentifierStack().makeNormalStack())) {
Item containerItem = Objects.requireNonNull(item.getContainerItem());
transport.sendItem(new ItemStack(containerItem, 1));
}
}
}
use of logisticspipes.utils.FluidIdentifierStack in project LogisticsPipes by RS485.
the class LogisticsNewPipeItemBoxRenderer method doRenderItem.
@SideOnly(Side.CLIENT)
public void doRenderItem(@Nonnull ItemStack itemstack, float light, double x, double y, double z, double boxScale, double yaw, double pitch, double yawForPitch) {
if (LogisticsNewRenderPipe.innerTransportBox == null)
return;
GL11.glPushMatrix();
if (renderList == -1) {
renderList = GLAllocation.generateDisplayLists(1);
GL11.glNewList(renderList, GL11.GL_COMPILE);
SimpleServiceLocator.cclProxy.getRenderState().reset();
SimpleServiceLocator.cclProxy.getRenderState().startDrawing(GL11.GL_QUADS, DefaultVertexFormats.OLDMODEL_POSITION_TEX_NORMAL);
LogisticsNewRenderPipe.innerTransportBox.render(LogisticsNewRenderPipe.innerBoxTexture);
SimpleServiceLocator.cclProxy.getRenderState().draw();
GL11.glEndList();
}
GL11.glTranslated(x, y, z);
Minecraft.getMinecraft().getTextureManager().bindTexture(LogisticsNewPipeItemBoxRenderer.BLOCKS);
GL11.glScaled(boxScale, boxScale, boxScale);
GL11.glRotated(yawForPitch, 0, 1, 0);
GL11.glRotated(pitch, 1, 0, 0);
GL11.glRotated(-yawForPitch, 0, 1, 0);
GL11.glRotated(yaw, 0, 1, 0);
GL11.glTranslated(-0.5, -0.5, -0.5);
GL11.glCallList(renderList);
GL11.glTranslated(0.5, 0.5, 0.5);
GL11.glRotated(-pitch, 1, 0, 0);
GL11.glRotated(-yaw, 0, 1, 0);
GL11.glScaled(1 / boxScale, 1 / boxScale, 1 / boxScale);
GL11.glTranslated(-0.5, -0.5, -0.5);
if (!itemstack.isEmpty() && itemstack.getItem() instanceof LogisticsFluidContainer) {
FluidIdentifierStack f = SimpleServiceLocator.logisticsFluidManager.getFluidFromContainer(ItemIdentifierStack.getFromStack(itemstack));
if (f != null) {
/*
FluidContainerRenderer.skipNext = true;
int list = getRenderListFor(f);
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glCallList(list);
GL11.glPopAttrib();
*/
}
}
GL11.glPopMatrix();
}
Aggregations