DimDoors/StevenDimDoors/mod_pocketDim/world/LimboProvider.java

182 lines
4 KiB
Java
Raw Normal View History

2013-06-02 03:43:56 +02:00
package StevenDimDoors.mod_pocketDim.world;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManagerHell;
import net.minecraft.world.chunk.IChunkProvider;
2013-05-29 23:54:41 +02:00
import net.minecraftforge.client.IRenderHandler;
import StevenDimDoors.mod_pocketDim.CloudRenderBlank;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class LimboProvider extends WorldProvider
{
@Override
public String getDimensionName() {
return "Limbo";
}
private IRenderHandler skyRenderer;
private DDProperties properties = null;
public LimboProvider()
{
this.hasNoSky = false;
this.skyRenderer = new limboSkyProvider();
if (properties == null)
properties = DDProperties.instance();
}
2013-05-29 23:54:41 +02:00
@SideOnly(Side.CLIENT)
public IRenderHandler getSkyRenderer()
{
return this.skyRenderer;
}
@Override
protected void registerWorldChunkManager()
{
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1,1);
//this.dimensionId = ConfigAtum.dimensionID;
}
@Override
public BiomeGenBase getBiomeGenForCoords(int x, int z)
{
return mod_pocketDim.limboBiome;
}
public boolean canRespawnHere()
{
return properties.HardcoreLimboEnabled && properties.LimboEnabled;
}
public boolean isBlockHighHumidity(int x, int y, int z)
{
return false;
}
@Override
public boolean canSnowAt(int x, int y, int z)
{
return false;
}
2013-05-27 14:10:07 +02:00
@Override
protected void generateLightBrightnessTable()
{
float modifier = 0.0F;
for (int steps = 0; steps <= 15; ++steps)
{
float var3 = 1.0F - (float)steps / 15.0F;
this.lightBrightnessTable[steps] = ((0.0F + var3) / (var3 * 3.0F + 1.0F) * (1.0F - modifier) + modifier)*3;
// System.out.println( this.lightBrightnessTable[steps]+"light");
}
}
public ChunkCoordinates getSpawnPoint()
{
return this.getRandomizedSpawnPoint();
}
public float calculateCelestialAngle(long par1, float par3)
{
int var4 = (int)(par1 % 24000L);
float var5 = ((float)var4 + par3) / 24000.0F - 0.25F;
if (var5 < 0.0F)
{
++var5;
}
if (var5 > 1.0F)
{
--var5;
}
float var6 = var5;
var5 = 1.0F - (float)((Math.cos((double)var5 * Math.PI) + 1.0D) / 2.0D);
var5 = var6 + (var5 - var6) / 3.0F;
return 0;
}
@SideOnly(Side.CLIENT)
public int getMoonPhase(long par1, float par3)
{
return 4;
}
@SideOnly(Side.CLIENT)
@Override
public String getSaveFolder()
{
return (dimensionId == 0 ? null : "DimensionalDoors/Limbo" + dimensionId);
}
public boolean canCoordinateBeSpawn(int par1, int par2)
{
int var3 = this.worldObj.getFirstUncoveredBlock(par1, par2);
return var3 == properties.LimboBlockID;
}
@Override
public double getHorizon()
{
return worldObj.getHeight()/4-800;
}
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
{
setCloudRenderer( new CloudRenderBlank());
return this.worldObj.getWorldVec3Pool().getVecFromPool((double)0, (double)0, (double)0);
}
@SideOnly(Side.CLIENT)
@Override
public Vec3 getFogColor(float par1, float par2)
{
return this.worldObj.getWorldVec3Pool().getVecFromPool((double).2, (double).2, (double).2);
}
public int getRespawnDimension(EntityPlayerMP player)
{
return 0;
}
@Override
public IChunkProvider createChunkGenerator()
{
return new LimboGenerator(worldObj, 45);
}
public boolean canBlockFreeze(int x, int y, int z, boolean byWater)
{
return false;
}
@Override
public ChunkCoordinates getRandomizedSpawnPoint()
{
ChunkCoordinates var5 = new ChunkCoordinates(0,0,0);
int spawnFuzz = 10000;
int spawnFuzzHalf = spawnFuzz / 2;
{
var5.posX += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf;
var5.posZ += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf;
var5.posY = 700;
}
return var5;
}
}