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


Java EntityType.ARMOR_STAND属性代码示例

本文整理汇总了Java中org.bukkit.entity.EntityType.ARMOR_STAND属性的典型用法代码示例。如果您正苦于以下问题:Java EntityType.ARMOR_STAND属性的具体用法?Java EntityType.ARMOR_STAND怎么用?Java EntityType.ARMOR_STAND使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.bukkit.entity.EntityType的用法示例。


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

示例1: onItemDamage

@EventHandler
public void onItemDamage(EntityDamageEvent event) {
    if (event.getEntityType() == EntityType.DROPPED_ITEM && (event.getCause() == DamageCause.LAVA || event.getCause() == DamageCause.FIRE_TICK || event.getCause() == DamageCause.FIRE)) {
        Vector v = Vector.getRandom().normalize();
        v = v.setX(v.getX() - 0.5f);
        v = v.setZ(v.getZ() - 0.5f);
        v = v.multiply(0.35);
        if (v.getX() > 0 && v.getX() < 0.10)
            v.setX(0.10);
        if (v.getZ() > 0 && v.getZ() < 0.10)
            v.setZ(0.10);
        if (v.getX() < 0 && v.getX() > -0.10)
            v.setX(-0.10);
        if (v.getZ() < 0 && v.getZ() > -0.10)
            v.setZ(-0.10);
        v.setY(0.3);
        event.getEntity().setVelocity(v);
        event.setCancelled(true);
        RScheduler.schedule(plugin, () -> {
            event.getEntity().setFireTicks(0);
        }, RTicks.seconds(1));
    }
    if (event.getEntityType() == EntityType.ARMOR_STAND && (event.getCause() == DamageCause.LAVA || event.getCause() == DamageCause.FIRE_TICK || event.getCause() == DamageCause.FIRE)) {
        event.setCancelled(true);
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:26,代码来源:EnvironmentManager.java

示例2: onPacketReceiving

@Override
public void onPacketReceiving(PacketEvent packetEvent) {
    Player p = packetEvent.getPlayer();
    PacketContainer packet = packetEvent.getPacket();
    if (packet.getType().equals(PacketType.Play.Client.USE_ENTITY)) {
        UUID u = tagMap.get(packet.getIntegers().read(0));
        if (u == null) return;
        Entity e = p.getNearbyEntities(8, 8, 8).stream().filter(entity -> entity.getUniqueId().equals(u)).findAny
                ().orElse(null);
        if (e == null) return;
        if (!HitboxUtil.isLookingAt(p, e)) return;
        packet.getIntegers().write(0, e.getEntityId());
        if (e.getType() == EntityType.ARMOR_STAND)
            packet.getEntityUseActions().write(0, EnumWrappers.EntityUseAction.ATTACK);
    }
}
 
开发者ID:iso2013,项目名称:MultiLineAPI,代码行数:16,代码来源:PacketListener.java

示例3: onPlayerInteractEntity

@EventHandler
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
    if (event.getRightClicked().getType() == EntityType.ENDER_CRYSTAL) {
        handleBossSpawn(event.getPlayer(), event.getRightClicked());
        event.setCancelled(true);
    } else if (event.getRightClicked().getType() == EntityType.ARMOR_STAND) {
        handleRewards(event.getPlayer(), event.getRightClicked());
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:9,代码来源:DungeonManager.java

示例4: onPlayerHitDungeonDisplay

@EventHandler
public void onPlayerHitDungeonDisplay(EntityDamageByEntityEvent event) {
    if (event.getEntityType() == EntityType.ENDER_CRYSTAL) {
        if (event.getDamager() instanceof Player)
            handleBossSpawn(event.getDamager(), event.getEntity());
        event.setCancelled(true);
    } else if (event.getEntityType() == EntityType.ARMOR_STAND) {
        if (event.getDamager() instanceof Player)
            handleRewards(event.getDamager(), event.getEntity());
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:11,代码来源:DungeonManager.java

示例5: onEntityDamageEvent

@EventHandler
   public void onEntityDamageEvent(EntityDamageEvent e) {
	if (!(e.getEntity() instanceof ArmorStand) && e.getEntityType() != EntityType.ARMOR_STAND && e.getEntityType() != EntityType.DROPPED_ITEM) {
		Hologram h = new Hologram(ChatColor.RED + "-" + Double.toString(e.getDamage()) + " \u2764", e.getEntity().getLocation());
		h.getHologram().addScoreboardTag("dindicator");
		h.setKillTimer(2);
	}
	if (e.getEntity() instanceof Player) {
		Player player = (Player) e.getEntity();
		player.sendMessage(ChatColor.GRAY + "[DamageIndicator] " + e.getCause().name() + " did " + new DecimalFormat("#0.0").format(((double) Math.round(e.getDamage())) / 2) + ChatColor.RED + " \u2764");
	}
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:12,代码来源:DamageIndicator.java

示例6: onArmorSpawn

@EventHandler
public void onArmorSpawn(CreatureSpawnEvent evt) {
    if (evt.getEntityType() != EntityType.ARMOR_STAND || placing == null)
        return;

    ArmorStand as = (ArmorStand) evt.getEntity();
    as.setArms(placing.isArms());
    as.setSmall(placing.isSmall());
    placing = null;
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:10,代码来源:ItemArmorStand.java

示例7: getType

/**
 * Get the entity type from an entity name in this cutscene.
 * @param type
 * @return type
 */
public EntityType getType(String type) {
    if (type.equalsIgnoreCase("Camera"))
        return EntityType.ARMOR_STAND;

    List<ActionCreateEntity> creations = getActions(ActionCreateEntity.class);
    ActionCreateEntity ce = creations.stream().filter(ac -> ac.getEntityName().equalsIgnoreCase(type)).findFirst().orElse(null);
    return ce != null ? ce.getEntityType() : null;
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:13,代码来源:Cutscene.java

示例8: createArmorStand

private PacketUtil.FakeEntity createArmorStand() {
    return new PacketUtil.FakeEntity(EntityType.ARMOR_STAND, PacketUtil.createWatcher(new HashMap<Integer,
            Object>() {{
        put(0, (byte) 32);
        put(3, true);
        put(4, true);
        put(11, (byte) 16);
    }}));
}
 
开发者ID:iso2013,项目名称:MultiLineAPI,代码行数:9,代码来源:Tag.java


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