Jump to content

[1.15.2] Saving player position data


QuantumSoul

Recommended Posts

Hi,

I need to save player coordinates when they teleport into my dimension so I can use them to send them back.

I have two questions:

1. Should I save the data in the player or the world ?

2. What data saving should I use, Capabilities, World Saved Data or another one ?

 

Thanks in advance

Edited by QuantumSoul
Link to comment
Share on other sites

You should try to use Capabilities if possible. Personally, I would associate that data with the world/dimension, considering the following scenario:

  • The player switches dimensions
  • The dimension gets deleted, for some reason
    • If the position was stored with the player, the player might die upon switching back
    • If the position was stored with the dimension, you can treat it as if it is the first time any switching occured

Have you ever want the new operator to return a type that you didn't ask for? Well, now you can!

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • What is that in my files?
    • Hi! I tried the above method, but it did not work. There's my function. The message appears in the chat, but the item is not added to the inventory. I can’t figure out what the problem is, so please help. @SubscribeEvent public void onJoin(EntityJoinLevelEvent event) { if (event.getEntity() instanceof Player && event.getEntity().getCommandSenderWorld().isClientSide) { Minecraft.getInstance().player.getInventory().add(new ItemStack(Items.CARROT)); Entity playerEntity = event.getEntity(); playerEntity.sendSystemMessage(Component.nullToEmpty("Hello!")); } }  
    • Hi guys ! New around here.So my problem is,I'm trying to play modded minecraft with my gf.We played on lan perfectly.But when we try to make a server for hamachi,It displays an error message.   [08Haz2023 18:30:33.491] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--launchTarget, forgeserver, --fml.forgeVersion, 43.2.8, --fml.mcVersion, 1.19.2, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20220805.130853] [08Haz2023 18:30:33.497] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.8+10.0.8+main.0ef7e830 starting: java version 19.0.1 by Oracle Corporation; OS Windows 10 arch amd64 version 10.0 [08Haz2023 18:30:33.798] [main/INFO] [optifine.OptiFineTransformationService/]: OptiFineTransformationService.onLoad [08Haz2023 18:30:33.799] [main/INFO] [optifine.OptiFineTransformationService/]: OptiFine ZIP file URL: union:/C:/Users/user/Desktop/Yeni%20klasör/mods/OptiFine-OptiFine-1.19.2_HD_U_I1.jar%23118!/ [08Haz2023 18:30:33.848] [main/INFO] [optifine.OptiFineTransformationService/]: OptiFine ZIP file: C:\Users\user\Desktop\Yeni klasör\mods\OptiFine-OptiFine-1.19.2_HD_U_I1.jar [08Haz2023 18:30:33.850] [main/INFO] [optifine.OptiFineTransformer/]: Target.PRE_CLASS is available [08Haz2023 18:30:33.916] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/C:/Users/user/Desktop/Yeni%20klasör/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar%2363!/ Service=ModLauncher Env=SERVER [08Haz2023 18:30:33.927] [main/INFO] [optifine.OptiFineTransformationService/]: OptiFineTransformationService.initialize [08Haz2023 18:30:34.282] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\user\Desktop\Yeni klasör\libraries\net\minecraftforge\fmlcore\1.19.2-43.2.8\fmlcore-1.19.2-43.2.8.jar is missing mods.toml file [08Haz2023 18:30:34.287] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\user\Desktop\Yeni klasör\libraries\net\minecraftforge\javafmllanguage\1.19.2-43.2.8\javafmllanguage-1.19.2-43.2.8.jar is missing mods.toml file [08Haz2023 18:30:34.291] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\user\Desktop\Yeni klasör\libraries\net\minecraftforge\lowcodelanguage\1.19.2-43.2.8\lowcodelanguage-1.19.2-43.2.8.jar is missing mods.toml file [08Haz2023 18:30:34.296] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\user\Desktop\Yeni klasör\libraries\net\minecraftforge\mclanguage\1.19.2-43.2.8\mclanguage-1.19.2-43.2.8.jar is missing mods.toml file [08Haz2023 18:30:34.386] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator/]: No dependencies to load found. Skipping! [08Haz2023 18:30:35.056] [main/INFO] [optifine.OptiFineTransformationService/]: OptiFineTransformationService.transformers [08Haz2023 18:30:35.063] [main/INFO] [optifine.OptiFineTransformer/]: Targets: 386 [08Haz2023 18:30:35.557] [main/INFO] [optifine.OptiFineTransformationService/]: additionalClassesLocator: [optifine., net.optifine.] [08Haz2023 18:30:35.906] [main/INFO] [mixin/]: Compatibility level set to JAVA_17 [08Haz2023 18:30:35.953] [main/ERROR] [mixin/]: Mixin config rottencreatures-common.mixins.json does not specify "minVersion" property [08Haz2023 18:30:35.957] [main/ERROR] [mixin/]: Mixin config rottencreatures.mixins.json does not specify "minVersion" property [08Haz2023 18:30:36.099] [main/INFO] [mixin/]: Successfully loaded Mixin Connector [org.tlauncher.MixinConnector] [08Haz2023 18:30:36.101] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'forgeserver' with arguments [] [08Haz2023 18:30:36.122] [main/WARN] [mixin/]: Reference map '${refmap_target}refmap.json' for corgilib.forge.mixins.json could not be read. If this is a development environment you can ignore this message [08Haz2023 18:30:36.139] [main/WARN] [mixin/]: Reference map 'rottencreatures-forge-refmap.json' for rottencreatures.mixins.json could not be read. If this is a development environment you can ignore this message [08Haz2023 18:30:36.565] [main/ERROR] [net.minecraftforge.fml.loading.RuntimeDistCleaner/DISTXFORM]: Attempted to load class net/minecraft/client/gui/screens/Screen for invalid dist DEDICATED_SERVER [08Haz2023 18:30:36.566] [main/WARN] [mixin/]: Error loading class: net/minecraft/client/gui/screens/TitleScreen (java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/screens/Screen for invalid dist DEDICATED_SERVER) [08Haz2023 18:30:36.566] [main/WARN] [mixin/]: @Mixin target net.minecraft.client.gui.screens.TitleScreen was not found tlskincape-mixins.json:MixinMainMenu [08Haz2023 18:30:36.581] [main/WARN] [mixin/]: Error loading class: net/minecraft/client/model/PlayerModel (java.lang.ClassNotFoundException: net.minecraft.client.model.PlayerModel) [08Haz2023 18:30:36.582] [main/WARN] [mixin/]: @Mixin target net.minecraft.client.model.PlayerModel was not found tlskincape-mixins.json:MixinPlayerModel   that's from logs folder.
    • LivingAttackEvent is called inside the hurt function of LivingEntity. this means that whenever a living entity is attacked, forge will create an instance of new LivingAttackEvent and hand it to all subscribed functions 
    • ok after quitting and restarting I now get this crash report  
  • Topics

×
×
  • Create New...

Important Information

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