本文整理汇总了Java中org.bukkit.craftbukkit.entity.CraftLivingEntity类的典型用法代码示例。如果您正苦于以下问题:Java CraftLivingEntity类的具体用法?Java CraftLivingEntity怎么用?Java CraftLivingEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CraftLivingEntity类属于org.bukkit.craftbukkit.entity包,在下文中一共展示了CraftLivingEntity类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: callEntityDeathEvent
import org.bukkit.craftbukkit.entity.CraftLivingEntity; //导入依赖的package包/类
public static EntityDeathEvent callEntityDeathEvent(EntityLiving victim, List<org.bukkit.inventory.ItemStack> drops) {
CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward());
CraftWorld world = (CraftWorld) entity.getWorld();
Bukkit.getServer().getPluginManager().callEvent(event);
victim.expToDrop = event.getDroppedExp();
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
if (stack == null || stack.getType() == Material.AIR || stack.getAmount() == 0) continue;
world.dropItemNaturally(entity.getLocation(), stack);
}
return event;
}
示例2: callEntityDeathEvent
import org.bukkit.craftbukkit.entity.CraftLivingEntity; //导入依赖的package包/类
public static EntityDeathEvent callEntityDeathEvent(EntityLiving victim, List<org.bukkit.inventory.ItemStack> drops) {
CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward());
org.bukkit.World world = entity.getWorld();
Bukkit.getServer().getPluginManager().callEvent(event);
victim.expToDrop = event.getDroppedExp();
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
if (stack == null || stack.getType() == Material.AIR) continue;
world.dropItemNaturally(entity.getLocation(), stack);
}
return event;
}
示例3: CraftEntityEquipment
import org.bukkit.craftbukkit.entity.CraftLivingEntity; //导入依赖的package包/类
public CraftEntityEquipment(CraftLivingEntity entity) {
this.entity = entity;
}
示例4: damageEntity
import org.bukkit.craftbukkit.entity.CraftLivingEntity; //导入依赖的package包/类
public boolean damageEntity(DamageSource damagesource, float f) {
if (!super.damageEntity(damagesource, f)) {
return false;
} else {
EntityLiving entityliving = this.getGoalTarget();
if (entityliving == null && this.bT() instanceof EntityLiving) {
entityliving = (EntityLiving) this.bT();
}
if (entityliving == null && damagesource.getEntity() instanceof EntityLiving) {
entityliving = (EntityLiving) damagesource.getEntity();
}
if (entityliving != null && this.world.difficulty == EnumDifficulty.HARD && (double) this.random.nextFloat() < this.getAttributeInstance(bp).getValue()) {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
EntityZombie entityzombie = new EntityZombie(this.world);
for (int l = 0; l < 50; ++l) {
int i1 = i + MathHelper.nextInt(this.random, 7, 40) * MathHelper.nextInt(this.random, -1, 1);
int j1 = j + MathHelper.nextInt(this.random, 7, 40) * MathHelper.nextInt(this.random, -1, 1);
int k1 = k + MathHelper.nextInt(this.random, 7, 40) * MathHelper.nextInt(this.random, -1, 1);
if (World.a((IBlockAccess) this.world, i1, j1 - 1, k1) && this.world.getLightLevel(i1, j1, k1) < 10) {
entityzombie.setPosition((double) i1, (double) j1, (double) k1);
if (this.world.b(entityzombie.boundingBox) && this.world.getCubes(entityzombie, entityzombie.boundingBox).isEmpty() && !this.world.containsLiquid(entityzombie.boundingBox)) {
this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
// CraftBukkit start - call EntityTargetEvent
org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(entityzombie, entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET);
if (!event.isCancelled()) {
if (event.getTarget() == null) {
entityzombie.setGoalTarget(null);
} else {
entityzombie.setGoalTarget(((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getTarget()).getHandle());
}
}
// CraftBukkit end
entityzombie.prepare((GroupDataEntity) null);
this.getAttributeInstance(bp).a(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
entityzombie.getAttributeInstance(bp).a(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0));
break;
}
}
}
}
return true;
}
}
示例5: callEntityPotionEffectChangeEvent
import org.bukkit.craftbukkit.entity.CraftLivingEntity; //导入依赖的package包/类
public static EntityPotionEffectChangeEvent callEntityPotionEffectChangeEvent(EntityLiving living, MobEffect mobEffect, EntityPotionEffectChangeEvent.Cause cause, World world, double locX, double locY, double locZ){
PotionEffect effect = new PotionEffect(PotionEffectType.getById(mobEffect.getEffectId()), mobEffect.getDuration(), mobEffect.getAmplifier());
CraftLivingEntity entity = (CraftLivingEntity) living.getBukkitEntity();
Location location = new Location(world.getWorld(), locX, locY, locZ);
return callEntityPotionEffectChangeEvent(entity, effect, cause, location);
}