本文整理汇总了Java中net.minecraft.world.chunk.ChunkPrimer.getBlockState方法的典型用法代码示例。如果您正苦于以下问题:Java ChunkPrimer.getBlockState方法的具体用法?Java ChunkPrimer.getBlockState怎么用?Java ChunkPrimer.getBlockState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.chunk.ChunkPrimer
的用法示例。
在下文中一共展示了ChunkPrimer.getBlockState方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例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)
{
net.minecraft.world.biome.Biome biome = worldObj.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
IBlockState state = data.getBlockState(x, y, z);
IBlockState top = isExceptionBiome(biome) ? Blocks.GRASS.getDefaultState() : biome.topBlock;
IBlockState filler = isExceptionBiome(biome) ? Blocks.DIRT.getDefaultState() : biome.fillerBlock;
if (state.getBlock() == Blocks.STONE || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock())
{
if (y - 1 < 10)
{
data.setBlockState(x, y, z, FLOWING_LAVA);
}
else
{
data.setBlockState(x, y, z, AIR);
if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock())
{
data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState());
}
}
}
}
示例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);
}
示例4: func_180519_a
import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
public void func_180519_a(ChunkPrimer p_180519_1_)
{
for (int i = 0; i < 16; ++i)
{
for (int j = 0; j < 16; ++j)
{
int k = 1;
int l = -1;
IBlockState iblockstate = Blocks.end_stone.getDefaultState();
IBlockState iblockstate1 = Blocks.end_stone.getDefaultState();
for (int i1 = 127; i1 >= 0; --i1)
{
IBlockState iblockstate2 = p_180519_1_.getBlockState(i, i1, j);
if (iblockstate2.getBlock().getMaterial() == Material.air)
{
l = -1;
}
else if (iblockstate2.getBlock() == Blocks.stone)
{
if (l == -1)
{
if (k <= 0)
{
iblockstate = Blocks.air.getDefaultState();
iblockstate1 = Blocks.end_stone.getDefaultState();
}
l = k;
if (i1 >= 0)
{
p_180519_1_.setBlockState(i, i1, j, iblockstate);
}
else
{
p_180519_1_.setBlockState(i, i1, j, iblockstate1);
}
}
else if (l > 0)
{
--l;
p_180519_1_.setBlockState(i, i1, j, iblockstate1);
}
}
}
}
}
}
示例5: buildSurfaces
import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
public void buildSurfaces(ChunkPrimer primer)
{
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);
}
}
}
}
}
}
示例6: isTopBlock
import net.minecraft.world.chunk.ChunkPrimer; //导入方法依赖的package包/类
private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ)
{
net.minecraft.world.biome.Biome biome = worldObj.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
IBlockState state = data.getBlockState(x, y, z);
return (isExceptionBiome(biome) ? state.getBlock() == Blocks.GRASS : state.getBlock() == biome.topBlock);
}
示例7: 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);
}
}
}
}
}
}