Adds a SkyProvider class that can handle the rendering of the sky

This commit is contained in:
heldplayer 2012-08-18 21:05:21 +02:00
parent 7f40671ad8
commit 59c77d7ca4
3 changed files with 66 additions and 7 deletions

View file

@ -0,0 +1,12 @@
package net.minecraftforge.client;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.src.WorldClient;
public abstract class SkyProvider
{
@SideOnly(Side.CLIENT)
public abstract void render(float partialTicks, WorldClient world, Minecraft mc);
}

View file

@ -1,13 +1,23 @@
--- ../src_base/common/net/minecraft/src/WorldProvider.java --- ../src_base/common/net/minecraft/src/WorldProvider.java
+++ ../src_work/common/net/minecraft/src/WorldProvider.java +++ ../src_work/common/net/minecraft/src/WorldProvider.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,7 @@
package net.minecraft.src; package net.minecraft.src;
+import net.minecraftforge.client.SkyProvider;
+import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.DimensionManager;
import cpw.mods.fml.common.Side; import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly; import cpw.mods.fml.common.asm.SideOnly;
@@ -185,7 +186,7 @@ @@ -30,6 +32,8 @@
/** Array for sunrise/sunset colors (RGBA) */
private float[] colorsSunriseSunset = new float[4];
+
+ private SkyProvider skyProvider = null;
/**
* associate an existing world with a World provider, and setup its lightbrightness table
@@ -185,7 +189,7 @@
public static WorldProvider getProviderForDimension(int par0) public static WorldProvider getProviderForDimension(int par0)
{ {
@ -16,7 +26,7 @@
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@@ -251,4 +252,79 @@ @@ -251,4 +255,92 @@
} }
public abstract String func_80007_l(); public abstract String func_80007_l();
@ -95,4 +105,17 @@
+ } + }
+ return 1.0; + return 1.0;
+ } + }
+
+ @SideOnly(Side.CLIENT)
+ public SkyProvider getSkyProvider()
+ {
+ return this.skyProvider;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void setSkyProvider(SkyProvider skyProvider)
+ {
+ this.skyProvider = skyProvider;
+ }
+
} }

View file

@ -1,6 +1,30 @@
--- ../src_base/minecraft/net/minecraft/src/RenderGlobal.java --- ../src_base/minecraft/net/minecraft/src/RenderGlobal.java
+++ ../src_work/minecraft/net/minecraft/src/RenderGlobal.java +++ ../src_work/minecraft/net/minecraft/src/RenderGlobal.java
@@ -1787,6 +1787,7 @@ @@ -9,7 +9,10 @@
import java.util.List;
import java.util.Map;
import java.util.Random;
+
import net.minecraft.client.Minecraft;
+import net.minecraftforge.client.SkyProvider;
+
import org.lwjgl.opengl.ARBOcclusionQuery;
import org.lwjgl.opengl.GL11;
@@ -867,6 +870,12 @@
*/
public void renderSky(float par1)
{
+ SkyProvider skyProvider = null;
+ if ((skyProvider = this.mc.theWorld.provider.getSkyProvider()) != null)
+ {
+ skyProvider.render(par1, this.theWorld, mc);
+ return;
+ }
if (this.mc.theWorld.provider.worldType == 1)
{
GL11.glDisable(GL11.GL_FOG);
@@ -1787,6 +1796,7 @@
double var17 = this.mc.renderViewEntity.posY - par4; double var17 = this.mc.renderViewEntity.posY - par4;
double var19 = this.mc.renderViewEntity.posZ - par6; double var19 = this.mc.renderViewEntity.posZ - par6;
EntityFX var21 = null; EntityFX var21 = null;
@ -8,7 +32,7 @@
if (par1Str.equals("hugeexplosion")) if (par1Str.equals("hugeexplosion"))
{ {
@@ -1906,6 +1907,7 @@ @@ -1906,6 +1916,7 @@
else if (par1Str.equals("snowballpoof")) else if (par1Str.equals("snowballpoof"))
{ {
var21 = new EntityBreakingFX(this.theWorld, par2, par4, par6, Item.snowball); var21 = new EntityBreakingFX(this.theWorld, par2, par4, par6, Item.snowball);
@ -16,7 +40,7 @@
} }
else if (par1Str.equals("dripWater")) else if (par1Str.equals("dripWater"))
{ {
@@ -1922,6 +1924,7 @@ @@ -1922,6 +1933,7 @@
else if (par1Str.equals("slime")) else if (par1Str.equals("slime"))
{ {
var21 = new EntityBreakingFX(this.theWorld, par2, par4, par6, Item.slimeBall); var21 = new EntityBreakingFX(this.theWorld, par2, par4, par6, Item.slimeBall);
@ -24,7 +48,7 @@
} }
else if (par1Str.equals("heart")) else if (par1Str.equals("heart"))
{ {
@@ -1935,17 +1938,19 @@ @@ -1935,17 +1947,19 @@
{ {
var24 = Integer.parseInt(par1Str.substring(par1Str.indexOf("_") + 1)); var24 = Integer.parseInt(par1Str.substring(par1Str.indexOf("_") + 1));
var21 = new EntityBreakingFX(this.theWorld, par2, par4, par6, par8, par10, par12, Item.itemsList[var24]); var21 = new EntityBreakingFX(this.theWorld, par2, par4, par6, par8, par10, par12, Item.itemsList[var24]);