当前位置: 首页>>代码示例>>Java>>正文


Java IEntityOwnable类代码示例

本文整理汇总了Java中net.minecraft.entity.IEntityOwnable的典型用法代码示例。如果您正苦于以下问题:Java IEntityOwnable类的具体用法?Java IEntityOwnable怎么用?Java IEntityOwnable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IEntityOwnable类属于net.minecraft.entity包,在下文中一共展示了IEntityOwnable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: matches

import net.minecraft.entity.IEntityOwnable; //导入依赖的package包/类
@Override
protected boolean matches(EntityLivingBase entity) {
    if (type == BOSS) return !entity.isNonBoss();
    else if (!entity.isNonBoss()) return false;

    switch (type) {
        case ANIMAL:    return entity instanceof EntityAnimal;
        case MONSTER:   return entity instanceof IMob;
        case TAMEABLE:  return entity instanceof IEntityOwnable;
        case PLAYER:    return entity instanceof EntityPlayer;
        case WATER:     return entity instanceof EntityWaterMob || entity instanceof EntityGuardian;
        case NPC:       return entity instanceof INpc;
        case GOLEM:     return entity instanceof EntityGolem;
        default:        return false;
    }
}
 
开发者ID:joshiejack,项目名称:Progression,代码行数:17,代码来源:FilterEntityType.java

示例2: serialize

import net.minecraft.entity.IEntityOwnable; //导入依赖的package包/类
@Override
public JsonElement serialize(Entity src, Type typeOfSrc, JsonSerializationContext context)
{
    JsonObject object = new JsonObject();
    object.addProperty("x", MathHelper.floor_double(src.posX));
    object.addProperty("y", MathHelper.floor_double(src.posY + 0.5d));
    object.addProperty("z", MathHelper.floor_double(src.posZ));
    if (src instanceof EntityPlayer)
    {
        object.addProperty("player", src.getUniqueID().toString());
    }
    else
    {
        object.addProperty("id", EntityList.getEntityString(src));
        if (src instanceof EntityLiving) object.addProperty("name", ((EntityLiving) src).getCustomNameTag());
        if (src instanceof IEntityOwnable) object.addProperty("owner", ((IEntityOwnable) src).func_152113_b());
    }
    return object;
}
 
开发者ID:DoubleDoorDevelopment,项目名称:D3Log,代码行数:20,代码来源:EntityJson.java

示例3: isSuitableTarget

import net.minecraft.entity.IEntityOwnable; //导入依赖的package包/类
public static boolean isSuitableTarget(EntityPlayer attacker, @Nullable EntityLivingBase target, boolean includeInvincibles, boolean checkSight)
{
    if (target == null)
    {
        return false;
    }
    else if (target == attacker)
    {
        return false;
    }
    else if (!target.isEntityAlive())
    {
        return false;
    }
    else if (target instanceof EntityPlayer && !attacker.canAttackPlayer((EntityPlayer) target))
    {
        return false;
    }
    else
    {
        if (attacker instanceof IEntityOwnable && ((IEntityOwnable)attacker).getOwnerId() != null)
        {
            if (target instanceof IEntityOwnable && ((IEntityOwnable)attacker).getOwnerId().equals(target.getUniqueID()))
            {
                return false;
            }

            if (target == ((IEntityOwnable)attacker).getOwner())
            {
                return false;
            }
        }
        else if (target instanceof EntityPlayer && !includeInvincibles && ((EntityPlayer)target).capabilities.disableDamage)
        {
            return false;
        }

        return !checkSight || attacker.canEntityBeSeen(target);
    }
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:41,代码来源:SpinToWin.java

示例4: testCondition

import net.minecraft.entity.IEntityOwnable; //导入依赖的package包/类
@Override
public boolean testCondition(Random rand, LootContext context) {

	Entity player = this.team ? context.getKiller() : context.getKillerPlayer();
	if(player instanceof IEntityOwnable && ((IEntityOwnable)player).getOwner() instanceof EntityPlayer)
		player = ((IEntityOwnable)player).getOwner();
	return player != null && player.getTeam() != null && !player.isOnSameTeam(context.getLootedEntity());
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:9,代码来源:KilledByTeam.java

示例5: isSuitableTarget

import net.minecraft.entity.IEntityOwnable; //导入依赖的package包/类
@Override
protected boolean isSuitableTarget(EntityLivingBase target, boolean includeInvincibles) {
	if (target == null)
		return false;
	else if (target == this.taskOwner)
		return false;
	else if (!target.isEntityAlive())
		return false;
	else if (!this.taskOwner.canAttackClass(target.getClass()))
		return false;
	else{
		Team team = this.taskOwner.getTeam();
		Team team1 = target.getTeam();
		boolean medic = (this.taskOwner instanceof EntityMedic);
		if ((team != null && team1 == team) && !medic)
			return false;
		else {
			if (!medic && this.taskOwner instanceof IEntityOwnable
					&& ((IEntityOwnable) this.taskOwner).getOwnerId() != null) {
				if (target instanceof IEntityOwnable && ((IEntityOwnable) this.taskOwner).getOwnerId()
						.equals(((IEntityOwnable) target).getOwnerId()))
					return false;

				if (target == ((IEntityOwnable) this.taskOwner).getOwner())
					return false;
			} else if (target instanceof EntityPlayer && !includeInvincibles
					&& ((EntityPlayer) target).capabilities.disableDamage)
				return false;

			return !this.shouldCheckSight || this.taskOwner.getEntitySenses().canSee(target);
		}
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:34,代码来源:EntityAINearestChecked.java

示例6: isSuitableTarget

import net.minecraft.entity.IEntityOwnable; //导入依赖的package包/类
@Override
protected boolean isSuitableTarget(EntityLivingBase target, boolean includeInvincibles) {
	if (target == null)
		return false;
	else if (target == this.taskOwner)
		return false;
	else if (!target.isEntityAlive())
		return false;
	else if (!this.taskOwner.canAttackClass(target.getClass()))
		return false;
	else {
		Team team = this.taskOwner.getTeam();
		Team team1 = target.getTeam();

		if ((team != null && team1 == team) && !(this.taskOwner instanceof EntityMedic))
			return false;
		else {
			if (this.taskOwner instanceof IEntityOwnable
					&& ((IEntityOwnable) this.taskOwner).getOwnerId() != null) {
				if (target instanceof IEntityOwnable && ((IEntityOwnable) this.taskOwner).getOwnerId()
						.equals(((IEntityOwnable) target).getOwnerId()))
					return false;

				if (target == ((IEntityOwnable) this.taskOwner).getOwner())
					return false;
			} else if (target instanceof EntityPlayer && !includeInvincibles
					&& ((EntityPlayer) target).capabilities.disableDamage)
				return false;

			return !this.shouldCheckSight || this.taskOwner.getEntitySenses().canSee(target);
		}
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:34,代码来源:EntityAIOwnerHurt.java

示例7: getAttributeModifier

import net.minecraft.entity.IEntityOwnable; //导入依赖的package包/类
@Override
public float getAttributeModifier(String attribute) {
	if (!(this.getAttackTarget() instanceof EntityPlayer || (this.getAttackTarget() instanceof IEntityOwnable && ((IEntityOwnable) this.getAttackTarget()).getOwnerId() != null))) {
		if (attribute.equals("Heal"))
			return this.getDiff() == 1 ? 0.75f : (this.getDiff() == 3 ? 1f : 0.9f);
		if (attribute.equals("Overheal"))
			return this.getDiff() == 1 ? 0.55f : (this.getDiff() == 3 ? 0.85f : 0.7f);
	}
	return super.getAttributeModifier(attribute);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:11,代码来源:EntityMedic.java

示例8: isOnTeam

import net.minecraft.entity.IEntityOwnable; //导入依赖的package包/类
/**
 * Returns true if the entity is considered friendly to the player (or IS the player)
 */
public static boolean isOnTeam(EntityPlayer player, EntityLivingBase entity) {
	if (entity == player) {
		return true;
	} else if (player.isOnSameTeam(entity)) {
		return true;
	} else if (entity instanceof IEntityOwnable) {
		return ((IEntityOwnable) entity).getOwner() == player;
	} else {
		return false;
	}
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:15,代码来源:TargetUtils.java

示例9: isSuitableTarget

import net.minecraft.entity.IEntityOwnable; //导入依赖的package包/类
/**
 * A static method used to see if an entity is a suitable target through a number of checks.
 */
public static boolean isSuitableTarget(EntityLiving attacker, EntityLivingBase target, boolean includeInvincibles, boolean checkSight)
{
    if (target == null)
    {
        return false;
    }
    else if (target == attacker)
    {
        return false;
    }
    else if (!target.isEntityAlive())
    {
        return false;
    }
    else if (!attacker.canAttackClass(target.getClass()))
    {
        return false;
    }
    else
    {
        Team team = attacker.getTeam();
        Team team1 = target.getTeam();

        if (team != null && team1 == team)
        {
            return false;
        }
        else
        {
            if (attacker instanceof IEntityOwnable && StringUtils.isNotEmpty(((IEntityOwnable)attacker).getOwnerId()))
            {
                if (target instanceof IEntityOwnable && ((IEntityOwnable)attacker).getOwnerId().equals(((IEntityOwnable)target).getOwnerId()))
                {
                    return false;
                }

                if (target == ((IEntityOwnable)attacker).getOwner())
                {
                    return false;
                }
            }
            else if (target instanceof EntityPlayer && !includeInvincibles && ((EntityPlayer)target).capabilities.disableDamage)
            {
                return false;
            }

            return !checkSight || attacker.getEntitySenses().canSee(target);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:54,代码来源:EntityAITarget.java

示例10: isSuitableTarget

import net.minecraft.entity.IEntityOwnable; //导入依赖的package包/类
/**
 * A static method used to see if an entity is a suitable target through a number of checks.
 */
public static boolean isSuitableTarget(EntityLiving attacker, @Nullable EntityLivingBase target, boolean includeInvincibles, boolean checkSight)
{
    if (target == null)
    {
        return false;
    }
    else if (target == attacker)
    {
        return false;
    }
    else if (!target.isEntityAlive())
    {
        return false;
    }
    else if (!attacker.canAttackClass(target.getClass()))
    {
        return false;
    }
    else if (attacker.isOnSameTeam(target))
    {
        return false;
    }
    else
    {
        if (attacker instanceof IEntityOwnable && ((IEntityOwnable)attacker).getOwnerId() != null)
        {
            if (target instanceof IEntityOwnable && ((IEntityOwnable)attacker).getOwnerId().equals(target.getUniqueID()))
            {
                return false;
            }

            if (target == ((IEntityOwnable)attacker).getOwner())
            {
                return false;
            }
        }
        else if (target instanceof EntityPlayer && !includeInvincibles && ((EntityPlayer)target).capabilities.disableDamage)
        {
            return false;
        }

        return !checkSight || attacker.getEntitySenses().canSee(target);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:48,代码来源:EntityAITarget.java

示例11: isOnSameTeam

import net.minecraft.entity.IEntityOwnable; //导入依赖的package包/类
public static boolean isOnSameTeam(Entity entity1, Entity entity2) {
	return (TF2Util.getTeam(entity1) == TF2Util.getTeam(entity2) && TF2Util.getTeam(entity1) != null)
			|| (entity1 instanceof IEntityOwnable && ((IEntityOwnable) entity1).getOwner() == entity2) 
			|| (entity2 instanceof IEntityOwnable && ((IEntityOwnable) entity2).getOwner() == entity1) || entity1 == entity2;

}
 
开发者ID:rafradek,项目名称:Mods,代码行数:7,代码来源:TF2Util.java

示例12: shouldScaleAttributes

import net.minecraft.entity.IEntityOwnable; //导入依赖的package包/类
public boolean shouldScaleAttributes() {
	return this.getAttackTarget() != null && (this.getAttackTarget() instanceof EntityPlayer 
			|| this.getAttackTarget() instanceof IEntityOwnable && ((IEntityOwnable) this.getAttackTarget()).getOwnerId() != null) && this.getOwnerId() == null;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:5,代码来源:EntityTF2Character.java

示例13: isSuitableTarget

import net.minecraft.entity.IEntityOwnable; //导入依赖的package包/类
/**
 * A static method used to see if an entity is a suitable target through a number of checks.
 */
public static boolean isSuitableTarget(EntityLiving attacker, EntityLivingBase target, boolean includeInvincibles, boolean checkSight)
{
    if (target == null)
    {
        return false;
    }
    else if (target == attacker)
    {
        return false;
    }
    else if (!target.isEntityAlive())
    {
        return false;
    }
    else if (!attacker.canAttackClass(target.getClass()))
    {
        return false;
    }
    else if (attacker.isOnSameTeam(target))
    {
        return false;
    }
    else
    {
        if (attacker instanceof IEntityOwnable && ((IEntityOwnable)attacker).getOwnerId() != null)
        {
            if (target instanceof IEntityOwnable && ((IEntityOwnable)attacker).getOwnerId().equals(target.getUniqueID()))
            {
                return false;
            }

            if (target == ((IEntityOwnable)attacker).getOwner())
            {
                return false;
            }
        }
        else if (target instanceof EntityPlayer && !includeInvincibles && ((EntityPlayer)target).capabilities.disableDamage)
        {
            return false;
        }

        return !checkSight || attacker.getEntitySenses().canSee(target);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:48,代码来源:EntityAITarget.java

示例14: onEntityTick

import net.minecraft.entity.IEntityOwnable; //导入依赖的package包/类
@Override
public void onEntityTick(@Nonnull EntityArmyMember armyMember) {
	for (Entity entity : armyMember.world.getEntitiesWithinAABBExcludingEntity(armyMember, armyMember.getEntityBoundingBox().grow(5)))
		if (entity instanceof EntityLivingBase && entity instanceof IEntityOwnable && ((IEntityOwnable) entity).getOwnerId() != null && ((IEntityOwnable) entity).getOwnerId().equals(armyMember.getOwnerId()) && ((EntityLivingBase) entity).getActivePotionEffect(MobEffects.RESISTANCE) == null)
			((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 120));
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:7,代码来源:AugmentMummy.java

示例15: passesFilter

import net.minecraft.entity.IEntityOwnable; //导入依赖的package包/类
public boolean passesFilter(Entity entity){
	if(filter == null || filter == FilterType.NONE) return false;
	switch(filter){
		default : case ALL : {
			return true; 
		}
		case PLAYER : {
			return entity instanceof EntityPlayer; 
		}
		case UNDEAD : {
			return (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).getCreatureAttribute() == EnumCreatureAttribute.UNDEAD);
		}
		case ARTHROPOD : {
			return (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD);
		}
		case MONSTER : {
			return (entity instanceof IMob);
		}
		case ANIMAL : {
			return (entity instanceof EntityAnimal);
		}
		case LIVING : {
			return (entity instanceof EntityLiving);
		}
		case WATER : {
			return (entity instanceof EntityWaterMob || entity instanceof EntityGuardian);
		}
		case BABY : {
			return (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isChild());
		}
		case PET : {
			return (entity instanceof IEntityOwnable);
		}
		case SLIME : {
			return (entity instanceof EntitySlime);
		}
		case VILLAGER : {
			return (entity instanceof EntityVillager);
		}
		case ITEM : {
			return (entity instanceof EntityItem);
		}
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:45,代码来源:TileEntityEntityHopper.java


注:本文中的net.minecraft.entity.IEntityOwnable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。