Location aware version og Block.lightOpacity for PR #169

This commit is contained in:
LexManos committed 2012-09-26 22:12:47 -07:00
1 parent 6ec887b34f
commit 520550dab9
6 files changed
+145 -38

No files matched your search

@@ -22,17 +22,10 @@
if (var9 != 0)
{
@@ -134,6 +140,48 @@
}
@@ -141,6 +147,48 @@
}
this.storageArrays[var10].setExtBlockID(var6, var8 & 15, var7, var9);
+ }
+ }
+ }
+ }
+ }
+
+ /**
/**
+ * Metadata sensitive Chunk constructor for use in new ChunkProviders that
+ * use metadata sensitive blocks during generation.
+ *
@@ -68,10 +61,38 @@
+
+ this.storageArrays[var10].setExtBlockID(x, y & 15, z, id);
+ this.storageArrays[var10].setExtBlockMetadata(x, y & 15, z, meta);
}
}
}
@@ -507,7 +555,7 @@
+ }
+ }
+ }
+ }
+ }
+
+ /**
* Checks whether the chunk is at the X/Z location specified
*/
public boolean isAtLocation(int par1, int par2)
@@ -204,7 +252,7 @@
{
int var5 = this.getBlockID(var2, var4 - 1, var3);
- if (Block.lightOpacity[var5] == 0)
+ if (getBlockLightOpacity(var2, var4 - 1, var3) == 0)
{
--var4;
continue;
@@ -499,7 +547,10 @@
public int getBlockLightOpacity(int par1, int par2, int par3)
{
- return Block.lightOpacity[this.getBlockID(par1, par2, par3)];
+ int x = (xPosition << 4) + par1;
+ int z = (zPosition << 4) + par3;
+ Block block = Block.blocksList[getBlockID(par1, par2, par3)];
+ return (block == null ? 0 : block.getLightOpacity(worldObj, x, par2, z));
}
/**
@@ -507,7 +558,7 @@
*/
public int getBlockID(int par1, int par2, int par3)
{
@@ -80,7 +101,7 @@
{
return 0;
}
@@ -523,7 +571,7 @@
@@ -523,7 +574,7 @@
*/
public int getBlockMetadata(int par1, int par2, int par3)
{
@@ -89,7 +110,7 @@
{
return 0;
}
@@ -564,6 +612,11 @@
@@ -564,6 +615,11 @@
}
else
{
@@ -101,7 +122,7 @@
ExtendedBlockStorage var10 = this.storageArrays[par2 >> 4];
boolean var11 = false;
@@ -594,7 +647,7 @@
@@ -594,7 +650,7 @@
{
Block.blocksList[var8].breakBlock(this.worldObj, var12, par2, var13, var8, var9);
}
@@ -110,7 +131,16 @@
{
this.worldObj.removeBlockTileEntity(var12, par2, var13);
}
@@ -638,29 +691,21 @@
@@ -614,7 +670,7 @@
}
else
{
- if (Block.lightOpacity[par4 & 4095] > 0)
+ if (getBlockLightOpacity(par1, par2 + 1, par3) > 0)
{
if (par2 >= var7)
{
@@ -638,29 +694,21 @@
Block.blocksList[par4].onBlockAdded(this.worldObj, var12, par2, var13);
}
@@ -143,7 +173,7 @@
}
}
@@ -675,7 +720,7 @@
@@ -675,7 +723,7 @@
*/
public boolean setBlockMetadata(int par1, int par2, int par3, int par4)
{
@@ -152,7 +182,7 @@
if (var5 == null)
{
@@ -695,7 +740,7 @@
@@ -695,7 +743,7 @@
var5.setExtBlockMetadata(par1, par2 & 15, par3, par4);
int var7 = var5.getExtBlockID(par1, par2 & 15, par3);
@@ -161,7 +191,7 @@
{
TileEntity var8 = this.getChunkBlockTileEntity(par1, par2, par3);
@@ -716,7 +761,7 @@
@@ -716,7 +764,7 @@
*/
public int getSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4)
{
@@ -170,7 +200,7 @@
return var5 == null ? (this.canBlockSeeTheSky(par2, par3, par4) ? par1EnumSkyBlock.defaultLightValue : 0) : (par1EnumSkyBlock == EnumSkyBlock.Sky ? var5.getExtSkylightValue(par2, par3 & 15, par4) : (par1EnumSkyBlock == EnumSkyBlock.Block ? var5.getExtBlocklightValue(par2, par3 & 15, par4) : par1EnumSkyBlock.defaultLightValue));
}
@@ -726,6 +771,11 @@
@@ -726,6 +774,11 @@
*/
public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5)
{
@@ -182,7 +212,7 @@
ExtendedBlockStorage var6 = this.storageArrays[par3 >> 4];
if (var6 == null)
@@ -754,7 +804,7 @@
@@ -754,7 +807,7 @@
*/
public int getBlockLightValue(int par1, int par2, int par3, int par4)
{
@@ -191,7 +221,7 @@
if (var5 == null)
{
@@ -807,7 +857,7 @@
@@ -807,7 +860,7 @@
{
var4 = this.entityLists.length - 1;
}
@@ -200,7 +230,7 @@
par1Entity.addedToChunk = true;
par1Entity.chunkCoordX = this.xPosition;
par1Entity.chunkCoordY = var4;
@@ -857,33 +907,33 @@
@@ -857,33 +910,33 @@
ChunkPosition var4 = new ChunkPosition(par1, par2, par3);
TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4);
@@ -245,7 +275,7 @@
}
/**
@@ -898,7 +948,7 @@
@@ -898,7 +951,7 @@
if (this.isChunkLoaded)
{
@@ -254,7 +284,7 @@
}
}
@@ -913,8 +963,14 @@
@@ -913,8 +966,14 @@
par4TileEntity.yCoord = par2;
par4TileEntity.zCoord = this.zPosition * 16 + par3;
@@ -271,7 +301,7 @@
par4TileEntity.validate();
this.chunkTileEntityMap.put(var5, par4TileEntity);
}
@@ -953,6 +1009,7 @@
@@ -953,6 +1012,7 @@
List var4 = var1[var3];
this.worldObj.addLoadedEntities(var4);
}
@@ -279,7 +309,7 @@
}
/**
@@ -977,6 +1034,7 @@
@@ -977,6 +1037,7 @@
List var4 = var5[var3];
this.worldObj.unloadEntities(var4);
}
@@ -287,7 +317,7 @@
}
/**
@@ -993,8 +1051,8 @@
@@ -993,8 +1054,8 @@
*/
public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List)
{
@@ -298,7 +328,7 @@
if (var4 < 0)
{
@@ -1042,8 +1100,8 @@
@@ -1042,8 +1103,8 @@
*/
public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List)
{
@@ -309,7 +339,7 @@
if (var4 < 0)
{
@@ -1227,6 +1285,15 @@
@@ -1227,6 +1288,15 @@
*/
public void fillChunk(byte[] par1ArrayOfByte, int par2, int par3, boolean par4)
{
@@ -325,7 +355,7 @@
int var5 = 0;
int var6;
@@ -1323,12 +1390,26 @@
@@ -1323,12 +1393,26 @@
}
this.generateHeightMap();
@@ -358,7 +388,7 @@
}
}
@@ -1437,4 +1518,18 @@
@@ -1437,4 +1521,18 @@
}
}
}