当前位置: 首页>>代码示例>>Java>>正文


Java BlockVector3类代码示例

本文整理汇总了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();
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:20,代码来源:CommandBlockUpdatePacket.java

示例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");
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:18,代码来源:BlockEntityMovingBlock.java

示例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);
        }
    }
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:24,代码来源:Entity.java

示例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();
    }
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:10,代码来源:NewJungleTree.java

示例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));
        }
    }
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:21,代码来源:Level.java

示例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));
            }
        }
    }
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:17,代码来源:Level.java

示例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();
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:20,代码来源:UseItemPacket.java

示例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();
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:20,代码来源:UseItemPacket.java

示例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;
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:9,代码来源:IntPositionEntityData.java

示例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();
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:11,代码来源:PlayerActionPacket.java

示例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;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:8,代码来源:ItemFrameDropItemPacket.java

示例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();
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:11,代码来源:ContainerOpenPacket.java

示例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();
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:10,代码来源:BlockPickRequestPacket.java

示例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();
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:9,代码来源:BlockEntityDataPacket.java

示例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();
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:11,代码来源:PlayerActionPacket.java


注:本文中的cn.nukkit.math.BlockVector3类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。