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);
}
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;
}
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;
}
}
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;
}
}
Aggregations