This commit is contained in:
Anuken
2020-10-24 10:21:57 -04:00
parent 1ffa3f21f0
commit 646b022d38
10 changed files with 51 additions and 19 deletions
+10
View File
@@ -133,6 +133,8 @@ public class Block extends UnlockableContent{
public int unitCapModifier = 0;
/** Whether the block can be tapped and selected to configure. */
public boolean configurable;
/** If true, this block can be configured by logic. */
public boolean logicConfigurable = false;
/** Whether this block consumes touchDown events when tapped. */
public boolean consumesTap;
/** Whether to draw the glow of the liquid for this block, if it has one. */
@@ -674,6 +676,14 @@ public class Block extends UnlockableContent{
consumes.init();
if(!logicConfigurable){
configurations.each((key, val) -> {
if(UnlockableContent.class.isAssignableFrom(key)){
logicConfigurable = true;
}
});
}
if(!outputsPower && consumes.hasPower() && consumes.getPower().buffered){
throw new IllegalArgumentException("Consumer using buffered power: " + name);
}
@@ -33,8 +33,6 @@ public class UnitFactory extends UnitBlock{
hasPower = true;
hasItems = true;
solid = true;
//flags = EnumSet.of(BlockFlag.producer, BlockFlag.unitModifier);
//unitCapModifier = 2;
configurable = true;
outputsPayload = true;
rotate = true;
@@ -44,6 +42,11 @@ public class UnitFactory extends UnitBlock{
tile.progress = 0;
});
config(UnitType.class, (UnitFactoryBuild tile, UnitType val) -> {
tile.currentPlan = plans.indexOf(p -> p.unit == val);
tile.progress = 0;
});
consumes.add(new ConsumeItemDynamic((UnitFactoryBuild e) -> e.currentPlan != -1 ? plans.get(e.currentPlan).requirements : ItemStack.empty));
}