Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
added last eu info to combustion engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Aug 20, 2023
1 parent 47d4e42 commit c6979cb
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package muramasa.gregtech.tile.multi;

import muramasa.antimatter.capability.machine.MachineRecipeHandler;
import muramasa.antimatter.gui.GuiInstance;
import muramasa.antimatter.gui.IGuiElement;
import muramasa.antimatter.gui.widget.InfoRenderWidget;
import muramasa.antimatter.gui.widget.WidgetSupplier;
import muramasa.antimatter.integration.jeirei.renderer.IInfoRenderer;
import muramasa.antimatter.machine.types.Machine;
import muramasa.antimatter.tile.multi.TileEntityMultiMachine;
import net.minecraft.core.BlockPos;
Expand All @@ -10,6 +15,7 @@

import java.util.List;

import static muramasa.antimatter.gui.ICanSyncData.SyncDirection.SERVER_TO_CLIENT;
import static muramasa.gregtech.data.Materials.Lubricant;
import static muramasa.gregtech.data.Materials.Oxygen;

Expand Down Expand Up @@ -71,4 +77,31 @@ public void deserialize(CompoundTag nbt) {
}
});
}

public static class CombustionEngineWidget extends InfoRenderWidget.MultiRenderWidget {

public long currentConsumption = 0;
public long lastEU = 0;
public long recommendedConsumption = 0;

protected CombustionEngineWidget(GuiInstance gui, IGuiElement parent, IInfoRenderer<MultiRenderWidget> renderer) {
super(gui, parent, renderer);
}

@Override
public void init() {
super.init();
TileEntityCombustionEngine turbine = (TileEntityCombustionEngine) gui.handler;
gui.syncLong(() -> turbine.lastEu, i -> this.lastEU = i, SERVER_TO_CLIENT);
}

public static WidgetSupplier build() {
return builder((a, b) -> new CombustionEngineWidget(a, b, (IInfoRenderer<MultiRenderWidget>) a.handler));
}

@Override
public boolean drawActiveInfo() {
return false;
}
}
}

0 comments on commit c6979cb

Please sign in to comment.