use of com.bluepowermod.part.tube.PneumaticTube in project BluePower by Qmunity.
the class PartConverterTube method convert.
@Override
public IPart convert(NBTTagCompound old) {
PartInfo info = PartManager.getPartInfo(old.getString("part_id"));
if (info == null)
return null;
PneumaticTube part = (PneumaticTube) info.create();
part.readFromNBT(old.getCompoundTag("partData"));
return part;
}
use of com.bluepowermod.part.tube.PneumaticTube in project BluePower by Qmunity.
the class TileManager method retrieveItemsFromManagers.
private void retrieveItemsFromManagers() {
PneumaticTube tube = MultipartCompatibility.getPart(worldObj, xCoord + getOutputDirection().offsetX, yCoord + getOutputDirection().offsetY, zCoord + getOutputDirection().offsetZ, PneumaticTube.class);
if (tube != null) {
for (ItemStack stack : inventory) {
int acceptedItems = acceptedItems(stack);
if (acceptedItems > 0) {
ItemStack retrievingStack = stack.copy();
retrievingStack.stackSize = retrievingStack.getMaxStackSize();
if (tube.getLogic().retrieveStack(this, getOutputDirection(), retrievingStack, filterColor))
return;
}
}
}
}
use of com.bluepowermod.part.tube.PneumaticTube 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;
}
use of com.bluepowermod.part.tube.PneumaticTube 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);
}
use of com.bluepowermod.part.tube.PneumaticTube in project BluePower by Qmunity.
the class TileRetriever method pullItem.
@Override
protected void pullItem() {
if (isBufferEmpty()) {
PneumaticTube tube = MultipartCompatibility.getPart(worldObj, xCoord + getFacingDirection().offsetX, yCoord + getFacingDirection().offsetY, zCoord + getFacingDirection().offsetZ, PneumaticTube.class);
if (tube != null) {
boolean everythingNull = true;
for (int i = 0; i < inventory.length; i++) {
if (mode == 1 || slotIndex == i) {
ItemStack stack = inventory[i];
if (stack != null) {
if (tube.getLogic().retrieveStack(this, getFacingDirection(), stack)) {
if (mode == 0) {
if (++slotIndex >= inventory.length)
slotIndex = 0;
while (slotIndex != i) {
if (inventory[slotIndex] != null)
break;
if (++slotIndex >= inventory.length)
slotIndex = 0;
}
}
return;
}
everythingNull = false;
}
}
}
if (everythingNull) {
tube.getLogic().retrieveStack(this, getFacingDirection(), null);
slotIndex = 0;
}
} else {
super.pullItem();
}
}
}
Aggregations