ForgePatch/patches/minecraft/net/minecraft/world/WorldProvider.java.patch

384 lines
12 KiB
Diff

--- ../src-base/minecraft/net/minecraft/world/WorldProvider.java
+++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java
@@ -52,26 +52,12 @@
protected void func_76572_b()
{
- WorldType worldtype = this.field_76579_a.func_72912_H().func_76067_t();
-
- if (worldtype == WorldType.field_77138_c)
- {
- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.func_82651_a(this.field_76579_a.func_72912_H().func_82571_y());
- this.field_76578_c = new WorldChunkManagerHell(BiomeGenBase.func_180276_a(flatgeneratorinfo.func_82648_a(), BiomeGenBase.field_180279_ad), 0.5F);
- }
- else if (worldtype == WorldType.field_180272_g)
- {
- this.field_76578_c = new WorldChunkManagerHell(BiomeGenBase.field_76772_c, 0.0F);
- }
- else
- {
- this.field_76578_c = new WorldChunkManager(this.field_76579_a);
- }
+ this.field_76578_c = field_76577_b.getChunkManager(field_76579_a);
}
public IChunkProvider func_76555_c()
{
- return (IChunkProvider)(this.field_76577_b == WorldType.field_77138_c ? new ChunkProviderFlat(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c) : (this.field_76577_b == WorldType.field_180272_g ? new ChunkProviderDebug(this.field_76579_a) : (this.field_76577_b == WorldType.field_180271_f ? new ChunkProviderGenerate(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c) : new ChunkProviderGenerate(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c))));
+ return field_76577_b.getChunkGenerator(field_76579_a, field_82913_c);
}
public boolean func_76566_a(int p_76566_1_, int p_76566_2_)
@@ -155,13 +141,13 @@
public static WorldProvider func_76570_a(int p_76570_0_)
{
- return (WorldProvider)(p_76570_0_ == -1 ? new WorldProviderHell() : (p_76570_0_ == 0 ? new WorldProviderSurface() : (p_76570_0_ == 1 ? new WorldProviderEnd() : null)));
+ return net.minecraftforge.common.DimensionManager.createProviderFor(p_76570_0_);
}
@SideOnly(Side.CLIENT)
public float func_76571_f()
{
- return 128.0F;
+ return this.field_76577_b.getCloudHeight();
}
@SideOnly(Side.CLIENT)
@@ -177,13 +163,13 @@
public int func_76557_i()
{
- return this.field_76577_b == WorldType.field_77138_c ? 4 : 64;
+ return this.field_76577_b.getMinimumSpawnHeight(this.field_76579_a);
}
@SideOnly(Side.CLIENT)
public double func_76565_k()
{
- return this.field_76577_b == WorldType.field_77138_c ? 1.0D : 0.03125D;
+ return this.field_76577_b.voidFadeMagnitude();
}
@SideOnly(Side.CLIENT)
@@ -225,4 +211,319 @@
{
return new WorldBorder();
}
+
+ /*======================================= Forge Start =========================================*/
+ private net.minecraftforge.client.IRenderHandler skyRenderer = null;
+ private net.minecraftforge.client.IRenderHandler cloudRenderer = null;
+ private net.minecraftforge.client.IRenderHandler weatherRenderer = null;
+
+ /**
+ * Sets the providers current dimension ID, used in default getSaveFolder()
+ * Added to allow default providers to be registered for multiple dimensions.
+ *
+ * @param dim Dimension ID
+ */
+ public void setDimension(int dim)
+ {
+ this.field_76574_g = dim;
+ }
+
+ /**
+ * Returns the sub-folder of the world folder that this WorldProvider saves to.
+ * EXA: DIM1, DIM-1
+ * @return The sub-folder name to save this world's chunks to.
+ */
+ public String getSaveFolder()
+ {
+ return (field_76574_g == 0 ? null : "DIM" + field_76574_g);
+ }
+
+ /**
+ * A message to display to the user when they transfer to this dimension.
+ *
+ * @return The message to be displayed
+ */
+ public String getWelcomeMessage()
+ {
+ if (this instanceof WorldProviderEnd)
+ {
+ return "Entering the End";
+ }
+ else if (this instanceof WorldProviderHell)
+ {
+ return "Entering the Nether";
+ }
+ return null;
+ }
+
+ /**
+ * A Message to display to the user when they transfer out of this dismension.
+ *
+ * @return The message to be displayed
+ */
+ public String getDepartMessage()
+ {
+ if (this instanceof WorldProviderEnd)
+ {
+ return "Leaving the End";
+ }
+ else if (this instanceof WorldProviderHell)
+ {
+ return "Leaving the Nether";
+ }
+ return null;
+ }
+
+ /**
+ * The dimensions movement factor. Relative to normal overworld.
+ * It is applied to the players position when they transfer dimensions.
+ * Exa: Nether movement is 8.0
+ * @return The movement factor
+ */
+ public double getMovementFactor()
+ {
+ if (this instanceof WorldProviderHell)
+ {
+ return 8.0;
+ }
+ return 1.0;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public net.minecraftforge.client.IRenderHandler getSkyRenderer()
+ {
+ return this.skyRenderer;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void setSkyRenderer(net.minecraftforge.client.IRenderHandler skyRenderer)
+ {
+ this.skyRenderer = skyRenderer;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public net.minecraftforge.client.IRenderHandler getCloudRenderer()
+ {
+ return cloudRenderer;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void setCloudRenderer(net.minecraftforge.client.IRenderHandler renderer)
+ {
+ cloudRenderer = renderer;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public net.minecraftforge.client.IRenderHandler getWeatherRenderer()
+ {
+ return weatherRenderer;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void setWeatherRenderer(net.minecraftforge.client.IRenderHandler renderer)
+ {
+ weatherRenderer = renderer;
+ }
+
+ public BlockPos getRandomizedSpawnPoint()
+ {
+ BlockPos ret = this.field_76579_a.func_175694_M();
+
+ boolean isAdventure = field_76579_a.func_72912_H().func_76077_q() == WorldSettings.GameType.ADVENTURE;
+ int spawnFuzz = field_76577_b.getSpawnFuzz();
+ int border = MathHelper.func_76128_c(field_76579_a.func_175723_af().func_177729_b(ret.func_177958_n(), ret.func_177952_p()));
+ if (border < spawnFuzz) spawnFuzz = border;
+ if (spawnFuzz < 1) spawnFuzz = 1;
+ int spawnFuzzHalf = spawnFuzz / 2;
+
+ if (!func_177495_o() && !isAdventure)
+ {
+ ret = field_76579_a.func_175672_r(ret.func_177982_a(field_76579_a.field_73012_v.nextInt(spawnFuzzHalf) - spawnFuzz, 0, field_76579_a.field_73012_v.nextInt(spawnFuzzHalf) - spawnFuzz));
+ }
+
+ return ret;
+ }
+ /**
+ * Determine if the cursor on the map should 'spin' when rendered, like it does for the player in the nether.
+ *
+ * @param entity The entity holding the map, playername, or frame-ENTITYID
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @return True to 'spin' the cursor
+ */
+ public boolean shouldMapSpin(String entity, double x, double y, double z)
+ {
+ return field_76574_g < 0;
+ }
+
+ /**
+ * Determines the dimension the player will be respawned in, typically this brings them back to the overworld.
+ *
+ * @param player The player that is respawning
+ * @return The dimension to respawn the player in
+ */
+ public int getRespawnDimension(net.minecraft.entity.player.EntityPlayerMP player)
+ {
+ return 0;
+ }
+
+ /*======================================= Start Moved From World =========================================*/
+
+ public BiomeGenBase getBiomeGenForCoords(BlockPos pos)
+ {
+ return field_76579_a.getBiomeGenForCoordsBody(pos);
+ }
+
+ public boolean isDaytime()
+ {
+ return field_76579_a.func_175657_ab() < 4;
+ }
+
+ /**
+ * The current sun brightness factor for this dimension.
+ * 0.0f means no light at all, and 1.0f means maximum sunlight.
+ * This will be used for the "calculateSkylightSubtracted"
+ * which is for Sky light value calculation.
+ *
+ * @return The current brightness factor
+ * */
+ public float getSunBrightnessFactor(float par1)
+ {
+ return field_76579_a.getSunBrightnessFactor(par1);
+ }
+
+ /**
+ * Calculates the current moon phase factor.
+ * This factor is effective for slimes.
+ * (This method do not affect the moon rendering)
+ * */
+ public float getCurrentMoonPhaseFactor()
+ {
+ return field_76579_a.getCurrentMoonPhaseFactorBody();
+ }
+
+ @SideOnly(Side.CLIENT)
+ public Vec3 getSkyColor(net.minecraft.entity.Entity cameraEntity, float partialTicks)
+ {
+ return field_76579_a.getSkyColorBody(cameraEntity, partialTicks);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public Vec3 drawClouds(float partialTicks)
+ {
+ return field_76579_a.drawCloudsBody(partialTicks);
+ }
+
+ /**
+ * Gets the Sun Brightness for rendering sky.
+ * */
+ @SideOnly(Side.CLIENT)
+ public float getSunBrightness(float par1)
+ {
+ return field_76579_a.getSunBrightnessBody(par1);
+ }
+
+ /**
+ * Gets the Star Brightness for rendering sky.
+ * */
+ @SideOnly(Side.CLIENT)
+ public float getStarBrightness(float par1)
+ {
+ return field_76579_a.getStarBrightnessBody(par1);
+ }
+
+ public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful)
+ {
+ field_76579_a.field_72985_G = allowHostile;
+ field_76579_a.field_72992_H = allowPeaceful;
+ }
+
+ public void calculateInitialWeather()
+ {
+ field_76579_a.calculateInitialWeatherBody();
+ }
+
+ public void updateWeather()
+ {
+ field_76579_a.updateWeatherBody();
+ }
+
+ public boolean canBlockFreeze(BlockPos pos, boolean byWater)
+ {
+ return field_76579_a.canBlockFreezeBody(pos, byWater);
+ }
+
+ public boolean canSnowAt(BlockPos pos, boolean checkLight)
+ {
+ return field_76579_a.canSnowAtBody(pos, checkLight);
+ }
+ public void setWorldTime(long time)
+ {
+ field_76579_a.field_72986_A.func_76068_b(time);
+ }
+
+ public long getSeed()
+ {
+ return field_76579_a.field_72986_A.func_76063_b();
+ }
+
+ public long getWorldTime()
+ {
+ return field_76579_a.field_72986_A.func_76073_f();
+ }
+
+ public BlockPos getSpawnPoint()
+ {
+ net.minecraft.world.storage.WorldInfo info = field_76579_a.field_72986_A;
+ return new BlockPos(info.func_76079_c(), info.func_76075_d(), info.func_76074_e());
+ }
+
+ public void setSpawnPoint(BlockPos pos)
+ {
+ field_76579_a.field_72986_A.func_176143_a(pos);
+ }
+
+ public boolean canMineBlock(net.minecraft.entity.player.EntityPlayer player, BlockPos pos)
+ {
+ return field_76579_a.canMineBlockBody(player, pos);
+ }
+
+ public boolean isBlockHighHumidity(BlockPos pos)
+ {
+ return field_76579_a.func_180494_b(pos).func_76736_e();
+ }
+
+ public int getHeight()
+ {
+ return 256;
+ }
+
+ public int getActualHeight()
+ {
+ return field_76576_e ? 128 : 256;
+ }
+
+ public double getHorizon()
+ {
+ return field_76579_a.field_72986_A.func_76067_t().getHorizon(field_76579_a);
+ }
+
+ public void resetRainAndThunder()
+ {
+ field_76579_a.field_72986_A.func_76080_g(0);
+ field_76579_a.field_72986_A.func_76084_b(false);
+ field_76579_a.field_72986_A.func_76090_f(0);
+ field_76579_a.field_72986_A.func_76069_a(false);
+ }
+
+ public boolean canDoLightning(net.minecraft.world.chunk.Chunk chunk)
+ {
+ return true;
+ }
+
+ public boolean canDoRainSnowIce(net.minecraft.world.chunk.Chunk chunk)
+ {
+ return true;
+ }
}