本文整理汇总了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);
}
}
示例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);
}
}
示例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());
}
}
示例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());
}
}
示例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");
}
}
示例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;
}
示例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;
}
示例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);
}}));
}