Jump to content

edma0

Members
  • Posts

    4
  • Joined

  • Last visited

edma0's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Just updated to 25.0.108 to ensure the issue had not already been resolved. Ah, yeah if the logic is similar to BlockEvent.BreakEvent then I think I see the issue. There is a function with the following signature commented out with the task: /* TODO: Talk to Sponge folk about World rollbacks. @line 602 of net.minecraftforge.common.ForgeHooks.class public static EnumActionResult onPlaceItemIntoWorld(@Nonnull ItemUseContext context) In this function (that is now commented out) it seems the BlockEvent.PlaceEvent was generated and a call to ForgeEventFactory.onPlayerBlockPlaced event was made. Edit: Yeah it seems to be an open issue on the issue tracker, kicking myself for missing it. https://github.com/MinecraftForge/MinecraftForge/issues/5476
  2. Thank you for your suggestion, I took your advice looked into the @Mod.EventBusSubscriber annotation. That will make things very neat, I am glad I looked into it further, awesome tip. I have implemented the change but I am still having no luck with BlockEvent.PlaceEvent. It just isn't firing, but is registered in an identical fashion to BlockEvent.BreakEvent. However BlockEvent.BreakEvent is working perfectly. So I am singling out these two events as they are registered in the same way, but one works and the other does not. Here is the code, in the Main mod class I have explicitly assigned the value and bus fields of the annotation to be on the safe side (rather than leaving them as default):
  3. One way would be: 1. Register a class instance with the Forge Event Bus (in server proxy) MinecraftForge.EVENT_BUS.register(MyClassWithSubscribedMethods.instance); 2. Subscribe to the EntityJoinWorldEvent in that class 3. Check if the entity is an instance of EntityPlayer 4. If it is, then read/write a value to the entity data to check/mark when they have FIRST joined the server 5. use World.spawnEntityInWorld to spawn the item or World.setBlockState to spawn the block. I'm relatively new to modding, but this is how I would tackle the problem at this point.
  4. Thanks in advance for pointing me in the right direction here! What is happening? I'm updating my mod from 1.10.2 to 1.13.2 and everything is working as expected except for the events. Some are working perfectly and others are never fired. I have commented the resulting behaviour in the below code. I've likely missed something pretty obvious and would really appreciate any help. How are you checking if the event is firing? I'm running the debug configuration for both client only and server + client, placing breakpoints and stepping through the code. What version of Forge are you working with? forge-1.13.2-25.0.107-mdk The code I am using to reproduce the issue: First, in the main mod class, I register the EventsCommon class instance and call the proxy to register the others. In the main mod class: EventsCommon: Then in the ClientProxy and ServerProxy hookEvents method, I register the EventsClient and EventsServer respectively. CommonProxy: ClientProxy: ServerProxy: Finally, the EventsClient and EventsServer classes. The EventsCommon class is posted above: EventsClient: EventsServer:
×
×
  • Create New...

Important Information

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