From d25e2fdea369e14ac414e725b0cc50d1cb289dc9 Mon Sep 17 00:00:00 2001 From: Michael Hillcox Date: Sat, 27 Feb 2021 21:59:18 +0000 Subject: [PATCH] chore: gui & booklet porting --- .../mod/booklet/button/BookmarkButton.java | 19 +++--- .../mod/booklet/button/EntryButton.java | 11 ++-- .../mod/booklet/button/TrialsButton.java | 6 +- .../mod/booklet/chapter/BookletChapter.java | 12 ++-- .../booklet/chapter/BookletChapterTrials.java | 3 +- .../mod/booklet/entry/BookletEntry.java | 3 +- .../mod/booklet/gui/GuiBooklet.java | 61 +++++++++--------- .../mod/booklet/gui/GuiEntry.java | 18 +++--- .../mod/booklet/gui/GuiMainPage.java | 60 +++++++++--------- .../mod/booklet/gui/GuiPage.java | 32 +++++----- .../mod/booklet/misc/BookletUtils.java | 30 +++++---- .../mod/booklet/page/BookletPage.java | 22 +++---- .../mod/booklet/page/ItemDisplay.java | 21 ++++--- .../mod/booklet/page/PageCoffeeMachine.java | 23 +++---- .../mod/booklet/page/PageCrafting.java | 20 +++--- .../mod/booklet/page/PageCrusherRecipe.java | 16 ++--- .../mod/booklet/page/PageEmpowerer.java | 16 ++--- .../mod/booklet/page/PageFurnace.java | 20 +++--- .../mod/booklet/page/PageLinkButton.java | 16 ++--- .../mod/booklet/page/PagePicture.java | 22 +++---- .../mod/booklet/page/PageReconstructor.java | 22 ++++--- .../mod/booklet/page/PageTextOnly.java | 4 +- .../mod/booklet/page/PageTrials.java | 11 ++-- .../mod/inventory/gui/TexturedButton.java | 11 ++-- .../mod/inventory/slot/SlotFilter.java | 4 +- .../mod/items/InitItems.java | 1 + .../mod/items/metalists/TheMiscItems.java | 63 +++++++++---------- 27 files changed, 289 insertions(+), 258 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java index 238f7dcc6..089bc3685 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java @@ -10,6 +10,7 @@ package de.ellpeck.actuallyadditions.mod.booklet.button; +import com.mojang.blaze3d.platform.GlStateManager; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; @@ -20,19 +21,19 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.widget.button.Button; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.client.gui.GuiUtils; import java.util.ArrayList; import java.util.List; @OnlyIn(Dist.CLIENT) -public class BookmarkButton extends GuiButton { +public class BookmarkButton extends Button { private final GuiBooklet booklet; public IBookletPage assignedPage; @@ -44,7 +45,7 @@ public class BookmarkButton extends GuiButton { public void onPressed() { if (this.assignedPage != null) { - if (GuiScreen.isShiftKeyDown()) { + if (Screen.hasShiftDown()) { this.assignedPage = null; } else if (!(this.booklet instanceof GuiPage) || ((GuiPage) this.booklet).pages[0] != this.assignedPage) { GuiPage gui = BookletUtils.createPageGui(this.booklet.previousScreen, this.booklet, this.assignedPage); @@ -61,8 +62,8 @@ public class BookmarkButton extends GuiButton { public void drawButton(Minecraft minecraft, int x, int y, float f) { if (this.visible) { minecraft.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.hovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height; + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + this.isHovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height; int k = this.getHoverState(this.hovered); if (k == 0) { k = 1; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/EntryButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/EntryButton.java index 2253e62f4..28a32dba3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/EntryButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/EntryButton.java @@ -10,19 +10,20 @@ package de.ellpeck.actuallyadditions.mod.booklet.button; +import com.mojang.blaze3d.platform.GlStateManager; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.gui.widget.button.Button; import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + @OnlyIn(Dist.CLIENT) -public class EntryButton extends GuiButton { +public class EntryButton extends Button { private final GuiBookletBase gui; private final ItemStack stackToRender; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/TrialsButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/TrialsButton.java index 08b1e6400..8d6b7ff4f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/TrialsButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/TrialsButton.java @@ -23,7 +23,7 @@ public class TrialsButton extends TexturedButton { public TrialsButton(GuiBooklet gui) { super(GuiBooklet.RES_LOC_GADGETS, -152000, gui.getGuiLeft() + gui.getSizeX(), gui.getGuiTop() + 10, 0, 204, 52, 16); this.isTrials = gui.areTrialsOpened(); - this.enabled = !this.isTrials; + this.active = !this.isTrials; } @Override @@ -31,7 +31,7 @@ public class TrialsButton extends TexturedButton { super.drawButton(minecraft, x, y, f); if (this.visible) { - if (this.hovered || this.isTrials) { + if (this.isHovered || this.isTrials) { this.drawCenteredString(minecraft.fontRenderer, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialsButton.name"), this.x + (this.width - 8) / 2, this.y + (this.height - 8) / 2, 14737632); } } @@ -41,7 +41,7 @@ public class TrialsButton extends TexturedButton { protected int getHoverState(boolean mouseOver) { if (mouseOver || this.isTrials) { return 2; - } else if (!this.enabled) { + } else if (!this.active) { return 0; } else { return 1; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java index fa2fb0eab..406923cd8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java @@ -18,8 +18,8 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class BookletChapter implements IBookletChapter { @@ -39,7 +39,9 @@ public class BookletChapter implements IBookletChapter { this.identifier = identifier; this.entry = entry; this.displayStack = displayStack; - if (displayStack.getItem() instanceof IDisableableItem && ((IDisableableItem) displayStack.getItem()).isDisabled()) displayStack = ItemStack.EMPTY; + if (displayStack.getItem() instanceof IDisableableItem && ((IDisableableItem) displayStack.getItem()).isDisabled()) { + displayStack = ItemStack.EMPTY; + } this.priority = priority; this.color = TextFormatting.RESET; @@ -84,7 +86,9 @@ public class BookletChapter implements IBookletChapter { @Override public int getPageIndex(IBookletPage page) { for (int i = 0; i < this.pages.length; i++) { - if (this.pages[i] == page) { return i; } + if (this.pages[i] == page) { + return i; + } } return -1; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterTrials.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterTrials.java index 74c4028b4..6bcfc7bba 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterTrials.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterTrials.java @@ -19,7 +19,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class BookletChapterTrials extends BookletChapter { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java index 9467e37f4..c8504fa65 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java @@ -21,8 +21,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.relauncher.OnlyIn; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java index 34128ecd1..1b553a9a8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java @@ -10,14 +10,7 @@ package de.ellpeck.actuallyadditions.mod.booklet.gui; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - -import org.apache.commons.lang3.ArrayUtils; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; - +import com.mojang.blaze3d.platform.GlStateManager; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; @@ -30,14 +23,20 @@ import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.GuiTextField; -import net.minecraft.client.renderer.GlStateManager; +import net.java.games.input.Keyboard; +import net.java.games.input.Mouse; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.widget.TextFieldWidget; +import net.minecraft.client.gui.widget.button.Button; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import org.apache.commons.lang3.ArrayUtils; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; @OnlyIn(Dist.CLIENT) public abstract class GuiBooklet extends GuiBookletBase { @@ -46,24 +45,24 @@ public abstract class GuiBooklet extends GuiBookletBase { public static final ResourceLocation RES_LOC_GUI = AssetUtil.getBookletGuiLocation("gui_booklet"); public static final ResourceLocation RES_LOC_GADGETS = AssetUtil.getBookletGuiLocation("gui_booklet_gadgets"); protected final BookmarkButton[] bookmarkButtons = new BookmarkButton[12]; - public GuiScreen previousScreen; + public Screen previousScreen; public GuiBookletBase parentPage; - public GuiTextField searchField; + public TextFieldWidget searchField; protected int xSize; protected int ySize; protected int guiLeft; protected int guiTop; - private GuiButton buttonLeft; - private GuiButton buttonRight; - private GuiButton buttonBack; + private Button buttonLeft; + private Button buttonRight; + private Button buttonBack; - private GuiButton buttonTrials; + private Button buttonTrials; private float smallFontSize; private float mediumFontSize; private float largeFontSize; - public GuiBooklet(GuiScreen previousScreen, GuiBookletBase parentPage) { + public GuiBooklet(Screen previousScreen, GuiBookletBase parentPage) { this.previousScreen = previousScreen; this.parentPage = parentPage; @@ -85,8 +84,8 @@ public abstract class GuiBooklet extends GuiBookletBase { } @Override - public void initGui() { - super.initGui(); + public void init() { + super.init(); this.guiLeft = (this.width - this.xSize) / 2; this.guiTop = (this.height - this.ySize) / 2; @@ -98,23 +97,23 @@ public abstract class GuiBooklet extends GuiBookletBase { if (this.hasPageLeftButton()) { List hoverText = Arrays.asList(TextFormatting.GOLD + "Previous Page", TextFormatting.ITALIC + "Or scroll up"); this.buttonLeft = new TexturedButton(RES_LOC_GADGETS, -2000, this.guiLeft - 12, this.guiTop + this.ySize - 8, 18, 54, 18, 10, hoverText); - this.buttonList.add(this.buttonLeft); + this.addButton(this.buttonLeft); } if (this.hasPageRightButton()) { List hoverText = Arrays.asList(TextFormatting.GOLD + "Next Page", TextFormatting.ITALIC + "Or scroll down"); this.buttonRight = new TexturedButton(RES_LOC_GADGETS, -2001, this.guiLeft + this.xSize - 6, this.guiTop + this.ySize - 8, 0, 54, 18, 10, hoverText); - this.buttonList.add(this.buttonRight); + this.addButton(this.buttonRight); } if (this.hasBackButton()) { List 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, -2002, this.guiLeft - 15, this.guiTop - 3, 36, 54, 18, 10, hoverText); - this.buttonList.add(this.buttonBack); + this.addButton(this.buttonBack); } if (this.hasSearchBar()) { - this.searchField = new GuiTextField(-420, this.fontRenderer, this.guiLeft + this.xSize + 2, this.guiTop + this.ySize - 40 + 2, 64, 12); + this.searchField = new TextFieldWidget(-420, this.fontRenderer, this.guiLeft + this.xSize + 2, this.guiTop + this.ySize - 40 + 2, 64, 12); this.searchField.setMaxStringLength(50); this.searchField.setEnableBackgroundDrawing(false); } @@ -144,7 +143,9 @@ public abstract class GuiBooklet extends GuiBookletBase { //Don't cache the parent GUI, otherwise it opens again when you close the cached book! this.previousScreen = null; - if (this.mc.player == null) return; + if (this.mc.player == null) { + return; + } PlayerSave data = PlayerData.getDataFromPlayer(this.mc.player); data.lastOpenBooklet = this; @@ -296,7 +297,9 @@ public abstract class GuiBooklet extends GuiBookletBase { } public void onSearchBarChanged(String searchBarText) { - GuiBookletBase parent = !(this instanceof GuiEntry) ? this : this.parentPage; + GuiBookletBase parent = !(this instanceof GuiEntry) + ? this + : this.parentPage; this.mc.displayGuiScreen(new GuiEntry(this.previousScreen, parent, ActuallyAdditionsAPI.entryAllAndSearch, 0, searchBarText, true)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java index 6723b7e19..7348f0374 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java @@ -10,9 +10,6 @@ package de.ellpeck.actuallyadditions.mod.booklet.gui; -import java.io.IOException; -import java.util.List; - import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; @@ -21,11 +18,14 @@ import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton; import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials; import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.screen.Screen; import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.relauncher.OnlyIn; +import java.io.IOException; +import java.util.List; + @OnlyIn(Dist.CLIENT) public class GuiEntry extends GuiBooklet { @@ -37,7 +37,7 @@ public class GuiEntry extends GuiBooklet { private final String searchText; private final boolean focusSearch; - public GuiEntry(GuiScreen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, int entryPage, String search, boolean focusSearch) { + public GuiEntry(Screen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, int entryPage, String search, boolean focusSearch) { super(previousScreen, parentPage); this.entryPage = entryPage; this.entry = entry; @@ -47,13 +47,15 @@ public class GuiEntry extends GuiBooklet { if (!this.chapters.isEmpty()) { IBookletChapter lastChap = this.chapters.get(this.chapters.size() - 1); - this.pageAmount = lastChap == null ? 1 : calcEntryPage(this.entry, lastChap, this.searchText) + 1; + this.pageAmount = lastChap == null + ? 1 + : calcEntryPage(this.entry, lastChap, this.searchText) + 1; } else { this.pageAmount = 1; } } - public GuiEntry(GuiScreen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, IBookletChapter chapterForPageCalc, String search, boolean focusSearch) { + public GuiEntry(Screen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, IBookletChapter chapterForPageCalc, String search, boolean focusSearch) { this(previousScreen, parentPage, entry, calcEntryPage(entry, chapterForPageCalc, search), search, focusSearch); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java index 2c0f7380b..7e7c74cfd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java @@ -10,10 +10,6 @@ package de.ellpeck.actuallyadditions.mod.booklet.gui; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; @@ -26,24 +22,28 @@ import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.Util; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.widget.button.Button; import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; //TODO Fix achievement button @OnlyIn(Dist.CLIENT) public class GuiMainPage extends GuiBooklet { - private static final String[] QUOTES = new String[] { "Actually Additions, to me, is quite magical in a way.@Saphrym", "Actually quite cool. Lots of nice little additions.@Direwolf20", "Mod Dev quite rude and arrogant@Bubb1e0seven", "A whimsical breath of fresh air in a stuffy tech-mod world.@mezz", "User-friendly :3@TheMeeep", "A lot of stuff, some of it really good.@Narubion", "I like the bookmarks.@Vazkii", "It's got some stuff I guess.@Ellpeck", "Actually Additions should be included in every new modpack that includes any form of tech.@YasminEndusa", "A mod that basically lets you do what ever the heck you want.@Ristelle", "TINY TORCHES!! BABY TORCHES!! Somebody actually finally did it!!@Soaryn", "Balanced mod wich makes things different - in a good way.@garantiertnicht", "The mod everyone needs, but not everyone knows@Brewpl", "The in-game documentation is the best I’ve seen. I especially love the JEI integration. Even a derp like me can figure it out.@dannydjdk", "The second best mod I've ever used.@mmaas44", "The Fermenting Barrel is one of my favorite textures.@amadornes", "Smiley Clouds is the reason for fascism in 2016.@raoulvdberge", "The worms are an awesome idea!@greenking", "Can I use that mod in my pack?@Ibraheem", "Hello, love the mod.@SuntannedDuck2", "Quick! Have all the fun before they nerf it!@JuddMan03", "I have a feeling Actually Additions is also like Extra Utilities with Random things smashed together why is it...@lesslighter", "Leaf eater... munchdew... hummm@EiOs", "There is no such thing as canola seeds.@AlBoVa", "This mod is cancer, BRUTAL EXPENSIVE POWER usage..Just, cancer.@KoJo", "Spaghetti is spaghetti, and noodles are noodles.@robsonld04", "The Actually Additions name is actually true. It's actually great!@asiekierka", "Such a great mod@jsdeveloper", "That mod is kind of funny.@Anonymous", "Actually Additions is a lot of fun.@Anonymous", "Is Actually Additions still fugly?@Anonymous", "I like it, but it's so small.@Anonymous", "It has a couple of blocks I like, but overall it's just a mess.@Anonymous", "Direwolf's 1.10 playthrough is just him shilling Actually Additions@Anonymous", "We thought about sending the author a bunch of pizzas to his adress@Anonymous", "It's op as heck.@billofbong0", "Actually AdditionsってマイクラMODすごく良いのに日本人で遊んでる人あんまいないっぽい@stay_uk", "Actually Additions is OP. Not like my favorite combination of mods, Project E + Magic Crops + Draconic Evolution.@Anonymous", "To be perfectly honest, I never actually realized how much content Actually Additions has before.@Ellpeck", "I don't blame you, I actually downgraded to Actually Additions.@PvtSeaCow", "It is lonely because there is no device to fly items with the laser in the 1.7.10 version.@Google Translate", "始めまして。日本人です。このMODは本当に素晴らしい!ただ、1.7.10ヴァージョンだと、レーザーでアイテムを飛ばす装置がないので寂しいです。@Anonymous", "Some verses found in older translations, such as the KJV were actually additions made by later copyists.@Pat_Joel", "I can't place filters into Laser Relays, but the mod is very cool.@LP_Jakob", "Am I good enough to be an Actually Additions tool?@deanwhufc" }; + private static final String[] QUOTES = new String[]{"Actually Additions, to me, is quite magical in a way.@Saphrym", "Actually quite cool. Lots of nice little additions.@Direwolf20", "Mod Dev quite rude and arrogant@Bubb1e0seven", "A whimsical breath of fresh air in a stuffy tech-mod world.@mezz", "User-friendly :3@TheMeeep", "A lot of stuff, some of it really good.@Narubion", "I like the bookmarks.@Vazkii", "It's got some stuff I guess.@Ellpeck", "Actually Additions should be included in every new modpack that includes any form of tech.@YasminEndusa", "A mod that basically lets you do what ever the heck you want.@Ristelle", "TINY TORCHES!! BABY TORCHES!! Somebody actually finally did it!!@Soaryn", "Balanced mod wich makes things different - in a good way.@garantiertnicht", "The mod everyone needs, but not everyone knows@Brewpl", "The in-game documentation is the best I’ve seen. I especially love the JEI integration. Even a derp like me can figure it out.@dannydjdk", "The second best mod I've ever used.@mmaas44", "The Fermenting Barrel is one of my favorite textures.@amadornes", "Smiley Clouds is the reason for fascism in 2016.@raoulvdberge", "The worms are an awesome idea!@greenking", "Can I use that mod in my pack?@Ibraheem", "Hello, love the mod.@SuntannedDuck2", "Quick! Have all the fun before they nerf it!@JuddMan03", "I have a feeling Actually Additions is also like Extra Utilities with Random things smashed together why is it...@lesslighter", "Leaf eater... munchdew... hummm@EiOs", "There is no such thing as canola seeds.@AlBoVa", "This mod is cancer, BRUTAL EXPENSIVE POWER usage..Just, cancer.@KoJo", "Spaghetti is spaghetti, and noodles are noodles.@robsonld04", "The Actually Additions name is actually true. It's actually great!@asiekierka", "Such a great mod@jsdeveloper", "That mod is kind of funny.@Anonymous", "Actually Additions is a lot of fun.@Anonymous", "Is Actually Additions still fugly?@Anonymous", "I like it, but it's so small.@Anonymous", "It has a couple of blocks I like, but overall it's just a mess.@Anonymous", "Direwolf's 1.10 playthrough is just him shilling Actually Additions@Anonymous", "We thought about sending the author a bunch of pizzas to his adress@Anonymous", "It's op as heck.@billofbong0", "Actually AdditionsってマイクラMODすごく良いのに日本人で遊んでる人あんまいないっぽい@stay_uk", "Actually Additions is OP. Not like my favorite combination of mods, Project E + Magic Crops + Draconic Evolution.@Anonymous", "To be perfectly honest, I never actually realized how much content Actually Additions has before.@Ellpeck", "I don't blame you, I actually downgraded to Actually Additions.@PvtSeaCow", "It is lonely because there is no device to fly items with the laser in the 1.7.10 version.@Google Translate", "始めまして。日本人です。このMODは本当に素晴らしい!ただ、1.7.10ヴァージョンだと、レーザーでアイテムを飛ばす装置がないので寂しいです。@Anonymous", "Some verses found in older translations, such as the KJV were actually additions made by later copyists.@Pat_Joel", "I can't place filters into Laser Relays, but the mod is very cool.@LP_Jakob", "Am I good enough to be an Actually Additions tool?@deanwhufc"}; //private TexturedButton achievementButton; private TexturedButton configButton; - private GuiButton tutorialButton; + private Button tutorialButton; private boolean showTutorial; private String bookletName; @@ -52,7 +52,7 @@ public class GuiMainPage extends GuiBooklet { private List quote; private String quoteGuy; - public GuiMainPage(GuiScreen previousScreen) { + public GuiMainPage(Screen previousScreen) { super(previousScreen, null); } @@ -69,23 +69,23 @@ public class GuiMainPage extends GuiBooklet { } @Override - public void initGui() { - super.initGui(); + public void init() { + super.init(); int flavor = 1; - if (this.mc.world.rand.nextFloat() <= 0.1) { - flavor = MathHelper.getInt(this.mc.world.rand, 2, 7); + if (this.getMinecraft().world.rand.nextFloat() <= 0.1) { + flavor = MathHelper.nextInt(this.getMinecraft().world.rand, 2, 7); } this.bookletName = "info." + ActuallyAdditions.MODID + ".booklet.manualName.1." + flavor; - String usedQuote = QUOTES[this.mc.world.rand.nextInt(QUOTES.length)]; + String usedQuote = QUOTES[this.getMinecraft().world.rand.nextInt(QUOTES.length)]; String[] quoteSplit = usedQuote.split("@"); if (quoteSplit.length == 2) { - this.quote = this.fontRenderer.listFormattedStringToWidth(quoteSplit[0], 120); + this.quote = this.font.listFormattedStringToWidth(quoteSplit[0], 120); this.quoteGuy = quoteSplit[1]; } - String playerName = this.mc.player.getName(); + String playerName = this.getMinecraft().player.getName().getString(); if (playerName.equalsIgnoreCase("dqmhose")) { this.bookletEdition = "Pants Edition"; } else if (playerName.equalsIgnoreCase("TwoOfEight") || playerName.equalsIgnoreCase("BootyToast")) { @@ -107,7 +107,7 @@ public class GuiMainPage extends GuiBooklet { } else if (playerName.equalsIgnoreCase("ellpeck") || playerName.equalsIgnoreCase("profprospector")) { String[] colors = new String[15]; for (int i = 0; i < colors.length; i++) { - colors[i] = TextFormatting.fromColorIndex(this.mc.world.rand.nextInt(15)).toString() + TextFormatting.ITALIC; + colors[i] = TextFormatting.fromColorIndex(this.getMinecraft().world.rand.nextInt(15)).toString() + TextFormatting.ITALIC; } this.bookletEdition = String.format("%sC%so%sl%so%sr%sf%su%sl %sE%sd%si%st%si%so%sn", (Object[]) colors); } else if (playerName.equalsIgnoreCase("oitsjustjose")) { @@ -134,17 +134,17 @@ public class GuiMainPage extends GuiBooklet { List configText = new ArrayList<>(); configText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".configButton.name")); - configText.addAll(this.fontRenderer.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, -388, this.guiLeft + 16, this.guiTop + this.ySize - 30, 188, 14, 16, 16, configText); this.buttonList.add(this.configButton); List achievementText = new ArrayList<>(); achievementText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".achievementButton.name")); - achievementText.addAll(this.fontRenderer.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".achievementButton.desc", ActuallyAdditions.NAME), 200)); + achievementText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".achievementButton.desc", ActuallyAdditions.NAME), 200)); //this.achievementButton = new TexturedButton(RES_LOC_GADGETS, -389, this.guiLeft+36, this.guiTop+this.ySize-30, 204, 14, 16, 16, achievementText); //this.buttonList.add(this.achievementButton); - PlayerSave data = PlayerData.getDataFromPlayer(this.mc.player); + PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player); if (!data.didBookTutorial) { this.showTutorial = true; @@ -173,17 +173,17 @@ public class GuiMainPage extends GuiBooklet { if (displayed.size() > button.id) { IBookletEntry entry = displayed.get(button.id); if (entry != null) { - this.mc.displayGuiScreen(new GuiEntry(this.previousScreen, this, entry, 0, "", false)); + this.getMinecraft().displayGuiScreen(new GuiEntry(this.previousScreen, this, entry, 0, "", false)); } } } /*else if(button == this.achievementButton){ - GuiScreen achievements = new GuiAAAchievements(this, this.mc.player.getStatFileWriter()); - this.mc.displayGuiScreen(achievements); + GuiScreen achievements = new GuiAAAchievements(this, this.getMinecraft().player.getStatFileWriter()); + this.getMinecraft().displayGuiScreen(achievements); }*/ else if (button == this.configButton) { GuiScreen config = new GuiConfiguration(this); - this.mc.displayGuiScreen(config); + this.getMinecraft().displayGuiScreen(config); } else if (this.showTutorial && button == this.tutorialButton) { if (this.hasBookmarkButtons()) { if (!isShiftKeyDown()) { @@ -197,7 +197,7 @@ public class GuiMainPage extends GuiBooklet { this.configButton.visible = true; //this.achievementButton.visible = true; - PlayerSave data = PlayerData.getDataFromPlayer(this.mc.player); + PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player); data.didBookTutorial = true; PacketHandlerHelper.sendPlayerDataToServer(false, 1); } @@ -211,12 +211,12 @@ public class GuiMainPage extends GuiBooklet { super.drawScreenPre(mouseX, mouseY, partialTicks); String strg = TextFormatting.DARK_GREEN + StringUtil.localize(this.bookletName); - this.fontRenderer.drawString(strg, this.guiLeft + 72 - this.fontRenderer.getStringWidth(strg) / 2 - 3, this.guiTop + 19, 0); + this.font.drawString(strg, this.guiLeft + 72 - this.font.getStringWidth(strg) / 2 - 3, this.guiTop + 19, 0); strg = TextFormatting.DARK_GREEN + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.manualName.2"); - this.fontRenderer.drawString(strg, this.guiLeft + 72 - this.fontRenderer.getStringWidth(strg) / 2 - 3, this.guiTop + 19 + this.fontRenderer.FONT_HEIGHT, 0); + this.font.drawString(strg, this.guiLeft + 72 - this.font.getStringWidth(strg) / 2 - 3, this.guiTop + 19 + this.font.FONT_HEIGHT, 0); strg = TextFormatting.GOLD + TextFormatting.ITALIC.toString() + this.bookletEdition; - this.fontRenderer.drawString(strg, this.guiLeft + 72 - this.fontRenderer.getStringWidth(strg) / 2 - 3, this.guiTop + 40, 0); + this.font.drawString(strg, this.guiLeft + 72 - this.font.getStringWidth(strg) / 2 - 3, this.guiTop + 40, 0); if (this.showTutorial) { String text = TextFormatting.BLUE + "It looks like this is the first time you are using this manual. \nIf you click the button below, some useful bookmarks will be stored at the bottom of the GUI. You should definitely check them out to get started with " + ActuallyAdditions.NAME + "! \nIf you don't want this, shift-click the button."; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java index d7e38adaa..bcb5fd3f1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java @@ -10,13 +10,7 @@ package de.ellpeck.actuallyadditions.mod.booklet.gui; -import java.awt.Desktop; -import java.io.IOException; -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - +import com.mojang.blaze3d.platform.GlStateManager; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; @@ -25,13 +19,19 @@ import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; import de.ellpeck.actuallyadditions.mod.booklet.page.ItemDisplay; import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton; import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.widget.button.Button; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.awt.*; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; @OnlyIn(Dist.CLIENT) public class GuiPage extends GuiBooklet { @@ -40,9 +40,9 @@ public class GuiPage extends GuiBooklet { private final List itemDisplays = new ArrayList<>(); private int pageTimer; - private GuiButton buttonViewOnline; + private Button buttonViewOnline; - public GuiPage(GuiScreen previousScreen, GuiBookletBase parentPage, IBookletPage page1, IBookletPage page2) { + public GuiPage(Screen previousScreen, GuiBookletBase parentPage, IBookletPage page1, IBookletPage page2) { super(previousScreen, parentPage); this.pages[0] = page1; @@ -217,7 +217,9 @@ public class GuiPage extends GuiBooklet { IBookletPage page = this.pages[0]; if (page != null) { IBookletChapter chapter = page.getChapter(); - if (chapter != null) { return chapter.getPageIndex(page) > 0; } + if (chapter != null) { + return chapter.getPageIndex(page) > 0; + } } return false; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/BookletUtils.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/BookletUtils.java index 8cfc211e9..7c6c8d0c8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/BookletUtils.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/BookletUtils.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.booklet.misc; -import java.util.List; - import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; @@ -20,11 +18,13 @@ import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiEntry; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiMainPage; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; -import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.screen.Screen; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.util.List; public final class BookletUtils { @@ -34,7 +34,9 @@ public final class BookletUtils { page.getItemStacksForPage(stacks); if (stacks != null && !stacks.isEmpty()) { for (ItemStack pageStack : stacks) { - if (ItemUtil.areItemsEqual(pageStack, stack, true)) { return page; } + if (ItemUtil.areItemsEqual(pageStack, stack, true)) { + return page; + } } } } @@ -42,7 +44,7 @@ public final class BookletUtils { } @OnlyIn(Dist.CLIENT) - public static GuiPage createBookletGuiFromPage(GuiScreen previousScreen, IBookletPage page) { + public static GuiPage createBookletGuiFromPage(Screen previousScreen, IBookletPage page) { GuiMainPage mainPage = new GuiMainPage(previousScreen); IBookletChapter chapter = page.getChapter(); @@ -52,7 +54,7 @@ public final class BookletUtils { } @OnlyIn(Dist.CLIENT) - public static GuiPage createPageGui(GuiScreen previousScreen, GuiBookletBase parentPage, IBookletPage page) { + public static GuiPage createPageGui(Screen previousScreen, GuiBookletBase parentPage, IBookletPage page) { IBookletChapter chapter = page.getChapter(); IBookletPage[] allPages = chapter.getAllPages(); @@ -62,9 +64,13 @@ public final class BookletUtils { if (page.shouldBeOnLeftSide()) { page1 = page; - page2 = pageIndex >= allPages.length - 1 ? null : allPages[pageIndex + 1]; + page2 = pageIndex >= allPages.length - 1 + ? null + : allPages[pageIndex + 1]; } else { - page1 = pageIndex <= 0 ? null : allPages[pageIndex - 1]; + page1 = pageIndex <= 0 + ? null + : allPages[pageIndex - 1]; page2 = page; } @@ -75,7 +81,9 @@ public final class BookletUtils { if (id != null) { for (IBookletChapter chapter : ActuallyAdditionsAPI.ALL_CHAPTERS) { for (IBookletPage page : chapter.getAllPages()) { - if (id.equals(page.getIdentifier())) { return page; } + if (id.equals(page.getIdentifier())) { + return page; + } } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPage.java index 186399c62..1a89ccf1e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPage.java @@ -10,25 +10,21 @@ package de.ellpeck.actuallyadditions.mod.booklet.page; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.block.Block; -import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.widget.button.Button; +import net.minecraft.fluid.Fluid; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; + +import java.util.*; public class BookletPage implements IBookletPage { @@ -72,7 +68,9 @@ public class BookletPage implements IBookletPage { @Override @OnlyIn(Dist.CLIENT) public String getInfoText() { - if (this.hasNoText) { return null; } + if (this.hasNoText) { + return null; + } String base = StringUtil.localize(this.getLocalizationKey()); base = base.replaceAll("", TextFormatting.DARK_GREEN + ""); @@ -113,7 +111,7 @@ public class BookletPage implements IBookletPage { @Override @OnlyIn(Dist.CLIENT) - public void actionPerformed(GuiBookletBase gui, GuiButton button) { + public void actionPerformed(GuiBookletBase gui, Button button) { } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java index 67a8004c8..1fc1a187c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.booklet.page; -import java.util.List; - import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; @@ -20,14 +18,15 @@ import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.util.ITooltipFlag.TooltipFlags; -import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; +import net.minecraft.util.SoundEvents; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.client.gui.GuiUtils; + +import java.util.List; public class ItemDisplay { @@ -44,7 +43,9 @@ public class ItemDisplay { this.y = y; this.scale = scale; this.stack = stack; - this.page = shouldTryTransfer ? BookletUtils.findFirstPageForStack(stack) : null; + this.page = shouldTryTransfer + ? BookletUtils.findFirstPageForStack(stack) + : null; } @OnlyIn(Dist.CLIENT) @@ -59,7 +60,9 @@ public class ItemDisplay { boolean flagBefore = mc.fontRenderer.getUnicodeFlag(); mc.fontRenderer.setUnicodeFlag(false); - List list = this.stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? TooltipFlags.ADVANCED : TooltipFlags.NORMAL); + List list = this.stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips + ? TooltipFlags.ADVANCED + : TooltipFlags.NORMAL); for (int k = 0; k < list.size(); ++k) { if (k == 0) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java index 0eac54559..e280ceadc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java @@ -10,18 +10,17 @@ package de.ellpeck.actuallyadditions.mod.booklet.page; -import java.util.List; - import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.items.InitItems; -import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.client.gui.GuiUtils; + +import java.util.List; public class PageCoffeeMachine extends BookletPage { @@ -36,7 +35,7 @@ public class PageCoffeeMachine extends BookletPage { this.ingredient = ingredient; this.stacks = ingredient.getInput().getMatchingStacks(); - this.outcome = new ItemStack(InitItems.itemCoffee); + this.outcome = new ItemStack(InitItems.itemCoffee.get()); ActuallyAdditionsAPI.methodHandler.addEffectToStack(this.outcome, this.ingredient); } @@ -45,7 +44,7 @@ public class PageCoffeeMachine extends BookletPage { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); - gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); + gui.getMinecraft().getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); GuiUtils.drawTexturedModalRect(startX + 5, startY + 10, 0, 74, 117, 72, 0); gui.renderScaledAsciiString("(Coffee Maker Recipe)", startX + 6, startY + 78, 0, false, gui.getMediumFontSize()); @@ -53,7 +52,9 @@ public class PageCoffeeMachine extends BookletPage { PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 90); - if (this.counter++ % 50 == 0) gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 5 + 82, startY + 10 + 1, 1F, true); + if (this.counter++ % 50 == 0) { + gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 5 + 82, startY + 10 + 1, 1F, true); + } } @Override @@ -64,8 +65,8 @@ public class PageCoffeeMachine extends BookletPage { gui.addOrModifyItemRenderer(this.stacks[0], startX + 5 + 82, startY + 10 + 1, 1F, true); gui.addOrModifyItemRenderer(this.outcome, startX + 5 + 36, startY + 10 + 42, 1F, false); - gui.addOrModifyItemRenderer(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), startX + 5 + 37, startY + 10 + 1, 1F, true); - gui.addOrModifyItemRenderer(new ItemStack(InitItems.itemCoffee), startX + 5 + 1, startY + 10 + 1, 1F, true); + gui.addOrModifyItemRenderer(new ItemStack(InitItems.itemCoffeeCup.get()), startX + 5 + 37, startY + 10 + 1, 1F, true); + gui.addOrModifyItemRenderer(new ItemStack(InitItems.itemCoffee.get()), startX + 5 + 1, startY + 10 + 1, 1F, true); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java index 18b8b3d18..0d06bc7fd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java @@ -10,9 +10,6 @@ package de.ellpeck.actuallyadditions.mod.booklet.page; -import java.util.Arrays; -import java.util.List; - import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; @@ -24,13 +21,12 @@ import de.ellpeck.actuallyadditions.mod.util.crafting.BlankRecipe; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.Ingredient; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.client.gui.GuiUtils; + +import java.util.Arrays; +import java.util.List; public class PageCrafting extends BookletPage { @@ -69,7 +65,9 @@ public class PageCrafting extends BookletPage { gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); GuiUtils.drawTexturedModalRect(startX + 5, startY + 6, 20, 0, 116, 54, 0); - if (recipeTypeLocKey != null) gui.renderScaledAsciiString("(" + StringUtil.localize(this.recipeTypeLocKey) + ")", startX + 6, startY + 65, 0, false, gui.getMediumFontSize()); + if (this.recipeTypeLocKey != null) { + gui.renderScaledAsciiString("(" + StringUtil.localize(this.recipeTypeLocKey) + ")", startX + 6, startY + 65, 0, false, gui.getMediumFontSize()); + } PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 80); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java index 870100d48..64d88478f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.booklet.page; -import java.util.List; - import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; @@ -19,9 +17,11 @@ import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.client.gui.GuiUtils; + +import java.util.List; public class PageCrusherRecipe extends BookletPage { @@ -41,14 +41,16 @@ public class PageCrusherRecipe extends BookletPage { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); - gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); + gui.getMinecraft().getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); GuiUtils.drawTexturedModalRect(startX + 38, startY + 6, 136, 0, 52, 74, 0); gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".crusherRecipe") + ")", startX + 36, startY + 85, 0, false, gui.getMediumFontSize()); PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 100); - if (this.counter++ % 50 == 0) gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 38 + 18, startY + 6 + 1, 1F, true); + if (this.counter++ % 50 == 0) { + gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 38 + 18, startY + 6 + 1, 1F, true); + } } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java index 18bb2b0d7..250c41418 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java @@ -10,17 +10,17 @@ package de.ellpeck.actuallyadditions.mod.booklet.page; -import java.util.List; - import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.client.gui.GuiUtils; + +import java.util.List; public class PageEmpowerer extends BookletPage { @@ -50,13 +50,15 @@ public class PageEmpowerer extends BookletPage { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); - gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); + gui.getMinecraft().getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); GuiUtils.drawTexturedModalRect(startX + 5, startY + 10, 117, 74, 116, 72, 0); gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".empowererRecipe") + ")", startX + 6, startY + 85, 0, false, gui.getMediumFontSize()); PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 100); - if (this.recipe != null) this.updateInputs(gui, startX, startY); + if (this.recipe != null) { + this.updateInputs(gui, startX, startY); + } } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java index acd44e742..9a5b83ffa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java @@ -10,19 +10,19 @@ package de.ellpeck.actuallyadditions.mod.booklet.page; -import java.util.List; -import java.util.Map; - import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraft.util.datafix.fixes.FurnaceRecipes; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.client.gui.GuiUtils; + +import java.util.List; +import java.util.Map; public class PageFurnace extends BookletPage { @@ -43,7 +43,9 @@ public class PageFurnace extends BookletPage { for (Map.Entry entry : FurnaceRecipes.instance().getSmeltingList().entrySet()) { ItemStack stack = entry.getValue(); if (StackUtil.isValid(stack)) { - if (stack.isItemEqual(output)) { return entry.getKey(); } + if (stack.isItemEqual(output)) { + return entry.getKey(); + } } } return ItemStack.EMPTY; @@ -54,7 +56,7 @@ public class PageFurnace extends BookletPage { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); - gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); + gui.getMinecraft().getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); GuiUtils.drawTexturedModalRect(startX + 23, startY + 10, 0, 146, 80, 26, 0); gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".furnaceRecipe") + ")", startX + 32, startY + 42, 0, false, gui.getMediumFontSize()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageLinkButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageLinkButton.java index e1f51e85b..6ea54e29c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageLinkButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageLinkButton.java @@ -10,15 +10,15 @@ package de.ellpeck.actuallyadditions.mod.booklet.page; -import java.awt.Desktop; -import java.net.URI; - import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.client.gui.GuiButton; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraft.client.gui.widget.button.Button; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.awt.*; +import java.net.URI; public class PageLinkButton extends BookletPage { @@ -40,7 +40,7 @@ public class PageLinkButton extends BookletPage { public void initGui(GuiBookletBase gui, int startX, int startY) { super.initGui(gui, startX, startY); - gui.getButtonList().add(new GuiButton(this.buttonId, startX + 125 / 2 - 50, startY + 130, 100, 20, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.chapter.getIdentifier() + ".button." + this.localizationKey))); + gui.getButtonList().add(new Button(this.buttonId, startX + 125 / 2 - 50, startY + 130, 100, 20, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.chapter.getIdentifier() + ".button." + this.localizationKey))); } @Override @@ -52,7 +52,7 @@ public class PageLinkButton extends BookletPage { @Override @OnlyIn(Dist.CLIENT) - public void actionPerformed(GuiBookletBase gui, GuiButton button) { + public void actionPerformed(GuiBookletBase gui, Button button) { if (button.id == this.buttonId) { if (Desktop.isDesktopSupported()) { try { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java index f39e5abcf..4b1342443 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java @@ -10,13 +10,13 @@ package de.ellpeck.actuallyadditions.mod.booklet.page; +import com.mojang.blaze3d.systems.RenderSystem; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.client.gui.GuiUtils; public class PagePicture extends BookletPage { @@ -44,15 +44,15 @@ public class PagePicture extends BookletPage { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); - gui.mc.getTextureManager().bindTexture(this.resLoc); + gui.getMinecraft().getTextureManager().bindTexture(this.resLoc); - GlStateManager.pushMatrix(); - GlStateManager.enableBlend(); - GlStateManager.disableAlpha(); + RenderSystem.pushMatrix(); + RenderSystem.enableBlend(); + RenderSystem.disableAlphaTest(); GuiUtils.drawTexturedModalRect(startX - 6, startY - 7, 0, 0, 256, 256, 0); - GlStateManager.disableBlend(); - GlStateManager.enableAlpha(); - GlStateManager.popMatrix(); + RenderSystem.disableBlend(); + RenderSystem.enableAlphaTest(); + RenderSystem.popMatrix(); PageTextOnly.renderTextToPage(gui, this, startX + 6, startY - 7 + this.yTextOffset); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java index eaca54553..cf63b44ee 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.booklet.page; -import java.util.List; - import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; @@ -19,9 +17,11 @@ import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.client.gui.GuiUtils; + +import java.util.List; public class PageReconstructor extends BookletPage { @@ -34,7 +34,9 @@ public class PageReconstructor extends BookletPage { public PageReconstructor(int localizationKey, LensConversionRecipe recipe) { super(localizationKey); this.recipe = recipe; - if (recipe != null) this.stacks = recipe.getInput().getMatchingStacks(); + if (recipe != null) { + this.stacks = recipe.getInput().getMatchingStacks(); + } } @Override @@ -42,14 +44,16 @@ public class PageReconstructor extends BookletPage { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); - gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); + gui.getMinecraft().getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); GuiUtils.drawTexturedModalRect(startX + 30, startY + 10, 80, 146, 68, 48, 0); gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".reconstructorRecipe") + ")", startX + 6, startY + 63, 0, false, gui.getMediumFontSize()); PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 88); if (this.recipe != null) { - if (this.counter++ % 50 == 0) gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 30 + 1, startY + 10 + 13, 1F, true); + if (this.counter++ % 50 == 0) { + gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 30 + 1, startY + 10 + 13, 1F, true); + } } } @@ -71,7 +75,7 @@ public class PageReconstructor extends BookletPage { if (this.recipe != null) { ItemStack copy = this.recipe.getOutput().copy(); if (this.isWildcard) { - copy.setItemDamage(Util.WILDCARD); + copy.setDamage(Util.WILDCARD); } list.add(copy); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java index 9dd3010ed..eae475478 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java @@ -11,8 +11,8 @@ package de.ellpeck.actuallyadditions.mod.booklet.page; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class PageTextOnly extends BookletPage { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTrials.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTrials.java index cc1c7f60b..981b8190c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTrials.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTrials.java @@ -17,16 +17,17 @@ import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.widget.button.Button; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class PageTrials extends BookletPage { private final int buttonId; @OnlyIn(Dist.CLIENT) - private GuiButton button; + private Button button; public PageTrials(int localizationKey, boolean button, boolean text) { super(localizationKey); @@ -49,7 +50,7 @@ public class PageTrials extends BookletPage { super.initGui(gui, startX, startY); if (this.buttonId >= 0) { - this.button = new GuiButton(this.buttonId, startX + 125 / 2 - 50, startY + 120, 100, 20, ""); + this.button = new Button(this.buttonId, startX + 125 / 2 - 50, startY + 120, 100, 20, ""); gui.getButtonList().add(this.button); this.updateButton(); } @@ -70,7 +71,7 @@ public class PageTrials extends BookletPage { @Override @OnlyIn(Dist.CLIENT) - public void actionPerformed(GuiBookletBase gui, GuiButton button) { + public void actionPerformed(GuiBookletBase gui, Button button) { if (this.buttonId >= 0 && button.id == this.buttonId) { PlayerEntity player = Minecraft.getInstance().player; PlayerSave data = PlayerData.getDataFromPlayer(player); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java index fd13c5d5c..0fb9e6d7a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java @@ -10,18 +10,19 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; +import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.gui.widget.button.Button; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.OnlyIn; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.client.gui.GuiUtils; import java.util.ArrayList; import java.util.List; @OnlyIn(Dist.CLIENT) -public class TexturedButton extends GuiButton { +public class TexturedButton extends Button { public final List textList = new ArrayList<>(); private final ResourceLocation resLoc; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java index a9084b6c4..16d7ffab6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java @@ -15,8 +15,8 @@ import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; +import net.minecraft.inventory.container.Container; +import net.minecraft.inventory.container.Slot; import net.minecraft.item.ItemStack; public class SlotFilter extends SlotItemHandlerUnconditioned { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java index f62199421..56eeacfa8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java @@ -31,6 +31,7 @@ public final class InitItems { // REMOVE ME @Deprecated public static final RegistryObject itemMisc = ITEMS.register("item_misc", ItemBase::new); + public static final RegistryObject itemCoffeeCup = ITEMS.register("coffee_cup", ItemBase::new); // SHARDS public static final RegistryObject RESTONIA_CRYSTAL_SHARD = ITEMS.register("item_restonia_crystal_shard", ItemBase::new); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheMiscItems.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheMiscItems.java index 732435443..cb05601c9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheMiscItems.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheMiscItems.java @@ -10,44 +10,39 @@ package de.ellpeck.actuallyadditions.mod.items.metalists; -import de.ellpeck.actuallyadditions.mod.util.Util; -import net.minecraft.item.EnumRarity; -import net.minecraftforge.common.IRarity; - +@Deprecated public enum TheMiscItems { - PAPER_CONE("paper_cone", EnumRarity.COMMON), - MASHED_FOOD("mashed_food", EnumRarity.UNCOMMON), - KNIFE_BLADE("knife_blade", EnumRarity.COMMON), - KNIFE_HANDLE("knife_handle", EnumRarity.COMMON), - DOUGH("dough", EnumRarity.COMMON), - QUARTZ("black_quartz", EnumRarity.EPIC), - RING("ring", EnumRarity.UNCOMMON), - COIL("coil", EnumRarity.COMMON), - COIL_ADVANCED("coil_advanced", EnumRarity.UNCOMMON), - RICE_DOUGH("rice_dough", EnumRarity.UNCOMMON), - TINY_COAL("tiny_coal", EnumRarity.COMMON), - TINY_CHAR("tiny_charcoal", EnumRarity.COMMON), - RICE_SLIME("rice_slime", EnumRarity.UNCOMMON), - CANOLA("canola", EnumRarity.UNCOMMON), - CUP("cup", EnumRarity.UNCOMMON), - BAT_WING("bat_wing", EnumRarity.RARE), - DRILL_CORE("drill_core", EnumRarity.UNCOMMON), - BLACK_DYE("black_dye", EnumRarity.EPIC), - LENS("lens", EnumRarity.UNCOMMON), - ENDER_STAR("ender_star", EnumRarity.EPIC), - SPAWNER_SHARD("spawner_shard", EnumRarity.EPIC), - BIOMASS("biomass", EnumRarity.UNCOMMON), - BIOCOAL("biocoal", EnumRarity.RARE), - CRYSTALLIZED_CANOLA_SEED("crystallized_canola_seed", EnumRarity.UNCOMMON), - EMPOWERED_CANOLA_SEED("empowered_canola_seed", EnumRarity.RARE), - YOUTUBE_ICON("youtube_icon", Util.FALLBACK_RARITY); + PAPER_CONE("paper_cone"), + MASHED_FOOD("mashed_food"), + KNIFE_BLADE("knife_blade"), + KNIFE_HANDLE("knife_handle"), + DOUGH("dough"), + QUARTZ("black_quartz"), + RING("ring"), + COIL("coil"), + COIL_ADVANCED("coil_advanced"), + RICE_DOUGH("rice_dough"), + TINY_COAL("tiny_coal"), + TINY_CHAR("tiny_charcoal"), + RICE_SLIME("rice_slime"), + CANOLA("canola"), + CUP("cup"), + BAT_WING("bat_wing"), + DRILL_CORE("drill_core"), + BLACK_DYE("black_dye"), + LENS("lens"), + ENDER_STAR("ender_star"), + SPAWNER_SHARD("spawner_shard"), + BIOMASS("biomass"), + BIOCOAL("biocoal"), + CRYSTALLIZED_CANOLA_SEED("crystallized_canola_seed"), + EMPOWERED_CANOLA_SEED("empowered_canola_seed"), + YOUTUBE_ICON("youtube_icon"); public final String name; - public final IRarity rarity; - TheMiscItems(String name, IRarity rarity) { + TheMiscItems(String name) { this.name = name; - this.rarity = rarity; } -} \ No newline at end of file +}