当前位置: 首页>>代码示例>>Java>>正文


Java ChunkPrimer.setBlockState方法代码示例

本文整理汇总了Java中net.minecraft.world.chunk.ChunkPrimer.setBlockState方法的典型用法代码示例。如果您正苦于以下问题:Java ChunkPrimer.setBlockState方法的具体用法?Java ChunkPrimer.setBlockState怎么用?Java ChunkPrimer.setBlockState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.chunk.ChunkPrimer的用法示例。


在下文中一共展示了ChunkPrimer.setBlockState方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: digBlock

import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
/**
 * Digs out the current block, default implementation removes stone, filler, and top block
 * Sets the block to lava if y is less then 10, and air other wise.
 * If setting to air, it also checks to see if we've broken the surface and if so
 * tries to make the floor the biome's top block
 *
 * @param data Block data array
 * @param index Pre-calculated index into block data
 * @param x local X position
 * @param y local Y position
 * @param z local Z position
 * @param chunkX Chunk X position
 * @param chunkZ Chunk Y position
 * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface.
 */
protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop)
{
    IBlockState state = data.getBlockState(x, y, z);

    if (Util.isRawStone(state.getBlock()) || Util.isSoil(state.getBlock()))
    {
        if (y - 1 < 10)
        {
            data.setBlockState(x, y, z, FLOWING_LAVA);
        }
        else
        {
            data.setBlockState(x, y, z, AIR);
        }
    }
}
 
开发者ID:trigg,项目名称:Firma,代码行数:32,代码来源:FirmaGenRavine.java

示例2: digBlock

import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
/**
 * Digs out the current block, default implementation removes stone, filler, and top block
 * Sets the block to lava if y is less then 10, and air other wise.
 * If setting to air, it also checks to see if we've broken the surface and if so
 * tries to make the floor the biome's top block
 *
 * @param data Block data array
 * @param index Pre-calculated index into block data
 * @param x local X position
 * @param y local Y position
 * @param z local Z position
 * @param chunkX Chunk X position
 * @param chunkZ Chunk Y position
 * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface.
 */
protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop, IBlockState state, IBlockState up)
{
    net.minecraft.world.biome.Biome biome = worldObj.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
    IBlockState top = biome.topBlock;
    IBlockState filler = biome.fillerBlock;

    if (this.canReplaceBlock(state, up) || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock())
    {
        if (y - 1 < 10)
        {
            data.setBlockState(x, y, z, BLK_LAVA);
        }
        else
        {
            data.setBlockState(x, y, z, BLK_AIR);

            if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock())
            {
                data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState());
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:39,代码来源:MapGenCaves.java

示例3: genTerrainBlocks

import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
@Override
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
   {
       double d0 = GRASS_COLOR_NOISE.getValue((double)x * 0.25D, (double)z * 0.25D);

       if (d0 > 0.0D)
       {
           int i = x & 15;
           int j = z & 15;

           for (int k = 255; k >= 0; --k)
           {
               if (chunkPrimerIn.getBlockState(j, k, i).getMaterial() != Material.AIR)
               {
                   if (k == 62 && chunkPrimerIn.getBlockState(j, k, i) != this.FRESH_WATER)
                   {
                       chunkPrimerIn.setBlockState(j, k, i, this.FRESH_WATER);
                   }

                   break;
               }
           }
       }

       super.genTerrainBlocks(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
   }
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:27,代码来源:ExPLake.java

示例4: generateBlocks

import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
private void generateBlocks(ChunkPrimer primer, int chunkX, int chunkZ) {
    // TODO: replace with some actual non-superflat terrain generation
    for (int localX = 0; localX < CHUNK_SIZE; localX++) {
        for (int localZ = 0; localZ < CHUNK_SIZE; localZ++) {
            primer.setBlockState(localX, 0, localZ, BlockStates.BEDROCK);
            for (int blockY = 1; blockY < 64; blockY++) {
                IBlockState state = BlockStates.STONE;
                if (blockY == 63) {
                    state = BlockStates.GRASS;
                } else if (blockY >= 60) {
                    state = BlockStates.DIRT;
                }
                primer.setBlockState(localX, blockY, localZ, state);
            }
        }
    }
}
 
开发者ID:Boethie,项目名称:Genesis,代码行数:18,代码来源:GenesisChunkGenerator.java

示例5: provideChunk

import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
/**
 * 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
 */
public Chunk provideChunk(int x, int z)
{
    ChunkPrimer chunkprimer = new ChunkPrimer();

    for (int i = 0; i < 16; ++i)
    {
        for (int j = 0; j < 16; ++j)
        {
            int k = x * 16 + i;
            int l = z * 16 + j;
            chunkprimer.setBlockState(i, 60, j, Blocks.barrier.getDefaultState());
            IBlockState iblockstate = func_177461_b(k, l);

            if (iblockstate != null)
            {
                chunkprimer.setBlockState(i, 70, j, iblockstate);
            }
        }
    }

    Chunk chunk = new Chunk(this.world, chunkprimer, x, z);
    chunk.generateSkylightMap();
    BiomeGenBase[] abiomegenbase = this.world.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16);
    byte[] abyte = chunk.getBiomeArray();

    for (int i1 = 0; i1 < abyte.length; ++i1)
    {
        abyte[i1] = (byte)abiomegenbase[i1].biomeID;
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:38,代码来源:ChunkProviderDebug.java

示例6: genTerrainBlocks

import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_)
{
    double d0 = GRASS_COLOR_NOISE.func_151601_a((double)p_180622_4_ * 0.25D, (double)p_180622_5_ * 0.25D);

    if (d0 > 0.0D)
    {
        int i = p_180622_4_ & 15;
        int j = p_180622_5_ & 15;

        for (int k = 255; k >= 0; --k)
        {
            if (chunkPrimerIn.getBlockState(j, k, i).getBlock().getMaterial() != Material.air)
            {
                if (k == 62 && chunkPrimerIn.getBlockState(j, k, i).getBlock() != Blocks.water)
                {
                    chunkPrimerIn.setBlockState(j, k, i, Blocks.water.getDefaultState());

                    if (d0 < 0.12D)
                    {
                        chunkPrimerIn.setBlockState(j, k + 1, i, Blocks.waterlily.getDefaultState());
                    }
                }

                break;
            }
        }
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:31,代码来源:BiomeGenSwamp.java

示例7: genTerrainBlocks

import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
{
    double d0 = GRASS_COLOR_NOISE.getValue((double)x * 0.25D, (double)z * 0.25D);

    if (d0 > 0.0D)
    {
        int i = x & 15;
        int j = z & 15;

        for (int k = 255; k >= 0; --k)
        {
            if (chunkPrimerIn.getBlockState(j, k, i).getMaterial() != Material.AIR)
            {
                if (k == 62 && chunkPrimerIn.getBlockState(j, k, i).getBlock() != Blocks.WATER)
                {
                    chunkPrimerIn.setBlockState(j, k, i, WATER);

                    if (d0 < 0.12D)
                    {
                        chunkPrimerIn.setBlockState(j, k + 1, i, WATER_LILY);
                    }
                }

                break;
            }
        }
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:31,代码来源:BiomeSwamp.java

示例8: provideChunk

import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
public Chunk provideChunk(int x, int z)
{
    ChunkPrimer chunkprimer = new ChunkPrimer();

    for (int i = 0; i < this.cachedBlockIDs.length; ++i)
    {
        IBlockState iblockstate = this.cachedBlockIDs[i];

        if (iblockstate != null)
        {
            for (int j = 0; j < 16; ++j)
            {
                for (int k = 0; k < 16; ++k)
                {
                    chunkprimer.setBlockState(j, i, k, iblockstate);
                }
            }
        }
    }

    for (MapGenBase mapgenbase : this.structureGenerators)
    {
        mapgenbase.generate(this.worldObj, x, z, chunkprimer);
    }

    Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
    Biome[] abiome = this.worldObj.getBiomeProvider().getBiomes((Biome[])null, x * 16, z * 16, 16, 16);
    byte[] abyte = chunk.getBiomeArray();

    for (int l = 0; l < abyte.length; ++l)
    {
        abyte[l] = (byte)Biome.getIdForBiome(abiome[l]);
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:38,代码来源:ChunkProviderFlat.java

示例9: provideChunk

import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
/**
 * 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
 */
public Chunk provideChunk(int x, int z)
{
    ChunkPrimer chunkprimer = new ChunkPrimer();

    for (int i = 0; i < this.cachedBlockIDs.length; ++i)
    {
        IBlockState iblockstate = this.cachedBlockIDs[i];

        if (iblockstate != null)
        {
            for (int j = 0; j < 16; ++j)
            {
                for (int k = 0; k < 16; ++k)
                {
                    chunkprimer.setBlockState(j, i, k, iblockstate);
                }
            }
        }
    }

    for (MapGenBase mapgenbase : this.structureGenerators)
    {
        mapgenbase.generate(this, this.worldObj, x, z, chunkprimer);
    }

    Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
    BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16);
    byte[] abyte = chunk.getBiomeArray();

    for (int l = 0; l < abyte.length; ++l)
    {
        abyte[l] = (byte)abiomegenbase[l].biomeID;
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:42,代码来源:ChunkProviderFlat.java

示例10: func_180520_a

import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
public void func_180520_a(int p_180520_1_, int p_180520_2_, ChunkPrimer p_180520_3_)
{
    int i = 2;
    int j = i + 1;
    int k = 33;
    int l = i + 1;
    this.densities = this.initializeNoiseField(this.densities, p_180520_1_ * i, 0, p_180520_2_ * i, j, k, l);

    for (int i1 = 0; i1 < i; ++i1)
    {
        for (int j1 = 0; j1 < i; ++j1)
        {
            for (int k1 = 0; k1 < 32; ++k1)
            {
                double d0 = 0.25D;
                double d1 = this.densities[((i1 + 0) * l + j1 + 0) * k + k1 + 0];
                double d2 = this.densities[((i1 + 0) * l + j1 + 1) * k + k1 + 0];
                double d3 = this.densities[((i1 + 1) * l + j1 + 0) * k + k1 + 0];
                double d4 = this.densities[((i1 + 1) * l + j1 + 1) * k + k1 + 0];
                double d5 = (this.densities[((i1 + 0) * l + j1 + 0) * k + k1 + 1] - d1) * d0;
                double d6 = (this.densities[((i1 + 0) * l + j1 + 1) * k + k1 + 1] - d2) * d0;
                double d7 = (this.densities[((i1 + 1) * l + j1 + 0) * k + k1 + 1] - d3) * d0;
                double d8 = (this.densities[((i1 + 1) * l + j1 + 1) * k + k1 + 1] - d4) * d0;

                for (int l1 = 0; l1 < 4; ++l1)
                {
                    double d9 = 0.125D;
                    double d10 = d1;
                    double d11 = d2;
                    double d12 = (d3 - d1) * d9;
                    double d13 = (d4 - d2) * d9;

                    for (int i2 = 0; i2 < 8; ++i2)
                    {
                        double d14 = 0.125D;
                        double d15 = d10;
                        double d16 = (d11 - d10) * d14;

                        for (int j2 = 0; j2 < 8; ++j2)
                        {
                            IBlockState iblockstate = null;

                            if (d15 > 0.0D)
                            {
                                iblockstate = Blocks.end_stone.getDefaultState();
                            }

                            int k2 = i2 + i1 * 8;
                            int l2 = l1 + k1 * 4;
                            int i3 = j2 + j1 * 8;
                            p_180520_3_.setBlockState(k2, l2, i3, iblockstate);
                            d15 += d16;
                        }

                        d10 += d12;
                        d11 += d13;
                    }

                    d1 += d5;
                    d2 += d6;
                    d3 += d7;
                    d4 += d8;
                }
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:68,代码来源:ChunkProviderEnd.java

示例11: setBlocksInChunk

import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_)
{
    this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, p_180518_1_ * 4 - 2, p_180518_2_ * 4 - 2, 10, 10);
    this.func_147423_a(p_180518_1_ * 4, 0, p_180518_2_ * 4);

    for (int i = 0; i < 4; ++i)
    {
        int j = i * 5;
        int k = (i + 1) * 5;

        for (int l = 0; l < 4; ++l)
        {
            int i1 = (j + l) * 33;
            int j1 = (j + l + 1) * 33;
            int k1 = (k + l) * 33;
            int l1 = (k + l + 1) * 33;

            for (int i2 = 0; i2 < 32; ++i2)
            {
                double d0 = 0.125D;
                double d1 = this.field_147434_q[i1 + i2];
                double d2 = this.field_147434_q[j1 + i2];
                double d3 = this.field_147434_q[k1 + i2];
                double d4 = this.field_147434_q[l1 + i2];
                double d5 = (this.field_147434_q[i1 + i2 + 1] - d1) * d0;
                double d6 = (this.field_147434_q[j1 + i2 + 1] - d2) * d0;
                double d7 = (this.field_147434_q[k1 + i2 + 1] - d3) * d0;
                double d8 = (this.field_147434_q[l1 + i2 + 1] - d4) * d0;

                for (int j2 = 0; j2 < 8; ++j2)
                {
                    double d9 = 0.25D;
                    double d10 = d1;
                    double d11 = d2;
                    double d12 = (d3 - d1) * d9;
                    double d13 = (d4 - d2) * d9;

                    for (int k2 = 0; k2 < 4; ++k2)
                    {
                        double d14 = 0.25D;
                        double d16 = (d11 - d10) * d14;
                        double lvt_45_1_ = d10 - d16;

                        for (int l2 = 0; l2 < 4; ++l2)
                        {
                            if ((lvt_45_1_ += d16) > 0.0D)
                            {
                                p_180518_3_.setBlockState(i * 4 + k2, i2 * 8 + j2, l * 4 + l2, Blocks.stone.getDefaultState());
                            }
                            else if (i2 * 8 + j2 < this.settings.seaLevel)
                            {
                                p_180518_3_.setBlockState(i * 4 + k2, i2 * 8 + j2, l * 4 + l2, this.field_177476_s.getDefaultState());
                            }
                        }

                        d10 += d12;
                        d11 += d13;
                    }

                    d1 += d5;
                    d2 += d6;
                    d3 += d7;
                    d4 += d8;
                }
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:69,代码来源:ChunkProviderGenerate.java

示例12: buildSurfaces

import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
public void buildSurfaces(ChunkPrimer primer)
{
    if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, this.chunkX, this.chunkZ, primer, this.worldObj)) return;
    for (int i = 0; i < 16; ++i)
    {
        for (int j = 0; j < 16; ++j)
        {
            int k = 1;
            int l = -1;
            IBlockState iblockstate = END_STONE;
            IBlockState iblockstate1 = END_STONE;

            for (int i1 = 127; i1 >= 0; --i1)
            {
                IBlockState iblockstate2 = primer.getBlockState(i, i1, j);

                if (iblockstate2.getMaterial() == Material.AIR)
                {
                    l = -1;
                }
                else if (iblockstate2.getBlock() == Blocks.STONE)
                {
                    if (l == -1)
                    {
                        l = 1;

                        if (i1 >= 0)
                        {
                            primer.setBlockState(i, i1, j, iblockstate);
                        }
                        else
                        {
                            primer.setBlockState(i, i1, j, iblockstate1);
                        }
                    }
                    else if (l > 0)
                    {
                        --l;
                        primer.setBlockState(i, i1, j, iblockstate1);
                    }
                }
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:46,代码来源:ChunkProviderEnd.java

示例13: func_180515_a

import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
public void func_180515_a(int p_180515_1_, int p_180515_2_, ChunkPrimer p_180515_3_)
{
    int i = 4;
    int j = this.worldObj.func_181545_F() / 2 + 1;
    int k = i + 1;
    int l = 17;
    int i1 = i + 1;
    this.noiseField = this.initializeNoiseField(this.noiseField, p_180515_1_ * i, 0, p_180515_2_ * i, k, l, i1);

    for (int j1 = 0; j1 < i; ++j1)
    {
        for (int k1 = 0; k1 < i; ++k1)
        {
            for (int l1 = 0; l1 < 16; ++l1)
            {
                double d0 = 0.125D;
                double d1 = this.noiseField[((j1 + 0) * i1 + k1 + 0) * l + l1 + 0];
                double d2 = this.noiseField[((j1 + 0) * i1 + k1 + 1) * l + l1 + 0];
                double d3 = this.noiseField[((j1 + 1) * i1 + k1 + 0) * l + l1 + 0];
                double d4 = this.noiseField[((j1 + 1) * i1 + k1 + 1) * l + l1 + 0];
                double d5 = (this.noiseField[((j1 + 0) * i1 + k1 + 0) * l + l1 + 1] - d1) * d0;
                double d6 = (this.noiseField[((j1 + 0) * i1 + k1 + 1) * l + l1 + 1] - d2) * d0;
                double d7 = (this.noiseField[((j1 + 1) * i1 + k1 + 0) * l + l1 + 1] - d3) * d0;
                double d8 = (this.noiseField[((j1 + 1) * i1 + k1 + 1) * l + l1 + 1] - d4) * d0;

                for (int i2 = 0; i2 < 8; ++i2)
                {
                    double d9 = 0.25D;
                    double d10 = d1;
                    double d11 = d2;
                    double d12 = (d3 - d1) * d9;
                    double d13 = (d4 - d2) * d9;

                    for (int j2 = 0; j2 < 4; ++j2)
                    {
                        double d14 = 0.25D;
                        double d15 = d10;
                        double d16 = (d11 - d10) * d14;

                        for (int k2 = 0; k2 < 4; ++k2)
                        {
                            IBlockState iblockstate = null;

                            if (l1 * 8 + i2 < j)
                            {
                                iblockstate = Blocks.lava.getDefaultState();
                            }

                            if (d15 > 0.0D)
                            {
                                iblockstate = Blocks.netherrack.getDefaultState();
                            }

                            int l2 = j2 + j1 * 4;
                            int i3 = i2 + l1 * 8;
                            int j3 = k2 + k1 * 4;
                            p_180515_3_.setBlockState(l2, i3, j3, iblockstate);
                            d15 += d16;
                        }

                        d10 += d12;
                        d11 += d13;
                    }

                    d1 += d5;
                    d2 += d6;
                    d3 += d7;
                    d4 += d8;
                }
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:74,代码来源:ChunkProviderHell.java


注:本文中的net.minecraft.world.chunk.ChunkPrimer.setBlockState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。