本文整理汇总了Java中net.minecraft.entity.monster.EntityMob.getCreatureAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java EntityMob.getCreatureAttribute方法的具体用法?Java EntityMob.getCreatureAttribute怎么用?Java EntityMob.getCreatureAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.monster.EntityMob
的用法示例。
在下文中一共展示了EntityMob.getCreatureAttribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateTick
import net.minecraft.entity.monster.EntityMob; //导入方法依赖的package包/类
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand)
{
if (!world.isRemote)
{
world.scheduleUpdate(pos, this, 5);
AxisAlignedBB axisalignedbb = this.getCollisionBoundingBox(world, pos, state).expand(6, 6, 6);
List<EntityMob> list = world.getEntitiesWithinAABB(EntityMob.class, axisalignedbb);
for (EntityMob mob : list)
{
if (mob.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
{
mob.setFire(20);
}
}
}
}
示例2: onUpdate
import net.minecraft.entity.monster.EntityMob; //导入方法依赖的package包/类
@Override
public void onUpdate(ItemStack is, World w, Entity e, int i, boolean isHeld) {
if (w.isRemote || is.getItemDamage() > 0)
return;
if (e instanceof EntityLivingBase) {
final EntityLivingBase sucker = (EntityLivingBase) e;
if ((sucker.getAge() & 127) == 0)
if (sucker.getCreatureAttribute() != EnumCreatureAttribute.UNDEAD) {
final List li = w.getEntitiesWithinAABBExcludingEntity(sucker,
AxisAlignedBB.getBoundingBox(sucker.posX - 32, sucker.posY - 8, sucker.posZ - 32,
sucker.posX + 32, sucker.posY + 24, sucker.posZ + 32));
for (final Object ent : li)
if (ent instanceof EntityMob) {
final EntityMob joker = (EntityMob) ent;
if (joker.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
if (ent instanceof IIaSMobGetters) {
((IIaSMobGetters) ent).setSearchTarget(sucker);
} else if (!joker.isInvisible() && joker.getAttackTarget() == null) {
joker.setTarget(sucker);
}
}
}
}
super.onUpdate(is, w, e, i, isHeld);
}
示例3: shouldDefend
import net.minecraft.entity.monster.EntityMob; //导入方法依赖的package包/类
@Override
public boolean shouldDefend(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, ArmourSlot slot) {
Entity entity = source.getSourceOfDamage();
if (entity == null) {
return false;
}
if (!(entity instanceof EntityMob)) {
return false;
}
EntityMob entityMob = (EntityMob) entity;
return entityMob.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD;
}
示例4: shouldDefend
import net.minecraft.entity.monster.EntityMob; //导入方法依赖的package包/类
@Override
public boolean shouldDefend(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, ArmourSlot slot) {
Entity entity = source.getSourceOfDamage();
if (entity == null) {
return false;
}
if (!(entity instanceof EntityMob)) {
return false;
}
EntityMob entityMob = (EntityMob) entity;
return entityMob.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD;
}