當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityCreature類代碼示例

本文整理匯總了Java中net.minecraft.entity.EntityCreature的典型用法代碼示例。如果您正苦於以下問題:Java EntityCreature類的具體用法?Java EntityCreature怎麽用?Java EntityCreature使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EntityCreature類屬於net.minecraft.entity包,在下文中一共展示了EntityCreature類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initializeEntityActivationType

import net.minecraft.entity.EntityCreature; //導入依賴的package包/類
/**
 * Initializes an entities type on construction to specify what group this
 * entity is in for activation ranges.
 *
 * @param entity
 * @return group id
 */
public static byte initializeEntityActivationType(Entity entity)
{
    Chunk chunk = null;
    // Cauldron start - account for entities that dont extend EntityMob, EntityAmbientCreature, EntityCreature
    if ( entity instanceof EntityMob || entity instanceof EntitySlime || entity.isCreatureType(EnumCreatureType.monster, false)) // Cauldron - account for entities that dont extend EntityMob
    {
        return 1; // Monster
    } else if ( entity instanceof EntityCreature || entity instanceof EntityAmbientCreature || entity.isCreatureType(EnumCreatureType.creature, false) 
             || entity.isCreatureType(EnumCreatureType.waterCreature, false) || entity.isCreatureType(EnumCreatureType.ambient, false))
    {
        return 2; // Animal
    // Cauldron end
    } else
    {
        return 3; // Misc
    }
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:25,代碼來源:ActivationRange.java

示例2: onDrops

import net.minecraft.entity.EntityCreature; //導入依賴的package包/類
@SubscribeEvent
public void onDrops(LivingDropsEvent event) {
	World world = event.getEntity().getEntityWorld();

	if (world.isRemote || !(event.getEntity() instanceof EntityCreature)) {
		return;
	}

	if (event.getSource() == null || event.getSource().getTrueSource() == null){
		return;
	}

	if (!(event.getSource().getTrueSource() instanceof EntityPlayer)) {
		return;
	}

	if (event.getEntity().getTags().contains(NemesisSystem.TAG_NEMESIS)) {
		handleNemesisDrops(event.getDrops(), (EntityCreature) event.getEntity());
	}
}
 
開發者ID:ToroCraft,項目名稱:NemesisSystem,代碼行數:21,代碼來源:DeathHandler.java

示例3: buffMobInAroundNemeses

import net.minecraft.entity.EntityCreature; //導入依賴的package包/類
private void buffMobInAroundNemeses(World world, EntityCreature entity) {
	if (!(entity instanceof EntityMob)) {
		return;
	}

	if (entity.getTags().contains(NemesisSystem.TAG_BUFF_MOB_REINFORCEMENT)) {
		return;
	}

	List<NemesisEntry> nemeses = NemesisRegistryProvider.get(world).list();
	sortByHighestLevel(nemeses);

	for (NemesisEntry nemesis : nemeses) {
		if (buffEntity(entity, nemesis)) {
			return;
		}
	}
}
 
開發者ID:ToroCraft,項目名稱:NemesisSystem,代碼行數:19,代碼來源:SpawnHandler.java

示例4: handleNemesisDeath

import net.minecraft.entity.EntityCreature; //導入依賴的package包/類
private static void handleNemesisDeath(EntityCreature nemesisEntity, Entity attacker) {
	NemesisEntry nemesis = NemesisUtil.loadNemesisFromEntity(nemesisEntity);

	if (nemesis == null) {
		return;
	}

	if (attacker == null || !(attacker instanceof EntityLivingBase)) {
		return;
	}

	NemesisActions.demote(nemesisEntity.world, nemesis, attacker.getName());

	NemesisUtil.findNemesisBodyGuards(nemesisEntity.world, nemesis.getId(), nemesisEntity.getPosition())
			.forEach((EntityCreature guard) -> {
				guard.setAttackTarget(null);
				guard.getTags().add(TAG_RONIN);
			});
}
 
開發者ID:ToroCraft,項目名稱:NemesisSystem,代碼行數:20,代碼來源:DeathHandler.java

示例5: EntityAIFindEntityNearest

import net.minecraft.entity.EntityCreature; //導入依賴的package包/類
public EntityAIFindEntityNearest(EntityLiving p_i45884_1_, Class <? extends EntityLivingBase > p_i45884_2_)
{
    this.field_179442_b = p_i45884_1_;
    this.field_179439_f = p_i45884_2_;

    if (p_i45884_1_ instanceof EntityCreature)
    {
        field_179444_a.warn("Use NearestAttackableTargetGoal.class for PathfinerMob mobs!");
    }

    this.field_179443_c = new Predicate<EntityLivingBase>()
    {
        public boolean apply(EntityLivingBase p_apply_1_)
        {
            double d0 = EntityAIFindEntityNearest.this.func_179438_f();

            if (p_apply_1_.isSneaking())
            {
                d0 *= 0.800000011920929D;
            }

            return p_apply_1_.isInvisible() ? false : ((double)p_apply_1_.getDistanceToEntity(EntityAIFindEntityNearest.this.field_179442_b) > d0 ? false : EntityAITarget.isSuitableTarget(EntityAIFindEntityNearest.this.field_179442_b, p_apply_1_, false, true));
        }
    };
    this.field_179440_d = new EntityAINearestAttackableTarget.Sorter(p_i45884_1_);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:27,代碼來源:EntityAIFindEntityNearest.java

示例6: onDeath

import net.minecraft.entity.EntityCreature; //導入依賴的package包/類
@SubscribeEvent
public void onDeath(LivingDeathEvent event) {

	World world = event.getEntity().getEntityWorld();

	if (world.isRemote) {
		return;
	}

	Entity slayer = event.getSource().getTrueSource();

	if (event.getEntity() instanceof EntityPlayer && slayer instanceof EntityCreature) {
		handlePlayerDeath((EntityPlayer) event.getEntity(), (EntityCreature) slayer);
		return;
	}

	if (!(event.getEntity() instanceof EntityCreature)) {
		return;
	}

	if (event.getEntity().getTags().contains(NemesisSystem.TAG_NEMESIS)) {
		handleNemesisDeath((EntityCreature) event.getEntity(), slayer);
	}
}
 
開發者ID:ToroCraft,項目名稱:NemesisSystem,代碼行數:25,代碼來源:DeathHandler.java

示例7: alertOthers

import net.minecraft.entity.EntityCreature; //導入依賴的package包/類
protected void alertOthers()
{
    double d0 = this.getTargetDistance();

    for (EntityCreature entitycreature : this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), (new AxisAlignedBB(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D)).expand(d0, 10.0D, d0)))
    {
        if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && (!(this.taskOwner instanceof EntityTameable) || ((EntityTameable)this.taskOwner).getOwner() == ((EntityTameable)entitycreature).getOwner()) && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget()))
        {
            boolean flag = false;

            for (Class<?> oclass : this.targetClasses)
            {
                if (entitycreature.getClass() == oclass)
                {
                    flag = true;
                    break;
                }
            }

            if (!flag)
            {
                this.setEntityAttackTarget(entitycreature, this.taskOwner.getAITarget());
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:27,代碼來源:EntityAIHurtByTarget.java

示例8: EntityAIFindEntityNearest

import net.minecraft.entity.EntityCreature; //導入依賴的package包/類
public EntityAIFindEntityNearest(EntityLiving mobIn, Class <? extends EntityLivingBase > p_i45884_2_)
{
    this.mob = mobIn;
    this.classToCheck = p_i45884_2_;

    if (mobIn instanceof EntityCreature)
    {
        LOGGER.warn("Use NearestAttackableTargetGoal.class for PathfinerMob mobs!");
    }

    this.predicate = new Predicate<EntityLivingBase>()
    {
        public boolean apply(@Nullable EntityLivingBase p_apply_1_)
        {
            double d0 = EntityAIFindEntityNearest.this.getFollowRange();

            if (p_apply_1_.isSneaking())
            {
                d0 *= 0.800000011920929D;
            }

            return p_apply_1_.isInvisible() ? false : ((double)p_apply_1_.getDistanceToEntity(EntityAIFindEntityNearest.this.mob) > d0 ? false : EntityAITarget.isSuitableTarget(EntityAIFindEntityNearest.this.mob, p_apply_1_, false, true));
        }
    };
    this.sorter = new EntityAINearestAttackableTarget.Sorter(mobIn);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:27,代碼來源:EntityAIFindEntityNearest.java

示例9: EntityAIMoveThroughVillage

import net.minecraft.entity.EntityCreature; //導入依賴的package包/類
public EntityAIMoveThroughVillage(EntityCreature theEntityIn, double movementSpeedIn, boolean isNocturnalIn)
{
    this.theEntity = theEntityIn;
    this.movementSpeed = movementSpeedIn;
    this.isNocturnal = isNocturnalIn;
    this.setMutexBits(1);

    if (!(theEntityIn.getNavigator() instanceof PathNavigateGround))
    {
        throw new IllegalArgumentException("Unsupported mob for MoveThroughVillageGoal");
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:13,代碼來源:EntityAIMoveThroughVillage.java

示例10: EntityAIMoveToBlock

import net.minecraft.entity.EntityCreature; //導入依賴的package包/類
public EntityAIMoveToBlock(EntityCreature creature, double speedIn, int length)
{
    this.theEntity = creature;
    this.movementSpeed = speedIn;
    this.searchLength = length;
    this.setMutexBits(5);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:8,代碼來源:EntityAIMoveToBlock.java

示例11: onAttacked

import net.minecraft.entity.EntityCreature; //導入依賴的package包/類
@SubscribeEvent
public void onAttacked(LivingHurtEvent event) {
	World world = event.getEntity().getEntityWorld();

	if (world.isRemote || !(event.getEntity() instanceof EntityCreature)) {
		return;
	}

	if (event.getEntity().getTags().contains(NemesisSystem.TAG_NEMESIS)) {
		orderGuardsToAttackAggressor((EntityCreature) event.getEntity(), event.getSource().getTrueSource());
	}
}
 
開發者ID:ToroCraft,項目名稱:NemesisSystem,代碼行數:13,代碼來源:AttackHandler.java

示例12: EntityAIWander

import net.minecraft.entity.EntityCreature; //導入依賴的package包/類
public EntityAIWander(EntityCreature creatureIn, double speedIn, int chance)
{
    this.entity = creatureIn;
    this.speed = speedIn;
    this.executionChance = chance;
    this.setMutexBits(1);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:8,代碼來源:EntityAIWander.java

示例13: setTarget

import net.minecraft.entity.EntityCreature; //導入依賴的package包/類
public void setTarget(LivingEntity target) {
    EntityCreature entity = getHandle();
    if (target == null) {
        entity.entityToAttack = null;
    } else if (target instanceof CraftLivingEntity) {
        entity.entityToAttack = ((CraftLivingEntity) target).getHandle();
        entity.pathToEntity = entity.worldObj.getPathEntityToEntity(entity, entity.entityToAttack, 16.0F, true, false, false, true);
    }
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:10,代碼來源:CraftCreature.java

示例14: EntityAIAttackMelee

import net.minecraft.entity.EntityCreature; //導入依賴的package包/類
public EntityAIAttackMelee(EntityCreature creature, double speedIn, boolean useLongMemory)
{
    this.attacker = creature;
    this.worldObj = creature.worldObj;
    this.speedTowardsTarget = speedIn;
    this.longMemory = useLongMemory;
    this.setMutexBits(3);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:9,代碼來源:EntityAIAttackMelee.java

示例15: EntityAIFleeSun

import net.minecraft.entity.EntityCreature; //導入依賴的package包/類
public EntityAIFleeSun(EntityCreature theCreatureIn, double movementSpeedIn)
{
    this.theCreature = theCreatureIn;
    this.movementSpeed = movementSpeedIn;
    this.theWorld = theCreatureIn.worldObj;
    this.setMutexBits(1);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:8,代碼來源:EntityAIFleeSun.java


注:本文中的net.minecraft.entity.EntityCreature類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。