Search in sources :

Example 11 with ExtendedBlockStorage

use of net.minecraft.world.chunk.storage.ExtendedBlockStorage in project Engine by VoltzEngine-Project.

the class ChunkProviderEmpty method generateZBridge.

private void generateZBridge(Chunk chunk, int chunkX, int chunkZ, int y_base) {
    int l = y_base >> 4;
    ExtendedBlockStorage extendedblockstorage = chunk.getBlockStorageArray()[l];
    if (extendedblockstorage == null) {
        extendedblockstorage = new ExtendedBlockStorage(y_base, !this.worldObj.provider.hasNoSky);
        chunk.getBlockStorageArray()[l] = extendedblockstorage;
    }
    int k = y_base + 10;
    for (int cx = 6; cx < 10; ++cx) {
        for (int cz = 0; cz < 16; ++cz) {
            if (cx == 6 || cx == 9)
                extendedblockstorage.func_150818_a(cx, k & 15, cz, Blocks.stonebrick);
            else
                extendedblockstorage.func_150818_a(cx, k & 15, cz, Blocks.planks);
        }
    }
}
Also used : ExtendedBlockStorage(net.minecraft.world.chunk.storage.ExtendedBlockStorage)

Example 12 with ExtendedBlockStorage

use of net.minecraft.world.chunk.storage.ExtendedBlockStorage in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class PhysicsObject method detectBlockPositions.

// Generates the blockPos array; must be loaded DIRECTLY after the chunks are setup
public void detectBlockPositions() {
    // int minChunkX = claimedChunks[0][0].xPosition;
    // int minChunkZ = claimedChunks[0][0].zPosition;
    int chunkX, chunkZ, index, x, y, z;
    Chunk chunk;
    ExtendedBlockStorage storage;
    for (chunkX = claimedChunks.length - 1; chunkX > -1; chunkX--) {
        for (chunkZ = claimedChunks[0].length - 1; chunkZ > -1; chunkZ--) {
            chunk = claimedChunks[chunkX][chunkZ];
            if (chunk != null && ownedChunks.chunkOccupiedInLocal[chunkX][chunkZ]) {
                for (index = 0; index < 16; index++) {
                    storage = chunk.getBlockStorageArray()[index];
                    if (storage != null) {
                        for (y = 0; y < 16; y++) {
                            for (x = 0; x < 16; x++) {
                                for (z = 0; z < 16; z++) {
                                    if (storage.data.storage.getAt(y << 8 | z << 4 | x) != ValkyrienWarfareMod.airStateIndex) {
                                        BlockPos pos = new BlockPos(chunk.xPosition * 16 + x, index * 16 + y, chunk.zPosition * 16 + z);
                                        blockPositions.add(pos);
                                        if (!worldObj.isRemote) {
                                            if (BlockForce.basicForces.isBlockProvidingForce(worldObj.getBlockState(pos), pos, worldObj)) {
                                                physicsProcessor.activeForcePositions.add(pos);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : MutableBlockPos(net.minecraft.util.math.BlockPos.MutableBlockPos) BlockPos(net.minecraft.util.math.BlockPos) SPacketUnloadChunk(net.minecraft.network.play.server.SPacketUnloadChunk) Chunk(net.minecraft.world.chunk.Chunk) ExtendedBlockStorage(net.minecraft.world.chunk.storage.ExtendedBlockStorage)

Example 13 with ExtendedBlockStorage

use of net.minecraft.world.chunk.storage.ExtendedBlockStorage in project BetterWithAddons by DaedalusGame.

the class PatientiaHandler method customRandomTick.

private void customRandomTick(WorldServer world) {
    if (world.getWorldInfo().getTerrainType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
        return;
    }
    int i = world.getGameRules().getInt("randomTickSpeed");
    if (i > 0) {
        Iterator<Chunk> iterator = world.getPersistentChunkIterable(world.getPlayerChunkMap().getChunkIterator());
        while (iterator.hasNext()) {
            Chunk chunk = iterator.next();
            int j = chunk.x * 16;
            int k = chunk.z * 16;
            for (ExtendedBlockStorage extendedblockstorage : chunk.getBlockStorageArray()) {
                if (extendedblockstorage != Chunk.NULL_BLOCK_STORAGE && extendedblockstorage.needsRandomTick()) {
                    for (int i1 = 0; i1 < i; ++i1) {
                        this.updateLCG = this.updateLCG * 3 + 1013904223;
                        int j1 = this.updateLCG >> 2;
                        int k1 = j1 & 15;
                        int l1 = j1 >> 8 & 15;
                        int i2 = j1 >> 16 & 15;
                        IBlockState iblockstate = extendedblockstorage.get(k1, i2, l1);
                        Block block = iblockstate.getBlock();
                        if (getTickRandomly(block)) {
                            MinecraftForge.EVENT_BUS.post(new RandomBlockTickEvent(world, new BlockPos(k1 + j, i2 + extendedblockstorage.getYLocation(), l1 + k), iblockstate, world.rand));
                        }
                    }
                }
            }
        }
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) Block(net.minecraft.block.Block) BlockPos(net.minecraft.util.math.BlockPos) Chunk(net.minecraft.world.chunk.Chunk) ExtendedBlockStorage(net.minecraft.world.chunk.storage.ExtendedBlockStorage)

Aggregations

ExtendedBlockStorage (net.minecraft.world.chunk.storage.ExtendedBlockStorage)13 Chunk (net.minecraft.world.chunk.Chunk)8 IBlockState (net.minecraft.block.state.IBlockState)4 BlockPos (net.minecraft.util.math.BlockPos)4 MutableBlockPos (net.minecraft.util.math.BlockPos.MutableBlockPos)4 Vector (ValkyrienWarfareBase.API.Vector)3 TIntIterator (gnu.trove.iterator.TIntIterator)2 SPacketUnloadChunk (net.minecraft.network.play.server.SPacketUnloadChunk)2 VWChunkCache (ValkyrienWarfareBase.Relocation.VWChunkCache)1 Pos (com.builtbroken.mc.imp.transform.vector.Pos)1 TIntArrayList (gnu.trove.list.array.TIntArrayList)1 Field (java.lang.reflect.Field)1 Block (net.minecraft.block.Block)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 TileEntity (net.minecraft.tileentity.TileEntity)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 ChunkCache (net.minecraft.world.ChunkCache)1