本文整理汇总了Java中ethanjones.cubes.world.CoordinateConverter.block方法的典型用法代码示例。如果您正苦于以下问题:Java CoordinateConverter.block方法的具体用法?Java CoordinateConverter.block怎么用?Java CoordinateConverter.block使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ethanjones.cubes.world.CoordinateConverter
的用法示例。
在下文中一共展示了CoordinateConverter.block方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: preventNoclip
import ethanjones.cubes.world.CoordinateConverter; //导入方法依赖的package包/类
@EventHandler
public void preventNoclip(PlayerMovementEvent event) {
Player player = event.getPlayer();
Vector3 pos = event.newPosition;
if (world.getArea(CoordinateConverter.area(pos.x), CoordinateConverter.area(pos.z)) != null
&& !event.isCanceled()) {
int blockX = CoordinateConverter.block(pos.x);
int blockZ = CoordinateConverter.block(pos.z);
int minBlockY = CoordinateConverter.block(pos.y - player.height);
int maxBlockY = CoordinateConverter.block(pos.y + 0.2f);
for (int y = minBlockY; y <= maxBlockY; y++) {
if (world.getBlock(blockX, y, blockZ) != null) {
event.setCanceled(true);
return;
}
}
limit(pos, +r, 0, player.height);
limit(pos, -r, 0, player.height);
limit(pos, 0, +r, player.height);
limit(pos, 0, -r, player.height);
}
}
示例2: preventNoclip
import ethanjones.cubes.world.CoordinateConverter; //导入方法依赖的package包/类
@EventHandler
public void preventNoclip(PlayerMovementEvent event) {
Player player = event.getPlayer();
Vector3 pos = event.newPosition;
if (world.getArea(CoordinateConverter.area(pos.x), CoordinateConverter.area(pos.z)) != null && !event.isCanceled()) {
int blockX = CoordinateConverter.block(pos.x);
int blockZ = CoordinateConverter.block(pos.z);
int minBlockY = CoordinateConverter.block(pos.y - player.height);
int maxBlockY = CoordinateConverter.block(pos.y + 0.2f);
for (int y = minBlockY; y <= maxBlockY; y++) {
if (world.getBlock(blockX, y, blockZ) != null) {
event.setCanceled(true);
return;
}
}
limit(pos, +r, 0, player.height);
limit(pos, -r, 0, player.height);
limit(pos, 0, +r, player.height);
limit(pos, 0, -r, player.height);
}
}
示例3: update
import ethanjones.cubes.world.CoordinateConverter; //导入方法依赖的package包/类
public boolean update() {
super.update();
if (Side.isServer()) {
if (age >= (600000 / Cubes.tickMS)) {
if (itemStack.item == Blocks.sapling.getItemBlock() && itemStack.count == 1) {
int x = CoordinateConverter.block(position.x), y = CoordinateConverter.block(position.y), z = CoordinateConverter.block(position.z);
if (Cubes.getServer().world.getBlock(x, y - 1, z) == Blocks.grass) {
Cubes.getServer().world.setBlock(Blocks.sapling, x, y, z);
}
}
return true;
}
if (age >= 0) {
for (ClientIdentifier clientIdentifier : Cubes.getServer().getAllClients()) {
float distance2 = VectorUtil.distance2(this.position, clientIdentifier.getPlayer().position.cpy().sub(0, clientIdentifier.getPlayer().height, 0));
if (distance2 < 1f) {
InventoryHelper.addItemstack(clientIdentifier.getPlayer().getInventory(), itemStack);
return true;
}
}
}
}
age++;
return false;
}
示例4: setFromPosition
import ethanjones.cubes.world.CoordinateConverter; //导入方法依赖的package包/类
public BlockReference setFromPosition(float x, float y, float z) {
this.blockX = CoordinateConverter.block(x);
this.blockY = CoordinateConverter.block(y);
this.blockZ = CoordinateConverter.block(z);
this.hashCode = 0;
return this;
}
示例5: setFromVector3
import ethanjones.cubes.world.CoordinateConverter; //导入方法依赖的package包/类
public BlockReference setFromVector3(Vector3 vector3) {
this.blockX = CoordinateConverter.block(vector3.x);
this.blockY = CoordinateConverter.block(vector3.y);
this.blockZ = CoordinateConverter.block(vector3.z);
this.hashCode = 0;
return this;
}
示例6: updateIf
import ethanjones.cubes.world.CoordinateConverter; //导入方法依赖的package包/类
private void updateIf() {
if (itemStack.item == Blocks.sapling.getItemBlock() && itemStack.count == 1) {
int x = CoordinateConverter.block(position.x);
int y = CoordinateConverter.block(position.y);
int z = CoordinateConverter.block(position.z);
if (Cubes.getServer().world.getBlock(x, y - 1, z) == Blocks.grass) {
Cubes.getServer().world.setBlock(Blocks.sapling, x, y, z);
}
}
}
示例7: setFromPosition
import ethanjones.cubes.world.CoordinateConverter; //导入方法依赖的package包/类
public BlockReference setFromPosition(float x, float y, float z) {
this.blockX = CoordinateConverter.block(x);
this.blockY = CoordinateConverter.block(y);
this.blockZ = CoordinateConverter.block(z);
this.hashCode = 0;
return this;
}
示例8: setFromVector3
import ethanjones.cubes.world.CoordinateConverter; //导入方法依赖的package包/类
public BlockReference setFromVector3(Vector3 vector3) {
this.blockX = CoordinateConverter.block(vector3.x);
this.blockY = CoordinateConverter.block(vector3.y);
this.blockZ = CoordinateConverter.block(vector3.z);
this.hashCode = 0;
return this;
}
示例9: check
import ethanjones.cubes.world.CoordinateConverter; //导入方法依赖的package包/类
private boolean check(Vector3 position, float xOffset, float yOffset, float zOffset) {
int x = CoordinateConverter.block(position.x + xOffset);
int y = CoordinateConverter.block(position.y + yOffset);
int z = CoordinateConverter.block(position.z + zOffset);
return world.getBlock(x, y, z) != null;
}
示例10: getBlockY
import ethanjones.cubes.world.CoordinateConverter; //导入方法依赖的package包/类
public static int getBlockY(Vector3 pos, float height) {
float f = pos.y - height;
return CoordinateConverter.block(f - 0.01f);
}
示例11: check
import ethanjones.cubes.world.CoordinateConverter; //导入方法依赖的package包/类
private boolean check(Vector3 position, float xOffset, float yOffset, float zOffset) {
int x = CoordinateConverter.block(position.x + xOffset);
int y = CoordinateConverter.block(position.y + yOffset);
int z = CoordinateConverter.block(position.z + zOffset);
return world.getBlock(x, y, z) != null;
}