Add CloudRenderer for PR #304

This commit is contained in:
LexManos 2012-12-12 01:35:18 -08:00
parent 9381fd07be
commit ee0763fb4a
3 changed files with 39 additions and 10 deletions

View file

@ -5,6 +5,7 @@ import cpw.mods.fml.common.asm.SideOnly;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.src.WorldClient; import net.minecraft.src.WorldClient;
//To-Do: Rename this to something more generic.. IRenderHandler?
public abstract class SkyProvider public abstract class SkyProvider
{ {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)

View file

@ -17,13 +17,15 @@
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@@ -256,4 +258,263 @@ @@ -256,4 +258,277 @@
* Returns the dimension's name, e.g. "The End", "Nether", or "Overworld". * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld".
*/ */
public abstract String getDimensionName(); public abstract String getDimensionName();
+ +
+ /*======================================= Forge Start =========================================*/ + /*======================================= Forge Start =========================================*/
+ private SkyProvider skyProvider = null; + private SkyProvider skyProvider = null;
+ private SkyProvider cloudRenderer = null;
+
+ /** + /**
+ * Sets the providers current dimension ID, used in default getSaveFolder() + * Sets the providers current dimension ID, used in default getSaveFolder()
+ * Added to allow default providers to be registered for multiple dimensions. + * Added to allow default providers to be registered for multiple dimensions.
@ -108,6 +110,18 @@
+ this.skyProvider = skyProvider; + this.skyProvider = skyProvider;
+ } + }
+ +
+ @SideOnly(Side.CLIENT)
+ public SkyProvider getCloudRenderer()
+ {
+ return cloudRenderer;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void setCloudRenderer(SkyProvider renderer)
+ {
+ cloudRenderer = renderer;
+ }
+
+ public ChunkCoordinates getRandomizedSpawnPoint() + public ChunkCoordinates getRandomizedSpawnPoint()
+ { + {
+ ChunkCoordinates var5 = new ChunkCoordinates(this.worldObj.getSpawnPoint()); + ChunkCoordinates var5 = new ChunkCoordinates(this.worldObj.getSpawnPoint());

View file

@ -24,19 +24,33 @@
if (this.mc.theWorld.provider.dimensionId == 1) if (this.mc.theWorld.provider.dimensionId == 1)
{ {
GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_FOG);
@@ -1547,6 +1556,11 @@ @@ -1120,6 +1129,13 @@
public void renderClouds(float par1)
{
+ SkyProvider renderer = null;
+ if ((renderer = theWorld.provider.getCloudRenderer()) != null)
+ {
+ renderer.render(par1, theWorld, mc);
+ return;
+ }
+
if (this.mc.theWorld.provider.isSurfaceWorld())
{
if (this.mc.gameSettings.fancyGraphics)
@@ -1546,6 +1562,11 @@
}
public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityPlayer par2EntityPlayer, float par3) public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityPlayer par2EntityPlayer, float par3)
{ + {
+ drawBlockDamageTexture(par1Tessellator, (EntityLiving)par2EntityPlayer, par3); + drawBlockDamageTexture(par1Tessellator, (EntityLiving)par2EntityPlayer, par3);
+ } + }
+ +
+ public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityLiving par2EntityPlayer, float par3) + public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityLiving par2EntityPlayer, float par3)
+ { {
double var4 = par2EntityPlayer.lastTickPosX + (par2EntityPlayer.posX - par2EntityPlayer.lastTickPosX) * (double)par3; double var4 = par2EntityPlayer.lastTickPosX + (par2EntityPlayer.posX - par2EntityPlayer.lastTickPosX) * (double)par3;
double var6 = par2EntityPlayer.lastTickPosY + (par2EntityPlayer.posY - par2EntityPlayer.lastTickPosY) * (double)par3; double var6 = par2EntityPlayer.lastTickPosY + (par2EntityPlayer.posY - par2EntityPlayer.lastTickPosY) * (double)par3;
double var8 = par2EntityPlayer.lastTickPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.lastTickPosZ) * (double)par3; @@ -1817,6 +1838,7 @@
@@ -1817,6 +1831,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;
@ -44,7 +58,7 @@
if (par1Str.equals("hugeexplosion")) if (par1Str.equals("hugeexplosion"))
{ {
@@ -1949,6 +1964,7 @@ @@ -1949,6 +1971,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);
@ -52,7 +66,7 @@
} }
else if (par1Str.equals("dripWater")) else if (par1Str.equals("dripWater"))
{ {
@@ -1965,6 +1981,7 @@ @@ -1965,6 +1988,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);
@ -60,7 +74,7 @@
} }
else if (par1Str.equals("heart")) else if (par1Str.equals("heart"))
{ {
@@ -1986,6 +2003,7 @@ @@ -1986,6 +2010,7 @@
{ {
int var27 = Integer.parseInt(par1Str.substring(par1Str.indexOf("_") + 1)); int var27 = Integer.parseInt(par1Str.substring(par1Str.indexOf("_") + 1));
var21 = new EntityBreakingFX(this.theWorld, par2, par4, par6, par8, par10, par12, Item.itemsList[var27]); var21 = new EntityBreakingFX(this.theWorld, par2, par4, par6, par8, par10, par12, Item.itemsList[var27]);
@ -68,7 +82,7 @@
} }
else if (par1Str.startsWith("tilecrack_")) else if (par1Str.startsWith("tilecrack_"))
{ {
@@ -1993,11 +2011,12 @@ @@ -1993,11 +2018,12 @@
int var25 = Integer.parseInt(var28[1]); int var25 = Integer.parseInt(var28[1]);
int var26 = Integer.parseInt(var28[2]); int var26 = Integer.parseInt(var28[2]);
var21 = (new EntityDiggingFX(this.theWorld, par2, par4, par6, par8, par10, par12, Block.blocksList[var25], 0, var26)).func_90019_g(var26); var21 = (new EntityDiggingFX(this.theWorld, par2, par4, par6, par8, par10, par12, Block.blocksList[var25], 0, var26)).func_90019_g(var26);