Store ItemStackWrappers instead of just ItemStacks (#844)
* Store ItemStackWrappers instead of just ItemStacks Allows proper usage of getRecipeForInput() * Refactoring and helper methods
This commit is contained in:
parent
46a35ac1fb
commit
c34bd48aa5
5 changed files with 51 additions and 15 deletions
src/main/java/WayofTime/bloodmagic/api
|
@ -8,6 +8,9 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class ItemStackWrapper
|
||||
|
@ -80,4 +83,22 @@ public class ItemStackWrapper
|
|||
result.setTagCompound(nbtTag);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<ItemStackWrapper> toWrapperList(List<ItemStack> itemStackList)
|
||||
{
|
||||
List<ItemStackWrapper> wrapperList = new ArrayList<ItemStackWrapper>();
|
||||
for (ItemStack stack : itemStackList)
|
||||
wrapperList.add(ItemStackWrapper.getHolder(stack));
|
||||
|
||||
return wrapperList;
|
||||
}
|
||||
|
||||
public static List<ItemStack> toStackList(List<ItemStackWrapper> wrapperList)
|
||||
{
|
||||
List<ItemStack> stackList = new ArrayList<ItemStack>();
|
||||
for (ItemStackWrapper wrapper : wrapperList)
|
||||
stackList.add(wrapper.toStack());
|
||||
|
||||
return stackList;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue