Search in sources :

Example 1 with Quartet

use of de.sanandrew.core.manpack.util.javatuples.Quartet 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 Quartet

use of de.sanandrew.core.manpack.util.javatuples.Quartet in project ClaySoldiersMod by SanAndreasP.

the class RenderStatDisplayOverlay method renderSoldiers.

private void renderSoldiers(Minecraft mc) {
    @SuppressWarnings("unchecked") List<EntityClayMan> soldiers = mc.theWorld.getEntitiesWithinAABB(EntityClayMan.class, getRangeAabbFromPlayer(mc.thePlayer));
    // team background color, team name, team count
    List<Quartet<Integer, String, Integer, ItemStack>> teams = new ArrayList<>();
    Map<String, Integer> teamCounts = Maps.newHashMap();
    for (EntityClayMan dex : soldiers) {
        String team = dex.getClayTeam();
        if (teamCounts.containsKey(team)) {
            teamCounts.put(team, teamCounts.get(team) + 1);
        } else {
            teamCounts.put(team, 1);
        }
    }
    for (Entry<String, Integer> team : teamCounts.entrySet()) {
        ClaymanTeam teamInst = ClaymanTeam.getTeam(team.getKey());
        ItemStack renderedItem = new ItemStack(RegistryItems.dollSoldier);
        ItemClayManDoll.setTeamForItem(team.getKey(), renderedItem);
        teams.add(Quartet.with(teamInst.getTeamColor(), renderedItem.getUnlocalizedName() + ".color", team.getValue(), renderedItem));
    }
    this.renderStats(mc, SAPUtils.translate(RegistryItems.statDisplay.getUnlocalizedName() + ".title.soldiers"), teams, 5, 5);
}
Also used : Quartet(de.sanandrew.core.manpack.util.javatuples.Quartet) ClaymanTeam(de.sanandrew.mods.claysoldiers.util.soldier.ClaymanTeam) EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack)

Aggregations

Quartet (de.sanandrew.core.manpack.util.javatuples.Quartet)2 ArrayList (java.util.ArrayList)2 ItemStack (net.minecraft.item.ItemStack)2 EntityClayMan (de.sanandrew.mods.claysoldiers.entity.EntityClayMan)1 EntityHorseMount (de.sanandrew.mods.claysoldiers.entity.mount.EntityHorseMount)1 EnumHorseType (de.sanandrew.mods.claysoldiers.util.mount.EnumHorseType)1 ClaymanTeam (de.sanandrew.mods.claysoldiers.util.soldier.ClaymanTeam)1