Jump to content

[1.7.10] Getting an instance of the World


Xcox123

Recommended Posts

renderTileEntityAt extending TileEntitySpecialRenderer. And I'm not sure specifically what world. I know that it has IBlockAccess built into it(thats what I need access to). I'd assume the main world, the one you have as World world in your method params.

Link to comment
Share on other sites

I think you will find IBlockAccess is the the world

the available methods it has might be enough for what you want

if not you might be able to cast it to World to access more methods

 

if you dont know how to find out what class an object is

System.out.println(obj.getClass().getSimpleName());

 

 

Link to comment
Share on other sites

In one of my mods, I needed the same thing in a place called from a method that had a world parameter that it was not kind enough to pass along to me. What I did was trace that method's call chain back to where a static world was being passed in, and I imitated the static reference (I was fortunate that it was public). Amazingly it worked  :)

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

I happen to be in that mod today, so I can show you what I used:

 

   

WorldClient wc = FMLClientHandler.instance ().getWorldClient ();

 

It traces back to Minecraft.theWorld. This is in a @SideOnly(Side.CLIENT) class, so YMMV.

 

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

FYI last time I checked:

 

Server side you can access the worlds from

MinecraftServer.getServer().worldServerForDimension or DimensionManager.getWorld()

 

Client side you can access the world from

Minecraft.theworld

 

See here for an overview of what it looked like in 1.6.4; probably it is still almost the same...

 

http://greyminecraftcoder.blogspot.com.au/2013/10/client-side-class-linkage-map.html

http://greyminecraftcoder.blogspot.com.au/2013/10/server-side-class-linkage-map.html

 

-TGG

 

Link to comment
Share on other sites

See here for an overview of what it looked like in 1.6.4; probably it is still almost the same...

 

http://greyminecraftcoder.blogspot.com.au/2013/10/client-side-class-linkage-map.html

http://greyminecraftcoder.blogspot.com.au/2013/10/server-side-class-linkage-map.html

 

-TGG

 

Wow!  You've got some time on your hands.  Good stuff though!  I'm going to study these when I'm not so tired.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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