本文整理汇总了Java中org.spacehq.mc.protocol.data.game.chunk.Column类的典型用法代码示例。如果您正苦于以下问题:Java Column类的具体用法?Java Column怎么用?Java Column使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Column类属于org.spacehq.mc.protocol.data.game.chunk包,在下文中一共展示了Column类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate
import org.spacehq.mc.protocol.data.game.chunk.Column; //导入依赖的package包/类
@Override
public void generate(Column column, OpenSimplexNoise heightmap, double grassStretch, double grassBumpyness,
double grassHeight) {
int x = random.nextInt(15) + 1;
int z = random.nextInt(15) + 1;
int type = (Math.random() <= 0.5) ? 1 : 2;
double absX = column.getX() * 16 + x;
double absZ = column.getZ() * 16 + z;
double dx = absX / grassStretch;
double dz = absZ / grassStretch;
int height = (int) (heightmap.eval(dx, dz) * grassBumpyness + grassHeight);
setBlock(column, (int) absX, height + 1, (int) absZ, new BlockState(36 + type, 0));
}
示例2: generate
import org.spacehq.mc.protocol.data.game.chunk.Column; //导入依赖的package包/类
@Override
public void generate(Column column, OpenSimplexNoise heightmap, double grassStretch, double grassBumpyness,
double grassHeight) {
int treeheight = random.nextInt(3) + 4;
int x = random.nextInt(15) + 1;
int z = random.nextInt(15) + 1;
double absX = column.getX() * 16 + x;
double absZ = column.getZ() * 16 + z;
double dx = absX / grassStretch;
double dz = absZ / grassStretch;
int y = (int) (heightmap.eval(dx, dz) * grassBumpyness + grassHeight);
if (amount_of_trees != 3) {
amount_of_trees++;
if ((x + treeheight + z + "").hashCode() % 21 == 0) {
generateTree(column, (int) absX, y, (int) absZ, treeheight);
}
}
}
示例3: apply
import org.spacehq.mc.protocol.data.game.chunk.Column; //导入依赖的package包/类
public void apply(Column column) {
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
double absX = column.getX() * 16 + x;
double absZ = column.getZ() * 16 + z;
double dx = absX / grassStretch;
double dz = absZ / grassStretch;
int height = (int) (grassHeightmap.eval(dx, dz) * grassBumpyness + grassHeight);
setBlock(column, (int) absX, height, (int) absZ, grass);
setBlock(column, (int) absX, height - 1, (int) absZ, dirt);
if (x == 0) {
TreePopulator treegenerator = new TreePopulator();
FlowerPopulator flowergenerator = new FlowerPopulator();
TallGrassPopulator grassgenerator = new TallGrassPopulator();
flowergenerator.generate(column, grassHeightmap, grassStretch, grassBumpyness, grassHeight);
grassgenerator.generate(column, grassHeightmap, grassStretch, grassBumpyness, grassHeight);
treegenerator.generate(column, grassHeightmap, grassStretch, grassBumpyness, grassHeight);
}
}
}
}
示例4: setBlock
import org.spacehq.mc.protocol.data.game.chunk.Column; //导入依赖的package包/类
protected void setBlock(Column column, int x, int y, int z, BlockState theBlock) {
int chunkY = y / 16;
int xOffset = x - column.getX() * 16;
int yOffset = y - chunkY * 16;
int zOffset = z - column.getZ() * 16;
if (xOffset < 0 || yOffset < 0 || zOffset < 0 || xOffset > 15 || yOffset > 15 || zOffset > 15)
return;
// // Workaround
// while (xOffset < 0)
// xOffset += 16;
// while (zOffset < 0)
// zOffset += 16;
column.getChunks()[chunkY].getBlocks().set(xOffset, y % 16, zOffset, theBlock);
}
示例5: getBlock
import org.spacehq.mc.protocol.data.game.chunk.Column; //导入依赖的package包/类
protected BlockState getBlock(Column column, int x, int y, int z) {
int chunkY = (int) Math.floor(y / 16);
int chunkX = (int) Math.floor(x / 16);
int chunkZ = (int) Math.floor(z / 16);
if (chunkX != column.getX()) {
log("Invalid chunk access (X)");
return new BlockState(86, 0);
}
if (chunkZ != column.getZ()) {
log("Invalid chunk access (Z)");
return new BlockState(86, 0);
}
int xOffset = x % 16;
int zOffset = z % 16;
while (xOffset < 0)
xOffset += 16;
while (zOffset < 0)
zOffset += 16;
if (chunkY < 0 || chunkY > 16)
return new BlockState(86, 0); // pumpkin ?
return column.getChunks()[chunkY].getBlocks().get(xOffset, y % 16, zOffset);
}
示例6: apply
import org.spacehq.mc.protocol.data.game.chunk.Column; //导入依赖的package包/类
public void apply(Column column) {
double offsetX = column.getX() * 16;
double offsetZ = column.getZ() * 16;
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
double absX = column.getX() * 16 + x;
double absZ = column.getZ() * 16 + z;
int height = (int) (bedrockHeightmap.eval(offsetX + x, offsetZ + z) * bedrockHeight);
height = Math.max(0, height);
setBlock(column, (int) absX, height, (int) absZ, bedrock);
setBlock(column, (int) absX, 0, (int) absZ, bedrock);
}
}
}
示例7: generate
import org.spacehq.mc.protocol.data.game.chunk.Column; //导入依赖的package包/类
@Override
public void generate(Column column, OpenSimplexNoise heightmap, double grassStretch, double grassBumpyness,
double grassHeight) {
for (int i = 0; i < 5; i++) {
int x = random.nextInt(15) + 1;
int z = random.nextInt(15) + 1;
double absX = column.getX() * 16 + x;
double absZ = column.getZ() * 16 + z;
double dx = absX / grassStretch;
double dz = absZ / grassStretch;
int height = (int) (heightmap.eval(dx, dz) * grassBumpyness + grassHeight);
setBlock(column, (int) absX, height + 1, (int) absZ, new BlockState(31, 1));
}
}
示例8: apply
import org.spacehq.mc.protocol.data.game.chunk.Column; //导入依赖的package包/类
public void apply(Column column) {
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
double absX = column.getX() * 16 + x;
double absZ = column.getZ() * 16 + z;
double dx = absX / stretch;
double dz = absZ / stretch;
int blockHeight = (int) (heightmap.eval(dx, dz) * bumpyness + height);
for (int y = blockHeight; y >= 0; y--) {
setBlock(column, (int) absX, y, (int) absZ, stone);
}
}
}
}
示例9: setBlock
import org.spacehq.mc.protocol.data.game.chunk.Column; //导入依赖的package包/类
protected void setBlock(Column column, int x, int y, int z, BlockState theBlock) {
int chunkY = y / 16;
int chunkX = x / 16;
int chunkZ = z / 16;
int xOffset = x - column.getX() * 16;
int yOffset = y - chunkY * 16;
int zOffset = z - column.getZ() * 16;
if(xOffset < 0 || yOffset < 0 || zOffset < 0 || xOffset > 15 || yOffset > 15 || zOffset > 15) return;
// // Workaround for the modulo bug.
// while (xOffset < 0)
// xOffset += 16;
// while (zOffset < 0)
// zOffset += 16;
column.getChunks()[chunkY].getBlocks().set(xOffset, y % 16, zOffset, theBlock);
}
示例10: generateColumn
import org.spacehq.mc.protocol.data.game.chunk.Column; //导入依赖的package包/类
public Column generateColumn(int columnX, int columnZ) {
Chunk[] subChunks = new Chunk[16];
for (int i = 0; i < 16; i++) {
subChunks[i] = new Chunk(hasSky);
}
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
subChunks[0].getBlocks().set(x, 1, z, new BlockState(floorBlockId, 0));
for (int y = 0; y < 16; y++) {
subChunks[0].getBlockLight().set(x, y, z, 15);
}
}
}
byte[] biomeData = new byte[256];
return new Column(columnX, columnZ, subChunks, biomeData);
}
示例11: apply
import org.spacehq.mc.protocol.data.game.chunk.Column; //导入依赖的package包/类
public void apply(Column column) {
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
double absX = column.getX() * 16 + x;
double absZ = column.getZ() * 16 + z;
double dx = absX / grassStretch;
double dz = absZ / grassStretch;
int height = (int) (grassHeightmap.eval(dx, dz) * grassBumpyness + grassHeight);
setBlock(column, (int) absX, height, (int) absZ, grass);
setBlock(column, (int) absX, height - 1, (int) absZ, dirt);
if(x == 0) {
TreePopulator treegenerator = new TreePopulator();
FlowerPopulator flowergenerator = new FlowerPopulator();
TallGrassPopulator grassgenerator = new TallGrassPopulator();
flowergenerator.generate(column, grassHeightmap, grassStretch, grassBumpyness, grassHeight);
grassgenerator.generate(column, grassHeightmap, grassStretch, grassBumpyness, grassHeight);
treegenerator.generate(column, grassHeightmap, grassStretch, grassBumpyness, grassHeight);
}
}
}
}
示例12: apply
import org.spacehq.mc.protocol.data.game.chunk.Column; //导入依赖的package包/类
public void apply(Column column) {
double offsetX = column.getX() * 16;
double offsetZ = column.getZ() * 16;
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
double absX = column.getX() * 16 + x;
double absZ = column.getZ() * 16 + z;
int height = (int) (bedrockHeightmap.eval(offsetX + x, offsetZ + z) * bedrockHeight);
height = Math.max(0, height);
setBlock(column, (int) absX, height, (int) absZ, bedrock);
setBlock(column, (int) absX, 0, (int) absZ, bedrock);
}
}
}
示例13: apply
import org.spacehq.mc.protocol.data.game.chunk.Column; //导入依赖的package包/类
public void apply(Column column) {
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
double absX = column.getX() * 16 + x;
double absZ = column.getZ() * 16 + z;
double dx = absX / stretch;
double dz = absZ / stretch;
int blockHeight = (int) (heightmap.eval(dx, dz) * bumpyness + height);
for (int y = blockHeight; y >= 0; y--) {
setBlock(column, (int) absX, y, (int) absZ, stone);
}
}
}
}
示例14: generate
import org.spacehq.mc.protocol.data.game.chunk.Column; //导入依赖的package包/类
@Override
public void generate(Column column, OpenSimplexNoise heightmap, double grassStretch, double grassBumpyness, double grassHeight) {
int x = random.nextInt(15) + 1;
int z = random.nextInt(15) + 1;
int type = (Math.random() <= 0.5) ? 1 : 2;
double absX = column.getX() * 16 + x;
double absZ = column.getZ() * 16 + z;
double dx = absX / grassStretch;
double dz = absZ / grassStretch;
int height = (int) (heightmap.eval(dx, dz) * grassBumpyness + grassHeight);
setBlock(column, (int)absX, height + 1, (int)absZ, new BlockState(36 + type, 0));
}
示例15: generate
import org.spacehq.mc.protocol.data.game.chunk.Column; //导入依赖的package包/类
@Override
public void generate(Column column, OpenSimplexNoise heightmap, double grassStretch, double grassBumpyness,double grassHeight) {
int treeheight = random.nextInt(3) + 4;
int x = random.nextInt(15) + 1;
int z = random.nextInt(15) + 1;
double absX = column.getX() * 16 + x;
double absZ = column.getZ() * 16 + z;
double dx = absX / grassStretch;
double dz = absZ / grassStretch;
int y = (int) (heightmap.eval(dx, dz) * grassBumpyness + grassHeight);
if(amount_of_trees != 3) {
amount_of_trees++;
if((x + treeheight + z + "").hashCode() % 21 == 0) {
generateTree(column, (int)absX, y, (int)absZ, treeheight);
}
}
}