Refactoring / Launch pad tweaks

This commit is contained in:
Anuken
2020-05-14 22:00:04 -04:00
parent 3fd677b3e6
commit a4987f864f
31 changed files with 761 additions and 679 deletions

View File

@@ -51,14 +51,14 @@ public class ItemModule extends BlockModule{
boolean updateFlow = flowTimer.get(30);
for(int i = 0; i < items.length; i++){
flow[i].addValue(cacheSums[i]);
flow[i].add(cacheSums[i]);
if(cacheSums[i] > 0){
cacheBits.set(i);
}
cacheSums[i] = 0;
if(updateFlow){
displayFlow[i] = flow[i].hasEnoughData() ? flow[i].getMean() : -1;
displayFlow[i] = flow[i].hasEnoughData() ? flow[i].mean() : -1;
}
}
}else{
@@ -267,7 +267,7 @@ public class ItemModule extends BlockModule{
}
public interface ItemConsumer{
void accept(Item item, float amount);
void accept(Item item, int amount);
}
public interface ItemCalculator{

View File

@@ -26,10 +26,10 @@ public class LiquidModule extends BlockModule{
smoothLiquid = Mathf.lerpDelta(smoothLiquid, currentAmount(), 0.1f);
if(showFlow){
if(flow == null) flow = new WindowedMean(windowSize);
flow.addValue(lastAdded);
flow.add(lastAdded);
lastAdded = 0;
if(currentFlowRate < 0 || flowTimer.get(updateInterval)){
currentFlowRate = flow.hasEnoughData() ? flow.getMean() : -1f;
currentFlowRate = flow.hasEnoughData() ? flow.mean() : -1f;
}
}else{
currentFlowRate = -1f;