diff --git a/src/generated/resources/assets/ae2/lang/en_us.json b/src/generated/resources/assets/ae2/lang/en_us.json index 92533c56564..70c9b792844 100644 --- a/src/generated/resources/assets/ae2/lang/en_us.json +++ b/src/generated/resources/assets/ae2/lang/en_us.json @@ -344,6 +344,7 @@ "gui.ae2.Empty": "Empty", "gui.ae2.Encoded": "Encoded", "gui.ae2.EnergyDrain": "Passive Drain: %s", + "gui.ae2.EnergyGenerationCapacity": "Generation Capacity: %s", "gui.ae2.EnergyLevelEmitter": "ME Energy Level Emitter", "gui.ae2.Excluded": "Excluded", "gui.ae2.ExportBus": "ME Export Bus", diff --git a/src/main/java/appeng/api/networking/energy/IPassiveEnergyGenerator.java b/src/main/java/appeng/api/networking/energy/IPassiveEnergyGenerator.java index 4c0356f2a9b..2bf9e09085b 100644 --- a/src/main/java/appeng/api/networking/energy/IPassiveEnergyGenerator.java +++ b/src/main/java/appeng/api/networking/energy/IPassiveEnergyGenerator.java @@ -41,4 +41,10 @@ public interface IPassiveEnergyGenerator extends IGridNodeService { */ void setSuppressed(boolean suppressed); + /** + * @return Whether this generator is currently suppressed. + * @see #setSuppressed(boolean) + */ + boolean isSuppressed(); + } diff --git a/src/main/java/appeng/blockentity/networking/CrystalResonanceGeneratorBlockEntity.java b/src/main/java/appeng/blockentity/networking/CrystalResonanceGeneratorBlockEntity.java index 77a01a2f4b5..fe03b4d293a 100644 --- a/src/main/java/appeng/blockentity/networking/CrystalResonanceGeneratorBlockEntity.java +++ b/src/main/java/appeng/blockentity/networking/CrystalResonanceGeneratorBlockEntity.java @@ -50,6 +50,11 @@ public double getRate() { return AEConfig.instance().getCrystalResonanceGeneratorRate(); } + @Override + public boolean isSuppressed() { + return CrystalResonanceGeneratorBlockEntity.this.suppressed; + } + @Override public void setSuppressed(boolean suppressed) { if (suppressed != CrystalResonanceGeneratorBlockEntity.this.suppressed) { diff --git a/src/main/java/appeng/client/gui/me/networktool/NetworkStatusScreen.java b/src/main/java/appeng/client/gui/me/networktool/NetworkStatusScreen.java index ad1da142aec..31b44a5ba6b 100644 --- a/src/main/java/appeng/client/gui/me/networktool/NetworkStatusScreen.java +++ b/src/main/java/appeng/client/gui/me/networktool/NetworkStatusScreen.java @@ -123,6 +123,10 @@ public void drawFG(GuiGraphics guiGraphics, int offsetX, int offsetY, int mouseX tooltip.add(GuiText.EnergyDrain .text(Platform.formatPower(entry.getIdlePowerUsage(), true))); } + if (entry.getPowerGenerationCapacity() > 0) { + tooltip.add(GuiText.EnergyGenerationCapacity + .text(Platform.formatPower(entry.getPowerGenerationCapacity(), true))); + } } if (++x >= COLUMNS) { diff --git a/src/main/java/appeng/core/localization/GuiText.java b/src/main/java/appeng/core/localization/GuiText.java index 6d7323b6588..bfb7e3a4261 100644 --- a/src/main/java/appeng/core/localization/GuiText.java +++ b/src/main/java/appeng/core/localization/GuiText.java @@ -90,6 +90,7 @@ public enum GuiText implements LocalizationEnum { Empty("Empty"), Encoded("Encoded"), EnergyDrain("Passive Drain: %s"), + EnergyGenerationCapacity("Generation Capacity: %s"), EnergyLevelEmitter("ME Energy Level Emitter"), Excluded("Excluded"), ExportBus("ME Export Bus"), diff --git a/src/main/java/appeng/menu/me/networktool/MachineGroup.java b/src/main/java/appeng/menu/me/networktool/MachineGroup.java index df28f8f69f8..9694151eb9b 100644 --- a/src/main/java/appeng/menu/me/networktool/MachineGroup.java +++ b/src/main/java/appeng/menu/me/networktool/MachineGroup.java @@ -46,6 +46,11 @@ public class MachineGroup { */ private double idlePowerUsage; + /** + * The sum of power this group of machines can generate in AE/t. + */ + private double powerGenerationCapacity; + /** * The number of machines in this group. */ @@ -61,6 +66,7 @@ public class MachineGroup { static MachineGroup read(FriendlyByteBuf data) { MachineGroup entry = new MachineGroup(MachineGroupKey.fromPacket(data)); entry.idlePowerUsage = data.readDouble(); + entry.powerGenerationCapacity = data.readDouble(); entry.count = data.readVarInt(); return entry; } @@ -68,6 +74,7 @@ static MachineGroup read(FriendlyByteBuf data) { void write(FriendlyByteBuf data) { key.write(data); data.writeDouble(idlePowerUsage); + data.writeDouble(powerGenerationCapacity); data.writeVarInt(count); } @@ -87,6 +94,14 @@ void setIdlePowerUsage(double idlePowerUsage) { this.idlePowerUsage = idlePowerUsage; } + public double getPowerGenerationCapacity() { + return powerGenerationCapacity; + } + + public void setPowerGenerationCapacity(double powerGenerationCapacity) { + this.powerGenerationCapacity = powerGenerationCapacity; + } + public int getCount() { return count; } @@ -94,4 +109,5 @@ public int getCount() { void setCount(int count) { this.count = count; } + } diff --git a/src/main/java/appeng/menu/me/networktool/NetworkStatus.java b/src/main/java/appeng/menu/me/networktool/NetworkStatus.java index ad7e4b1dfc4..4331c8ac405 100644 --- a/src/main/java/appeng/menu/me/networktool/NetworkStatus.java +++ b/src/main/java/appeng/menu/me/networktool/NetworkStatus.java @@ -32,6 +32,8 @@ import appeng.api.networking.IGrid; import appeng.api.networking.IGridNode; import appeng.api.networking.energy.IEnergyService; +import appeng.api.networking.energy.IPassiveEnergyGenerator; +import appeng.blockentity.misc.VibrationChamberBlockEntity; import appeng.client.gui.me.networktool.NetworkStatusScreen; /** @@ -72,6 +74,17 @@ public static NetworkStatus fromGrid(IGrid grid) { group.setCount(group.getCount() + 1); group.setIdlePowerUsage(group.getIdlePowerUsage() + machine.getIdlePowerUsage()); + + var owner = machine.getOwner(); + var passiveEnergyGenerator = machine.getService(IPassiveEnergyGenerator.class); + if (passiveEnergyGenerator != null && !passiveEnergyGenerator.isSuppressed()) { + group.setPowerGenerationCapacity( + group.getPowerGenerationCapacity() + passiveEnergyGenerator.getRate()); + } + if (owner instanceof VibrationChamberBlockEntity vibrationChamberBlockEntity) { + group.setPowerGenerationCapacity( + group.getPowerGenerationCapacity() + vibrationChamberBlockEntity.getMaxEnergyRate()); + } } } } @@ -158,5 +171,4 @@ public void write(FriendlyByteBuf data) { machine.write(data); } } - }