java类net.minecraft.entity.monster.EntityMob的实例源码

ActivationRange.java 文件源码 项目:Uranium 阅读 36 收藏 0 点赞 0 评论 0
/**
 * 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
    }
}
Aura.java 文件源码 项目:BaseClient 阅读 26 收藏 0 点赞 0 评论 0
private boolean checkValidity(final EntityLivingBase entity) {
    if (entity == this.mc.thePlayer) {
        return false;
    }
    if (!entity.isEntityAlive()) {
        return false;
    }
    if (this.mc.thePlayer.getDistanceToEntity(entity) > this.range) {
        return false;
    }
    if (!(entity instanceof EntityPlayer)) {
        return (this.monsters && entity instanceof EntityMob) || (this.animals && (entity instanceof EntityAnimal || entity instanceof EntitySquid)) || (this.bats && entity instanceof EntityBat);
    }
    if (this.players) {
        final EntityPlayer player = (EntityPlayer)entity;
        return (this.friend && FriendManager.isFriend(player.getName())) || (!FriendManager.isFriend(player.getName()) && (!this.noArmor || this.hasArmor(player)));
    }
    return false;
}
EntityLiving.java 文件源码 项目:BaseClient 阅读 29 收藏 0 点赞 0 评论 0
private void onUpdateMinimal()
{
    ++this.entityAge;

    if (this instanceof EntityMob)
    {
        float f = this.getBrightness(1.0F);

        if (f > 0.5F)
        {
            this.entityAge += 2;
        }
    }

    this.despawnEntity();
}
EntityLiving.java 文件源码 项目:BaseClient 阅读 27 收藏 0 点赞 0 评论 0
private void onUpdateMinimal()
{
    ++this.entityAge;

    if (this instanceof EntityMob)
    {
        float f = this.getBrightness(1.0F);

        if (f > 0.5F)
        {
            this.entityAge += 2;
        }
    }

    this.despawnEntity();
}
EntityAIHaunter.java 文件源码 项目:Halloween 阅读 33 收藏 0 点赞 0 评论 0
/**
 * Make the drone mob attack the target player
 */
private boolean initializeDrone(EntityMob mob)
{
    // ensure that the drone has sufficient follow range to be able to path to the player
    double followRange = mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).getAttributeValue();
    float distance = mob.getDistanceToEntity(this.attackTarget);
    if (followRange < distance)
    {
        mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(distance * 1.1D);
    }

    // set the drone on a path to the player
    boolean canNavigate = mob.getNavigator().tryMoveToEntityLiving(this.attackTarget, this.currentDrone.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue());
    if (canNavigate)
    {
        // set the drone's attack target to be the player
        mob.setAttackTarget(this.attackTarget);
    }
    else
    {
        this.currentDrone = null;
    }

    return canNavigate;
}
MobOptionsEventHandler.java 文件源码 项目:Mob-Option-Redux 阅读 38 收藏 0 点赞 0 评论 0
/**
 * Checks spawning
 */
@SubscribeEvent
public void onSpawn(CheckSpawn event) {
    //If the entity is not a mob or above the forced-spawn-y-level, stop
    if (!(event.getEntity() instanceof EntityMob && event.getY() < underground))
        return;

    EntityMob mob = (EntityMob) event.getEntity();
    String name = EntityList.getEntityString(mob);

    //If whitelist and list contains mob, or blacklist and list does not contain mob
    if ((spawnWhitelist && mobsToSpawn.contains(name)) || (!(spawnWhitelist && mobsToSpawn.contains(name)))){
        //If the chance is within allowed mob-spawn-under-y-level range, and the game is not on Peaceful
        if (rand.nextFloat() < undergroundChance && event.getWorld().getDifficulty() != EnumDifficulty.PEACEFUL){
            //If there are no other entities in this area, and there are no collisions, and there is not a liquid
            if (event.getWorld().checkNoEntityCollision(mob.getEntityBoundingBox())
                    && event.getWorld().getCollisionBoxes(mob, mob.getEntityBoundingBox()).isEmpty()
                    && !event.getWorld().containsAnyLiquid(mob.getEntityBoundingBox())){
                //Allow the spawn
                event.setResult(Result.ALLOW);
            }
        }
    }

}
ItemHammer.java 文件源码 项目:Thermionics 阅读 29 收藏 0 点赞 0 评论 0
@Override
public int activateSkill(IWeaponSkillInfo info, EntityLivingBase attacker, ItemStack item, DamageSource source, EntityLivingBase opponent) {
    //If you don't know about Earthbound, we can't be friends. Sorry, I don't make the rules.
    DamageSource smaaaaaaash = new EntityDamageSource("weaponskill.smash", attacker);
    opponent.attackEntityFrom(smaaaaaaash, 4f);

    opponent.addPotionEffect( new PotionEffect(Potion.getPotionFromResourceLocation("minecraft:blindness"), 20*3, 2 ));
    //Thermionics.LOG.info("SMAAAAAAASH WeaponSkill activated against entity {} at {},{},{}", opponent, opponent.posX, opponent.posY, opponent.posZ);
    if (opponent instanceof EntityMob) {
        EntityMob monster = (EntityMob)opponent;
        monster.setAttackTarget(null);
        monster.setRevengeTarget(null);
    }
    if (!attacker.world.isRemote) {
        //Serverside, queue the effect
        SpawnParticleEmitterMessage fx = new SpawnParticleEmitterMessage(Thermionics.CONTEXT, EnumWeaponSkill.SMAAAAAAASH, opponent);
        fx.sendToAllWatching(opponent);
    }

    return 20*5;
}
IEntity.java 文件源码 项目:EMC 阅读 37 收藏 0 点赞 0 评论 0
public Color getEntityColor() {
    if ((entity instanceof EntityAnimal)) {
        return Color.white;
    }
    if ((entity instanceof EntityMob)) {
        return Color.red;
    }
    if ((entity instanceof EntitySlime)) {
        return Color.green;
    }
    if ((entity instanceof EntityVillager)) {
        return new Color(245, 245, 220);
    }
    if ((entity instanceof EntityBat)) {
        return Color.BLACK;
    }
    if ((entity instanceof EntitySquid)) {
        return Color.PINK;
    }
    return Color.white;
}
EntityLiving.java 文件源码 项目:Backmemed 阅读 28 收藏 0 点赞 0 评论 0
private void onUpdateMinimal()
{
    ++this.entityAge;

    if (this instanceof EntityMob)
    {
        float f = this.getBrightness(1.0F);

        if (f > 0.5F)
        {
            this.entityAge += 2;
        }
    }

    this.despawnEntity();
}
SpawnHandler.java 文件源码 项目:NemesisSystem 阅读 39 收藏 0 点赞 0 评论 0
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;
        }
    }
}
BlockCursedEarth.java 文件源码 项目:ExtraUtilities 阅读 30 收藏 0 点赞 0 评论 0
public boolean SpawnMob(final EntityLiving t) {
    if (t.getCanSpawnHere()) {
        t.onSpawnWithEgg((IEntityLivingData)null);
        if (t instanceof EntityMob) {
            t.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 3600, 1));
            t.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 3600, 1));
        }
        else {
            t.addPotionEffect(new PotionEffect(Potion.regeneration.id, 3600, 1));
        }
        t.getEntityData().setLong("CursedEarth", 3600L);
        t.forceSpawn = true;
        t.func_110163_bv();
        return true;
    }
    return false;
}
EventHandlerSiege.java 文件源码 项目:ExtraUtilities 阅读 37 收藏 0 点赞 0 评论 0
public static void beginSiege(final World world) {
    if (world.isRemote) {
        return;
    }
    if (world.provider.dimensionId != 1) {
        return;
    }
    for (int i = 0; i < world.loadedEntityList.size(); ++i) {
        if (world.loadedEntityList.get(i) instanceof EntityMob) {
            world.removeEntity((Entity)world.loadedEntityList.get(i));
        }
        else if (world.loadedEntityList.get(i) instanceof EntityPlayer) {
            final EntityPlayer player = (EntityPlayer)world.loadedEntityList.get(i);
            EventHandlerSiege.SiegeParticipants.add(player.getGameProfile().getName());
            player.getEntityData().setInteger("SiegeKills", 0);
        }
    }
    if (EventHandlerSiege.SiegeParticipants.size() != 0) {
        MinecraftServer.getServer().getConfigurationManager().sendChatMsg((IChatComponent)new ChatComponentText("The Siege has begun in 'The End'"));
    }
    else {
        endSiege(world, false);
    }
}
EventHandlerSiege.java 文件源码 项目:ExtraUtilities 阅读 30 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void SiegeCheckSpawn(final LivingSpawnEvent.CheckSpawn event) {
    if (EventHandlerSiege.SiegeParticipants.isEmpty()) {
        return;
    }
    if (event.entity.worldObj.isRemote) {
        return;
    }
    if (event.world.provider.dimensionId != 1) {
        return;
    }
    if (event.entityLiving instanceof EntityMob && event.entityLiving.worldObj.checkNoEntityCollision(event.entityLiving.boundingBox) && event.entityLiving.worldObj.getCollidingBoundingBoxes((Entity)event.entityLiving, event.entityLiving.boundingBox).isEmpty() && !event.entityLiving.worldObj.isAnyLiquid(event.entityLiving.boundingBox)) {
        event.entityLiving.getEntityData().setBoolean("Siege", true);
        event.entityLiving.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 7200, 2));
        event.setResult(Event.Result.ALLOW);
    }
}
EventHandlerUnderdark.java 文件源码 项目:ExtraUtilities 阅读 35 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void noMobs(final LivingSpawnEvent.CheckSpawn event) {
    if (event.getResult() == Event.Result.DEFAULT && event.world.provider.dimensionId == ExtraUtils.underdarkDimID && event.entity instanceof EntityMob) {
        if (EventHandlerUnderdark.rand.nextDouble() < Math.min(0.95, event.entity.posY / 80.0)) {
            event.setResult(Event.Result.DENY);
        }
        else {
            IAttributeInstance t = ((EntityMob)event.entity).getEntityAttribute(SharedMonsterAttributes.maxHealth);
            t.setBaseValue(t.getBaseValue() * 2.0);
            ((EntityMob)event.entity).heal((float)t.getAttributeValue());
            t = ((EntityMob)event.entity).getEntityAttribute(SharedMonsterAttributes.attackDamage);
            t.setBaseValue(t.getBaseValue() * 2.0);
            if (!EventHandlerServer.isInRangeOfTorch(event.entity) && event.entityLiving.worldObj.checkNoEntityCollision(event.entityLiving.boundingBox) && event.entityLiving.worldObj.getCollidingBoundingBoxes((Entity)event.entityLiving, event.entityLiving.boundingBox).isEmpty() && !event.entityLiving.worldObj.isAnyLiquid(event.entityLiving.boundingBox)) {
                event.setResult(Event.Result.ALLOW);
            }
        }
    }
}
MinionAICombat.java 文件源码 项目:CrystalMod 阅读 31 收藏 0 点赞 0 评论 0
public boolean isEntityValidToAttack(EntityMinionWarrior minion, EntityLivingBase entity)
{
    if(entity == minion || entity == minion.getRidingEntity() || !EntityAITarget.isSuitableTarget(minion, entity, false, false) || entity.getClass() == EntityCreeper.class) return false;

    if (entity instanceof EntityMob &&
            (getTargetBehavior() == EnumCombatBehaviors.TARGET_HOSTILE_MOBS || 
            getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_OR_HOSTILE_MOBS))
    {
        return true;
    }

    else if (entity instanceof EntityAnimal &&
            (getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_MOBS || 
            getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_OR_HOSTILE_MOBS))
    {
        return true;
    }

    else
    {
        return false;
    }
}
EntitySlave.java 文件源码 项目:MidgarCrusade 阅读 32 收藏 0 点赞 0 评论 0
public EntitySlave(World p_i1688_1_)
{
    super(p_i1688_1_);
    this.setSize(0.8F, 1.6F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, this.aiSit);
    this.tasks.addTask(3, this.aiTempt = new EntityAITempt(this, 0.6D, Items.diamond, true));
    this.tasks.addTask(4, new EntityAIFollowOwner(this, 1.0D, 10.0F, 5.0F));
    this.tasks.addTask(5, new EntityAIAvoidEntity(this, EntityCreeper.class, 16.0F, 0.8D, 1.33D));
    this.tasks.addTask(6, new EntityAILeapAtTarget(this, 0.3F));
    this.tasks.addTask(7, new EntityAIOcelotAttack(this));
    this.tasks.addTask(8, new EntityAIMate(this, 0.8D));
    this.tasks.addTask(9, new EntityAIWander(this, 0.8D));
    this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
    this.targetTasks.addTask(1, new EntityAITargetNonTamed(this, EntityMob.class, 750, false));
    this.setType(this.rand.nextInt(4));
    this.setRandomStuff();
}
LivingEntityEvent.java 文件源码 项目:MidgarCrusade 阅读 32 收藏 0 点赞 0 评论 0
@SubscribeEvent
   public void onEntityDrops(LivingDropsEvent event)
{
    int alea;

    if (event.entityLiving instanceof EntityMob)
        alea = 20;
    else
        alea = 50;

    if (event.entityLiving.worldObj.rand.nextInt(alea) < 1 + event.lootingLevel * 2)
    {
        EntityItem e;

        e = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, new ItemStack(ItemRegister.getRandomArmor(), 1));
        e = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, new ItemStack(ItemRegistry1.bagdrop, 1));


        event.drops.add(e);
    }
}
TileEntityReciever.java 文件源码 项目:Rival-Rebels-Mod 阅读 23 收藏 0 点赞 0 评论 0
private boolean isValidTarget(Entity e)
{
    if (e == null) return false;
    else if (e instanceof EntityPlayer)
    {
        EntityPlayer p = ((EntityPlayer) e);
        if (p.capabilities.isCreativeMode) return false;
        else
        {
            if (kPlayers) return true;
            else if (!kTeam) return false;
            RivalRebelsPlayer rrp = RivalRebels.round.rrplayerlist.getForName(((EntityPlayer) e).getCommandSenderName());
            if (rrp == null) return kTeam;
            if (rrp.rrteam == RivalRebelsTeam.NONE) return !p.getCommandSenderName().equals(username);
            if (rrp.rrteam != team) return kTeam;
            else return false;
        }
    }
    else return (kMobs && (e instanceof EntityRhodes || (e instanceof EntityMob && !(e instanceof EntityAnimal) && !(e instanceof EntityBat) && !(e instanceof EntityVillager) && !(e instanceof EntitySquid)) || e instanceof EntityGhast));
}
EntityGuard.java 文件源码 项目:ToroQuest 阅读 32 收藏 0 点赞 0 评论 0
protected void initEntityAI() {
    areaAI = new EntityAIMoveIntoArea(this, 0.5D, 30);
    tasks.addTask(0, new EntityAISwimming(this));
    tasks.addTask(2, new EntityAIAttackMelee(this, 0.6D, false));
    tasks.addTask(4, areaAI);
    tasks.addTask(7, new EntityAIWander(this, 0.35D));
    tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    tasks.addTask(8, new EntityAILookIdle(this));

    targetTasks.addTask(2, new EntityAINearestAttackableCivTarget(this));
    targetTasks.addTask(3, new EntityAINearestAttackableTarget<EntityMob>(this, EntityMob.class, 10, false, false, new Predicate<EntityMob>() {
        @Override
        public boolean apply(EntityMob target) {
            return !(target instanceof EntityCreeper);
        }
    }));
}
AbstractHealthDisplay.java 文件源码 项目:ToroHealth 阅读 37 收藏 0 点赞 0 评论 0
protected Relation determineRelation() {
    if (entity instanceof EntityMob) {
        return Relation.FOE;
    } else if (entity instanceof EntitySlime) {
        return Relation.FOE;
    } else if (entity instanceof EntityGhast) {
        return Relation.FOE;
    } else if (entity instanceof EntityAnimal) {
        return Relation.FRIEND;
    } else if (entity instanceof EntitySquid) {
        return Relation.FRIEND;
    } else if (entity instanceof EntityAmbientCreature) {
        return Relation.FRIEND;
    } else {
        return Relation.UNKNOWN;
    }
}
ActivationRange.java 文件源码 项目:ThermosRebased 阅读 50 收藏 0 点赞 0 评论 0
/**
 * 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
    }
}
TileEntityTurretSentry.java 文件源码 项目:FissionWarfare 阅读 23 收藏 0 点赞 0 评论 0
@Override
public void checkTarget() {

    if (RaytraceUtil.raytrace(getAngleFromTarget(), getTurretVector(), worldObj, InitBlocks.sentry_turret, target, RANGE) == HitType.BLOCK) {
        target = null;
    }

    if (target instanceof EntityPlayer) {

        EntityPlayer player = (EntityPlayer)target;

        if (target == null || player.isDead || target.getDistance(xCoord, yCoord, zCoord) >= RANGE ||  player.capabilities.isCreativeMode || profile.isSameTeam(player)) {
            target = null;
        }
    }

    if (target instanceof EntityMob) {

        if (target == null || target.isDead || target.getDistance(xCoord, yCoord, zCoord) >= RANGE) {
            target = null;
        }
    }       
}
TileEntityTurretSentry.java 文件源码 项目:FissionWarfare 阅读 22 收藏 0 点赞 0 评论 0
@Override
public void fire() {

    if (target != null) {

        if (target instanceof EntityPlayer) {   

            EntityPlayer player = (EntityPlayer) target;
            player.attackEntityFrom(new DamageSourceTeam((EntityPlayer) player, profile.getTeamName() + "'s Sentry Turret"), DAMAGE);               
        }

        if (target instanceof EntityMob) {

            target.attackEntityFrom(DamageSource.generic, DAMAGE);
        }
    }
}
ItemVoidScroll.java 文件源码 项目:Lost-Eclipse-Outdated 阅读 21 收藏 0 点赞 0 评论 0
@SuppressWarnings("rawtypes")
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
{       
    ItemStack stack = player.inventory.getCurrentItem();

    if (player.inventory.getCurrentItem().getItem() == ModItems.voidScroll)
    {
        if (!world.isRemote)
        {
            List entityList = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(player.posX - 10, player.posY - 10, player.posZ - 10, player.posX + 10, player.posY + 10, player.posZ + 10));
            Iterator iterator = entityList.iterator();

            while (iterator.hasNext())
            {
                   Entity entity = (Entity) iterator.next();
                if (entity instanceof EntityMob) ((EntityMob) entity).setHealth(0);
            }

            // decrease stack size by 1
            stack.shrink(1);
        }
    }

    return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
}
ItemRadiationScroll.java 文件源码 项目:Lost-Eclipse-Outdated 阅读 31 收藏 0 点赞 0 评论 0
@SuppressWarnings("rawtypes")
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
{       
    ItemStack stack = player.inventory.getCurrentItem();

    if (player.inventory.getCurrentItem().getItem() == ModItems.radiationScroll)
    {
        if (!world.isRemote)
        {
            List entityList = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(player.posX - 10, player.posY - 10, player.posZ - 10, player.posX + 10, player.posY + 10, player.posZ + 10));
            Iterator iterator = entityList.iterator();

            while (iterator.hasNext())
            {
                   Entity entity = (Entity) iterator.next();
                if (entity instanceof EntityMob) entity.setFire(5);
            }

            // decrease stack size by 1
            stack.shrink(1);
        }
    }

    return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
}
WorldUtils.java 文件源码 项目:LightningCraft 阅读 38 收藏 0 点赞 0 评论 0
/** Spawn a hostile mob near the player in between mindist and maxdist at a random angle
 * @return Returns true if the mob was successfully spawned
 */
public static boolean spawnMobNearPlayer(EntityPlayer player, EntityMob mob, double mindist, double maxdist) {
    // try this distance and angle
    double dd = maxdist - mindist;
    double dist = mindist + random.nextDouble() * dd;
    float angle = (float)(random.nextDouble() * 2 * Math.PI);

    // get corresponding position
    double x = player.posX - MathHelper.sin(angle) * dist;
    double z = player.posZ + MathHelper.cos(angle) * dist;
    Integer y = getOpenSurface(player.worldObj, (int)x, (int)z, (int)player.posY, 10, true);
    if(y == null) return false;

    // spawning
    if(player.worldObj.getCombinedLight(new BlockPos((int)x, y, (int)z), 0) <= 7) {
        mob.setPositionAndUpdate(x, y, z);
        return player.worldObj.spawnEntityInWorld(mob);
    }

    return false;
}
ActivationRange.java 文件源码 项目:Thermos 阅读 35 收藏 0 点赞 0 评论 0
/**
 * 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
    }
}
ActivationRange.java 文件源码 项目:KCauldron 阅读 31 收藏 0 点赞 0 评论 0
/**
 * 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
    }
}
ActivationRange.java 文件源码 项目:CauldronGit 阅读 36 收藏 0 点赞 0 评论 0
/**
 * 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
    }
}
ActivationRange.java 文件源码 项目:Cauldron-Old 阅读 39 收藏 0 点赞 0 评论 0
/**
 * 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
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号