Added option to initialize generators without storage properties

This commit is contained in:
Anuken
2019-10-12 13:10:33 -04:00
parent d9f98323c7
commit 01e3bd703e
@@ -33,12 +33,21 @@ public class ItemLiquidGenerator extends PowerGenerator{
protected Color heatColor = Color.valueOf("ff9b59"); protected Color heatColor = Color.valueOf("ff9b59");
protected TextureRegion topRegion, liquidRegion; protected TextureRegion topRegion, liquidRegion;
protected boolean randomlyExplode = true; protected boolean randomlyExplode = true;
protected boolean defaults = false;
public ItemLiquidGenerator(boolean hasItems, boolean hasLiquids, String name){ public ItemLiquidGenerator(boolean hasItems, boolean hasLiquids, String name){
super(name); super(name);
this.hasItems = hasItems; this.hasItems = hasItems;
this.hasLiquids = hasLiquids; this.hasLiquids = hasLiquids;
setDefaults();
}
public ItemLiquidGenerator(String name){
super(name);
}
protected void setDefaults(){
if(hasItems){ if(hasItems){
consumes.add(new ConsumeItemFilter(item -> getItemEfficiency(item) >= minItemEfficiency)).update(false).optional(true, false); consumes.add(new ConsumeItemFilter(item -> getItemEfficiency(item) >= minItemEfficiency)).update(false).optional(true, false);
} }
@@ -46,10 +55,16 @@ public class ItemLiquidGenerator extends PowerGenerator{
if(hasLiquids){ if(hasLiquids){
consumes.add(new ConsumeLiquidFilter(liquid -> getLiquidEfficiency(liquid) >= minLiquidEfficiency, maxLiquidGenerate)).update(false).optional(true, false); consumes.add(new ConsumeLiquidFilter(liquid -> getLiquidEfficiency(liquid) >= minLiquidEfficiency, maxLiquidGenerate)).update(false).optional(true, false);
} }
defaults = true;
} }
public ItemLiquidGenerator(String name){ @Override
super(name); public void init(){
if(!defaults){
setDefaults();
}
super.init();
} }
@Override @Override