Jump to content

Recommended Posts

Posted

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 :)

Posted

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.

Posted

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 :)

Posted

Did you experiment at all?

 

try setRaining(false)?

 

Look at the where the vanilla used that and see what it changes?

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

The code above is the exact code that vanilla use when the player does the weather thunder command. I've tried using setRaining(false) but if i do also the thunders doesn't spawns :/

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

Posted

The code above is the exact code that vanilla use when the player does the weather thunder command. I've tried using setRaining(false) but if i do also the thunders doesn't spawns :/

 

Are you calling this on the server?

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Posted

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 :)

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.