mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
* Update dependencies for dev environment to have latest versions * Fix depreated method usage for JEI * Add Deprecated annotation to methods overriding a deprecated method * Fix various Deprecated method calls * Slightly clean up gui code based on IntelliJ inspections * Remove some unused variables/calculations from the gui code * Remove some unused variables/calculations from the generator gui code * Create a bit of hierarchy for Gui's that keep track of TileEntities * Cleanup Gui Element having majority of variables as public * Cleanup some duplicate math * Store tile entity type in a less duplicated manner * Cleanup Gui ResourceLocation handling. Makes it easier to read the code * Switch adding to a method * Switch remaining GUI variables to private/protected * Partially cleanup Gui Filter code * Cleanup some of the Chemical Gui Code * Fix missing a few files in last commit * Improve handling of Tile Entities in GUIs
61 lines
2.1 KiB
Java
61 lines
2.1 KiB
Java
package mekanism.client.gui.element;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import mekanism.client.gui.IGuiWrapper;
|
|
import mekanism.common.config.MekanismConfig.general;
|
|
import mekanism.common.util.LangUtils;
|
|
import mekanism.common.util.MekanismUtils;
|
|
import mekanism.common.util.MekanismUtils.ResourceType;
|
|
import mekanism.common.util.UnitDisplayUtils.TempType;
|
|
import net.minecraft.util.ResourceLocation;
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
public class GuiHeatInfo extends GuiElement {
|
|
|
|
private final IInfoHandler infoHandler;
|
|
|
|
public GuiHeatInfo(IInfoHandler handler, IGuiWrapper gui, ResourceLocation def) {
|
|
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiHeatInfo.png"), gui, def);
|
|
infoHandler = handler;
|
|
}
|
|
|
|
@Override
|
|
public Rectangle4i getBounds(int guiWidth, int guiHeight) {
|
|
return new Rectangle4i(guiWidth - 26, guiHeight + 138, 26, 26);
|
|
}
|
|
|
|
@Override
|
|
protected boolean inBounds(int xAxis, int yAxis) {
|
|
return xAxis >= -21 && xAxis <= -3 && yAxis >= 116 && yAxis <= 134;
|
|
}
|
|
|
|
@Override
|
|
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight) {
|
|
mc.renderEngine.bindTexture(RESOURCE);
|
|
guiObj.drawTexturedRect(guiWidth - 26, guiHeight + 112, 0, 0, 26, 26);
|
|
mc.renderEngine.bindTexture(defaultLocation);
|
|
}
|
|
|
|
@Override
|
|
public void renderForeground(int xAxis, int yAxis) {
|
|
if (inBounds(xAxis, yAxis)) {
|
|
List<String> info = new ArrayList<>(infoHandler.getInfo());
|
|
info.add(LangUtils.localize("gui.unit") + ": " + general.tempUnit);
|
|
displayTooltips(info, xAxis, yAxis);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void preMouseClicked(int xAxis, int yAxis, int button) {
|
|
}
|
|
|
|
@Override
|
|
public void mouseClicked(int xAxis, int yAxis, int button) {
|
|
if (button == 0 && inBounds(xAxis, yAxis)) {
|
|
general.tempUnit = TempType.values()[(general.tempUnit.ordinal() + 1) % TempType.values().length];
|
|
}
|
|
}
|
|
} |