cn.nukkit.math.BlockVector3 Java Examples
The following examples show how to use
cn.nukkit.math.BlockVector3.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlockEntityMovingBlock.java From Jupiter with GNU General Public License v3.0 | 6 votes |
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"); }
Example #2
Source File: CommandBlockUpdatePacket.java From Nukkit with GNU General Public License v3.0 | 6 votes |
@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(); }
Example #3
Source File: Level.java From Jupiter with GNU General Public License v3.0 | 6 votes |
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)); } } }
Example #4
Source File: BlockEntityMovingBlock.java From Nukkit with GNU General Public License v3.0 | 6 votes |
@Override protected void initBlockEntity() { if (namedTag.contains("movingBlockData") && namedTag.contains("movingBlockId")) { this.block = Block.get(namedTag.getInt("movingBlockId"), namedTag.getInt("movingBlockData")); } else { this.close(); } if (namedTag.contains("pistonPosX") && namedTag.contains("pistonPosY") && namedTag.contains("pistonPosZ")) { this.piston = new BlockVector3(namedTag.getInt("pistonPosX"), namedTag.getInt("pistonPosY"), namedTag.getInt("pistonPosZ")); } else { this.close(); } super.initBlockEntity(); }
Example #5
Source File: Level.java From Jupiter with GNU General Public License v3.0 | 6 votes |
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)); } } } }
Example #6
Source File: CommandBlockUpdatePacket.java From Nukkit with GNU General Public License v3.0 | 6 votes |
@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(); }
Example #7
Source File: CommandBlockUpdatePacket.java From Jupiter with GNU General Public License v3.0 | 6 votes |
@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(); }
Example #8
Source File: Entity.java From Jupiter with GNU General Public License v3.0 | 6 votes |
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); } } }
Example #9
Source File: BlockEntityMovingBlock.java From Nukkit with GNU General Public License v3.0 | 6 votes |
@Override protected void initBlockEntity() { if (namedTag.contains("movingBlockData") && namedTag.contains("movingBlockId")) { this.block = Block.get(namedTag.getInt("movingBlockId"), namedTag.getInt("movingBlockData")); } else { this.close(); } if (namedTag.contains("pistonPosX") && namedTag.contains("pistonPosY") && namedTag.contains("pistonPosZ")) { this.piston = new BlockVector3(namedTag.getInt("pistonPosX"), namedTag.getInt("pistonPosY"), namedTag.getInt("pistonPosZ")); } else { this.close(); } super.initBlockEntity(); }
Example #10
Source File: PlayerActionPacket.java From Jupiter with GNU General Public License v3.0 | 5 votes |
@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(); }
Example #11
Source File: BlockPickRequestPacket.java From Jupiter with GNU General Public License v3.0 | 5 votes |
@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(); }
Example #12
Source File: ItemFrameDropItemPacket.java From Jupiter with GNU General Public License v3.0 | 5 votes |
@Override public void decode() { BlockVector3 v = this.getBlockVector3(); this.z = v.z; this.y = v.y; this.x = v.x; }
Example #13
Source File: IntPositionEntityData.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public void setData(BlockVector3 data) { if (data != null) { this.x = data.x; this.y = data.y; this.z = data.z; } }
Example #14
Source File: PlayerActionPacket.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@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(); }
Example #15
Source File: ObjectSwampTree.java From Jupiter with GNU General Public License v3.0 | 5 votes |
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(); } }
Example #16
Source File: IntPositionEntityData.java From Jupiter with GNU General Public License v3.0 | 5 votes |
@Override public void setData(BlockVector3 data) { if (data != null) { this.x = data.x; this.y = data.y; this.z = data.z; } }
Example #17
Source File: ItemFrameDropItemPacket.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public void decode() { BlockVector3 v = this.getBlockVector3(); this.z = v.z; this.y = v.y; this.x = v.x; }
Example #18
Source File: ContainerOpenPacket.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@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(); }
Example #19
Source File: BlockPickRequestPacket.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public void decode() { BlockVector3 v = this.getSignedBlockPosition(); this.x = v.x; this.y = v.y; this.z = v.z; this.addUserData = this.getBoolean(); this.selectedSlot = this.getByte(); }
Example #20
Source File: BlockEntityDataPacket.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public void decode() { BlockVector3 v = this.getBlockVector3(); this.x = v.x; this.y = v.y; this.z = v.z; this.namedTag = this.get(); }
Example #21
Source File: NewJungleTree.java From Nukkit with GNU General Public License v3.0 | 5 votes |
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(); } }
Example #22
Source File: ObjectSwampTree.java From Nukkit with GNU General Public License v3.0 | 5 votes |
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(); } }
Example #23
Source File: IntPositionEntityData.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public void setData(BlockVector3 data) { if (data != null) { this.x = data.x; this.y = data.y; this.z = data.z; } }
Example #24
Source File: PlayerActionPacket.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@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(); }
Example #25
Source File: ItemFrameDropItemPacket.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public void decode() { BlockVector3 v = this.getBlockVector3(); this.z = v.z; this.y = v.y; this.x = v.x; }
Example #26
Source File: ContainerOpenPacket.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@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(); }
Example #27
Source File: BlockPickRequestPacket.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@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(); }
Example #28
Source File: BlockEntityDataPacket.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public void decode() { BlockVector3 v = this.getBlockVector3(); this.x = v.x; this.y = v.y; this.z = v.z; this.namedTag = this.get(); }
Example #29
Source File: NewJungleTree.java From Nukkit with GNU General Public License v3.0 | 5 votes |
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(); } }
Example #30
Source File: ObjectSwampTree.java From Nukkit with GNU General Public License v3.0 | 5 votes |
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(); } }