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.

[1.12.1] [Solved]Not seeing PlayerEvent.SaveToFile or LoadFromFile firing

Featured Replies

Posted

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 by jabelar

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.