Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[SOLVED] [1.12.2] Modifying player capabilities for offline players?


Differentiation
 Share

Recommended Posts

How is JSON applicable at all here? Capabilities use NBT...

You can probably do something similar to what SaveHandler#readPlayerData does. You can't use it directly, because it requires an EntityPlayerMP. Then you can modify the data and save it back. Note however that you need to take to only do this if the player isn't logged in or your changes will go away.

Link to comment
Share on other sites

3 hours ago, diesieben07 said:

How is JSON applicable at all here? Capabilities use NBT...

You can probably do something similar to what SaveHandler#readPlayerData does. You can't use it directly, because it requires an EntityPlayerMP. Then you can modify the data and save it back. Note however that you need to take to only do this if the player isn't logged in or your changes will go away.

I mean, it isn't necessarily capabilities that I'm trying to store, it's just raw data (some boolean, integer variables, etc.) and that's what I meant by using JSON.

 

So the way I currently do it is make a temporary entry in my JSON file for offline player. Then when they log on, I move the values to NBT (the player capability class) and remove the JSON entry.

Edited by Differentiation
Link to comment
Share on other sites

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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • This a problem with the Theabyss (The Abyss?) mod. Make sure you have the latest version then contact the author.
    • This is an issue with JEI make sure you have latest version for 1.16.5 then contact the author.
    • I checked my list of mod and immersive portal wasn't even installed.    
    • Look at your image. You are showing  /Applications/Minecraft/Contents/mods Your mods folder is Take a screenshot of the contents of second one. Although we can guess, you have been downloading your mods into the first folder when you should be putting them in the second one.  
    • I play the world yesterday and it was fine, upon loading it today it crashed ╥_╥. Pls help.  [main/ERROR]: Exception caught during firing event: null     Index: 6     Listeners:         0: HIGH         1: ASM: class me.shedaniel.architectury.event.forge.EventHandlerImplClient event(Lnet/minecraftforge/client/event/RecipesUpdatedEvent;)V         2: NORMAL         3: ASM: class owmii.lib.client.wiki.Wiki collect(Lnet/minecraftforge/client/event/RecipesUpdatedEvent;)V         4: ASM: class com.blamejared.crafttweaker.impl.events.CTStateEventHandler onRecipesUpdated(Lnet/minecraftforge/client/event/RecipesUpdatedEvent;)V         5: ASM: mekanism.client.ClientTickHandler@43d9842f recipesUpdated(Lnet/minecraftforge/client/event/RecipesUpdatedEvent;)V         6: net.minecraftforge.eventbus.EventBus$$Lambda$2959/736640638@6d07c39b java.util.ConcurrentModificationException     at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)     at java.util.ArrayList$Itr.next(ArrayList.java:851)     at mezz.jei.load.PluginCaller.callOnPlugins(PluginCaller.java:21)     at mezz.jei.load.PluginLoader.<init>(PluginLoader.java:109)     at mezz.jei.startup.JeiStarter.start(JeiStarter.java:69)     at mezz.jei.startup.ClientLifecycleHandler.startJEI(ClientLifecycleHandler.java:147)     at mezz.jei.startup.ClientLifecycleHandler.setupJEI(ClientLifecycleHandler.java:140)     at mezz.jei.startup.ClientLifecycleHandler.lambda$new$3(ClientLifecycleHandler.java:106)     at mezz.jei.startup.ClientLifecycleHandler$$Lambda$29176/1547335276.accept(Unknown Source)     at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:247)     at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:239)     at net.minecraftforge.eventbus.EventBus$$Lambda$2959/736640638.invoke(Unknown Source)     at net.minecraftforge.eventbus.EventBus$$Lambda$3273/1859299978.invoke(Unknown Source)     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302)     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283)     at net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(ForgeHooksClient.java:772)     at net.minecraft.client.network.play.ClientPlayNetHandler.func_199525_a(ClientPlayNetHandler.java:1314)     at net.minecraft.network.play.server.SUpdateRecipesPacket.func_148833_a(SourceFile:27)     at net.minecraft.network.play.server.SUpdateRecipesPacket.func_148833_a(SourceFile:15)     at net.minecraft.network.PacketThreadUtil.func_225383_a(SourceFile:21)     at net.minecraft.network.PacketThreadUtil$$Lambda$34638/1869809823.run(Unknown Source)     at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213166_h(SourceFile:144)     at net.minecraft.util.concurrent.RecursiveEventLoop.func_213166_h(SourceFile:23)     at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213168_p(SourceFile:118)     at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213160_bf(SourceFile:103)     at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:948)     at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607)     at net.minecraft.client.main.Main.main(Main.java:184)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:497)     at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:37)     at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$502/1391735333.call(Unknown Source)     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54)     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72)     at cpw.mods.modlauncher.Launcher.run(Launcher.java:82)     at cpw.mods.modlauncher.Launcher.main(Launcher.java:66)  [main/FATAL]: Error executing task on Client java.util.ConcurrentModificationException: null     at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) ~[?:1.8.0_51]     at java.util.ArrayList$Itr.next(ArrayList.java:851) ~[?:1.8.0_51]     at mezz.jei.load.PluginCaller.callOnPlugins(PluginCaller.java:21) ~[?:7.7.1.152]     at mezz.jei.load.PluginLoader.<init>(PluginLoader.java:109) ~[?:7.7.1.152]     at mezz.jei.startup.JeiStarter.start(JeiStarter.java:69) ~[?:7.7.1.152]     at mezz.jei.startup.ClientLifecycleHandler.startJEI(ClientLifecycleHandler.java:147) ~[?:7.7.1.152]     at mezz.jei.startup.ClientLifecycleHandler.setupJEI(ClientLifecycleHandler.java:140) ~[?:7.7.1.152]     at mezz.jei.startup.ClientLifecycleHandler.lambda$new$3(ClientLifecycleHandler.java:106) ~[?:7.7.1.152]     at mezz.jei.startup.ClientLifecycleHandler$$Lambda$29176/1547335276.accept(Unknown Source) ~[?:?]     at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:247) ~[eventbus-4.0.0.jar:?]     at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:239) ~[eventbus-4.0.0.jar:?]     at net.minecraftforge.eventbus.EventBus$$Lambda$2959/736640638.invoke(Unknown Source) ~[?:?]     at net.minecraftforge.eventbus.EventBus$$Lambda$3273/1859299978.invoke(Unknown Source) ~[?:?]     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?]     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?]     at net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(ForgeHooksClient.java:772) ~[?:?]     at net.minecraft.client.network.play.ClientPlayNetHandler.func_199525_a(ClientPlayNetHandler.java:1314) ~[?:?]     at net.minecraft.network.play.server.SUpdateRecipesPacket.func_148833_a(SourceFile:27) ~[?:?]     at net.minecraft.network.play.server.SUpdateRecipesPacket.func_148833_a(SourceFile:15) ~[?:?]     at net.minecraft.network.PacketThreadUtil.func_225383_a(SourceFile:21) ~[?:?]     at net.minecraft.network.PacketThreadUtil$$Lambda$34638/1869809823.run(Unknown Source) ~[?:?]     at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213166_h(SourceFile:144) [?:?]     at net.minecraft.util.concurrent.RecursiveEventLoop.func_213166_h(SourceFile:23) [?:?]     at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213168_p(SourceFile:118) [?:?]     at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213160_bf(SourceFile:103) [?:?]     at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:948) [?:?]     at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607) [?:?]     at net.minecraft.client.main.Main.main(Main.java:184) [?:?]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51]     at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51]     at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:37) [forge-1.16.5-36.2.35.jar:36.2]     at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$502/1391735333.call(Unknown Source) [forge-1.16.5-36.2.35.jar:36.2]     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.1.3.jar:?]     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.1.3.jar:?]     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.1.3.jar:?]     at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.1.3.jar:?]     at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.1.3.jar:?]
  • Topics

×
×
  • Create New...

Important Information

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