-
Recently Browsing
No registered users viewing this page.
-
Posts
-
By diesieben07 · Posted
The correct event for this check is ClientTickEvent. Make sure to check TickEvent#phase. -
By diesieben07 · Posted
Yeah, it would be better to just lazily initialize the values in the capability. However AttachCapabilitiesEvent is triggered directly from the ItemStack constructor. So it is impossible to have an ItemStack object and not have AttackCapabilitiesEvent fire for it. -
By Beethoven92 · Posted
They are basically the same. With the annotation method you can also specify the Dist where this event handler will be loaded on. What is wrong with your code is that your method is not declared as static. Take a look here for more info on events: https://mcforge.readthedocs.io/en/latest/events/intro/ -
Hey there, I'm trying to setup a basic keybinding, but I can't seem to get the event to fire. Here's my code for subscribing to the event: @Mod.EventBusSubscriber public class ModKeyInputs { @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { if (ModKeyBindings.OPEN_DIVINE_FAVOUR_RELATIONSHIP.isPressed()) { Minecraft.getInstance().displayGuiScreen(new DivineFavourRelationshipsScreen(Minecraft.getInstance().player)); } } } Now I've put a breakpoint in the method there at the start, and I can never get it to fire. Am I subscribing to this event incorrectly? As a side note, is there much difference between using @Mod.EventBusSubscriber on a class versus MOD_EVENT_BUS.register(ModKeyInputs.class); in the constructor of the main mod class?
-
just two maps and two strings. I use json files, so anyone can override them with datapacks. Basically each item, that should have default values, also has a corresponding json file. (if an item does not have a corresponding json file, then it will get default default values.) The information in the files are loaded into a Map<ResourceLocation, DataFromJson> once when the server starts, so i can get them whenever i need them. When the attach event (or the item craft event) trigger i resolve the resourceLocation, get the DataFromJson and then set the itemstack capability. As long as the Map doesn't get humongous, this method shouldn't be a performance issure.
-
-
Topics
-
Who's Online (See full list)