@Override protected ItemStackList getDemoTools(ItemStack[][] inputItems) { if(inputItems.length == 0) { return ItemStackList.create(); } ItemStackList demo = super.getDemoTools(inputItems); ItemStackList out = ItemStackList.create(); for(int i = 0; i < inputItems[0].length; i++) { if(inputItems[0][i].getItem() == TinkerTools.sharpeningKit) { Material material = TinkerTools.sharpeningKit.getMaterial(inputItems[0][i]); IModifier modifier = TinkerRegistry.getModifier("fortify" + material.getIdentifier()); if(modifier != null) { ItemStack stack = demo.get(i % demo.size()).copy(); modifier.apply(stack); out.add(stack); } } } return out; } }
/** * Create an ItemStackList from the given elements. */ public static ItemStackList of(ItemStack... element) { ItemStackList itemStackList = create(); itemStackList.addAll(Arrays.asList(element)); return itemStackList; }
/** * Create an ItemStackList from the given elements. */ public static ItemStackList of(Collection<ItemStack> boringList) { ItemStackList itemStackList = create(); itemStackList.addAll(boringList); return itemStackList; }
/** * Creates a new list with the same content. ItemStacks are shared between lists! * @param fixed If true the list will have fixed size */ public ItemStackList copy(boolean fixed) { ItemStackList copy = fixed ? withSize(this.size()) : create(); for(int i = 0; i < size(); i++) { copy.set(i, get(i)); } return copy; }
/** * Creates a new list with the same content, but Itemstacks are copied too, * meaning changes to the copy will not affect the itemstacks in the original list. * @param fixed If true the list will have fixed size */ public ItemStackList deepCopy(boolean fixed) { ItemStackList copy = fixed ? withSize(this.size()) : create(); for(int i = 0; i < size(); i++) { copy.set(i, get(i).copy()); } return copy; } }