Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Swirls

Members
  • Joined

  • Last visited

Everything posted by Swirls

  1. I'm just asking for some tips what should I do, and for making topics i will stick to one from nowon
  2. Hello, I need help with creating a button subclass, and overriding the relevant method(s). I want to change color of a button, also onHover. I've been told I cant do this with the default Button. Any help would be appreciated, thanks in forward.
  3. Oh, that makes sense now, thank you
  4. Hello, I was wondering if it is possible to change a color of a button added with addWidget method? Also if its possible to change color onHover? event.addWidget(new Button(154, 33, 31, 14, "", new CustomAction())); Thanks!
  5. Its working after changing from .Pre to .Post, thank you very much for your time!
  6. So basically instead of .Pre i would use .Post
  7. Sorry, but i dont understand
  8. Isnt the event called with event handler?
  9. Once again, I've been told on discord that event is called with event handler.
  10. Sure, This is the code after I removed Bus.MOD and changed x,y,height,width of button @Mod.EventBusSubscriber(modid = StudyingMod.MOD_ID, bus = Bus.FORGE, value = Dist.CLIENT) public class SurvivalInventory { @SubscribeEvent public static void addCustomButtonToInventory(GuiScreenEvent.InitGuiEvent.Pre event) { if (event.getGui() instanceof InventoryScreen) { event.addWidget(new Button(154, 33, 31, 14, "test", new CustomAction())); } } public static class CustomAction implements IPressable { public void onPress(Button button) { } } }
  11. Again, it's not working for some reason. I tried changing x, y of the button but didn't help. At this point i really don't know what to do
  12. Should i remove it completely?
  13. Hello there, I added a addWidget method to instance of InventoryScreen but it seems not to work. I don't know what might be causing the issue. Perhaps its my event handler. @Mod.EventBusSubscriber(modid = StudyingMod.MOD_ID, bus = Bus.MOD, value = Dist.CLIENT) public class SurvivalInventory { @SubscribeEvent public static void addCustomButtonToInventory(GuiScreenEvent.InitGuiEvent.Pre event) { if (event.getGui() instanceof InventoryScreen) { event.addWidget(new Button(8, 12, 6, 3, "test", new CustomAction())); } } public static class CustomAction implements IPressable { public void onPress(Button button) { } } } If anyone knows what the issue might be, help would be really appreciated. Thanks in forward!
  14. I have my event handler, but anyways doesn't seem to be working. Well I will work something out. thank you for your time!
  15. Yea, but I've been told i need to call it because at the moment its not working. So people told me to call it
  16. Oh yea, thanks, this might be stupid question but i dont seem to understand where should i call the event?
  17. Its not called
  18. I need to call it before FMLClientSetupEvent ?
  19. Hello, I am making a Inventory Button, but it does not appear in player's inventory. Its maybe I don't have a Button Texture? This is my code: @SubscribeEvent public void addCustomButtonToInventory(GuiScreenEvent.InitGuiEvent.Pre event) { if (event.getGui() instanceof InventoryScreen) { event.addWidget(new Button(64, 98, 112, 93, "Test", new CustomAction())); } } class CustomAction implements IPressable { public void onPress(Button button) { return; } } Any help would be really appreciated, thank you! Thanks.
  20. @Vinyarion, sorry for mentioning you! So when adding widget x, y, width, height, text, is a position of the button in pixels? And what does "text" do? And can I remove CustomAction so i can only test a button without function to it?
  21. Exactly what I needed, explained well. Thank you very much for your time!
  22. Hello, So short story, I am trying to make a button in a player inventory that will lead to a custom GUI. For version 1.12 I think you use `InitGuiEvent`. I've been told i could use method called `addWidget` but I am not sure what event should I use. Any help would be really appreciated. Thanks.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.