Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Client-side server world info
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
Abattoir

Client-side server world info

By Abattoir, December 29, 2020 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Abattoir    0

Abattoir

Abattoir    0

  • Tree Puncher
  • Abattoir
  • Members
  • 0
  • 6 posts
Posted December 29, 2020

Hello.

 

I would like to create an 1.16.4 client-side mod which can store per-world info but I don’t know how can I get any unique info about a world in a server?

I only found the dimension but I would like to add multiworld support so I have to distinguish the worlds.


Thanks for your answer.

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7696

diesieben07

diesieben07    7696

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7696
  • 56376 posts
Posted December 30, 2020

The client will get a hash of the server's seed, you can use that.

  • Quote

Share this post


Link to post
Share on other sites

Abattoir    0

Abattoir

Abattoir    0

  • Tree Puncher
  • Abattoir
  • Members
  • 0
  • 6 posts
Posted January 24

I don’t find that method.

Can you please explain it more how can I get the server world seed from my client-side mod?

Thanks!

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7696

diesieben07

diesieben07    7696

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7696
  • 56376 posts
Posted January 24
21 minutes ago, Abattoir said:

Can you please explain it more how can I get the server world seed from my client-side mod?

You cannot get the server world seed. The client receives a hashed seed (BiomeManager.getHashedSeed), which you can use for identification purposes.

The only way to get this hashed seed is first World#getBiomeManager and then BiomeManager#seed (you'll need reflection for the latter).

  • Quote

Share this post


Link to post
Share on other sites

Abattoir    0

Abattoir

Abattoir    0

  • Tree Puncher
  • Abattoir
  • Members
  • 0
  • 6 posts
Posted January 25 (edited)

I found that on some servers (like Hypixel) the seed is 0.

What can cause this? Is there any other way to identify the world?

 

Code:

@SubscribeEvent
public static void onPlayerJoin(EntityJoinWorldEvent event) {
    if (Minecraft.getInstance().player == null || event.getEntity() != Minecraft.getInstance().player) {
        return;
    }

    BiomeManager biomeManager = Minecraft.getInstance().player.getEntityWorld().getBiomeManager();
    Long seed = ObfuscationReflectionHelper.getPrivateValue(BiomeManager.class, biomeManager, "field_226833_b_");

    if (seed == null) {
        return;
    }

    System.out.println("SEED: " + seed); // DEBUG
}
Edited January 25 by Abattoir
  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7696

diesieben07

diesieben07    7696

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7696
  • 56376 posts
Posted January 25
44 minutes ago, Abattoir said:

I found that on some servers (like Hypixel) the seed is 0.

What can cause this?

Then the server doesn't send the hashed seed.

 

45 minutes ago, Abattoir said:

Is there any other way to identify the world?

You can use the server IP, I guess.

 

45 minutes ago, Abattoir said:

 


@SubscribeEvent
public static void onPlayerJoin(EntityJoinWorldEvent event) {
    if (Minecraft.getInstance().player == null || event.getEntity() != Minecraft.getInstance().player) {
        return;
    }

    BiomeManager biomeManager = Minecraft.getInstance().player.getEntityWorld().getBiomeManager();
    Long seed = ObfuscationReflectionHelper.getPrivateValue(BiomeManager.class, biomeManager, "field_226833_b_");

    if (seed == null) {
        return;
    }

    System.out.println("SEED: " + seed); // DEBUG
}
  • ClientPlayerNetworkEvent.LoggedInEvent woudl be a much better choice here.
  • Do not use getPrivateValue. Use findField and store the Field in a static final field.
  • Quote

Share this post


Link to post
Share on other sites

Abattoir    0

Abattoir

Abattoir    0

  • Tree Puncher
  • Abattoir
  • Members
  • 0
  • 6 posts
Posted January 25 (edited)

I found a mod called Xaero's Minimap which can store waypoints per world.

 

reC4NtI.png

 

Do you know how can it recognise the server worlds or it uses a custom method?

Edited January 25 by Abattoir
  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7696

diesieben07

diesieben07    7696

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7696
  • 56376 posts
Posted January 25

It uses the server IP I'm guessing.

  • Quote

Share this post


Link to post
Share on other sites

Abattoir    0

Abattoir

Abattoir    0

  • Tree Puncher
  • Abattoir
  • Members
  • 0
  • 6 posts
Posted January 29

Okay.

And what can I do with singleplayer worlds?

They have any unique thing I can get?

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • JayNeedsHelp
      Logger not working

      By JayNeedsHelp · Posted 5 minutes ago

      So I'm currently creating a forge mod and I'm having an issue where the console stops logging after some errors. It seems to be connected to the access transformers that I'm using as before I added at's my console was working fine.   Here is my at file:  public-f net.minecraft.client.Minecraft session public net.minecraft.client.Minecraft timer public net.minecraft.client.gui.GuiScreen buttonList public net.minecraft.util.Timer tickLength public net.minecraft.network.play.client.CPacketPlayer onGround public net.minecraft.network.play.server.SPacketEntityVelocity motionX public net.minecraft.network.play.server.SPacketEntityVelocity motionY public net.minecraft.network.play.server.SPacketEntityVelocity motionZ public net.minecraft.network.play.server.SPacketExplosion motionX public net.minecraft.network.play.server.SPacketExplosion motionY public net.minecraft.network.play.server.SPacketExplosion motionZ public net.minecraft.client.renderer.entity.RenderManager renderPosX public net.minecraft.client.renderer.entity.RenderManager renderPosY public net.minecraft.client.renderer.entity.RenderManager renderPosZ   Any help is greatly appreciated thank you!
    • cadbane86140
      Minecraft: Hunger Games Game #36- Shear FIGHT!

      By cadbane86140 · Posted 1 hour ago

      Hello There! Today we are back on Hunger Games after a little break but we are finally back! In this episode we are on the good ol' map Survival Games 4 and it ACTUALLY went well for once. Also we have so many great battles on rooftops, small rooms and just out in the open! We also use shears to fight at one point and that was pretty crazy! There are so many hilarious moments in this episode that I know you guys are gonna love! I hope you all enjoy this video and if you did don't forget to like and sub for more Hunger Games in the future!  
    • Sad Whale
      Game crashes whenever I try to increase the RAM

      By Sad Whale · Posted 1 hour ago

      latest.log
    • diesieben07
      Game crashes whenever I try to increase the RAM

      By diesieben07 · Posted 1 hour ago

      In the logs folder of your game directory.
    • Unusualty
      GUI'S and player editing

      By Unusualty · Posted 2 hours ago

      So I'm trying to make a mod that is inspired by Origin's because this mod isn't for forge I was wondering if anyone can help me do something like this where you get a GUI when you join the world where you can select a race that has abilities and down sides to them, I also want to have classes but first I want these race's done so if anyone can help this would be appreciated.
  • Topics

    • JayNeedsHelp
      0
      Logger not working

      By JayNeedsHelp
      Started 7 minutes ago

    • cadbane86140
      0
      Minecraft: Hunger Games Game #36- Shear FIGHT!

      By cadbane86140
      Started 1 hour ago

    • Sad Whale
      6
      Game crashes whenever I try to increase the RAM

      By Sad Whale
      Started 2 hours ago

    • Unusualty
      0
      GUI'S and player editing

      By Unusualty
      Started 2 hours ago

    • fluiX
      1
      server wont start

      By fluiX
      Started 3 hours ago

  • Who's Online (See full list)

    • Lyon
    • JayNeedsHelp
    • PyRoTheLifeLess
    • _Traficantefav_
    • Beethoven92
    • matezz
    • NullDev
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Client-side server world info
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community