Jump to content

[1.12] Getting world time from the server without being passed a world?


naturaGodhead

Recommended Posts

I'm using nbt tags to create a cooldown for an item I made. It works fine in singleplayer when I was getting the minecraft instance and grabbing the world time from there, but obviously that doesn't work on servers. Is there a simple way I can use server side to get the world an item's holder is in? 

Link to comment
Share on other sites

1 minute ago, diesieben07 said:

Just for reference: This does not work in singleplayer either.

 

Every entity has a world reference: Entity#world.

It does work in singleplayer as I've been using it. It's gone this long without being reported because I hadn't used it on a server. How can I get an entity from an item's class?

Link to comment
Share on other sites

2 minutes ago, diesieben07 said:

No, it does not. It will crash eventually, since you are reaching across logical sides.

 

You don't, at least not with a blanket statement like that. Methods that are player-related will get the player passed as a parameter.

"It works" as in it functions without immediately crashing. Obviously I'm trying to fix it, so let's stay on topic. The methods for saving and loading nbt don't accept a player as a parameter, and that's where my issue is, as I need those methods to be completely server side, so I can't grab the world from the client to check the time. 

Link to comment
Share on other sites

5 hours ago, naturaGodhead said:

making a couple of methods

oh-really-do-cbffsw.jpg

  • Haha 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.