use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class TileEntityClayNexus method countTeammates.
private int countTeammates() {
@SuppressWarnings("unchecked") List<EntityClayMan> soldiers = this.worldObj.getEntitiesWithinAABB(EntityClayMan.class, this.p_searchArea);
int cnt = 0;
for (EntityClayMan dodger : soldiers) {
if (dodger.getClayTeam().equals(this.p_tempClayTeam.getTeamName())) {
cnt++;
}
}
return cnt;
}
use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class TileEntityClayNexus method getEnemies.
private List<EntityClayMan> getEnemies(boolean mustBeSeen) {
@SuppressWarnings("unchecked") List<EntityClayMan> soldiers = this.worldObj.getEntitiesWithinAABB(EntityClayMan.class, this.p_searchArea);
Iterator<EntityClayMan> iterator = soldiers.iterator();
while (iterator.hasNext()) {
EntityClayMan roomie = iterator.next();
if (roomie.getClayTeam().equals(this.p_tempClayTeam.getTeamName()) || (mustBeSeen && !this.canEntityBeSeen(roomie))) {
iterator.remove();
}
}
return soldiers;
}
use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class UpgradeEnderpearl method onUpdate.
@Override
public boolean onUpdate(EntityClayMan clayMan, SoldierUpgradeInst upgradeInst) {
short ticksAlive = upgradeInst.getNbtTag().getShort("ticksActive");
upgradeInst.getNbtTag().setShort("ticksActive", ++ticksAlive);
if (!(clayMan.getEntityToAttack() instanceof EntityClayMan && ((EntityClayMan) clayMan.getEntityToAttack()).getClayTeam().equals(clayMan.getClayTeam()))) {
EntityPlayer closestPlayer = clayMan.worldObj.getClosestPlayer(clayMan.posX, clayMan.posY, clayMan.posZ, clayMan.getLookRangeRad());
if (!(clayMan.getEntityToAttack() instanceof EntityPlayer) && closestPlayer != null && !closestPlayer.isDead && !(closestPlayer.isEntityInvulnerable() || closestPlayer.capabilities.isCreativeMode)) {
clayMan.setTarget(closestPlayer);
}
}
if (ticksAlive == 12000) {
clayMan.attackEntityFrom(DamageSource.magic, 10000.0F);
}
return false;
}
use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan 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);
}
use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan 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;
}
}
Aggregations