Search in sources :

Example 1 with MultiTankTileEntity

use of mcjty.rftoolscontrol.blocks.multitank.MultiTankTileEntity in project RFToolsControl by McJty.

the class ProcessorTileEntity method updateFluidSlotsAvailability.

private void updateFluidSlotsAvailability() {
    fluidSlotsAvailable = 0;
    for (EnumFacing facing : EnumFacing.values()) {
        TileEntity te = getWorld().getTileEntity(getPos().offset(facing));
        if (te instanceof MultiTankTileEntity) {
            fluidSlotsAvailable |= 1 << facing.ordinal();
        }
    }
    fixCardInfoForSlotAvailability();
    markDirty();
}
Also used : GenericEnergyReceiverTileEntity(mcjty.lib.entity.GenericEnergyReceiverTileEntity) CraftingStationTileEntity(mcjty.rftoolscontrol.blocks.craftingstation.CraftingStationTileEntity) WorkbenchTileEntity(mcjty.rftoolscontrol.blocks.workbench.WorkbenchTileEntity) NodeTileEntity(mcjty.rftoolscontrol.blocks.node.NodeTileEntity) MultiTankTileEntity(mcjty.rftoolscontrol.blocks.multitank.MultiTankTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) MultiTankTileEntity(mcjty.rftoolscontrol.blocks.multitank.MultiTankTileEntity) EnumFacing(net.minecraft.util.EnumFacing)

Example 2 with MultiTankTileEntity

use of mcjty.rftoolscontrol.blocks.multitank.MultiTankTileEntity in project RFToolsControl by McJty.

the class ProcessorTileEntity method getFluids.

public List<PacketGetFluids.FluidEntry> getFluids() {
    List<PacketGetFluids.FluidEntry> pars = new ArrayList<>();
    for (int i = 0; i < MAXFLUIDVARS; i++) {
        if (isFluidSlotAvailable(i)) {
            EnumFacing side = EnumFacing.values()[i / TANKS];
            TileEntity te = getWorld().getTileEntity(getPos().offset(side));
            if (te instanceof MultiTankTileEntity) {
                MultiTankTileEntity mtank = (MultiTankTileEntity) te;
                MultiTankFluidProperties[] propertyList = mtank.getProperties();
                IFluidTankProperties properties = propertyList[i % TANKS];
                FluidStack fluidStack = properties == null ? null : properties.getContents();
                pars.add(new PacketGetFluids.FluidEntry(fluidStack, true));
            } else {
                pars.add(new PacketGetFluids.FluidEntry(null, true));
            }
        } else {
            pars.add(new PacketGetFluids.FluidEntry(null, false));
        }
    }
    return pars;
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) EnumFacing(net.minecraft.util.EnumFacing) GenericEnergyReceiverTileEntity(mcjty.lib.entity.GenericEnergyReceiverTileEntity) CraftingStationTileEntity(mcjty.rftoolscontrol.blocks.craftingstation.CraftingStationTileEntity) WorkbenchTileEntity(mcjty.rftoolscontrol.blocks.workbench.WorkbenchTileEntity) NodeTileEntity(mcjty.rftoolscontrol.blocks.node.NodeTileEntity) MultiTankTileEntity(mcjty.rftoolscontrol.blocks.multitank.MultiTankTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) MultiTankTileEntity(mcjty.rftoolscontrol.blocks.multitank.MultiTankTileEntity) IFluidTankProperties(net.minecraftforge.fluids.capability.IFluidTankProperties) MultiTankFluidProperties(mcjty.rftoolscontrol.blocks.multitank.MultiTankFluidProperties) PacketGetFluids(mcjty.rftoolscontrol.network.PacketGetFluids)

Aggregations

GenericEnergyReceiverTileEntity (mcjty.lib.entity.GenericEnergyReceiverTileEntity)2 CraftingStationTileEntity (mcjty.rftoolscontrol.blocks.craftingstation.CraftingStationTileEntity)2 MultiTankTileEntity (mcjty.rftoolscontrol.blocks.multitank.MultiTankTileEntity)2 NodeTileEntity (mcjty.rftoolscontrol.blocks.node.NodeTileEntity)2 WorkbenchTileEntity (mcjty.rftoolscontrol.blocks.workbench.WorkbenchTileEntity)2 TileEntity (net.minecraft.tileentity.TileEntity)2 EnumFacing (net.minecraft.util.EnumFacing)2 MultiTankFluidProperties (mcjty.rftoolscontrol.blocks.multitank.MultiTankFluidProperties)1 PacketGetFluids (mcjty.rftoolscontrol.network.PacketGetFluids)1 FluidStack (net.minecraftforge.fluids.FluidStack)1 IFluidTankProperties (net.minecraftforge.fluids.capability.IFluidTankProperties)1