@Override protected final void populateBuyingList() { this.tradingLevel++; if (this.buyingList == null) { this.buyingList = new MerchantRecipeList(); } ITradeList[] trades = this.getTrades(tradingLevel - 1); for (EntityVillager.ITradeList trade : trades) { trade.addMerchantRecipe(this, this.buyingList, this.rand); } } }
private void addDefaultEquipmentAndRecipies(int maxRecipesToAdd) { MerchantRecipeList rec = new MerchantRecipeList(); addRecipies(rec); if (buyingList == null) { buyingList = new MerchantRecipeList(); } for (int i = 0; i < maxRecipesToAdd && i < rec.size(); ++i) { buyingList.add(rec.get(i)); } }
@Override public void fromBytes(ByteBuf buf) { NBTTagCompound tags = ByteBufUtils.readTag(buf); career = tags.getInteger("h"); NBTTagCompound tradeTag = (NBTTagCompound) tags.getTag("trades"); trades = new MerchantRecipeList(); trades.readRecipiesFromTags(tradeTag); }
existingList = new MerchantRecipeList(); } else { existingList = stock; existingList = new MerchantRecipeList();
@Override public void readNBT(Capability<AnimalData> capability, AnimalData instance, EnumFacing side, NBTBase nbtBase) { NBTTagCompound nbt = (NBTTagCompound) nbtBase; instance.setMaximumTotalTrades(nbt.getInteger("MaximumTrades")); instance.setTotalTrades(nbt.getInteger("TotalTrades")); instance.setMerchantName(nbt.getString("MerchantName")); if (nbt.hasKey("Stock")) { NBTTagCompound stock = nbt.getCompoundTag("Stock"); MerchantRecipeList recipes = stock.isEmpty() ? new MerchantRecipeList() : new MerchantRecipeList(stock); instance.setStock(recipes); } } }
private void populateBuyingList() { if (this.careerId != 0 && this.careerLevel != 0) { ++this.careerLevel; } else { this.careerId = this.getProfessionForge().getRandomCareer(this.rand) + 1; this.careerLevel = 1; } if (this.buyingList == null) { this.buyingList = new MerchantRecipeList(); } int i = this.careerId - 1; int j = this.careerLevel - 1; java.util.List<EntityVillager.ITradeList> trades = this.getProfessionForge().getCareer(i).getTrades(j); if (trades != null) { for (EntityVillager.ITradeList entityvillager$itradelist : trades) { entityvillager$itradelist.addMerchantRecipe(this, this.buyingList, this.rand); } } }
@Override public void readEntityFromNBT(NBTTagCompound tag) { super.readEntityFromNBT(tag); this.setGrowthStage(tag.getInteger("GrowthStage")); this.growthTicks = tag.getInteger("GrowthTicks"); this.setJungleVariant(tag.getBoolean("Variant")); this.setHive(MyrmexWorldData.get(world).getHiveFromUUID(tag.getUniqueId("HiveUUID"))); this.careerId = tag.getInteger("Career"); this.careerLevel = tag.getInteger("CareerLevel"); if (tag.hasKey("Offers", 10)) { NBTTagCompound nbttagcompound = tag.getCompoundTag("Offers"); this.buyingList = new MerchantRecipeList(nbttagcompound); } this.wealth = tag.getInteger("Riches"); }