本文整理匯總了Java中net.minecraft.entity.EnumCreatureAttribute類的典型用法代碼示例。如果您正苦於以下問題:Java EnumCreatureAttribute類的具體用法?Java EnumCreatureAttribute怎麽用?Java EnumCreatureAttribute使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EnumCreatureAttribute類屬於net.minecraft.entity包,在下文中一共展示了EnumCreatureAttribute類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addCollisionBoxToList
import net.minecraft.entity.EnumCreatureAttribute; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_) {
if (entityIn instanceof EntityLivingBase && (((EntityLivingBase) entityIn).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)) {
collidingBoxes.add(new AxisAlignedBB(pos).expand(0, 255, 0));
}
if (entityIn instanceof EntityLivingBase && (((EntityLivingBase) entityIn).getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD)) {
entityIn.attackEntityFrom(DamageSource.MAGIC, 1);
}
if (entityIn instanceof EntityBlaze) {
collidingBoxes.add(new AxisAlignedBB(pos).expand(0, 255, 0));
}
if (entityIn instanceof EntityEnderman) {
collidingBoxes.add(new AxisAlignedBB(pos).expand(0, 255, 0));
}
if (entityIn instanceof EntityGhast) {
collidingBoxes.add(new AxisAlignedBB(pos).expand(0, 255, 0));
}
if (entityIn instanceof EntityVex) {
collidingBoxes.add(new AxisAlignedBB(pos).expand(0, 255, 0));
}
}
示例2: apply
import net.minecraft.entity.EnumCreatureAttribute; //導入依賴的package包/類
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
if (amplifier >= 3) {
if (entity instanceof EntityWitch) {
entity.setFire(500);
entity.attackEntityFrom(DamageSource.MAGIC, 20);
} else if (entity.getCreatureAttribute() == EnumCreatureAttribute.ILLAGER) {
entity.addPotionEffect(new PotionEffect(MobEffects.WITHER, 1500, 0));
entity.attackEntityFrom(DamageSource.MAGIC, 20);
}
} else if (amplifier == 2 && entity.getCreatureAttribute() == EnumCreatureAttribute.ILLAGER || entity instanceof EntityWitch) {
entity.attackEntityFrom(DamageSource.MAGIC, 16);
} else if (entity.getCreatureAttribute() == EnumCreatureAttribute.ILLAGER) {
entity.attackEntityFrom(DamageSource.MAGIC, 10);
}
}
示例3: updateTick
import net.minecraft.entity.EnumCreatureAttribute; //導入依賴的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);
}
}
}
}
示例4: shouldDefend
import net.minecraft.entity.EnumCreatureAttribute; //導入依賴的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;
}
示例5: shouldDefend
import net.minecraft.entity.EnumCreatureAttribute; //導入依賴的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;
}
示例6: shouldSilverHurt
import net.minecraft.entity.EnumCreatureAttribute; //導入依賴的package包/類
public static boolean shouldSilverHurt(EntityLivingBase target)
{
Class enClass = target.getClass();
String name = "";
if(enClass != null && EntityList.classToStringMapping.get(enClass) != null)
{
name = (String) EntityList.classToStringMapping.get(enClass);
}
if (target.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
{
return true;
}
if (name.endsWith("Werewolf"))
{
return true;
}
return false;
}
示例7: shouldDamage
import net.minecraft.entity.EnumCreatureAttribute; //導入依賴的package包/類
@Override
public boolean shouldDamage(DamageSource source)
{
if(material == EnumArmourMF.GUILDED)
{
if(source.getSourceOfDamage() != null && source.getSourceOfDamage() instanceof EntityLivingBase)
{
if(((EntityLivingBase)source.getSourceOfDamage()).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
{
return false;
}
}
}
if(material == EnumArmourMF.DRAGONFORGE)
{
if(source.isFireDamage())
{
return false;
}
}
return true;
}
示例8: hitEntity
import net.minecraft.entity.EnumCreatureAttribute; //導入依賴的package包/類
@Override
public boolean hitEntity(ItemStack weapon, EntityLiving target, EntityLiving user)
{
if(this.toolMaterial == ToolMaterialMedieval.DRAGONFORGE)
target.setFire(20);
if(this.toolMaterial == ToolMaterialMedieval.IGNOTUMITE)
{
user.heal(2);
}
if(this.toolMaterial == ToolMaterialMedieval.ORNATE)
{
if (((EntityLiving) target).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD || target.getClass().getName().endsWith("MoCEntityWarewolf"))
{
target.setFire(20);
target.worldObj.playSoundAtEntity(target, "random.fizz", 1, 1);
}
}
return super.hitEntity(weapon, target, user);
}
示例9: getDamage
import net.minecraft.entity.EnumCreatureAttribute; //導入依賴的package包/類
@Override
public float getDamage(Entity tar)
{
float dam = weaponDamage;
if(tar != null && tar instanceof EntityLiving && toolMaterial == ToolMaterialMedieval.ORNATE)
{
if (((EntityLiving) tar).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD || tar.getClass().getName().endsWith("MoCEntityWarewolf"))
{
if(tar.getClass().getName().endsWith("MoCEntityWarewolf"))
{
dam *= 10;
}
else
{
dam *= 2;
}
}
}
return dam;
}
示例10: getHearing
import net.minecraft.entity.EnumCreatureAttribute; //導入依賴的package包/類
public static int getHearing(Entity entity)
{
if(entity instanceof ISpecialSenses)
{
return((ISpecialSenses)entity).getSight();
}
if(entity instanceof EntityMob)
{
if(((EntityMob)entity).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
{
return 10;
}
}
return 5;
}
示例11: onUpdate
import net.minecraft.entity.EnumCreatureAttribute; //導入依賴的package包/類
@Override
public void onUpdate(ItemStack is, World w, Entity ent, int time, boolean holding) {
if (ent instanceof EntityLivingBase) {
final EntityLivingBase el = (EntityLivingBase) ent;
if (el.getEquipmentInSlot(0) == null)
return;
if (el.getEquipmentInSlot(0).getItem() != this)
return;
else if (el.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
return;
else if (!el.isPotionActive(Potion.wither.id)) {
el.addPotionEffect(new PotionEffect(Potion.wither.id, 41, 0));
}
}
super.onUpdate(is, w, ent, time, holding);
}
示例12: doShadowAttack
import net.minecraft.entity.EnumCreatureAttribute; //導入依賴的package包/類
public void doShadowAttack(EntityLivingBase par1EntityLiving, float par2) {
final boolean harm_undead = par1EntityLiving.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD;
final EntityThrowable entityball = new EntityShadowBall(worldObj, this, harm_undead,
IaSWorldHelper.getRegionLevel(par1EntityLiving) >= 6);
final double d0 = par1EntityLiving.posX + par1EntityLiving.motionX - posX;
final double d1 = par1EntityLiving.posY + par1EntityLiving.getEyeHeight() - getEyeHeight() - posY;
final double d2 = par1EntityLiving.posZ + par1EntityLiving.motionZ - posZ;
final float f1 = MathHelper.sqrt_double(d0 * d0 + d2 * d2);
if (f1 <= 2.0) {
entityball.setThrowableHeading(d0, d1, d2, 0.40F, 8.0F);
} else {
entityball.rotationPitch += 20.0F;
}
entityball.setThrowableHeading(d0, d1 + f1 * 0.2F, d2, 0.80F, 8.0F);
worldObj.spawnEntityInWorld(entityball);
}
示例13: hitEntity
import net.minecraft.entity.EnumCreatureAttribute; //導入依賴的package包/類
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, @Nonnull EntityLivingBase attacker) {
if (!target.world.isRemote) {
if (target.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD && attacker instanceof EntityPlayer) {
target.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 12);
stack.damageItem(25, attacker);
} else {
stack.damageItem(1, attacker);
}
}
return true;
}
示例14: onEntityDamage
import net.minecraft.entity.EnumCreatureAttribute; //導入依賴的package包/類
@SubscribeEvent
public void onEntityDamage(LivingHurtEvent event) {
DamageSource source = event.getSource();
Entity attacker = source.getTrueSource();
if ((attacker instanceof EntityLivingBase) && ((EntityLivingBase) attacker).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD) {
event.setAmount(event.getAmount() * 0.95F);
}
}
示例15: addCollisionBoxToList
import net.minecraft.entity.EnumCreatureAttribute; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_) {
if (entityIn instanceof EntityLivingBase && (((EntityLivingBase) entityIn).getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD)) {
entityIn.attackEntityFrom(DamageSource.MAGIC, 4);
}
if (entityIn instanceof EntityLivingBase && (((EntityLivingBase) entityIn).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)) {
entityIn.attackEntityFrom(DamageSource.MAGIC, 4);
}
}