Jump to content

Recommended Posts

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

 

Posted

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

 

Posted

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();

Posted

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)

Posted

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

 

 

Posted

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.

 

Posted

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,

 

Posted

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 ?

 

 

Posted

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.

Posted

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...

×   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.

Announcements



×
×
  • Create New...

Important Information

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