本文整理汇总了Java中cn.nukkit.math.BlockVector3类的典型用法代码示例。如果您正苦于以下问题:Java BlockVector3类的具体用法?Java BlockVector3怎么用?Java BlockVector3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BlockVector3类属于cn.nukkit.math包,在下文中一共展示了BlockVector3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decode
import cn.nukkit.math.BlockVector3; //导入依赖的package包/类
@Override
public void decode() {
this.isBlock = this.getBoolean();
if (this.isBlock) {
BlockVector3 v = this.getBlockVector3();
this.x = v.x;
this.y = v.y;
this.z = v.z;
this.commandBlockMode = (int) this.getUnsignedVarInt();
this.isRedstoneMode = this.getBoolean();
this.isConditional = this.getBoolean();
} else {
this.minecartEid = this.getEntityRuntimeId();
}
this.command = this.getString();
this.lastOutput = this.getString();
this.name = this.getString();
this.shouldTrackOutput = this.getBoolean();
}
示例2: BlockEntityMovingBlock
import cn.nukkit.math.BlockVector3; //导入依赖的package包/类
public BlockEntityMovingBlock(FullChunk chunk, CompoundTag nbt) {
super(chunk, nbt);
if (nbt.contains("movingBlockData") && nbt.contains("movingBlockId")) {
this.block = Block.get(nbt.getInt("movingBlockId"), nbt.getInt("movingBlockData"));
} else {
this.close();
}
if (nbt.contains("pistonPosX") && nbt.contains("pistonPosY") && nbt.contains("pistonPosZ")) {
this.piston = new BlockVector3(nbt.getInt("pistonPosX"), nbt.getInt("pistonPosY"), nbt.getInt("pistonPosZ"));
} else {
this.close();
}
this.isMovable = nbt.getBoolean("isMovable");
}
示例3: fall
import cn.nukkit.math.BlockVector3; //导入依赖的package包/类
public void fall(float fallDistance) {
float damage = (float) Math.floor(fallDistance - 3 - (this.hasEffect(Effect.JUMP) ? this.getEffect(Effect.JUMP).getAmplifier() + 1 : 0));
if (damage > 0) {
this.attack(new EntityDamageEvent(this, DamageCause.FALL, damage));
}
if (fallDistance > 0.75) {
BlockVector3 v = new BlockVector3(getFloorX(), getFloorY() - 1, getFloorZ());
int down = this.level.getBlockIdAt(v.x, v.y, v.z);
if (down == Item.FARMLAND) {
if (this instanceof Player) {
Player p = (Player) this;
PlayerInteractEvent ev = new PlayerInteractEvent(p, p.getInventory().getItemInHand(), this.temporalVector.setComponents(v.x, v.y, v.z), null, Action.PHYSICAL);
this.server.getPluginManager().callEvent(ev);
if (ev.isCancelled()) {
return;
}
}
this.level.setBlock(this.temporalVector.setComponents(v.x, v.y, v.z), new BlockDirt(), true, true);
}
}
}
示例4: addHangingVine
import cn.nukkit.math.BlockVector3; //导入依赖的package包/类
private void addHangingVine(ChunkManager worldIn, BlockVector3 pos, int meta) {
this.addVine(worldIn, pos, meta);
int i = 4;
for (pos = pos.down(); i > 0 && worldIn.getBlockIdAt(pos.x, pos.y, pos.z) == Block.AIR; --i) {
this.addVine(worldIn, pos, meta);
pos = pos.down();
}
}
示例5: computeRemoveBlockLight
import cn.nukkit.math.BlockVector3; //导入依赖的package包/类
private void computeRemoveBlockLight(int x, int y, int z, int currentLight, Queue<Object[]> queue,
Queue<Vector3> spreadQueue, Map<BlockVector3, Boolean> visited, Map<BlockVector3, Boolean> spreadVisited) {
int current = this.getBlockLightAt(x, y, z);
BlockVector3 index = Level.blockHash(x, y, z);
if (current != 0 && current < currentLight) {
this.setBlockLightAt(x, y, z, 0);
if (!visited.containsKey(index)) {
visited.put(index, true);
if (current > 1) {
queue.add(new Object[]{new Vector3(x, y, z), current});
}
}
} else if (current >= currentLight) {
if (!spreadVisited.containsKey(index)) {
spreadVisited.put(index, true);
spreadQueue.add(new Vector3(x, y, z));
}
}
}
示例6: computeSpreadBlockLight
import cn.nukkit.math.BlockVector3; //导入依赖的package包/类
private void computeSpreadBlockLight(int x, int y, int z, int currentLight, Queue<Vector3> queue,
Map<BlockVector3, Boolean> visited) {
int current = this.getBlockLightAt(x, y, z);
BlockVector3 index = Level.blockHash(x, y, z);
if (current < currentLight) {
this.setBlockLightAt(x, y, z, currentLight);
if (!visited.containsKey(index)) {
visited.put(index, true);
if (currentLight > 1) {
queue.add(new Vector3(x, y, z));
}
}
}
}
示例7: decode
import cn.nukkit.math.BlockVector3; //导入依赖的package包/类
@Override
public void decode() {
BlockVector3 v = this.getBlockCoords();
this.x = v.x;
this.y = v.y;
this.z = v.z;
this.interactBlockId = (int) this.getUnsignedVarInt();
this.face = this.getVarInt();
Vector3f faceVector3 = this.getVector3f();
this.fx = faceVector3.x;
this.fy = faceVector3.y;
this.fz = faceVector3.z;
Vector3f playerPos = this.getVector3f();
this.posX = playerPos.x;
this.posY = playerPos.y;
this.posZ = playerPos.z;
this.unknown = this.getByte();
this.item = this.getSlot();
}
示例8: decode
import cn.nukkit.math.BlockVector3; //导入依赖的package包/类
@Override
public void decode() {
BlockVector3 v = this.getBlockCoords();
this.x = v.x;
this.y = v.y;
this.z = v.z;
this.interactBlockId = (int) this.getUnsignedVarInt();
this.face = this.getVarInt();
Vector3f faceVector3 = this.getVector3f();
this.fx = faceVector3.x;
this.fy = faceVector3.y;
this.fz = faceVector3.z;
Vector3f playerPos = this.getVector3f();
this.posX = playerPos.x;
this.posY = playerPos.y;
this.posZ = playerPos.z;
this.slot = this.getByte();
this.item = this.getSlot();
}
示例9: setData
import cn.nukkit.math.BlockVector3; //导入依赖的package包/类
@Override
public void setData(BlockVector3 data) {
if (data != null) {
this.x = data.x;
this.y = data.y;
this.z = data.z;
}
}
示例10: decode
import cn.nukkit.math.BlockVector3; //导入依赖的package包/类
@Override
public void decode() {
this.entityId = this.getEntityRuntimeId();
this.action = this.getVarInt();
BlockVector3 v = this.getBlockVector3();
this.x = v.x;
this.y = v.y;
this.z = v.z;
this.face = this.getVarInt();
}
示例11: decode
import cn.nukkit.math.BlockVector3; //导入依赖的package包/类
@Override
public void decode() {
BlockVector3 v = this.getBlockVector3();
this.z = v.z;
this.y = v.y;
this.x = v.x;
}
示例12: decode
import cn.nukkit.math.BlockVector3; //导入依赖的package包/类
@Override
public void decode() {
this.windowId = this.getByte();
this.type = this.getByte();
BlockVector3 v = this.getBlockVector3();
this.x = v.x;
this.y = v.y;
this.z = v.z;
this.entityId = this.getEntityUniqueId();
}
示例13: decode
import cn.nukkit.math.BlockVector3; //导入依赖的package包/类
@Override
public void decode() {
BlockVector3 v = this.getSignedBlockPosition();
this.x = v.x;
this.y = v.y;
this.z = v.z;
this.putBoolean(this.addUserData);
this.selectedSlot = this.getByte();
}
示例14: decode
import cn.nukkit.math.BlockVector3; //导入依赖的package包/类
@Override
public void decode() {
BlockVector3 v = this.getBlockVector3();
this.x = v.x;
this.y = v.y;
this.z = v.z;
this.namedTag = this.get();
}
示例15: decode
import cn.nukkit.math.BlockVector3; //导入依赖的package包/类
@Override
public void decode() {
this.entityRuntimeId = this.getEntityRuntimeId();
this.action = this.getVarInt();
BlockVector3 v = this.getBlockVector3();
this.x = v.x;
this.y = v.y;
this.z = v.z;
this.face = this.getVarInt();
}