
Swirls
Members-
Posts
23 -
Joined
-
Last visited
Everything posted by Swirls
-
I'm just asking for some tips what should I do, and for making topics i will stick to one from nowon
-
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.
-
Oh, that makes sense now, thank you
-
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!
-
Its working after changing from .Pre to .Post, thank you very much for your time!
-
So basically instead of .Pre i would use .Post
-
Sorry, but i dont understand
-
Isnt the event called with event handler?
-
Once again, I've been told on discord that event is called with event handler.
-
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) { } } }
-
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
-
Should i remove it completely?
-
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!
-
I have my event handler, but anyways doesn't seem to be working. Well I will work something out. thank you for your time!
-
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
-
Oh yea, thanks, this might be stupid question but i dont seem to understand where should i call the event?
-
Its not called
-
I need to call it before FMLClientSetupEvent ?
-
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.
-
@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?
-
Exactly what I needed, explained well. Thank you very much for your time!
-
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.