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


Java DoubleTag类代码示例

本文整理汇总了Java中cn.nukkit.nbt.tag.DoubleTag的典型用法代码示例。如果您正苦于以下问题:Java DoubleTag类的具体用法?Java DoubleTag怎么用?Java DoubleTag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DoubleTag类属于cn.nukkit.nbt.tag包,在下文中一共展示了DoubleTag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prime

import cn.nukkit.nbt.tag.DoubleTag; //导入依赖的package包/类
public void prime(int fuse) {
    this.getLevel().setBlock(this, new BlockAir(), true);
    double mot = (new NukkitRandom()).nextSignedFloat() * Math.PI * 2;
    CompoundTag nbt = new CompoundTag()
            .putList(new ListTag<DoubleTag>("Pos")
                    .add(new DoubleTag("", this.x + 0.5))
                    .add(new DoubleTag("", this.y))
                    .add(new DoubleTag("", this.z + 0.5)))
            .putList(new ListTag<DoubleTag>("Motion")
                    .add(new DoubleTag("", -Math.sin(mot) * 0.02))
                    .add(new DoubleTag("", 0.2))
                    .add(new DoubleTag("", -Math.cos(mot) * 0.02)))
            .putList(new ListTag<FloatTag>("Rotation")
                    .add(new FloatTag("", 0))
                    .add(new FloatTag("", 0)))
            .putByte("Fuse", fuse);
    Entity tnt = new EntityPrimedTNT(
            this.getLevel().getChunk(this.getFloorX() >> 4, this.getFloorZ() >> 4),
            nbt
    );
    tnt.spawnToAll();
    this.level.addSound(new TNTPrimeSound(this));
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:24,代码来源:BlockTNT.java

示例2: dropExpOrb

import cn.nukkit.nbt.tag.DoubleTag; //导入依赖的package包/类
public void dropExpOrb(Vector3 source, int exp, Vector3 motion, int delay) {
    motion = (motion == null) ? new Vector3(new java.util.Random().nextDouble() * 0.2 - 0.1, 0.2,
            new java.util.Random().nextDouble() * 0.2 - 0.1) : motion;
    CompoundTag nbt = new CompoundTag()
            .putList(new ListTag<DoubleTag>("Pos").add(new DoubleTag("", source.getX()))
                    .add(new DoubleTag("", source.getY())).add(new DoubleTag("", source.getZ())))
            .putList(new ListTag<DoubleTag>("Motion").add(new DoubleTag("", motion.getX()))
                    .add(new DoubleTag("", motion.getY())).add(new DoubleTag("", motion.getZ())))
            .putList(new ListTag<FloatTag>("Rotation").add(new FloatTag("", 0)).add(new FloatTag("", 0)));
    Entity entity = new EntityXPOrb(this.getChunk(source.getFloorX() >> 4, source.getFloorZ() >> 4), nbt);
    EntityXPOrb xpOrb = (EntityXPOrb) entity;
    xpOrb.setExp(exp);
    xpOrb.setPickupDelay(delay);
    xpOrb.saveNBT();

    xpOrb.spawnToAll();

}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:19,代码来源:Level.java

示例3: onUpdate

import cn.nukkit.nbt.tag.DoubleTag; //导入依赖的package包/类
public int onUpdate(int type) {
    if (type == Level.BLOCK_UPDATE_NORMAL) {
        Block down = this.down();
        if (down.getId() == AIR || down instanceof BlockLiquid) {
        	EntityFallingBlock fall = (EntityFallingBlock) Entity.createEntity("FallingSand", this.getLevel().getChunk((int) (this.x) >> 4, (int) (this.z) >> 4),
        			new CompoundTag()
                    .putList(new ListTag<DoubleTag>("Pos")
                            .add(new DoubleTag("", this.x + 0.5))
                            .add(new DoubleTag("", this.y))
                            .add(new DoubleTag("", this.z + 0.5)))
                    .putList(new ListTag<DoubleTag>("Motion")
                            .add(new DoubleTag("", 0))
                            .add(new DoubleTag("", 0))
                            .add(new DoubleTag("", 0)))

                    .putList(new ListTag<FloatTag>("Rotation")
                            .add(new FloatTag("", 0))
                            .add(new FloatTag("", 0)))
                    .putInt("TileID", this.getId())
                    .putByte("Data", this.getDamage()));
        	fall.spawnToAll();
        }
    }
    return type;
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:26,代码来源:BlockFallable.java

示例4: onActivate

import cn.nukkit.nbt.tag.DoubleTag; //导入依赖的package包/类
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, BlockFace face, double fx, double fy, double fz) {
    Block secret = level.getBlock(block.add(0, -1, 0));
    // TODO: 2016/1/30 check if blockId of secret is a rail
    EntityMinecartTNT minecart = new EntityMinecartTNT(
            level.getChunk(block.getFloorX() >> 4, block.getFloorZ() >> 4), new CompoundTag("")
            .putList(new ListTag<DoubleTag>("Pos")
                    .add(new DoubleTag("", block.getX() + 0.5))
                    .add(new DoubleTag("", block.getY()))
                    .add(new DoubleTag("", block.getZ() + 0.5)))
            .putList(new ListTag<DoubleTag>("Motion")
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0)))
            .putList(new ListTag<FloatTag>("Rotation")
                    .add(new FloatTag("", 0))
                    .add(new FloatTag("", 0)))
    );
    minecart.spawnToAll();

    // TODO: 2016/1/30 if player is survival, item in hand count--

    return true;
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:25,代码来源:ItemMinecartTNT.java

示例5: onActivate

import cn.nukkit.nbt.tag.DoubleTag; //导入依赖的package包/类
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, BlockFace face, double fx, double fy, double fz) {
    Block secret = level.getBlock(block.add(0, -1, 0));
    // TODO: 2016/1/30 check if blockId of secret is a rail
    EntityMinecartHopper minecart = new EntityMinecartHopper(
            level.getChunk(block.getFloorX() >> 4, block.getFloorZ() >> 4), new CompoundTag("")
            .putList(new ListTag<DoubleTag>("Pos")
                    .add(new DoubleTag("", block.getX() + 0.5))
                    .add(new DoubleTag("", block.getY()))
                    .add(new DoubleTag("", block.getZ() + 0.5)))
            .putList(new ListTag<DoubleTag>("Motion")
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0)))
            .putList(new ListTag<FloatTag>("Rotation")
                    .add(new FloatTag("", 0))
                    .add(new FloatTag("", 0)))
    );
    minecart.spawnToAll();

    // TODO: 2016/1/30 if player is survival, item in hand count--

    return true;
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:25,代码来源:ItemMinecartHopper.java

示例6: onActivate

import cn.nukkit.nbt.tag.DoubleTag; //导入依赖的package包/类
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, BlockFace face, double fx, double fy, double fz) {
    Block secret = level.getBlock(block.add(0, -1, 0));
    // TODO: 2016/1/30 check if blockId of secret is a rail
    EntityMinecartChest minecart = new EntityMinecartChest(
            level.getChunk(block.getFloorX() >> 4, block.getFloorZ() >> 4), new CompoundTag("")
            .putList(new ListTag<DoubleTag>("Pos")
                    .add(new DoubleTag("", block.getX() + 0.5))
                    .add(new DoubleTag("", block.getY()))
                    .add(new DoubleTag("", block.getZ() + 0.5)))
            .putList(new ListTag<DoubleTag>("Motion")
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0)))
            .putList(new ListTag<FloatTag>("Rotation")
                    .add(new FloatTag("", 0))
                    .add(new FloatTag("", 0)))
    );
    minecart.spawnToAll();

    // TODO: 2016/1/30 if player is survival, item in hand count--

    return true;
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:25,代码来源:ItemMinecartChest.java

示例7: onActivate

import cn.nukkit.nbt.tag.DoubleTag; //导入依赖的package包/类
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, BlockFace face, double fx, double fy, double fz) {
    Block secret = level.getBlock(block.add(0, -1, 0));
    // TODO: 2016/1/30 check if blockId of secret is a rail

    EntityMinecartEmpty minecart = new EntityMinecartEmpty(
            level.getChunk(block.getFloorX() >> 4, block.getFloorZ() >> 4), new CompoundTag("")
            .putList(new ListTag<DoubleTag>("Pos")
                    .add(new DoubleTag("", block.getX() + 0.5))
                    .add(new DoubleTag("", block.getY()))
                    .add(new DoubleTag("", block.getZ() + 0.5)))
            .putList(new ListTag<DoubleTag>("Motion")
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0)))
            .putList(new ListTag<FloatTag>("Rotation")
                    .add(new FloatTag("", 0))
                    .add(new FloatTag("", 0)))
    );
    minecart.spawnToAll();

    // TODO: 2016/1/30 if player is survival, item in hand count--

    return true;
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:26,代码来源:ItemMinecart.java

示例8: prime

import cn.nukkit.nbt.tag.DoubleTag; //导入依赖的package包/类
public void prime() {
    this.getLevel().setBlock(this, new BlockAir(), true);
    double mot = (new NukkitRandom()).nextSignedFloat() * Math.PI * 2;
    CompoundTag nbt = new CompoundTag()
            .putList(new ListTag<DoubleTag>("Pos")
                    .add(new DoubleTag("", this.x + 0.5))
                    .add(new DoubleTag("", this.y))
                    .add(new DoubleTag("", this.z + 0.5)))
            .putList(new ListTag<DoubleTag>("Motion")
                    .add(new DoubleTag("", -Math.sin(mot) * 0.02))
                    .add(new DoubleTag("", 0.2))
                    .add(new DoubleTag("", -Math.cos(mot) * 0.02)))
            .putList(new ListTag<FloatTag>("Rotation")
                    .add(new FloatTag("", 0))
                    .add(new FloatTag("", 0)))
            .putByte("Fuse", 80);
    Entity tnt = new EntityPrimedTNT(
            this.getLevel().getChunk(this.getFloorX() >> 4, this.getFloorZ() >> 4),
            nbt
    );
    tnt.spawnToAll();
    this.level.addSound(new TNTPrimeSound(this));
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:24,代码来源:BlockTNT.java

示例9: onActivate

import cn.nukkit.nbt.tag.DoubleTag; //导入依赖的package包/类
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, int face, double fx, double fy, double fz) {
    Block secret = level.getBlock(block.add(0, -1, 0));
    // TODO: 2016/1/30 check if blockId of secret is a rail

    EntityMinecartEmpty minecart = new EntityMinecartEmpty(
            level.getChunk(block.getFloorX() >> 4, block.getFloorZ() >> 4), new CompoundTag("")
            .putList(new ListTag<DoubleTag>("Pos")
                    .add(new DoubleTag("", block.getX() + 0.5))
                    .add(new DoubleTag("", block.getY()))
                    .add(new DoubleTag("", block.getZ() + 0.5)))
            .putList(new ListTag<DoubleTag>("Motion")
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0)))
            .putList(new ListTag<FloatTag>("Rotation")
                    .add(new FloatTag("", 0))
                    .add(new FloatTag("", 0)))
    );
    minecart.spawnToAll();

    // TODO: 2016/1/30 if player is survival, item in hand count--

    return true;
}
 
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:26,代码来源:ItemMinecart.java

示例10: onActivate

import cn.nukkit.nbt.tag.DoubleTag; //导入依赖的package包/类
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, int face, double fx, double fy, double fz) {
    Block secret = level.getBlock(block.add(0, -1, 0));
    // TODO: 2016/1/30 check if blockId of secret is a rail
    EntityMinecartTNT minecart = new EntityMinecartTNT(
            level.getChunk(block.getFloorX() >> 4, block.getFloorZ() >> 4), new CompoundTag("")
            .putList(new ListTag<DoubleTag>("Pos")
                    .add(new DoubleTag("", block.getX() + 0.5))
                    .add(new DoubleTag("", block.getY()))
                    .add(new DoubleTag("", block.getZ() + 0.5)))
            .putList(new ListTag<DoubleTag>("Motion")
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0)))
            .putList(new ListTag<FloatTag>("Rotation")
                    .add(new FloatTag("", 0))
                    .add(new FloatTag("", 0)))
    );
    minecart.spawnToAll();

    // TODO: 2016/1/30 if player is survival, item in hand count--

    return true;
}
 
开发者ID:NycuRO,项目名称:Apollo-OLD,代码行数:25,代码来源:ItemMinecartTNT.java

示例11: onActivate

import cn.nukkit.nbt.tag.DoubleTag; //导入依赖的package包/类
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, int face, double fx, double fy, double fz) {
    Block secret = level.getBlock(block.add(0, -1, 0));
    // TODO: 2016/1/30 check if blockId of secret is a rail
    EntityMinecartHopper minecart = new EntityMinecartHopper(
            level.getChunk(block.getFloorX() >> 4, block.getFloorZ() >> 4), new CompoundTag("")
            .putList(new ListTag<DoubleTag>("Pos")
                    .add(new DoubleTag("", block.getX() + 0.5))
                    .add(new DoubleTag("", block.getY()))
                    .add(new DoubleTag("", block.getZ() + 0.5)))
            .putList(new ListTag<DoubleTag>("Motion")
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0)))
            .putList(new ListTag<FloatTag>("Rotation")
                    .add(new FloatTag("", 0))
                    .add(new FloatTag("", 0)))
    );
    minecart.spawnToAll();

    // TODO: 2016/1/30 if player is survival, item in hand count--

    return true;
}
 
开发者ID:NycuRO,项目名称:Apollo-OLD,代码行数:25,代码来源:ItemMinecartHopper.java

示例12: onActivate

import cn.nukkit.nbt.tag.DoubleTag; //导入依赖的package包/类
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, int face, double fx, double fy, double fz) {
    Block secret = level.getBlock(block.add(0, -1, 0));
    // TODO: 2016/1/30 check if blockId of secret is a rail
    EntityMinecartChest minecart = new EntityMinecartChest(
            level.getChunk(block.getFloorX() >> 4, block.getFloorZ() >> 4), new CompoundTag("")
            .putList(new ListTag<DoubleTag>("Pos")
                    .add(new DoubleTag("", block.getX() + 0.5))
                    .add(new DoubleTag("", block.getY()))
                    .add(new DoubleTag("", block.getZ() + 0.5)))
            .putList(new ListTag<DoubleTag>("Motion")
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0)))
            .putList(new ListTag<FloatTag>("Rotation")
                    .add(new FloatTag("", 0))
                    .add(new FloatTag("", 0)))
    );
    minecart.spawnToAll();

    // TODO: 2016/1/30 if player is survival, item in hand count--

    return true;
}
 
开发者ID:NycuRO,项目名称:Apollo-OLD,代码行数:25,代码来源:ItemMinecartChest.java

示例13: strikeLighting

import cn.nukkit.nbt.tag.DoubleTag; //导入依赖的package包/类
public void strikeLighting(Position pos) {
    FullChunk chunk = pos.getLevel().getChunk((int) pos.getX() >> 4, (int) pos.getZ() >> 4);
    CompoundTag nbt = new CompoundTag()
            .putList(new ListTag<DoubleTag>("Pos")
                    .add(new DoubleTag("", pos.getX()))
                    .add(new DoubleTag("", pos.getY()))
                    .add(new DoubleTag("", pos.getZ())))
            .putList(new ListTag<DoubleTag>("Motion")
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0))
                    .add(new DoubleTag("", 0)))
            .putList(new ListTag<FloatTag>("Rotation")
                    .add(new FloatTag("", 0))
                    .add(new FloatTag("", 0)));
    EntityLightning lightning = new EntityLightning(chunk, nbt);
    lightning.spawnToAll();
}
 
开发者ID:yescallop,项目名称:EssentialsNK,代码行数:18,代码来源:EssentialsAPI.java

示例14: spawnEntity

import cn.nukkit.nbt.tag.DoubleTag; //导入依赖的package包/类
@Override
public Entity spawnEntity(Location loc, EntityType type) {
	try {
		BaseFullChunk chunk = nukkit.getChunk(loc.getChunk().getX(), loc.getChunk().getZ());
		CompoundTag nbt = new CompoundTag();
		nbt.putList(new ListTag<DoubleTag>("Pos").add(new DoubleTag("", loc.getX() + 0.5))
                   .add(new DoubleTag("", loc.getY())).add(new DoubleTag("", loc.getZ() + 0.5)))
           .putList(new ListTag<DoubleTag>("Motion").add(new DoubleTag("", 0))
                   .add(new DoubleTag("", 0)).add(new DoubleTag("", 0)))
           .putList(new ListTag<FloatTag>("Rotation").add(new FloatTag("", 0))
                   .add(new FloatTag("", 0)));
		cn.nukkit.entity.Entity ent = cn.nukkit.entity.Entity.createEntity(PokkitEntityTranslator.getEntity(type), chunk, nbt);
		ent.spawnToAll();
		return PokkitEntity.toBukkit(ent);
	} catch(Exception e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:20,代码来源:PokkitWorld.java

示例15: strike

import cn.nukkit.nbt.tag.DoubleTag; //导入依赖的package包/类
public LightningStrike strike(Location loc, boolean effect) {
	BaseFullChunk chunk = nukkit.getChunk(loc.getChunk().getX(), loc.getChunk().getZ());
       int x = loc.getBlockX();
       int z = loc.getBlockZ();
       int y = loc.getBlockY();
       int bId = nukkit.getBlockIdAt(x, y, z);
       if (bId != cn.nukkit.block.Block.TALL_GRASS && bId != cn.nukkit.block.Block.WATER)
           y += 1;
       CompoundTag nbt = new CompoundTag()
               .putList(new ListTag<DoubleTag>("Pos").add(new DoubleTag("", x))
                       .add(new DoubleTag("", y)).add(new DoubleTag("", z)))
               .putList(new ListTag<DoubleTag>("Motion").add(new DoubleTag("", 0))
                       .add(new DoubleTag("", 0)).add(new DoubleTag("", 0)))
               .putList(new ListTag<FloatTag>("Rotation").add(new FloatTag("", 0))
                       .add(new FloatTag("", 0)));

       EntityLightning bolt = new EntityLightning(chunk, nbt);
       bolt.setEffect(effect);
       bolt.spawnToAll();
       return PokkitEntityLightningStrike.toBukkit(bolt);
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:22,代码来源:PokkitWorld.java


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