Repatch missed hasTileEntity redirects. And cleanup related patches. Closes #5369

This commit is contained in:
LexManos 2019-01-25 13:11:06 -08:00
parent d04df43b27
commit 7a651b8c1f
16 changed files with 307 additions and 761 deletions

View File

@ -0,0 +1,10 @@
--- a/net/minecraft/block/ITileEntityProvider.java
+++ b/net/minecraft/block/ITileEntityProvider.java
@@ -4,6 +4,7 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
+@Deprecated //Forge: Do not use, use IBlockState.hasTileEntity/Blocks.createTileEntity
public interface ITileEntityProvider {
@Nullable
TileEntity func_196283_a_(IBlockReader p_196283_1_);

View File

@ -65,7 +65,7 @@
TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity1, p_180446_3_, -1);
}
}
@@ -622,10 +632,12 @@
@@ -622,16 +632,18 @@
synchronized(this.field_181024_n) {
for(TileEntity tileentity : this.field_181024_n) {
@ -73,12 +73,18 @@
TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity, p_180446_3_, -1);
}
}
-
+ TileEntityRendererDispatcher.field_147556_a.drawBatch(pass);
+
this.func_180443_s();
for(DestroyBlockProgress destroyblockprogress : this.field_72738_E.values()) {
BlockPos blockpos = destroyblockprogress.func_180246_b();
IBlockState iblockstate = this.field_72769_h.func_180495_p(blockpos);
- if (iblockstate.func_177230_c().func_149716_u()) {
+ if (iblockstate.hasTileEntity()) {
TileEntity tileentity2 = this.field_72769_h.func_175625_s(blockpos);
if (tileentity2 instanceof TileEntityChest && iblockstate.func_177229_b(BlockChest.field_196314_b) == ChestType.LEFT) {
blockpos = blockpos.func_177972_a(((EnumFacing)iblockstate.func_177229_b(BlockChest.field_176459_a)).func_176746_e());
@@ -767,7 +779,7 @@
for(int j = -this.field_72739_F; j <= this.field_72739_F; ++j) {
for(int k = -this.field_72739_F; k <= this.field_72739_F; ++k) {
@ -106,7 +112,7 @@
+ renderer.render(p_195465_1_, field_72769_h, field_72777_q);
+ return;
+ }
+
+
if (this.field_72777_q.field_71441_e.field_73011_w.func_186058_p().func_186068_a() == 1) {
this.func_180448_r();
} else if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) {

View File

@ -0,0 +1,20 @@
--- a/net/minecraft/command/arguments/BlockStateParser.java
+++ b/net/minecraft/command/arguments/BlockStateParser.java
@@ -167,7 +167,7 @@
}
private CompletableFuture<Suggestions> func_197244_d(SuggestionsBuilder p_197244_1_) {
- if (p_197244_1_.getRemaining().isEmpty() && (this.field_197270_l == null || this.field_197270_l.func_177230_c().func_149716_u())) {
+ if (p_197244_1_.getRemaining().isEmpty() && (this.field_197270_l == null || this.field_197270_l.hasTileEntity())) {
p_197244_1_.suggest(String.valueOf('{'));
}
@@ -252,7 +252,7 @@
p_197255_1_.suggest(String.valueOf('['));
}
- if (this.field_197270_l.func_177230_c().func_149716_u()) {
+ if (this.field_197270_l.hasTileEntity()) {
p_197255_1_.suggest(String.valueOf('{'));
}
}

View File

@ -40,7 +40,7 @@
return this.field_78033_n < 6;
}
@@ -220,4 +225,57 @@
@@ -220,4 +225,54 @@
}
}

View File

@ -25,7 +25,59 @@
}
public Chunk(World p_i48703_1_, ChunkPrimer p_i48703_2_, int p_i48703_3_, int p_i48703_4_) {
@@ -593,6 +595,7 @@
@@ -423,6 +425,7 @@
Block block = p_177436_2_.func_177230_c();
Block block1 = iblockstate.func_177230_c();
ChunkSection chunksection = this.field_76652_q[j >> 4];
+ int j1 = iblockstate.func_200016_a(this.field_76637_e, p_177436_1_); // Relocate old light value lookup here, so that it is called before TE is removed.
boolean flag = false;
if (chunksection == field_186036_a) {
if (p_177436_2_.func_196958_f()) {
@@ -441,7 +444,7 @@
((Heightmap)this.field_76634_f.get(Heightmap.Type.WORLD_SURFACE)).func_202270_a(i, j, k, p_177436_2_);
if (!this.field_76637_e.field_72995_K) {
iblockstate.func_196947_b(this.field_76637_e, p_177436_1_, p_177436_2_, p_177436_3_);
- } else if (block1 != block && block1 instanceof ITileEntityProvider) {
+ } else if (block1 != block && iblockstate.hasTileEntity()) {
this.field_76637_e.func_175713_t(p_177436_1_);
}
@@ -452,14 +455,13 @@
this.func_76603_b();
} else {
int i1 = p_177436_2_.func_200016_a(this.field_76637_e, p_177436_1_);
- int j1 = iblockstate.func_200016_a(this.field_76637_e, p_177436_1_);
this.func_76615_h(i, j, k, p_177436_2_);
if (i1 != j1 && (i1 < j1 || this.func_177413_a(EnumLightType.SKY, p_177436_1_) > 0 || this.func_177413_a(EnumLightType.BLOCK, p_177436_1_) > 0)) {
this.func_76595_e(i, k);
}
}
- if (block1 instanceof ITileEntityProvider) {
+ if (iblockstate.hasTileEntity()) {
TileEntity tileentity = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK);
if (tileentity != null) {
tileentity.func_145836_u();
@@ -470,10 +472,10 @@
p_177436_2_.func_196945_a(this.field_76637_e, p_177436_1_, iblockstate);
}
- if (block instanceof ITileEntityProvider) {
+ if (p_177436_2_.hasTileEntity()) {
TileEntity tileentity1 = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK);
if (tileentity1 == null) {
- tileentity1 = ((ITileEntityProvider)block).func_196283_a_(this.field_76637_e);
+ tileentity1 = p_177436_2_.createTileEntity(this.field_76637_e);
this.field_76637_e.func_175690_a(p_177436_1_, tileentity1);
} else {
tileentity1.func_145836_u();
@@ -588,11 +590,13 @@
k = this.field_76645_j.length - 1;
}
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EnteringChunk(p_76612_1_, this.field_76635_g, this.field_76647_h, p_76612_1_.field_70176_ah, p_76612_1_.field_70164_aj));
p_76612_1_.field_70175_ag = true;
p_76612_1_.field_70176_ah = this.field_76635_g;
p_76612_1_.field_70162_ai = k;
p_76612_1_.field_70164_aj = this.field_76647_h;
this.field_76645_j[k].add(p_76612_1_);
@ -33,7 +85,7 @@
}
public void func_201607_a(Heightmap.Type p_201607_1_, long[] p_201607_2_) {
@@ -613,6 +616,7 @@
@@ -613,6 +617,7 @@
}
this.field_76645_j[p_76608_2_].remove(p_76608_1_);
@ -41,7 +93,142 @@
}
public boolean func_177444_d(BlockPos p_177444_1_) {
@@ -1164,4 +1168,30 @@
@@ -630,7 +635,7 @@
private TileEntity func_177422_i(BlockPos p_177422_1_) {
IBlockState iblockstate = this.func_180495_p(p_177422_1_);
Block block = iblockstate.func_177230_c();
- return !block.func_149716_u() ? null : ((ITileEntityProvider)block).func_196283_a_(this.field_76637_e);
+ return !iblockstate.hasTileEntity() ? null : iblockstate.createTileEntity(this.field_76637_e);
}
@Nullable
@@ -641,16 +646,17 @@
@Nullable
public TileEntity func_177424_a(BlockPos p_177424_1_, Chunk.EnumCreateEntityType p_177424_2_) {
TileEntity tileentity = this.field_150816_i.get(p_177424_1_);
+ if (tileentity != null && tileentity.func_145837_r()) {
+ field_150816_i.remove(p_177424_1_);
+ tileentity = null;
+ }
if (tileentity == null) {
if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) {
tileentity = this.func_177422_i(p_177424_1_);
this.field_76637_e.func_175690_a(p_177424_1_, tileentity);
} else if (p_177424_2_ == Chunk.EnumCreateEntityType.QUEUED) {
- this.field_177447_w.add(p_177424_1_);
+ this.field_177447_w.add(p_177424_1_.func_185334_h());
}
- } else if (tileentity.func_145837_r()) {
- this.field_150816_i.remove(p_177424_1_);
- return null;
}
return tileentity;
@@ -665,9 +671,10 @@
}
public void func_177426_a(BlockPos p_177426_1_, TileEntity p_177426_2_) {
+ if (p_177426_2_.func_145831_w() != this.field_76637_e) //Forge don't call unless it's changed, could screw up bad mods.
p_177426_2_.func_145834_a(this.field_76637_e);
p_177426_2_.func_174878_a(p_177426_1_);
- if (this.func_180495_p(p_177426_1_).func_177230_c() instanceof ITileEntityProvider) {
+ if (this.func_180495_p(p_177426_1_).hasTileEntity()) {
if (this.field_150816_i.containsKey(p_177426_1_)) {
((TileEntity)this.field_150816_i.get(p_177426_1_)).func_145843_s();
}
@@ -696,12 +703,14 @@
this.field_76637_e.func_147448_a(this.field_150816_i.values());
for(ClassInheritanceMultiMap<Entity> classinheritancemultimap : this.field_76645_j) {
- this.field_76637_e.func_175650_b(classinheritancemultimap);
+ this.field_76637_e.func_175650_b(com.google.common.collect.ImmutableList.copyOf(classinheritancemultimap));
}
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(this));
}
public void func_76623_d() {
+ java.util.Arrays.stream(field_76645_j).forEach(multimap -> com.google.common.collect.Lists.newArrayList(multimap.func_180215_b(net.minecraft.entity.player.EntityPlayer.class)).forEach(player -> field_76637_e.func_72866_a(player, false))); // FORGE - Fix for MC-92916
this.field_76636_d = false;
for(TileEntity tileentity : this.field_150816_i.values()) {
@@ -711,6 +720,7 @@
for(ClassInheritanceMultiMap<Entity> classinheritancemultimap : this.field_76645_j) {
this.field_76637_e.func_175681_c(classinheritancemultimap);
}
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload(this));
}
@@ -719,8 +729,8 @@
}
public void func_177414_a(@Nullable Entity p_177414_1_, AxisAlignedBB p_177414_2_, List<Entity> p_177414_3_, Predicate<? super Entity> p_177414_4_) {
- int i = MathHelper.func_76128_c((p_177414_2_.field_72338_b - 2.0D) / 16.0D);
- int j = MathHelper.func_76128_c((p_177414_2_.field_72337_e + 2.0D) / 16.0D);
+ int i = MathHelper.func_76128_c((p_177414_2_.field_72338_b - net.minecraftforge.common.extensions.IForgeWorld.MAX_ENTITY_RADIUS) / 16.0D);
+ int j = MathHelper.func_76128_c((p_177414_2_.field_72337_e + net.minecraftforge.common.extensions.IForgeWorld.MAX_ENTITY_RADIUS) / 16.0D);
i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1);
j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1);
@@ -748,8 +758,8 @@
}
public <T extends Entity> void func_177430_a(Class<? extends T> p_177430_1_, AxisAlignedBB p_177430_2_, List<T> p_177430_3_, @Nullable Predicate<? super T> p_177430_4_) {
- int i = MathHelper.func_76128_c((p_177430_2_.field_72338_b - 2.0D) / 16.0D);
- int j = MathHelper.func_76128_c((p_177430_2_.field_72337_e + 2.0D) / 16.0D);
+ int i = MathHelper.func_76128_c((p_177430_2_.field_72338_b - net.minecraftforge.common.extensions.IForgeWorld.MAX_ENTITY_RADIUS) / 16.0D);
+ int j = MathHelper.func_76128_c((p_177430_2_.field_72337_e + net.minecraftforge.common.extensions.IForgeWorld.MAX_ENTITY_RADIUS) / 16.0D);
i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1);
j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1);
@@ -788,7 +798,7 @@
while(!this.field_177447_w.isEmpty()) {
BlockPos blockpos = this.field_177447_w.poll();
- if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.func_180495_p(blockpos).func_177230_c().func_149716_u()) {
+ if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.func_180495_p(blockpos).hasTileEntity()) {
TileEntity tileentity = this.func_177422_i(blockpos);
this.field_76637_e.func_175690_a(blockpos, tileentity);
this.field_76637_e.func_175704_b(blockpos, blockpos);
@@ -838,6 +848,10 @@
@OnlyIn(Dist.CLIENT)
public void func_186033_a(PacketBuffer p_186033_1_, int p_186033_2_, boolean p_186033_3_) {
+ for (TileEntity tileEntity : field_150816_i.values()) {
+ tileEntity.func_145836_u();
+ tileEntity.func_195044_w();
+ }
if (p_186033_3_) {
this.field_150816_i.clear();
} else {
@@ -926,10 +940,10 @@
for(int i1 = 0; i1 < 16; ++i1) {
BlockPos blockpos1 = blockpos.func_177982_a(k, (j << 4) + i1, l);
boolean flag = i1 == 0 || i1 == 15 || k == 0 || k == 15 || l == 0 || l == 15;
- if (this.field_76652_q[j] == field_186036_a && flag || this.field_76652_q[j] != field_186036_a && this.field_76652_q[j].func_177485_a(k, i1, l).func_196958_f()) {
+ if (this.field_76652_q[j] == field_186036_a && flag || this.field_76652_q[j] != field_186036_a && this.field_76652_q[j].func_177485_a(k, i1, l).isAir(field_76637_e, blockpos1)) {
for(EnumFacing enumfacing : EnumFacing.values()) {
BlockPos blockpos2 = blockpos1.func_177972_a(enumfacing);
- if (this.field_76637_e.func_180495_p(blockpos2).func_185906_d() > 0) {
+ if (this.field_76637_e.func_180495_p(blockpos2).getLightValue(field_76637_e, blockpos2) > 0) {
this.field_76637_e.func_175664_x(blockpos2);
}
}
@@ -1087,9 +1101,9 @@
if (this.func_175625_s(blockpos1) == null) {
TileEntity tileentity;
if ("DUMMY".equals(nbttagcompound.func_74779_i("id"))) {
- Block block = this.func_180495_p(blockpos1).func_177230_c();
- if (block instanceof ITileEntityProvider) {
- tileentity = ((ITileEntityProvider)block).func_196283_a_(this.field_76637_e);
+ IBlockState state = this.func_180495_p(blockpos1);
+ if (state.hasTileEntity()) {
+ tileentity = state.createTileEntity(this.field_76637_e);
} else {
tileentity = null;
field_150817_t.warn("Tried to load a DUMMY block entity @ {} but found not tile entity block {} at location", blockpos1, this.func_180495_p(blockpos1));
@@ -1164,4 +1178,30 @@
QUEUED,
CHECK;
}

View File

@ -0,0 +1,26 @@
--- a/net/minecraft/world/gen/ChunkProviderServer.java
+++ b/net/minecraft/world/gen/ChunkProviderServer.java
@@ -248,6 +248,7 @@
public boolean func_73156_b() {
if (!this.field_73251_h.field_73058_d) {
+ field_73251_h.getPersistentChunks().keySet().forEach(pos -> field_73248_b.remove(ChunkPos.func_77272_a(pos.field_77276_a, pos.field_77275_b)));
if (!this.field_73248_b.isEmpty()) {
Iterator<Long> iterator = this.field_73248_b.iterator();
@@ -256,6 +257,7 @@
Chunk chunk = (Chunk)this.field_73244_f.get(olong);
if (chunk != null && chunk.field_189550_d) {
chunk.func_76623_d();
+ net.minecraftforge.common.ForgeChunkManager.putDormantChunk(ChunkPos.func_77272_a(chunk.field_76635_g, chunk.field_76647_h), chunk);
this.func_73242_b(chunk);
this.func_73243_a(chunk);
this.field_73244_f.remove(olong);
@@ -264,6 +266,7 @@
}
}
+ if (this.field_73244_f.isEmpty()) net.minecraftforge.common.DimensionManager.unloadWorld(this.field_73251_h.field_73011_w.getId());
this.field_201723_f.func_208484_a();
this.field_73247_e.func_75817_a();
}

View File

@ -9,3 +9,42 @@
}
public Biome func_180494_b(BlockPos p_180494_1_) {
@@ -180,7 +180,7 @@
NBTTagCompound nbttagcompound = ichunk.func_201579_g(p_175625_1_);
if (nbttagcompound != null) {
if ("DUMMY".equals(nbttagcompound.func_74779_i("id"))) {
- tileentity = ((ITileEntityProvider)this.func_180495_p(p_175625_1_).func_177230_c()).func_196283_a_(this.field_201689_f);
+ tileentity = this.func_180495_p(p_175625_1_).createTileEntity(this.field_201689_f);
} else {
tileentity = TileEntity.func_203403_c(nbttagcompound);
}
@@ -191,7 +191,7 @@
}
}
- if (ichunk.func_180495_p(p_175625_1_).func_177230_c() instanceof ITileEntityProvider) {
+ if (ichunk.func_180495_p(p_175625_1_).hasTileEntity()) {
field_208303_a.warn("Tried to access a block entity before it was created. {}", (Object)p_175625_1_);
}
@@ -203,9 +203,9 @@
IChunk ichunk = this.func_205771_y(p_180501_1_);
IBlockState iblockstate = ichunk.func_177436_a(p_180501_1_, p_180501_2_, false);
Block block = p_180501_2_.func_177230_c();
- if (block.func_149716_u()) {
+ if (p_180501_2_.hasTileEntity()) {
if (ichunk.func_201589_g().func_202129_d() == ChunkStatus.Type.LEVELCHUNK) {
- ichunk.func_177426_a(p_180501_1_, ((ITileEntityProvider)block).func_196283_a_(this));
+ ichunk.func_177426_a(p_180501_1_, p_180501_2_.createTileEntity(this));
} else {
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.func_74768_a("x", p_180501_1_.func_177958_n());
@@ -214,7 +214,7 @@
nbttagcompound.func_74778_a("id", "DUMMY");
ichunk.func_201591_a(nbttagcompound);
}
- } else if (iblockstate != null && iblockstate.func_177230_c().func_149716_u()) {
+ } else if (iblockstate != null && iblockstate.hasTileEntity()) {
ichunk.func_177425_e(p_180501_1_);
}

View File

@ -1,67 +0,0 @@
--- ../src-base/minecraft/net/minecraft/world/WorldProvider.java
+++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java
@@ -55,37 +55,12 @@
protected void func_76572_b()
{
this.field_191067_f = true;
- WorldType worldtype = this.field_76579_a.func_72912_H().func_76067_t();
-
- if (worldtype == WorldType.field_77138_c)
- {
- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.func_82651_a(this.field_76579_a.func_72912_H().func_82571_y());
- this.field_76578_c = new BiomeProviderSingle(Biome.func_180276_a(flatgeneratorinfo.func_82648_a(), Biomes.field_180279_ad));
- }
- else if (worldtype == WorldType.field_180272_g)
- {
- this.field_76578_c = new BiomeProviderSingle(Biomes.field_76772_c);
- }
- else
- {
- this.field_76578_c = new BiomeProvider(this.field_76579_a.func_72912_H());
- }
+ this.field_76578_c = this.field_76577_b.getBiomeProvider(field_76579_a);
}
public IChunkGenerator func_186060_c()
{
- if (this.field_76577_b == WorldType.field_77138_c)
- {
- return new ChunkGeneratorFlat(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c);
- }
- else if (this.field_76577_b == WorldType.field_180272_g)
- {
- return new ChunkGeneratorDebug(this.field_76579_a);
- }
- else
- {
- return this.field_76577_b == WorldType.field_180271_f ? new ChunkGeneratorOverworld(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c) : new ChunkGeneratorOverworld(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c);
- }
+ return this.field_76577_b.getChunkGenerator(field_76579_a, field_82913_c);
}
public boolean func_76566_a(int p_76566_1_, int p_76566_2_)
@@ -196,13 +171,13 @@
public int func_76557_i()
{
- return this.field_76577_b == WorldType.field_77138_c ? 4 : this.field_76579_a.func_181545_F() + 1;
+ return this.field_76577_b.getMinimumSpawnHeight(this.field_76579_a);
}
@@ -241,6 +216,371 @@
return new WorldBorder();
}
+ /*======================================= Forge Start =========================================*/
+ public boolean canBlockFreeze(BlockPos pos, boolean byWater)
+ {
+ return field_76579_a.canBlockFreezeBody(pos, byWater);
+ }
+
+ public boolean canSnowAt(BlockPos pos, boolean checkLight)
+ {
+ return field_76579_a.canSnowAtBody(pos, checkLight);
+ }
+
public void func_186061_a(EntityPlayerMP p_186061_1_)
{
}

View File

@ -1,372 +0,0 @@
--- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java
+++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java
@@ -41,7 +41,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public class Chunk
+public class Chunk implements net.minecraftforge.common.capabilities.ICapabilityProvider
{
private static final Logger field_150817_t = LogManager.getLogger();
public static final ExtendedBlockStorage field_186036_a = null;
@@ -91,6 +91,7 @@
Arrays.fill(this.field_76638_b, -999);
Arrays.fill(this.field_76651_r, (byte) - 1);
+ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this);
}
public Chunk(World p_i45645_1_, ChunkPrimer p_i45645_2_, int p_i45645_3_, int p_i45645_4_)
@@ -179,7 +180,7 @@
{
IBlockState iblockstate = this.func_186032_a(j, l - 1, k);
- if (iblockstate.func_185891_c() != 0)
+ if (this.func_150808_b(j, l - 1, k) != 0)
{
this.field_76634_f[k << 4 | j] = l;
@@ -452,12 +453,13 @@
public int func_177437_b(BlockPos p_177437_1_)
{
- return this.func_177435_g(p_177437_1_).func_185891_c();
+ return this.func_177435_g(p_177437_1_).getLightOpacity(this.field_76637_e, p_177437_1_);
}
private int func_150808_b(int p_150808_1_, int p_150808_2_, int p_150808_3_)
{
- return this.func_186032_a(p_150808_1_, p_150808_2_, p_150808_3_).func_185891_c();
+ IBlockState state = this.func_186032_a(p_150808_1_, p_150808_2_, p_150808_3_); //Forge: Can sometimes be called before we are added to the global world list. So use the less accurate one during that. It'll be recalculated later
+ return !field_76636_d ? state.func_185891_c() : state.getLightOpacity(field_76637_e, new BlockPos(this.field_76635_g << 4 | p_150808_1_ & 15, p_150808_2_, this.field_76647_h << 4 | p_150808_3_ & 15));
}
public IBlockState func_177435_g(BlockPos p_177435_1_)
@@ -539,6 +541,7 @@
{
Block block = p_177436_2_.func_177230_c();
Block block1 = iblockstate.func_177230_c();
+ int k1 = iblockstate.getLightOpacity(this.field_76637_e, p_177436_1_); // Relocate old light value lookup here, so that it is called before TE is removed.
ExtendedBlockStorage extendedblockstorage = this.field_76652_q[j >> 4];
boolean flag = false;
@@ -556,14 +559,19 @@
extendedblockstorage.func_177484_a(i, j & 15, k, p_177436_2_);
- if (block1 != block)
+ //if (block1 != block)
{
if (!this.field_76637_e.field_72995_K)
{
+ if (block1 != block) //Only fire block breaks when the block changes.
block1.func_180663_b(this.field_76637_e, p_177436_1_, iblockstate);
+ TileEntity te = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK);
+ if (te != null && te.shouldRefresh(this.field_76637_e, p_177436_1_, iblockstate, p_177436_2_)) this.field_76637_e.func_175713_t(p_177436_1_);
}
- else if (block1 instanceof ITileEntityProvider)
+ else if (block1.hasTileEntity(iblockstate))
{
+ TileEntity te = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK);
+ if (te != null && te.shouldRefresh(this.field_76637_e, p_177436_1_, iblockstate, p_177436_2_))
this.field_76637_e.func_175713_t(p_177436_1_);
}
}
@@ -580,8 +588,7 @@
}
else
{
- int j1 = p_177436_2_.func_185891_c();
- int k1 = iblockstate.func_185891_c();
+ int j1 = p_177436_2_.getLightOpacity(this.field_76637_e, p_177436_1_);
if (j1 > 0)
{
@@ -601,28 +608,19 @@
}
}
- if (block1 instanceof ITileEntityProvider)
+ // If capturing blocks, only run block physics for TE's. Non-TE's are handled in ForgeHooks.onPlaceItemIntoWorld
+ if (!this.field_76637_e.field_72995_K && block1 != block && (!this.field_76637_e.captureBlockSnapshots || block.hasTileEntity(p_177436_2_)))
{
- TileEntity tileentity = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK);
-
- if (tileentity != null)
- {
- tileentity.func_145836_u();
- }
- }
-
- if (!this.field_76637_e.field_72995_K && block1 != block)
- {
block.func_176213_c(this.field_76637_e, p_177436_1_, p_177436_2_);
}
- if (block instanceof ITileEntityProvider)
+ if (block.hasTileEntity(p_177436_2_))
{
TileEntity tileentity1 = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK);
if (tileentity1 == null)
{
- tileentity1 = ((ITileEntityProvider)block).func_149915_a(this.field_76637_e, block.func_176201_c(p_177436_2_));
+ tileentity1 = block.createTileEntity(this.field_76637_e, p_177436_2_);
this.field_76637_e.func_175690_a(p_177436_1_, tileentity1);
}
@@ -738,6 +736,7 @@
k = this.field_76645_j.length - 1;
}
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EnteringChunk(p_76612_1_, this.field_76635_g, this.field_76647_h, p_76612_1_.field_70176_ah, p_76612_1_.field_70164_aj));
p_76612_1_.field_70175_ag = true;
p_76612_1_.field_70176_ah = this.field_76635_g;
p_76612_1_.field_70162_ai = k;
@@ -778,7 +777,7 @@
{
IBlockState iblockstate = this.func_177435_g(p_177422_1_);
Block block = iblockstate.func_177230_c();
- return !block.func_149716_u() ? null : ((ITileEntityProvider)block).func_149915_a(this.field_76637_e, iblockstate.func_177230_c().func_176201_c(iblockstate));
+ return !block.hasTileEntity(iblockstate) ? null : block.createTileEntity(this.field_76637_e, iblockstate);
}
@Nullable
@@ -786,6 +785,12 @@
{
TileEntity tileentity = this.field_150816_i.get(p_177424_1_);
+ if (tileentity != null && tileentity.func_145837_r())
+ {
+ field_150816_i.remove(p_177424_1_);
+ tileentity = null;
+ }
+
if (tileentity == null)
{
if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE)
@@ -795,14 +800,9 @@
}
else if (p_177424_2_ == Chunk.EnumCreateEntityType.QUEUED)
{
- this.field_177447_w.add(p_177424_1_);
+ this.field_177447_w.add(p_177424_1_.func_185334_h());
}
}
- else if (tileentity.func_145837_r())
- {
- this.field_150816_i.remove(p_177424_1_);
- return null;
- }
return tileentity;
}
@@ -819,10 +819,11 @@
public void func_177426_a(BlockPos p_177426_1_, TileEntity p_177426_2_)
{
+ if (p_177426_2_.func_145831_w() != this.field_76637_e) //Forge don't call unless it's changed, could screw up bad mods.
p_177426_2_.func_145834_a(this.field_76637_e);
p_177426_2_.func_174878_a(p_177426_1_);
- if (this.func_177435_g(p_177426_1_).func_177230_c() instanceof ITileEntityProvider)
+ if (this.func_177435_g(p_177426_1_).func_177230_c().hasTileEntity(this.func_177435_g(p_177426_1_)))
{
if (this.field_150816_i.containsKey(p_177426_1_))
{
@@ -854,12 +855,14 @@
for (ClassInheritanceMultiMap<Entity> classinheritancemultimap : this.field_76645_j)
{
- this.field_76637_e.func_175650_b(classinheritancemultimap);
+ this.field_76637_e.func_175650_b(com.google.common.collect.ImmutableList.copyOf(classinheritancemultimap));
}
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(this));
}
public void func_76623_d()
{
+ java.util.Arrays.stream(field_76645_j).forEach(multimap -> com.google.common.collect.Lists.newArrayList(multimap.func_180215_b(net.minecraft.entity.player.EntityPlayer.class)).forEach(player -> field_76637_e.func_72866_a(player, false))); // FORGE - Fix for MC-92916
this.field_76636_d = false;
for (TileEntity tileentity : this.field_150816_i.values())
@@ -871,6 +874,7 @@
{
this.field_76637_e.func_175681_c(classinheritancemultimap);
}
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload(this));
}
public void func_76630_e()
@@ -880,8 +884,8 @@
public void func_177414_a(@Nullable Entity p_177414_1_, AxisAlignedBB p_177414_2_, List<Entity> p_177414_3_, Predicate <? super Entity > p_177414_4_)
{
- int i = MathHelper.func_76128_c((p_177414_2_.field_72338_b - 2.0D) / 16.0D);
- int j = MathHelper.func_76128_c((p_177414_2_.field_72337_e + 2.0D) / 16.0D);
+ int i = MathHelper.func_76128_c((p_177414_2_.field_72338_b - World.MAX_ENTITY_RADIUS) / 16.0D);
+ int j = MathHelper.func_76128_c((p_177414_2_.field_72337_e + World.MAX_ENTITY_RADIUS) / 16.0D);
i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1);
j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1);
@@ -918,8 +922,8 @@
public <T extends Entity> void func_177430_a(Class <? extends T > p_177430_1_, AxisAlignedBB p_177430_2_, List<T> p_177430_3_, Predicate <? super T > p_177430_4_)
{
- int i = MathHelper.func_76128_c((p_177430_2_.field_72338_b - 2.0D) / 16.0D);
- int j = MathHelper.func_76128_c((p_177430_2_.field_72337_e + 2.0D) / 16.0D);
+ int i = MathHelper.func_76128_c((p_177430_2_.field_72338_b - World.MAX_ENTITY_RADIUS) / 16.0D);
+ int j = MathHelper.func_76128_c((p_177430_2_.field_72337_e + World.MAX_ENTITY_RADIUS) / 16.0D);
i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1);
j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1);
@@ -997,6 +1001,9 @@
protected void func_186034_a(IChunkGenerator p_186034_1_)
{
+ if (populating != null && net.minecraftforge.common.ForgeModContainer.logCascadingWorldGeneration) logCascadingWorldGeneration();
+ ChunkPos prev = populating;
+ populating = this.func_76632_l();
if (this.func_177419_t())
{
if (p_186034_1_.func_185933_a(this, this.field_76635_g, this.field_76647_h))
@@ -1008,8 +1015,10 @@
{
this.func_150809_p();
p_186034_1_.func_185931_b(this.field_76635_g, this.field_76647_h);
+ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(this.field_76635_g, this.field_76647_h, this.field_76637_e, p_186034_1_, this.field_76637_e.func_72863_F());
this.func_76630_e();
}
+ populating = prev;
}
public BlockPos func_177440_h(BlockPos p_177440_1_)
@@ -1064,7 +1073,7 @@
{
BlockPos blockpos = this.field_177447_w.poll();
- if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.func_177435_g(blockpos).func_177230_c().func_149716_u())
+ if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.func_177435_g(blockpos).func_177230_c().hasTileEntity(this.func_177435_g(blockpos)))
{
TileEntity tileentity = this.func_177422_i(blockpos);
this.field_76637_e.func_175690_a(blockpos, tileentity);
@@ -1128,6 +1137,13 @@
@SideOnly(Side.CLIENT)
public void func_186033_a(PacketBuffer p_186033_1_, int p_186033_2_, boolean p_186033_3_)
{
+ for(TileEntity tileEntity : field_150816_i.values())
+ {
+ tileEntity.func_145836_u();
+ tileEntity.func_145832_p();
+ tileEntity.func_145838_q();
+ }
+
boolean flag = this.field_76637_e.field_73011_w.func_191066_m();
for (int i = 0; i < this.field_76652_q.length; ++i)
@@ -1176,10 +1192,16 @@
this.field_76646_k = true;
this.func_76590_a();
+ List<TileEntity> invalidList = new java.util.ArrayList<TileEntity>();
+
for (TileEntity tileentity : this.field_150816_i.values())
{
+ if (tileentity.shouldRefresh(this.field_76637_e, tileentity.func_174877_v(), tileentity.func_145838_q().func_176203_a(tileentity.func_145832_p()), func_177435_g(tileentity.func_174877_v())))
+ invalidList.add(tileentity);
tileentity.func_145836_u();
}
+
+ for (TileEntity te : invalidList) te.func_145843_s();
}
public Biome func_177411_a(BlockPos p_177411_1_, BiomeProvider p_177411_2_)
@@ -1244,13 +1266,13 @@
BlockPos blockpos1 = blockpos.func_177982_a(k, (j << 4) + i1, l);
boolean flag = i1 == 0 || i1 == 15 || k == 0 || k == 15 || l == 0 || l == 15;
- if (this.field_76652_q[j] == field_186036_a && flag || this.field_76652_q[j] != field_186036_a && this.field_76652_q[j].func_177485_a(k, i1, l).func_185904_a() == Material.field_151579_a)
+ if (this.field_76652_q[j] == field_186036_a && flag || this.field_76652_q[j] != field_186036_a && this.field_76652_q[j].func_177485_a(k, i1, l).func_177230_c().isAir(this.field_76652_q[j].func_177485_a(k, i1, l), this.field_76637_e, blockpos1))
{
for (EnumFacing enumfacing : EnumFacing.values())
{
BlockPos blockpos2 = blockpos1.func_177972_a(enumfacing);
- if (this.field_76637_e.func_180495_p(blockpos2).func_185906_d() > 0)
+ if (this.field_76637_e.func_180495_p(blockpos2).getLightValue(this.field_76637_e, blockpos2) > 0)
{
this.field_76637_e.func_175664_x(blockpos2);
}
@@ -1381,7 +1403,7 @@
{
blockpos$mutableblockpos.func_181079_c(blockpos$mutableblockpos.func_177958_n(), l, blockpos$mutableblockpos.func_177952_p());
- if (this.func_177435_g(blockpos$mutableblockpos).func_185906_d() > 0)
+ if (this.func_177435_g(blockpos$mutableblockpos).getLightValue(this.field_76637_e, blockpos$mutableblockpos) > 0)
{
this.field_76637_e.func_175664_x(blockpos$mutableblockpos);
}
@@ -1420,6 +1442,7 @@
else
{
System.arraycopy(p_177420_1_, 0, this.field_76634_f, 0, this.field_76634_f.length);
+ this.field_82912_p = com.google.common.primitives.Ints.min(this.field_76634_f); // Forge: fix MC-117412
}
}
@@ -1489,4 +1512,55 @@
QUEUED,
CHECK;
}
+
+ /* ======================================== FORGE START =====================================*/
+ /**
+ * Removes the tile entity at the specified position, only if it's
+ * marked as invalid.
+ */
+ public void removeInvalidTileEntity(BlockPos pos)
+ {
+ if (field_76636_d)
+ {
+ TileEntity entity = (TileEntity)field_150816_i.get(pos);
+ if (entity != null && entity.func_145837_r())
+ {
+ field_150816_i.remove(pos);
+ }
+ }
+ }
+
+ private static ChunkPos populating = null; // keep track of cascading chunk generation during chunk population
+
+ private void logCascadingWorldGeneration()
+ {
+ net.minecraftforge.fml.common.ModContainer activeModContainer = net.minecraftforge.fml.common.Loader.instance().activeModContainer();
+ String format = "{} loaded a new chunk {} in dimension {} ({}) while populating chunk {}, causing cascading worldgen lag.";
+
+ if (activeModContainer == null) { // vanilla minecraft has problems too (MC-114332), log it at a quieter level.
+ net.minecraftforge.fml.common.FMLLog.log.debug(format, "Minecraft", this.func_76632_l(), this.field_76637_e.field_73011_w.getDimension(), this.field_76637_e.field_73011_w.func_186058_p().func_186065_b(), populating);
+ net.minecraftforge.fml.common.FMLLog.log.debug("Consider setting 'fixVanillaCascading' to 'true' in the Forge config to fix many cases where this occurs in the base game.");
+ } else {
+ net.minecraftforge.fml.common.FMLLog.log.warn(format, activeModContainer.getName(), this.func_76632_l(), this.field_76637_e.field_73011_w.getDimension(), this.field_76637_e.field_73011_w.func_186058_p().func_186065_b(), populating);
+ net.minecraftforge.fml.common.FMLLog.log.warn("Please report this to the mod's issue tracker. This log can be disabled in the Forge config.");
+ }
+ }
+
+ private final net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities;
+ @Nullable
+ public net.minecraftforge.common.capabilities.CapabilityDispatcher getCapabilities()
+ {
+ return 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);
+ }
}

View File

@ -1,111 +0,0 @@
--- ../src-base/minecraft/net/minecraft/world/gen/MapGenCaves.java
+++ ../src-work/minecraft/net/minecraft/world/gen/MapGenCaves.java
@@ -140,9 +140,7 @@
{
if (l1 >= 0 && l1 < 256)
{
- IBlockState iblockstate = p_180702_5_.func_177856_a(j1, l1, k1);
-
- if (iblockstate.func_177230_c() == Blocks.field_150358_i || iblockstate.func_177230_c() == Blocks.field_150355_j)
+ if (isOceanBlock(p_180702_5_, j1, l1, k1, p_180702_3_, p_180702_4_))
{
flag3 = true;
}
@@ -180,28 +178,12 @@
IBlockState iblockstate1 = p_180702_5_.func_177856_a(j3, j2, i2);
IBlockState iblockstate2 = (IBlockState)MoreObjects.firstNonNull(p_180702_5_.func_177856_a(j3, j2 + 1, i2), field_186127_b);
- if (iblockstate1.func_177230_c() == Blocks.field_150349_c || iblockstate1.func_177230_c() == Blocks.field_150391_bh)
+ if (isTopBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_))
{
flag1 = true;
}
- if (this.func_175793_a(iblockstate1, iblockstate2))
- {
- if (j2 - 1 < 10)
- {
- p_180702_5_.func_177855_a(j3, j2, i2, field_186126_a);
- }
- else
- {
- p_180702_5_.func_177855_a(j3, j2, i2, field_186127_b);
-
- if (flag1 && p_180702_5_.func_177856_a(j3, j2 - 1, i2).func_177230_c() == Blocks.field_150346_d)
- {
- blockpos$mutableblockpos.func_181079_c(j3 + p_180702_3_ * 16, 0, i2 + p_180702_4_ * 16);
- p_180702_5_.func_177855_a(j3, j2 - 1, i2, this.field_75039_c.func_180494_b(blockpos$mutableblockpos).field_76752_A.func_177230_c().func_176223_P());
- }
- }
- }
+ digBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2);
}
}
}
@@ -299,4 +281,66 @@
}
}
}
+
+ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ)
+ {
+ net.minecraft.block.Block block = data.func_177856_a(x, y, z).func_177230_c();
+ return block== Blocks.field_150358_i || block == Blocks.field_150355_j;
+ }
+
+ //Exception biomes to make sure we generate like vanilla
+ private boolean isExceptionBiome(net.minecraft.world.biome.Biome biome)
+ {
+ if (biome == net.minecraft.init.Biomes.field_76787_r) return true;
+ if (biome == net.minecraft.init.Biomes.field_76769_d) return true;
+ return false;
+ }
+
+ //Determine if the block at the specified location is the top block for the biome, we take into account
+ //Vanilla bugs to make sure that we generate the map the same way vanilla does.
+ private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ)
+ {
+ net.minecraft.world.biome.Biome biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
+ IBlockState state = data.func_177856_a(x, y, z);
+ return (isExceptionBiome(biome) ? state.func_177230_c() == Blocks.field_150349_c : state.func_177230_c() == biome.field_76752_A);
+ }
+
+ /**
+ * Digs out the current block, default implementation removes stone, filler, and top block
+ * Sets the block to lava if y is less then 10, and air other wise.
+ * If setting to air, it also checks to see if we've broken the surface and if so
+ * tries to make the floor the biome's top block
+ *
+ * @param data Block data array
+ * @param index Pre-calculated index into block data
+ * @param x local X position
+ * @param y local Y position
+ * @param z local Z position
+ * @param chunkX Chunk X position
+ * @param chunkZ Chunk Y position
+ * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface.
+ */
+ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop, IBlockState state, IBlockState up)
+ {
+ net.minecraft.world.biome.Biome biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
+ IBlockState top = biome.field_76752_A;
+ IBlockState filler = biome.field_76753_B;
+
+ if (this.func_175793_a(state, up) || state.func_177230_c() == top.func_177230_c() || state.func_177230_c() == filler.func_177230_c())
+ {
+ if (y - 1 < 10)
+ {
+ data.func_177855_a(x, y, z, field_186126_a);
+ }
+ else
+ {
+ data.func_177855_a(x, y, z, field_186127_b);
+
+ if (foundTop && data.func_177856_a(x, y - 1, z).func_177230_c() == filler.func_177230_c())
+ {
+ data.func_177855_a(x, y - 1, z, top.func_177230_c().func_176223_P());
+ }
+ }
+ }
+ }
}

View File

@ -1,124 +0,0 @@
--- ../src-base/minecraft/net/minecraft/world/gen/MapGenRavine.java
+++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java
@@ -128,9 +128,7 @@
{
if (l1 >= 0 && l1 < 256)
{
- IBlockState iblockstate = p_180707_5_.func_177856_a(j1, l1, k1);
-
- if (iblockstate.func_177230_c() == Blocks.field_150358_i || iblockstate.func_177230_c() == Blocks.field_150355_j)
+ if (isOceanBlock(p_180707_5_, j1, l1, k1, p_180707_3_, p_180707_4_))
{
flag2 = true;
}
@@ -146,8 +144,6 @@
if (!flag2)
{
- BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
-
for (int j3 = k2; j3 < k; ++j3)
{
double d10 = ((double)(j3 + p_180707_3_ * 16) + 0.5D - p_180707_6_) / d9;
@@ -165,30 +161,12 @@
if ((d10 * d10 + d7 * d7) * (double)this.field_75046_d[j2 - 1] + d8 * d8 / 6.0D < 1.0D)
{
- IBlockState iblockstate1 = p_180707_5_.func_177856_a(j3, j2, i2);
-
- if (iblockstate1.func_177230_c() == Blocks.field_150349_c)
+ if (isTopBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_))
{
flag = true;
}
- if (iblockstate1.func_177230_c() == Blocks.field_150348_b || iblockstate1.func_177230_c() == Blocks.field_150346_d || iblockstate1.func_177230_c() == Blocks.field_150349_c)
- {
- if (j2 - 1 < 10)
- {
- p_180707_5_.func_177855_a(j3, j2, i2, field_186135_a);
- }
- else
- {
- p_180707_5_.func_177855_a(j3, j2, i2, field_186136_b);
-
- if (flag && p_180707_5_.func_177856_a(j3, j2 - 1, i2).func_177230_c() == Blocks.field_150346_d)
- {
- blockpos$mutableblockpos.func_181079_c(j3 + p_180707_3_ * 16, 0, i2 + p_180707_4_ * 16);
- p_180707_5_.func_177855_a(j3, j2 - 1, i2, this.field_75039_c.func_180494_b(blockpos$mutableblockpos).field_76752_A);
- }
- }
- }
+ digBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_, flag);
}
}
}
@@ -223,4 +201,68 @@
}
}
}
+ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ)
+ {
+ net.minecraft.block.Block block = data.func_177856_a(x, y, z).func_177230_c();
+ return block== Blocks.field_150358_i || block == Blocks.field_150355_j;
+ }
+
+ //Exception biomes to make sure we generate like vanilla
+ private boolean isExceptionBiome(net.minecraft.world.biome.Biome biome)
+ {
+ if (biome == net.minecraft.init.Biomes.field_76787_r) return true;
+ if (biome == net.minecraft.init.Biomes.field_76769_d) return true;
+ if (biome == net.minecraft.init.Biomes.field_76789_p) return true;
+ if (biome == net.minecraft.init.Biomes.field_76788_q) return true;
+ return false;
+ }
+
+ //Determine if the block at the specified location is the top block for the biome, we take into account
+ //Vanilla bugs to make sure that we generate the map the same way vanilla does.
+ private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ)
+ {
+ net.minecraft.world.biome.Biome biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
+ IBlockState state = data.func_177856_a(x, y, z);
+ return (isExceptionBiome(biome) ? state.func_177230_c() == Blocks.field_150349_c : state.func_177230_c() == biome.field_76752_A);
+ }
+
+ /**
+ * Digs out the current block, default implementation removes stone, filler, and top block
+ * Sets the block to lava if y is less then 10, and air other wise.
+ * If setting to air, it also checks to see if we've broken the surface and if so
+ * tries to make the floor the biome's top block
+ *
+ * @param data Block data array
+ * @param index Pre-calculated index into block data
+ * @param x local X position
+ * @param y local Y position
+ * @param z local Z position
+ * @param chunkX Chunk X position
+ * @param chunkZ Chunk Y position
+ * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface.
+ */
+ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop)
+ {
+ net.minecraft.world.biome.Biome biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
+ IBlockState state = data.func_177856_a(x, y, z);
+ IBlockState top = isExceptionBiome(biome) ? Blocks.field_150349_c.func_176223_P() : biome.field_76752_A;
+ IBlockState filler = isExceptionBiome(biome) ? Blocks.field_150346_d.func_176223_P() : biome.field_76753_B;
+
+ if (state.func_177230_c() == Blocks.field_150348_b || state.func_177230_c() == top.func_177230_c() || state.func_177230_c() == filler.func_177230_c())
+ {
+ if (y - 1 < 10)
+ {
+ data.func_177855_a(x, y, z, field_186135_a);
+ }
+ else
+ {
+ data.func_177855_a(x, y, z, field_186136_b);
+
+ if (foundTop && data.func_177856_a(x, y - 1, z).func_177230_c() == filler.func_177230_c())
+ {
+ data.func_177855_a(x, y - 1, z, top.func_177230_c().func_176223_P());
+ }
+ }
+ }
+ }
}

View File

@ -1,23 +0,0 @@
--- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java
+++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java
@@ -29,11 +29,19 @@
for (Biome biome : Biome.field_185377_q)
{
- if (biome != null && biome.func_185355_j() > 0.0F)
+ if (biome != null && biome.func_185355_j() > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biome))
{
this.field_151546_e.add(biome);
}
}
+
+ for (Biome biome : net.minecraftforge.common.BiomeManager.strongHoldBiomes)
+ {
+ if (!this.field_151546_e.contains(biome))
+ {
+ this.field_151546_e.add(biome);
+ }
+ }
}
public MapGenStronghold(Map<String, String> p_i2068_1_)

View File

@ -1,17 +0,0 @@
--- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java
+++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java
@@ -175,12 +175,12 @@
{
if (this.field_143029_e == null && p_143027_1_ != null)
{
- this.field_143029_e = (MapGenStructureData)p_143027_1_.func_72943_a(MapGenStructureData.class, this.func_143025_a());
+ this.field_143029_e = (MapGenStructureData)p_143027_1_.getPerWorldStorage().func_75742_a(MapGenStructureData.class, this.func_143025_a());
if (this.field_143029_e == null)
{
this.field_143029_e = new MapGenStructureData(this.func_143025_a());
- p_143027_1_.func_72823_a(this.func_143025_a(), this.field_143029_e);
+ p_143027_1_.getPerWorldStorage().func_75745_a(this.func_143025_a(), this.field_143029_e);
}
else
{

View File

@ -59,33 +59,4 @@
+ if (runnable != null) runnable.run();
return chunk;
}
@@ -224,6 +252,11 @@
{
if (!this.field_73248_b.isEmpty())
{
+ for (ChunkPos forced : this.field_73251_h.getPersistentChunks().keySet())
+ {
+ this.field_73248_b.remove(ChunkPos.func_77272_a(forced.field_77276_a, forced.field_77275_b));
+ }
+
Iterator<Long> iterator = this.field_73248_b.iterator();
for (int i = 0; i < 100 && iterator.hasNext(); iterator.remove())
@@ -234,6 +267,7 @@
if (chunk != null && chunk.field_189550_d)
{
chunk.func_76623_d();
+ net.minecraftforge.common.ForgeChunkManager.putDormantChunk(ChunkPos.func_77272_a(chunk.field_76635_g, chunk.field_76647_h), chunk);
this.func_73242_b(chunk);
this.func_73243_a(chunk);
this.field_73244_f.remove(olong);
@@ -242,6 +276,8 @@
}
}
+ if (this.field_73244_f.isEmpty()) net.minecraftforge.common.DimensionManager.unloadWorld(this.field_73251_h.field_73011_w.getDimension());
+
this.field_73247_e.func_75817_a();
}

View File

@ -190,6 +190,7 @@ public interface IForgeBlock
* @param state State of the current block
* @return True if block has a tile entity, false otherwise
*/
@SuppressWarnings("deprecation")
default boolean hasTileEntity(IBlockState state)
{
return this instanceof ITileEntityProvider;
@ -204,6 +205,7 @@ public interface IForgeBlock
* @param world The world to create the TE in
* @return A instance of a class extending TileEntity
*/
@SuppressWarnings("deprecation")
@Nullable
default TileEntity createTileEntity(IBlockState state, IBlockReader world)
{

View File

@ -51,7 +51,7 @@ public class VanillaInventoryCodeHooks
return getItemHandler(dest, EnumFacing.UP)
.map(itemHandlerResult -> {
IItemHandler handler = itemHandlerResult.getKey();
for (int i = 0; i < handler.getSlots(); i++)
{
ItemStack extractItem = handler.extractItem(i, 1, true);
@ -76,7 +76,7 @@ public class VanillaInventoryCodeHooks
}
}
}
return false;
})
.orElse(null); // TODO bad null
@ -95,7 +95,7 @@ public class VanillaInventoryCodeHooks
Object destination = destinationResult.getValue();
ItemStack dispensedStack = stack.copy().split(1);
ItemStack remainder = putStackInInventoryAllSlots(dropper, destination, itemHandler, dispensedStack);
if (remainder.isEmpty())
{
remainder = stack.copy();
@ -105,7 +105,7 @@ public class VanillaInventoryCodeHooks
{
remainder = stack.copy();
}
dropper.setInventorySlotContents(slot, remainder);
return false;
})
@ -135,16 +135,16 @@ public class VanillaInventoryCodeHooks
ItemStack originalSlotContents = hopper.getStackInSlot(i).copy();
ItemStack insertStack = hopper.decrStackSize(i, 1);
ItemStack remainder = putStackInInventoryAllSlots(hopper, destination, itemHandler, insertStack);
if (remainder.isEmpty())
{
return true;
}
hopper.setInventorySlotContents(i, originalSlotContents);
}
}
return false;
}
})
@ -253,9 +253,8 @@ public class VanillaInventoryCodeHooks
int k = MathHelper.floor(z);
BlockPos blockpos = new BlockPos(i, j, k);
net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos);
Block block = state.getBlock();
if (block.hasTileEntity(/* TODO Block patches // state */))
if (state.hasTileEntity())
{
TileEntity tileentity = worldIn.getTileEntity(blockpos);
if (tileentity != null)