From abbbe78ac3464d6ae2a0f6ca470573ea9b14e2ed Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Sat, 15 Aug 2015 20:15:52 +0100 Subject: Fixed a bug which causes servers to crash --- .../darkknight/jewelrycraft/JewelrycraftMod.java | 6 +- .../jewelrycraft/client/gui/GuiGuide.java | 18 ++-- .../darkknight/jewelrycraft/client/gui/GuiTab.java | 104 ++++++--------------- .../darkknight/jewelrycraft/util/Variables.java | 2 +- 4 files changed, 43 insertions(+), 87 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java b/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java index 1d57412..908aaf6 100644 --- a/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java +++ b/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java @@ -21,6 +21,8 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import darkknight.jewelrycraft.achievements.AchievementsList; import darkknight.jewelrycraft.block.BlockList; import darkknight.jewelrycraft.client.gui.GuiTab; @@ -69,10 +71,6 @@ public class JewelrycraftMod public static SimpleNetworkWrapper netWrapper; public static boolean fancyRender = false; - //GUIDE - public static GuiTab prevActive = new GuiTabIntroduction(0); - public static int prevPage = 1; - /** * Pre initialization of mod stuff. * diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java index b3caaf2..5f52897 100644 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java @@ -15,6 +15,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import darkknight.jewelrycraft.JewelrycraftMod; import darkknight.jewelrycraft.block.BlockList; import darkknight.jewelrycraft.block.BlockShadowEye; @@ -27,14 +29,18 @@ public class GuiGuide extends GuiContainer { private final GuiTab[] tabs = new GuiTab[] { new GuiTabIntroduction(0), new GuiTabBlocks(1), new GuiTabItems(2), new GuiTabGemsAndIngots(3), new GuiTabCurses(4), new GuiTabModifiers(5), new GuiTabRitual(6) }; private GuiTab activeTab; ResourceLocation pageTexture, flippedPageTexture; + + //GUIDE + public static GuiTab prevActive = new GuiTabIntroduction(0); + public static int prevPage = 1; public GuiGuide(Container container, World world, ResourceLocation pageTex, ResourceLocation flipPageTex) { super(container); - page = JewelrycraftMod.prevPage; + page = prevPage; rot = 0; del = 0; this.world = world; - activeTab = JewelrycraftMod.prevActive; + activeTab = prevActive; pageTexture = pageTex; flippedPageTexture = flipPageTex; this.xSize = 240; @@ -93,19 +99,19 @@ public class GuiGuide extends GuiContainer { protected void mouseClicked(int x, int y, int button) { if (nextHover && page + 2 <= activeTab.getMaxPages()) { page += 2; - JewelrycraftMod.prevPage = page; + prevPage = page; } else if (prevHover && page > 1) { page -= 2; - JewelrycraftMod.prevPage = page; + prevPage = page; } activeTab.mouseClick(this, x, y, button); for (GuiTab tab : tabs) if (activeTab != tab) if (tab.inRect(this, x, y)) { activeTab = tab; - JewelrycraftMod.prevActive = tab; + prevActive = tab; page = 1; - JewelrycraftMod.prevPage = page; + prevPage = page; break; } } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTab.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTab.java index 8258cfc..3ef224a 100644 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTab.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTab.java @@ -3,80 +3,32 @@ package darkknight.jewelrycraft.client.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -@SideOnly (Side.CLIENT) -public abstract class GuiTab extends GuiRectangle -{ - protected int values; - protected int del; - - /** - * @param name - * @param id - */ - public GuiTab(int id) - { - super(-62, 10 + 19 * id, 19, 18); - values = 0; - del = 0; - } - - /** - * @return - */ - public String getName() - { - return ""; - } - - /** - * @param gui - * @param x - * @param y - * @param page - */ - public abstract void drawBackground(GuiGuide gui, int x, int y, int page); - - /** - * @param gui - * @param x - * @param y - * @param page - */ - public abstract void drawForeground(GuiGuide gui, int x, int y, int page); - - /** - * @param gui - * @param x - * @param y - * @param button - */ - public void mouseClick(GuiGuide gui, int x, int y, int button) - {} - - /** - * @param gui - * @param x - * @param y - * @param button - * @param timeSinceClicked - */ - public void mouseMoveClick(GuiGuide gui, int x, int y, int button, long timeSinceClicked) - {} - - /** - * @param gui - * @param x - * @param y - * @param button - */ - public void mouseReleased(GuiGuide gui, int x, int y, int button) - {} - - /** - * @return - */ - public int getMaxPages() - { - return 1; - } +@SideOnly(Side.CLIENT) +public abstract class GuiTab extends GuiRectangle { + protected int values; + protected int del; + + public GuiTab(int id) { + super(-62, 10 + 19 * id, 19, 18); + values = 0; + del = 0; + } + + public String getName() { + return ""; + } + + public abstract void drawBackground(GuiGuide gui, int x, int y, int page); + + public abstract void drawForeground(GuiGuide gui, int x, int y, int page); + + public void mouseClick(GuiGuide gui, int x, int y, int button) {} + + public void mouseMoveClick(GuiGuide gui, int x, int y, int button, long timeSinceClicked) {} + + public void mouseReleased(GuiGuide gui, int x, int y, int button) {} + + public int getMaxPages() { + return 1; + } } diff --git a/src/main/java/darkknight/jewelrycraft/util/Variables.java b/src/main/java/darkknight/jewelrycraft/util/Variables.java index 016bd54..fa48bcf 100644 --- a/src/main/java/darkknight/jewelrycraft/util/Variables.java +++ b/src/main/java/darkknight/jewelrycraft/util/Variables.java @@ -6,7 +6,7 @@ public class Variables { public static final String MODID = "jewelrycraft2"; public static final String MODNAME = "Jewelrycraft 2"; - public static final String VERSION = "1.1.0"; + public static final String VERSION = "1.1.1"; public static final String PACKET_CHANNEL = "jewelrycraft2"; public static final String CONFIG_GUI = "darkknight.jewelrycraft.config.ConfigGuiFactory"; -- cgit v1.2.3