Search in sources :

Example 6 with ExtendedBlockStorage

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

the class ChunkProviderEmpty method generateXBridge.

private void generateXBridge(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 = 0; cx < 16; ++cx) {
        for (int cz = 6; cz < 10; ++cz) {
            if (cz == 6 || cz == 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 7 with ExtendedBlockStorage

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

the class ChunkProviderEmpty method generateSpawnCenter.

private void generateSpawnCenter(Chunk chunk, int chunkX, int chunkZ, int y_base) {
    //Generate spawn platform
    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 = 0; cx < 16; ++cx) {
        for (int cz = 0; cz < 16; ++cz) {
            //corners of glowstone
            if ((cx == 0 || cx == 15) && (cz == 0 || cz == 15))
                extendedblockstorage.func_150818_a(cx, k & 15, cz, Blocks.glowstone);
            else //edges of stone bricks excluding bridge connections
            if ((cx == 0 || cx == 15 || cz == 0 || cz == 15) && cz != 7 && cz != 8 && cx != 7 && cx != 8)
                extendedblockstorage.func_150818_a(cx, k & 15, cz, Blocks.stonebrick);
            else //center of grass
            if ((cx == 8 || cx == 7) && (cz == 8 || cz == 7))
                extendedblockstorage.func_150818_a(cx, k & 15, cz, Blocks.grass);
            else
                //reset stone
                extendedblockstorage.func_150818_a(cx, k & 15, cz, Blocks.stone);
        }
    }
    k = y_base + 9;
    for (int cx = 0; cx < 16; ++cx) {
        for (int cz = 0; cz < 16; ++cz) {
            extendedblockstorage.func_150818_a(cx, k & 15, cz, Blocks.stone);
        //extendedblockstorage.setExtBlockMetadata(cx, k & 15, cz, 0);
        }
    }
    k = y_base + 8;
    for (int cx = 1; cx < 15; ++cx) {
        for (int cz = 1; cz < 15; ++cz) {
            extendedblockstorage.func_150818_a(cx, k & 15, cz, Blocks.stone);
        //extendedblockstorage.setExtBlockMetadata(cx, k & 15, cz, 0);
        }
    }
    //Fix spawn point
    int x = (chunkX << 4) + 8;
    int z = (chunkZ << 4) + 8;
    int y = y_base + 12;
    this.worldObj.setSpawnLocation(x, y, z);
}
Also used : ExtendedBlockStorage(net.minecraft.world.chunk.storage.ExtendedBlockStorage)

Example 8 with ExtendedBlockStorage

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

the class ChunkProviderStone method provideChunk.

/**
     * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
     * specified chunk from the map seed and chunk seed
     */
@Override
public Chunk provideChunk(int chunkX, int chunkZ) {
    Chunk chunk = new Chunk(this.worldObj, chunkX, chunkZ);
    int y = 0;
    //Bedrock to prevent falling out of the world
    generatePlatform(chunk, y++, Blocks.bedrock, -1);
    generatePlatform(chunk, y++, Blocks.bedrock, -1);
    generatePlatform(chunk, y++, Blocks.bedrock, -1);
    generatePlatform(chunk, y++, Blocks.bedrock, -1);
    generatePlatform(chunk, y++, Blocks.bedrock, -1);
    //20 layers of stone
    for (int i = 0; i <= 20; i++) {
        generatePlatform(chunk, y++, Blocks.cobblestone, -1);
        generatePlatform(chunk, y++, Blocks.stone, -1);
    }
    //Top layer and chunk boards
    generatePlatform(chunk, y, Blocks.stone, -1);
    generateSquare(chunk, y, 16, 16, 0, 0, Blocks.coal_block, -1);
    final int l = y >> 4;
    ExtendedBlockStorage extendedblockstorage = chunk.getBlockStorageArray()[l];
    generateCorners(chunk, y, 9, Blocks.glowstone, -1);
    generateCorners(chunk, y, 5, 10, 0, 0, Blocks.glowstone, -1);
    extendedblockstorage.func_150818_a(0, y & 15, 2, Blocks.glowstone);
    extendedblockstorage.func_150818_a(0, y & 15, 13, Blocks.glowstone);
    extendedblockstorage.func_150818_a(15, y & 15, 2, Blocks.glowstone);
    extendedblockstorage.func_150818_a(15, y & 15, 13, Blocks.glowstone);
    extendedblockstorage.func_150818_a(2, y & 15, 15, Blocks.glowstone);
    extendedblockstorage.func_150818_a(13, y & 15, 15, Blocks.glowstone);
    extendedblockstorage.func_150818_a(2, y & 15, 0, Blocks.glowstone);
    extendedblockstorage.func_150818_a(13, y & 15, 0, Blocks.glowstone);
    //Not sure if we need to call this before biome
    chunk.generateSkylightMap();
    //Set biome ID for chunk
    byte[] abyte1 = chunk.getBiomeArray();
    Arrays.fill(abyte1, (byte) 1);
    chunk.generateSkylightMap();
    return chunk;
}
Also used : Chunk(net.minecraft.world.chunk.Chunk) ExtendedBlockStorage(net.minecraft.world.chunk.storage.ExtendedBlockStorage)

Example 9 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 10 with ExtendedBlockStorage

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

the class ChunkProviderEmpty method generatePlatform.

private void generatePlatform(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 = 0; cx < 16; ++cx) {
        for (int cz = 0; cz < 16; ++cz) {
            extendedblockstorage.func_150818_a(cx, k & 15, cz, Blocks.stone);
        }
    }
    k = y_base + 9;
    for (int cx = 1; cx < 15; ++cx) {
        for (int cz = 1; cz < 15; ++cz) {
            extendedblockstorage.func_150818_a(cx, k & 15, cz, Blocks.stone);
        }
    }
    k = y_base + 8;
    for (int cx = 2; cx < 14; ++cx) {
        for (int cz = 1; cz < 15; ++cz) {
            extendedblockstorage.func_150818_a(cx, k & 15, cz, Blocks.stone);
        }
    }
}
Also used : ExtendedBlockStorage(net.minecraft.world.chunk.storage.ExtendedBlockStorage)

Aggregations

ExtendedBlockStorage (net.minecraft.world.chunk.storage.ExtendedBlockStorage)12 Chunk (net.minecraft.world.chunk.Chunk)7 MutableBlockPos (net.minecraft.util.math.BlockPos.MutableBlockPos)4 Vector (ValkyrienWarfareBase.API.Vector)3 IBlockState (net.minecraft.block.state.IBlockState)3 BlockPos (net.minecraft.util.math.BlockPos)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 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