Jump to content

Creleb

Members
  • Posts

    9
  • Joined

  • Last visited

Creleb's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Do I do that with @SideOnly.CLIENT or no? I tried adding it but it doesn't seem to work where ever I put. Where would it go?
  2. Hello! I am made an item that uses a random number generator to generate a number, then to test it I made it send a chat message to the player. However, when the item is used, it sends two chat messages, meaning it is generating two numbers. I want it to only generate one; could someone help me? public class QuirkGiver extends ItemBase { public QuirkGiver(String name) { super(name); } public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { ItemStack itemstack = playerIn.getHeldItem(handIn); if (!playerIn.capabilities.isCreativeMode); { itemstack.shrink(1); } int number = ((int) (Math.random()*100))+1; playerIn.sendMessage(new TextComponentString("you got " + number)); return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack); } }
  3. It works now! Thank you so much! My only problem now is actually getting the GUI to display lol. I press the key and it pauses but nothing shows up. I'll work on it and let you know if I have any issues!
  4. wow really? Awesome! anyways you said something about a StackOverflow Exception and that stupid question: wheres the @Mod class and how to I call my register method from it? Could my @Mod class named something different or no?
  5. It's suppose to detect if the "U" key is pressed and display a custom gui screen. I'm 100% positive that its wrong considering that i have done everything else without knowing. package com.Creleb.Mod.util.handlers; import com.Creleb.Mod.client.gui.CustomGui; import com.Creleb.Mod.keys.Keybinds; import net.minecraft.client.Minecraft; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; public class KeyInputHandler { @SubscribeEvent public void onKeyInput (KeyInputEvent event) { if (Keybinds.gui.isPressed()) { Minecraft.getMinecraft().displayGuiScreen(new CustomGui()); } } } Thanks for your help! I know my inexperience is frustrating...if there is a tutorial out there that you know of feel free to let me know because I obviously need it.
  6. okay...so how can I edit it to insert a StackOverflow to get it to work? ?
  7. Well I edited it and I guess I still don't get it. public class Keybinds { public static KeyBinding gui; public static void register() { gui = new KeyBinding("key.gui", Keyboard.KEY_U, "key.categories.mhq"); ClientRegistry.registerKeyBinding(gui); Keybinds.register(); MinecraftForge.EVENT_BUS.register(new KeyInputHandler()); } } Like I said I'm fairly new. I have been trying to lookup tutorials but I haven't found much. I'm sorry if my lack of knowledge is annoying you, but I am learning and I thank you for your help!
  8. I started to try this out but I did not make it far. I tried to get the keybind to appear in the controls but they haven't appeared. I do not know what I did wrong ? package com.Creleb.Mod.keys; import org.lwjgl.input.Keyboard; import com.Creleb.Mod.util.handlers.KeyInputHandler; import net.minecraft.client.settings.KeyBinding; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; public class Keybinds { public static KeyBinding gui; public static void register() { gui = new KeyBinding("key.gui", Keyboard.KEY_U, "key.categories.mhq"); } public static void preInit(FMLPreInitializationEvent event) { Keybinds.register(); MinecraftForge.EVENT_BUS.register(new KeyInputHandler()); } } I don't know if I am missing anything, but if I am let me know.
  9. Hello! I’m fairy new to modding and I need some help with a custom gui. I want to make a gui that pops up when you press the “U” Key but I do not know where to start. Could someone help me?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.