mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
chore: gui & booklet porting
This commit is contained in:
parent
a200f9aa6a
commit
d25e2fdea3
27 changed files with 289 additions and 258 deletions
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.button;
|
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.IBookletChapter;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
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.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.widget.button.Button;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class BookmarkButton extends GuiButton {
|
public class BookmarkButton extends Button {
|
||||||
|
|
||||||
private final GuiBooklet booklet;
|
private final GuiBooklet booklet;
|
||||||
public IBookletPage assignedPage;
|
public IBookletPage assignedPage;
|
||||||
|
@ -44,7 +45,7 @@ public class BookmarkButton extends GuiButton {
|
||||||
|
|
||||||
public void onPressed() {
|
public void onPressed() {
|
||||||
if (this.assignedPage != null) {
|
if (this.assignedPage != null) {
|
||||||
if (GuiScreen.isShiftKeyDown()) {
|
if (Screen.hasShiftDown()) {
|
||||||
this.assignedPage = null;
|
this.assignedPage = null;
|
||||||
} else if (!(this.booklet instanceof GuiPage) || ((GuiPage) this.booklet).pages[0] != this.assignedPage) {
|
} else if (!(this.booklet instanceof GuiPage) || ((GuiPage) this.booklet).pages[0] != this.assignedPage) {
|
||||||
GuiPage gui = BookletUtils.createPageGui(this.booklet.previousScreen, this.booklet, 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) {
|
public void drawButton(Minecraft minecraft, int x, int y, float f) {
|
||||||
if (this.visible) {
|
if (this.visible) {
|
||||||
minecraft.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
minecraft.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color4f(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;
|
this.isHovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
|
||||||
int k = this.getHoverState(this.hovered);
|
int k = this.getHoverState(this.hovered);
|
||||||
if (k == 0) {
|
if (k == 0) {
|
||||||
k = 1;
|
k = 1;
|
||||||
|
|
|
@ -10,19 +10,20 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.button;
|
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.api.booklet.internal.GuiBookletBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.widget.button.Button;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class EntryButton extends GuiButton {
|
public class EntryButton extends Button {
|
||||||
|
|
||||||
private final GuiBookletBase gui;
|
private final GuiBookletBase gui;
|
||||||
private final ItemStack stackToRender;
|
private final ItemStack stackToRender;
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class TrialsButton extends TexturedButton {
|
||||||
public TrialsButton(GuiBooklet gui) {
|
public TrialsButton(GuiBooklet gui) {
|
||||||
super(GuiBooklet.RES_LOC_GADGETS, -152000, gui.getGuiLeft() + gui.getSizeX(), gui.getGuiTop() + 10, 0, 204, 52, 16);
|
super(GuiBooklet.RES_LOC_GADGETS, -152000, gui.getGuiLeft() + gui.getSizeX(), gui.getGuiTop() + 10, 0, 204, 52, 16);
|
||||||
this.isTrials = gui.areTrialsOpened();
|
this.isTrials = gui.areTrialsOpened();
|
||||||
this.enabled = !this.isTrials;
|
this.active = !this.isTrials;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -31,7 +31,7 @@ public class TrialsButton extends TexturedButton {
|
||||||
super.drawButton(minecraft, x, y, f);
|
super.drawButton(minecraft, x, y, f);
|
||||||
|
|
||||||
if (this.visible) {
|
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);
|
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) {
|
protected int getHoverState(boolean mouseOver) {
|
||||||
if (mouseOver || this.isTrials) {
|
if (mouseOver || this.isTrials) {
|
||||||
return 2;
|
return 2;
|
||||||
} else if (!this.enabled) {
|
} else if (!this.active) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -18,8 +18,8 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
public class BookletChapter implements IBookletChapter {
|
public class BookletChapter implements IBookletChapter {
|
||||||
|
|
||||||
|
@ -39,7 +39,9 @@ public class BookletChapter implements IBookletChapter {
|
||||||
this.identifier = identifier;
|
this.identifier = identifier;
|
||||||
this.entry = entry;
|
this.entry = entry;
|
||||||
this.displayStack = displayStack;
|
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.priority = priority;
|
||||||
this.color = TextFormatting.RESET;
|
this.color = TextFormatting.RESET;
|
||||||
|
|
||||||
|
@ -84,7 +86,9 @@ public class BookletChapter implements IBookletChapter {
|
||||||
@Override
|
@Override
|
||||||
public int getPageIndex(IBookletPage page) {
|
public int getPageIndex(IBookletPage page) {
|
||||||
for (int i = 0; i < this.pages.length; i++) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,8 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
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 {
|
public class BookletChapterTrials extends BookletChapter {
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,9 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
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.fluids.FluidStack;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -10,14 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.gui;
|
package de.ellpeck.actuallyadditions.mod.booklet.gui;
|
||||||
|
|
||||||
import java.io.IOException;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
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 de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
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.network.PacketHandlerHelper;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.java.games.input.Keyboard;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.java.games.input.Mouse;
|
||||||
import net.minecraft.client.gui.GuiTextField;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||||
|
import net.minecraft.client.gui.widget.button.Button;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
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)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public abstract class GuiBooklet extends GuiBookletBase {
|
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_GUI = AssetUtil.getBookletGuiLocation("gui_booklet");
|
||||||
public static final ResourceLocation RES_LOC_GADGETS = AssetUtil.getBookletGuiLocation("gui_booklet_gadgets");
|
public static final ResourceLocation RES_LOC_GADGETS = AssetUtil.getBookletGuiLocation("gui_booklet_gadgets");
|
||||||
protected final BookmarkButton[] bookmarkButtons = new BookmarkButton[12];
|
protected final BookmarkButton[] bookmarkButtons = new BookmarkButton[12];
|
||||||
public GuiScreen previousScreen;
|
public Screen previousScreen;
|
||||||
public GuiBookletBase parentPage;
|
public GuiBookletBase parentPage;
|
||||||
public GuiTextField searchField;
|
public TextFieldWidget searchField;
|
||||||
protected int xSize;
|
protected int xSize;
|
||||||
protected int ySize;
|
protected int ySize;
|
||||||
protected int guiLeft;
|
protected int guiLeft;
|
||||||
protected int guiTop;
|
protected int guiTop;
|
||||||
private GuiButton buttonLeft;
|
private Button buttonLeft;
|
||||||
private GuiButton buttonRight;
|
private Button buttonRight;
|
||||||
private GuiButton buttonBack;
|
private Button buttonBack;
|
||||||
|
|
||||||
private GuiButton buttonTrials;
|
private Button buttonTrials;
|
||||||
|
|
||||||
private float smallFontSize;
|
private float smallFontSize;
|
||||||
private float mediumFontSize;
|
private float mediumFontSize;
|
||||||
private float largeFontSize;
|
private float largeFontSize;
|
||||||
|
|
||||||
public GuiBooklet(GuiScreen previousScreen, GuiBookletBase parentPage) {
|
public GuiBooklet(Screen previousScreen, GuiBookletBase parentPage) {
|
||||||
this.previousScreen = previousScreen;
|
this.previousScreen = previousScreen;
|
||||||
this.parentPage = parentPage;
|
this.parentPage = parentPage;
|
||||||
|
|
||||||
|
@ -85,8 +84,8 @@ public abstract class GuiBooklet extends GuiBookletBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void init() {
|
||||||
super.initGui();
|
super.init();
|
||||||
|
|
||||||
this.guiLeft = (this.width - this.xSize) / 2;
|
this.guiLeft = (this.width - this.xSize) / 2;
|
||||||
this.guiTop = (this.height - this.ySize) / 2;
|
this.guiTop = (this.height - this.ySize) / 2;
|
||||||
|
@ -98,23 +97,23 @@ 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, -2000, this.guiLeft - 12, this.guiTop + this.ySize - 8, 18, 54, 18, 10, hoverText);
|
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()) {
|
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, -2001, this.guiLeft + this.xSize - 6, this.guiTop + this.ySize - 8, 0, 54, 18, 10, hoverText);
|
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()) {
|
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, -2002, this.guiLeft - 15, this.guiTop - 3, 36, 54, 18, 10, hoverText);
|
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()) {
|
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.setMaxStringLength(50);
|
||||||
this.searchField.setEnableBackgroundDrawing(false);
|
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!
|
//Don't cache the parent GUI, otherwise it opens again when you close the cached book!
|
||||||
this.previousScreen = null;
|
this.previousScreen = null;
|
||||||
|
|
||||||
if (this.mc.player == null) return;
|
if (this.mc.player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
PlayerSave data = PlayerData.getDataFromPlayer(this.mc.player);
|
PlayerSave data = PlayerData.getDataFromPlayer(this.mc.player);
|
||||||
data.lastOpenBooklet = this;
|
data.lastOpenBooklet = this;
|
||||||
|
|
||||||
|
@ -296,7 +297,9 @@ public abstract class GuiBooklet extends GuiBookletBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSearchBarChanged(String searchBarText) {
|
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));
|
this.mc.displayGuiScreen(new GuiEntry(this.previousScreen, parent, ActuallyAdditionsAPI.entryAllAndSearch, 0, searchBarText, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.gui;
|
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.IBookletChapter;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
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.entry.BookletEntryTrials;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
|
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
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.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class GuiEntry extends GuiBooklet {
|
public class GuiEntry extends GuiBooklet {
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class GuiEntry extends GuiBooklet {
|
||||||
private final String searchText;
|
private final String searchText;
|
||||||
private final boolean focusSearch;
|
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);
|
super(previousScreen, parentPage);
|
||||||
this.entryPage = entryPage;
|
this.entryPage = entryPage;
|
||||||
this.entry = entry;
|
this.entry = entry;
|
||||||
|
@ -47,13 +47,15 @@ public class GuiEntry extends GuiBooklet {
|
||||||
|
|
||||||
if (!this.chapters.isEmpty()) {
|
if (!this.chapters.isEmpty()) {
|
||||||
IBookletChapter lastChap = this.chapters.get(this.chapters.size() - 1);
|
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 {
|
} else {
|
||||||
this.pageAmount = 1;
|
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);
|
this(previousScreen, parentPage, entry, calcEntryPage(entry, chapterForPageCalc, search), search, focusSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.gui;
|
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.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
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.network.PacketHandlerHelper;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.widget.button.Button;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
//TODO Fix achievement button
|
//TODO Fix achievement button
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class GuiMainPage extends GuiBooklet {
|
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 achievementButton;
|
||||||
private TexturedButton configButton;
|
private TexturedButton configButton;
|
||||||
|
|
||||||
private GuiButton tutorialButton;
|
private Button tutorialButton;
|
||||||
private boolean showTutorial;
|
private boolean showTutorial;
|
||||||
|
|
||||||
private String bookletName;
|
private String bookletName;
|
||||||
|
@ -52,7 +52,7 @@ public class GuiMainPage extends GuiBooklet {
|
||||||
private List<String> quote;
|
private List<String> quote;
|
||||||
private String quoteGuy;
|
private String quoteGuy;
|
||||||
|
|
||||||
public GuiMainPage(GuiScreen previousScreen) {
|
public GuiMainPage(Screen previousScreen) {
|
||||||
super(previousScreen, null);
|
super(previousScreen, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,23 +69,23 @@ public class GuiMainPage extends GuiBooklet {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void init() {
|
||||||
super.initGui();
|
super.init();
|
||||||
|
|
||||||
int flavor = 1;
|
int flavor = 1;
|
||||||
if (this.mc.world.rand.nextFloat() <= 0.1) {
|
if (this.getMinecraft().world.rand.nextFloat() <= 0.1) {
|
||||||
flavor = MathHelper.getInt(this.mc.world.rand, 2, 7);
|
flavor = MathHelper.nextInt(this.getMinecraft().world.rand, 2, 7);
|
||||||
}
|
}
|
||||||
this.bookletName = "info." + ActuallyAdditions.MODID + ".booklet.manualName.1." + flavor;
|
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("@");
|
String[] quoteSplit = usedQuote.split("@");
|
||||||
if (quoteSplit.length == 2) {
|
if (quoteSplit.length == 2) {
|
||||||
this.quote = this.fontRenderer.listFormattedStringToWidth(quoteSplit[0], 120);
|
this.quote = this.font.listFormattedStringToWidth(quoteSplit[0], 120);
|
||||||
this.quoteGuy = quoteSplit[1];
|
this.quoteGuy = quoteSplit[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
String playerName = this.mc.player.getName();
|
String playerName = this.getMinecraft().player.getName().getString();
|
||||||
if (playerName.equalsIgnoreCase("dqmhose")) {
|
if (playerName.equalsIgnoreCase("dqmhose")) {
|
||||||
this.bookletEdition = "Pants Edition";
|
this.bookletEdition = "Pants Edition";
|
||||||
} else if (playerName.equalsIgnoreCase("TwoOfEight") || playerName.equalsIgnoreCase("BootyToast")) {
|
} 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")) {
|
} else if (playerName.equalsIgnoreCase("ellpeck") || playerName.equalsIgnoreCase("profprospector")) {
|
||||||
String[] colors = new String[15];
|
String[] colors = new String[15];
|
||||||
for (int i = 0; i < colors.length; i++) {
|
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);
|
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")) {
|
} else if (playerName.equalsIgnoreCase("oitsjustjose")) {
|
||||||
|
@ -134,17 +134,17 @@ 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.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.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);
|
this.buttonList.add(this.configButton);
|
||||||
|
|
||||||
List<String> achievementText = new ArrayList<>();
|
List<String> achievementText = new ArrayList<>();
|
||||||
achievementText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".achievementButton.name"));
|
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.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);
|
//this.buttonList.add(this.achievementButton);
|
||||||
|
|
||||||
PlayerSave data = PlayerData.getDataFromPlayer(this.mc.player);
|
PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player);
|
||||||
if (!data.didBookTutorial) {
|
if (!data.didBookTutorial) {
|
||||||
this.showTutorial = true;
|
this.showTutorial = true;
|
||||||
|
|
||||||
|
@ -173,17 +173,17 @@ public class GuiMainPage extends GuiBooklet {
|
||||||
if (displayed.size() > button.id) {
|
if (displayed.size() > button.id) {
|
||||||
IBookletEntry entry = displayed.get(button.id);
|
IBookletEntry entry = displayed.get(button.id);
|
||||||
if (entry != null) {
|
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){
|
/*else if(button == this.achievementButton){
|
||||||
GuiScreen achievements = new GuiAAAchievements(this, this.mc.player.getStatFileWriter());
|
GuiScreen achievements = new GuiAAAchievements(this, this.getMinecraft().player.getStatFileWriter());
|
||||||
this.mc.displayGuiScreen(achievements);
|
this.getMinecraft().displayGuiScreen(achievements);
|
||||||
}*/
|
}*/
|
||||||
else if (button == this.configButton) {
|
else if (button == this.configButton) {
|
||||||
GuiScreen config = new GuiConfiguration(this);
|
GuiScreen config = new GuiConfiguration(this);
|
||||||
this.mc.displayGuiScreen(config);
|
this.getMinecraft().displayGuiScreen(config);
|
||||||
} else if (this.showTutorial && button == this.tutorialButton) {
|
} else if (this.showTutorial && button == this.tutorialButton) {
|
||||||
if (this.hasBookmarkButtons()) {
|
if (this.hasBookmarkButtons()) {
|
||||||
if (!isShiftKeyDown()) {
|
if (!isShiftKeyDown()) {
|
||||||
|
@ -197,7 +197,7 @@ public class GuiMainPage extends GuiBooklet {
|
||||||
this.configButton.visible = true;
|
this.configButton.visible = true;
|
||||||
//this.achievementButton.visible = true;
|
//this.achievementButton.visible = true;
|
||||||
|
|
||||||
PlayerSave data = PlayerData.getDataFromPlayer(this.mc.player);
|
PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player);
|
||||||
data.didBookTutorial = true;
|
data.didBookTutorial = true;
|
||||||
PacketHandlerHelper.sendPlayerDataToServer(false, 1);
|
PacketHandlerHelper.sendPlayerDataToServer(false, 1);
|
||||||
}
|
}
|
||||||
|
@ -211,12 +211,12 @@ public class GuiMainPage extends GuiBooklet {
|
||||||
super.drawScreenPre(mouseX, mouseY, partialTicks);
|
super.drawScreenPre(mouseX, mouseY, partialTicks);
|
||||||
|
|
||||||
String strg = TextFormatting.DARK_GREEN + StringUtil.localize(this.bookletName);
|
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");
|
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;
|
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) {
|
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.";
|
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.";
|
||||||
|
|
|
@ -10,13 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.gui;
|
package de.ellpeck.actuallyadditions.mod.booklet.gui;
|
||||||
|
|
||||||
import java.awt.Desktop;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
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.booklet.page.ItemDisplay;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
|
import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.widget.button.Button;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
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)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class GuiPage extends GuiBooklet {
|
public class GuiPage extends GuiBooklet {
|
||||||
|
@ -40,9 +40,9 @@ public class GuiPage extends GuiBooklet {
|
||||||
private final List<ItemDisplay> itemDisplays = new ArrayList<>();
|
private final List<ItemDisplay> itemDisplays = new ArrayList<>();
|
||||||
private int pageTimer;
|
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);
|
super(previousScreen, parentPage);
|
||||||
|
|
||||||
this.pages[0] = page1;
|
this.pages[0] = page1;
|
||||||
|
@ -217,7 +217,9 @@ public class GuiPage extends GuiBooklet {
|
||||||
IBookletPage page = this.pages[0];
|
IBookletPage page = this.pages[0];
|
||||||
if (page != null) {
|
if (page != null) {
|
||||||
IBookletChapter chapter = page.getChapter();
|
IBookletChapter chapter = page.getChapter();
|
||||||
if (chapter != null) { return chapter.getPageIndex(page) > 0; }
|
if (chapter != null) {
|
||||||
|
return chapter.getPageIndex(page) > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.misc;
|
package de.ellpeck.actuallyadditions.mod.booklet.misc;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
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.GuiMainPage;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage;
|
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
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.item.ItemStack;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public final class BookletUtils {
|
public final class BookletUtils {
|
||||||
|
|
||||||
|
@ -34,7 +34,9 @@ public final class BookletUtils {
|
||||||
page.getItemStacksForPage(stacks);
|
page.getItemStacksForPage(stacks);
|
||||||
if (stacks != null && !stacks.isEmpty()) {
|
if (stacks != null && !stacks.isEmpty()) {
|
||||||
for (ItemStack pageStack : stacks) {
|
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)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static GuiPage createBookletGuiFromPage(GuiScreen previousScreen, IBookletPage page) {
|
public static GuiPage createBookletGuiFromPage(Screen previousScreen, IBookletPage page) {
|
||||||
GuiMainPage mainPage = new GuiMainPage(previousScreen);
|
GuiMainPage mainPage = new GuiMainPage(previousScreen);
|
||||||
|
|
||||||
IBookletChapter chapter = page.getChapter();
|
IBookletChapter chapter = page.getChapter();
|
||||||
|
@ -52,7 +54,7 @@ public final class BookletUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@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();
|
IBookletChapter chapter = page.getChapter();
|
||||||
|
|
||||||
IBookletPage[] allPages = chapter.getAllPages();
|
IBookletPage[] allPages = chapter.getAllPages();
|
||||||
|
@ -62,9 +64,13 @@ public final class BookletUtils {
|
||||||
|
|
||||||
if (page.shouldBeOnLeftSide()) {
|
if (page.shouldBeOnLeftSide()) {
|
||||||
page1 = page;
|
page1 = page;
|
||||||
page2 = pageIndex >= allPages.length - 1 ? null : allPages[pageIndex + 1];
|
page2 = pageIndex >= allPages.length - 1
|
||||||
|
? null
|
||||||
|
: allPages[pageIndex + 1];
|
||||||
} else {
|
} else {
|
||||||
page1 = pageIndex <= 0 ? null : allPages[pageIndex - 1];
|
page1 = pageIndex <= 0
|
||||||
|
? null
|
||||||
|
: allPages[pageIndex - 1];
|
||||||
page2 = page;
|
page2 = page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +81,9 @@ public final class BookletUtils {
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
for (IBookletChapter chapter : ActuallyAdditionsAPI.ALL_CHAPTERS) {
|
for (IBookletChapter chapter : ActuallyAdditionsAPI.ALL_CHAPTERS) {
|
||||||
for (IBookletPage page : chapter.getAllPages()) {
|
for (IBookletPage page : chapter.getAllPages()) {
|
||||||
if (id.equals(page.getIdentifier())) { return page; }
|
if (id.equals(page.getIdentifier())) {
|
||||||
|
return page;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,25 +10,21 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
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.IBookletChapter;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.Block;
|
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.item.ItemStack;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
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.fluids.FluidStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import java.util.*;
|
||||||
|
|
||||||
public class BookletPage implements IBookletPage {
|
public class BookletPage implements IBookletPage {
|
||||||
|
|
||||||
|
@ -72,7 +68,9 @@ public class BookletPage implements IBookletPage {
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public String getInfoText() {
|
public String getInfoText() {
|
||||||
if (this.hasNoText) { return null; }
|
if (this.hasNoText) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
String base = StringUtil.localize(this.getLocalizationKey());
|
String base = StringUtil.localize(this.getLocalizationKey());
|
||||||
base = base.replaceAll("<imp>", TextFormatting.DARK_GREEN + "");
|
base = base.replaceAll("<imp>", TextFormatting.DARK_GREEN + "");
|
||||||
|
@ -113,7 +111,7 @@ public class BookletPage implements IBookletPage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void actionPerformed(GuiBookletBase gui, GuiButton button) {
|
public void actionPerformed(GuiBookletBase gui, Button button) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
|
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.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
|
||||||
import net.minecraft.client.util.ITooltipFlag.TooltipFlags;
|
import net.minecraft.client.util.ITooltipFlag.TooltipFlags;
|
||||||
import net.minecraft.init.SoundEvents;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.SoundEvents;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ItemDisplay {
|
public class ItemDisplay {
|
||||||
|
|
||||||
|
@ -44,7 +43,9 @@ public class ItemDisplay {
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.scale = scale;
|
this.scale = scale;
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
this.page = shouldTryTransfer ? BookletUtils.findFirstPageForStack(stack) : null;
|
this.page = shouldTryTransfer
|
||||||
|
? BookletUtils.findFirstPageForStack(stack)
|
||||||
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
@ -59,7 +60,9 @@ public class ItemDisplay {
|
||||||
boolean flagBefore = mc.fontRenderer.getUnicodeFlag();
|
boolean flagBefore = mc.fontRenderer.getUnicodeFlag();
|
||||||
mc.fontRenderer.setUnicodeFlag(false);
|
mc.fontRenderer.setUnicodeFlag(false);
|
||||||
|
|
||||||
List<String> list = this.stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? TooltipFlags.ADVANCED : TooltipFlags.NORMAL);
|
List<String> list = this.stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips
|
||||||
|
? TooltipFlags.ADVANCED
|
||||||
|
: TooltipFlags.NORMAL);
|
||||||
|
|
||||||
for (int k = 0; k < list.size(); ++k) {
|
for (int k = 0; k < list.size(); ++k) {
|
||||||
if (k == 0) {
|
if (k == 0) {
|
||||||
|
|
|
@ -10,18 +10,17 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
|
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class PageCoffeeMachine extends BookletPage {
|
public class PageCoffeeMachine extends BookletPage {
|
||||||
|
|
||||||
|
@ -36,7 +35,7 @@ public class PageCoffeeMachine extends BookletPage {
|
||||||
this.ingredient = ingredient;
|
this.ingredient = ingredient;
|
||||||
this.stacks = ingredient.getInput().getMatchingStacks();
|
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);
|
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) {
|
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, 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);
|
GuiUtils.drawTexturedModalRect(startX + 5, startY + 10, 0, 74, 117, 72, 0);
|
||||||
|
|
||||||
gui.renderScaledAsciiString("(Coffee Maker Recipe)", startX + 6, startY + 78, 0, false, gui.getMediumFontSize());
|
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);
|
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
|
@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.stacks[0], startX + 5 + 82, startY + 10 + 1, 1F, true);
|
||||||
gui.addOrModifyItemRenderer(this.outcome, startX + 5 + 36, startY + 10 + 42, 1F, false);
|
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.itemCoffeeCup.get()), 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.itemCoffee.get()), startX + 5 + 1, startY + 10 + 1, 1F, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
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.api.booklet.internal.GuiBookletBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
|
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.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.item.crafting.ShapedRecipes;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import java.util.Arrays;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import java.util.List;
|
||||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
|
||||||
|
|
||||||
public class PageCrafting extends BookletPage {
|
public class PageCrafting extends BookletPage {
|
||||||
|
|
||||||
|
@ -69,7 +65,9 @@ public class PageCrafting extends BookletPage {
|
||||||
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||||
GuiUtils.drawTexturedModalRect(startX + 5, startY + 6, 20, 0, 116, 54, 0);
|
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);
|
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 80);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
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.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class PageCrusherRecipe extends BookletPage {
|
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) {
|
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, 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);
|
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());
|
gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".crusherRecipe") + ")", startX + 36, startY + 85, 0, false, gui.getMediumFontSize());
|
||||||
|
|
||||||
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 100);
|
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
|
@Override
|
||||||
|
|
|
@ -10,17 +10,17 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
|
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class PageEmpowerer extends BookletPage {
|
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) {
|
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, 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);
|
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());
|
gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".empowererRecipe") + ")", startX + 6, startY + 85, 0, false, gui.getMediumFontSize());
|
||||||
|
|
||||||
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 100);
|
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
|
@Override
|
||||||
|
|
|
@ -10,19 +10,19 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
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.api.booklet.internal.GuiBookletBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
|
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
import net.minecraft.util.datafix.fixes.FurnaceRecipes;
|
||||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class PageFurnace extends BookletPage {
|
public class PageFurnace extends BookletPage {
|
||||||
|
|
||||||
|
@ -43,7 +43,9 @@ public class PageFurnace extends BookletPage {
|
||||||
for (Map.Entry<ItemStack, ItemStack> entry : FurnaceRecipes.instance().getSmeltingList().entrySet()) {
|
for (Map.Entry<ItemStack, ItemStack> entry : FurnaceRecipes.instance().getSmeltingList().entrySet()) {
|
||||||
ItemStack stack = entry.getValue();
|
ItemStack stack = entry.getValue();
|
||||||
if (StackUtil.isValid(stack)) {
|
if (StackUtil.isValid(stack)) {
|
||||||
if (stack.isItemEqual(output)) { return entry.getKey(); }
|
if (stack.isItemEqual(output)) {
|
||||||
|
return entry.getKey();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ItemStack.EMPTY;
|
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) {
|
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, 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);
|
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());
|
gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".furnaceRecipe") + ")", startX + 32, startY + 42, 0, false, gui.getMediumFontSize());
|
||||||
|
|
|
@ -10,15 +10,15 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
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.api.booklet.internal.GuiBookletBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.widget.button.Button;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
public class PageLinkButton extends BookletPage {
|
public class PageLinkButton extends BookletPage {
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class PageLinkButton extends BookletPage {
|
||||||
public void initGui(GuiBookletBase gui, int startX, int startY) {
|
public void initGui(GuiBookletBase gui, int startX, int startY) {
|
||||||
super.initGui(gui, startX, 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
|
@Override
|
||||||
|
@ -52,7 +52,7 @@ public class PageLinkButton extends BookletPage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void actionPerformed(GuiBookletBase gui, GuiButton button) {
|
public void actionPerformed(GuiBookletBase gui, Button button) {
|
||||||
if (button.id == this.buttonId) {
|
if (button.id == this.buttonId) {
|
||||||
if (Desktop.isDesktopSupported()) {
|
if (Desktop.isDesktopSupported()) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -10,13 +10,13 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
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.api.booklet.internal.GuiBookletBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||||
|
|
||||||
public class PagePicture extends BookletPage {
|
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) {
|
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
|
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
|
||||||
|
|
||||||
gui.mc.getTextureManager().bindTexture(this.resLoc);
|
gui.getMinecraft().getTextureManager().bindTexture(this.resLoc);
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
GlStateManager.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
GlStateManager.disableAlpha();
|
RenderSystem.disableAlphaTest();
|
||||||
GuiUtils.drawTexturedModalRect(startX - 6, startY - 7, 0, 0, 256, 256, 0);
|
GuiUtils.drawTexturedModalRect(startX - 6, startY - 7, 0, 0, 256, 256, 0);
|
||||||
GlStateManager.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
GlStateManager.enableAlpha();
|
RenderSystem.enableAlphaTest();
|
||||||
GlStateManager.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
|
|
||||||
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY - 7 + this.yTextOffset);
|
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY - 7 + this.yTextOffset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
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.StringUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class PageReconstructor extends BookletPage {
|
public class PageReconstructor extends BookletPage {
|
||||||
|
|
||||||
|
@ -34,7 +34,9 @@ public class PageReconstructor extends BookletPage {
|
||||||
public PageReconstructor(int localizationKey, LensConversionRecipe recipe) {
|
public PageReconstructor(int localizationKey, LensConversionRecipe recipe) {
|
||||||
super(localizationKey);
|
super(localizationKey);
|
||||||
this.recipe = recipe;
|
this.recipe = recipe;
|
||||||
if (recipe != null) this.stacks = recipe.getInput().getMatchingStacks();
|
if (recipe != null) {
|
||||||
|
this.stacks = recipe.getInput().getMatchingStacks();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
|
||||||
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, 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);
|
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());
|
gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".reconstructorRecipe") + ")", startX + 6, startY + 63, 0, false, gui.getMediumFontSize());
|
||||||
|
|
||||||
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 88);
|
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 88);
|
||||||
if (this.recipe != null) {
|
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) {
|
if (this.recipe != null) {
|
||||||
ItemStack copy = this.recipe.getOutput().copy();
|
ItemStack copy = this.recipe.getOutput().copy();
|
||||||
if (this.isWildcard) {
|
if (this.isWildcard) {
|
||||||
copy.setItemDamage(Util.WILDCARD);
|
copy.setDamage(Util.WILDCARD);
|
||||||
}
|
}
|
||||||
list.add(copy);
|
list.add(copy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
package de.ellpeck.actuallyadditions.mod.booklet.page;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
public class PageTextOnly extends BookletPage {
|
public class PageTextOnly extends BookletPage {
|
||||||
|
|
||||||
|
|
|
@ -17,16 +17,17 @@ import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
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.entity.player.PlayerEntity;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
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 {
|
public class PageTrials extends BookletPage {
|
||||||
|
|
||||||
private final int buttonId;
|
private final int buttonId;
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
private GuiButton button;
|
private Button button;
|
||||||
|
|
||||||
public PageTrials(int localizationKey, boolean button, boolean text) {
|
public PageTrials(int localizationKey, boolean button, boolean text) {
|
||||||
super(localizationKey);
|
super(localizationKey);
|
||||||
|
@ -49,7 +50,7 @@ public class PageTrials extends BookletPage {
|
||||||
super.initGui(gui, startX, startY);
|
super.initGui(gui, startX, startY);
|
||||||
|
|
||||||
if (this.buttonId >= 0) {
|
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);
|
gui.getButtonList().add(this.button);
|
||||||
this.updateButton();
|
this.updateButton();
|
||||||
}
|
}
|
||||||
|
@ -70,7 +71,7 @@ public class PageTrials extends BookletPage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@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) {
|
if (this.buttonId >= 0 && button.id == this.buttonId) {
|
||||||
PlayerEntity player = Minecraft.getInstance().player;
|
PlayerEntity player = Minecraft.getInstance().player;
|
||||||
PlayerSave data = PlayerData.getDataFromPlayer(player);
|
PlayerSave data = PlayerData.getDataFromPlayer(player);
|
||||||
|
|
|
@ -10,18 +10,19 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.widget.button.Button;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class TexturedButton extends GuiButton {
|
public class TexturedButton extends Button {
|
||||||
|
|
||||||
public final List<String> textList = new ArrayList<>();
|
public final List<String> textList = new ArrayList<>();
|
||||||
private final ResourceLocation resLoc;
|
private final ResourceLocation resLoc;
|
||||||
|
|
|
@ -15,8 +15,8 @@ import de.ellpeck.actuallyadditions.mod.tile.FilterSettings;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
|
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.container.Container;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.container.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class SlotFilter extends SlotItemHandlerUnconditioned {
|
public class SlotFilter extends SlotItemHandlerUnconditioned {
|
||||||
|
|
|
@ -31,6 +31,7 @@ public final class InitItems {
|
||||||
// REMOVE ME
|
// REMOVE ME
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final RegistryObject<Item> itemMisc = ITEMS.register("item_misc", ItemBase::new);
|
public static final RegistryObject<Item> itemMisc = ITEMS.register("item_misc", ItemBase::new);
|
||||||
|
public static final RegistryObject<Item> itemCoffeeCup = ITEMS.register("coffee_cup", ItemBase::new);
|
||||||
|
|
||||||
// SHARDS
|
// SHARDS
|
||||||
public static final RegistryObject<Item> RESTONIA_CRYSTAL_SHARD = ITEMS.register("item_restonia_crystal_shard", ItemBase::new);
|
public static final RegistryObject<Item> RESTONIA_CRYSTAL_SHARD = ITEMS.register("item_restonia_crystal_shard", ItemBase::new);
|
||||||
|
|
|
@ -10,44 +10,39 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items.metalists;
|
package de.ellpeck.actuallyadditions.mod.items.metalists;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
@Deprecated
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraftforge.common.IRarity;
|
|
||||||
|
|
||||||
public enum TheMiscItems {
|
public enum TheMiscItems {
|
||||||
|
|
||||||
PAPER_CONE("paper_cone", EnumRarity.COMMON),
|
PAPER_CONE("paper_cone"),
|
||||||
MASHED_FOOD("mashed_food", EnumRarity.UNCOMMON),
|
MASHED_FOOD("mashed_food"),
|
||||||
KNIFE_BLADE("knife_blade", EnumRarity.COMMON),
|
KNIFE_BLADE("knife_blade"),
|
||||||
KNIFE_HANDLE("knife_handle", EnumRarity.COMMON),
|
KNIFE_HANDLE("knife_handle"),
|
||||||
DOUGH("dough", EnumRarity.COMMON),
|
DOUGH("dough"),
|
||||||
QUARTZ("black_quartz", EnumRarity.EPIC),
|
QUARTZ("black_quartz"),
|
||||||
RING("ring", EnumRarity.UNCOMMON),
|
RING("ring"),
|
||||||
COIL("coil", EnumRarity.COMMON),
|
COIL("coil"),
|
||||||
COIL_ADVANCED("coil_advanced", EnumRarity.UNCOMMON),
|
COIL_ADVANCED("coil_advanced"),
|
||||||
RICE_DOUGH("rice_dough", EnumRarity.UNCOMMON),
|
RICE_DOUGH("rice_dough"),
|
||||||
TINY_COAL("tiny_coal", EnumRarity.COMMON),
|
TINY_COAL("tiny_coal"),
|
||||||
TINY_CHAR("tiny_charcoal", EnumRarity.COMMON),
|
TINY_CHAR("tiny_charcoal"),
|
||||||
RICE_SLIME("rice_slime", EnumRarity.UNCOMMON),
|
RICE_SLIME("rice_slime"),
|
||||||
CANOLA("canola", EnumRarity.UNCOMMON),
|
CANOLA("canola"),
|
||||||
CUP("cup", EnumRarity.UNCOMMON),
|
CUP("cup"),
|
||||||
BAT_WING("bat_wing", EnumRarity.RARE),
|
BAT_WING("bat_wing"),
|
||||||
DRILL_CORE("drill_core", EnumRarity.UNCOMMON),
|
DRILL_CORE("drill_core"),
|
||||||
BLACK_DYE("black_dye", EnumRarity.EPIC),
|
BLACK_DYE("black_dye"),
|
||||||
LENS("lens", EnumRarity.UNCOMMON),
|
LENS("lens"),
|
||||||
ENDER_STAR("ender_star", EnumRarity.EPIC),
|
ENDER_STAR("ender_star"),
|
||||||
SPAWNER_SHARD("spawner_shard", EnumRarity.EPIC),
|
SPAWNER_SHARD("spawner_shard"),
|
||||||
BIOMASS("biomass", EnumRarity.UNCOMMON),
|
BIOMASS("biomass"),
|
||||||
BIOCOAL("biocoal", EnumRarity.RARE),
|
BIOCOAL("biocoal"),
|
||||||
CRYSTALLIZED_CANOLA_SEED("crystallized_canola_seed", EnumRarity.UNCOMMON),
|
CRYSTALLIZED_CANOLA_SEED("crystallized_canola_seed"),
|
||||||
EMPOWERED_CANOLA_SEED("empowered_canola_seed", EnumRarity.RARE),
|
EMPOWERED_CANOLA_SEED("empowered_canola_seed"),
|
||||||
YOUTUBE_ICON("youtube_icon", Util.FALLBACK_RARITY);
|
YOUTUBE_ICON("youtube_icon");
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
public final IRarity rarity;
|
|
||||||
|
|
||||||
TheMiscItems(String name, IRarity rarity) {
|
TheMiscItems(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.rarity = rarity;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue