Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-17 05:20:05 +01:00
Added weather control methods.
Dieser Commit ist enthalten in:
Ursprung
6739d6d75c
Commit
c3ce6ce3ab
@ -363,7 +363,6 @@ public class CraftWorld implements World {
|
|||||||
return creature;
|
return creature;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public LightningStrike strikeLightning(Location loc) {
|
public LightningStrike strikeLightning(Location loc) {
|
||||||
EntityWeatherStorm lightning = new EntityWeatherStorm(world, loc.getX(), loc.getY(), loc.getZ());
|
EntityWeatherStorm lightning = new EntityWeatherStorm(world, loc.getX(), loc.getY(), loc.getZ());
|
||||||
world.a(lightning);
|
world.a(lightning);
|
||||||
@ -549,4 +548,27 @@ public class CraftWorld implements World {
|
|||||||
// Saves all chunks/regions
|
// Saves all chunks/regions
|
||||||
world.chunkProvider.saveChunks(true, null);
|
world.chunkProvider.saveChunks(true, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasStorm() {
|
||||||
|
return world.worldData.l();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStorm(boolean hasStorm) {
|
||||||
|
world.worldData.b(hasStorm);
|
||||||
|
|
||||||
|
// These numbers are from Minecraft
|
||||||
|
if (hasStorm) {
|
||||||
|
setWeatherDuration(rand.nextInt(12000) + 12000);
|
||||||
|
} else {
|
||||||
|
setWeatherDuration(rand.nextInt(168000) + 12000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWeatherDuration() {
|
||||||
|
return world.worldData.m();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeatherDuration(int duration) {
|
||||||
|
world.worldData.c(duration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren