mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 12:20:11 +00:00
964 lines
41 KiB
Diff
964 lines
41 KiB
Diff
--- ../src-base/minecraft/net/minecraft/world/World.java
|
|
+++ ../src-work/minecraft/net/minecraft/world/World.java
|
|
@@ -59,8 +59,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();
|
|
@@ -102,6 +109,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(new IWorldEventListener[] {this.field_184152_t});
|
|
@@ -116,6 +129,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()
|
|
@@ -125,6 +139,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_);
|
|
@@ -201,7 +220,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_)
|
|
@@ -298,23 +317,49 @@
|
|
{
|
|
Chunk chunk = this.func_175726_f(p_180501_1_);
|
|
Block block = p_180501_2_.func_177230_c();
|
|
+
|
|
+ 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_, Chunk chunk, IBlockState iblockstate, IBlockState p_180501_2_, int p_180501_3_)
|
|
+ {
|
|
+ {
|
|
+ {
|
|
+ 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_);
|
|
}
|
|
|
|
@@ -324,11 +369,9 @@
|
|
|
|
if (p_180501_2_.func_185912_n())
|
|
{
|
|
- this.func_175666_e(p_180501_1_, block);
|
|
+ this.func_175666_e(p_180501_1_, p_180501_2_.func_177230_c());
|
|
}
|
|
}
|
|
-
|
|
- return true;
|
|
}
|
|
}
|
|
}
|
|
@@ -343,7 +386,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;
|
|
}
|
|
@@ -416,6 +459,9 @@
|
|
|
|
public void func_175685_c(BlockPos p_175685_1_, Block p_175685_2_)
|
|
{
|
|
+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_175685_1_, this.func_180495_p(p_175685_1_), java.util.EnumSet.allOf(EnumFacing.class)).isCanceled())
|
|
+ return;
|
|
+
|
|
this.func_180496_d(p_175685_1_.func_177976_e(), p_175685_2_);
|
|
this.func_180496_d(p_175685_1_.func_177974_f(), p_175685_2_);
|
|
this.func_180496_d(p_175685_1_.func_177977_b(), p_175685_2_);
|
|
@@ -426,6 +472,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).isCanceled())
|
|
+ return;
|
|
+
|
|
if (p_175695_3_ != EnumFacing.WEST)
|
|
{
|
|
this.func_180496_d(p_175695_1_.func_177976_e(), p_175695_2_);
|
|
@@ -521,7 +572,7 @@
|
|
{
|
|
IBlockState iblockstate = this.func_180495_p(blockpos);
|
|
|
|
- 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;
|
|
}
|
|
@@ -795,7 +846,7 @@
|
|
|
|
public boolean func_72935_r()
|
|
{
|
|
- return this.field_73008_k < 4;
|
|
+ return this.field_73011_w.isDaytime();
|
|
}
|
|
|
|
@Nullable
|
|
@@ -998,6 +1049,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_);
|
|
@@ -1043,6 +1101,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;
|
|
@@ -1065,6 +1126,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_);
|
|
@@ -1221,7 +1284,7 @@
|
|
}
|
|
}
|
|
}
|
|
-
|
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.GetCollisionBoxesEvent(this, p_184144_1_, p_184144_2_, list));
|
|
return list;
|
|
}
|
|
|
|
@@ -1296,7 +1359,6 @@
|
|
return list;
|
|
}
|
|
|
|
- @SideOnly(Side.CLIENT)
|
|
public void func_72848_b(IWorldEventListener p_72848_1_)
|
|
{
|
|
this.field_73021_x.remove(p_72848_1_);
|
|
@@ -1359,19 +1421,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);
|
|
@@ -1384,6 +1465,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);
|
|
@@ -1391,9 +1478,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;
|
|
@@ -1453,6 +1538,11 @@
|
|
|
|
public float func_130001_d()
|
|
{
|
|
+ return field_73011_w.getCurrentMoonPhaseFactor();
|
|
+ }
|
|
+
|
|
+ public float getCurrentMoonPhaseFactorBody()
|
|
+ {
|
|
return WorldProvider.field_111203_a[this.field_73011_w.func_76559_b(this.field_72986_A.func_76073_f())];
|
|
}
|
|
|
|
@@ -1465,6 +1555,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);
|
|
@@ -1520,9 +1616,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;
|
|
}
|
|
@@ -1534,6 +1630,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);
|
|
@@ -1585,6 +1687,12 @@
|
|
entity.func_85029_a(crashreportcategory);
|
|
}
|
|
|
|
+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities)
|
|
+ {
|
|
+ net.minecraftforge.fml.common.FMLLog.severe(crashreport.func_71502_e());
|
|
+ func_72900_e(entity);
|
|
+ }
|
|
+ else
|
|
throw new ReportedException(crashreport);
|
|
}
|
|
|
|
@@ -1646,6 +1754,12 @@
|
|
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.severe(crashreport1.func_71502_e());
|
|
+ func_72900_e(entity2);
|
|
+ }
|
|
+ else
|
|
throw new ReportedException(crashreport1);
|
|
}
|
|
}
|
|
@@ -1682,7 +1796,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
|
|
{
|
|
@@ -1695,6 +1809,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.severe(crashreport2.func_71502_e());
|
|
+ tileentity.func_145843_s();
|
|
+ this.func_175713_t(tileentity.func_174877_v());
|
|
+ }
|
|
+ else
|
|
throw new ReportedException(crashreport2);
|
|
}
|
|
}
|
|
@@ -1707,20 +1828,28 @@
|
|
|
|
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());
|
|
}
|
|
}
|
|
}
|
|
|
|
- this.field_147481_N = false;
|
|
-
|
|
if (!this.field_147483_b.isEmpty())
|
|
{
|
|
+ for (Object tile : field_147483_b)
|
|
+ {
|
|
+ ((TileEntity)tile).onChunkUnload();
|
|
+ }
|
|
+
|
|
this.field_175730_i.removeAll(this.field_147483_b);
|
|
this.field_147482_g.removeAll(this.field_147483_b);
|
|
this.field_147483_b.clear();
|
|
}
|
|
|
|
+ this.field_147481_N = false; //FML Move below remove to prevent CMEs
|
|
+
|
|
this.field_72984_F.func_76318_c("pendingBlockEntities");
|
|
|
|
if (!this.field_147484_a.isEmpty())
|
|
@@ -1759,8 +1888,12 @@
|
|
|
|
public boolean func_175700_a(TileEntity p_175700_1_)
|
|
{
|
|
- boolean flag = this.field_147482_g.add(p_175700_1_);
|
|
+ if (p_175700_1_.func_145831_w() != null) // Forge - set the world early as vanilla doesn't set it until next tick
|
|
+ p_175700_1_.func_145834_a(this);
|
|
|
|
+ List<TileEntity> dest = field_147481_N ? field_147484_a : field_147482_g;
|
|
+ boolean flag = dest.add(p_175700_1_);
|
|
+
|
|
if (flag && p_175700_1_ instanceof ITickable)
|
|
{
|
|
this.field_175730_i.add(p_175700_1_);
|
|
@@ -1780,6 +1913,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
|
|
@@ -1800,9 +1938,12 @@
|
|
{
|
|
int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t);
|
|
int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v);
|
|
- int k = 32;
|
|
+ boolean isForced = getPersistentChunks().containsKey(new net.minecraft.util.math.ChunkPos(i >> 4, j >> 4));
|
|
+ int k = isForced ? 0 : 32;
|
|
+ boolean canUpdate = !p_72866_2_ || this.func_175663_a(i - k, 0, j - k, i + k, 0, j + k, true);
|
|
+ if (!canUpdate) canUpdate = net.minecraftforge.event.ForgeEventFactory.canEntityUpdate(p_72866_1_);
|
|
|
|
- if (!p_72866_2_ || this.func_175663_a(i - 32, 0, j - 32, i + 32, 0, j + 32, true))
|
|
+ if (canUpdate)
|
|
{
|
|
p_72866_1_.field_70142_S = p_72866_1_.field_70165_t;
|
|
p_72866_1_.field_70137_T = p_72866_1_.field_70163_u;
|
|
@@ -2001,6 +2142,10 @@
|
|
blockpos$pooledmutableblockpos.func_185344_t();
|
|
return true;
|
|
}
|
|
+ else if (block.isBurning(this, new BlockPos(k1, l1, i2)))
|
|
+ {
|
|
+ return true;
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
@@ -2040,6 +2185,16 @@
|
|
IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos);
|
|
Block block = iblockstate.func_177230_c();
|
|
|
|
+ Boolean result = block.isEntityInsideMaterial(this, blockpos$pooledmutableblockpos, iblockstate, p_72918_3_, (double)l, 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 (iblockstate.func_185904_a() == p_72918_2_)
|
|
{
|
|
double d0 = (double)((float)(l1 + 1) - BlockLiquid.func_149801_b(((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue()));
|
|
@@ -2116,6 +2271,9 @@
|
|
{
|
|
IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(k1, l1, i2));
|
|
|
|
+ Boolean result = iblockstate.func_177230_c().isAABBInsideMaterial(this, blockpos$pooledmutableblockpos, p_72830_1_, p_72830_2_);
|
|
+ if (result != null) return result;
|
|
+
|
|
if (iblockstate.func_185904_a() == p_72830_2_)
|
|
{
|
|
int j2 = ((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue();
|
|
@@ -2148,6 +2306,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;
|
|
@@ -2270,6 +2429,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())
|
|
@@ -2277,6 +2437,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> iterator = this.field_147484_a.iterator();
|
|
|
|
while (iterator.hasNext())
|
|
@@ -2295,8 +2457,10 @@
|
|
else
|
|
{
|
|
this.func_175700_a(p_175690_2_);
|
|
- 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_); //Forge add NPE protection
|
|
+ if (chunk != null) chunk.func_177426_a(p_175690_1_, p_175690_2_);
|
|
}
|
|
+ this.func_175666_e(p_175690_1_, func_180495_p(p_175690_1_).func_177230_c()); //Notify neighbors of changes
|
|
}
|
|
}
|
|
}
|
|
@@ -2309,6 +2473,8 @@
|
|
{
|
|
tileentity.func_145843_s();
|
|
this.field_147484_a.remove(tileentity);
|
|
+ if (!(tileentity instanceof ITickable)) //Forge: If they are not tickable they wont be removed in the update loop.
|
|
+ this.field_147482_g.remove(tileentity);
|
|
}
|
|
else
|
|
{
|
|
@@ -2321,6 +2487,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_)
|
|
@@ -2347,7 +2514,7 @@
|
|
if (chunk != null && !chunk.func_76621_g())
|
|
{
|
|
IBlockState iblockstate = this.func_180495_p(p_175677_1_);
|
|
- return iblockstate.func_185904_a().func_76218_k() && iblockstate.func_185917_h();
|
|
+ return iblockstate.func_177230_c().isNormalCube(iblockstate, this, p_175677_1_);
|
|
}
|
|
else
|
|
{
|
|
@@ -2370,6 +2537,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()
|
|
@@ -2379,6 +2547,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;
|
|
@@ -2392,6 +2565,11 @@
|
|
|
|
protected void func_72979_l()
|
|
{
|
|
+ this.field_73011_w.updateWeather();
|
|
+ }
|
|
+
|
|
+ public void updateWeatherBody()
|
|
+ {
|
|
if (!this.field_73011_w.func_177495_o())
|
|
{
|
|
if (!this.field_72995_K)
|
|
@@ -2511,6 +2689,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_);
|
|
|
|
@@ -2552,6 +2735,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_);
|
|
|
|
@@ -2569,7 +2757,7 @@
|
|
{
|
|
IBlockState iblockstate = this.func_180495_p(p_175708_1_);
|
|
|
|
- if (iblockstate.func_185904_a() == Material.field_151579_a && Blocks.field_150431_aC.func_176196_c(this, p_175708_1_))
|
|
+ if (iblockstate.func_177230_c().isAir(iblockstate, this, p_175708_1_) && Blocks.field_150431_aC.func_176196_c(this, p_175708_1_))
|
|
{
|
|
return true;
|
|
}
|
|
@@ -2601,10 +2789,11 @@
|
|
else
|
|
{
|
|
IBlockState iblockstate = this.func_180495_p(p_175638_1_);
|
|
- int i = p_175638_2_ == EnumSkyBlock.SKY ? 0 : iblockstate.func_185906_d();
|
|
- int j = iblockstate.func_185891_c();
|
|
+ int blockLight = iblockstate.func_177230_c().getLightValue(iblockstate, this, p_175638_1_);
|
|
+ int i = p_175638_2_ == EnumSkyBlock.SKY ? 0 : blockLight;
|
|
+ int j = iblockstate.func_177230_c().getLightOpacity(iblockstate, this, p_175638_1_);
|
|
|
|
- if (j >= 15 && iblockstate.func_185906_d() > 0)
|
|
+ if (j >= 15 && blockLight > 0)
|
|
{
|
|
j = 1;
|
|
}
|
|
@@ -2703,7 +2892,7 @@
|
|
int j4 = j2 + enumfacing.func_96559_d();
|
|
int k4 = k2 + enumfacing.func_82599_e();
|
|
blockpos$pooledmutableblockpos.func_181079_c(i4, j4, k4);
|
|
- int l4 = Math.max(1, this.func_180495_p(blockpos$pooledmutableblockpos).func_185891_c());
|
|
+ int l4 = Math.max(1, this.func_180495_p(blockpos$pooledmutableblockpos).func_177230_c().getLightOpacity(this.func_180495_p(blockpos$pooledmutableblockpos), this, blockpos$pooledmutableblockpos));
|
|
i3 = this.func_175642_b(p_180500_1_, blockpos$pooledmutableblockpos);
|
|
|
|
if (i3 == l2 - l4 && j < this.field_72994_J.length)
|
|
@@ -2811,10 +3000,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 i = MathHelper.func_76128_c((p_175674_2_.field_72340_a - 2.0D) / 16.0D);
|
|
- int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + 2.0D) / 16.0D);
|
|
- int k = MathHelper.func_76128_c((p_175674_2_.field_72339_c - 2.0D) / 16.0D);
|
|
- int l = MathHelper.func_76128_c((p_175674_2_.field_72334_f + 2.0D) / 16.0D);
|
|
+ int i = MathHelper.func_76128_c((p_175674_2_.field_72340_a - MAX_ENTITY_RADIUS) / 16.0D);
|
|
+ int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + MAX_ENTITY_RADIUS) / 16.0D);
|
|
+ int k = MathHelper.func_76128_c((p_175674_2_.field_72339_c - MAX_ENTITY_RADIUS) / 16.0D);
|
|
+ int l = MathHelper.func_76128_c((p_175674_2_.field_72334_f + MAX_ENTITY_RADIUS) / 16.0D);
|
|
|
|
for (int i1 = i; i1 <= j; ++i1)
|
|
{
|
|
@@ -2867,10 +3056,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 i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - 2.0D) / 16.0D);
|
|
- int j = MathHelper.func_76143_f((p_175647_2_.field_72336_d + 2.0D) / 16.0D);
|
|
- int k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - 2.0D) / 16.0D);
|
|
- int l = MathHelper.func_76143_f((p_175647_2_.field_72334_f + 2.0D) / 16.0D);
|
|
+ int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - MAX_ENTITY_RADIUS) / 16.0D);
|
|
+ int j = MathHelper.func_76143_f((p_175647_2_.field_72336_d + MAX_ENTITY_RADIUS) / 16.0D);
|
|
+ int k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - MAX_ENTITY_RADIUS) / 16.0D);
|
|
+ int l = MathHelper.func_76143_f((p_175647_2_.field_72334_f + MAX_ENTITY_RADIUS) / 16.0D);
|
|
List<T> list = Lists.<T>newArrayList();
|
|
|
|
for (int i1 = i; i1 < j; ++i1)
|
|
@@ -2950,11 +3139,13 @@
|
|
|
|
public void func_175650_b(Collection<Entity> p_175650_1_)
|
|
{
|
|
- this.field_72996_f.addAll(p_175650_1_);
|
|
-
|
|
for (Entity entity : p_175650_1_)
|
|
{
|
|
- this.func_72923_a(entity);
|
|
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity, this)))
|
|
+ {
|
|
+ field_72996_f.add(entity);
|
|
+ this.func_72923_a(entity);
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -2967,7 +3158,7 @@
|
|
{
|
|
IBlockState iblockstate = this.func_180495_p(p_175716_2_);
|
|
AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.func_176223_P().func_185890_d(this, p_175716_2_);
|
|
- return axisalignedbb != Block.field_185506_k && !this.func_72917_a(axisalignedbb.func_186670_a(p_175716_2_), p_175716_5_) ? false : (iblockstate.func_185904_a() == Material.field_151594_q && p_175716_1_ == Blocks.field_150467_bQ ? true : iblockstate.func_185904_a().func_76222_j() && p_175716_1_.func_176193_a(this, p_175716_2_, p_175716_4_, p_175716_6_));
|
|
+ return axisalignedbb != Block.field_185506_k && !this.func_72917_a(axisalignedbb.func_186670_a(p_175716_2_), p_175716_5_) ? false : (iblockstate.func_185904_a() == Material.field_151594_q && p_175716_1_ == Blocks.field_150467_bQ ? true : iblockstate.func_177230_c().func_176200_f(this, p_175716_2_) && p_175716_1_.func_176193_a(this, p_175716_2_, p_175716_4_, p_175716_6_));
|
|
}
|
|
|
|
public int func_181545_F()
|
|
@@ -3050,7 +3241,7 @@
|
|
public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_)
|
|
{
|
|
IBlockState iblockstate = this.func_180495_p(p_175651_1_);
|
|
- return iblockstate.func_185915_l() ? this.func_175676_y(p_175651_1_) : iblockstate.func_185911_a(this, p_175651_1_, p_175651_2_);
|
|
+ return iblockstate.func_177230_c().shouldCheckWeakPower(iblockstate, this, p_175651_1_, p_175651_2_) ? this.func_175676_y(p_175651_1_) : iblockstate.func_185911_a(this, p_175651_1_, p_175651_2_);
|
|
}
|
|
|
|
public boolean func_175640_z(BlockPos p_175640_1_)
|
|
@@ -3185,7 +3376,7 @@
|
|
{
|
|
d2 *= ((Double)Objects.firstNonNull(p_184150_11_.apply(entityplayer1), Double.valueOf(1.0D))).doubleValue();
|
|
}
|
|
-
|
|
+ d2 = net.minecraftforge.common.ForgeHooks.getPlayerVisibilityDistance(entityplayer1, d2, p_184150_7_);
|
|
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;
|
|
@@ -3247,7 +3438,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()
|
|
@@ -3257,17 +3448,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 blockpos = new BlockPos(this.field_72986_A.func_76079_c(), this.field_72986_A.func_76075_d(), this.field_72986_A.func_76074_e());
|
|
+ BlockPos blockpos = this.field_73011_w.getSpawnPoint();
|
|
|
|
if (!this.func_175723_af().func_177746_a(blockpos))
|
|
{
|
|
@@ -3279,7 +3470,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)
|
|
@@ -3299,12 +3490,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;
|
|
}
|
|
|
|
@@ -3398,8 +3595,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
|
|
@@ -3460,12 +3656,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_)
|
|
@@ -3509,7 +3705,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_)
|
|
@@ -3543,7 +3739,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 blockpos = p_175666_1_.func_177972_a(enumfacing);
|
|
|
|
@@ -3551,18 +3747,14 @@
|
|
{
|
|
IBlockState iblockstate = this.func_180495_p(blockpos);
|
|
|
|
- if (Blocks.field_150441_bU.func_185547_C(iblockstate))
|
|
+ iblockstate.func_177230_c().onNeighborChange(this, blockpos, p_175666_1_);
|
|
+ if (iblockstate.func_177230_c().isNormalCube(iblockstate, this, blockpos))
|
|
{
|
|
- iblockstate.func_189546_a(this, blockpos, p_175666_2_);
|
|
- }
|
|
- else if (iblockstate.func_185915_l())
|
|
- {
|
|
blockpos = blockpos.func_177972_a(enumfacing);
|
|
iblockstate = this.func_180495_p(blockpos);
|
|
-
|
|
- if (Blocks.field_150441_bU.func_185547_C(iblockstate))
|
|
+ if (iblockstate.func_177230_c().getWeakChanges(this, blockpos))
|
|
{
|
|
- iblockstate.func_189546_a(this, blockpos, p_175666_2_);
|
|
+ iblockstate.func_177230_c().onNeighborChange(this, blockpos, p_175666_1_);
|
|
}
|
|
}
|
|
}
|
|
@@ -3628,6 +3820,112 @@
|
|
return i >= -128 && i <= 128 && j >= -128 && j <= 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;
|
|
+ }
|
|
+
|
|
+ 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);
|
|
+ }
|
|
+ }
|
|
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, EnumFacing facing)
|
|
+ {
|
|
+ return capabilities == null ? false : capabilities.hasCapability(capability, facing);
|
|
+ }
|
|
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, 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.");
|