mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-12 16:27:27 +00:00
Merge pull request #5 from DeForce/fix-nei-integration
Remove dependency on NEI item cache
This commit is contained in:
3 files changed
+42
-20
No files matched your search
+2
-2
@@ -1,6 +1,6 @@
|
||||
#Fri Sep 26 11:20:52 CDT 2014
|
||||
#Sat Jul 06 23:18:00 EEST 2019
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-all.zip
|
||||
@@ -83,12 +83,24 @@ public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public TemplateRecipeHandler newInstance() {
|
||||
for (ItemStack item : ItemList.items) {
|
||||
if (item != null && item.getItem() instanceof IBloodOrb) {
|
||||
bloodOrbs.add(item.getItem());
|
||||
// We need to populate available blood orbs,
|
||||
// but don't try to do it more than once
|
||||
if (bloodOrbs.isEmpty()) {
|
||||
for (ItemStack item : ItemList.items) {
|
||||
if (item != null && item.getItem() instanceof IBloodOrb) {
|
||||
bloodOrbs.add(item.getItem());
|
||||
}
|
||||
}
|
||||
if (bloodOrbs.isEmpty()) {
|
||||
// If there is NEI no cache - go to item registry
|
||||
for (Object anItemRegistry : Item.itemRegistry) {
|
||||
Item item = (Item) anItemRegistry;
|
||||
if (item != null && item instanceof IBloodOrb) {
|
||||
bloodOrbs.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.newInstance();
|
||||
}
|
||||
|
||||
|
||||
+24
-14
@@ -2,11 +2,12 @@ package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
@@ -48,12 +49,10 @@ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
|
||||
orbs.add(new ItemStack(item));
|
||||
}
|
||||
}
|
||||
if (orbs.isEmpty()) throw new RuntimeException("Invalid blood orb level " + o.toString() + " with recepie: " + Arrays.asList(items).toString() + " and existing orbs are: " + bloodOrbs);
|
||||
PositionedStack stack = new PositionedStack(orbs, 25 + x * 18, 6 + y * 18, false);
|
||||
stack.setMaxSize(1);
|
||||
ingredients.add(stack);
|
||||
}else if(o instanceof List)
|
||||
{
|
||||
} else if(o instanceof List) {
|
||||
PositionedStack stack = new PositionedStack(o, 25 + x * 18, 6 + y * 18, false);
|
||||
stack.setMaxSize(1);
|
||||
ingredients.add(stack);
|
||||
@@ -145,16 +144,27 @@ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
|
||||
return StatCollector.translateToLocal("bm.string.crafting.orb.shaped");
|
||||
|
||||
}
|
||||
@Override
|
||||
public TemplateRecipeHandler newInstance() {
|
||||
for (ItemStack item : ItemList.items) {
|
||||
if (item != null && item.getItem() instanceof IBloodOrb) {
|
||||
bloodOrbs.add(item.getItem());
|
||||
}
|
||||
}
|
||||
|
||||
return super.newInstance();
|
||||
|
||||
@Override
|
||||
public TemplateRecipeHandler newInstance() {
|
||||
// We need to populate available blood orbs,
|
||||
// but don't try to do it more than once
|
||||
if (bloodOrbs.isEmpty()) {
|
||||
for (ItemStack item : ItemList.items) {
|
||||
if (item != null && item.getItem() instanceof IBloodOrb) {
|
||||
bloodOrbs.add(item.getItem());
|
||||
}
|
||||
}
|
||||
if (bloodOrbs.isEmpty()) {
|
||||
// If there is NEI no cache - go to item registry
|
||||
for (Object anItemRegistry : Item.itemRegistry) {
|
||||
Item item = (Item) anItemRegistry;
|
||||
if (item != null && item instanceof IBloodOrb) {
|
||||
bloodOrbs.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.newInstance();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user