use of com.infinityraider.agricraft.tiles.irrigation.TileEntityChannel in project AgriCraft by AgriCraft.
the class BlockWaterChannel method getBoundingBox.
@Override
@SuppressWarnings("deprecation")
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
// Fetch Tile Entity
final Optional<TileEntityChannel> tile = WorldHelper.getTile(world, pos, TileEntityChannel.class);
// Define Core Bounding Box
AxisAlignedBB selection = CENTER_BOX;
// Expand Bounding Box
if (tile.isPresent()) {
if (tile.get().hasNeighbor(EnumFacing.NORTH)) {
selection = selection.union(NORTH_BOX);
}
if (tile.get().hasNeighbor(EnumFacing.EAST)) {
selection = selection.union(EAST_BOX);
}
if (tile.get().hasNeighbor(EnumFacing.SOUTH)) {
selection = selection.union(SOUTH_BOX);
}
if (tile.get().hasNeighbor(EnumFacing.WEST)) {
selection = selection.union(WEST_BOX);
}
}
return selection;
}
use of com.infinityraider.agricraft.tiles.irrigation.TileEntityChannel in project AgriCraft by AgriCraft.
the class AbstractBlockWaterChannel method getActualState.
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
final Optional<TileEntityChannel> tile = WorldHelper.getTile(world, pos, TileEntityChannel.class);
if (!tile.isPresent()) {
return state;
}
tile.get().checkConnections();
final IrrigationConnection sides = new IrrigationConnection();
for (EnumFacing facing : EnumFacing.HORIZONTALS) {
sides.set(facing, tile.get().getConnectionType(facing));
}
return sides.write(state);
}
Aggregations