net.minecraft.entity.passive.EntityVillager.ITradeList Java Examples
The following examples show how to use
net.minecraft.entity.passive.EntityVillager.ITradeList.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VillagerTrades.java From BaseMetals with GNU Lesser General Public License v2.1 | 6 votes |
private static ITradeList[] makeTradePalette(ITradeList[]... list){ if(list.length == 1) return list[0]; int totalsize = 0; for(ITradeList[] e : list){ totalsize += e.length; } ITradeList[] concat = new ITradeList[totalsize]; int index = 0; int element = 0; while(index < totalsize){ System.arraycopy(list[element], 0, concat, index, list[element].length); index += list[element].length; element++; } return concat; }
Example #2
Source File: VillagerTrades.java From BaseMetals with GNU Lesser General Public License v2.1 | 5 votes |
private static ITradeList[] makePurchasePalette(int emeraldPrice, int stackSize, Item... items){ ITradeList[] trades = new ITradeList[items.length]; for(int i = 0; i < items.length; i++){ Item item = items[i]; trades[i] = new SimpleTrade( new ItemStack(net.minecraft.init.Items.EMERALD,emeraldPrice,0), fluctuation(emeraldPrice), (ItemStack)null, 0, new ItemStack(item,stackSize,0), 0); } return trades; }
Example #3
Source File: VillagerTrades.java From BaseMetals with GNU Lesser General Public License v2.1 | 5 votes |
private static ITradeList[] makeSalePalette(int emeraldValue, int stackSize, Item... items){ ITradeList[] trades = new ITradeList[items.length]; for(int i = 0; i < items.length; i++){ Item item = items[i]; trades[i] = new SimpleTrade( new ItemStack(item,stackSize,0), fluctuation(stackSize), (ItemStack)null, 0, new ItemStack(net.minecraft.init.Items.EMERALD,emeraldValue,0), 0); } return trades; }
Example #4
Source File: VillagerTrades.java From BaseMetals with GNU Lesser General Public License v2.1 | 2 votes |
/** * Creates an ITradeList instanec that randomly adds multiple trades at a time * @param tradeCount Number of trades to add to the merchant's trade menu * @param tradePalette The trades to randomly choose from */ public MultiTradeGenerator(int tradeCount, List<ITradeList> tradePalette){ this.numberOfTrades = Math.min(tradeCount,tradePalette.size()); trades = tradePalette.toArray(new ITradeList[tradePalette.size()]); }