當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。