package micdoodle8.mods.galacticraft.core.entities; import micdoodle8.mods.galacticraft.api.entity.IEntityBreathable; import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; import micdoodle8.mods.galacticraft.core.items.ItemBasic; import micdoodle8.mods.galacticraft.core.items.ItemCanisterGeneric; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.core.wrappers.PlayerGearData; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentData; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.*; import net.minecraft.entity.ai.*; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.monster.EntityWitch; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.InventoryBasic; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.pathfinding.PathNavigateGround; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.stats.StatList; import net.minecraft.util.*; import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipeList; import net.minecraft.village.Village; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import java.util.Random; public class EntityAlienVillager extends EntityAgeable implements IMerchant, INpc, IEntityBreathable { private int randomTickDivider; private boolean isMating; private boolean isPlaying; private Village villageObj; private EntityPlayer buyingPlayer; private MerchantRecipeList buyingList; private int timeUntilReset; private boolean needsInitilization; private int wealth; private String lastBuyingPlayer; private boolean isLookingForHome; private InventoryBasic villagerInventory; private static final EntityAlienVillager.ITradeList[] DEFAULT_TRADE_LIST_MAP = new EntityAlienVillager.ITradeList[] { new EntityAlienVillager.ListItemForEmeralds(new ItemStack(GCItems.oxMask, 1, 0), new EntityAlienVillager.PriceInfo(1, 2)), new EntityAlienVillager.ListItemForEmeralds(new ItemStack(GCItems.oxTankLight, 1, 235), new EntityAlienVillager.PriceInfo(3, 4)), new EntityAlienVillager.ListItemForEmeralds(new ItemStack(GCItems.oxygenGear, 1, 0), new EntityAlienVillager.PriceInfo(3, 4)), new EntityAlienVillager.ListItemForEmeralds(new ItemStack(GCItems.fuelCanister, 1, 317), new EntityAlienVillager.PriceInfo(3, 4)), new EntityAlienVillager.ListItemForEmeralds(new ItemStack(GCItems.parachute, 1, 0), new EntityAlienVillager.PriceInfo(1, 2)), new EntityAlienVillager.ListItemForEmeralds(new ItemStack(GCItems.battery, 1, 58), new EntityAlienVillager.PriceInfo(2, 4)), new EntityAlienVillager.ItemAndEmeraldToItem(new ItemStack(GCItems.oilCanister, 1, ItemCanisterGeneric.EMPTY), new EntityAlienVillager.PriceInfo(1, 1), new ItemStack(GCItems.basicItem, 1, 16)), //carrots = also yields a tin! new EntityAlienVillager.ListItemForEmeralds(new ItemStack(GCItems.basicItem, 1, ItemBasic.WAFER_BASIC), new EntityAlienVillager.PriceInfo(3, 4)), new EntityAlienVillager.ItemAndEmeraldToItem(new ItemStack(GCItems.schematic, 1, 0), new EntityAlienVillager.PriceInfo(3, 5), new ItemStack(GCItems.schematic, 1, 1)), //Exchange buggy and rocket schematics new EntityAlienVillager.ItemAndEmeraldToItem(new ItemStack(GCItems.schematic, 1, 1), new EntityAlienVillager.PriceInfo(3, 5), new ItemStack(GCItems.schematic, 1, 0)), //Exchange buggy and rocket schematics new EntityAlienVillager.ItemAndEmeraldToItem(new ItemStack(GCItems.basicItem, 2, 3), new EntityAlienVillager.PriceInfo(1, 1), new ItemStack(GCItems.basicItem, 1, 6)), //Compressed Tin - needed to craft a Fuel Loader new EntityAlienVillager.ItemAndEmeraldToItem(new ItemStack(GCItems.basicItem, 2, 4), new EntityAlienVillager.PriceInfo(1, 1), new ItemStack(GCItems.basicItem, 1, 7)), //Compressed Copper - needed to craft a Fuel Loader new EntityAlienVillager.EmeraldForItems(new ItemStack(Blocks.sapling, 1, 3), new EntityAlienVillager.PriceInfo(11, 39)) //The one thing Alien Villagers don't have and can't get is jungle trees... }; public EntityAlienVillager(World worldIn) { super(worldIn); this.villagerInventory = new InventoryBasic("Items", false, 8); this.setSize(0.6F, 1.8F); ((PathNavigateGround) this.getNavigator()).setBreakDoors(true); ((PathNavigateGround) this.getNavigator()).setAvoidsWater(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIAvoidEntity<>(this, EntityZombie.class, 8.0F, 0.6D, 0.6D)); this.tasks.addTask(1, new EntityAITradePlayerGC(this)); this.tasks.addTask(1, new EntityAILookAtTradePlayerGC(this)); this.tasks.addTask(2, new EntityAIMoveIndoors(this)); this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this)); this.tasks.addTask(4, new EntityAIOpenDoor(this, true)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.6D)); this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F)); this.tasks.addTask(9, new EntityAIWander(this, 0.6D)); this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F)); this.setCanPickUpLoot(true); } @Override protected void onGrowingAdult() { super.onGrowingAdult(); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D); } @Override protected void updateAITasks() { if (--this.randomTickDivider <= 0) { BlockPos blockpos = new BlockPos(this); this.worldObj.getVillageCollection().addToVillagerPositionList(blockpos); this.randomTickDivider = 70 + this.rand.nextInt(50); this.villageObj = this.worldObj.getVillageCollection().getNearestVillage(blockpos, 32); if (this.villageObj == null) { this.detachHome(); } else { BlockPos blockpos1 = this.villageObj.getCenter(); this.setHomePosAndDistance(blockpos1, (int) ((float) this.villageObj.getVillageRadius() * 1.0F)); if (this.isLookingForHome) { this.isLookingForHome = false; this.villageObj.setDefaultPlayerReputation(5); } } } if (!this.isTrading() && this.timeUntilReset > 0) { --this.timeUntilReset; if (this.timeUntilReset <= 0) { if (this.needsInitilization) { for (MerchantRecipe merchantrecipe : this.buyingList) { if (merchantrecipe.isRecipeDisabled()) { merchantrecipe.increaseMaxTradeUses(this.rand.nextInt(6) + this.rand.nextInt(6) + 2); } } this.populateBuyingList(); this.needsInitilization = false; if (this.villageObj != null && this.lastBuyingPlayer != null) { this.worldObj.setEntityState(this, (byte) 14); this.villageObj.setReputationForPlayer(this.lastBuyingPlayer, 1); } } this.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 0)); } } super.updateAITasks(); } @Override public boolean interact(EntityPlayer player) { ItemStack itemstack = player.inventory.getCurrentItem(); boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg; if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking()) { PlayerGearData gearData = ClientProxyCore.playerItemData.get(player.getGameProfile().getName()); if (!this.worldObj.isRemote && (this.buyingList == null || this.buyingList.size() > 0)) { if (gearData != null && gearData.getFrequencyModule() != -1) { this.setCustomer(player); player.displayVillagerTradeGui(this); } else { if (player instanceof EntityPlayerMP) { EntityPlayerMP playerMP = (EntityPlayerMP) player; GCPlayerStats stats = GCPlayerStats.get(playerMP); if (stats.getChatCooldown() == 0) { player.addChatMessage(new ChatComponentText(GCCoreUtil.translate("gui.village.warning.no_freq_mod"))); stats.setChatCooldown(20); } } } } player.triggerAchievement(StatList.timesTalkedToVillagerStat); return true; } else { return super.interact(player); } } @Override public void writeEntityToNBT(NBTTagCompound tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setInteger("Riches", this.wealth); if (this.buyingList != null) { tagCompound.setTag("Offers", this.buyingList.getRecipiesAsTags()); } NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.villagerInventory.getSizeInventory(); ++i) { ItemStack itemstack = this.villagerInventory.getStackInSlot(i); if (itemstack != null) { nbttaglist.appendTag(itemstack.writeToNBT(new NBTTagCompound())); } } tagCompound.setTag("Inventory", nbttaglist); } @Override public void readEntityFromNBT(NBTTagCompound tagCompund) { super.readEntityFromNBT(tagCompund); this.wealth = tagCompund.getInteger("Riches"); if (tagCompund.hasKey("Offers", 10)) { NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Offers"); this.buyingList = new MerchantRecipeList(nbttagcompound); } NBTTagList nbttaglist = tagCompund.getTagList("Inventory", 10); for (int i = 0; i < nbttaglist.tagCount(); ++i) { ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttaglist.getCompoundTagAt(i)); if (itemstack != null) { this.villagerInventory.func_174894_a(itemstack); } } this.setCanPickUpLoot(true); } @Override protected boolean canDespawn() { return false; } @Override protected float getSoundPitch() { return (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 0.5F; } @Override protected String getLivingSound() { return this.isTrading() ? "mob.villager.haggle" : "mob.villager.idle"; } @Override protected String getHurtSound() { return "mob.villager.hit"; } @Override protected String getDeathSound() { return "mob.villager.death"; } public boolean isMating() { return this.isMating; } public void setMating(boolean mating) { this.isMating = mating; } public void setPlaying(boolean playing) { this.isPlaying = playing; } public boolean isPlaying() { return this.isPlaying; } @Override public void setRevengeTarget(EntityLivingBase livingBase) { super.setRevengeTarget(livingBase); if (this.villageObj != null && livingBase != null) { this.villageObj.addOrRenewAgressor(livingBase); if (livingBase instanceof EntityPlayer) { int i = -1; if (this.isChild()) { i = -3; } this.villageObj.setReputationForPlayer(livingBase.getName(), i); if (this.isEntityAlive()) { this.worldObj.setEntityState(this, (byte) 13); } } } } @Override public void onDeath(DamageSource cause) { if (this.villageObj != null) { Entity entity = cause.getEntity(); if (entity != null) { if (entity instanceof EntityPlayer) { this.villageObj.setReputationForPlayer(entity.getName(), -2); } else if (entity instanceof IMob) { this.villageObj.endMatingSeason(); } } else { EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, 16.0D); if (entityplayer != null) { this.villageObj.endMatingSeason(); } } } super.onDeath(cause); } @Override public void setCustomer(EntityPlayer p_70932_1_) { this.buyingPlayer = p_70932_1_; } @Override public EntityPlayer getCustomer() { return this.buyingPlayer; } public boolean isTrading() { return this.buyingPlayer != null; } @Override public void useRecipe(MerchantRecipe recipe) { recipe.incrementToolUses(); this.livingSoundTime = -this.getTalkInterval(); this.playSound("mob.villager.yes", this.getSoundVolume(), this.getSoundPitch()); int i = 3 + this.rand.nextInt(4); if (recipe.getToolUses() == 1 || this.rand.nextInt(5) == 0) { this.timeUntilReset = 40; this.needsInitilization = true; if (this.buyingPlayer != null) { this.lastBuyingPlayer = this.buyingPlayer.getName(); } else { this.lastBuyingPlayer = null; } i += 5; } if (recipe.getItemToBuy().getItem() == Items.emerald) { this.wealth += recipe.getItemToBuy().stackSize; } if (recipe.getRewardsExp()) { this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY + 0.5D, this.posZ, i)); } } @Override public void verifySellingItem(ItemStack stack) { if (!this.worldObj.isRemote && this.livingSoundTime > -this.getTalkInterval() + 20) { this.livingSoundTime = -this.getTalkInterval(); if (stack != null) { this.playSound("mob.villager.yes", this.getSoundVolume(), this.getSoundPitch()); } else { this.playSound("mob.villager.no", this.getSoundVolume(), this.getSoundPitch()); } } } @Override public MerchantRecipeList getRecipes(EntityPlayer p_70934_1_) { if (this.buyingList == null) { this.populateBuyingList(); } return this.buyingList; } private void populateBuyingList() { if (this.buyingList == null) { this.buyingList = new MerchantRecipeList(); } for (EntityAlienVillager.ITradeList tradeList : DEFAULT_TRADE_LIST_MAP) { tradeList.modifyMerchantRecipeList(this.buyingList, this.rand); } } @Override @SideOnly(Side.CLIENT) public void setRecipes(MerchantRecipeList recipeList) { } @Override public float getEyeHeight() { float f = 1.62F; if (this.isChild()) { f = (float) ((double) f - 0.81D); } return f; } @Override @SideOnly(Side.CLIENT) public void handleStatusUpdate(byte id) { if (id == 12) { this.spawnParticles(EnumParticleTypes.HEART); } else if (id == 13) { this.spawnParticles(EnumParticleTypes.VILLAGER_ANGRY); } else if (id == 14) { this.spawnParticles(EnumParticleTypes.VILLAGER_HAPPY); } else { super.handleStatusUpdate(id); } } @SideOnly(Side.CLIENT) private void spawnParticles(EnumParticleTypes particleType) { for (int i = 0; i < 5; ++i) { double d0 = this.rand.nextGaussian() * 0.02D; double d1 = this.rand.nextGaussian() * 0.02D; double d2 = this.rand.nextGaussian() * 0.02D; this.worldObj.spawnParticle(particleType, this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, this.posY + 1.0D + (double) (this.rand.nextFloat() * this.height), this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, d0, d1, d2, new int[0]); } } @Override public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) { livingdata = super.onInitialSpawn(difficulty, livingdata); return livingdata; } @Override public EntityAlienVillager createChild(EntityAgeable ageable) { EntityAlienVillager entityvillager = new EntityAlienVillager(this.worldObj); entityvillager.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData) null); return entityvillager; } @Override public boolean allowLeashing() { return false; } @Override public void onStruckByLightning(EntityLightningBolt lightningBolt) { if (!this.worldObj.isRemote && !this.isDead) { EntityWitch entitywitch = new EntityWitch(this.worldObj); entitywitch.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); entitywitch.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entitywitch)), (IEntityLivingData) null); entitywitch.setNoAI(this.isAIDisabled()); if (this.hasCustomName()) { entitywitch.setCustomNameTag(this.getCustomNameTag()); entitywitch.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag()); } this.worldObj.spawnEntityInWorld(entitywitch); this.setDead(); } } public InventoryBasic getVillagerInventory() { return this.villagerInventory; } @Override protected void updateEquipmentIfNeeded(EntityItem itemEntity) { ItemStack itemstack = itemEntity.getEntityItem(); Item item = itemstack.getItem(); if (this.canVillagerPickupItem(item)) { ItemStack itemstack1 = this.villagerInventory.func_174894_a(itemstack); if (itemstack1 == null) { itemEntity.setDead(); } else { itemstack.stackSize = itemstack1.stackSize; } } } private boolean canVillagerPickupItem(Item itemIn) { return itemIn == Items.bread || itemIn == Items.potato || itemIn == Items.carrot || itemIn == Items.wheat || itemIn == Items.wheat_seeds; } public boolean func_175553_cp() { return this.hasEnoughItems(1); } public boolean canAbondonItems() { return this.hasEnoughItems(2); } public boolean func_175557_cr() { return !this.hasEnoughItems(5); } private boolean hasEnoughItems(int multiplier) { for (int i = 0; i < this.villagerInventory.getSizeInventory(); ++i) { ItemStack itemstack = this.villagerInventory.getStackInSlot(i); if (itemstack != null) { if (itemstack.getItem() == Items.bread && itemstack.stackSize >= 3 * multiplier || itemstack.getItem() == Items.potato && itemstack.stackSize >= 12 * multiplier || itemstack.getItem() == Items.carrot && itemstack.stackSize >= 12 * multiplier) { return true; } if (itemstack.getItem() == Items.wheat && itemstack.stackSize >= 9 * multiplier) { return true; } } } return false; } @Override public boolean canBreath() { return true; } @Override public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn) { if (super.replaceItemInInventory(inventorySlot, itemStackIn)) { return true; } else { int i = inventorySlot - 300; if (i >= 0 && i < this.villagerInventory.getSizeInventory()) { this.villagerInventory.setInventorySlotContents(i, itemStackIn); return true; } else { return false; } } } public static class EmeraldForItems implements EntityAlienVillager.ITradeList { public ItemStack sellItem; public EntityAlienVillager.PriceInfo price; public EmeraldForItems(ItemStack itemStack, EntityAlienVillager.PriceInfo priceIn) { this.sellItem = itemStack; this.price = priceIn; } @Override public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) { int i = 1; if (this.price != null) { i = this.price.getPrice(random); } ItemStack tradeStack = this.sellItem.copy(); tradeStack.stackSize = i; recipeList.add(new MerchantRecipe(tradeStack, new ItemStack(GCItems.itemBasicMoon, 1, 2))); } } public interface ITradeList { void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random); } public static class ItemAndEmeraldToItem implements EntityAlienVillager.ITradeList { public ItemStack field_179411_a; public EntityAlienVillager.PriceInfo field_179409_b; public ItemStack field_179410_c; public ItemAndEmeraldToItem(Item p_i45813_1_, EntityAlienVillager.PriceInfo p_i45813_2_, Item p_i45813_3_) { this.field_179411_a = new ItemStack(p_i45813_1_); this.field_179409_b = p_i45813_2_; this.field_179410_c = new ItemStack(p_i45813_3_); } public ItemAndEmeraldToItem(ItemStack p_i45813_1_, EntityAlienVillager.PriceInfo p_i45813_2_, ItemStack p_i45813_3_) { this.field_179411_a = p_i45813_1_; this.field_179409_b = p_i45813_2_; this.field_179410_c = p_i45813_3_; } @Override public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) { int i = 1; if (this.field_179409_b != null) { i = this.field_179409_b.getPrice(random); } recipeList.add(new MerchantRecipe(this.field_179411_a.copy(), new ItemStack(GCItems.itemBasicMoon, i, 2), this.field_179410_c.copy())); } } public static class ListEnchantedBookForEmeralds implements EntityAlienVillager.ITradeList { @Override public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) { Enchantment enchantment = Enchantment.enchantmentsBookList[random.nextInt(Enchantment.enchantmentsBookList.length)]; int i = MathHelper.getRandomIntegerInRange(random, enchantment.getMinLevel(), enchantment.getMaxLevel()); ItemStack itemstack = Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(enchantment, i)); int j = 2 + random.nextInt(5 + i * 10) + 3 * i; if (j > 64) { j = 64; } recipeList.add(new MerchantRecipe(new ItemStack(Items.book), new ItemStack(GCItems.itemBasicMoon, j, 2), itemstack)); } } public static class ListEnchantedItemForEmeralds implements EntityAlienVillager.ITradeList { public ItemStack field_179407_a; public EntityAlienVillager.PriceInfo field_179406_b; public ListEnchantedItemForEmeralds(Item p_i45814_1_, EntityAlienVillager.PriceInfo p_i45814_2_) { this.field_179407_a = new ItemStack(p_i45814_1_); this.field_179406_b = p_i45814_2_; } @Override public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) { int i = 1; if (this.field_179406_b != null) { i = this.field_179406_b.getPrice(random); } ItemStack itemstack = new ItemStack(GCItems.itemBasicMoon, i, 2); ItemStack itemstack1 = new ItemStack(this.field_179407_a.getItem(), 1, this.field_179407_a.getMetadata()); itemstack1 = EnchantmentHelper.addRandomEnchantment(random, itemstack1, 5 + random.nextInt(15)); recipeList.add(new MerchantRecipe(itemstack, itemstack1)); } } public static class ListItemForEmeralds implements EntityAlienVillager.ITradeList { public ItemStack field_179403_a; public EntityAlienVillager.PriceInfo field_179402_b; public ListItemForEmeralds(Item par1Item, EntityAlienVillager.PriceInfo priceInfo) { this.field_179403_a = new ItemStack(par1Item); this.field_179402_b = priceInfo; } public ListItemForEmeralds(ItemStack stack, EntityAlienVillager.PriceInfo priceInfo) { this.field_179403_a = stack; this.field_179402_b = priceInfo; } @Override public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) { int i = 1; if (this.field_179402_b != null) { i = this.field_179402_b.getPrice(random); } ItemStack itemstack; ItemStack itemstack1; if (i < 0) { itemstack = new ItemStack(GCItems.itemBasicMoon, 1, 2); itemstack1 = new ItemStack(this.field_179403_a.getItem(), -i, this.field_179403_a.getMetadata()); } else { itemstack = new ItemStack(GCItems.itemBasicMoon, i, 2); itemstack1 = new ItemStack(this.field_179403_a.getItem(), 1, this.field_179403_a.getMetadata()); } recipeList.add(new MerchantRecipe(itemstack, itemstack1)); } } public static class PriceInfo extends Tuple<Integer, Integer> { public PriceInfo(int p_i45810_1_, int p_i45810_2_) { super(Integer.valueOf(p_i45810_1_), Integer.valueOf(p_i45810_2_)); } public int getPrice(Random rand) { return ((Integer) this.getFirst()).intValue() >= ((Integer) this.getSecond()).intValue() ? ((Integer) this.getFirst()).intValue() : ((Integer) this.getFirst()).intValue() + rand.nextInt(((Integer) this.getSecond()).intValue() - ((Integer) this.getFirst()).intValue() + 1); } } }