mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-28 15:35:59 +00:00
Fix race condition on NEIConfig#bloodOrbs initialization (#10)
This commit is contained in:
1 parent
b4db1b05c8
commit
67062474fa
4 files changed
+52
-67
No files matched your search
@@ -1,6 +1,6 @@
|
||||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.bloodOrbs;
|
||||
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.getBloodOrbs;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
@@ -57,7 +57,7 @@ public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
|
||||
this.output = new PositionedStack(recipe.getResult(), 76, 25);
|
||||
this.lp = recipe.getAmountNeeded() * 100;
|
||||
this.orbs = new ArrayList<BloodOrbs>();
|
||||
for (Item orb : bloodOrbs) {
|
||||
for (Item orb : getBloodOrbs()) {
|
||||
if (((IBloodOrb) orb).getOrbLevel() >= recipe.getOrbLevel()) {
|
||||
orbs.add(new BloodOrbs(new ItemStack(orb)));
|
||||
}
|
||||
@@ -81,29 +81,6 @@ public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "alchemicalwizardry.alchemy";
|
||||
|
||||
Reference in new issue
Block a user