use of net.minecraft.world.ChunkCache in project RFTools by McJty.
the class LiquidMonitorBlock method getActualState.
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
TileEntity te = world instanceof ChunkCache ? ((ChunkCache) world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos);
int level = 0;
if (te instanceof LiquidMonitorBlockTileEntity) {
level = ((LiquidMonitorBlockTileEntity) te).getFluidLevel();
}
return state.withProperty(LEVEL, level);
}
use of net.minecraft.world.ChunkCache in project RFTools by McJty.
the class RFMonitorBlock method getActualState.
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
TileEntity te = world instanceof ChunkCache ? ((ChunkCache) world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos);
int level = 0;
if (te instanceof RFMonitorBlockTileEntity) {
level = ((RFMonitorBlockTileEntity) te).getRflevel();
}
return state.withProperty(LEVEL, level);
}
use of net.minecraft.world.ChunkCache in project RFTools by McJty.
the class BlockProtectorBlock method getActualState.
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
TileEntity te = world instanceof ChunkCache ? ((ChunkCache) world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos);
boolean working = false;
if (te instanceof BlockProtectorTileEntity) {
working = ((BlockProtectorTileEntity) te).isActive();
}
return state.withProperty(WORKING, working);
}
use of net.minecraft.world.ChunkCache in project DynamicSurroundings by OreCruncher.
the class PassThroughChunkCache method update.
@Override
public void update(@Nonnull final World world, @Nonnull final BlockPos min, @Nonnull final BlockPos max) {
final ChunkPos from = new ChunkPos(min);
final ChunkPos to = new ChunkPos(max);
if (this.anyEmpty || this.world != world || from.x < this.minCX || from.z < this.minCZ || to.x > this.maxCX || to.z > this.maxCZ) {
if (this.world != world)
this.worldRef++;
this.ref++;
this.world = world;
this.minCX = from.x;
this.minCZ = from.z;
this.maxCX = to.x;
this.maxCZ = to.z;
this.cache = new ChunkCache(world, min, max, 0);
this.anyEmpty = false;
for (int cX = this.minCX; cX <= this.maxCX; cX++) for (int cZ = this.minCZ; cZ <= this.maxCZ; cZ++) if (!this.world.isChunkGeneratedAt(cX, cZ)) {
this.anyEmpty = true;
break;
}
}
}
use of net.minecraft.world.ChunkCache in project Railcraft by Railcraft.
the class RenderBlockLamp method canConnect.
private boolean canConnect(IBlockAccess world, int x, int y, int z, EnumFacing side) {
int sx = MiscTools.getXOnSide(x, side);
int sy = MiscTools.getYOnSide(y, side);
int sz = MiscTools.getZOnSide(z, side);
if (world.isSideSolid(sx, sy, sz, side.getOpposite(), false))
return true;
if (side == EnumFacing.DOWN) {
if (World.doesBlockHaveSolidTopSurface(world, sx, sy, sz))
return true;
if (world instanceof ChunkCache) {
Block block = WorldPlugin.getBlock(world, sx, sy, sz);
if (block != null && block.canPlaceTorchOnTop(Minecraft.getMinecraft().theWorld, sx, sy, sz))
return true;
}
}
Block block = WorldPlugin.getBlock(world, sx, sy, sz);
return block instanceof BlockPostBase;
}
Aggregations