Fixed #3706
This commit is contained in:
@@ -109,6 +109,8 @@ public class UnitType extends UnlockableContent{
|
||||
occlusionRegion, jointRegion, footRegion, legBaseRegion, baseJointRegion, outlineRegion;
|
||||
public TextureRegion[] wreckRegions;
|
||||
|
||||
protected @Nullable ItemStack[] cachedRequirements;
|
||||
|
||||
public UnitType(String name){
|
||||
super(name);
|
||||
|
||||
@@ -193,6 +195,10 @@ public class UnitType extends UnlockableContent{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(ItemStack stack : researchRequirements()){
|
||||
cons.get(stack.item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -357,6 +363,10 @@ public class UnitType extends UnlockableContent{
|
||||
|
||||
@Override
|
||||
public ItemStack[] researchRequirements(){
|
||||
if(cachedRequirements != null){
|
||||
return cachedRequirements;
|
||||
}
|
||||
|
||||
ItemStack[] stacks = null;
|
||||
|
||||
//calculate costs based on reconstructors or factories found
|
||||
@@ -377,6 +387,8 @@ public class UnitType extends UnlockableContent{
|
||||
out[i] = new ItemStack(stacks[i].item, UI.roundAmount((int)(Math.pow(stacks[i].amount, 1.1) * 50)));
|
||||
}
|
||||
|
||||
cachedRequirements = out;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user