本文整理匯總了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;
}