Display stored matter in network

This commit is contained in:
DBotThePony 2021-08-23 18:36:55 +07:00
parent 4f2fede296
commit 14f7115639
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 18 additions and 1 deletions
src/main/java/ru/dbotthepony/mc/otm

View File

@ -9,12 +9,15 @@ import ru.dbotthepony.mc.otm.capability.IMatterHandler;
import ru.dbotthepony.mc.otm.menu.slot.MatterContainerInputSlot;
import ru.dbotthepony.mc.otm.menu.widget.MatterLevelWidget;
import java.math.BigDecimal;
public class MatterCapacitorBankMenu extends MatteryMenu {
public MatterCapacitorBankMenu(int p_38852_, Inventory inventory) {
this(p_38852_, inventory, null);
}
public MatterLevelWidget matter_widget;
public MatterLevelWidget total_matter_widget;
public MatterContainerInputSlot[] container_slots = new MatterContainerInputSlot[2 * 6];
@ -23,8 +26,22 @@ public class MatterCapacitorBankMenu extends MatteryMenu {
if (tile == null) {
matter_widget = new MatterLevelWidget(this, 14, 20);
total_matter_widget = new MatterLevelWidget(this, 14, 20);
} else {
matter_widget = new MatterLevelWidget(this, 14, 20, tile.matter);
total_matter_widget = new MatterLevelWidget(this, 14, 20, () -> {
if (tile.getMatterGrid() != null) {
return tile.getMatterGrid().getStored();
}
return BigDecimal.ZERO;
}, () -> {
if (tile.getMatterGrid() != null) {
return tile.getMatterGrid().getCapacity();
}
return BigDecimal.ZERO;
});
}
Container container = tile != null ? tile.matter_container : new SimpleContainer(2 * 6);

View File

@ -17,7 +17,7 @@ public class MatterCapacitorBankScreen extends MatteryScreen<MatterCapacitorBank
@Override
public List<GaugeWidget> getGauges() {
return List.of(menu.matter_widget);
return List.of(menu.matter_widget, menu.total_matter_widget);
}
@Override