Search in sources :

Example 1 with EntityGecko

use of sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityGecko in project ClaySoldiersMod by SanAndreasP.

the class EntityClayNexus method spawnSoldiers.

private void spawnSoldiers() {
    if (worldObj.isRemote)
        return;
    for (int i = 0; i < getMaxSpwnSoldiers() && !isMaxSpawningReached(); i++) {
        double clayX;
        double clayY;
        double clayZ;
        clayX = posX + rand.nextInt(2) * 0.5F * (rand.nextBoolean() ? -1 : 1) + 0.2D;
        clayY = posY + 0.5F;
        clayZ = posZ + rand.nextInt(2) * 0.5F * (rand.nextBoolean() ? -1 : 1) + 0.2D;
        EntityClayMan ec = null;
        if (!getSpawnMount()) {
            ec = new EntityClayMan(worldObj, (int) Math.floor(clayX), (int) Math.floor(clayY), (int) Math.floor(clayZ), getColor());
            ec.setNexusSpawn();
        }
        EntityLiving mount = null;
        if (nexusIS[1] != null && nexusIS[1].stackSize > 0) {
            if (nexusIS[1].itemID == CSMModRegistry.horseDoll.itemID)
                mount = new EntityHorse(worldObj, clayX, clayY, clayZ, nexusIS[1].getItemDamage()).setSpawnedFromNexus();
            if (nexusIS[1].itemID == CSMModRegistry.pegasusDoll.itemID)
                mount = new EntityPegasus(worldObj, clayX, clayY, clayZ, nexusIS[1].getItemDamage()).setSpawnedFromNexus();
            if (nexusIS[1].itemID == CSMModRegistry.turtleDoll.itemID)
                mount = new EntityTurtle(worldObj, clayX, clayY, clayZ, nexusIS[1].getItemDamage()).setSpawnedFromNexus();
            if (nexusIS[1].itemID == CSMModRegistry.bunnyDoll.itemID)
                mount = new EntityBunny(worldObj, clayX, clayY, clayZ, nexusIS[1].getItemDamage()).setSpawnedFromNexus();
            if (nexusIS[1].itemID == CSMModRegistry.geckoDoll.itemID)
                mount = new EntityGecko(worldObj, clayX, clayY, clayZ, nexusIS[1].getItemDamage()).setSpawnedFromNexus();
        }
        if (!getSpawnMount()) {
            boolean[] usedStacks = new boolean[nexusIS.length];
            for (int j = 2; j < nexusIS.length && !hasRandItems(); j++) {
                if (nexusIS[j] != null && nexusIS[j].stackSize > 0 && !usedStacks[j]) {
                    if (checkIfItemIsValidAndApply(nexusIS[j], ec, false)) {
                        checkForUpgradeItem(ec);
                    }
                    usedStacks[j] = true;
                }
            }
            if (hasRandItems()) {
                int loopInd = 0;
                do {
                    int index = rand.nextInt(nexusIS.length - 2) + 2;
                    if (nexusIS[index] != null && nexusIS[index].stackSize > 0 && !usedStacks[index]) {
                        loopInd = 0;
                        if (checkIfItemIsValidAndApply(nexusIS[index], ec, false)) {
                            checkForUpgradeItem(ec);
                        }
                        usedStacks[index] = true;
                    } else {
                        loopInd++;
                    }
                } while (loopInd < nexusIS.length - 2);
            }
            worldObj.spawnEntityInWorld(ec);
            CSMModRegistry.proxy.showEffect(this.worldObj, ec, 11);
        // ec.spawnExplosionParticle();
        }
        if (mount != null) {
            worldObj.spawnEntityInWorld(mount);
            if (!getSpawnMount())
                ec.mountEntity(mount);
        }
    }
}
Also used : EntityHorse(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityHorse) EntityGecko(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityGecko) EntityLiving(net.minecraft.entity.EntityLiving) EntityPegasus(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityPegasus) EntityBunny(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityBunny) EntityTurtle(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityTurtle)

Example 2 with EntityGecko

use of sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityGecko in project ClaySoldiersMod by SanAndreasP.

the class EntityClayNexus method isMaxSpawningReached.

private boolean isMaxSpawningReached() {
    List<Entity> el = worldObj.loadedEntityList;
    int count = 0;
    for (Entity entity : el) {
        if (entity instanceof EntityClayMan) {
            if (((EntityClayMan) entity).getClayTeam() == getColor() && ((EntityClayMan) entity).spawnedFromNexus())
                count++;
        } else if (getSpawnMount() && (entity instanceof IMount) && ((IMount) entity).getType() == nexusIS[1].getItemDamage()) {
            if (entity instanceof EntityPegasus && nexusIS[1].getItem() instanceof ItemHorses && ((ItemHorses) nexusIS[1].getItem()).horseType == 1) {
                count++;
            } else if (entity instanceof EntityHorse && nexusIS[1].getItem() instanceof ItemHorses && ((ItemHorses) nexusIS[1].getItem()).horseType == 0) {
                count++;
            } else if (entity instanceof EntityTurtle && nexusIS[1].getItem() instanceof ItemTurtle) {
                count++;
            } else if (entity instanceof EntityBunny && nexusIS[1].getItem() instanceof ItemBunny) {
                count++;
            } else if (entity instanceof EntityGecko && nexusIS[1].getItem() instanceof ItemGecko) {
                count++;
            }
        }
    }
    return count >= getMaxLvngSoldiers();
}
Also used : Entity(net.minecraft.entity.Entity) ItemTurtle(sanandreasp.mods.ClaySoldiersMod.item.ItemTurtle) EntityPegasus(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityPegasus) ItemHorses(sanandreasp.mods.ClaySoldiersMod.item.ItemHorses) EntityTurtle(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityTurtle) ItemBunny(sanandreasp.mods.ClaySoldiersMod.item.ItemBunny) ItemGecko(sanandreasp.mods.ClaySoldiersMod.item.ItemGecko) EntityHorse(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityHorse) IMount(sanandreasp.mods.ClaySoldiersMod.entity.mount.IMount) EntityGecko(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityGecko) EntityBunny(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityBunny)

Example 3 with EntityGecko

use of sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityGecko in project ClaySoldiersMod by SanAndreasP.

the class ItemGecko method spawnGecko.

public boolean spawnGecko(World par0World, int par1, double par2, double par4, double par6) {
    EntityGecko var8 = new EntityGecko(par0World, par2, par4, par6, par1);
    if (var8 != null) {
        var8.setLocationAndAngles(par2, par4, par6, par0World.rand.nextFloat() * 360.0F, 0.0F);
        par0World.spawnEntityInWorld(var8);
        var8.playLivingSound();
    }
    return var8 != null;
}
Also used : EntityGecko(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityGecko)

Example 4 with EntityGecko

use of sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityGecko in project ClaySoldiersMod by SanAndreasP.

the class Handler_BehaviorDispenseItem method getLivingFromItem.

private static EntityLiving getLivingFromItem(World world, double x, double y, double z, ItemStack item) {
    if (item.getItem() instanceof ItemClayMan) {
        EntityClayMan entityclayman = new EntityClayMan(world, x, y, z, item.getItemDamage());
        world.playSoundEffect(x, y, z, "step.gravel", 1.0F, 1.0F / 0.4F + 0.8F);
        return entityclayman;
    } else if (item.getItem() instanceof ItemHorses) {
        EntityHorse entityhorse = new EntityHorse(world, x, y, z, item.getItemDamage());
        if (item.getItem() == CSMModRegistry.pegasusDoll) {
            entityhorse = new EntityPegasus(world, x, y, z, item.getItemDamage());
        }
        world.playSoundEffect(x, y, z, "step.gravel", 1.0F, 1.0F / 0.4F + 1.2F);
        return entityhorse;
    } else if (item.getItem() instanceof ItemTurtle) {
        EntityTurtle entityturtle = new EntityTurtle(world, x, y, z, item.getItemDamage());
        world.playSoundEffect(x, y, z, "step.stone", 1.0F, 1.0F / 0.4F + 0.8F);
        return entityturtle;
    } else if (item.getItem() instanceof ItemBunny) {
        EntityBunny entitybunny = new EntityBunny(world, x, y, z, item.getItemDamage());
        world.playSoundEffect(x, y, z, "step.stone", 1.0F, 1.0F / 0.4F + 0.8F);
        return entitybunny;
    } else if (item.getItem() instanceof ItemGecko) {
        EntityGecko entitygecko = new EntityGecko(world, x, y, z, item.getItemDamage());
        world.playSoundEffect(x, y, z, "step.gravel", 1.0F, 1.0F / 0.4F + 1.2F);
        return entitygecko;
    }
    return null;
}
Also used : ItemTurtle(sanandreasp.mods.ClaySoldiersMod.item.ItemTurtle) EntityHorse(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityHorse) EntityGecko(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityGecko) EntityClayMan(sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan) EntityPegasus(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityPegasus) EntityBunny(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityBunny) ItemHorses(sanandreasp.mods.ClaySoldiersMod.item.ItemHorses) EntityTurtle(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityTurtle) ItemBunny(sanandreasp.mods.ClaySoldiersMod.item.ItemBunny) ItemClayMan(sanandreasp.mods.ClaySoldiersMod.item.ItemClayMan) ItemGecko(sanandreasp.mods.ClaySoldiersMod.item.ItemGecko)

Aggregations

EntityGecko (sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityGecko)4 EntityBunny (sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityBunny)3 EntityHorse (sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityHorse)3 EntityPegasus (sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityPegasus)3 EntityTurtle (sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityTurtle)3 ItemBunny (sanandreasp.mods.ClaySoldiersMod.item.ItemBunny)2 ItemGecko (sanandreasp.mods.ClaySoldiersMod.item.ItemGecko)2 ItemHorses (sanandreasp.mods.ClaySoldiersMod.item.ItemHorses)2 ItemTurtle (sanandreasp.mods.ClaySoldiersMod.item.ItemTurtle)2 Entity (net.minecraft.entity.Entity)1 EntityLiving (net.minecraft.entity.EntityLiving)1 EntityClayMan (sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan)1 IMount (sanandreasp.mods.ClaySoldiersMod.entity.mount.IMount)1 ItemClayMan (sanandreasp.mods.ClaySoldiersMod.item.ItemClayMan)1