ForgePatch/patches_old/minecraft/net/minecraft/world/World.java.patch

1154 lines
49 KiB
Diff

--- ../src-base/minecraft/net/minecraft/world/World.java
+++ ../src-work/minecraft/net/minecraft/world/World.java
@@ -63,8 +63,15 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public abstract class World implements IBlockAccess
+public abstract class World implements IBlockAccess, net.minecraftforge.common.capabilities.ICapabilityProvider
{
+ /**
+ * Used in the getEntitiesWithinAABB functions to expand the search area for entities.
+ * Modders should change this variable to a higher value if it is less then the radius
+ * of one of there entities.
+ */
+ public static double MAX_ENTITY_RADIUS = 2.0D;
+
private int field_181546_a = 63;
protected boolean field_72999_e;
public final List<Entity> field_72996_f = Lists.<Entity>newArrayList();
@@ -108,6 +115,12 @@
private final WorldBorder field_175728_M;
int[] field_72994_J;
+ public boolean restoringBlockSnapshots = false;
+ public boolean captureBlockSnapshots = false;
+ public java.util.ArrayList<net.minecraftforge.common.util.BlockSnapshot> capturedBlockSnapshots = new java.util.ArrayList<net.minecraftforge.common.util.BlockSnapshot>();
+ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities;
+ private net.minecraftforge.common.util.WorldCapabilityData capabilityData;
+
protected World(ISaveHandler p_i45749_1_, WorldInfo p_i45749_2_, WorldProvider p_i45749_3_, Profiler p_i45749_4_, boolean p_i45749_5_)
{
this.field_73021_x = Lists.newArrayList(this.field_184152_t);
@@ -122,6 +135,7 @@
this.field_73011_w = p_i45749_3_;
this.field_72995_K = p_i45749_5_;
this.field_175728_M = p_i45749_3_.func_177501_r();
+ perWorldStorage = new MapStorage((ISaveHandler)null);
}
public World func_175643_b()
@@ -131,6 +145,11 @@
public Biome func_180494_b(final BlockPos p_180494_1_)
{
+ return this.field_73011_w.getBiomeForCoords(p_180494_1_);
+ }
+
+ public Biome getBiomeForCoordsBody(final BlockPos p_180494_1_)
+ {
if (this.func_175667_e(p_180494_1_))
{
Chunk chunk = this.func_175726_f(p_180494_1_);
@@ -207,7 +226,7 @@
public boolean func_175623_d(BlockPos p_175623_1_)
{
- return this.func_180495_p(p_175623_1_).func_185904_a() == Material.field_151579_a;
+ return this.func_180495_p(p_175623_1_).func_177230_c().isAir(this.func_180495_p(p_175623_1_), this, p_175623_1_);
}
public boolean func_175667_e(BlockPos p_175667_1_)
@@ -308,24 +327,51 @@
else
{
Chunk chunk = this.func_175726_f(p_180501_1_);
- Block block = p_180501_2_.func_177230_c();
+
+ p_180501_1_ = p_180501_1_.func_185334_h(); // Forge - prevent mutable BlockPos leaks
+ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null;
+ if (this.captureBlockSnapshots && !this.field_72995_K)
+ {
+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, p_180501_1_, p_180501_3_);
+ this.capturedBlockSnapshots.add(blockSnapshot);
+ }
+ IBlockState oldState = func_180495_p(p_180501_1_);
+ int oldLight = oldState.getLightValue(this, p_180501_1_);
+ int oldOpacity = oldState.getLightOpacity(this, p_180501_1_);
+
IBlockState iblockstate = chunk.func_177436_a(p_180501_1_, p_180501_2_);
if (iblockstate == null)
{
+ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot);
return false;
}
else
{
- if (p_180501_2_.func_185891_c() != iblockstate.func_185891_c() || p_180501_2_.func_185906_d() != iblockstate.func_185906_d())
+ if (p_180501_2_.getLightOpacity(this, p_180501_1_) != oldOpacity || p_180501_2_.getLightValue(this, p_180501_1_) != oldLight)
{
this.field_72984_F.func_76320_a("checkLight");
this.func_175664_x(p_180501_1_);
this.field_72984_F.func_76319_b();
}
- if ((p_180501_3_ & 2) != 0 && (!this.field_72995_K || (p_180501_3_ & 4) == 0) && chunk.func_150802_k())
+ if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates
{
+ this.markAndNotifyBlock(p_180501_1_, chunk, iblockstate, p_180501_2_, p_180501_3_);
+ }
+ return true;
+ }
+ }
+ }
+
+ // Split off from original setBlockState(BlockPos, IBlockState, int) method in order to directly send client and physic updates
+ public void markAndNotifyBlock(BlockPos p_180501_1_, @Nullable Chunk chunk, IBlockState iblockstate, IBlockState p_180501_2_, int p_180501_3_)
+ {
+ Block block = p_180501_2_.func_177230_c();
+ {
+ {
+ if ((p_180501_3_ & 2) != 0 && (!this.field_72995_K || (p_180501_3_ & 4) == 0) && (chunk == null || chunk.func_150802_k()))
+ {
this.func_184138_a(p_180501_1_, iblockstate, p_180501_2_, p_180501_3_);
}
@@ -342,8 +388,6 @@
{
this.func_190522_c(p_180501_1_, block);
}
-
- return true;
}
}
}
@@ -358,7 +402,7 @@
IBlockState iblockstate = this.func_180495_p(p_175655_1_);
Block block = iblockstate.func_177230_c();
- if (iblockstate.func_185904_a() == Material.field_151579_a)
+ if (block.isAir(iblockstate, this, p_175655_1_))
{
return false;
}
@@ -441,6 +485,9 @@
public void func_175685_c(BlockPos p_175685_1_, Block p_175685_2_, boolean p_175685_3_)
{
+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_175685_1_, this.func_180495_p(p_175685_1_), java.util.EnumSet.allOf(EnumFacing.class), p_175685_3_).isCanceled())
+ return;
+
this.func_190524_a(p_175685_1_.func_177976_e(), p_175685_2_, p_175685_1_);
this.func_190524_a(p_175685_1_.func_177974_f(), p_175685_2_, p_175685_1_);
this.func_190524_a(p_175685_1_.func_177977_b(), p_175685_2_, p_175685_1_);
@@ -456,6 +503,11 @@
public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, EnumFacing p_175695_3_)
{
+ java.util.EnumSet<EnumFacing> directions = java.util.EnumSet.allOf(EnumFacing.class);
+ directions.remove(p_175695_3_);
+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_175695_1_, this.func_180495_p(p_175695_1_), directions, false).isCanceled())
+ return;
+
if (p_175695_3_ != EnumFacing.WEST)
{
this.func_190524_a(p_175695_1_.func_177976_e(), p_175695_2_, p_175695_1_);
@@ -507,7 +559,7 @@
{
try
{
- return String.format("ID #%d (%s // %s)", Block.func_149682_b(p_190524_2_), p_190524_2_.func_149739_a(), p_190524_2_.getClass().getCanonicalName());
+ return String.format("ID #%d (%s // %s // %s)", Block.func_149682_b(p_190524_2_), p_190524_2_.func_149739_a(), p_190524_2_.getClass().getName(), p_190524_2_.getRegistryName());
}
catch (Throwable var2)
{
@@ -527,11 +579,11 @@
{
IBlockState iblockstate = this.func_180495_p(p_190529_1_);
- if (iblockstate.func_177230_c() == Blocks.field_190976_dk)
+ if (true)
{
try
{
- ((BlockObserver)iblockstate.func_177230_c()).func_190962_b(iblockstate, this, p_190529_1_, p_190529_2_, p_190529_3_);
+ iblockstate.func_177230_c().observedNeighborChange(iblockstate, this, p_190529_1_, p_190529_2_, p_190529_3_);
}
catch (Throwable throwable)
{
@@ -543,7 +595,7 @@
{
try
{
- return String.format("ID #%d (%s // %s)", Block.func_149682_b(p_190529_2_), p_190529_2_.func_149739_a(), p_190529_2_.getClass().getCanonicalName());
+ return String.format("ID #%d (%s // %s // %s)", Block.func_149682_b(p_190529_2_), p_190529_2_.func_149739_a(), p_190529_2_.getClass().getName(), p_190529_2_.getRegistryName());
}
catch (Throwable var2)
{
@@ -588,7 +640,7 @@
{
IBlockState iblockstate = this.func_180495_p(blockpos1);
- if (iblockstate.func_185891_c() > 0 && !iblockstate.func_185904_a().func_76224_d())
+ if (iblockstate.func_177230_c().getLightOpacity(iblockstate, this, blockpos) > 0 && !iblockstate.func_185904_a().func_76224_d())
{
return false;
}
@@ -862,7 +914,7 @@
public boolean func_72935_r()
{
- return this.field_73008_k < 4;
+ return this.field_73011_w.isDaytime();
}
@Nullable
@@ -1065,6 +1117,13 @@
public void func_184148_a(@Nullable EntityPlayer p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_)
{
+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_10_, p_184148_11_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_184148_8_ = event.getSound();
+ p_184148_9_ = event.getCategory();
+ p_184148_10_ = event.getVolume();
+ p_184148_11_ = event.getPitch();
+
for (int i = 0; i < this.field_73021_x.size(); ++i)
{
((IWorldEventListener)this.field_73021_x.get(i)).func_184375_a(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_, p_184148_11_);
@@ -1118,6 +1177,9 @@
public boolean func_72838_d(Entity p_72838_1_)
{
+ // do not drop any items while restoring blocksnapshots. Prevents dupes
+ if (!this.field_72995_K && (p_72838_1_ == null || (p_72838_1_ instanceof net.minecraft.entity.item.EntityItem && this.restoringBlockSnapshots))) return false;
+
int i = MathHelper.func_76128_c(p_72838_1_.field_70165_t / 16.0D);
int j = MathHelper.func_76128_c(p_72838_1_.field_70161_v / 16.0D);
boolean flag = p_72838_1_.field_98038_p;
@@ -1140,6 +1202,8 @@
this.func_72854_c();
}
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72838_1_, this)) && !flag) return false;
+
this.func_72964_e(i, j).func_76612_a(p_72838_1_);
this.field_72996_f.add(p_72838_1_);
this.func_72923_a(p_72838_1_);
@@ -1227,6 +1291,7 @@
IBlockState iblockstate = Blocks.field_150348_b.func_176223_P();
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.func_185346_s();
+ if (p_191504_3_ && !net.minecraftforge.event.ForgeEventFactory.gatherCollisionBoxes(this, p_191504_1_, p_191504_2_, p_191504_4_)) return true;
try
{
for (int k1 = i; k1 < j; ++k1)
@@ -1269,7 +1334,7 @@
iblockstate1.func_185908_a(this, blockpos$pooledmutableblockpos, p_191504_2_, p_191504_4_, p_191504_1_, false);
- if (p_191504_3_ && !p_191504_4_.isEmpty())
+ if (p_191504_3_ && !net.minecraftforge.event.ForgeEventFactory.gatherCollisionBoxes(this, p_191504_1_, p_191504_2_, p_191504_4_))
{
boolean flag5 = true;
return flag5;
@@ -1319,11 +1384,10 @@
}
}
}
-
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.GetCollisionBoxesEvent(this, p_184144_1_, p_184144_2_, list));
return list;
}
- @SideOnly(Side.CLIENT)
public void func_72848_b(IWorldEventListener p_72848_1_)
{
this.field_73021_x.remove(p_72848_1_);
@@ -1361,19 +1425,38 @@
public int func_72967_a(float p_72967_1_)
{
+ float f = field_73011_w.getSunBrightnessFactor(p_72967_1_);
+ f = 1 - f;
+ return (int)(f * 11);
+ }
+
+ /**
+ * The current sun brightness factor for this dimension.
+ * 0.0f means no light at all, and 1.0f means maximum sunlight.
+ * Highly recommended for sunlight detection like solar panel.
+ *
+ * @return The current brightness factor
+ * */
+ public float getSunBrightnessFactor(float p_72967_1_)
+ {
float f = this.func_72826_c(p_72967_1_);
float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F);
f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F);
f1 = 1.0F - f1;
f1 = (float)((double)f1 * (1.0D - (double)(this.func_72867_j(p_72967_1_) * 5.0F) / 16.0D));
f1 = (float)((double)f1 * (1.0D - (double)(this.func_72819_i(p_72967_1_) * 5.0F) / 16.0D));
- f1 = 1.0F - f1;
- return (int)(f1 * 11.0F);
+ return f1;
}
@SideOnly(Side.CLIENT)
public float func_72971_b(float p_72971_1_)
{
+ return this.field_73011_w.getSunBrightness(p_72971_1_);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public float getSunBrightnessBody(float p_72971_1_)
+ {
float f = this.func_72826_c(p_72971_1_);
float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.2F);
f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F);
@@ -1386,6 +1469,12 @@
@SideOnly(Side.CLIENT)
public Vec3d func_72833_a(Entity p_72833_1_, float p_72833_2_)
{
+ return this.field_73011_w.getSkyColor(p_72833_1_, p_72833_2_);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public Vec3d getSkyColorBody(Entity p_72833_1_, float p_72833_2_)
+ {
float f = this.func_72826_c(p_72833_2_);
float f1 = MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F;
f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F);
@@ -1393,9 +1482,7 @@
int j = MathHelper.func_76128_c(p_72833_1_.field_70163_u);
int k = MathHelper.func_76128_c(p_72833_1_.field_70161_v);
BlockPos blockpos = new BlockPos(i, j, k);
- Biome biome = this.func_180494_b(blockpos);
- float f2 = biome.func_180626_a(blockpos);
- int l = biome.func_76731_a(f2);
+ int l = net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(this, blockpos);
float f3 = (float)(l >> 16 & 255) / 255.0F;
float f4 = (float)(l >> 8 & 255) / 255.0F;
float f5 = (float)(l & 255) / 255.0F;
@@ -1444,20 +1531,25 @@
public float func_72826_c(float p_72826_1_)
{
- return this.field_73011_w.func_76563_a(this.field_72986_A.func_76073_f(), p_72826_1_);
+ return this.field_73011_w.func_76563_a(this.func_72820_D(), p_72826_1_);
}
@SideOnly(Side.CLIENT)
public int func_72853_d()
{
- return this.field_73011_w.func_76559_b(this.field_72986_A.func_76073_f());
+ return this.field_73011_w.func_76559_b(this.func_72820_D());
}
public float func_130001_d()
{
- return WorldProvider.field_111203_a[this.field_73011_w.func_76559_b(this.field_72986_A.func_76073_f())];
+ return field_73011_w.getCurrentMoonPhaseFactor();
}
+ public float getCurrentMoonPhaseFactorBody()
+ {
+ return WorldProvider.field_111203_a[this.field_73011_w.func_76559_b(this.func_72820_D())];
+ }
+
public float func_72929_e(float p_72929_1_)
{
float f = this.func_72826_c(p_72929_1_);
@@ -1467,6 +1559,12 @@
@SideOnly(Side.CLIENT)
public Vec3d func_72824_f(float p_72824_1_)
{
+ return this.field_73011_w.getCloudColor(p_72824_1_);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public Vec3d getCloudColorBody(float p_72824_1_)
+ {
float f = this.func_72826_c(p_72824_1_);
float f1 = MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F;
f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F);
@@ -1522,9 +1620,9 @@
for (blockpos = new BlockPos(p_175672_1_.func_177958_n(), chunk.func_76625_h() + 16, p_175672_1_.func_177952_p()); blockpos.func_177956_o() >= 0; blockpos = blockpos1)
{
blockpos1 = blockpos.func_177977_b();
- Material material = chunk.func_177435_g(blockpos1).func_185904_a();
+ IBlockState state = chunk.func_177435_g(blockpos1);
- if (material.func_76230_c() && material != Material.field_151584_j)
+ if (state.func_185904_a().func_76230_c() && !state.func_177230_c().isLeaves(state, this, blockpos1) && !state.func_177230_c().isFoliage(this, blockpos1))
{
break;
}
@@ -1536,6 +1634,12 @@
@SideOnly(Side.CLIENT)
public float func_72880_h(float p_72880_1_)
{
+ return this.field_73011_w.getStarBrightness(p_72880_1_);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public float getStarBrightnessBody(float p_72880_1_)
+ {
float f = this.func_72826_c(p_72880_1_);
float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.25F);
f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F);
@@ -1570,6 +1674,7 @@
try
{
+ if(entity.updateBlocked) continue;
++entity.field_70173_aa;
entity.func_70071_h_();
}
@@ -1587,6 +1692,12 @@
entity.func_85029_a(crashreportcategory);
}
+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities)
+ {
+ net.minecraftforge.fml.common.FMLLog.log.fatal("{}", crashreport.func_71502_e());
+ func_72900_e(entity);
+ }
+ else
throw new ReportedException(crashreport);
}
@@ -1641,13 +1752,21 @@
{
try
{
+ net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackStart(entity2);
this.func_72870_g(entity2);
+ net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackEnd(entity2);
}
catch (Throwable throwable1)
{
CrashReport crashreport1 = CrashReport.func_85055_a(throwable1, "Ticking entity");
CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Entity being ticked");
entity2.func_85029_a(crashreportcategory1);
+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities)
+ {
+ net.minecraftforge.fml.common.FMLLog.log.fatal("{}", crashreport1.func_71502_e());
+ func_72900_e(entity2);
+ }
+ else
throw new ReportedException(crashreport1);
}
}
@@ -1674,14 +1793,23 @@
this.field_72984_F.func_76318_c("blockEntities");
+ this.field_147481_N = true; //FML Move above remove to prevent CMEs
+
if (!this.field_147483_b.isEmpty())
{
- this.field_175730_i.removeAll(this.field_147483_b);
- this.field_147482_g.removeAll(this.field_147483_b);
+ for (Object tile : field_147483_b)
+ {
+ ((TileEntity)tile).onChunkUnload();
+ }
+
+ // forge: faster "contains" makes this removal much more efficient
+ java.util.Set<TileEntity> remove = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>());
+ remove.addAll(field_147483_b);
+ this.field_175730_i.removeAll(remove);
+ this.field_147482_g.removeAll(remove);
this.field_147483_b.clear();
}
- this.field_147481_N = true;
Iterator<TileEntity> iterator = this.field_175730_i.iterator();
while (iterator.hasNext())
@@ -1692,7 +1820,7 @@
{
BlockPos blockpos = tileentity.func_174877_v();
- if (this.func_175667_e(blockpos) && this.field_175728_M.func_177746_a(blockpos))
+ if (this.func_175668_a(blockpos, false) && this.field_175728_M.func_177746_a(blockpos)) //Forge: Fix TE's getting an extra tick on the client side....
{
try
{
@@ -1700,7 +1828,9 @@
{
return String.valueOf((Object)TileEntity.func_190559_a(tileentity.getClass()));
});
+ net.minecraftforge.server.timings.TimeTracker.TILE_ENTITY_UPDATE.trackStart(tileentity);
((ITickable)tileentity).func_73660_a();
+ net.minecraftforge.server.timings.TimeTracker.TILE_ENTITY_UPDATE.trackEnd(tileentity);
this.field_72984_F.func_76319_b();
}
catch (Throwable throwable)
@@ -1708,6 +1838,13 @@
CrashReport crashreport2 = CrashReport.func_85055_a(throwable, "Ticking block entity");
CrashReportCategory crashreportcategory2 = crashreport2.func_85058_a("Block entity being ticked");
tileentity.func_145828_a(crashreportcategory2);
+ if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities)
+ {
+ net.minecraftforge.fml.common.FMLLog.log.fatal("{}", crashreport2.func_71502_e());
+ tileentity.func_145843_s();
+ this.func_175713_t(tileentity.func_174877_v());
+ }
+ else
throw new ReportedException(crashreport2);
}
}
@@ -1720,7 +1857,10 @@
if (this.func_175667_e(tileentity.func_174877_v()))
{
- this.func_175726_f(tileentity.func_174877_v()).func_177425_e(tileentity.func_174877_v());
+ //Forge: Bugfix: If we set the tile entity it immediately sets it in the chunk, so we could be desyned
+ Chunk chunk = this.func_175726_f(tileentity.func_174877_v());
+ if (chunk.func_177424_a(tileentity.func_174877_v(), net.minecraft.world.chunk.Chunk.EnumCreateEntityType.CHECK) == tileentity)
+ chunk.func_177425_e(tileentity.func_174877_v());
}
}
}
@@ -1764,12 +1904,18 @@
public boolean func_175700_a(TileEntity p_175700_1_)
{
+ // Forge - set the world early as vanilla doesn't set it until next tick
+ if (p_175700_1_.func_145831_w() != this) p_175700_1_.func_145834_a(this);
+ // Forge: wait to add new TE if we're currently processing existing ones
+ if (field_147481_N) return field_147484_a.add(p_175700_1_);
+
boolean flag = this.field_147482_g.add(p_175700_1_);
if (flag && p_175700_1_ instanceof ITickable)
{
this.field_175730_i.add(p_175700_1_);
}
+ p_175700_1_.onLoad();
if (this.field_72995_K)
{
@@ -1785,6 +1931,11 @@
{
if (this.field_147481_N)
{
+ for (TileEntity te : p_147448_1_)
+ {
+ if (te.func_145831_w() != this) // Forge - set the world early as vanilla doesn't set it until next tick
+ te.func_145834_a(this);
+ }
this.field_147484_a.addAll(p_147448_1_);
}
else
@@ -1807,9 +1958,13 @@
{
int j2 = MathHelper.func_76128_c(p_72866_1_.field_70165_t);
int k2 = MathHelper.func_76128_c(p_72866_1_.field_70161_v);
- int l2 = 32;
- if (p_72866_2_ && !this.func_175663_a(j2 - 32, 0, k2 - 32, j2 + 32, 0, k2 + 32, true))
+ boolean isForced = getPersistentChunks().containsKey(new net.minecraft.util.math.ChunkPos(j2 >> 4, k2 >> 4));
+ int range = isForced ? 0 : 32;
+ boolean canUpdate = !p_72866_2_ || this.func_175663_a(j2 - range, 0, k2 - range, j2 + range, 0, k2 + range, true);
+ if (!canUpdate) canUpdate = net.minecraftforge.event.ForgeEventFactory.canEntityUpdate(p_72866_1_);
+
+ if (!canUpdate)
{
return;
}
@@ -1831,6 +1986,7 @@
}
else
{
+ if(!p_72866_1_.updateBlocked)
p_72866_1_.func_70071_h_();
}
}
@@ -1914,7 +2070,7 @@
{
Entity entity4 = list.get(j2);
- if (!entity4.field_70128_L && entity4.field_70156_m && entity4 != p_72917_2_ && (p_72917_2_ == null || entity4.func_184223_x(p_72917_2_)))
+ if (!entity4.field_70128_L && entity4.field_70156_m && entity4 != p_72917_2_ && (p_72917_2_ == null || !entity4.func_184223_x(p_72917_2_))) // Forge: fix MC-103516
{
return false;
}
@@ -1972,6 +2128,12 @@
{
IBlockState iblockstate1 = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(l3, i4, j4));
+ Boolean result = iblockstate1.func_177230_c().isAABBInsideLiquid(this, blockpos$pooledmutableblockpos, p_72953_1_);
+ if (result != null) {
+ if (!result) continue;
+ blockpos$pooledmutableblockpos.func_185344_t();
+ return true;
+ }
if (iblockstate1.func_185904_a().func_76224_d())
{
blockpos$pooledmutableblockpos.func_185344_t();
@@ -2011,6 +2173,11 @@
blockpos$pooledmutableblockpos.func_185344_t();
return true;
}
+ else if (block.isBurning(this, new BlockPos(l3, i4, j4)))
+ {
+ blockpos$pooledmutableblockpos.func_185344_t();
+ return true;
+ }
}
}
}
@@ -2050,6 +2217,16 @@
IBlockState iblockstate1 = this.func_180495_p(blockpos$pooledmutableblockpos);
Block block = iblockstate1.func_177230_c();
+ Boolean result = block.isEntityInsideMaterial(this, blockpos$pooledmutableblockpos, iblockstate1, p_72918_3_, (double)i3, p_72918_2_, false);
+ if (result != null && result == true)
+ {
+ // Forge: When requested call blocks modifyAcceleration method, and more importantly cause this method to return true, which results in an entity being "inWater"
+ flag = true;
+ vec3d = block.func_176197_a(this, blockpos$pooledmutableblockpos, p_72918_3_, vec3d);
+ continue;
+ }
+ else if (result != null && result == false) continue;
+
if (iblockstate1.func_185904_a() == p_72918_2_)
{
double d0 = (double)((float)(i4 + 1) - BlockLiquid.func_149801_b(((Integer)iblockstate1.func_177229_b(BlockLiquid.field_176367_b)).intValue()));
@@ -2095,7 +2272,14 @@
{
for (int j4 = j3; j4 < k3; ++j4)
{
- if (this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(l3, i4, j4)).func_185904_a() == p_72875_2_)
+ IBlockState iblockstate1 = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(l3, i4, j4));
+ Boolean result = iblockstate1.func_177230_c().isAABBInsideMaterial(this, blockpos$pooledmutableblockpos, p_72875_1_, p_72875_2_);
+ if (result != null) {
+ if (!result) continue;
+ blockpos$pooledmutableblockpos.func_185344_t();
+ return true;
+ }
+ if (iblockstate1.func_185904_a() == p_72875_2_)
{
blockpos$pooledmutableblockpos.func_185344_t();
return true;
@@ -2116,6 +2300,7 @@
public Explosion func_72885_a(@Nullable Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_)
{
Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_);
+ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion;
explosion.func_77278_a();
explosion.func_77279_a(true);
return explosion;
@@ -2238,6 +2423,7 @@
public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_)
{
+ p_175690_1_ = p_175690_1_.func_185334_h(); // Forge - prevent mutable BlockPos leaks
if (!this.func_189509_E(p_175690_1_))
{
if (p_175690_2_ != null && !p_175690_2_.func_145837_r())
@@ -2245,6 +2431,8 @@
if (this.field_147481_N)
{
p_175690_2_.func_174878_a(p_175690_1_);
+ if (p_175690_2_.func_145831_w() != this)
+ p_175690_2_.func_145834_a(this); // Forge - set the world early as vanilla doesn't set it until next tick
Iterator<TileEntity> iterator1 = this.field_147484_a.iterator();
while (iterator1.hasNext())
@@ -2262,7 +2450,8 @@
}
else
{
- this.func_175726_f(p_175690_1_).func_177426_a(p_175690_1_, p_175690_2_);
+ Chunk chunk = this.func_175726_f(p_175690_1_);
+ if (chunk != null) chunk.func_177426_a(p_175690_1_, p_175690_2_);
this.func_175700_a(p_175690_2_);
}
}
@@ -2277,6 +2466,8 @@
{
tileentity2.func_145843_s();
this.field_147484_a.remove(tileentity2);
+ if (!(tileentity2 instanceof ITickable)) //Forge: If they are not tickable they wont be removed in the update loop.
+ this.field_147482_g.remove(tileentity2);
}
else
{
@@ -2289,6 +2480,7 @@
this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_);
}
+ this.func_175666_e(p_175713_1_, func_180495_p(p_175713_1_).func_177230_c()); //Notify neighbors of changes
}
public void func_147457_a(TileEntity p_147457_1_)
@@ -2315,7 +2507,7 @@
if (chunk1 != null && !chunk1.func_76621_g())
{
IBlockState iblockstate1 = this.func_180495_p(p_175677_1_);
- return iblockstate1.func_185904_a().func_76218_k() && iblockstate1.func_185917_h();
+ return iblockstate1.func_177230_c().isNormalCube(iblockstate1, this, p_175677_1_);
}
else
{
@@ -2338,6 +2530,7 @@
{
this.field_72985_G = p_72891_1_;
this.field_72992_H = p_72891_2_;
+ this.field_73011_w.setAllowedSpawnTypes(p_72891_1_, p_72891_2_);
}
public void func_72835_b()
@@ -2347,6 +2540,11 @@
protected void func_72947_a()
{
+ this.field_73011_w.calculateInitialWeather();
+ }
+
+ public void calculateInitialWeatherBody()
+ {
if (this.field_72986_A.func_76059_o())
{
this.field_73004_o = 1.0F;
@@ -2360,6 +2558,11 @@
protected void func_72979_l()
{
+ this.field_73011_w.updateWeather();
+ }
+
+ public void updateWeatherBody()
+ {
if (this.field_73011_w.func_191066_m())
{
if (!this.field_72995_K)
@@ -2484,6 +2687,11 @@
public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_)
{
+ return this.field_73011_w.canBlockFreeze(p_175670_1_, p_175670_2_);
+ }
+
+ public boolean canBlockFreezeBody(BlockPos p_175670_1_, boolean p_175670_2_)
+ {
Biome biome = this.func_180494_b(p_175670_1_);
float f = biome.func_180626_a(p_175670_1_);
@@ -2525,6 +2733,11 @@
public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_)
{
+ return this.field_73011_w.canSnowAt(p_175708_1_, p_175708_2_);
+ }
+
+ public boolean canSnowAtBody(BlockPos p_175708_1_, boolean p_175708_2_)
+ {
Biome biome = this.func_180494_b(p_175708_1_);
float f = biome.func_180626_a(p_175708_1_);
@@ -2542,7 +2755,7 @@
{
IBlockState iblockstate1 = this.func_180495_p(p_175708_1_);
- if (iblockstate1.func_185904_a() == Material.field_151579_a && Blocks.field_150431_aC.func_176196_c(this, p_175708_1_))
+ if (iblockstate1.func_177230_c().isAir(iblockstate1, this, p_175708_1_) && Blocks.field_150431_aC.func_176196_c(this, p_175708_1_))
{
return true;
}
@@ -2574,10 +2787,10 @@
else
{
IBlockState iblockstate1 = this.func_180495_p(p_175638_1_);
- int j2 = p_175638_2_ == EnumSkyBlock.SKY ? 0 : iblockstate1.func_185906_d();
- int k2 = iblockstate1.func_185891_c();
+ int j2 = p_175638_2_ == EnumSkyBlock.SKY ? 0 : iblockstate1.func_177230_c().getLightValue(iblockstate1, this, p_175638_1_);
+ int k2 = iblockstate1.func_177230_c().getLightOpacity(iblockstate1, this, p_175638_1_);
- if (k2 >= 15 && iblockstate1.func_185906_d() > 0)
+ if (false) // Forge: fix MC-119932
{
k2 = 1;
}
@@ -2589,7 +2802,7 @@
if (k2 >= 15)
{
- return 0;
+ return j2; // Forge: fix MC-119932
}
else if (j2 >= 14)
{
@@ -2630,12 +2843,13 @@
public boolean func_180500_c(EnumSkyBlock p_180500_1_, BlockPos p_180500_2_)
{
- if (!this.func_175648_a(p_180500_2_, 17, false))
+ if (!this.func_175648_a(p_180500_2_, 16, false))
{
return false;
}
else
{
+ int updateRange = this.func_175648_a(p_180500_2_, 18, false) ? 17 : 15;
int j2 = 0;
int k2 = 0;
this.field_72984_F.func_76320_a("getBrightness");
@@ -2673,7 +2887,7 @@
int l5 = MathHelper.func_76130_a(k4 - k3);
int i6 = MathHelper.func_76130_a(l4 - l3);
- if (k5 + l5 + i6 < 17)
+ if (k5 + l5 + i6 < updateRange)
{
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.func_185346_s();
@@ -2683,7 +2897,8 @@
int k6 = k4 + enumfacing.func_96559_d();
int l6 = l4 + enumfacing.func_82599_e();
blockpos$pooledmutableblockpos.func_181079_c(j6, k6, l6);
- int i7 = Math.max(1, this.func_180495_p(blockpos$pooledmutableblockpos).func_185891_c());
+ IBlockState bs = this.func_180495_p(blockpos$pooledmutableblockpos);
+ int i7 = Math.max(1, bs.func_177230_c().getLightOpacity(bs, this, blockpos$pooledmutableblockpos));
j5 = this.func_175642_b(p_180500_1_, blockpos$pooledmutableblockpos);
if (j5 == i5 - i7 && k2 < this.field_72994_J.length)
@@ -2725,7 +2940,7 @@
int j9 = Math.abs(i8 - l3);
boolean flag = k2 < this.field_72994_J.length - 6;
- if (l8 + i9 + j9 < 17 && flag)
+ if (l8 + i9 + j9 < updateRange && flag)
{
if (this.func_175642_b(p_180500_1_, blockpos2.func_177976_e()) < k8)
{
@@ -2791,10 +3006,10 @@
public List<Entity> func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate <? super Entity > p_175674_3_)
{
List<Entity> list = Lists.<Entity>newArrayList();
- int j2 = MathHelper.func_76128_c((p_175674_2_.field_72340_a - 2.0D) / 16.0D);
- int k2 = MathHelper.func_76128_c((p_175674_2_.field_72336_d + 2.0D) / 16.0D);
- int l2 = MathHelper.func_76128_c((p_175674_2_.field_72339_c - 2.0D) / 16.0D);
- int i3 = MathHelper.func_76128_c((p_175674_2_.field_72334_f + 2.0D) / 16.0D);
+ int j2 = MathHelper.func_76128_c((p_175674_2_.field_72340_a - MAX_ENTITY_RADIUS) / 16.0D);
+ int k2 = MathHelper.func_76128_c((p_175674_2_.field_72336_d + MAX_ENTITY_RADIUS) / 16.0D);
+ int l2 = MathHelper.func_76128_c((p_175674_2_.field_72339_c - MAX_ENTITY_RADIUS) / 16.0D);
+ int i3 = MathHelper.func_76128_c((p_175674_2_.field_72334_f + MAX_ENTITY_RADIUS) / 16.0D);
for (int j3 = j2; j3 <= k2; ++j3)
{
@@ -2847,10 +3062,10 @@
public <T extends Entity> List<T> func_175647_a(Class <? extends T > p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate <? super T > p_175647_3_)
{
- int j2 = MathHelper.func_76128_c((p_175647_2_.field_72340_a - 2.0D) / 16.0D);
- int k2 = MathHelper.func_76143_f((p_175647_2_.field_72336_d + 2.0D) / 16.0D);
- int l2 = MathHelper.func_76128_c((p_175647_2_.field_72339_c - 2.0D) / 16.0D);
- int i3 = MathHelper.func_76143_f((p_175647_2_.field_72334_f + 2.0D) / 16.0D);
+ int j2 = MathHelper.func_76128_c((p_175647_2_.field_72340_a - MAX_ENTITY_RADIUS) / 16.0D);
+ int k2 = MathHelper.func_76143_f((p_175647_2_.field_72336_d + MAX_ENTITY_RADIUS) / 16.0D);
+ int l2 = MathHelper.func_76128_c((p_175647_2_.field_72339_c - MAX_ENTITY_RADIUS) / 16.0D);
+ int i3 = MathHelper.func_76143_f((p_175647_2_.field_72334_f + MAX_ENTITY_RADIUS) / 16.0D);
List<T> list = Lists.<T>newArrayList();
for (int j3 = j2; j3 < k2; ++j3)
@@ -2930,11 +3145,13 @@
public void func_175650_b(Collection<Entity> p_175650_1_)
{
- this.field_72996_f.addAll(p_175650_1_);
-
for (Entity entity4 : p_175650_1_)
{
- this.func_72923_a(entity4);
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity4, this)))
+ {
+ field_72996_f.add(entity4);
+ this.func_72923_a(entity4);
+ }
}
}
@@ -2958,7 +3175,7 @@
}
else
{
- return iblockstate1.func_185904_a().func_76222_j() && p_190527_1_.func_176198_a(this, p_190527_2_, p_190527_4_);
+ return iblockstate1.func_177230_c().func_176200_f(this, p_190527_2_) && p_190527_1_.func_176198_a(this, p_190527_2_, p_190527_4_);
}
}
@@ -3042,7 +3259,7 @@
public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_)
{
IBlockState iblockstate1 = this.func_180495_p(p_175651_1_);
- return iblockstate1.func_185915_l() ? this.func_175676_y(p_175651_1_) : iblockstate1.func_185911_a(this, p_175651_1_, p_175651_2_);
+ return iblockstate1.func_177230_c().shouldCheckWeakPower(iblockstate1, this, p_175651_1_, p_175651_2_) ? this.func_175676_y(p_175651_1_) : iblockstate1.func_185911_a(this, p_175651_1_, p_175651_2_);
}
public boolean func_175640_z(BlockPos p_175640_1_)
@@ -3208,6 +3425,8 @@
d2 *= ((Double)MoreObjects.firstNonNull(p_184150_11_.apply(entityplayer1), Double.valueOf(1.0D))).doubleValue();
}
+ d2 = net.minecraftforge.common.ForgeHooks.getPlayerVisibilityDistance(entityplayer1, d2, p_184150_9_);
+
if ((p_184150_9_ < 0.0D || Math.abs(entityplayer1.field_70163_u - p_184150_3_) < p_184150_9_ * p_184150_9_) && (p_184150_7_ < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0))
{
d0 = d1;
@@ -3269,7 +3488,7 @@
public long func_72905_C()
{
- return this.field_72986_A.func_76063_b();
+ return this.field_73011_w.getSeed();
}
public long func_82737_E()
@@ -3279,17 +3498,17 @@
public long func_72820_D()
{
- return this.field_72986_A.func_76073_f();
+ return this.field_73011_w.getWorldTime();
}
public void func_72877_b(long p_72877_1_)
{
- this.field_72986_A.func_76068_b(p_72877_1_);
+ this.field_73011_w.setWorldTime(p_72877_1_);
}
public BlockPos func_175694_M()
{
- BlockPos blockpos1 = new BlockPos(this.field_72986_A.func_76079_c(), this.field_72986_A.func_76075_d(), this.field_72986_A.func_76074_e());
+ BlockPos blockpos1 = this.field_73011_w.getSpawnPoint();
if (!this.func_175723_af().func_177746_a(blockpos1))
{
@@ -3301,7 +3520,7 @@
public void func_175652_B(BlockPos p_175652_1_)
{
- this.field_72986_A.func_176143_a(p_175652_1_);
+ this.field_73011_w.setSpawnPoint(p_175652_1_);
}
@SideOnly(Side.CLIENT)
@@ -3321,12 +3540,18 @@
if (!this.field_72996_f.contains(p_72897_1_))
{
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72897_1_, this)))
this.field_72996_f.add(p_72897_1_);
}
}
public boolean func_175660_a(EntityPlayer p_175660_1_, BlockPos p_175660_2_)
{
+ return this.field_73011_w.canMineBlock(p_175660_1_, p_175660_2_);
+ }
+
+ public boolean canMineBlockBody(EntityPlayer p_175660_1_, BlockPos p_175660_2_)
+ {
return true;
}
@@ -3428,8 +3653,7 @@
public boolean func_180502_D(BlockPos p_180502_1_)
{
- Biome biome = this.func_180494_b(p_180502_1_);
- return biome.func_76736_e();
+ return this.field_73011_w.isBlockHighHumidity(p_180502_1_);
}
@Nullable
@@ -3490,12 +3714,12 @@
public int func_72800_K()
{
- return 256;
+ return this.field_73011_w.getHeight();
}
public int func_72940_L()
{
- return this.field_73011_w.func_177495_o() ? 128 : 256;
+ return this.field_73011_w.getActualHeight();
}
public Random func_72843_D(int p_72843_1_, int p_72843_2_, int p_72843_3_)
@@ -3539,7 +3763,7 @@
@SideOnly(Side.CLIENT)
public double func_72919_O()
{
- return this.field_72986_A.func_76067_t() == WorldType.field_77138_c ? 0.0D : 63.0D;
+ return field_73011_w.getHorizon();
}
public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_)
@@ -3573,7 +3797,7 @@
public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_)
{
- for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
+ for (EnumFacing enumfacing : EnumFacing.field_82609_l)
{
BlockPos blockpos1 = p_175666_1_.func_177972_a(enumfacing);
@@ -3581,18 +3805,15 @@
{
IBlockState iblockstate1 = this.func_180495_p(blockpos1);
- if (Blocks.field_150441_bU.func_185547_C(iblockstate1))
+ iblockstate1.func_177230_c().onNeighborChange(this, blockpos1, p_175666_1_);
+ if (iblockstate1.func_177230_c().isNormalCube(iblockstate1, this, blockpos1))
{
- iblockstate1.func_189546_a(this, blockpos1, p_175666_2_, p_175666_1_);
- }
- else if (iblockstate1.func_185915_l())
- {
blockpos1 = blockpos1.func_177972_a(enumfacing);
iblockstate1 = this.func_180495_p(blockpos1);
- if (Blocks.field_150441_bU.func_185547_C(iblockstate1))
+ if (iblockstate1.func_177230_c().getWeakChanges(this, blockpos1))
{
- iblockstate1.func_189546_a(this, blockpos1, p_175666_2_, p_175666_1_);
+ iblockstate1.func_177230_c().onNeighborChange(this, blockpos1, p_175666_1_);
}
}
}
@@ -3658,6 +3879,124 @@
return j2 >= -128 && j2 <= 128 && k2 >= -128 && k2 <= 128;
}
+ /* ======================================== FORGE START =====================================*/
+ /**
+ * Determine if the given block is considered solid on the
+ * specified side. Used by placement logic.
+ *
+ * @param pos Block Position
+ * @param side The Side in question
+ * @return True if the side is solid
+ */
+ public boolean isSideSolid(BlockPos pos, EnumFacing side)
+ {
+ return isSideSolid(pos, side, false);
+ }
+
+ /**
+ * Determine if the given block is considered solid on the
+ * specified side. Used by placement logic.
+ *
+ * @param pos Block Position
+ * @param side The Side in question
+ * @param _default The default to return if the block doesn't exist.
+ * @return True if the side is solid
+ */
+ @Override
+ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default)
+ {
+ if (!this.func_175701_a(pos)) return _default;
+
+ Chunk chunk = func_175726_f(pos);
+ if (chunk == null || chunk.func_76621_g()) return _default;
+ return func_180495_p(pos).isSideSolid(this, pos, side);
+ }
+
+ /**
+ * Get the persistent chunks for this world
+ *
+ * @return
+ */
+ public com.google.common.collect.ImmutableSetMultimap<net.minecraft.util.math.ChunkPos, net.minecraftforge.common.ForgeChunkManager.Ticket> getPersistentChunks()
+ {
+ return net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this);
+ }
+
+ public Iterator<Chunk> getPersistentChunkIterable(Iterator<Chunk> chunkIterator)
+ {
+ return net.minecraftforge.common.ForgeChunkManager.getPersistentChunksIterableFor(this, chunkIterator);
+ }
+ /**
+ * Readded as it was removed, very useful helper function
+ *
+ * @param pos Block position
+ * @return The blocks light opacity
+ */
+ public int getBlockLightOpacity(BlockPos pos)
+ {
+ if (!this.func_175701_a(pos)) return 0;
+ return func_175726_f(pos).func_177437_b(pos);
+ }
+
+ /**
+ * Returns a count of entities that classify themselves as the specified creature type.
+ */
+ public int countEntities(net.minecraft.entity.EnumCreatureType type, boolean forSpawnCount)
+ {
+ int count = 0;
+ for (int x = 0; x < field_72996_f.size(); x++)
+ {
+ if (((Entity)field_72996_f.get(x)).isCreatureType(type, forSpawnCount))
+ {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ @Deprecated // remove in 1.13
+ public void markTileEntitiesInChunkForRemoval(Chunk chunk)
+ {
+ for (TileEntity tileentity : chunk.func_177434_r().values())
+ {
+ func_147457_a(tileentity);
+ }
+ }
+
+ protected void initCapabilities()
+ {
+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = field_73011_w.initCapabilities();
+ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this, parent);
+ net.minecraftforge.common.util.WorldCapabilityData data = (net.minecraftforge.common.util.WorldCapabilityData)perWorldStorage.func_75742_a(net.minecraftforge.common.util.WorldCapabilityData.class, net.minecraftforge.common.util.WorldCapabilityData.ID);
+ if (data == null)
+ {
+ capabilityData = new net.minecraftforge.common.util.WorldCapabilityData(capabilities);
+ perWorldStorage.func_75745_a(capabilityData.field_76190_i, capabilityData);
+ }
+ else
+ {
+ capabilityData = data;
+ capabilityData.setCapabilities(field_73011_w, capabilities);
+ }
+ }
+ @Override
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, @Nullable EnumFacing facing)
+ {
+ return capabilities == null ? false : capabilities.hasCapability(capability, facing);
+ }
+ @Override
+ @Nullable
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable EnumFacing facing)
+ {
+ return capabilities == null ? null : capabilities.getCapability(capability, facing);
+ }
+
+ protected MapStorage perWorldStorage; //Moved to a getter to simulate final without being final so we can load in subclasses.
+ public MapStorage getPerWorldStorage()
+ {
+ return perWorldStorage;
+ }
+
public void func_184135_a(Packet<?> p_184135_1_)
{
throw new UnsupportedOperationException("Can't send packets to server unless you're on the client.");