-
Notifications
You must be signed in to change notification settings - Fork 214
Recycling Recipes #292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recycling Recipes #292
Changes from all commits
e8af071
8e4b9c5
e2d1801
5772700
75d71a0
8403747
084676c
fb4cb37
01462f2
b69e6f6
a741bff
2cfd910
9f7c02d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -190,7 +190,14 @@ public static MaterialStack getMaterial(ItemStack itemStack) { | |
| } | ||
| } | ||
| ItemMaterialInfo info = materialUnificationInfo.get(simpleItemStack); | ||
| return info == null ? null : info.material.copy(); | ||
| return info == null ? null : info.getMaterial().copy(); | ||
| } | ||
|
|
||
| @Nullable | ||
| public static ItemMaterialInfo getMaterialInfo(ItemStack itemStack) { | ||
| if (itemStack.isEmpty()) return null; | ||
| ItemAndMetadata simpleItemStack = new ItemAndMetadata(itemStack); | ||
| return materialUnificationInfo.get(simpleItemStack); | ||
| } | ||
|
|
||
| @Nullable | ||
|
|
@@ -239,7 +246,8 @@ public static ItemStack get(OrePrefix orePrefix, Material material, int stackSiz | |
|
|
||
| public static ItemStack get(String oreDictName) { | ||
| List<ItemStack> itemStacks = oreDictNameStacks.get(oreDictName); | ||
| return itemStacks.size() > 0 ? itemStacks.get(0).copy() : ItemStack.EMPTY; | ||
| if (itemStacks == null || itemStacks.size() == 0) return ItemStack.EMPTY; | ||
| return itemStacks.get(0).copy(); | ||
| } | ||
|
|
||
| public static List<Entry<ItemStack, ItemMaterialInfo>> getAllItemInfos() { | ||
|
|
@@ -267,21 +275,40 @@ else if ((materialAmount * 9) >= M) | |
| return ItemStack.EMPTY; | ||
| } | ||
|
|
||
|
|
||
| public static ItemStack getDust(MaterialStack materialStack) { | ||
| return getDust(materialStack.material, materialStack.amount); | ||
| } | ||
|
|
||
| public static ItemStack getIngot(Material material, long materialAmount) { | ||
| if (!material.hasProperty(PropertyKey.INGOT) || materialAmount <= 0) | ||
| return ItemStack.EMPTY; | ||
| if (materialAmount % (M * 9) == 0) | ||
| return get(OrePrefix.block, material, (int) (materialAmount / (M * 9))); | ||
| if (materialAmount % M == 0 || materialAmount >= M * 16) | ||
| return get(OrePrefix.ingot, material, (int) (materialAmount / M)); | ||
| else if ((materialAmount * 9) >= M) | ||
| return get(OrePrefix.nugget, material, (int) ((materialAmount * 9) / M)); | ||
| return ItemStack.EMPTY; | ||
| } | ||
|
|
||
| public static ItemStack getIngot(MaterialStack materialStack) { | ||
| return getIngot(materialStack.material, materialStack.amount); | ||
| } | ||
|
|
||
| /** | ||
| * Returns an Ingot of the material if it exists. Otherwise it returns a Dust. | ||
| * Returns ItemStack.EMPTY if neither exist. | ||
| */ | ||
| public static ItemStack getIngotOrDust(Material material, long materialAmount) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needed to not return an |
||
| ItemStack ingotStack = getIngot(material, materialAmount); | ||
| if (ingotStack != ItemStack.EMPTY) return ingotStack; | ||
| return getDust(material, materialAmount); | ||
| } | ||
|
|
||
| public static ItemStack getIngotOrDust(MaterialStack materialStack) { | ||
| return getIngotOrDust(materialStack.material, materialStack.amount); | ||
| } | ||
|
Comment on lines
+308
to
+310
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you add this method, when anything that can call this method can automatically call the method's redirect, as it has access to the |
||
|
|
||
| synchronized private static <T> void addAndSort(List<T> list, T itemToAdd, Comparator<T> comparator) { | ||
| list.add(itemToAdd); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.