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.

Featured Replies

Posted

how do i get the name of the world that the player is in

I need this for Client side

Minecraft.getMinecraft().thePlayer.getEntityWorld().getWorldInfo().getWorldName();

does NOT work

 

What do you mean "does NOT work"? What doesn't work? What do you get?

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

try "system.out.println(Minecraft.getMinecraft().thePlayer.getEntityWorld().getWorldInfo().getWorldName();"

 

This will give you the "getWorldName".

  • Author

i did that , thats how i know it dosnt work,

 

the client returns "MpServer"

event though the world name is "Borkland"

 

I tried other single player worlds  they all return the same thing

 

this is for a tracking device and i need the world name during the

public IIcon getIconIndex(ItemStack i)

method, so i can set the icon to what is needed depending on the world

 

Sounds like you want something like "Overworld", or "Nether", or "End" not the actual save name. Am I correct?

 

Try Minecraft.getMinecraft().thePlayer.getEntityWorld().provider.getDimensionName();

  • Author

its the world name that i want , (it happens to be the same name as the folder [usually])

 

You can't possibly expect to know every name for every save and have a different icon for the infinite number of possibilities.

 

What exactly is it you are trying to do and are you sure there isn't a better way to do it? Even if you're not sure if there is, someone here might know a better way than relying on a save name determined by the end user. I'm not sure I understand what you plan to do with the name you receive. (But, how you were trying to get it should have been working)

  • Author

when the item is configured, a location and the name of the world is stored in the nbtcompoundtag

that is done server side, so the name is being stored correctly, this IS NOT the problem, that part works properly

 

when the item is displayed in inventory or in hand, it uses icons similar to the compass (32 of them)

if you are in the world it was configured to it will point to the location it is configured to,

if you are in a different world it will flick about randomly

 

well it would , but i cant get the world name client side while rendering

 

 

when the item is configured, a location and the name of the world is stored in the nbtcompoundtag

that is done server side, so the name is being stored correctly, this IS NOT the problem, that part works properly

 

when the item is displayed in inventory or in hand, it uses icons similar to the compass (32 of them)

if you are in the world it was configured to it will point to the location it is configured to,

if you are in a different world it will flick about randomly

 

well it would , but i cant get the world name client side while rendering

 

 

 

So you are basically trying to save a compass/thing across worlds that holds no data in all worlds except one?

Why not do the opposite, instead of trying to get names of saves, just set a boolean on the configured world to true and save that on the server. And if you're trying to share the item, e.g. pass it along with the player the same logic applies.

 

Example: The player can take a compass on him to different saves. To do so you set a textfile that reads the playername and that he has a compass on him(or whatever other method you want to use to do this). Since the player needs to have the itemstack on him to take it with him he'll need to have it in his inventory. When exiting the save, save to the file the playername and the unique id's of each itemstack of that particular item. On loading, simply check whether the inventory of the player has those items with those id's and if he doesn't create those. And simply don't care about the configured thing. If it is, it'll read it from the server automatically and if isn't it'll be set to false on that particular server.

 

Well, there might be easier ways, that what I came up with on the top of my head just now.

 

  • Author

NO I am saving the data in the ItemStack NBTCompoundTag

I am NOT trying to get it to work across different game saves

 

here is a scenario

I have a game running with multiple worlds

world1) name: mainland                  type: normal Overworld

world2) name: mainland_nether    type: normal nether

world3) name: mainland_the_end  type: normal end

world4) name: flatland                    type: flat Overworld

world5) name: loonyland                type: Amplified Overworld

world6) name: expanse                  type: LargeBiome Overworld

 

I have one of the tracker devices set to track  location (world= loonyland x=1735.5 z=-456)

when im in the loonyland world the device is surposed to points to the marked location

when im in any other world it randomly flicks around

 

the problem i am facing is that when rendering the screen i cannot tell which world i am in,

 

  • Author

I'm not worried about multiplayer servers at this time, but i dont see any reason it should be a problem

 

yes i did know that single player runs a server

 

custom packet , yes looks like that will be the easiest solution, though knowing when to send them could be problematic, but doable

 

"save name can change" ,

this is how i have been getting the world name

@Override
public ItemStack onItemRightClick(ItemStack i, World w, EntityPlayer p) {
	String wn=w.getWorldInfo().getWorldName());
                ...
}

 

do worlds have a UUID ?

 

 

NO I am saving the data in the ItemStack NBTCompoundTag

I am NOT trying to get it to work across different game saves

 

here is a scenario

I have a game running with multiple worlds

world1) name: mainland                  type: normal Overworld

world2) name: mainland_nether    type: normal nether

world3) name: mainland_the_end  type: normal end

world4) name: flatland                    type: flat Overworld

world5) name: loonyland                type: Amplified Overworld

world6) name: expanse                  type: LargeBiome Overworld

 

I have one of the tracker devices set to track  location (world= loonyland x=1735.5 z=-456)

when im in the loonyland world the device is surposed to points to the marked location

when im in any other world it randomly flicks around

 

the problem i am facing is that when rendering the screen i cannot tell which world i am in,

 

Just to point out but those aren't worlds. Those are dimensions. Quite a different thing, so it is quite normal that we misunderstood you, especially when you were trying to get names on folders and such.

 

Dimensions each have ids. Save those to the item and you're done.

 

player.dimension
player.worldObj.provider.dimensionId
world.provider.dimensionId

 

And if this is still not what you're looking for well, either you're on the wrong forum for the wrong game or I have completely lost you.

  • Author

sorry, im used to bukkit (been using it for years), in which they are called worlds, and i have only been using forge for about 3 weeks

 

why couldnt they have named things the same

 

 

 

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.