cn.nukkit.item.ItemBoat Java Examples
The following examples show how to use
cn.nukkit.item.ItemBoat.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityBoat.java From Jupiter with GNU General Public License v3.0 | 5 votes |
@Override public boolean attack(EntityDamageEvent source) { if (invulnerable) { return false; } else { performHurtAnimation((int) source.getFinalDamage()); Entity damager = ((EntityDamageByEntityEvent) source).getDamager(); boolean instantKill = damager instanceof Player && ((Player) damager).isCreative(); if (instantKill || getDamage() > 40) { if (linkedEntity != null) { mountEntity(linkedEntity); } if (instantKill && (!hasCustomName())) { kill(); } else { if (level.getGameRules().getBoolean("doentitydrops")) { this.level.dropItem(this, new ItemBoat()); } close(); } } } return true; }
Example #2
Source File: EntityBoat.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public void kill() { super.kill(); if (level.getGameRules().getBoolean(GameRule.DO_ENTITY_DROPS)) { this.level.dropItem(this, new ItemBoat()); } }
Example #3
Source File: EntityBoat.java From Nukkit with GNU General Public License v3.0 | 4 votes |
@Override public boolean attack(EntityDamageEvent source) { if (invulnerable) { return false; } else { // Event start VehicleDamageEvent event = new VehicleDamageEvent(this, source.getEntity(), source.getFinalDamage()); getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return false; } // Event stop performHurtAnimation((int) event.getDamage()); boolean instantKill = false; if (source instanceof EntityDamageByEntityEvent) { Entity damager = ((EntityDamageByEntityEvent) source).getDamager(); instantKill = damager instanceof Player && ((Player) damager).isCreative(); } if (instantKill || getDamage() > 40) { // Event start VehicleDestroyEvent event2 = new VehicleDestroyEvent(this, source.getEntity()); getServer().getPluginManager().callEvent(event2); if (event2.isCancelled()) { return false; } // Event stop if (linkedEntity != null) { mountEntity(linkedEntity); } if (instantKill && (!hasCustomName())) { kill(); } else { if (level.getGameRules().getBoolean(GameRule.DO_ENTITY_DROPS)) { this.level.dropItem(this, new ItemBoat()); } close(); } } } return true; }