Updated World patch, there are a lot of new things happening int he constructor, xcomp should probably vet this.

This commit is contained in:
LexManos 2012-10-21 10:26:07 -07:00
parent 07a4a9f41f
commit 158c2f1feb
1 changed files with 98 additions and 83 deletions

View File

@ -28,7 +28,7 @@
/**
* boolean; if true updates scheduled by scheduleBlockUpdate happen immediately
*/
@@ -133,6 +152,11 @@
@@ -134,6 +153,11 @@
*/
public BiomeGenBase getBiomeGenForCoords(int par1, int par2)
{
@ -40,21 +40,33 @@
if (this.blockExists(par1, 0, par2))
{
Chunk var3 = this.getChunkFromBlockCoords(par1, par2);
@@ -162,8 +186,11 @@
@@ -163,7 +187,15 @@
this.theProfiler = par5Profiler;
this.worldInfo = new WorldInfo(par4WorldSettings, par2Str);
this.provider = par3WorldProvider;
- this.mapStorage = new MapStorage(par1ISaveHandler);
- par3WorldProvider.registerWorld(this);
+ }
+
+ // Broken up so that the WorldClient gets the chance to set the mapstorage object before the dimension initializes
+ @SideOnly(Side.CLIENT)
+ protected void finishSetup() {
+ protected void finishSetup()
+ {
+ this.provider.registerWorld(this);
+
+ this.mapStorage = new MapStorage(saveHandler);
VillageCollection var6 = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, "villages");
if (var6 == null)
@@ -177,7 +209,7 @@
this.villageCollectionObj.func_82566_a(this);
}
- par3WorldProvider.registerWorld(this);
+ this.provider.registerWorld(this);
this.chunkProvider = this.createChunkProvider();
this.calculateInitialSkylight();
this.calculateInitialWeather();
@@ -177,7 +204,7 @@
@@ -191,7 +223,7 @@
this.isRemote = false;
this.saveHandler = par1ISaveHandler;
this.theProfiler = par5Profiler;
@ -63,7 +75,7 @@
this.worldInfo = par1ISaveHandler.loadWorldInfo();
if (par4WorldProvider != null)
@@ -215,6 +242,19 @@
@@ -242,6 +274,19 @@
this.calculateInitialWeather();
}
@ -83,7 +95,7 @@
/**
* Creates the chunk provider for this world. Called in the constructor. Retrieves provider from worldProvider?
*/
@@ -269,7 +309,8 @@
@@ -296,7 +341,8 @@
*/
public boolean isAirBlock(int par1, int par2, int par3)
{
@ -93,7 +105,7 @@
}
/**
@@ -278,7 +319,8 @@
@@ -305,7 +351,8 @@
public boolean blockHasTileEntity(int par1, int par2, int par3)
{
int var4 = this.getBlockId(par1, par2, par3);
@ -103,7 +115,7 @@
}
/**
@@ -980,7 +1022,7 @@
@@ -1027,7 +1074,7 @@
*/
public boolean isDaytime()
{
@ -112,7 +124,7 @@
}
/**
@@ -1012,7 +1054,7 @@
@@ -1059,7 +1106,7 @@
int var12 = this.getBlockMetadata(var8, var9, var10);
Block var13 = Block.blocksList[var11];
@ -121,7 +133,7 @@
{
MovingObjectPosition var14 = var13.collisionRayTrace(this, var8, var9, var10, par1Vec3, par2Vec3);
@@ -1212,6 +1254,12 @@
@@ -1259,6 +1306,12 @@
*/
public void playSoundAtEntity(Entity par1Entity, String par2Str, float par3, float par4)
{
@ -134,7 +146,7 @@
if (par1Entity != null && par2Str != null)
{
Iterator var5 = this.worldAccesses.iterator();
@@ -1312,6 +1360,11 @@
@@ -1357,6 +1410,11 @@
EntityPlayer var5 = (EntityPlayer)par1Entity;
this.playerEntities.add(var5);
this.updateAllPlayersSleepingFlag();
@ -146,7 +158,7 @@
}
this.getChunkFromChunkCoords(var2, var3).addEntity(par1Entity);
@@ -1563,6 +1616,12 @@
@@ -1608,6 +1666,12 @@
* Calculates the color for the skybox
*/
public Vec3 getSkyColor(Entity par1Entity, float par2)
@ -159,7 +171,7 @@
{
float var3 = this.getCelestialAngle(par2);
float var4 = MathHelper.cos(var3 * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
@@ -1658,6 +1717,12 @@
@@ -1703,6 +1767,12 @@
@SideOnly(Side.CLIENT)
public Vec3 drawClouds(float par1)
{
@ -172,7 +184,7 @@
float var2 = this.getCelestialAngle(par1);
float var3 = MathHelper.cos(var2 * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
@@ -1736,7 +1801,7 @@
@@ -1781,7 +1851,7 @@
{
int var5 = var3.getBlockID(par1, var4, par2);
@ -181,7 +193,7 @@
{
return var4 + 1;
}
@@ -1751,6 +1816,12 @@
@@ -1796,6 +1866,12 @@
* How bright are stars in the sky
*/
public float getStarBrightness(float par1)
@ -194,7 +206,7 @@
{
float var2 = this.getCelestialAngle(par1);
float var3 = 1.0F - (MathHelper.cos(var2 * (float)Math.PI * 2.0F) * 2.0F + 0.25F);
@@ -1893,7 +1964,7 @@
@@ -1940,7 +2016,7 @@
if (var8 != null)
{
@ -203,7 +215,7 @@
}
}
}
@@ -1903,6 +1974,10 @@
@@ -1950,6 +2026,10 @@
if (!this.entityRemoval.isEmpty())
{
@ -214,7 +226,7 @@
this.loadedTileEntityList.removeAll(this.entityRemoval);
this.entityRemoval.clear();
}
@@ -1923,7 +1998,9 @@
@@ -1970,7 +2050,9 @@
{
this.loadedTileEntityList.add(var9);
}
@ -225,7 +237,7 @@
if (this.chunkExists(var9.xCoord >> 4, var9.zCoord >> 4))
{
Chunk var10 = this.getChunkFromChunkCoords(var9.xCoord >> 4, var9.zCoord >> 4);
@@ -1933,8 +2010,6 @@
@@ -1980,8 +2062,6 @@
var10.setChunkBlockTileEntity(var9.xCoord & 15, var9.yCoord, var9.zCoord & 15, var9);
}
}
@ -234,7 +246,7 @@
}
}
@@ -1947,13 +2022,13 @@
@@ -1994,13 +2074,13 @@
public void addTileEntity(Collection par1Collection)
{
@ -255,7 +267,7 @@
}
}
@@ -1973,9 +2048,17 @@
@@ -2020,9 +2100,17 @@
{
int var3 = MathHelper.floor_double(par1Entity.posX);
int var4 = MathHelper.floor_double(par1Entity.posZ);
@ -276,7 +288,7 @@
{
par1Entity.lastTickPosX = par1Entity.posX;
par1Entity.lastTickPosY = par1Entity.posY;
@@ -2210,6 +2293,14 @@
@@ -2257,6 +2345,14 @@
{
return true;
}
@ -291,7 +303,7 @@
}
}
}
@@ -2516,25 +2607,21 @@
@@ -2564,25 +2660,21 @@
*/
public void setBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity)
{
@ -332,7 +344,7 @@
}
}
@@ -2543,27 +2630,10 @@
@@ -2591,27 +2683,10 @@
*/
public void removeBlockTileEntity(int par1, int par2, int par3)
{
@ -364,7 +376,7 @@
}
}
@@ -2589,7 +2659,8 @@
@@ -2637,7 +2712,8 @@
*/
public boolean isBlockNormalCube(int par1, int par2, int par3)
{
@ -374,7 +386,7 @@
}
/**
@@ -2597,8 +2668,7 @@
@@ -2645,8 +2721,7 @@
*/
public boolean doesBlockHaveSolidTopSurface(int par1, int par2, int par3)
{
@ -384,7 +396,7 @@
}
/**
@@ -2614,7 +2684,7 @@
@@ -2662,7 +2737,7 @@
if (var5 != null && !var5.isEmpty())
{
Block var6 = Block.blocksList[this.getBlockId(par1, par2, par3)];
@ -393,7 +405,7 @@
}
else
{
@@ -2645,8 +2715,7 @@
@@ -2693,8 +2768,7 @@
*/
public void setAllowedSpawnTypes(boolean par1, boolean par2)
{
@ -403,7 +415,7 @@
}
/**
@@ -2662,6 +2731,11 @@
@@ -2710,6 +2784,11 @@
*/
private void calculateInitialWeather()
{
@ -415,7 +427,7 @@
if (this.worldInfo.isRaining())
{
this.rainingStrength = 1.0F;
@@ -2677,6 +2751,11 @@
@@ -2725,6 +2804,11 @@
* Updates all weather states.
*/
protected void updateWeather()
@ -427,7 +439,7 @@
{
if (!this.provider.hasNoSky)
{
@@ -2779,12 +2858,14 @@
@@ -2827,12 +2911,14 @@
public void toggleRain()
{
@ -443,7 +455,7 @@
this.theProfiler.startSection("buildList");
int var1;
EntityPlayer var2;
@@ -2891,6 +2972,11 @@
@@ -2939,6 +3025,11 @@
*/
public boolean canBlockFreeze(int par1, int par2, int par3, boolean par4)
{
@ -455,7 +467,7 @@
BiomeGenBase var5 = this.getBiomeGenForCoords(par1, par3);
float var6 = var5.getFloatTemperature();
@@ -2948,6 +3034,11 @@
@@ -2996,6 +3087,11 @@
* Tests whether or not snow can be placed at a given location
*/
public boolean canSnowAt(int par1, int par2, int par3)
@ -467,7 +479,7 @@
{
BiomeGenBase var4 = this.getBiomeGenForCoords(par1, par3);
float var5 = var4.getFloatTemperature();
@@ -3041,7 +3132,7 @@
@@ -3089,7 +3185,7 @@
private int computeBlockLightValue(int par1, int par2, int par3, int par4, int par5, int par6)
{
@ -476,7 +488,7 @@
int var8 = this.getSavedLightValue(EnumSkyBlock.Block, par2 - 1, par3, par4) - par6;
int var9 = this.getSavedLightValue(EnumSkyBlock.Block, par2 + 1, par3, par4) - par6;
int var10 = this.getSavedLightValue(EnumSkyBlock.Block, par2, par3 - 1, par4) - par6;
@@ -3176,7 +3267,7 @@
@@ -3224,7 +3320,7 @@
int var21 = var24 + (var18 / 2 + 1) % 3 / 2 * var19;
int var22 = var12 + (var18 / 2 + 2) % 3 / 2 * var19;
var14 = this.getSavedLightValue(par1EnumSkyBlock, var20, var21, var22);
@ -485,7 +497,7 @@
if (var23 == 0)
{
@@ -3207,7 +3298,7 @@
@@ -3255,7 +3351,7 @@
var12 = (var9 >> 12 & 63) - 32 + par4;
var13 = this.getSavedLightValue(par1EnumSkyBlock, var10, var24, var12);
var14 = this.getBlockId(var10, var24, var12);
@ -494,7 +506,7 @@
if (var15 == 0)
{
@@ -3309,10 +3400,10 @@
@@ -3357,10 +3453,10 @@
public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB)
{
this.entitiesWithinAABBExcludingEntity.clear();
@ -509,22 +521,22 @@
for (int var7 = var3; var7 <= var4; ++var7)
{
@@ -3333,10 +3424,10 @@
*/
public List getEntitiesWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB)
{
- int var3 = MathHelper.floor_double((par2AxisAlignedBB.minX - 2.0D) / 16.0D);
- int var4 = MathHelper.floor_double((par2AxisAlignedBB.maxX + 2.0D) / 16.0D);
- int var5 = MathHelper.floor_double((par2AxisAlignedBB.minZ - 2.0D) / 16.0D);
- int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxZ + 2.0D) / 16.0D);
+ int var3 = MathHelper.floor_double((par2AxisAlignedBB.minX - MAX_ENTITY_RADIUS) / 16.0D);
+ int var4 = MathHelper.floor_double((par2AxisAlignedBB.maxX + MAX_ENTITY_RADIUS) / 16.0D);
+ int var5 = MathHelper.floor_double((par2AxisAlignedBB.minZ - MAX_ENTITY_RADIUS) / 16.0D);
+ int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxZ + MAX_ENTITY_RADIUS) / 16.0D);
ArrayList var7 = new ArrayList();
@@ -3386,10 +3482,10 @@
for (int var8 = var3; var8 <= var4; ++var8)
@@ -3425,11 +3516,14 @@
public List func_82733_a(Class par1Class, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector)
{
- int var4 = MathHelper.floor_double((par2AxisAlignedBB.minX - 2.0D) / 16.0D);
- int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxX + 2.0D) / 16.0D);
- int var6 = MathHelper.floor_double((par2AxisAlignedBB.minZ - 2.0D) / 16.0D);
- int var7 = MathHelper.floor_double((par2AxisAlignedBB.maxZ + 2.0D) / 16.0D);
+ int var4 = MathHelper.floor_double((par2AxisAlignedBB.minX - MAX_ENTITY_RADIUS) / 16.0D);
+ int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxX + MAX_ENTITY_RADIUS) / 16.0D);
+ int var6 = MathHelper.floor_double((par2AxisAlignedBB.minZ - MAX_ENTITY_RADIUS) / 16.0D);
+ int var7 = MathHelper.floor_double((par2AxisAlignedBB.maxZ + MAX_ENTITY_RADIUS) / 16.0D);
ArrayList var8 = new ArrayList();
for (int var9 = var4; var9 <= var5; ++var9)
@@ -3483,11 +3579,14 @@
*/
public void addLoadedEntities(List par1List)
{
@ -542,28 +554,19 @@
}
}
@@ -3466,7 +3560,10 @@
{
var9 = null;
}
-
+ if (var9 != null && var9.isBlockReplaceable(this, par2, par3, par4))
@@ -3521,6 +3620,11 @@
else
{
if (var9 != null && (var9 == Block.waterMoving || var9 == Block.waterStill || var9 == Block.lavaMoving || var9 == Block.lavaStill || var9 == Block.fire || var9.blockMaterial.isGroundCover()))
+ {
+ var9 = null;
+ }
return par1 > 0 && var9 == null && var10.canPlaceBlockOnSide(this, par2, par3, par4, par6);
}
}
@@ -3656,7 +3753,7 @@
*/
public void setWorldTime(long par1)
{
- this.worldInfo.setWorldTime(par1);
+ provider.setWorldTime(par1);
}
/**
@@ -3664,12 +3761,12 @@
+
+ if (var9 != null && var9.isBlockReplaceable(this, par2, par3, par4))
{
var9 = null;
}
@@ -3738,7 +3842,7 @@
*/
public long getSeed()
{
@ -571,6 +574,9 @@
+ return provider.getSeed();
}
public long func_82737_E()
@@ -3748,7 +3852,7 @@
public long getWorldTime()
{
- return this.worldInfo.getWorldTime();
@ -578,7 +584,16 @@
}
/**
@@ -3677,13 +3774,13 @@
@@ -3756,7 +3860,7 @@
*/
public void setWorldTime(long par1)
{
- this.worldInfo.setWorldTime(par1);
+ provider.setWorldTime(par1);
}
/**
@@ -3764,13 +3868,13 @@
*/
public ChunkCoordinates getSpawnPoint()
{
@ -594,7 +609,7 @@
}
@SideOnly(Side.CLIENT)
@@ -3707,7 +3804,10 @@
@@ -3794,7 +3898,10 @@
if (!this.loadedEntityList.contains(par1Entity))
{
@ -606,7 +621,7 @@
}
}
@@ -3715,6 +3815,11 @@
@@ -3802,6 +3909,11 @@
* Called when checking if a certain block can be mined or not. The 'spawn safe zone' check is located here.
*/
public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4)
@ -618,7 +633,7 @@
{
return true;
}
@@ -3827,8 +3932,7 @@
@@ -3919,8 +4031,7 @@
*/
public boolean isBlockHighHumidity(int par1, int par2, int par3)
{
@ -628,7 +643,7 @@
}
/**
@@ -3882,7 +3986,7 @@
@@ -3982,7 +4093,7 @@
*/
public int getHeight()
{
@ -637,7 +652,7 @@
}
/**
@@ -3890,7 +3994,7 @@
@@ -3990,7 +4101,7 @@
*/
public int getActualHeight()
{
@ -645,8 +660,8 @@
+ return provider.getActualHeight();
}
/**
@@ -3936,7 +4040,7 @@
public IUpdatePlayerListBox func_82735_a(EntityMinecart par1EntityMinecart)
@@ -4033,7 +4144,7 @@
*/
public double getHorizon()
{
@ -655,9 +670,9 @@
}
/**
@@ -3964,4 +4068,75 @@
var7.destroyBlockPartially(par1, par2, par3, par4, par5);
}
@@ -4066,4 +4177,75 @@
{
return this.field_82741_K;
}
+
+ /**