Search in sources :

Example 11 with ChunkCache

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);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ChunkCache(net.minecraft.world.ChunkCache)

Example 12 with ChunkCache

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);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ChunkCache(net.minecraft.world.ChunkCache)

Example 13 with ChunkCache

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);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ChunkCache(net.minecraft.world.ChunkCache)

Example 14 with ChunkCache

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;
        }
    }
}
Also used : ChunkCache(net.minecraft.world.ChunkCache) ChunkPos(net.minecraft.util.math.ChunkPos)

Example 15 with ChunkCache

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;
}
Also used : ChunkCache(net.minecraft.world.ChunkCache) Block(net.minecraft.block.Block) BlockPostBase(mods.railcraft.common.blocks.aesthetics.post.BlockPostBase)

Aggregations

ChunkCache (net.minecraft.world.ChunkCache)36 TileEntity (net.minecraft.tileentity.TileEntity)16 BlockPos (net.minecraft.util.math.BlockPos)9 IBlockState (net.minecraft.block.state.IBlockState)8 Block (net.minecraft.block.Block)5 World (net.minecraft.world.World)5 LazyBlockState (com.almuradev.content.type.block.state.LazyBlockState)4 WeightedLazyBlockState (com.almuradev.content.util.WeightedLazyBlockState)4 ArrayList (java.util.ArrayList)4 BlockBush (net.minecraft.block.BlockBush)4 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)4 IBlockAccess (net.minecraft.world.IBlockAccess)4 TIntArrayList (gnu.trove.list.array.TIntArrayList)3 BlockCactus (net.minecraft.block.BlockCactus)3 ItemStack (net.minecraft.item.ItemStack)3 PathEntity (net.minecraft.pathfinding.PathEntity)3 PathPoint (net.minecraft.pathfinding.PathPoint)3 MutableBlockPos (net.minecraft.util.math.BlockPos.MutableBlockPos)3 Chunk (net.minecraft.world.chunk.Chunk)3 ExtendedBlockStorage (net.minecraft.world.chunk.storage.ExtendedBlockStorage)3