Jump to content

[1.8] Change world weather based on events


JimiIT92

Recommended Posts

Is there any chanche to change the weather when an event occurs? For example, i have a tile entity that spawns 4 mobs, then it destroys itself. How can i do to also change the weather to thunder before it disappear (so: it spawns the mob and then it change the weather to thunder)?

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

Use the

setRaining

,

setRainTime

,

setThundering

and

setThunderTime

methods of

WorldInfo

(

World#getWorldInfo

will return the

World

's

WorldInfo

instance). This should be done on the server, the clients will be automatically notified of the change.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Ok, so i've do this

this.worldObj.getWorldInfo().setCleanWeatherTime(0);
			this.worldObj.getWorldInfo().setRainTime(0);
			this.worldObj.getWorldInfo().setThunderTime(12000);
			this.worldObj.getWorldInfo().setRaining(true);
			this.worldObj.getWorldInfo().setThundering(true);

it works, but now i am wondering if there is any way to spawn only thunders (without the rain)

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

i'm calling it from here

if(!this.worldObj.isRemote)
{
this.worldObj.getWorldInfo().setCleanWeatherTime(0);
this.worldObj.getWorldInfo().setRainTime(0);
this.worldObj.getWorldInfo().setThunderTime(12000);
this.worldObj.getWorldInfo().setRaining(true);
this.worldObj.getWorldInfo().setThundering(true);
}

Is it correct? Doing this i have no problem, the weather is changed as well ;) I'm just wondering if there is a way to not spawn the rain (so making the sky darker and make it thundering but without raining). As i said before i tried setting false the setRaining parameter, but if i do it will not change the weather

Don't blame me if i always ask for your help. I just want to learn to be better :)

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.