Posted August 6, 201312 yr Hello! The GUI i made is pausing the game(causing bugs) And i cant figure out how to make it stop pausing. GUI code: package mod.gmod622.gui; import java.util.Random; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiIngameMenu; import net.minecraft.client.gui.GuiScreen; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentData; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class GUIenchanter extends GuiScreen { private World worldMC; private EntityPlayer entityP; private Minecraft mineC; public static double rand; private static Random random = new Random(); public GUIenchanter(World world, EntityPlayer entityplayer, Minecraft minecraft) { worldMC = world; entityP = entityplayer; mineC = minecraft; } public void initGui() { buttonList.add(new GuiButton(0, width / 2 - 50, height / 2 - 50, 200, 20, "Random Enchanted Book (30 lvls)")); } protected void actionPerformed(GuiButton guiButton) { if(guiButton.id == 0) { if(entityP.experienceLevel >= 30) { EnchantedBook(entityP); entityP.experienceLevel -= 30; } } } public static void EnchantedBook(EntityPlayer par3EntityPlayer) { Enchantment enchantment = Enchantment.enchantmentsBookList[random.nextInt(Enchantment.enchantmentsBookList.length)]; ItemStack itemstack = new ItemStack(Item.enchantedBook.itemID, 1, 0); int l = MathHelper.getRandomIntegerInRange(random, enchantment.getMinLevel(), enchantment.getMaxLevel()); Item.enchantedBook.getEnchantedItemStack_do(itemstack, new EnchantmentData(enchantment, l)); par3EntityPlayer.inventory.addItemStackToInventory(itemstack); } } Not new to java >> New to modding.
August 6, 201312 yr The gui class contains a method to set if you want your gui to pause the game or not, the method looks like this public boolean doesGuiPauseGame() { return true; } Just copy and paste that method into your gui file and change the value from true to false, and you should be all good.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.