Search in sources :

Example 1 with TubeLogic

use of com.bluepowermod.part.tube.TubeLogic in project BluePower by Qmunity.

the class IOHelper method insert.

public static ItemStack insert(TileEntity tile, ItemStack itemStack, ForgeDirection direction, TubeColor color, boolean simulate) {
    if (tile == null || itemStack == null)
        return itemStack;
    if (tile instanceof ITubeConnection) {
        TubeStack tubeStack = ((ITubeConnection) tile).acceptItemFromTube(new TubeStack(itemStack, direction.getOpposite(), color), direction, simulate);
        if (tubeStack == null)
            return null;
        return tubeStack.stack;
    }
    IInventory inv = getInventoryForTE(tile);
    if (inv != null)
        return insert(inv, itemStack, direction.ordinal(), simulate);
    PneumaticTube tube = MultipartCompatibility.getPart(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, PneumaticTube.class);
    if (tube != null) {
        // we don't need to check connections, that's catched earlier.
        TubeLogic logic = tube.getLogic();
        return logic.injectStack(itemStack, direction.getOpposite(), color, simulate) ? null : itemStack;
    }
    return itemStack;
}
Also used : ITubeConnection(com.bluepowermod.api.tube.ITubeConnection) IInventory(net.minecraft.inventory.IInventory) PneumaticTube(com.bluepowermod.part.tube.PneumaticTube) TubeStack(com.bluepowermod.part.tube.TubeStack) TubeLogic(com.bluepowermod.part.tube.TubeLogic)

Example 2 with TubeLogic

use of com.bluepowermod.part.tube.TubeLogic in project BluePower by Qmunity.

the class MessageRedirectTubeStack method handleClientSide.

@Override
public void handleClientSide(EntityPlayer player) {
    PneumaticTube tube = MultipartCompatibility.getPart(player.worldObj, x, y, z, PneumaticTube.class);
    if (tube == null)
        return;
    TubeLogic logic = tube.getLogic();
    if (logic == null)
        return;
    logic.onClientTubeRedirectPacket(stack);
}
Also used : PneumaticTube(com.bluepowermod.part.tube.PneumaticTube) TubeLogic(com.bluepowermod.part.tube.TubeLogic)

Aggregations

PneumaticTube (com.bluepowermod.part.tube.PneumaticTube)2 TubeLogic (com.bluepowermod.part.tube.TubeLogic)2 ITubeConnection (com.bluepowermod.api.tube.ITubeConnection)1 TubeStack (com.bluepowermod.part.tube.TubeStack)1 IInventory (net.minecraft.inventory.IInventory)1