Search in sources :

Example 1 with EntityHorseMount

use of de.sanandrew.mods.claysoldiers.entity.mount.EntityHorseMount in project ClaySoldiersMod by SanAndreasP.

the class RenderStatDisplayOverlay method renderMounts.

private void renderMounts(Minecraft mc) {
    @SuppressWarnings("unchecked") List<EntityHorseMount> horses = mc.theWorld.getEntitiesWithinAABB(EntityHorseMount.class, getRangeAabbFromPlayer(mc.thePlayer));
    List<Quartet<Integer, String, Integer, ItemStack>> teams = new ArrayList<>();
    Map<String, Integer> teamCounts = Maps.newHashMap();
    for (EntityHorseMount dex : horses) {
        String team = EnumHorseType.VALUES[dex.getType()].toString();
        if (teamCounts.containsKey(team)) {
            teamCounts.put(team, teamCounts.get(team) + 1);
        } else {
            teamCounts.put(team, 1);
        }
    }
    for (Entry<String, Integer> team : teamCounts.entrySet()) {
        EnumHorseType teamInst = EnumHorseType.valueOf(team.getKey());
        teams.add(Quartet.with(teamInst.typeColor, team.getKey(), team.getValue(), (ItemStack) null));
    }
    this.renderStats(mc, SAPUtils.translate(RegistryItems.statDisplay.getUnlocalizedName() + ".title.mounts"), teams, 110, 5);
}
Also used : EntityHorseMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityHorseMount) Quartet(de.sanandrew.core.manpack.util.javatuples.Quartet) ArrayList(java.util.ArrayList) EnumHorseType(de.sanandrew.mods.claysoldiers.util.mount.EnumHorseType) ItemStack(net.minecraft.item.ItemStack)

Example 2 with EntityHorseMount

use of de.sanandrew.mods.claysoldiers.entity.mount.EntityHorseMount in project ClaySoldiersMod by SanAndreasP.

the class ItemHorseDoll method spawnHorse.

/**
 * Spawns the horse specified by the type in the location specified by the last three parameters.
 *
 * @param world the World the entity will spawn in
 * @param type  the type the horse will be
 */
public static EntityHorseMount spawnHorse(World world, EnumHorseType type, boolean isPegasus, double x, double y, double z) {
    EntityHorseMount jordan;
    if (isPegasus) {
        jordan = new EntityPegasusMount(world, type);
    } else {
        jordan = new EntityHorseMount(world, type);
    }
    jordan.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F);
    jordan.rotationYawHead = jordan.rotationYaw;
    jordan.renderYawOffset = jordan.rotationYaw;
    world.spawnEntityInWorld(jordan);
    jordan.playSound("step.gravel", 1.0F, 1.0F);
    return jordan;
}
Also used : EntityHorseMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityHorseMount) EntityPegasusMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityPegasusMount)

Example 3 with EntityHorseMount

use of de.sanandrew.mods.claysoldiers.entity.mount.EntityHorseMount in project ClaySoldiersMod by SanAndreasP.

the class ItemHorseDoll method onItemUse.

@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int blockX, int blockY, int blockZ, int side, float offX, float offY, float offZ) {
    if (world.isRemote) {
        return true;
    } else {
        Block block = world.getBlock(blockX, blockY, blockZ);
        double entityOffY = 0.0D;
        int maxSpawns = stack.stackSize;
        if (player.isSneaking()) {
            maxSpawns = 1;
        }
        if (side == 1 && block.getRenderType() == 11) {
            entityOffY = 0.5D;
        }
        blockX += Facing.offsetsXForSide[side];
        blockY += Facing.offsetsYForSide[side];
        blockZ += Facing.offsetsZForSide[side];
        for (int i = 0; i < maxSpawns; i++) {
            EntityHorseMount dan = spawnHorse(world, getType(stack), isPegasus(stack), blockX + 0.5D, blockY + entityOffY, blockZ + 0.5D);
            if (dan != null) {
                if (stack.hasDisplayName()) {
                    dan.setCustomNameTag(stack.getDisplayName());
                }
                if (!player.capabilities.isCreativeMode) {
                    dan.dollItem = stack.splitStack(1);
                }
            }
        }
        return true;
    }
}
Also used : EntityHorseMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityHorseMount) Block(net.minecraft.block.Block)

Example 4 with EntityHorseMount

use of de.sanandrew.mods.claysoldiers.entity.mount.EntityHorseMount in project ClaySoldiersMod by SanAndreasP.

the class BehaviorDollDispenseItem method doDispense.

private static void doDispense(World world, ItemStack stack, EnumFacing facing, IPosition position) {
    double x = position.getX();
    double y = position.getY() - (facing == EnumFacing.UP ? 0.0D : 0.3D);
    double z = position.getZ();
    if (stack.getItem() == RegistryItems.dollSoldier) {
        EntityClayMan spencer = ItemClayManDoll.spawnClayMan(world, ItemClayManDoll.getTeam(stack).getTeamName(), x, y, z);
        spencer.dollItem = stack;
    } else if (stack.getItem() == RegistryItems.dollHorseMount) {
        EntityHorseMount spencer = ItemHorseDoll.spawnHorse(world, ItemHorseDoll.getType(stack), ItemHorseDoll.isPegasus(stack), x, y, z);
        spencer.dollItem = stack;
    } else if (stack.getItem() == RegistryItems.dollTurtleMount) {
        EntityTurtleMount spencer = ItemTurtleDoll.spawnTurtle(world, ItemTurtleDoll.getType(stack), x, y, z);
        spencer.dollItem = stack;
    } else if (stack.getItem() == RegistryItems.dollGeckoMount) {
        EntityGeckoMount spencer = ItemGeckoDoll.spawnGecko(world, ItemGeckoDoll.getType(stack), x, y, z);
        spencer.dollItem = stack;
    } else if (stack.getItem() == RegistryItems.dollBunnyMount) {
        EntityBunnyMount spencer = ItemBunnyDoll.spawnBunny(world, ItemBunnyDoll.getType(stack), x, y, z);
        spencer.dollItem = stack;
    }
}
Also used : EntityHorseMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityHorseMount) EntityTurtleMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityTurtleMount) EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan) EntityGeckoMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityGeckoMount) EntityBunnyMount(de.sanandrew.mods.claysoldiers.entity.mount.EntityBunnyMount)

Aggregations

EntityHorseMount (de.sanandrew.mods.claysoldiers.entity.mount.EntityHorseMount)4 Quartet (de.sanandrew.core.manpack.util.javatuples.Quartet)1 EntityClayMan (de.sanandrew.mods.claysoldiers.entity.EntityClayMan)1 EntityBunnyMount (de.sanandrew.mods.claysoldiers.entity.mount.EntityBunnyMount)1 EntityGeckoMount (de.sanandrew.mods.claysoldiers.entity.mount.EntityGeckoMount)1 EntityPegasusMount (de.sanandrew.mods.claysoldiers.entity.mount.EntityPegasusMount)1 EntityTurtleMount (de.sanandrew.mods.claysoldiers.entity.mount.EntityTurtleMount)1 EnumHorseType (de.sanandrew.mods.claysoldiers.util.mount.EnumHorseType)1 ArrayList (java.util.ArrayList)1 Block (net.minecraft.block.Block)1 ItemStack (net.minecraft.item.ItemStack)1