chore: minor refactor fixes

This commit is contained in:
Michael Hillcox 2021-03-01 19:58:15 +00:00
parent dcdac11e2b
commit 4919a5cbba
7 changed files with 16 additions and 8 deletions

View file

@ -21,7 +21,8 @@ public class TrialsButton extends TexturedButton {
private final boolean isTrials; private final boolean isTrials;
public TrialsButton(GuiBooklet gui) { public TrialsButton(GuiBooklet gui) {
super(GuiBooklet.RES_LOC_GADGETS, gui.getGuiLeft() + gui.getSizeX(), gui.getGuiTop() + 10, 0, 204, 52, 16, ); super(GuiBooklet.RES_LOC_GADGETS, gui.getGuiLeft() + gui.getSizeX(), gui.getGuiTop() + 10, 0, 204, 52, 16, btn -> {
});
this.isTrials = gui.areTrialsOpened(); this.isTrials = gui.areTrialsOpened();
this.active = !this.isTrials; this.active = !this.isTrials;
} }

View file

@ -96,19 +96,22 @@ public abstract class GuiBooklet extends GuiBookletBase {
if (this.hasPageLeftButton()) { if (this.hasPageLeftButton()) {
List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Previous Page", TextFormatting.ITALIC + "Or scroll up"); List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Previous Page", TextFormatting.ITALIC + "Or scroll up");
this.buttonLeft = new TexturedButton(RES_LOC_GADGETS, this.guiLeft - 12, this.guiTop + this.ySize - 8, 18, 54, 18, 10, hoverText, ); this.buttonLeft = new TexturedButton(RES_LOC_GADGETS, this.guiLeft - 12, this.guiTop + this.ySize - 8, 18, 54, 18, 10, hoverText, btn -> {
});
this.addButton(this.buttonLeft); this.addButton(this.buttonLeft);
} }
if (this.hasPageRightButton()) { if (this.hasPageRightButton()) {
List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Next Page", TextFormatting.ITALIC + "Or scroll down"); List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Next Page", TextFormatting.ITALIC + "Or scroll down");
this.buttonRight = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + this.xSize - 6, this.guiTop + this.ySize - 8, 0, 54, 18, 10, hoverText, ); this.buttonRight = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + this.xSize - 6, this.guiTop + this.ySize - 8, 0, 54, 18, 10, hoverText, btn -> {
});
this.addButton(this.buttonRight); this.addButton(this.buttonRight);
} }
if (this.hasBackButton()) { if (this.hasBackButton()) {
List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Go Back", TextFormatting.ITALIC + "Or right-click", TextFormatting.ITALIC.toString() + TextFormatting.GRAY + "Hold Shift for Main Page"); List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Go Back", TextFormatting.ITALIC + "Or right-click", TextFormatting.ITALIC.toString() + TextFormatting.GRAY + "Hold Shift for Main Page");
this.buttonBack = new TexturedButton(RES_LOC_GADGETS, this.guiLeft - 15, this.guiTop - 3, 36, 54, 18, 10, hoverText, ); this.buttonBack = new TexturedButton(RES_LOC_GADGETS, this.guiLeft - 15, this.guiTop - 3, 36, 54, 18, 10, hoverText, btn -> {
});
this.addButton(this.buttonBack); this.addButton(this.buttonBack);
} }

View file

@ -135,7 +135,8 @@ public class GuiMainPage extends GuiBooklet {
List<String> configText = new ArrayList<>(); List<String> configText = new ArrayList<>();
configText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".configButton.name")); configText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".configButton.name"));
configText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".configButton.desc", ActuallyAdditions.NAME).replaceAll("\\\\n", "\n"), 200)); configText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".configButton.desc", ActuallyAdditions.NAME).replaceAll("\\\\n", "\n"), 200));
this.configButton = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + 16, this.guiTop + this.ySize - 30, 188, 14, 16, 16, configText, ); this.configButton = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + 16, this.guiTop + this.ySize - 30, 188, 14, 16, 16, configText, btn -> {
});
this.addButton(this.configButton); this.addButton(this.configButton);
List<String> achievementText = new ArrayList<>(); List<String> achievementText = new ArrayList<>();

View file

@ -117,7 +117,8 @@ public class GuiPage extends GuiBooklet {
List<String> links = this.getWebLinks(); List<String> links = this.getWebLinks();
if (links != null && !links.isEmpty()) { if (links != null && !links.isEmpty()) {
this.buttonViewOnline = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + this.xSize - 24, this.guiTop + this.ySize - 25, 0, 172, 16, 16, Collections.singletonList(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".onlineButton.name")), ); this.buttonViewOnline = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + this.xSize - 24, this.guiTop + this.ySize - 25, 0, 172, 16, 16, Collections.singletonList(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".onlineButton.name")), btn -> {
});
this.addButton(this.buttonViewOnline); this.addButton(this.buttonViewOnline);
} }

View file

@ -76,7 +76,7 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
if (this.isDouble) { if (this.isDouble) {
this.buttonAutoSplit.setMessage(new StringTextComponent("S").mergeStyle(this.tileGrinder.isAutoSplit this.buttonAutoSplit.setMessage(new StringTextComponent("S").mergeStyle(this.tileGrinder.isAutoSplit
? TextFormatting.DARK_GREEN ? TextFormatting.DARK_GREEN
: TextFormatting.RED); : TextFormatting.RED));
} }
} }

View file

@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector; import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;

View file

@ -27,7 +27,8 @@ public abstract class RecipeWrapperWithButton implements IRecipeWr {
protected final TexturedButton theButton; protected final TexturedButton theButton;
public RecipeWrapperWithButton() { public RecipeWrapperWithButton() {
this.theButton = new TexturedButton(GuiBooklet.RES_LOC_GADGETS, this.getButtonX(), this.getButtonY(), 0, 0, 20, 20, ); this.theButton = new TexturedButton(GuiBooklet.RES_LOC_GADGETS, this.getButtonX(), this.getButtonY(), 0, 0, 20, 20, btn -> {
});
} }
public abstract int getButtonX(); public abstract int getButtonX();