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