Search in sources :

Example 16 with IoMode

use of crazypants.enderio.base.machine.modes.IoMode in project EnderIO by SleepyTrousers.

the class TileTransceiver method canReceive.

// ---------------- Fluid Handling
public boolean canReceive(Set<Channel> channels, Fluid fluid) {
    if (inFluidFill) {
        return false;
    }
    if (!hasRecieveChannel(channels, ChannelType.FLUID)) {
        return false;
    }
    FluidStack offer = new FluidStack(fluid, 1);
    Map<EnumFacing, IFluidWrapper> neighbours = FluidWrapper.wrapNeighbours(world, pos);
    for (Entry<EnumFacing, IFluidWrapper> entry : neighbours.entrySet()) {
        IoMode mode = getIoMode(entry.getKey());
        if (mode.canOutput() && entry.getValue().offer(offer) > 0) {
            return true;
        }
    }
    return false;
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) EnumFacing(net.minecraft.util.EnumFacing) IFluidWrapper(com.enderio.core.common.fluid.IFluidWrapper) IoMode(crazypants.enderio.base.machine.modes.IoMode)

Aggregations

IoMode (crazypants.enderio.base.machine.modes.IoMode)16 EnumFacing (net.minecraft.util.EnumFacing)8 EnumIOMode (crazypants.enderio.base.render.property.IOMode.EnumIOMode)4 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)4 EnumMap (java.util.EnumMap)3 Nonnull (javax.annotation.Nonnull)3 IPowerInterface (crazypants.enderio.base.power.IPowerInterface)2 Rectangle (java.awt.Rectangle)2 IBlockState (net.minecraft.block.state.IBlockState)2 IFluidWrapper (com.enderio.core.common.fluid.IFluidWrapper)1 Vector4f (com.enderio.core.common.vecmath.Vector4f)1 IConduitBundle (crazypants.enderio.base.conduit.IConduitBundle)1 SlotDefinition (crazypants.enderio.base.machine.baselegacy.SlotDefinition)1 PacketIoMode (crazypants.enderio.base.machine.modes.PacketIoMode)1 BlockCapBank (crazypants.enderio.powertools.machine.capbank.BlockCapBank)1 InfoDisplayType (crazypants.enderio.powertools.machine.capbank.InfoDisplayType)1 TileCapBank (crazypants.enderio.powertools.machine.capbank.TileCapBank)1 EnergyReceptor (crazypants.enderio.powertools.machine.capbank.network.EnergyReceptor)1 ArrayList (java.util.ArrayList)1 Entry (java.util.Map.Entry)1