public abstract class WorldProvider
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
WorldProvider.WorldSleepResult |
Modifier and Type | Field and Description |
---|---|
protected BiomeProvider |
biomeProvider
World chunk manager being used to generate chunks
|
protected boolean |
doesWaterVaporize
States whether the Hell world provider is used(true) or if the normal world provider is used(false)
|
protected boolean |
hasSkyLight |
protected float[] |
lightBrightnessTable
Light to brightness conversion table
|
static float[] |
MOON_PHASE_FACTORS |
protected boolean |
nether
Whether this dimension should be treated as the nether.
|
protected World |
world
world object being used
|
Constructor and Description |
---|
WorldProvider() |
Modifier and Type | Method and Description |
---|---|
float[] |
calcSunriseSunsetColors(float celestialAngle,
float partialTicks)
Returns array with sunrise/sunset colors
|
float |
calculateCelestialAngle(long worldTime,
float partialTicks)
Calculates the angle of sun and moon in the sky relative to a specified time (usually worldTime)
|
void |
calculateInitialWeather() |
boolean |
canBlockFreeze(BlockPos pos,
boolean byWater) |
boolean |
canCoordinateBeSpawn(int x,
int z)
Will check if the x, z position specified is alright to be set as the map spawn point
|
boolean |
canDoLightning(Chunk chunk) |
boolean |
canDoRainSnowIce(Chunk chunk) |
boolean |
canDropChunk(int x,
int z)
Called to determine if the chunk at the given chunk coordinates within the provider's world can be dropped.
|
boolean |
canMineBlock(EntityPlayer player,
BlockPos pos) |
boolean |
canRespawnHere()
True if the player can respawn in this dimension (true = overworld, false = nether).
|
WorldProvider.WorldSleepResult |
canSleepAt(EntityPlayer player,
BlockPos pos)
Determines if the player can sleep in this world (or if the bed should explode for example).
|
boolean |
canSnowAt(BlockPos pos,
boolean checkLight) |
IChunkGenerator |
createChunkGenerator() |
WorldBorder |
createWorldBorder() |
boolean |
doesWaterVaporize() |
boolean |
doesXZShowFog(int x,
int z)
Returns true if the given X,Z coordinate should show environmental fog.
|
protected void |
generateLightBrightnessTable()
Creates the light to brightness table
|
int |
getActualHeight() |
int |
getAverageGroundLevel() |
Biome |
getBiomeForCoords(BlockPos pos) |
BiomeProvider |
getBiomeProvider() |
Vec3d |
getCloudColor(float partialTicks) |
float |
getCloudHeight()
the y level at which clouds are rendered.
|
IRenderHandler |
getCloudRenderer() |
float |
getCurrentMoonPhaseFactor()
Calculates the current moon phase factor.
|
int |
getDimension() |
abstract DimensionType |
getDimensionType() |
Vec3d |
getFogColor(float p_76562_1_,
float p_76562_2_)
Return Vec3D with biome specific fog color
|
int |
getHeight() |
double |
getHorizon() |
float[] |
getLightBrightnessTable() |
void |
getLightmapColors(float partialTicks,
float sunBrightness,
float skyLight,
float blockLight,
float[] colors)
Allows for manipulating the coloring of the lightmap texture.
|
int |
getMoonPhase(long worldTime) |
double |
getMovementFactor()
The dimension's movement factor.
|
MusicTicker.MusicType |
getMusicType()
Called on the client to get the music type to play when in this world type.
|
BlockPos |
getRandomizedSpawnPoint() |
int |
getRespawnDimension(EntityPlayerMP player)
Determines the dimension the player will be respawned in, typically this brings them back to the overworld.
|
java.lang.String |
getSaveFolder()
Returns the sub-folder of the world folder that this WorldProvider saves to.
|
long |
getSeed() |
Vec3d |
getSkyColor(Entity cameraEntity,
float partialTicks) |
IRenderHandler |
getSkyRenderer() |
BlockPos |
getSpawnCoordinate() |
BlockPos |
getSpawnPoint() |
float |
getStarBrightness(float par1)
Gets the Star Brightness for rendering sky.
|
float |
getSunBrightness(float par1)
Gets the Sun Brightness for rendering sky.
|
float |
getSunBrightnessFactor(float par1)
The current sun brightness factor for this dimension.
|
double |
getVoidFogYFactor()
Returns a double value representing the Y value relative to the top of the map at which void fog is at its
maximum.
|
IRenderHandler |
getWeatherRenderer() |
long |
getWorldTime() |
boolean |
hasSkyLight() |
protected void |
init()
Creates a new
BiomeProvider for the WorldProvider, and also sets the values of #hasSkylight and
#hasNoSky appropriately. |
ICapabilityProvider |
initCapabilities()
Called from
World.initCapabilities() , to gather capabilities for this world. |
boolean |
isBlockHighHumidity(BlockPos pos) |
boolean |
isDaytime() |
boolean |
isNether() |
boolean |
isSkyColored() |
boolean |
isSurfaceWorld()
Returns 'true' if in the "main surface world", but 'false' if in the Nether or End dimensions.
|
void |
onPlayerAdded(EntityPlayerMP player)
Called when a Player is added to the provider's world.
|
void |
onPlayerRemoved(EntityPlayerMP player)
Called when a Player is removed from the provider's world.
|
void |
onWorldSave()
Called when the world is performing a save.
|
void |
onWorldUpdateEntities()
Called when the world is updating entities.
|
void |
resetRainAndThunder() |
void |
setAllowedSpawnTypes(boolean allowHostile,
boolean allowPeaceful) |
void |
setCloudRenderer(IRenderHandler renderer) |
void |
setDimension(int dim)
Sets the providers current dimension ID, used in default getSaveFolder()
Added to allow default providers to be registered for multiple dimensions.
|
void |
setSkyRenderer(IRenderHandler skyRenderer) |
void |
setSpawnPoint(BlockPos pos) |
void |
setWeatherRenderer(IRenderHandler renderer) |
void |
setWorld(World worldIn)
associate an existing world with a World provider, and setup its lightbrightness table
|
void |
setWorldTime(long time) |
boolean |
shouldClientCheckLighting()
If this method returns true, then chunks received by the client will
have
Chunk.resetRelightChecks() called
on them, queuing lighting checks for all air blocks in the chunk (and
any adjacent light-emitting blocks). |
boolean |
shouldMapSpin(java.lang.String entity,
double x,
double z,
double rotation)
Determine if the cursor on the map should 'spin' when rendered, like it does for the player in the nether.
|
void |
updateWeather() |
public static final float[] MOON_PHASE_FACTORS
protected World world
protected BiomeProvider biomeProvider
protected boolean doesWaterVaporize
protected boolean nether
protected boolean hasSkyLight
protected final float[] lightBrightnessTable
public final void setWorld(World worldIn)
protected void generateLightBrightnessTable()
protected void init()
BiomeProvider
for the WorldProvider, and also sets the values of #hasSkylight
and
#hasNoSky
appropriately.
Note that subclasses generally override this method without calling the parent version.public IChunkGenerator createChunkGenerator()
public boolean canCoordinateBeSpawn(int x, int z)
public float calculateCelestialAngle(long worldTime, float partialTicks)
public int getMoonPhase(long worldTime)
public boolean isSurfaceWorld()
public float[] calcSunriseSunsetColors(float celestialAngle, float partialTicks)
public Vec3d getFogColor(float p_76562_1_, float p_76562_2_)
public boolean canRespawnHere()
public float getCloudHeight()
public boolean isSkyColored()
public BlockPos getSpawnCoordinate()
public int getAverageGroundLevel()
public double getVoidFogYFactor()
public boolean doesXZShowFog(int x, int z)
public BiomeProvider getBiomeProvider()
public boolean doesWaterVaporize()
public boolean hasSkyLight()
public boolean isNether()
public float[] getLightBrightnessTable()
public WorldBorder createWorldBorder()
public void setDimension(int dim)
dim
- Dimension IDpublic int getDimension()
public java.lang.String getSaveFolder()
public double getMovementFactor()
public boolean shouldClientCheckLighting()
Chunk.resetRelightChecks()
called
on them, queuing lighting checks for all air blocks in the chunk (and
any adjacent light-emitting blocks).
Returning true here is recommended if the chunk generator used also
does this for newly generated chunks.public IRenderHandler getSkyRenderer()
public void setSkyRenderer(IRenderHandler skyRenderer)
public IRenderHandler getCloudRenderer()
public void setCloudRenderer(IRenderHandler renderer)
public IRenderHandler getWeatherRenderer()
public void setWeatherRenderer(IRenderHandler renderer)
public void getLightmapColors(float partialTicks, float sunBrightness, float skyLight, float blockLight, float[] colors)
partialTicks
- Progress between ticks.sunBrightness
- Current sun brightness.skyLight
- Sky light brightness factor.blockLight
- Block light brightness factor.colors
- The color values that will be used: [r, g, b].EntityRenderer.updateLightmap(float)
public BlockPos getRandomizedSpawnPoint()
public boolean shouldMapSpin(java.lang.String entity, double x, double z, double rotation)
entity
- The entity holding the map, playername, or frame-ENTITYIDx
- X Positionz
- Z Positionrotation
- the regular rotation of the markerpublic int getRespawnDimension(EntityPlayerMP player)
player
- The player that is respawningpublic ICapabilityProvider initCapabilities()
World.initCapabilities()
, to gather capabilities for this world.
It's safe to access world here since this is called after world is registered.
On server, called directly after mapStorage and world data such as Scoreboard and VillageCollection are initialized.
On client, called when world is constructed, just before world load event is called.
Note that this method is always called before the world load event.public MusicTicker.MusicType getMusicType()
public WorldProvider.WorldSleepResult canSleepAt(EntityPlayer player, BlockPos pos)
player
- The player that is attempting to sleeppos
- The location where the player tries to sleep at (the position of the clicked on bed for example)public boolean isDaytime()
public float getSunBrightnessFactor(float par1)
public float getCurrentMoonPhaseFactor()
public Vec3d getCloudColor(float partialTicks)
public float getSunBrightness(float par1)
public float getStarBrightness(float par1)
public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful)
public void calculateInitialWeather()
public void updateWeather()
public boolean canBlockFreeze(BlockPos pos, boolean byWater)
public boolean canSnowAt(BlockPos pos, boolean checkLight)
public void setWorldTime(long time)
public long getSeed()
public long getWorldTime()
public BlockPos getSpawnPoint()
public void setSpawnPoint(BlockPos pos)
public boolean canMineBlock(EntityPlayer player, BlockPos pos)
public boolean isBlockHighHumidity(BlockPos pos)
public int getHeight()
public int getActualHeight()
public double getHorizon()
public void resetRainAndThunder()
public boolean canDoLightning(Chunk chunk)
public boolean canDoRainSnowIce(Chunk chunk)
public void onPlayerAdded(EntityPlayerMP player)
public void onPlayerRemoved(EntityPlayerMP player)
public abstract DimensionType getDimensionType()
public void onWorldSave()
public void onWorldUpdateEntities()
public boolean canDropChunk(int x, int z)