use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.
the class ItemAmountSignGui method getContainer.
@Override
public DummyContainer getContainer(EntityPlayer player) {
LogisticsTileGenericPipe pipe = getTileAs(player.world, LogisticsTileGenericPipe.class);
if (!(pipe.pipe instanceof CoreRoutedPipe)) {
return null;
}
ItemAmountPipeSign sign = ((ItemAmountPipeSign) ((CoreRoutedPipe) pipe.pipe).getPipeSign(dir));
Objects.requireNonNull(sign);
DummyContainer dummy = new DummyContainer(player.inventory, sign.itemTypeInv);
dummy.addDummySlot(0, 0, 0);
dummy.addNormalSlotsForPlayerInventory(0, 0);
return dummy;
}
use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.
the class EnderIOTransceiverConnection method getConnections.
@Override
public Collection<TileEntity> getConnections(TileEntity tile) {
boolean onlyOnePipe = false;
for (EnumFacing direction : EnumFacing.VALUES) {
DoubleCoordinates p = CoordinateUtils.add(new DoubleCoordinates(tile), direction);
TileEntity candidate = p.getTileEntity(tile.getWorld());
if (candidate instanceof LogisticsTileGenericPipe && MainProxy.checkPipesConnections(tile, candidate, direction)) {
if (onlyOnePipe) {
onlyOnePipe = false;
break;
} else {
onlyOnePipe = true;
}
}
}
if (!onlyOnePipe || !SimpleServiceLocator.enderIOProxy.isSendAndReceive(tile)) {
return new ArrayList<>(0);
}
List<? extends TileEntity> connections = SimpleServiceLocator.enderIOProxy.getConnectedTransceivers(tile);
Set<TileEntity> set = new HashSet<>();
for (TileEntity connected : connections) {
if (!SimpleServiceLocator.enderIOProxy.isSendAndReceive(connected)) {
continue;
}
LogisticsTileGenericPipe pipe = null;
for (EnumFacing direction : EnumFacing.VALUES) {
DoubleCoordinates p = CoordinateUtils.add(new DoubleCoordinates(connected), direction);
TileEntity candidate = p.getTileEntity(tile.getWorld());
if (candidate instanceof LogisticsTileGenericPipe && MainProxy.checkPipesConnections(connected, candidate, direction)) {
if (pipe != null) {
pipe = null;
break;
} else {
pipe = (LogisticsTileGenericPipe) candidate;
}
}
}
if (pipe != null && pipe.pipe instanceof CoreRoutedPipe) {
set.add(pipe);
}
}
if (set.size() == 1) {
return set;
} else {
return new ArrayList<>(0);
}
}
use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.
the class ItemModule method onItemUse.
@Override
@Nonnull
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (MainProxy.isServer(player.world)) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof LogisticsTileGenericPipe) {
if (player.getDisplayName().getUnformattedText().equals("ComputerCraft")) {
// Allow turtle to place modules in pipes.
CoreUnroutedPipe pipe = LogisticsBlockGenericPipe.getPipe(world, pos);
if (LogisticsBlockGenericPipe.isValid(pipe)) {
pipe.blockActivated(player);
}
}
return EnumActionResult.PASS;
}
openConfigGui(player.inventory.getCurrentItem(), player, world);
}
return EnumActionResult.PASS;
}
use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.
the class TileBuffer method refresh.
public void refresh() {
if (tile instanceof LogisticsTileGenericPipe && ((LogisticsTileGenericPipe) tile).pipe != null && ((LogisticsTileGenericPipe) tile).pipe.preventRemove()) {
if (world.getBlockState(new BlockPos(x, y, z)) == null) {
return;
}
}
tile = null;
block = null;
if (!loadUnloaded) {
return;
}
IBlockState blockState = world.getBlockState(new BlockPos(x, y, z));
block = blockState != null ? blockState.getBlock() : null;
if (block != null && block.hasTileEntity(world.getBlockState(new BlockPos(x, y, z)))) {
tile = world.getTileEntity(new BlockPos(x, y, z));
}
}
use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.
the class PipeMultiBlockTransportLogistics method handleTileReachedServer.
@Override
protected void handleTileReachedServer(LPTravelingItemServer arrivingItem, TileEntity tile, EnumFacing dir) {
markChunkModified(tile);
if (tile instanceof LogisticsTileGenericPipe && ((LogisticsTileGenericPipe) tile).pipe instanceof CoreMultiBlockPipe) {
passToNextPipe(arrivingItem, tile);
return;
} else if (tile instanceof LogisticsTileGenericSubMultiBlock) {
List<LogisticsTileGenericPipe> masterTile = ((LogisticsTileGenericSubMultiBlock) tile).getMainPipe();
if (!masterTile.isEmpty()) {
if (masterTile.size() > 1) {
throw new UnsupportedOperationException();
}
passToNextPipe(arrivingItem, masterTile.get(0));
return;
}
}
Explosion explosion = new Explosion(this.getWorld(), null, this.getPipe().getX(), this.getPipe().getY(), this.getPipe().getZ(), 4.0F, false, true);
explosion.doExplosionB(true);
}
Aggregations