    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import cpw.mods.fml.common.registry.VillagerRegistry;
    006
    007    import java.util.Collections;
    008    import java.util.HashMap;
    009    import java.util.Map;
    010    import java.util.Random;
    011
    012    public class EntityVillager extends EntityAgeable implements INpc, IMerchant
    013    {
    014        private int randomTickDivider;
    015        private boolean isMating;
    016        private boolean isPlaying;
    017        Village villageObj;
    018
    019        /** This villager's current customer. */
    020        private EntityPlayer buyingPlayer;
    021
    022        /** Initialises the MerchantRecipeList.java */
    023        private MerchantRecipeList buyingList;
    024        private int timeUntilReset;
    025
    026        /** addDefaultEquipmentAndRecipies is called if this is true */
    027        private boolean needsInitilization;
    028        private int wealth;
    029
    030        /** Recipes for buying things from Villagers. */
    031        private MerchantRecipe sellingRecipeList;
    032
    033        /**
    034         * a villagers recipe list is intialized off this list ; the 2 params are min/max amount they will trade for 1
    035         * emerald
    036         */
    037        public static final Map villagerStockList = new HashMap();
    038
    039        /**
    040         * Selling list of Blacksmith items. negative numbers mean 1 emerald for n items, positive numbers are n emeralds
    041         * for 1 item
    042         */
    043        public static final Map blacksmithSellingList = new HashMap();
    044
    045        public EntityVillager(World par1World)
    046        {
    047            this(par1World, 0);
    048        }
    049
    050        public EntityVillager(World par1World, int par2)
    051        {
    052            super(par1World);
    053            this.randomTickDivider = 0;
    054            this.isMating = false;
    055            this.isPlaying = false;
    056            this.villageObj = null;
    057            this.setProfession(par2);
    058            this.texture = "/mob/villager/villager.png";
    059            this.moveSpeed = 0.5F;
    060            this.getNavigator().setBreakDoors(true);
    061            this.getNavigator().setAvoidsWater(true);
    062            this.tasks.addTask(0, new EntityAISwimming(this));
    063            this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.3F, 0.35F));
    064            this.tasks.addTask(1, new EntityAITradePlayer(this));
    065            this.tasks.addTask(1, new EntityAILookAtTradePlayer(this));
    066            this.tasks.addTask(2, new EntityAIMoveIndoors(this));
    067            this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this));
    068            this.tasks.addTask(4, new EntityAIOpenDoor(this, true));
    069            this.tasks.addTask(5, new EntityAIMoveTwardsRestriction(this, 0.3F));
    070            this.tasks.addTask(6, new EntityAIVillagerMate(this));
    071            this.tasks.addTask(7, new EntityAIFollowGolem(this));
    072            this.tasks.addTask(8, new EntityAIPlay(this, 0.32F));
    073            this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F));
    074            this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityVillager.class, 5.0F, 0.02F));
    075            this.tasks.addTask(9, new EntityAIWander(this, 0.3F));
    076            this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F));
    077        }
    078
    079        /**
    080         * Returns true if the newer Entity AI code should be run
    081         */
    082        public boolean isAIEnabled()
    083        {
    084            return true;
    085        }
    086
    087        /**
    088         * main AI tick function, replaces updateEntityActionState
    089         */
    090        protected void updateAITick()
    091        {
    092            if (--this.randomTickDivider <= 0)
    093            {
    094                this.worldObj.villageCollectionObj.addVillagerPosition(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ));
    095                this.randomTickDivider = 70 + this.rand.nextInt(50);
    096                this.villageObj = this.worldObj.villageCollectionObj.findNearestVillage(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ), 32);
    097
    098                if (this.villageObj == null)
    099                {
    100                    this.detachHome();
    101                }
    102                else
    103                {
    104                    ChunkCoordinates var1 = this.villageObj.getCenter();
    105                    this.setHomeArea(var1.posX, var1.posY, var1.posZ, this.villageObj.getVillageRadius());
    106                }
    107            }
    108
    109            if (!this.isTrading() && this.timeUntilReset > 0)
    110            {
    111                --this.timeUntilReset;
    112
    113                if (this.timeUntilReset <= 0)
    114                {
    115                    if (this.needsInitilization)
    116                    {
    117                        this.addDefaultEquipmentAndRecipies(1);
    118                        this.needsInitilization = false;
    119                    }
    120
    121                    if (this.sellingRecipeList != null)
    122                    {
    123                        this.buyingList.remove(this.sellingRecipeList);
    124                        this.sellingRecipeList = null;
    125                    }
    126
    127                    this.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 0));
    128                }
    129            }
    130
    131            super.updateAITick();
    132        }
    133
    134        /**
    135         * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
    136         */
    137        public boolean interact(EntityPlayer par1EntityPlayer)
    138        {
    139            if (this.isEntityAlive() && !this.isTrading() && !this.isChild())
    140            {
    141                if (!this.worldObj.isRemote)
    142                {
    143                    this.setCustomer(par1EntityPlayer);
    144                    par1EntityPlayer.displayGUIMerchant(this);
    145                }
    146
    147                return true;
    148            }
    149            else
    150            {
    151                return super.interact(par1EntityPlayer);
    152            }
    153        }
    154
    155        protected void entityInit()
    156        {
    157            super.entityInit();
    158            this.dataWatcher.addObject(16, Integer.valueOf(0));
    159        }
    160
    161        public int getMaxHealth()
    162        {
    163            return 20;
    164        }
    165
    166        /**
    167         * (abstract) Protected helper method to write subclass entity data to NBT.
    168         */
    169        public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
    170        {
    171            super.writeEntityToNBT(par1NBTTagCompound);
    172            par1NBTTagCompound.setInteger("Profession", this.getProfession());
    173            par1NBTTagCompound.setInteger("Riches", this.wealth);
    174
    175            if (this.buyingList != null)
    176            {
    177                par1NBTTagCompound.setCompoundTag("Offers", this.buyingList.getRecipiesAsTags());
    178            }
    179        }
    180
    181        /**
    182         * (abstract) Protected helper method to read subclass entity data from NBT.
    183         */
    184        public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
    185        {
    186            super.readEntityFromNBT(par1NBTTagCompound);
    187            this.setProfession(par1NBTTagCompound.getInteger("Profession"));
    188            this.wealth = par1NBTTagCompound.getInteger("Riches");
    189
    190            if (par1NBTTagCompound.hasKey("Offers"))
    191            {
    192                NBTTagCompound var2 = par1NBTTagCompound.getCompoundTag("Offers");
    193                this.buyingList = new MerchantRecipeList(var2);
    194            }
    195        }
    196
    197        @SideOnly(Side.CLIENT)
    198
    199        /**
    200         * Returns the texture's file path as a String.
    201         */
    202        public String getTexture()
    203        {
    204            switch (this.getProfession())
    205            {
    206                case 0:
    207                    return "/mob/villager/farmer.png";
    208                case 1:
    209                    return "/mob/villager/librarian.png";
    210                case 2:
    211                    return "/mob/villager/priest.png";
    212                case 3:
    213                    return "/mob/villager/smith.png";
    214                case 4:
    215                    return "/mob/villager/butcher.png";
    216                default:
    217                    return VillagerRegistry.getVillagerSkin(this.getProfession(), super.getTexture());
    218            }
    219        }
    220
    221        /**
    222         * Determines if an entity can be despawned, used on idle far away entities
    223         */
    224        protected boolean canDespawn()
    225        {
    226            return false;
    227        }
    228
    229        /**
    230         * Returns the sound this mob makes while it's alive.
    231         */
    232        protected String getLivingSound()
    233        {
    234            return "mob.villager.default";
    235        }
    236
    237        /**
    238         * Returns the sound this mob makes when it is hurt.
    239         */
    240        protected String getHurtSound()
    241        {
    242            return "mob.villager.defaulthurt";
    243        }
    244
    245        /**
    246         * Returns the sound this mob makes on death.
    247         */
    248        protected String getDeathSound()
    249        {
    250            return "mob.villager.defaultdeath";
    251        }
    252
    253        public void setProfession(int par1)
    254        {
    255            this.dataWatcher.updateObject(16, Integer.valueOf(par1));
    256        }
    257
    258        public int getProfession()
    259        {
    260            return this.dataWatcher.getWatchableObjectInt(16);
    261        }
    262
    263        public boolean isMating()
    264        {
    265            return this.isMating;
    266        }
    267
    268        public void setMating(boolean par1)
    269        {
    270            this.isMating = par1;
    271        }
    272
    273        public void setPlaying(boolean par1)
    274        {
    275            this.isPlaying = par1;
    276        }
    277
    278        public boolean isPlaying()
    279        {
    280            return this.isPlaying;
    281        }
    282
    283        public void setRevengeTarget(EntityLiving par1EntityLiving)
    284        {
    285            super.setRevengeTarget(par1EntityLiving);
    286
    287            if (this.villageObj != null && par1EntityLiving != null)
    288            {
    289                this.villageObj.addOrRenewAgressor(par1EntityLiving);
    290            }
    291        }
    292
    293        public void setCustomer(EntityPlayer par1EntityPlayer)
    294        {
    295            this.buyingPlayer = par1EntityPlayer;
    296        }
    297
    298        public EntityPlayer getCustomer()
    299        {
    300            return this.buyingPlayer;
    301        }
    302
    303        public boolean isTrading()
    304        {
    305            return this.buyingPlayer != null;
    306        }
    307
    308        public void useRecipe(MerchantRecipe par1MerchantRecipe)
    309        {
    310            par1MerchantRecipe.incrementToolUses();
    311
    312            if (par1MerchantRecipe.hasSameIDsAs((MerchantRecipe)this.buyingList.get(this.buyingList.size() - 1)))
    313            {
    314                this.timeUntilReset = 60;
    315                this.needsInitilization = true;
    316            }
    317            else if (this.buyingList.size() > 1)
    318            {
    319                int var2 = this.rand.nextInt(6) + this.rand.nextInt(6) + 3;
    320
    321                if (var2 <= par1MerchantRecipe.getToolUses())
    322                {
    323                    this.timeUntilReset = 20;
    324                    this.sellingRecipeList = par1MerchantRecipe;
    325                }
    326            }
    327
    328            if (par1MerchantRecipe.getItemToBuy().itemID == Item.emerald.shiftedIndex)
    329            {
    330                this.wealth += par1MerchantRecipe.getItemToBuy().stackSize;
    331            }
    332        }
    333
    334        public MerchantRecipeList getRecipes(EntityPlayer par1EntityPlayer)
    335        {
    336            if (this.buyingList == null)
    337            {
    338                this.addDefaultEquipmentAndRecipies(1);
    339            }
    340
    341            return this.buyingList;
    342        }
    343
    344        /**
    345         * based on the villagers profession add items, equipment, and recipies adds par1 random items to the list of things
    346         * that the villager wants to buy. (at most 1 of each wanted type is added)
    347         */
    348        private void addDefaultEquipmentAndRecipies(int par1)
    349        {
    350            MerchantRecipeList var2;
    351            var2 = new MerchantRecipeList();
    352            label44:
    353
    354            switch (this.getProfession())
    355            {
    356                case 0:
    357                    addMerchantItem(var2, Item.wheat.shiftedIndex, this.rand, 0.9F);
    358                    addMerchantItem(var2, Block.cloth.blockID, this.rand, 0.5F);
    359                    addMerchantItem(var2, Item.chickenRaw.shiftedIndex, this.rand, 0.5F);
    360                    addMerchantItem(var2, Item.fishCooked.shiftedIndex, this.rand, 0.4F);
    361                    addBlacksmithItem(var2, Item.bread.shiftedIndex, this.rand, 0.9F);
    362                    addBlacksmithItem(var2, Item.melon.shiftedIndex, this.rand, 0.3F);
    363                    addBlacksmithItem(var2, Item.appleRed.shiftedIndex, this.rand, 0.3F);
    364                    addBlacksmithItem(var2, Item.cookie.shiftedIndex, this.rand, 0.3F);
    365                    addBlacksmithItem(var2, Item.shears.shiftedIndex, this.rand, 0.3F);
    366                    addBlacksmithItem(var2, Item.flintAndSteel.shiftedIndex, this.rand, 0.3F);
    367                    addBlacksmithItem(var2, Item.chickenCooked.shiftedIndex, this.rand, 0.3F);
    368                    addBlacksmithItem(var2, Item.arrow.shiftedIndex, this.rand, 0.5F);
    369
    370                    if (this.rand.nextFloat() < 0.5F)
    371                    {
    372                        var2.add(new MerchantRecipe(new ItemStack(Block.gravel, 10), new ItemStack(Item.emerald), new ItemStack(Item.flint.shiftedIndex, 2 + this.rand.nextInt(2), 0)));
    373                    }
    374
    375                    break;
    376                case 1:
    377                    addMerchantItem(var2, Item.paper.shiftedIndex, this.rand, 0.8F);
    378                    addMerchantItem(var2, Item.book.shiftedIndex, this.rand, 0.8F);
    379                    addMerchantItem(var2, Item.writtenBook.shiftedIndex, this.rand, 0.3F);
    380                    addBlacksmithItem(var2, Block.bookShelf.blockID, this.rand, 0.8F);
    381                    addBlacksmithItem(var2, Block.glass.blockID, this.rand, 0.2F);
    382                    addBlacksmithItem(var2, Item.compass.shiftedIndex, this.rand, 0.2F);
    383                    addBlacksmithItem(var2, Item.pocketSundial.shiftedIndex, this.rand, 0.2F);
    384                    break;
    385                case 2:
    386                    addBlacksmithItem(var2, Item.eyeOfEnder.shiftedIndex, this.rand, 0.3F);
    387                    addBlacksmithItem(var2, Item.expBottle.shiftedIndex, this.rand, 0.2F);
    388                    addBlacksmithItem(var2, Item.redstone.shiftedIndex, this.rand, 0.4F);
    389                    addBlacksmithItem(var2, Block.glowStone.blockID, this.rand, 0.3F);
    390                    int[] var3 = new int[] {Item.swordSteel.shiftedIndex, Item.swordDiamond.shiftedIndex, Item.plateSteel.shiftedIndex, Item.plateDiamond.shiftedIndex, Item.axeSteel.shiftedIndex, Item.axeDiamond.shiftedIndex, Item.pickaxeSteel.shiftedIndex, Item.pickaxeDiamond.shiftedIndex};
    391                    int[] var4 = var3;
    392                    int var5 = var3.length;
    393                    int var6 = 0;
    394
    395                    while (true)
    396                    {
    397                        if (var6 >= var5)
    398                        {
    399                            break label44;
    400                        }
    401
    402                        int var7 = var4[var6];
    403
    404                        if (this.rand.nextFloat() < 0.1F)
    405                        {
    406                            var2.add(new MerchantRecipe(new ItemStack(var7, 1, 0), new ItemStack(Item.emerald, 2 + this.rand.nextInt(3), 0), EnchantmentHelper.addRandomEnchantment(this.rand, new ItemStack(var7, 1, 0), 5 + this.rand.nextInt(15))));
    407                        }
    408
    409                        ++var6;
    410                    }
    411                case 3:
    412                    addMerchantItem(var2, Item.coal.shiftedIndex, this.rand, 0.7F);
    413                    addMerchantItem(var2, Item.ingotIron.shiftedIndex, this.rand, 0.5F);
    414                    addMerchantItem(var2, Item.ingotGold.shiftedIndex, this.rand, 0.5F);
    415                    addMerchantItem(var2, Item.diamond.shiftedIndex, this.rand, 0.5F);
    416                    addBlacksmithItem(var2, Item.swordSteel.shiftedIndex, this.rand, 0.5F);
    417                    addBlacksmithItem(var2, Item.swordDiamond.shiftedIndex, this.rand, 0.5F);
    418                    addBlacksmithItem(var2, Item.axeSteel.shiftedIndex, this.rand, 0.3F);
    419                    addBlacksmithItem(var2, Item.axeDiamond.shiftedIndex, this.rand, 0.3F);
    420                    addBlacksmithItem(var2, Item.pickaxeSteel.shiftedIndex, this.rand, 0.5F);
    421                    addBlacksmithItem(var2, Item.pickaxeDiamond.shiftedIndex, this.rand, 0.5F);
    422                    addBlacksmithItem(var2, Item.shovelSteel.shiftedIndex, this.rand, 0.2F);
    423                    addBlacksmithItem(var2, Item.shovelDiamond.shiftedIndex, this.rand, 0.2F);
    424                    addBlacksmithItem(var2, Item.hoeSteel.shiftedIndex, this.rand, 0.2F);
    425                    addBlacksmithItem(var2, Item.hoeDiamond.shiftedIndex, this.rand, 0.2F);
    426                    addBlacksmithItem(var2, Item.bootsSteel.shiftedIndex, this.rand, 0.2F);
    427                    addBlacksmithItem(var2, Item.bootsDiamond.shiftedIndex, this.rand, 0.2F);
    428                    addBlacksmithItem(var2, Item.helmetSteel.shiftedIndex, this.rand, 0.2F);
    429                    addBlacksmithItem(var2, Item.helmetDiamond.shiftedIndex, this.rand, 0.2F);
    430                    addBlacksmithItem(var2, Item.plateSteel.shiftedIndex, this.rand, 0.2F);
    431                    addBlacksmithItem(var2, Item.plateDiamond.shiftedIndex, this.rand, 0.2F);
    432                    addBlacksmithItem(var2, Item.legsSteel.shiftedIndex, this.rand, 0.2F);
    433                    addBlacksmithItem(var2, Item.legsDiamond.shiftedIndex, this.rand, 0.2F);
    434                    addBlacksmithItem(var2, Item.bootsChain.shiftedIndex, this.rand, 0.1F);
    435                    addBlacksmithItem(var2, Item.helmetChain.shiftedIndex, this.rand, 0.1F);
    436                    addBlacksmithItem(var2, Item.plateChain.shiftedIndex, this.rand, 0.1F);
    437                    addBlacksmithItem(var2, Item.legsChain.shiftedIndex, this.rand, 0.1F);
    438                    break;
    439                case 4:
    440                    addMerchantItem(var2, Item.coal.shiftedIndex, this.rand, 0.7F);
    441                    addMerchantItem(var2, Item.porkRaw.shiftedIndex, this.rand, 0.5F);
    442                    addMerchantItem(var2, Item.beefRaw.shiftedIndex, this.rand, 0.5F);
    443                    addBlacksmithItem(var2, Item.saddle.shiftedIndex, this.rand, 0.1F);
    444                    addBlacksmithItem(var2, Item.plateLeather.shiftedIndex, this.rand, 0.3F);
    445                    addBlacksmithItem(var2, Item.bootsLeather.shiftedIndex, this.rand, 0.3F);
    446                    addBlacksmithItem(var2, Item.helmetLeather.shiftedIndex, this.rand, 0.3F);
    447                    addBlacksmithItem(var2, Item.legsLeather.shiftedIndex, this.rand, 0.3F);
    448                    addBlacksmithItem(var2, Item.porkCooked.shiftedIndex, this.rand, 0.3F);
    449                    addBlacksmithItem(var2, Item.beefCooked.shiftedIndex, this.rand, 0.3F);
    450            }
    451
    452            VillagerRegistry.manageVillagerTrades(var2, this, this.getProfession(), this.rand);
    453
    454            if (var2.isEmpty())
    455            {
    456                addMerchantItem(var2, Item.ingotGold.shiftedIndex, this.rand, 1.0F);
    457            }
    458
    459            Collections.shuffle(var2);
    460
    461            if (this.buyingList == null)
    462            {
    463                this.buyingList = new MerchantRecipeList();
    464            }
    465
    466            for (int var8 = 0; var8 < par1 && var8 < var2.size(); ++var8)
    467            {
    468                this.buyingList.addToListWithCheck((MerchantRecipe)var2.get(var8));
    469            }
    470        }
    471
    472        @SideOnly(Side.CLIENT)
    473        public void setRecipes(MerchantRecipeList par1MerchantRecipeList) {}
    474
    475        /**
    476         * each recipie takes a random stack from villagerStockList and offers it for 1 emerald
    477         */
    478        public static void addMerchantItem(MerchantRecipeList par0MerchantRecipeList, int par1, Random par2Random, float par3)
    479        {
    480            if (par2Random.nextFloat() < par3)
    481            {
    482                par0MerchantRecipeList.add(new MerchantRecipe(getRandomSizedStack(par1, par2Random), Item.emerald));
    483            }
    484        }
    485
    486        private static ItemStack getRandomSizedStack(int par0, Random par1Random)
    487        {
    488            return new ItemStack(par0, getRandomCountForItem(par0, par1Random), 0);
    489        }
    490
    491        /**
    492         * default to 1, and villagerStockList contains a min/max amount for each index
    493         */
    494        private static int getRandomCountForItem(int par0, Random par1Random)
    495        {
    496            Tuple var2 = (Tuple)villagerStockList.get(Integer.valueOf(par0));
    497            return var2 == null ? 1 : (((Integer)var2.getFirst()).intValue() >= ((Integer)var2.getSecond()).intValue() ? ((Integer)var2.getFirst()).intValue() : ((Integer)var2.getFirst()).intValue() + par1Random.nextInt(((Integer)var2.getSecond()).intValue() - ((Integer)var2.getFirst()).intValue()));
    498        }
    499
    500        public static void addBlacksmithItem(MerchantRecipeList par0MerchantRecipeList, int par1, Random par2Random, float par3)
    501        {
    502            if (par2Random.nextFloat() < par3)
    503            {
    504                int var4 = getRandomCountForBlacksmithItem(par1, par2Random);
    505                ItemStack var5;
    506                ItemStack var6;
    507
    508                if (var4 < 0)
    509                {
    510                    var5 = new ItemStack(Item.emerald.shiftedIndex, 1, 0);
    511                    var6 = new ItemStack(par1, -var4, 0);
    512                }
    513                else
    514                {
    515                    var5 = new ItemStack(Item.emerald.shiftedIndex, var4, 0);
    516                    var6 = new ItemStack(par1, 1, 0);
    517                }
    518
    519                par0MerchantRecipeList.add(new MerchantRecipe(var5, var6));
    520            }
    521        }
    522
    523        private static int getRandomCountForBlacksmithItem(int par0, Random par1Random)
    524        {
    525            Tuple var2 = (Tuple)blacksmithSellingList.get(Integer.valueOf(par0));
    526            return var2 == null ? 1 : (((Integer)var2.getFirst()).intValue() >= ((Integer)var2.getSecond()).intValue() ? ((Integer)var2.getFirst()).intValue() : ((Integer)var2.getFirst()).intValue() + par1Random.nextInt(((Integer)var2.getSecond()).intValue() - ((Integer)var2.getFirst()).intValue()));
    527        }
    528
    529        @SideOnly(Side.CLIENT)
    530        public void handleHealthUpdate(byte par1)
    531        {
    532            if (par1 == 12)
    533            {
    534                this.generateRandomParticles("heart");
    535            }
    536            else
    537            {
    538                super.handleHealthUpdate(par1);
    539            }
    540        }
    541
    542        @SideOnly(Side.CLIENT)
    543
    544        /**
    545         * par1 is the particleName
    546         */
    547        private void generateRandomParticles(String par1Str)
    548        {
    549            for (int var2 = 0; var2 < 5; ++var2)
    550            {
    551                double var3 = this.rand.nextGaussian() * 0.02D;
    552                double var5 = this.rand.nextGaussian() * 0.02D;
    553                double var7 = this.rand.nextGaussian() * 0.02D;
    554                this.worldObj.spawnParticle(par1Str, 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, var3, var5, var7);
    555            }
    556        }
    557
    558        static
    559        {
    560            villagerStockList.put(Integer.valueOf(Item.coal.shiftedIndex), new Tuple(Integer.valueOf(16), Integer.valueOf(24)));
    561            villagerStockList.put(Integer.valueOf(Item.ingotIron.shiftedIndex), new Tuple(Integer.valueOf(8), Integer.valueOf(10)));
    562            villagerStockList.put(Integer.valueOf(Item.ingotGold.shiftedIndex), new Tuple(Integer.valueOf(8), Integer.valueOf(10)));
    563            villagerStockList.put(Integer.valueOf(Item.diamond.shiftedIndex), new Tuple(Integer.valueOf(4), Integer.valueOf(6)));
    564            villagerStockList.put(Integer.valueOf(Item.paper.shiftedIndex), new Tuple(Integer.valueOf(19), Integer.valueOf(30)));
    565            villagerStockList.put(Integer.valueOf(Item.book.shiftedIndex), new Tuple(Integer.valueOf(12), Integer.valueOf(15)));
    566            villagerStockList.put(Integer.valueOf(Item.writtenBook.shiftedIndex), new Tuple(Integer.valueOf(1), Integer.valueOf(1)));
    567            villagerStockList.put(Integer.valueOf(Item.enderPearl.shiftedIndex), new Tuple(Integer.valueOf(3), Integer.valueOf(4)));
    568            villagerStockList.put(Integer.valueOf(Item.eyeOfEnder.shiftedIndex), new Tuple(Integer.valueOf(2), Integer.valueOf(3)));
    569            villagerStockList.put(Integer.valueOf(Item.porkRaw.shiftedIndex), new Tuple(Integer.valueOf(14), Integer.valueOf(18)));
    570            villagerStockList.put(Integer.valueOf(Item.beefRaw.shiftedIndex), new Tuple(Integer.valueOf(14), Integer.valueOf(18)));
    571            villagerStockList.put(Integer.valueOf(Item.chickenRaw.shiftedIndex), new Tuple(Integer.valueOf(14), Integer.valueOf(18)));
    572            villagerStockList.put(Integer.valueOf(Item.fishCooked.shiftedIndex), new Tuple(Integer.valueOf(9), Integer.valueOf(13)));
    573            villagerStockList.put(Integer.valueOf(Item.seeds.shiftedIndex), new Tuple(Integer.valueOf(34), Integer.valueOf(48)));
    574            villagerStockList.put(Integer.valueOf(Item.melonSeeds.shiftedIndex), new Tuple(Integer.valueOf(30), Integer.valueOf(38)));
    575            villagerStockList.put(Integer.valueOf(Item.pumpkinSeeds.shiftedIndex), new Tuple(Integer.valueOf(30), Integer.valueOf(38)));
    576            villagerStockList.put(Integer.valueOf(Item.wheat.shiftedIndex), new Tuple(Integer.valueOf(18), Integer.valueOf(22)));
    577            villagerStockList.put(Integer.valueOf(Block.cloth.blockID), new Tuple(Integer.valueOf(14), Integer.valueOf(22)));
    578            villagerStockList.put(Integer.valueOf(Item.rottenFlesh.shiftedIndex), new Tuple(Integer.valueOf(36), Integer.valueOf(64)));
    579            blacksmithSellingList.put(Integer.valueOf(Item.flintAndSteel.shiftedIndex), new Tuple(Integer.valueOf(3), Integer.valueOf(4)));
    580            blacksmithSellingList.put(Integer.valueOf(Item.shears.shiftedIndex), new Tuple(Integer.valueOf(3), Integer.valueOf(4)));
    581            blacksmithSellingList.put(Integer.valueOf(Item.swordSteel.shiftedIndex), new Tuple(Integer.valueOf(7), Integer.valueOf(11)));
    582            blacksmithSellingList.put(Integer.valueOf(Item.swordDiamond.shiftedIndex), new Tuple(Integer.valueOf(12), Integer.valueOf(14)));
    583            blacksmithSellingList.put(Integer.valueOf(Item.axeSteel.shiftedIndex), new Tuple(Integer.valueOf(6), Integer.valueOf(8)));
    584            blacksmithSellingList.put(Integer.valueOf(Item.axeDiamond.shiftedIndex), new Tuple(Integer.valueOf(9), Integer.valueOf(12)));
    585            blacksmithSellingList.put(Integer.valueOf(Item.pickaxeSteel.shiftedIndex), new Tuple(Integer.valueOf(7), Integer.valueOf(9)));
    586            blacksmithSellingList.put(Integer.valueOf(Item.pickaxeDiamond.shiftedIndex), new Tuple(Integer.valueOf(10), Integer.valueOf(12)));
    587            blacksmithSellingList.put(Integer.valueOf(Item.shovelSteel.shiftedIndex), new Tuple(Integer.valueOf(4), Integer.valueOf(6)));
    588            blacksmithSellingList.put(Integer.valueOf(Item.shovelDiamond.shiftedIndex), new Tuple(Integer.valueOf(7), Integer.valueOf(8)));
    589            blacksmithSellingList.put(Integer.valueOf(Item.hoeSteel.shiftedIndex), new Tuple(Integer.valueOf(4), Integer.valueOf(6)));
    590            blacksmithSellingList.put(Integer.valueOf(Item.hoeDiamond.shiftedIndex), new Tuple(Integer.valueOf(7), Integer.valueOf(8)));
    591            blacksmithSellingList.put(Integer.valueOf(Item.bootsSteel.shiftedIndex), new Tuple(Integer.valueOf(4), Integer.valueOf(6)));
    592            blacksmithSellingList.put(Integer.valueOf(Item.bootsDiamond.shiftedIndex), new Tuple(Integer.valueOf(7), Integer.valueOf(8)));
    593            blacksmithSellingList.put(Integer.valueOf(Item.helmetSteel.shiftedIndex), new Tuple(Integer.valueOf(4), Integer.valueOf(6)));
    594            blacksmithSellingList.put(Integer.valueOf(Item.helmetDiamond.shiftedIndex), new Tuple(Integer.valueOf(7), Integer.valueOf(8)));
    595            blacksmithSellingList.put(Integer.valueOf(Item.plateSteel.shiftedIndex), new Tuple(Integer.valueOf(10), Integer.valueOf(14)));
    596            blacksmithSellingList.put(Integer.valueOf(Item.plateDiamond.shiftedIndex), new Tuple(Integer.valueOf(16), Integer.valueOf(19)));
    597            blacksmithSellingList.put(Integer.valueOf(Item.legsSteel.shiftedIndex), new Tuple(Integer.valueOf(8), Integer.valueOf(10)));
    598            blacksmithSellingList.put(Integer.valueOf(Item.legsDiamond.shiftedIndex), new Tuple(Integer.valueOf(11), Integer.valueOf(14)));
    599            blacksmithSellingList.put(Integer.valueOf(Item.bootsChain.shiftedIndex), new Tuple(Integer.valueOf(5), Integer.valueOf(7)));
    600            blacksmithSellingList.put(Integer.valueOf(Item.helmetChain.shiftedIndex), new Tuple(Integer.valueOf(5), Integer.valueOf(7)));
    601            blacksmithSellingList.put(Integer.valueOf(Item.plateChain.shiftedIndex), new Tuple(Integer.valueOf(11), Integer.valueOf(15)));
    602            blacksmithSellingList.put(Integer.valueOf(Item.legsChain.shiftedIndex), new Tuple(Integer.valueOf(9), Integer.valueOf(11)));
    603            blacksmithSellingList.put(Integer.valueOf(Item.bread.shiftedIndex), new Tuple(Integer.valueOf(-4), Integer.valueOf(-2)));
    604            blacksmithSellingList.put(Integer.valueOf(Item.melon.shiftedIndex), new Tuple(Integer.valueOf(-8), Integer.valueOf(-4)));
    605            blacksmithSellingList.put(Integer.valueOf(Item.appleRed.shiftedIndex), new Tuple(Integer.valueOf(-8), Integer.valueOf(-4)));
    606            blacksmithSellingList.put(Integer.valueOf(Item.cookie.shiftedIndex), new Tuple(Integer.valueOf(-10), Integer.valueOf(-7)));
    607            blacksmithSellingList.put(Integer.valueOf(Block.glass.blockID), new Tuple(Integer.valueOf(-5), Integer.valueOf(-3)));
    608            blacksmithSellingList.put(Integer.valueOf(Block.bookShelf.blockID), new Tuple(Integer.valueOf(3), Integer.valueOf(4)));
    609            blacksmithSellingList.put(Integer.valueOf(Item.plateLeather.shiftedIndex), new Tuple(Integer.valueOf(4), Integer.valueOf(5)));
    610            blacksmithSellingList.put(Integer.valueOf(Item.bootsLeather.shiftedIndex), new Tuple(Integer.valueOf(2), Integer.valueOf(4)));
    611            blacksmithSellingList.put(Integer.valueOf(Item.helmetLeather.shiftedIndex), new Tuple(Integer.valueOf(2), Integer.valueOf(4)));
    612            blacksmithSellingList.put(Integer.valueOf(Item.legsLeather.shiftedIndex), new Tuple(Integer.valueOf(2), Integer.valueOf(4)));
    613            blacksmithSellingList.put(Integer.valueOf(Item.saddle.shiftedIndex), new Tuple(Integer.valueOf(6), Integer.valueOf(8)));
    614            blacksmithSellingList.put(Integer.valueOf(Item.expBottle.shiftedIndex), new Tuple(Integer.valueOf(-4), Integer.valueOf(-1)));
    615            blacksmithSellingList.put(Integer.valueOf(Item.redstone.shiftedIndex), new Tuple(Integer.valueOf(-4), Integer.valueOf(-1)));
    616            blacksmithSellingList.put(Integer.valueOf(Item.compass.shiftedIndex), new Tuple(Integer.valueOf(10), Integer.valueOf(12)));
    617            blacksmithSellingList.put(Integer.valueOf(Item.pocketSundial.shiftedIndex), new Tuple(Integer.valueOf(10), Integer.valueOf(12)));
    618            blacksmithSellingList.put(Integer.valueOf(Block.glowStone.blockID), new Tuple(Integer.valueOf(-3), Integer.valueOf(-1)));
    619            blacksmithSellingList.put(Integer.valueOf(Item.porkCooked.shiftedIndex), new Tuple(Integer.valueOf(-7), Integer.valueOf(-5)));
    620            blacksmithSellingList.put(Integer.valueOf(Item.beefCooked.shiftedIndex), new Tuple(Integer.valueOf(-7), Integer.valueOf(-5)));
    621            blacksmithSellingList.put(Integer.valueOf(Item.chickenCooked.shiftedIndex), new Tuple(Integer.valueOf(-8), Integer.valueOf(-6)));
    622            blacksmithSellingList.put(Integer.valueOf(Item.eyeOfEnder.shiftedIndex), new Tuple(Integer.valueOf(7), Integer.valueOf(11)));
    623            blacksmithSellingList.put(Integer.valueOf(Item.arrow.shiftedIndex), new Tuple(Integer.valueOf(-5), Integer.valueOf(-19)));
    624        }
    625    }