Skip to content

Commit

Permalink
Expose player equipment slots in generator guis (mekanism/Mekanism-Fe…
Browse files Browse the repository at this point in the history
  • Loading branch information
pupnewfster committed Aug 20, 2024
1 parent 213556b commit 0230ed9
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package mekanism.generators.client.gui;

import java.util.List;
import mekanism.client.SpecialColors;
import mekanism.client.gui.GuiMekanismTile;
import mekanism.client.gui.element.GuiInnerScreen;
import mekanism.client.gui.element.GuiSideHolder;
import mekanism.client.gui.element.bar.GuiFluidBar;
import mekanism.client.gui.element.bar.GuiVerticalPowerBar;
import mekanism.client.gui.element.tab.GuiEnergyTab;
Expand All @@ -27,6 +29,8 @@ public GuiBioGenerator(MekanismTileContainer<TileEntityBioGenerator> container,

@Override
protected void addGuiElements() {
//Add the side holder before the slots, as it holds a couple of the slots
addRenderableWidget(GuiSideHolder.create(this, -26, 6, 98, true, true, SpecialColors.TAB_ARMOR_SLOTS));
super.addGuiElements();
addRenderableWidget(new GuiInnerScreen(this, 48, 23, 80, 40, () -> List.of(
EnergyDisplay.of(tile.getEnergyContainer().getEnergy()).getTextComponent(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import java.util.List;
import mekanism.api.math.MathUtils;
import mekanism.client.SpecialColors;
import mekanism.client.gui.GuiMekanismTile;
import mekanism.client.gui.element.GuiSideHolder;
import mekanism.client.gui.element.bar.GuiVerticalPowerBar;
import mekanism.client.gui.element.gauge.GaugeType;
import mekanism.client.gui.element.gauge.GuiChemicalGauge;
Expand All @@ -26,6 +28,8 @@ public GuiGasGenerator(MekanismTileContainer<TileEntityGasGenerator> container,

@Override
protected void addGuiElements() {
//Add the side holder before the slots, as it holds a couple of the slots
addRenderableWidget(GuiSideHolder.create(this, -26, 6, 98, true, true, SpecialColors.TAB_ARMOR_SLOTS));
super.addGuiElements();
addRenderableWidget(new GuiEnergyTab(this, () -> {
long productionAmount = MathUtils.clampToLong(tile.getGenerationRate() * tile.getUsed() * tile.getMaxBurnTicks());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package mekanism.generators.client.gui;

import java.util.List;
import mekanism.client.SpecialColors;
import mekanism.client.gui.GuiMekanismTile;
import mekanism.client.gui.element.GuiSideHolder;
import mekanism.client.gui.element.bar.GuiVerticalPowerBar;
import mekanism.client.gui.element.gauge.GaugeType;
import mekanism.client.gui.element.gauge.GuiFluidGauge;
Expand All @@ -28,6 +30,8 @@ public GuiHeatGenerator(MekanismTileContainer<TileEntityHeatGenerator> container

@Override
protected void addGuiElements() {
//Add the side holder before the slots, as it holds a couple of the slots
addRenderableWidget(GuiSideHolder.create(this, -26, 6, 98, true, true, SpecialColors.TAB_ARMOR_SLOTS));
super.addGuiElements();
addRenderableWidget(new GuiEnergyTab(this, () -> List.of(GeneratorsLang.PRODUCING_AMOUNT.translate(EnergyDisplay.of(tile.getProductionRate())),
MekanismLang.MAX_OUTPUT.translate(EnergyDisplay.of(tile.getMaxOutput())))));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package mekanism.generators.client.gui;

import java.util.List;
import mekanism.client.SpecialColors;
import mekanism.client.gui.GuiMekanismTile;
import mekanism.client.gui.element.GuiInnerScreen;
import mekanism.client.gui.element.GuiSideHolder;
import mekanism.client.gui.element.bar.GuiVerticalPowerBar;
import mekanism.client.gui.element.tab.GuiEnergyTab;
import mekanism.common.MekanismLang;
Expand All @@ -27,6 +29,8 @@ public GuiSolarGenerator(MekanismTileContainer<TILE> container, Inventory inv, C

@Override
protected void addGuiElements() {
//Add the side holder before the slots, as it holds a couple of the slots
addRenderableWidget(GuiSideHolder.create(this, -26, 6, 98, true, true, SpecialColors.TAB_ARMOR_SLOTS));
super.addGuiElements();
addRenderableWidget(new GuiInnerScreen(this, 48, 23, 80, 40, () -> List.of(
EnergyDisplay.of(tile.getEnergyContainer()).getTextComponent(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import java.util.List;
import mekanism.api.text.EnumColor;
import mekanism.api.text.ILangEntry;
import mekanism.client.SpecialColors;
import mekanism.client.gui.GuiMekanismTile;
import mekanism.client.gui.element.GuiInnerScreen;
import mekanism.client.gui.element.GuiSideHolder;
import mekanism.client.gui.element.bar.GuiVerticalPowerBar;
import mekanism.client.gui.element.tab.GuiEnergyTab;
import mekanism.common.MekanismLang;
Expand All @@ -31,6 +33,8 @@ public GuiWindGenerator(MekanismTileContainer<TileEntityWindGenerator> container

@Override
protected void addGuiElements() {
//Add the side holder before the slots, as it holds a couple of the slots
addRenderableWidget(GuiSideHolder.create(this, -26, 6, 98, true, true, SpecialColors.TAB_ARMOR_SLOTS));
super.addGuiElements();
addRenderableWidget(new GuiInnerScreen(this, 48, 21, 80, 44, () -> {
List<Component> list = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ private GeneratorsContainerTypes() {

public static final ContainerTypeDeferredRegister CONTAINER_TYPES = new ContainerTypeDeferredRegister(MekanismGenerators.MODID);

public static final ContainerTypeRegistryObject<MekanismTileContainer<TileEntityBioGenerator>> BIO_GENERATOR = CONTAINER_TYPES.register(GeneratorsBlocks.BIO_GENERATOR, TileEntityBioGenerator.class);
public static final ContainerTypeRegistryObject<MekanismTileContainer<TileEntityGasGenerator>> GAS_BURNING_GENERATOR = CONTAINER_TYPES.register(GeneratorsBlocks.GAS_BURNING_GENERATOR, TileEntityGasGenerator.class);
public static final ContainerTypeRegistryObject<MekanismTileContainer<TileEntityHeatGenerator>> HEAT_GENERATOR = CONTAINER_TYPES.register(GeneratorsBlocks.HEAT_GENERATOR, TileEntityHeatGenerator.class);
public static final ContainerTypeRegistryObject<MekanismTileContainer<TileEntityBioGenerator>> BIO_GENERATOR = CONTAINER_TYPES.custom(GeneratorsBlocks.BIO_GENERATOR, TileEntityBioGenerator.class).armorSideBar(-20, 11, 0).build();
public static final ContainerTypeRegistryObject<MekanismTileContainer<TileEntityGasGenerator>> GAS_BURNING_GENERATOR = CONTAINER_TYPES.custom(GeneratorsBlocks.GAS_BURNING_GENERATOR, TileEntityGasGenerator.class).armorSideBar(-20, 11, 0).build();
public static final ContainerTypeRegistryObject<MekanismTileContainer<TileEntityHeatGenerator>> HEAT_GENERATOR = CONTAINER_TYPES.custom(GeneratorsBlocks.HEAT_GENERATOR, TileEntityHeatGenerator.class).armorSideBar(-20, 11, 0).build();
public static final ContainerTypeRegistryObject<MekanismTileContainer<TileEntityTurbineCasing>> INDUSTRIAL_TURBINE = CONTAINER_TYPES.register("industrial_turbine", TileEntityTurbineCasing.class);
public static final ContainerTypeRegistryObject<MekanismTileContainer<TileEntityFissionReactorCasing>> FISSION_REACTOR = CONTAINER_TYPES.custom("fission_reactor", TileEntityFissionReactorCasing.class).offset(10, 91).build();
public static final ContainerTypeRegistryObject<EmptyTileContainer<TileEntityFissionReactorCasing>> FISSION_REACTOR_STATS = CONTAINER_TYPES.registerEmpty("fission_reactor_stats", TileEntityFissionReactorCasing.class);
Expand All @@ -36,8 +36,8 @@ private GeneratorsContainerTypes() {
public static final ContainerTypeRegistryObject<EmptyTileContainer<TileEntityFusionReactorController>> FUSION_REACTOR_HEAT = CONTAINER_TYPES.registerEmpty("fusion_reactor_heat", TileEntityFusionReactorController.class);
public static final ContainerTypeRegistryObject<EmptyTileContainer<TileEntityFusionReactorLogicAdapter>> FUSION_REACTOR_LOGIC_ADAPTER = CONTAINER_TYPES.registerEmpty(GeneratorsBlocks.FUSION_REACTOR_LOGIC_ADAPTER, TileEntityFusionReactorLogicAdapter.class);
public static final ContainerTypeRegistryObject<EmptyTileContainer<TileEntityFusionReactorController>> FUSION_REACTOR_STATS = CONTAINER_TYPES.registerEmpty("fusion_reactor_stats", TileEntityFusionReactorController.class);
public static final ContainerTypeRegistryObject<MekanismTileContainer<TileEntitySolarGenerator>> SOLAR_GENERATOR = CONTAINER_TYPES.register("solar_generator", TileEntitySolarGenerator.class);
public static final ContainerTypeRegistryObject<MekanismTileContainer<TileEntityAdvancedSolarGenerator>> ADVANCED_SOLAR_GENERATOR = CONTAINER_TYPES.register("advanced_solar_generator", TileEntityAdvancedSolarGenerator.class);
public static final ContainerTypeRegistryObject<MekanismTileContainer<TileEntitySolarGenerator>> SOLAR_GENERATOR = CONTAINER_TYPES.custom("solar_generator", TileEntitySolarGenerator.class).armorSideBar(-20, 11, 0).build();
public static final ContainerTypeRegistryObject<MekanismTileContainer<TileEntityAdvancedSolarGenerator>> ADVANCED_SOLAR_GENERATOR = CONTAINER_TYPES.custom("advanced_solar_generator", TileEntityAdvancedSolarGenerator.class).armorSideBar(-20, 11, 0).build();
public static final ContainerTypeRegistryObject<EmptyTileContainer<TileEntityTurbineCasing>> TURBINE_STATS = CONTAINER_TYPES.registerEmpty("turbine_stats", TileEntityTurbineCasing.class);
public static final ContainerTypeRegistryObject<MekanismTileContainer<TileEntityWindGenerator>> WIND_GENERATOR = CONTAINER_TYPES.register(GeneratorsBlocks.WIND_GENERATOR, TileEntityWindGenerator.class);
public static final ContainerTypeRegistryObject<MekanismTileContainer<TileEntityWindGenerator>> WIND_GENERATOR = CONTAINER_TYPES.custom(GeneratorsBlocks.WIND_GENERATOR, TileEntityWindGenerator.class).armorSideBar(-20, 11, 0).build();
}

0 comments on commit 0230ed9

Please sign in to comment.