• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IntEntityData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setDisplayBlock

import cn.nukkit.entity.data.IntEntityData; //导入依赖的package包/类
/**
 * Set the minecart display block!
 *
 * @param block The block that will changed. Set {@code null} for BlockAir
 * @return {@code true} if the block is normal block
 */
@API(usage = Usage.MAINTAINED, definition = Definition.UNIVERSAL)
public boolean setDisplayBlock(Block block) {
    if (block != null) {
        if (block.isNormalBlock()) {
            blockInside = block;
            int display = blockInside.getId()
                    | blockInside.getDamage() << 16;
            setDataProperty(new ByteEntityData(DATA_MINECART_HAS_DISPLAY, 1));
            setDataProperty(new IntEntityData(DATA_MINECART_DISPLAY_BLOCK, display));
            setDisplayBlockOffset(6);
        }
    } else {
        // Set block to air (default).
        blockInside = null;
        setDataProperty(new ByteEntityData(DATA_MINECART_HAS_DISPLAY, 0));
        setDataProperty(new IntEntityData(DATA_MINECART_DISPLAY_BLOCK, 0));
        setDisplayBlockOffset(0);
    }
    return true;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:27,代码来源:EntityMinecartAbstract.java


示例2: initEntity

import cn.nukkit.entity.data.IntEntityData; //导入依赖的package包/类
@Override
protected void initEntity() {
    super.initEntity();

    if (namedTag != null) {
        if (namedTag.contains("TileID")) {
            blockId = namedTag.getInt("TileID");
        } else if (namedTag.contains("Tile")) {
            blockId = namedTag.getInt("Tile");
            namedTag.putInt("TileID", blockId);
        }

        if (namedTag.contains("Data")) {
            damage = namedTag.getByte("Data");
        }
    }

    if (blockId == 0) {
        close();
        return;
    }

    setDataProperty(new IntEntityData(DATA_VARIANT, this.getBlock() | this.getDamage() << 8));
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:25,代码来源:EntityFallingBlock.java


示例3: setDisplayBlock

import cn.nukkit.entity.data.IntEntityData; //导入依赖的package包/类
/**
 * Set the minecart display block!
 *
 * @param block The block that will changed. Set {@code null} for BlockAir
 * @return {@code true} if the block is normal block
 */
public boolean setDisplayBlock(Block block) {
    if (block != null) {
        if (block.isNormalBlock()) {
            blockInside = block;
            int display = blockInside.getId()
                    | blockInside.getDamage() << 16;
            setDataProperty(new ByteEntityData(DATA_MINECART_HAS_DISPLAY, 1));
            setDataProperty(new IntEntityData(DATA_MINECART_DISPLAY_BLOCK, display));
            setDisplayBlockOffset(6);
        }
    } else {
        // Set block to air (default).
        blockInside = null;
        setDataProperty(new ByteEntityData(DATA_MINECART_HAS_DISPLAY, 0));
        setDataProperty(new IntEntityData(DATA_MINECART_DISPLAY_BLOCK, 0));
        setDisplayBlockOffset(0);
    }
    return true;
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:26,代码来源:EntityMinecartAbstract.java


示例4: initEntity

import cn.nukkit.entity.data.IntEntityData; //导入依赖的package包/类
@Override
protected void initEntity() {
    super.initEntity();

    if (namedTag != null) {
        if (namedTag.contains("TileID")) {
            blockId = namedTag.getInt("TileID");
        } else if (namedTag.contains("Tile")) {
            blockId = namedTag.getInt("Tile");
            namedTag.putInt("TileID", blockId);
        }

        if (namedTag.contains("Data")) {
            damage = namedTag.getByte("Data");
        }
    }

    if (blockId == 0) {
        close();
        return;
    }

    setDataProperty(new IntEntityData(DATA_BLOCK_INFO, this.getBlock() | this.getDamage() << 8));
}
 
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:25,代码来源:EntityFallingBlock.java


示例5: initEntity

import cn.nukkit.entity.data.IntEntityData; //导入依赖的package包/类
protected void initEntity() {
    super.initEntity();

    if (namedTag.contains("Fuse")) {
        fuse = namedTag.getByte("Fuse");
    } else {
        fuse = 80;
    }

    this.setDataFlag(DATA_FLAGS, DATA_FLAG_IGNITED, true);
    this.setDataProperty(new IntEntityData(DATA_FUSE_LENGTH, fuse));

    this.level.addSound(new TNTPrimeSound(this));
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:15,代码来源:EntityPrimedTNT.java


示例6: initEntity

import cn.nukkit.entity.data.IntEntityData; //导入依赖的package包/类
protected void initEntity() {
    super.initEntity();

    if (namedTag.contains("Fuse")) {
        fuse = namedTag.getByte("Fuse");
    } else {
        fuse = 80;
    }

    this.setDataFlag(DATA_FLAGS, DATA_FLAG_IGNITED, true);
    this.setDataProperty(new IntEntityData(DATA_FUSE_LENGTH, fuse));
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:13,代码来源:EntityPrimedTNT.java


示例7: recalculateEffectColor

import cn.nukkit.entity.data.IntEntityData; //导入依赖的package包/类
protected void recalculateEffectColor() {
    int[] color = new int[3];
    int count = 0;
    boolean ambient = true;
    for (Effect effect : this.effects.values()) {
        if (effect.isVisible()) {
            int[] c = effect.getColor();
            color[0] += c[0] * (effect.getAmplifier() + 1);
            color[1] += c[1] * (effect.getAmplifier() + 1);
            color[2] += c[2] * (effect.getAmplifier() + 1);
            count += effect.getAmplifier() + 1;
            if (!effect.isAmbient()) {
                ambient = false;
            }
        }
    }

    if (count > 0) {
        int r = (color[0] / count) & 0xff;
        int g = (color[1] / count) & 0xff;
        int b = (color[2] / count) & 0xff;

        this.setDataProperty(new IntEntityData(Entity.DATA_POTION_COLOR, (r << 16) + (g << 8) + b));
        this.setDataProperty(new ByteEntityData(Entity.DATA_POTION_AMBIENT, ambient ? 1 : 0));
    } else {
        this.setDataProperty(new IntEntityData(Entity.DATA_POTION_COLOR, 0));
        this.setDataProperty(new ByteEntityData(Entity.DATA_POTION_AMBIENT, 0));
    }
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:30,代码来源:Entity.java


示例8: initEntity

import cn.nukkit.entity.data.IntEntityData; //导入依赖的package包/类
protected void initEntity() {
    super.initEntity();

    if (namedTag.contains("Fuse")) {
        fuse = namedTag.getByte("Fuse");
    } else {
        fuse = 80;
    }
    this.setDataFlag(DATA_FLAGS, DATA_FLAG_IGNITED, true);
    this.setDataProperty(new IntEntityData(DATA_FUSE_LENGTH, fuse));
}
 
开发者ID:NycuRO,项目名称:Apollo-OLD,代码行数:12,代码来源:EntityPrimedTNT.java


示例9: setRollingAmplitude

import cn.nukkit.entity.data.IntEntityData; //导入依赖的package包/类
public void setRollingAmplitude(int time) {
    this.setDataProperty(new IntEntityData(DATA_HURT_TIME, time));
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:4,代码来源:EntityVehicle.java


示例10: setRollingDirection

import cn.nukkit.entity.data.IntEntityData; //导入依赖的package包/类
public void setRollingDirection(int direction) {
    this.setDataProperty(new IntEntityData(DATA_HURT_DIRECTION, direction));
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:4,代码来源:EntityVehicle.java


示例11: setDamage

import cn.nukkit.entity.data.IntEntityData; //导入依赖的package包/类
public void setDamage(int damage) {
    this.setDataProperty(new IntEntityData(DATA_HEALTH, damage));
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:4,代码来源:EntityVehicle.java


示例12: writeMetadata

import cn.nukkit.entity.data.IntEntityData; //导入依赖的package包/类
public static byte[] writeMetadata(EntityMetadata metadata) {
    BinaryStream stream = new BinaryStream();
    Map<Integer, EntityData> map = metadata.getMap();
    stream.putUnsignedVarInt(map.size());
    for (int id : map.keySet()) {
        EntityData d = map.get(id);
        stream.putUnsignedVarInt(id);
        stream.putUnsignedVarInt(d.getType());
        switch (d.getType()) {
            case Entity.DATA_TYPE_BYTE:
                stream.putByte(((ByteEntityData) d).getData().byteValue());
                break;
            case Entity.DATA_TYPE_SHORT:
                stream.putLShort(((ShortEntityData) d).getData());
                break;
            case Entity.DATA_TYPE_INT:
                stream.putVarInt(((IntEntityData) d).getData());
                break;
            case Entity.DATA_TYPE_FLOAT:
                stream.putLFloat(((FloatEntityData) d).getData());
                break;
            case Entity.DATA_TYPE_STRING:
                String s = ((StringEntityData) d).getData();
                stream.putUnsignedVarInt(s.getBytes(StandardCharsets.UTF_8).length);
                stream.put(s.getBytes(StandardCharsets.UTF_8));
                break;
            case Entity.DATA_TYPE_SLOT:
                SlotEntityData slot = (SlotEntityData) d;
                stream.putLShort(slot.blockId);
                stream.putByte((byte) slot.meta);
                stream.putLShort(slot.count);
                break;
            case Entity.DATA_TYPE_POS:
                IntPositionEntityData pos = (IntPositionEntityData) d;
                stream.putVarInt(pos.x);
                stream.putByte((byte) pos.y);
                stream.putVarInt(pos.z);
                break;
            case Entity.DATA_TYPE_LONG:
                stream.putVarLong(((LongEntityData) d).getData());
                break;
            case Entity.DATA_TYPE_VECTOR3F:
                Vector3fEntityData v3data = (Vector3fEntityData) d;
                stream.putLFloat(v3data.x);
                stream.putLFloat(v3data.y);
                stream.putLFloat(v3data.z);
                break;
        }
    }
    return stream.getBuffer();
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:52,代码来源:Binary.java


示例13: setHurtTime

import cn.nukkit.entity.data.IntEntityData; //导入依赖的package包/类
public void setHurtTime(int time) {
    this.setDataProperty(new IntEntityData(EntityVehicle.DATA_HURT_TIME, time));
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:4,代码来源:EntityVehicle.java


示例14: setHurtDirection

import cn.nukkit.entity.data.IntEntityData; //导入依赖的package包/类
public void setHurtDirection(int direction) {
    this.setDataProperty(new IntEntityData(EntityVehicle.DATA_HURT_DIRECTION, direction));
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:4,代码来源:EntityVehicle.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TFastFramedTransport类代码示例发布时间:2022-05-22
下一篇:
Java SequenceFlow类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap