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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Back then there was a number which determined the tier of an item and block. If the block tier is lower or equal to the item number, the block would be mined. this however, has changed and now it goes by "needs_netherite_tool" which is fine, until you realized that some mods had items and blocks that exceeded these values. You can make you own "needs_mod_tool" but I feel that this is more limiting(and just more work) than before. So is there anyway to use something similar to the old tier system while also still being compatible with a lot of other mod tools?
    • Well, when I log in to the server, sometimes within an hour, sometimes within a minute, the server closes and informs me that there was a Ticking entity error. Below is the crash report
    • This forum is for Forge, not NeoForge. Please go to them for support.
    • Forge version: 55.0.0 Minecraft version: 1.21.5 Downloads: As this is the start of a new version, it is recommended that you check the downloads page and use the latest version to receive any bug fixes. Downloads page Intro: Good evening! Today, we have released our initial build of Forge 55.0 for Minecraft 1.21.5. 1.21.5 is the newest member of the 1.21 family of versions, which was released yesterday on March 25, 2025. As a reminder, the first minor (X.0) of a Forge version is a beta. Forge betas are marked as such on the bottom left of the title screen and are candidates for any breaking changes. Additionally, there are a couple of important things to note about this update, which I've made sure to mention in this post as well. Feel free to chat with us about bugs or these implementation changes on GitHub and in our Discord server. As always, we will continue to keep all versions of 1.21 and 1.20 in active support as covered by our tiered support policy. Cheers, happy modding, and good luck porting! Rendering Refactor For those who tuned in to Minecraft Live on March 22, 2025, you may already know that Mojang have announced their intention to bring their new Vibrant Visuals overhaul to Java in the future. They've taken the first steps toward this by refactoring how rendering pipelines and render types are handled internally. This has, in turn, made many of Forge's rendering APIs that have existed for years obsolete, as they (for the most part) can be done directly in vanilla. If there was a rendering API that was provided by Forge which you believe should be re-implemented, we're happy to discuss on GitHub through an issue or a pull request. Deprecation of weapon-like ToolActions In 1.21.5, Minecraft added new data components for defining the characteristics of weapons in data. This includes attack speed, block tags which define efficient blocks, and more. As such, we will begin marking our ToolActions solution for this as deprecated. ToolActions were originally added to address the problem of creating modded tools that needed to perform the same actions as vanilla tools. There are still a few tool actions that will continue to be used, such as the shears tool action for example. There are some existing Forge tool actions that are currently obsolete and have no effect given the way the new data components are implemented. We will continue to work on these deprecations and invite you to chat with us on GitHub or Discord if you have any questions.
  • Topics

×
×
  • Create New...

Important Information

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