本文整理匯總了Java中org.spacehq.mc.protocol.data.game.chunk.Column.getZ方法的典型用法代碼示例。如果您正苦於以下問題:Java Column.getZ方法的具體用法?Java Column.getZ怎麽用?Java Column.getZ使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.spacehq.mc.protocol.data.game.chunk.Column
的用法示例。
在下文中一共展示了Column.getZ方法的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: 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);
}
}
}
}
示例11: 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);
}
}
}
示例12: 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);
}
}
}
}
示例13: 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));
}
示例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 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);
}
}
}
示例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) {
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));
}
}