本文整理汇总了Java中cn.nukkit.entity.EntityHumanType类的典型用法代码示例。如果您正苦于以下问题:Java EntityHumanType类的具体用法?Java EntityHumanType怎么用?Java EntityHumanType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityHumanType类属于cn.nukkit.entity包,在下文中一共展示了EntityHumanType类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doPostAttack
import cn.nukkit.entity.EntityHumanType; //导入依赖的package包/类
@Override
public void doPostAttack(Entity attacker, Entity entity) {
if (!(entity instanceof EntityHumanType)) {
return;
}
EntityHumanType human = (EntityHumanType) entity;
int thornsDamage = 0;
Random rnd = new Random();
for (Item armor : human.getInventory().getArmorContents()) {
Enchantment thorns = armor.getEnchantment(Enchantment.ID_THORNS);
if (thorns != null && thorns.getLevel() > 0) {
int chance = thorns.getLevel() * 15;
if (chance > 90) {
chance = 90;
}
if (rnd.nextInt(100) + 1 <= chance) {
thornsDamage += rnd.nextInt(4) + 1;
}
}
}
if (thornsDamage > 0) {
attacker.attack(new EntityDamageEvent(attacker, DamageCause.MAGIC, rnd.nextInt(4) + 1));
}
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:32,代码来源:EnchantmentThorns.java
示例2: PlayerInventory
import cn.nukkit.entity.EntityHumanType; //导入依赖的package包/类
public PlayerInventory(EntityHumanType player) {
super(player, InventoryType.PLAYER);
this.hotbar = new int[this.getHotbarSize()];
for (int i = 0; i < this.hotbar.length; i++) {
this.hotbar[i] = i;
}
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:10,代码来源:PlayerInventory.java
示例3: PlayerInventory
import cn.nukkit.entity.EntityHumanType; //导入依赖的package包/类
public PlayerInventory(EntityHumanType player) {
super(player, InventoryType.PLAYER);
this.hotbar = new int[this.getHotbarSize()];
for (int i = 0; i < this.hotbar.length; i++) {
this.hotbar[i] = i;
}
}
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:8,代码来源:PlayerInventory.java
示例4: doPostAttack
import cn.nukkit.entity.EntityHumanType; //导入依赖的package包/类
@Override
public void doPostAttack(Entity attacker, Entity entity) {
if (!(entity instanceof EntityHumanType)) {
return;
}
EntityHumanType human = (EntityHumanType) entity;
int thornsDamage = 0;
Random rnd = new Random();
for (Item armor : human.getInventory().getArmorContents()) {
Enchantment thorns = armor.getEnchantment(Enchantment.ID_THORNS);
if (thorns != null && thorns.getLevel() > 0) {
int chance = thorns.getLevel() * 15;
if (chance > 90) {
chance = 90;
}
if (rnd.nextInt(100) + 1 <= chance) {
thornsDamage += rnd.nextInt(4) + 1;
}
}
}
if (thornsDamage > 0) {
attacker.attack(new EntityDamageEvent(attacker, EntityDamageEvent.CAUSE_MAGIC, rnd.nextInt(4) + 1));
}
}
开发者ID:NycuRO,项目名称:Apollo-OLD,代码行数:32,代码来源:EnchantmentThorns.java
示例5: PlayerEnderChestInventory
import cn.nukkit.entity.EntityHumanType; //导入依赖的package包/类
public PlayerEnderChestInventory(EntityHumanType player) {
super(player, InventoryType.ENDER_CHEST);
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:4,代码来源:PlayerEnderChestInventory.java
示例6: PlayerOffhandInventory
import cn.nukkit.entity.EntityHumanType; //导入依赖的package包/类
public PlayerOffhandInventory(EntityHumanType holder) {
super(holder, InventoryType.OFFHAND);
}
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:4,代码来源:PlayerOffhandInventory.java
注:本文中的cn.nukkit.entity.EntityHumanType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论