本文整理汇总了Java中org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent方法的典型用法代码示例。如果您正苦于以下问题:Java CraftEventFactory.callEntityDeathEvent方法的具体用法?Java CraftEventFactory.callEntityDeathEvent怎么用?Java CraftEventFactory.callEntityDeathEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.craftbukkit.event.CraftEventFactory
的用法示例。
在下文中一共展示了CraftEventFactory.callEntityDeathEvent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dropDeathLoot
import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - Whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int j = this.random.nextInt(3) + this.random.nextInt(1 + i);
int k;
if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(Item.LEATHER.id, j));
}
j = this.random.nextInt(3) + 1 + this.random.nextInt(1 + i);
if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(this.isBurning() ? Item.COOKED_BEEF.id : Item.RAW_BEEF.id, j));
}
CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end
}
示例2: dropDeathLoot
import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
protected void dropDeathLoot(boolean flag, int i) {
int j = this.getLootId();
if (j > 0) {
// CraftBukkit start - Whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int count = this.random.nextInt(2 + i);
if ((j > 0) && (count > 0)) {
loot.add(new org.bukkit.inventory.ItemStack(j, count));
}
CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end
}
}
示例3: dropDeathLoot
import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int j = this.random.nextInt(3) + 1 + this.random.nextInt(1 + i);
if (j > 0) {
if (this.isBurning()) {
loot.add(new org.bukkit.inventory.ItemStack(Item.GRILLED_PORK.id, j));
} else {
loot.add(new org.bukkit.inventory.ItemStack(Item.PORK.id, j));
}
}
if (this.hasSaddle()) {
loot.add(new org.bukkit.inventory.ItemStack(Item.SADDLE.id, 1));
}
CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end
}
示例4: dropDeathLoot
import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
protected void dropDeathLoot(boolean flag, int i) {
int j = this.getLootId();
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
if (j > 0) {
int k = this.random.nextInt(3);
if (i > 0) {
k += this.random.nextInt(i + 1);
}
if (k > 0) {
loot.add(new org.bukkit.inventory.ItemStack(j, k));
}
}
// Drop a music disc?
if (this.record != -1) {
loot.add(new org.bukkit.inventory.ItemStack(this.record, 1));
this.record = -1;
}
CraftEventFactory.callEntityDeathEvent(this, loot); // raise event even for those times when the entity does not drop loot
}
示例5: dropDeathLoot
import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int j = this.random.nextInt(16);
if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(Item.SNOW_BALL.id, j));
}
CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end
}
示例6: die
import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void die(DamageSource damagesource) {
Entity entity = damagesource.getEntity();
EntityLiving entityliving = this.aS();
if (this.bb >= 0 && entityliving != null) {
entityliving.b(this, this.bb);
}
if (entity != null) {
entity.a(this);
}
this.aU = true;
if (!this.world.isStatic) {
int i = 0;
if (entity instanceof EntityHuman) {
i = EnchantmentManager.getBonusMonsterLootEnchantmentLevel((EntityLiving) entity);
}
if (!this.isBaby() && this.world.getGameRules().getBoolean("doMobLoot")) {
this.dropDeathLoot(this.lastDamageByPlayerTime > 0, i);
this.dropEquipment(this.lastDamageByPlayerTime > 0, i);
if (false && this.lastDamageByPlayerTime > 0) { // CraftBukkit - move rare item drop call to dropDeathLoot
int j = this.random.nextInt(200) - i;
if (j < 5) {
this.l(j <= 0 ? 1 : 0);
}
}
} else { // CraftBukkit
CraftEventFactory.callEntityDeathEvent(this); // CraftBukkit
}
}
this.world.broadcastEntityEffect(this, (byte) 3);
}
示例7: dropDeathLoot
import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
loot.add(new org.bukkit.inventory.ItemStack(Item.NETHER_STAR.id, 1));
CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end
}
示例8: die
import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void die(DamageSource damagesource) {
Entity entity = damagesource.getEntity();
EntityLiving entityliving = this.aX();
if (this.ba >= 0 && entityliving != null) {
entityliving.b(this, this.ba);
}
if (entity != null) {
entity.a(this);
}
this.aT = true;
this.aW().g();
if (!this.world.isStatic) {
int i = 0;
if (entity instanceof EntityHuman) {
i = EnchantmentManager.getBonusMonsterLootEnchantmentLevel((EntityLiving) entity);
}
if (this.aG() && this.world.getGameRules().getBoolean("doMobLoot")) {
this.drops = new ArrayList<org.bukkit.inventory.ItemStack>(); // CraftBukkit - Setup drop capture
this.dropDeathLoot(this.lastDamageByPlayerTime > 0, i);
this.dropEquipment(this.lastDamageByPlayerTime > 0, i);
if (this.lastDamageByPlayerTime > 0) {
int j = this.random.nextInt(200) - i;
if (j < 5) {
this.getRareDrop(j <= 0 ? 1 : 0);
}
}
// CraftBukkit start - Call death event
CraftEventFactory.callEntityDeathEvent(this, this.drops);
this.drops = null;
} else {
CraftEventFactory.callEntityDeathEvent(this);
// CraftBukkit end
}
}
this.world.broadcastEntityEffect(this, (byte) 3);
}