Posted October 3, 20178 yr So in my main event handler class (yes the class is subscribed and all my other events work) I have put simple methods to print to console the player main inventory during the PlayerEvent.SaveToFile and PlayerEvent.LoadFromFile events. My code is simply: @EventBusSubscriber public class EventHandler { @SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true) public void onEvent(SaveToFile event) { EntityPlayer thePlayer = event.getEntityPlayer(); InventoryPlayer theInventory = thePlayer.inventory; // DEBUG System.out.println("Saving Player To File With main inventory:"); System.out.println(theInventory.mainInventory); } @SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true) public void onEvent(LoadFromFile event) { EntityPlayer thePlayer = event.getEntityPlayer(); InventoryPlayer theInventory = thePlayer.inventory; // DEBUG System.out.println("Loading Player from File With main inventory:"); System.out.println(theInventory.mainInventory); } } But the console output doesn't ever print out these statements. For example, when saving the game it shows: [21:46:30] [Server thread/INFO]: Saving and pausing game... [21:46:30] [Server thread/INFO]: Saving chunks for level 'Copy of Copy of Really Cool Worl'/overworld [21:46:30] [Server thread/INFO]: Saving chunks for level 'Copy of Copy of Really Cool Worl'/the_nether [21:46:30] [Server thread/INFO]: Saving chunks for level 'Copy of Copy of Really Cool Worl'/the_end [21:46:38] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.MainMod:fmlLifeCycle:227]: Server stopping [21:46:38] [Server thread/INFO]: Stopping server [21:46:38] [Server thread/INFO]: Saving players [21:46:38] [Server thread/INFO]: MistMaestro lost connection: Disconnected [21:46:38] [Server thread/INFO]: MistMaestro left the game [21:46:38] [Server thread/INFO]: Stopping singleplayer server as player logged out [21:46:38] [Server thread/INFO]: Saving worlds [21:46:38] [Server thread/INFO]: Saving chunks for level 'Copy of Copy of Really Cool Worl'/overworld [21:46:38] [Server thread/INFO]: Saving chunks for level 'Copy of Copy of Really Cool Worl'/the_nether [21:46:38] [Server thread/INFO]: Saving chunks for level 'Copy of Copy of Really Cool Worl'/the_end [21:46:38] [Server thread/INFO] [FML]: Unloading dimension 0 [21:46:38] [Server thread/INFO] [FML]: Unloading dimension -1 [21:46:38] [Server thread/INFO] [FML]: Unloading dimension 1 [21:46:38] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.items.fluidcontainers.ItemSlimeBag:initCapabilities:90]: initCapabilities for ItemSlimeBag with NBT = null and Cap NBT = null [21:46:38] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.items.fluidcontainers.ItemSlimeBag:initCapabilities:90]: initCapabilities for ItemSlimeBag with NBT = null and Cap NBT = null [21:46:38] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.items.fluidcontainers.ItemSlimeBag:initCapabilities:90]: initCapabilities for ItemSlimeBag with NBT = null and Cap NBT = null [21:46:38] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.items.fluidcontainers.ItemSlimeBag:initCapabilities:90]: initCapabilities for ItemSlimeBag with NBT = null and Cap NBT = null [21:46:38] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.items.fluidcontainers.ItemSlimeBag:initCapabilities:90]: initCapabilities for ItemSlimeBag with NBT = null and Cap NBT = {} [21:46:38] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.items.fluidcontainers.ItemSlimeBag:getSubItems:117]: Filled bag and adding as sub-item = 1xitem.slime_bag@0 with amount = 1000 [21:46:38] [Server thread/INFO] [FML]: Applying holder lookups [21:46:38] [Server thread/INFO] [FML]: Holder lookups applied [21:46:38] [Server thread/INFO] [STDOUT]: [com.blogspot.jabelarminecraft.examplemod.MainMod:fmlLifeCycle:241]: Server stopped [22:05:56] [main/INFO]: Stopping! [22:05:56] [main/INFO]: SoundSystem shutting down... [22:05:56] [main/WARN]: Author: Paul Lamb, www.paulscode.com As you can see i doesn't show the save to file print statement. However, tracing the call hierarchy, not only should the statement print but it looks like actually the game saves every 45 seconds (in the MinecraftServer tick() method for example) let alone when actually saving. Any reasons why these events might not fire? Edited October 3, 20178 yr by jabelar Check out my tutorials here: http://jabelarminecraft.blogspot.com/
October 3, 20178 yr Author Never mind. I see that I changed to the @EventBusSuscriber annotation but didn't make the handling methods static. Fixed that and it works. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.