use of crazypants.enderio.conduits.conduit.TileConduitBundle in project EnderIO by SleepyTrousers.
the class TileInventoryPanel method scanNetwork.
private void scanNetwork() {
EnumFacing facingDir = getFacing();
EnumFacing backside = facingDir.getOpposite();
ItemConduitNetwork icn = null;
BlockPos p = pos.offset(backside);
TileEntity te = world.getTileEntity(p);
if (te instanceof TileConduitBundle) {
TileConduitBundle teCB = (TileConduitBundle) te;
ItemConduit conduit = teCB.getConduit(ItemConduit.class);
if (conduit != null) {
icn = (ItemConduitNetwork) conduit.getNetwork();
}
}
if (icn != null) {
dbServer = icn.getDatabase();
dbServer.sendChangeLogs();
refuelPower(dbServer);
if (active != dbServer.isOperational()) {
active = dbServer.isOperational();
updateClients = true;
}
} else {
if (active) {
updateClients = true;
}
dbServer = null;
active = false;
}
}
use of crazypants.enderio.conduits.conduit.TileConduitBundle in project EnderIO by SleepyTrousers.
the class AbstractConduitPacket method getConduit.
@SuppressWarnings("unchecked")
@Nullable
public T getConduit(MessageContext ctx) {
if (ctx.side == Side.SERVER) {
if (ctx.getServerHandler().player.openContainer instanceof ExternalConnectionContainer) {
final TileConduitBundle tileEntity = ((ExternalConnectionContainer) ctx.getServerHandler().player.openContainer).getTileEntity();
if (tileEntity == null || !tileEntity.getPos().equals(getPos())) {
Log.warn("Player " + ctx.getServerHandler().player.getName() + " tried to manipulate conduit while having another conduit's GUI open!");
return null;
}
} else {
if (BlockCoord.get(ctx.getServerHandler().player).distanceSq(getPos()) > EnderIO.proxy.getReachDistanceForPlayer(ctx.getServerHandler().player)) {
Log.warn("Player " + ctx.getServerHandler().player.getName() + " tried to manipulate conduit without having its GUI open or being near it!");
return null;
}
}
}
World world = getWorld(ctx);
TileEntity tileEntity = getTileEntity(world);
if (tileEntity instanceof IConduitBundle) {
return (T) ((IConduitBundle) tileEntity).getConduit(getConType());
}
return null;
}
use of crazypants.enderio.conduits.conduit.TileConduitBundle in project EnderIO by SleepyTrousers.
the class ConduitRenderMapper method mapBlockRender.
@Override
public List<IBlockState> mapBlockRender(@Nonnull IBlockStateWrapper state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, BlockRenderLayer blockLayer, @Nonnull QuadCollector quadCollector) {
TileEntity tileEntity = state.getTileEntity();
if (tileEntity instanceof TileConduitBundle) {
IBlockState paintSource = ((TileConduitBundle) tileEntity).getPaintSource();
if (paintSource != null && (paintSource.isOpaqueCube() || ((TileConduitBundle) tileEntity).getFacadeType().isTransparent()) && !state.getYetaDisplayMode().isHideFacades()) {
return null;
}
List<BakedQuad> quads = ConduitBundleRenderManager.instance.getConduitBundleRenderer().getGeneralQuads(state, blockLayer);
quadCollector.addQuads(null, blockLayer, quads);
}
return null;
}
Aggregations