diff --git a/patches/minecraft/net/minecraft/block/BlockNote.java.patch b/patches/minecraft/net/minecraft/block/BlockNote.java.patch index dbbb7e9b9..8863e598d 100644 --- a/patches/minecraft/net/minecraft/block/BlockNote.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNote.java.patch @@ -1,5 +1,14 @@ --- a/net/minecraft/block/BlockNote.java +++ b/net/minecraft/block/BlockNote.java +@@ -49,7 +49,7 @@ + } + + private void func_196482_a(World p_196482_1_, BlockPos p_196482_2_) { +- if (p_196482_1_.func_180495_p(p_196482_2_.func_177984_a()).func_196958_f()) { ++ if (p_196482_1_.func_175623_d(p_196482_2_.func_177984_a())) { + p_196482_1_.func_175641_c(p_196482_2_, this, 0, 0); + } + @@ -59,7 +59,9 @@ if (p_196250_2_.field_72995_K) { return true; diff --git a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch index 03c62bc1f..e1c7c0758 100644 --- a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch @@ -12,7 +12,7 @@ if (p_176478_3_.func_177229_b(field_176479_b) == 0) { p_176478_1_.func_180501_a(p_176478_2_, (IBlockState)p_176478_3_.func_177231_a(field_176479_b), 4); } else { -+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(p_176478_1_, p_176478_4_, p_176478_2_)) return; ++ if (!net.minecraftforge.event.ForgeEventFactory.saplingGrowTree(p_176478_1_, p_176478_4_, p_176478_2_)) return; this.field_196387_c.func_196935_a(p_176478_1_, p_176478_2_, p_176478_3_, p_176478_4_); } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index 73ff3214d..ebe49d970 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -44,7 +44,15 @@ return p_189516_1_; } } -@@ -98,7 +106,6 @@ +@@ -91,14 +99,13 @@ + if (this.field_145850_b != null) { + this.field_195045_e = this.field_145850_b.func_180495_p(this.field_174879_c); + this.field_145850_b.func_175646_b(this.field_174879_c, this); +- if (!this.field_195045_e.func_196958_f()) { ++ if (!this.field_195045_e.isAir(field_145850_b, this.field_174879_c)) { + this.field_145850_b.func_175666_e(this.field_174879_c, this.field_195045_e.func_177230_c()); + } + } } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch new file mode 100644 index 000000000..57b974d01 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch @@ -0,0 +1,47 @@ +--- a/net/minecraft/tileentity/TileEntityBeacon.java ++++ b/net/minecraft/tileentity/TileEntityBeacon.java +@@ -128,7 +128,7 @@ + boolean flag = true; + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + +- for(int i1 = j + 1; i1 < 256; ++i1) { ++ for(int i1 = j + 1; i1 < this.func_145831_w().func_72800_K(); ++i1) { + IBlockState iblockstate = this.field_145850_b.func_180495_p(blockpos$mutableblockpos.func_181079_c(i, i1, k)); + Block block = iblockstate.func_177230_c(); + float[] afloat; +@@ -142,10 +142,15 @@ + break; + } + ++ float[] custom = iblockstate.getBeaconColorMultiplier(this.field_145850_b, blockpos$mutableblockpos, func_174877_v()); ++ if (custom != null) { ++ afloat = custom; ++ } else { + tileentitybeacon$beamsegment.func_177262_a(); + continue; ++ } + } +- ++ else + afloat = ((BlockStainedGlassPane)block).func_196419_d().func_193349_f(); + } + +@@ -174,8 +179,7 @@ + + for(int i2 = i - k1; i2 <= i + k1 && flag1; ++i2) { + for(int j1 = k - k1; j1 <= k + k1; ++j1) { +- Block block1 = this.field_145850_b.func_180495_p(new BlockPos(i2, l1, j1)).func_177230_c(); +- if (block1 != Blocks.field_150475_bE && block1 != Blocks.field_150340_R && block1 != Blocks.field_150484_ah && block1 != Blocks.field_150339_S) { ++ if (this.field_145850_b.func_180495_p(new BlockPos(i2, l1, j1)).isBeaconBase(this.field_145850_b, new BlockPos(i2, l1, j1), this.func_174877_v())) { + flag1 = false; + break; + } +@@ -346,7 +350,7 @@ + } + + public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) { +- return p_94041_2_.func_77973_b() == Items.field_151166_bC || p_94041_2_.func_77973_b() == Items.field_151045_i || p_94041_2_.func_77973_b() == Items.field_151043_k || p_94041_2_.func_77973_b() == Items.field_151042_j; ++ return p_94041_2_.isBeaconPayment(); + } + + public String func_174875_k() { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch new file mode 100644 index 000000000..d72e042df --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch @@ -0,0 +1,70 @@ +--- a/net/minecraft/tileentity/TileEntityChest.java ++++ b/net/minecraft/tileentity/TileEntityChest.java +@@ -33,6 +33,7 @@ + protected float field_145986_n; + protected int field_145987_o; + private int field_145983_q; ++ private net.minecraftforge.common.capabilities.OptionalCapabilityInstance chestHandler; + + protected TileEntityChest(TileEntityType p_i48287_1_) { + super(p_i48287_1_); +@@ -220,7 +221,7 @@ + + public static int func_195481_a(IBlockReader p_195481_0_, BlockPos p_195481_1_) { + IBlockState iblockstate = p_195481_0_.func_180495_p(p_195481_1_); +- if (iblockstate.func_177230_c().func_149716_u()) { ++ if (iblockstate.hasTileEntity()) { + TileEntity tileentity = p_195481_0_.func_175625_s(p_195481_1_); + if (tileentity instanceof TileEntityChest) { + return ((TileEntityChest)tileentity).field_145987_o; +@@ -235,4 +236,50 @@ + p_199722_0_.func_199721_a(p_199722_1_.func_190576_q()); + p_199722_1_.func_199721_a(nonnulllist); + } ++ ++ @Override ++ public void func_145836_u() { ++ super.func_145836_u(); ++ if (this.chestHandler != null) { ++ this.chestHandler.invalidate(); ++ this.chestHandler = null; ++ } ++ } ++ ++ @Override ++ public net.minecraftforge.common.capabilities.OptionalCapabilityInstance getCapability(net.minecraftforge.common.capabilities.Capability cap, EnumFacing side) { ++ if (cap == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { ++ if (this.chestHandler == null) { ++ this.chestHandler = net.minecraftforge.common.capabilities.OptionalCapabilityInstance.of(this::createHandler); ++ } ++ return this.chestHandler.cast(); ++ } ++ return super.getCapability(cap, side); ++ } ++ ++ private net.minecraftforge.items.IItemHandlerModifiable createHandler() { ++ IBlockState state = this.func_195044_w(); ++ if (!(state.func_177230_c() instanceof BlockChest)) { ++ return new net.minecraftforge.items.wrapper.InvWrapper(this); ++ } ++ ChestType type = state.func_177229_b(BlockChest.field_196314_b); ++ if (type != ChestType.SINGLE) { ++ BlockPos opos = this.func_174877_v().func_177972_a(BlockChest.func_196311_i(state)); ++ IBlockState ostate = this.func_145831_w().func_180495_p(opos); ++ if (state.func_177230_c() == ostate.func_177230_c()) { ++ ChestType otype = ostate.func_177229_b(BlockChest.field_196314_b); ++ if (otype != ChestType.SINGLE && type != otype && state.func_177229_b(BlockChest.field_176459_a) == ostate.func_177229_b(BlockChest.field_176459_a)) { ++ TileEntity ote = this.func_145831_w().func_175625_s(opos); ++ if (ote instanceof TileEntityChest) { ++ IInventory top = type == ChestType.RIGHT ? this : (IInventory)ote; ++ IInventory bottom = type == ChestType.RIGHT ? (IInventory)ote : this; ++ return new net.minecraftforge.items.wrapper.CombinedInvWrapper( ++ new net.minecraftforge.items.wrapper.InvWrapper(top), ++ new net.minecraftforge.items.wrapper.InvWrapper(bottom)); ++ } ++ } ++ } ++ } ++ return new net.minecraftforge.items.wrapper.InvWrapper(this); ++ } + } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch new file mode 100644 index 000000000..a3abe2ce3 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch @@ -0,0 +1,42 @@ +--- a/net/minecraft/tileentity/TileEntityHopper.java ++++ b/net/minecraft/tileentity/TileEntityHopper.java +@@ -159,6 +159,7 @@ + } + + private boolean func_145883_k() { ++ if (net.minecraftforge.items.VanillaInventoryCodeHooks.insertHook(this)) return true; + IInventory iinventory = this.func_145895_l(); + if (iinventory == null) { + return false; +@@ -234,6 +235,8 @@ + } + + public static boolean func_145891_a(IHopper p_145891_0_) { ++ Boolean ret = net.minecraftforge.items.VanillaInventoryCodeHooks.extractHook(p_145891_0_); ++ if (ret != null) return ret; + IInventory iinventory = func_145884_b(p_145891_0_); + if (iinventory != null) { + EnumFacing enumfacing = EnumFacing.DOWN; +@@ -399,7 +402,7 @@ + BlockPos blockpos = new BlockPos(p_145893_1_, p_145893_3_, p_145893_5_); + IBlockState iblockstate = p_145893_0_.func_180495_p(blockpos); + Block block = iblockstate.func_177230_c(); +- if (block.func_149716_u()) { ++ if (iblockstate.hasTileEntity()) { + TileEntity tileentity = p_145893_0_.func_175625_s(blockpos); + if (tileentity instanceof IInventory) { + iinventory = (IInventory)tileentity; +@@ -483,4 +486,13 @@ + } + + } ++ ++ @Override ++ protected net.minecraftforge.items.IItemHandler createUnSidedHandler() { ++ return new net.minecraftforge.items.VanillaHopperItemHandler(this); ++ } ++ ++ public long getLastUpdateTime() { ++ return this.field_190578_g; ++ } + } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch new file mode 100644 index 000000000..0393293e5 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/tileentity/TileEntityLockable.java ++++ b/net/minecraft/tileentity/TileEntityLockable.java +@@ -36,4 +36,17 @@ + public void func_174892_a(LockCode p_174892_1_) { + this.field_174901_a = p_174892_1_; + } ++ ++ private net.minecraftforge.common.capabilities.OptionalCapabilityInstance itemHandler = net.minecraftforge.common.capabilities.OptionalCapabilityInstance.of(() -> createUnSidedHandler()); ++ protected net.minecraftforge.items.IItemHandler createUnSidedHandler() { ++ return new net.minecraftforge.items.wrapper.InvWrapper(this); ++ } ++ ++ @javax.annotation.Nullable ++ public net.minecraftforge.common.capabilities.OptionalCapabilityInstance getCapability(net.minecraftforge.common.capabilities.Capability cap, @javax.annotation.Nullable net.minecraft.util.EnumFacing side) { ++ if (cap == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ) { ++ return itemHandler.cast(); ++ } ++ return super.getCapability(cap, side); ++ } + } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityLockableLoot.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityLockableLoot.java.patch new file mode 100644 index 000000000..66b4faaa7 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityLockableLoot.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/tileentity/TileEntityLockableLoot.java ++++ b/net/minecraft/tileentity/TileEntityLockableLoot.java +@@ -69,6 +69,7 @@ + + LootContext.Builder lootcontext$builder = new LootContext.Builder((WorldServer)this.field_145850_b); + lootcontext$builder.func_204313_a(this.field_174879_c); ++ lootcontext$builder.func_186470_a(p_184281_1_); + if (p_184281_1_ != null) { + lootcontext$builder.func_186469_a(p_184281_1_.func_184817_da()); + } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityShulkerBox.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityShulkerBox.java.patch new file mode 100644 index 000000000..6c1980464 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityShulkerBox.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/tileentity/TileEntityShulkerBox.java ++++ b/net/minecraft/tileentity/TileEntityShulkerBox.java +@@ -331,6 +331,11 @@ + return !this.func_190581_E() || !this.func_191420_l() || this.func_145818_k_() || this.field_184284_m != null; + } + ++ @Override ++ protected net.minecraftforge.items.IItemHandler createUnSidedHandler() { ++ return new net.minecraftforge.items.wrapper.SidedInvWrapper(this, EnumFacing.UP); ++ } ++ + public static enum AnimationStatus { + CLOSED, + OPENING, diff --git a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch index d99119e24..32572a0d4 100644 --- a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch @@ -1,6 +1,38 @@ --- a/net/minecraft/world/ChunkCache.java +++ b/net/minecraft/world/ChunkCache.java -@@ -239,7 +239,7 @@ +@@ -62,13 +62,14 @@ + + @Nullable + public TileEntity func_175625_s(BlockPos p_175625_1_) { +- return this.func_190300_a(p_175625_1_, Chunk.EnumCreateEntityType.IMMEDIATE); ++ return this.func_190300_a(p_175625_1_, Chunk.EnumCreateEntityType.CHECK); // Forge: don't modify world from other threads + } + + @Nullable + public TileEntity func_190300_a(BlockPos p_190300_1_, Chunk.EnumCreateEntityType p_190300_2_) { + int i = (p_190300_1_.func_177958_n() >> 4) - this.field_72818_a; + int j = (p_190300_1_.func_177952_p() >> 4) - this.field_72816_b; ++ if (!withinBounds(i, j)) return null; + return this.field_72817_c[i][j].func_177424_a(p_190300_1_, p_190300_2_); + } + +@@ -205,6 +206,7 @@ + public Biome func_180494_b(BlockPos p_180494_1_) { + int i = (p_180494_1_.func_177958_n() >> 4) - this.field_72818_a; + int j = (p_180494_1_.func_177952_p() >> 4) - this.field_72816_b; ++ if (!withinBounds(i, j)) return net.minecraft.init.Biomes.field_76772_c; + return this.field_72817_c[i][j].func_201600_k(p_180494_1_); + } + +@@ -231,6 +233,7 @@ + } else { + int i = (p_175629_2_.func_177958_n() >> 4) - this.field_72818_a; + int j = (p_175629_2_.func_177952_p() >> 4) - this.field_72816_b; ++ if (!withinBounds(i, j)) return p_175629_1_.field_77198_c; + return this.field_72817_c[i][j].func_177413_a(p_175629_1_, p_175629_2_); + } + } else { +@@ -239,13 +242,14 @@ } public boolean func_175623_d(BlockPos p_175623_1_) { @@ -9,3 +41,19 @@ } public int func_175642_b(EnumLightType p_175642_1_, BlockPos p_175642_2_) { + if (p_175642_2_.func_177956_o() >= 0 && p_175642_2_.func_177956_o() < 256) { + int i = (p_175642_2_.func_177958_n() >> 4) - this.field_72818_a; + int j = (p_175642_2_.func_177952_p() >> 4) - this.field_72816_b; ++ if (!withinBounds(i, j)) return p_175642_1_.field_77198_c; + return this.field_72817_c[i][j].func_177413_a(p_175642_1_, p_175642_2_); + } else { + return p_175642_1_.field_77198_c; +@@ -263,4 +267,8 @@ + public int func_181545_F() { + throw new RuntimeException("Not yet implemented"); + } ++ ++ private boolean withinBounds(int x, int z) { ++ return x >= 0 && x < field_72817_c.length && z >= 0 && z < field_72817_c[x].length && field_72817_c[x][z] != null; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch index 5ef08d208..df90b80df 100644 --- a/patches/minecraft/net/minecraft/world/Explosion.java.patch +++ b/patches/minecraft/net/minecraft/world/Explosion.java.patch @@ -1,6 +1,22 @@ --- a/net/minecraft/world/Explosion.java +++ b/net/minecraft/world/Explosion.java -@@ -92,7 +92,7 @@ +@@ -41,6 +41,7 @@ + private DamageSource field_199593_j; + private final List field_77281_g; + private final Map field_77288_k; ++ private final Vec3d position; + + @OnlyIn(Dist.CLIENT) + public Explosion(World p_i45752_1_, @Nullable Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) { +@@ -66,6 +67,7 @@ + this.field_77286_a = p_i45754_10_; + this.field_82755_b = p_i45754_11_; + this.field_199593_j = DamageSource.func_94539_a(this); ++ this.position = new Vec3d(this.field_77284_b, this.field_77285_c, this.field_77282_d); + } + + public void func_77278_a() { +@@ -92,7 +94,7 @@ BlockPos blockpos = new BlockPos(d4, d6, d8); IBlockState iblockstate = this.field_77287_j.func_180495_p(blockpos); IFluidState ifluidstate = this.field_77287_j.func_204610_c(blockpos); @@ -9,3 +25,44 @@ if (f2 > 0.0F) { if (this.field_77283_e != null) { f2 = this.field_77283_e.func_180428_a(this, this.field_77287_j, blockpos, iblockstate, ifluidstate, f2); +@@ -123,6 +125,7 @@ + int j2 = MathHelper.func_76128_c(this.field_77282_d - (double)f3 - 1.0D); + int j1 = MathHelper.func_76128_c(this.field_77282_d + (double)f3 + 1.0D); + List list = this.field_77287_j.func_72839_b(this.field_77283_e, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); ++ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.field_77287_j, this, list, f3); + Vec3d vec3d = new Vec3d(this.field_77284_b, this.field_77285_c, this.field_77282_d); + + for(int k2 = 0; k2 < list.size(); ++k2) { +@@ -194,20 +197,19 @@ + this.field_77287_j.func_195594_a(Particles.field_197601_L, d0, d1, d2, d3, d4, d5); + } + +- if (!iblockstate.func_196958_f()) { ++ if (!iblockstate.isAir(field_77287_j, blockpos)) { + if (block.func_149659_a(this)) { + iblockstate.func_196941_a(this.field_77287_j, blockpos, 1.0F / this.field_77280_f, 0); + } + +- this.field_77287_j.func_180501_a(blockpos, Blocks.field_150350_a.func_176223_P(), 3); +- block.func_180652_a(this.field_77287_j, blockpos, this); ++ iblockstate.onBlockExploded(this.field_77287_j, blockpos, this); + } + } + } + + if (this.field_77286_a) { + for(BlockPos blockpos1 : this.field_77281_g) { +- if (this.field_77287_j.func_180495_p(blockpos1).func_196958_f() && this.field_77287_j.func_180495_p(blockpos1.func_177977_b()).func_200015_d(this.field_77287_j, blockpos1.func_177977_b()) && this.field_77290_i.nextInt(3) == 0) { ++ if (this.field_77287_j.func_180495_p(blockpos1).isAir(field_77287_j, blockpos1) && this.field_77287_j.func_180495_p(blockpos1.func_177977_b()).func_200015_d(this.field_77287_j, blockpos1.func_177977_b()) && this.field_77290_i.nextInt(3) == 0) { + this.field_77287_j.func_175656_a(blockpos1, Blocks.field_150480_ab.func_176223_P()); + } + } +@@ -245,4 +247,8 @@ + public List func_180343_e() { + return this.field_77281_g; + } ++ ++ public Vec3d getPosition() { ++ return this.position; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/IWorld.java.patch b/patches/minecraft/net/minecraft/world/IWorld.java.patch new file mode 100644 index 000000000..8f50dfac4 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/IWorld.java.patch @@ -0,0 +1,22 @@ +--- a/net/minecraft/world/IWorld.java ++++ b/net/minecraft/world/IWorld.java +@@ -24,16 +24,16 @@ + long func_72905_C(); + + default float func_130001_d() { +- return Dimension.field_111203_a[this.func_201675_m().func_76559_b(this.func_72912_H().func_76073_f())]; ++ return this.func_201675_m().getCurrentMoonPhaseFactor(this.func_201672_e().func_72820_D()); + } + + default float func_72826_c(float p_72826_1_) { +- return this.func_201675_m().func_76563_a(this.func_72912_H().func_76073_f(), p_72826_1_); ++ return this.func_201675_m().func_76563_a(this.func_201672_e().func_72820_D(), p_72826_1_); + } + + @OnlyIn(Dist.CLIENT) + default int func_72853_d() { +- return this.func_201675_m().func_76559_b(this.func_72912_H().func_76073_f()); ++ return this.func_201675_m().func_76559_b(this.func_201672_e().func_72820_D()); + } + + ITickList func_205220_G_(); diff --git a/patches/minecraft/net/minecraft/world/ServerWorldEventHandler.java.patch b/patches/minecraft/net/minecraft/world/ServerWorldEventHandler.java.patch new file mode 100644 index 000000000..8c74af667 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/ServerWorldEventHandler.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/world/ServerWorldEventHandler.java ++++ b/net/minecraft/world/ServerWorldEventHandler.java +@@ -47,7 +47,7 @@ + } + + public void func_184375_a(@Nullable EntityPlayer p_184375_1_, SoundEvent p_184375_2_, SoundCategory p_184375_3_, double p_184375_4_, double p_184375_6_, double p_184375_8_, float p_184375_10_, float p_184375_11_) { +- this.field_72783_a.func_184103_al().func_148543_a(p_184375_1_, p_184375_4_, p_184375_6_, p_184375_8_, p_184375_10_ > 1.0F ? (double)(16.0F * p_184375_10_) : 16.0D, this.field_72782_b.field_73011_w.func_186058_p().func_186068_a(), new SPacketSoundEffect(p_184375_2_, p_184375_3_, p_184375_4_, p_184375_6_, p_184375_8_, p_184375_10_, p_184375_11_)); ++ this.field_72783_a.func_184103_al().func_148543_a(p_184375_1_, p_184375_4_, p_184375_6_, p_184375_8_, p_184375_10_ > 1.0F ? (double)(16.0F * p_184375_10_) : 16.0D, this.field_72782_b.field_73011_w.getId(), new SPacketSoundEffect(p_184375_2_, p_184375_3_, p_184375_4_, p_184375_6_, p_184375_8_, p_184375_10_, p_184375_11_)); + } + + public void func_147585_a(int p_147585_1_, int p_147585_2_, int p_147585_3_, int p_147585_4_, int p_147585_5_, int p_147585_6_) { +@@ -64,7 +64,7 @@ + } + + public void func_180439_a(EntityPlayer p_180439_1_, int p_180439_2_, BlockPos p_180439_3_, int p_180439_4_) { +- this.field_72783_a.func_184103_al().func_148543_a(p_180439_1_, (double)p_180439_3_.func_177958_n(), (double)p_180439_3_.func_177956_o(), (double)p_180439_3_.func_177952_p(), 64.0D, this.field_72782_b.field_73011_w.func_186058_p().func_186068_a(), new SPacketEffect(p_180439_2_, p_180439_3_, p_180439_4_, false)); ++ this.field_72783_a.func_184103_al().func_148543_a(p_180439_1_, (double)p_180439_3_.func_177958_n(), (double)p_180439_3_.func_177956_o(), (double)p_180439_3_.func_177952_p(), 64.0D, this.field_72782_b.field_73011_w.getId(), new SPacketEffect(p_180439_2_, p_180439_3_, p_180439_4_, false)); + } + + public void func_180440_a(int p_180440_1_, BlockPos p_180440_2_, int p_180440_3_) { diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index 4a34d44ca..e7ef4b39f 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -9,16 +9,20 @@ protected static final Logger field_195596_d = LogManager.getLogger(); private static final EnumFacing[] field_200007_a = EnumFacing.values(); private int field_181546_a = 63; -@@ -110,6 +110,8 @@ +@@ -110,6 +110,12 @@ private final WorldBorder field_175728_M; int[] field_72994_J; + public boolean restoringBlockSnapshots = false; ++ public boolean captureBlockSnapshots = false; ++ public java.util.ArrayList capturedBlockSnapshots = new java.util.ArrayList(); ++ protected WorldSavedDataStorage perWorldStorage; ++ private net.minecraftforge.common.util.WorldCapabilityData capabilityData; + protected World(ISaveHandler p_i45749_1_, WorldInfo p_i45749_2_, Dimension p_i45749_3_, Profiler p_i45749_4_, boolean p_i45749_5_) { this.field_73021_x = Lists.newArrayList(this.field_184152_t); this.field_72985_G = true; -@@ -121,6 +123,7 @@ +@@ -121,6 +127,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(); @@ -26,7 +30,38 @@ } public IWorld func_175643_b() { -@@ -184,7 +187,7 @@ +@@ -128,21 +135,25 @@ + } + + public Biome func_180494_b(BlockPos p_180494_1_) { +- if (this.func_175667_e(p_180494_1_)) { +- Chunk chunk = this.func_175726_f(p_180494_1_); ++ return this.field_73011_w.getBiome(p_180494_1_); ++ } + ++ public Biome getBiomeBody(BlockPos pos) { ++ if (this.func_175667_e(pos)) { ++ Chunk chunk = this.func_175726_f(pos); ++ + try { +- return chunk.func_201600_k(p_180494_1_); ++ return chunk.func_201600_k(pos); + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.func_85055_a(throwable, "Getting biome"); + CrashReportCategory crashreportcategory = crashreport.func_85058_a("Coordinates of biome request"); + crashreportcategory.func_189529_a("Location", () -> { +- return CrashReportCategory.func_180522_a(p_180494_1_); ++ return CrashReportCategory.func_180522_a(pos); + }); + throw new ReportedException(crashreport); + } + } else { +- return this.field_73020_y.func_201711_g().func_202090_b().func_180300_a(p_180494_1_, Biomes.field_76772_c); ++ return this.field_73020_y.func_201711_g().func_202090_b().func_180300_a(pos, Biomes.field_76772_c); + } + } + +@@ -184,7 +195,7 @@ } public boolean func_175623_d(BlockPos p_175623_1_) { @@ -35,7 +70,528 @@ } public Chunk func_175726_f(BlockPos p_175726_1_) { -@@ -1495,7 +1498,7 @@ +@@ -203,42 +214,67 @@ + } 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 old = func_180495_p(p_180501_1_); ++ int oldLight = old.getLightValue(this, p_180501_1_); ++ int oldOpacity = old.func_200016_a(this, p_180501_1_); ++ + IBlockState iblockstate = chunk.func_177436_a(p_180501_1_, p_180501_2_, (p_180501_3_ & 64) != 0); + if (iblockstate == null) { ++ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); + return false; + } else { + IBlockState iblockstate1 = this.func_180495_p(p_180501_1_); +- if (iblockstate1.func_200016_a(this, p_180501_1_) != iblockstate.func_200016_a(this, p_180501_1_) || iblockstate1.func_185906_d() != iblockstate.func_185906_d()) { ++ if (iblockstate1.func_200016_a(this, p_180501_1_) != oldOpacity || iblockstate1.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 (iblockstate1 == p_180501_2_) { ++ 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 pos, @Nullable Chunk chunk, IBlockState iblockstate, IBlockState newState, int flags) { ++ Block block = newState.func_177230_c(); ++ IBlockState iblockstate1 = func_180495_p(pos); ++ { ++ { ++ if (iblockstate1 == newState) { + if (iblockstate != iblockstate1) { +- this.func_175704_b(p_180501_1_, p_180501_1_); ++ this.func_175704_b(pos, pos); + } + +- if ((p_180501_3_ & 2) != 0 && (!this.field_72995_K || (p_180501_3_ & 4) == 0) && chunk.func_150802_k()) { +- this.func_184138_a(p_180501_1_, iblockstate, p_180501_2_, p_180501_3_); ++ if ((flags & 2) != 0 && (!this.field_72995_K || (flags & 4) == 0) && (chunk == null || chunk.func_150802_k())) { ++ this.func_184138_a(pos, iblockstate, newState, flags); + } + +- if (!this.field_72995_K && (p_180501_3_ & 1) != 0) { +- this.func_195592_c(p_180501_1_, iblockstate.func_177230_c()); +- if (p_180501_2_.func_185912_n()) { +- this.func_175666_e(p_180501_1_, block); ++ if (!this.field_72995_K && (flags & 1) != 0) { ++ this.func_195592_c(pos, iblockstate.func_177230_c()); ++ if (newState.func_185912_n()) { ++ this.func_175666_e(pos, block); + } + } + +- if ((p_180501_3_ & 16) == 0) { +- int i = p_180501_3_ & -2; +- iblockstate.func_196948_b(this, p_180501_1_, i); +- p_180501_2_.func_196946_a(this, p_180501_1_, i); +- p_180501_2_.func_196948_b(this, p_180501_1_, i); ++ if ((flags & 16) == 0) { ++ int i = flags & -2; ++ iblockstate.func_196948_b(this, pos, i); ++ newState.func_196946_a(this, pos, i); ++ newState.func_196948_b(this, pos, i); + } + } +- +- return true; + } + } + } +@@ -250,7 +286,7 @@ + + public boolean func_175655_b(BlockPos p_175655_1_, boolean p_175655_2_) { + IBlockState iblockstate = this.func_180495_p(p_175655_1_); +- if (iblockstate.func_196958_f()) { ++ if (iblockstate.isAir(this, p_175655_1_)) { + return false; + } else { + IFluidState ifluidstate = this.func_204610_c(p_175655_1_); +@@ -309,6 +345,8 @@ + } + + public void func_195593_d(BlockPos p_195593_1_, Block p_195593_2_) { ++ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_195593_1_, this.func_180495_p(p_195593_1_), java.util.EnumSet.allOf(EnumFacing.class), false).isCanceled()) ++ return; + this.func_190524_a(p_195593_1_.func_177976_e(), p_195593_2_, p_195593_1_); + this.func_190524_a(p_195593_1_.func_177974_f(), p_195593_2_, p_195593_1_); + this.func_190524_a(p_195593_1_.func_177977_b(), p_195593_2_, p_195593_1_); +@@ -318,6 +356,11 @@ + } + + public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, EnumFacing p_175695_3_) { ++ java.util.EnumSet 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_); + } +@@ -355,9 +398,9 @@ + CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block being updated"); + crashreportcategory.func_189529_a("Source block type", () -> { + try { +- return String.format("ID #%s (%s // %s)", Block.field_149771_c.func_177774_c(p_190524_2_), p_190524_2_.func_149739_a(), p_190524_2_.getClass().getCanonicalName()); ++ return String.format("ID #%s (%s // %s)", p_190524_2_.getRegistryName(), p_190524_2_.func_149739_a(), p_190524_2_.getClass().getCanonicalName()); + } catch (Throwable var2) { +- return "ID #" + Block.field_149771_c.func_177774_c(p_190524_2_); ++ return "ID #" + p_190524_2_.getRegistryName(); + } + }); + CrashReportCategory.func_175750_a(crashreportcategory, p_190524_1_, iblockstate); +@@ -515,7 +558,7 @@ + } + + public boolean func_72935_r() { +- return this.field_73008_k < 4; ++ return this.field_73011_w.isDaytime(); + } + + @Nullable +@@ -695,6 +738,12 @@ + } + + 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_); + } +@@ -739,6 +788,8 @@ + } + + 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; +@@ -755,6 +806,7 @@ + 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_); +@@ -816,52 +868,62 @@ + this.field_73021_x.add(p_72954_1_); + } + +- @OnlyIn(Dist.CLIENT) + public void func_72848_b(IWorldEventListener p_72848_1_) { + this.field_73021_x.remove(p_72848_1_); + } + + public int func_72967_a(float p_72967_1_) { +- float f = this.func_72826_c(p_72967_1_); ++ float f = 1.0F - this.field_73011_w.getSunBrightnessFactor(p_72967_1_); ++ return (int)(f * 11); ++ } ++ public float getSunBrightnessFactor(float partialTicks) { ++ float f = this.func_72826_c(partialTicks); + 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); ++ f1 = (float)((double)f1 * (1.0D - (double)(this.func_72867_j(partialTicks) * 5.0F) / 16.0D)); ++ f1 = (float)((double)f1 * (1.0D - (double)(this.func_72819_i(partialTicks) * 5.0F) / 16.0D)); ++ return f1; + } + + @OnlyIn(Dist.CLIENT) + public float func_72971_b(float p_72971_1_) { +- float f = this.func_72826_c(p_72971_1_); ++ return this.field_73011_w.getSunBrightness(p_72971_1_); ++ } ++ ++ @OnlyIn(Dist.CLIENT) ++ public float getSunBrightnessBody(float partialTicks) { ++ float f = this.func_72826_c(partialTicks); + 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); + f1 = 1.0F - f1; +- f1 = (float)((double)f1 * (1.0D - (double)(this.func_72867_j(p_72971_1_) * 5.0F) / 16.0D)); +- f1 = (float)((double)f1 * (1.0D - (double)(this.func_72819_i(p_72971_1_) * 5.0F) / 16.0D)); ++ f1 = (float)((double)f1 * (1.0D - (double)(this.func_72867_j(partialTicks) * 5.0F) / 16.0D)); ++ f1 = (float)((double)f1 * (1.0D - (double)(this.func_72819_i(partialTicks) * 5.0F) / 16.0D)); + return f1 * 0.8F + 0.2F; + } + + @OnlyIn(Dist.CLIENT) + public Vec3d func_72833_a(Entity p_72833_1_, float p_72833_2_) { +- float f = this.func_72826_c(p_72833_2_); ++ return this.field_73011_w.getSkyColor(p_72833_1_, p_72833_2_); ++ } ++ ++ @OnlyIn(Dist.CLIENT) ++ public Vec3d getSkyColorBody(Entity entityIn, float partialTicks) { ++ float f = this.func_72826_c(partialTicks); + 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); +- int i = MathHelper.func_76128_c(p_72833_1_.field_70165_t); +- int j = MathHelper.func_76128_c(p_72833_1_.field_70163_u); +- int k = MathHelper.func_76128_c(p_72833_1_.field_70161_v); ++ int i = MathHelper.func_76128_c(entityIn.field_70165_t); ++ int j = MathHelper.func_76128_c(entityIn.field_70163_u); ++ int k = MathHelper.func_76128_c(entityIn.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; + f3 = f3 * f1; + f4 = f4 * f1; + f5 = f5 * f1; +- float f6 = this.func_72867_j(p_72833_2_); ++ float f6 = this.func_72867_j(partialTicks); + if (f6 > 0.0F) { + float f7 = (f3 * 0.3F + f4 * 0.59F + f5 * 0.11F) * 0.6F; + float f8 = 1.0F - f6 * 0.75F; +@@ -870,7 +932,7 @@ + f5 = f5 * f8 + f7 * (1.0F - f8); + } + +- float f10 = this.func_72819_i(p_72833_2_); ++ float f10 = this.func_72819_i(partialTicks); + if (f10 > 0.0F) { + float f11 = (f3 * 0.3F + f4 * 0.59F + f5 * 0.11F) * 0.2F; + float f9 = 1.0F - f10 * 0.75F; +@@ -880,7 +942,7 @@ + } + + if (this.field_73016_r > 0) { +- float f12 = (float)this.field_73016_r - p_72833_2_; ++ float f12 = (float)this.field_73016_r - partialTicks; + if (f12 > 1.0F) { + f12 = 1.0F; + } +@@ -901,13 +963,17 @@ + + @OnlyIn(Dist.CLIENT) + public Vec3d func_72824_f(float p_72824_1_) { +- float f = this.func_72826_c(p_72824_1_); ++ return this.field_73011_w.getCloudColor(p_72824_1_); ++ } ++ @OnlyIn(Dist.CLIENT) ++ public Vec3d getCloudColorBody(float partialTicks) { ++ float f = this.func_72826_c(partialTicks); + 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); + float f2 = 1.0F; + float f3 = 1.0F; + float f4 = 1.0F; +- float f5 = this.func_72867_j(p_72824_1_); ++ float f5 = this.func_72867_j(partialTicks); + if (f5 > 0.0F) { + float f6 = (f2 * 0.3F + f3 * 0.59F + f4 * 0.11F) * 0.6F; + float f7 = 1.0F - f5 * 0.95F; +@@ -919,7 +985,7 @@ + f2 = f2 * (f1 * 0.9F + 0.1F); + f3 = f3 * (f1 * 0.9F + 0.1F); + f4 = f4 * (f1 * 0.85F + 0.15F); +- float f9 = this.func_72819_i(p_72824_1_); ++ float f9 = this.func_72819_i(partialTicks); + if (f9 > 0.0F) { + float f10 = (f2 * 0.3F + f3 * 0.59F + f4 * 0.11F) * 0.2F; + float f8 = 1.0F - f9 * 0.95F; +@@ -939,10 +1005,7 @@ + + @OnlyIn(Dist.CLIENT) + public float func_72880_h(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); +- return f1 * f1 * 0.5F; ++ return this.field_73011_w.getStarBrightness(p_72880_1_); + } + + public void func_72939_s() { +@@ -953,6 +1016,7 @@ + Entity entity = this.field_73007_j.get(i); + + try { ++ if (entity.canUpdate()) continue; + ++entity.field_70173_aa; + entity.func_70071_h_(); + } catch (Throwable throwable2) { +@@ -964,6 +1028,10 @@ + entity.func_85029_a(crashreportcategory); + } + ++ if (net.minecraftforge.common.ForgeConfig.GENERAL.removeErroringEntities()) { ++ LogManager.getLogger().fatal("{}", crashreport.func_71502_e()); ++ func_72900_e(entity); ++ } else + throw new ReportedException(crashreport); + } + +@@ -1006,11 +1074,17 @@ + this.field_72984_F.func_76320_a("tick"); + if (!entity2.field_70128_L && !(entity2 instanceof EntityPlayerMP)) { + 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.ForgeConfig.GENERAL.removeErroringEntities()) { ++ LogManager.getLogger().fatal("{}", crashreport1.func_71502_e()); ++ func_72900_e(entity2); ++ } else + throw new ReportedException(crashreport1); + } + } +@@ -1032,30 +1106,41 @@ + } + + 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); ++ field_147483_b.forEach(e -> e.onChunkUnloaded()); ++ // forge: faster "contains" makes this removal much more efficient ++ java.util.Set 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 iterator = this.field_175730_i.iterator(); + + while(iterator.hasNext()) { + TileEntity tileentity = iterator.next(); + if (!tileentity.func_145837_r() && tileentity.func_145830_o()) { + 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 { + this.field_72984_F.func_194340_a(() -> { + return String.valueOf((Object)TileEntityType.func_200969_a(tileentity.func_200662_C())); + }); ++ 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) { + 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.ForgeConfig.GENERAL.removeErroringTileEntities()) { ++ LogManager.getLogger().fatal("{}", crashreport2.func_71502_e()); ++ tileentity.func_145843_s(); ++ this.func_175713_t(tileentity.func_174877_v()); ++ } else + throw new ReportedException(crashreport2); + } + } +@@ -1065,7 +1150,10 @@ + iterator.remove(); + this.field_147482_g.remove(tileentity); + 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(), Chunk.EnumCreateEntityType.CHECK) == tileentity) ++ chunk.func_177425_e(tileentity.func_174877_v()); + } + } + } +@@ -1100,10 +1188,15 @@ + } + + 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) { + BlockPos blockpos = p_175700_1_.func_174877_v(); +@@ -1116,6 +1209,11 @@ + + public void func_147448_a(Collection p_147448_1_) { + 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 { + for(TileEntity tileentity : p_147448_1_) { +@@ -1134,7 +1232,11 @@ + 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; +- if (p_72866_2_ && !this.func_175663_a(i - 32, 0, j - 32, i + 32, 0, j + 32, true)) { ++ boolean isForced = getPersistentChunks().containsKey(new net.minecraft.util.math.ChunkPos(i >> 4, j >> 4)); ++ int range = isForced ? 0 : 32; ++ boolean canUpdate = !p_72866_2_ || this.func_175663_a(i - range, 0, j - range, i + range, 0, j + range, true); ++ if (!canUpdate) canUpdate = net.minecraftforge.event.ForgeEventFactory.canEntityUpdate(p_72866_1_); ++ if (!canUpdate) { + return; + } + } +@@ -1197,6 +1299,7 @@ + if (p_72866_2_ && p_72866_1_.field_70175_ag) { + for(Entity entity : p_72866_1_.func_184188_bt()) { + if (!entity.field_70128_L && entity.func_184187_bx() == p_72866_1_) { ++ if (entity.canUpdate()) + this.func_72870_g(entity); + } else { + entity.func_184210_p(); +@@ -1236,7 +1339,7 @@ + for(int l1 = k; l1 < l; ++l1) { + for(int i2 = i1; i2 < j1; ++i2) { + IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(k1, l1, i2)); +- if (!iblockstate.func_196958_f()) { ++ if (!iblockstate.isAir(this, blockpos$pooledmutableblockpos)) { + boolean flag = true; + return flag; + } +@@ -1260,10 +1363,13 @@ + for(int k1 = i; k1 < j; ++k1) { + for(int l1 = k; l1 < l; ++l1) { + for(int i2 = i1; i2 < j1; ++i2) { +- Block block = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(k1, l1, i2)).func_177230_c(); ++ IBlockState state = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(k1, l1, i2)); ++ Block block = state.func_177230_c(); + if (block == Blocks.field_150480_ab || block == Blocks.field_150353_l) { + boolean flag = true; + return flag; ++ } else if (state.isBurning(this, blockpos$pooledmutableblockpos)) { ++ return true; + } + } + } +@@ -1343,6 +1449,7 @@ + if (p_211529_2_ != null) { + explosion.func_199592_a(p_211529_2_); + } ++ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; + + explosion.func_77278_a(); + explosion.func_77279_a(true); +@@ -1436,10 +1543,13 @@ + } + + 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 (!func_189509_E(p_175690_1_)) { + if (p_175690_2_ != null && !p_175690_2_.func_145837_r()) { + 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 iterator = this.field_147484_a.iterator(); + + while(iterator.hasNext()) { +@@ -1452,7 +1562,8 @@ + + this.field_147484_a.add(p_175690_2_); + } 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_); + } + } +@@ -1465,6 +1576,8 @@ + if (tileentity != null && this.field_147481_N) { + 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 { + if (tileentity != null) { + this.field_147484_a.remove(tileentity); +@@ -1474,6 +1587,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 + + } + +@@ -1495,7 +1609,7 @@ } public boolean func_195595_w(BlockPos p_195595_1_) { @@ -44,15 +600,263 @@ } public void func_72966_v() { -@@ -2397,4 +2400,35 @@ +@@ -1509,6 +1623,7 @@ + public void func_72891_a(boolean p_72891_1_, boolean p_72891_2_) { + 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() { +@@ -1516,6 +1631,10 @@ + } + + 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; + if (this.field_72986_A.func_76061_m()) { +@@ -1530,6 +1649,10 @@ + } + + 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) { + boolean flag = this.func_82736_K().func_82766_b("doWeatherCycle"); +@@ -1616,9 +1739,9 @@ + return 15; + } else { + IBlockState iblockstate = this.func_180495_p(p_175638_1_); +- int i = p_175638_2_ == EnumLightType.SKY ? 0 : iblockstate.func_185906_d(); ++ int i = p_175638_2_ == EnumLightType.SKY ? 0 : iblockstate.getLightValue(this, p_175638_1_); + int j = iblockstate.func_200016_a(this, p_175638_1_); +- if (j >= 15 && iblockstate.func_185906_d() > 0) { ++ if (false) { // Forge: fix MC-119932 + j = 1; + } + +@@ -1627,7 +1750,7 @@ + } + + if (j >= 15) { +- return 0; ++ return i; // Forge: fix MC-119932 + } else if (i >= 14) { + return i; + } else { +@@ -1652,11 +1775,12 @@ + } + + public boolean func_180500_c(EnumLightType 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 i = 0; + int j = 0; ++ int updateRange = this.func_175648_a(p_180500_2_, 18, false) ? 17 : 15; + this.field_72984_F.func_76320_a("getBrightness"); + int k = this.func_175642_b(p_180500_1_, p_180500_2_); + int l = this.func_175638_a(p_180500_2_, p_180500_1_); +@@ -1682,7 +1806,7 @@ + int j3 = MathHelper.func_76130_a(i2 - i1); + int k3 = MathHelper.func_76130_a(j2 - j1); + int l3 = MathHelper.func_76130_a(k2 - k1); +- if (j3 + k3 + l3 < 17) { ++ if (j3 + k3 + l3 < updateRange) { + try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.func_185346_s()) { + for(EnumFacing enumfacing : field_200007_a) { + int i4 = i2 + enumfacing.func_82601_c(); +@@ -1722,7 +1846,7 @@ + int l6 = Math.abs(k5 - j1); + int i7 = Math.abs(l5 - k1); + boolean flag = j < this.field_72994_J.length - 6; +- if (k6 + l6 + i7 < 17 && flag) { ++ if (k6 + l6 + i7 < updateRange && flag) { + if (this.func_175642_b(p_180500_1_, blockpos1.func_177976_e()) < j6) { + this.field_72994_J[j++] = j5 - 1 - i1 + 32 + (k5 - j1 + 32 << 6) + (l5 - k1 + 32 << 12); + } +@@ -1762,10 +1886,10 @@ + + public List func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate p_175674_3_) { + List list = Lists.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) { + for(int j1 = k; j1 <= l; ++j1) { +@@ -1807,10 +1931,10 @@ + } + + public List func_175647_a(Class p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate 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 list = Lists.newArrayList(); + + for(int i1 = i; i1 < j; ++i1) { +@@ -1874,10 +1998,12 @@ + } + + public void func_175650_b(Collection p_175650_1_) { +- this.field_72996_f.addAll(p_175650_1_); + + for(Entity entity : p_175650_1_) { ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity, this))) { ++ this.field_72996_f.add(entity); + this.func_72923_a(entity); ++ } + } + + } +@@ -1943,7 +2069,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.shouldCheckWeakPower(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_) { +@@ -2049,6 +2175,8 @@ + d2 *= MoreObjects.firstNonNull(p_184150_11_.apply(entityplayer1), 1.0D); + } + ++ 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; + entityplayer = entityplayer1; +@@ -2097,7 +2225,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() { +@@ -2105,15 +2233,15 @@ + } + + 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)) { + blockpos = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, new BlockPos(this.func_175723_af().func_177731_f(), 0.0D, this.func_175723_af().func_177721_g())); + } +@@ -2122,7 +2250,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_); + } + + @OnlyIn(Dist.CLIENT) +@@ -2138,12 +2266,17 @@ + } + + 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 player, BlockPos pos) { + return true; + } + +@@ -2218,8 +2351,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.isHighHumidity(p_180502_1_); + } + + @Nullable +@@ -2269,16 +2401,15 @@ + } + + 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(); + } + +- @OnlyIn(Dist.CLIENT) + public double func_72919_O() { +- return this.field_72986_A.func_76067_t() == WorldType.field_77138_c ? 0.0D : 63.0D; ++ return this.field_73011_w.getHorizon(); + } + + public CrashReportCategory func_72914_a(CrashReport p_72914_1_) { +@@ -2315,16 +2446,16 @@ + public abstract Scoreboard func_96441_U(); + + public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) { +- for(EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) { ++ for(EnumFacing enumfacing : EnumFacing.values()) { //Forge: TODO: change to VALUES once ATed + BlockPos blockpos = p_175666_1_.func_177972_a(enumfacing); + if (this.func_175667_e(blockpos)) { + IBlockState iblockstate = this.func_180495_p(blockpos); +- if (iblockstate.func_177230_c() == Blocks.field_196762_fd) { +- iblockstate.func_189546_a(this, blockpos, p_175666_2_, p_175666_1_); +- } else if (iblockstate.func_185915_l()) { ++ iblockstate.onNeighborChange(this, blockpos, p_175666_1_); ++ ++ if (iblockstate.isNormalCube(this, blockpos)) { + blockpos = blockpos.func_177972_a(enumfacing); + iblockstate = this.func_180495_p(blockpos); +- if (iblockstate.func_177230_c() == Blocks.field_196762_fd) { ++ if (iblockstate.getWeakChanges(this, blockpos)) { + iblockstate.func_189546_a(this, blockpos, p_175666_2_, p_175666_1_); + } + } +@@ -2397,4 +2528,30 @@ public abstract RecipeManager func_199532_z(); public abstract NetworkTagManager func_205772_D(); + -+ /* ======================================== FORGE START =====================================*/ -+ -+ private net.minecraftforge.common.util.WorldCapabilityData capabilityData; -+ + protected void initCapabilities() { + net.minecraftforge.common.capabilities.ICapabilityProvider parent = field_73011_w.initCapabilities(); + this.gatherCapabilities(parent); @@ -66,7 +870,6 @@ + } + } + -+ protected WorldSavedDataStorage perWorldStorage; //Moved to a getter to simulate final without being final so we can load in subclasses. + public WorldSavedDataStorage getPerWorldStorage() { + return perWorldStorage; + } diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch index 61d63e31b..b5c388ead 100644 --- a/patches/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServer.java.patch @@ -9,15 +9,14 @@ private static final Logger field_147491_a = LogManager.getLogger(); private final MinecraftServer field_73061_a; private final EntityTracker field_73062_L; -@@ -105,27 +105,36 @@ - protected final VillageSiege field_175740_d = new VillageSiege(this); +@@ -106,26 +106,35 @@ ObjectLinkedOpenHashSet field_147490_S = new ObjectLinkedOpenHashSet(); private boolean field_211159_Q; -+ + + /** Stores the recently processed (lighting) chunks */ + protected java.util.Set doneChunks = new java.util.HashSet(); + public List customTeleporters = new java.util.ArrayList(); - ++ public WorldServer(MinecraftServer p_i45921_1_, ISaveHandler p_i45921_2_, WorldInfo p_i45921_3_, int p_i45921_4_, Profiler p_i45921_5_) { - super(p_i45921_2_, p_i45921_3_, DimensionType.func_186069_a(p_i45921_4_).func_186070_d(), p_i45921_5_, false); + super(p_i45921_2_, p_i45921_3_,net.minecraftforge.common.DimensionManager.createProviderFor(p_i45921_4_), p_i45921_5_, false); @@ -73,7 +72,7 @@ this.field_72986_A.func_82572_b(this.field_72986_A.func_82573_f() + 1L); if (this.func_82736_K().func_82766_b("doDaylightCycle")) { - this.field_72986_A.func_76068_b(this.field_72986_A.func_76073_f() + 1L); -+ this.field_72986_A.func_76068_b(this.func_72820_D() + 1L); ++ this.func_72877_b(this.func_72820_D() + 1L); } this.field_72984_F.func_76318_c("tickPending"); @@ -114,6 +113,15 @@ } public boolean func_73056_e() { +@@ -336,7 +349,7 @@ + boolean flag1 = this.func_72911_I(); + this.field_72984_F.func_76320_a("pollingChunks"); + +- for(Iterator iterator = this.field_73063_M.func_187300_b(); iterator.hasNext(); this.field_72984_F.func_76319_b()) { ++ for(Iterator iterator = getPersistentChunkIterable(this.field_73063_M.func_187300_b()); iterator.hasNext(); this.field_72984_F.func_76319_b()) { + this.field_72984_F.func_76320_a("getChunk"); + Chunk chunk = iterator.next(); + int j = chunk.field_76635_g * 16; @@ -346,7 +359,7 @@ this.field_72984_F.func_76318_c("tickChunk"); chunk.func_150804_b(false); @@ -138,15 +146,29 @@ if (biome.func_201848_a(this, blockpos2)) { this.func_175656_a(blockpos2, Blocks.field_150432_aD.func_176223_P()); } -@@ -545,6 +559,11 @@ +@@ -435,7 +449,7 @@ + } + + public void func_72939_s() { +- if (this.field_73010_i.isEmpty()) { ++ if (this.field_73010_i.isEmpty() && getPersistentChunks().isEmpty()) { + if (this.field_80004_Q++ >= 300) { + return; + } +@@ -541,10 +555,15 @@ + + protected IChunkProvider func_72970_h() { + IChunkLoader ichunkloader = this.field_73019_z.func_75763_a(this.field_73011_w); +- return new ChunkProviderServer(this, ichunkloader, this.field_73011_w.func_186060_c(), this.field_73061_a); ++ return new ChunkProviderServer(this, ichunkloader, this.func_175624_G().createChunkGenerator(this), this.field_73061_a); } public boolean func_175660_a(EntityPlayer p_175660_1_, BlockPos p_175660_2_) { + return super.func_175660_a(p_175660_1_, p_175660_2_); + } -+ -+ public boolean canMineBlockBody(EntityPlayer p_175660_1_, BlockPos p_175660_2_) -+ { ++ ++ @Override ++ public boolean canMineBlockBody(EntityPlayer p_175660_1_, BlockPos p_175660_2_) { return !this.field_73061_a.func_175579_a(this, p_175660_2_, p_175660_1_) && this.func_175723_af().func_177746_a(p_175660_2_); } @@ -154,7 +176,7 @@ } else if (this.field_72986_A.func_76067_t() == WorldType.field_180272_g) { this.field_72986_A.func_176143_a(BlockPos.field_177992_a.func_177984_a()); } else { -+ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; ++ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; BiomeProvider biomeprovider = this.field_73020_y.func_201711_g().func_202090_b(); List list = biomeprovider.func_76932_a(); Random random = new Random(this.func_72905_C()); @@ -242,16 +264,22 @@ } } -@@ -957,4 +984,12 @@ +@@ -957,4 +984,18 @@ public NetworkTagManager func_205772_D() { return this.field_73061_a.func_199731_aO(); } + + private long[] tickTime = new long[100]; ++ + public void setTickTime(int tick, long time) { + this.tickTime[tick % 100] = time; + } ++ + public long[] getTickTimes() { + return this.tickTime; ++ } ++ ++ public java.io.File getChunkSaveLocation() { ++ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)func_72863_F().field_73247_e).field_75825_d; + } } diff --git a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch index 5491ac0bd..0621184c5 100644 --- a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch @@ -1,6 +1,43 @@ --- a/net/minecraft/world/WorldServerMulti.java +++ b/net/minecraft/world/WorldServerMulti.java -@@ -60,6 +60,7 @@ +@@ -10,11 +10,12 @@ + + public class WorldServerMulti extends WorldServer { + private final WorldServer field_175743_a; ++ private IBorderListener borderListener; + + public WorldServerMulti(MinecraftServer p_i45923_1_, ISaveHandler p_i45923_2_, int p_i45923_3_, WorldServer p_i45923_4_, Profiler p_i45923_5_) { + super(p_i45923_1_, p_i45923_2_, new DerivedWorldInfo(p_i45923_4_.func_72912_H()), p_i45923_3_, p_i45923_5_); + this.field_175743_a = p_i45923_4_; +- p_i45923_4_.func_175723_af().func_177737_a(new IBorderListener() { ++ this.borderListener = new IBorderListener() { + public void func_177694_a(WorldBorder p_177694_1_, double p_177694_2_) { + WorldServerMulti.this.func_175723_af().func_177750_a(p_177694_2_); + } +@@ -42,28 +43,37 @@ + public void func_177695_c(WorldBorder p_177695_1_, double p_177695_2_) { + WorldServerMulti.this.func_175723_af().func_177724_b(p_177695_2_); + } +- }); ++ }; ++ p_i45923_4_.func_175723_af().func_177737_a(this.borderListener); + } + + protected void func_73042_a() { ++ this.perWorldStorage.func_75744_a(); + } + + public IWorld func_175643_b() { + this.field_72988_C = this.field_175743_a.func_175693_T(); + String s = VillageCollection.func_176062_a(this.field_73011_w); +- VillageCollection villagecollection = (VillageCollection)this.field_72988_C.func_201067_a(VillageCollection::new, s); ++ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.func_201067_a(VillageCollection::new, s); + if (villagecollection == null) { + this.field_72982_D = new VillageCollection(this); +- this.field_72988_C.func_75745_a(s, this.field_72982_D); ++ this.perWorldStorage.func_75745_a(s, this.field_72982_D); + } else { + this.field_72982_D = villagecollection; this.field_72982_D.func_82566_a(this); } @@ -8,3 +45,13 @@ return this; } + public void func_184166_c() { + this.field_73011_w.func_186057_q(); + } ++ ++ @Override ++ public void close() { ++ super.close(); ++ this.field_175743_a.func_175723_af().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak. ++ } + } diff --git a/patches/minecraft/net/minecraft/world/WorldType.java.patch b/patches/minecraft/net/minecraft/world/WorldType.java.patch index 083c4b013..1279f314a 100644 --- a/patches/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldType.java.patch @@ -1,6 +1,17 @@ --- a/net/minecraft/world/WorldType.java +++ b/net/minecraft/world/WorldType.java -@@ -31,6 +31,7 @@ +@@ -22,6 +22,10 @@ + private boolean field_151361_l; + private boolean field_205395_p; + ++ public WorldType(String name) { ++ this(getNextID(), name); ++ } ++ + private WorldType(int p_i1959_1_, String p_i1959_2_) { + this(p_i1959_1_, p_i1959_2_, p_i1959_2_, 0); + } +@@ -31,6 +35,7 @@ } private WorldType(int p_i49778_1_, String p_i49778_2_, String p_i49778_3_, int p_i49778_4_) { @@ -8,7 +19,25 @@ this.field_77133_f = p_i49778_2_; this.field_211890_l = p_i49778_3_; this.field_77134_g = p_i49778_4_; -@@ -117,4 +118,26 @@ +@@ -39,6 +44,17 @@ + field_77139_a[p_i49778_1_] = this; + } + ++ private static int getNextID() { ++ for (int x = 0; x < field_77139_a.length; x++) { ++ if (field_77139_a[x] == null) { ++ return x; ++ } ++ } ++ int old = field_77139_a.length; ++ field_77139_a = java.util.Arrays.copyOf(field_77139_a, old + 16); ++ return old; ++ } ++ + public String func_211888_a() { + return this.field_77133_f; + } +@@ -117,4 +133,45 @@ this.field_151361_l = true; return this; } @@ -34,4 +63,23 @@ + public boolean handleSlimeSpawnReduction(java.util.Random random, World world) { + return this == field_77138_c ? random.nextInt(4) != 1 : false; + } ++ ++ public double getHorizon(World world) { ++ return this == field_77138_c ? 0.0D : 63.0D; ++ } ++ ++ /** ++ * Get the height to render the clouds for this world type ++ * @return The height to render clouds at ++ */ ++ public float getCloudHeight() { ++ return 128.0F; ++ } ++ ++ @SuppressWarnings("deprecation") ++ public net.minecraft.world.gen.IChunkGenerator createChunkGenerator(World world) { ++ return world.field_73011_w.func_186060_c(); ++ } ++ ++ } diff --git a/patches/minecraft/net/minecraft/world/biome/Biome.java.patch b/patches/minecraft/net/minecraft/world/biome/Biome.java.patch index dd98781af..a1f9ca01b 100644 --- a/patches/minecraft/net/minecraft/world/biome/Biome.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/Biome.java.patch @@ -9,3 +9,62 @@ public static final Logger field_150586_aC = LogManager.getLogger(); public static final WorldCarver field_201907_b = new CaveWorldCarver(); public static final WorldCarver field_201908_c = new NetherCaveWorldCarver(); +@@ -233,7 +233,7 @@ + public static final ObjectIntIdentityMap field_185373_j = new ObjectIntIdentityMap(); + protected static final NoiseGeneratorPerlin field_150605_ac = new NoiseGeneratorPerlin(new Random(1234L), 1); + public static final NoiseGeneratorPerlin field_180281_af = new NoiseGeneratorPerlin(new Random(2345L), 1); +- public static final RegistryNamespaced field_185377_q = new RegistryNamespaced(); ++ public static final RegistryNamespaced field_185377_q = net.minecraftforge.registries.GameData.getWrapper(Biome.class); + @Nullable + protected String field_205405_aL; + protected final float field_76748_D; +@@ -299,7 +299,6 @@ + for(EnumCreatureType enumcreaturetype : EnumCreatureType.values()) { + this.field_201880_ax.put(enumcreaturetype, Lists.newArrayList()); + } +- + } else { + throw new IllegalStateException("You are missing parameters to build a proper biome for " + this.getClass().getSimpleName() + "\n" + p_i48975_1_); + } +@@ -332,11 +331,11 @@ + } + + public void func_201866_a(EnumCreatureType p_201866_1_, Biome.SpawnListEntry p_201866_2_) { +- (this.field_201880_ax.get(p_201866_1_)).add(p_201866_2_); ++ (this.field_201880_ax.computeIfAbsent(p_201866_1_, k -> Lists.newArrayList())).add(p_201866_2_); + } + + public List func_76747_a(EnumCreatureType p_76747_1_) { +- return this.field_201880_ax.get(p_76747_1_); ++ return this.field_201880_ax.computeIfAbsent(p_76747_1_, k -> Lists.newArrayList()); + } + + public Biome.RainType func_201851_b() { +@@ -393,7 +392,7 @@ + } else { + if (p_201850_2_.func_177956_o() >= 0 && p_201850_2_.func_177956_o() < 256 && p_201850_1_.func_175642_b(EnumLightType.BLOCK, p_201850_2_) < 10) { + IBlockState iblockstate = p_201850_1_.func_180495_p(p_201850_2_); +- if (iblockstate.func_196958_f() && Blocks.field_150433_aE.func_176223_P().func_196955_c(p_201850_1_, p_201850_2_)) { ++ if (iblockstate.isAir(p_201850_1_, p_201850_2_) && Blocks.field_150433_aE.func_176223_P().func_196955_c(p_201850_1_, p_201850_2_)) { + return true; + } + } +@@ -752,6 +751,18 @@ + } + } + ++ public static class FlowerEntry extends WeightedRandom.Item { ++ private final IBlockState state; ++ public FlowerEntry(IBlockState state, int weight) { ++ super(weight); ++ this.state = state; ++ } ++ ++ public IBlockState getState() { ++ return state; ++ } ++ } ++ + public static enum TempCategory { + OCEAN, + COLD, diff --git a/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch new file mode 100644 index 000000000..4babd2fc3 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/world/border/WorldBorder.java ++++ b/net/minecraft/world/border/WorldBorder.java +@@ -174,6 +174,10 @@ + this.field_177758_a.add(p_177737_1_); + } + ++ public void removeListener(IBorderListener listener) { ++ this.field_177758_a.remove(listener); ++ } ++ + public void func_177725_a(int p_177725_1_) { + this.field_177762_h = p_177725_1_; + } diff --git a/patches/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch b/patches/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch new file mode 100644 index 000000000..7673e0605 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch @@ -0,0 +1,43 @@ +--- a/net/minecraft/world/chunk/BlockStateContainer.java ++++ b/net/minecraft/world/chunk/BlockStateContainer.java +@@ -63,8 +63,11 @@ + } + + private void func_186012_b(int p_186012_1_) { +- if (p_186012_1_ != this.field_186024_e) { +- this.field_186024_e = p_186012_1_; ++ setBits(p_186012_1_, false); ++ } ++ private void setBits(int bitsIn, boolean forceBits) { ++ if (bitsIn != this.field_186024_e) { ++ this.field_186024_e = bitsIn; + if (this.field_186024_e <= 4) { + this.field_186024_e = 4; + this.field_186022_c = new BlockStatePaletteLinear(this.field_205523_d, this.field_186024_e, this, this.field_205524_e); +@@ -73,6 +76,8 @@ + } else { + this.field_186022_c = this.field_205521_b; + this.field_186024_e = MathHelper.func_151241_e(this.field_205523_d.func_186804_a()); ++ if (forceBits) ++ this.field_186024_e = bitsIn; + } + + this.field_186022_c.func_186041_a(this.field_205526_g); +@@ -123,12 +128,16 @@ + this.func_210459_b(); + int i = p_186010_1_.readByte(); + if (this.field_186024_e != i) { +- this.func_186012_b(i); ++ this.setBits(i, true); //Forge, Force bit density to fix network issues, resize below if needed. + } + + this.field_186022_c.func_186038_a(p_186010_1_); + p_186010_1_.func_186873_b(this.field_186021_b.func_188143_a()); + this.func_210460_c(); ++ ++ int regSize = MathHelper.func_151241_e(this.field_205523_d.func_186804_a()); ++ if (this.field_186022_c == field_205521_b && this.field_186024_e != regSize) // Resize bits to fit registry. ++ this.onResize(regSize, field_205526_g); + } + + public void func_186009_b(PacketBuffer p_186009_1_) { diff --git a/patches/minecraft/net/minecraft/world/chunk/ChunkSection.java.patch b/patches/minecraft/net/minecraft/world/chunk/ChunkSection.java.patch new file mode 100644 index 000000000..873667a33 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/chunk/ChunkSection.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/chunk/ChunkSection.java ++++ b/net/minecraft/world/chunk/ChunkSection.java +@@ -35,6 +35,8 @@ + } + + public void func_177484_a(int p_177484_1_, int p_177484_2_, int p_177484_3_, IBlockState p_177484_4_) { ++ if (p_177484_4_ instanceof net.minecraftforge.common.property.IExtendedBlockState) ++ p_177484_4_ = ((net.minecraftforge.common.property.IExtendedBlockState)p_177484_4_).getClean(); + IBlockState iblockstate = this.func_177485_a(p_177484_1_, p_177484_2_, p_177484_3_); + IFluidState ifluidstate = this.func_206914_b(p_177484_1_, p_177484_2_, p_177484_3_); + IFluidState ifluidstate1 = p_177484_4_.func_204520_s(); diff --git a/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch new file mode 100644 index 000000000..cd3f49a61 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/world/chunk/IChunk.java ++++ b/net/minecraft/world/chunk/IChunk.java +@@ -116,4 +116,9 @@ + ITickList func_212247_j(); + + BitSet func_205749_a(GenerationStage.Carving p_205749_1_); ++ ++ @Nullable ++ default net.minecraft.world.IWorld getWorld() { ++ return null; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch index 21d2b1a03..a5e028eac 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch @@ -1,6 +1,44 @@ --- a/net/minecraft/world/chunk/storage/AnvilChunkLoader.java +++ b/net/minecraft/world/chunk/storage/AnvilChunkLoader.java -@@ -445,6 +445,16 @@ +@@ -214,6 +214,9 @@ + this.func_202156_a((ChunkPrimer)p_75816_2_, p_75816_1_, nbttagcompound1); + } + ++ net.minecraftforge.common.ForgeChunkManager.storeChunkNBT(p_75816_1_, p_75816_2_, nbttagcompound1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(p_75816_2_, nbttagcompound)); ++ + this.func_75824_a(chunkpos, nbttagcompound); + } catch (Exception exception) { + field_151505_a.error("Failed to save chunk", (Throwable)exception); +@@ -391,10 +394,14 @@ + for(int j = 0; j < p_75820_1_.func_177429_s().length; ++j) { + for(Entity entity : p_75820_1_.func_177429_s()[j]) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); ++ try { + if (entity.func_70039_c(nbttagcompound)) { + p_75820_1_.func_177409_g(true); + nbttaglist1.add((INBTBase)nbttagcompound); + } ++ } catch (Exception e) { ++ LogManager.getLogger().error("An Entity type {} has thrown an exception trying to write state. It will not persist. Report this to the mod author", entity.func_200600_R(), e); ++ } + } + } + +@@ -405,7 +412,11 @@ + TileEntity tileentity = p_75820_1_.func_175625_s(blockpos); + if (tileentity != null) { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); +- tileentity.func_189515_b(nbttagcompound1); ++ try { ++ tileentity.func_189515_b(nbttagcompound1); ++ } catch (Exception e) { ++ LogManager.getLogger().error("A TileEntity type {} has thrown an exception trying to write state. It will not persist, Report this to the mod author", tileentity.getClass().getName(), e); ++ } + nbttagcompound1.func_74757_a("keepPacked", false); + nbttaglist2.add((INBTBase)nbttagcompound1); + } else { +@@ -445,6 +456,16 @@ p_75820_3_.func_74782_a("Heightmaps", nbttagcompound2); p_75820_3_.func_74782_a("Structures", this.func_202160_a(p_75820_1_.field_76635_g, p_75820_1_.field_76647_h, p_75820_1_.func_201609_c(), p_75820_1_.func_201604_d())); @@ -17,7 +55,7 @@ } private Chunk func_75823_a(IWorld p_75823_1_, NBTTagCompound p_75823_2_) { -@@ -511,6 +521,10 @@ +@@ -511,12 +532,16 @@ chunk.func_177427_f(true); } @@ -28,7 +66,14 @@ return chunk; } -@@ -813,4 +827,8 @@ + private void func_199814_a(NBTTagCompound p_199814_1_, Chunk p_199814_2_) { + NBTTagList nbttaglist = p_199814_1_.func_150295_c("Entities", 10); +- World world = p_199814_2_.func_177412_p(); ++ World world = p_199814_2_.getWorld(); + + for(int i = 0; i < nbttaglist.size(); ++i) { + NBTTagCompound nbttagcompound = nbttaglist.func_150305_b(i); +@@ -813,4 +838,8 @@ return flag; } diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch new file mode 100644 index 000000000..de30ce33e --- /dev/null +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch @@ -0,0 +1,17 @@ +--- a/net/minecraft/world/chunk/storage/AnvilSaveHandler.java ++++ b/net/minecraft/world/chunk/storage/AnvilSaveHandler.java +@@ -19,12 +19,8 @@ + + public IChunkLoader func_75763_a(Dimension p_75763_1_) { + File file1 = this.func_75765_b(); +- if (p_75763_1_ instanceof NetherDimension) { +- File file3 = new File(file1, "DIM-1"); +- file3.mkdirs(); +- return new AnvilChunkLoader(file3, this.field_186341_a); +- } else if (p_75763_1_ instanceof EndDimension) { +- File file2 = new File(file1, "DIM1"); ++ if (p_75763_1_.getSaveFolder() != null) { ++ File file2 = new File(file1, p_75763_1_.getSaveFolder()); + file2.mkdirs(); + return new AnvilChunkLoader(file2, this.field_186341_a); + } else { diff --git a/patches/minecraft/net/minecraft/world/dimension/Dimension.java.patch b/patches/minecraft/net/minecraft/world/dimension/Dimension.java.patch index 0fb010ae9..44073d416 100644 --- a/patches/minecraft/net/minecraft/world/dimension/Dimension.java.patch +++ b/patches/minecraft/net/minecraft/world/dimension/Dimension.java.patch @@ -9,7 +9,24 @@ public static final float[] field_111203_a = new float[]{1.0F, 0.75F, 0.5F, 0.25F, 0.0F, 0.25F, 0.5F, 0.75F}; protected World field_76579_a; protected boolean field_76575_d; -@@ -141,4 +141,97 @@ +@@ -64,7 +64,7 @@ + + @OnlyIn(Dist.CLIENT) + public float func_76571_f() { +- return 128.0F; ++ return this.getWorld().func_72912_H().func_76067_t().getCloudHeight(); + } + + @OnlyIn(Dist.CLIENT) +@@ -120,6 +120,7 @@ + + protected abstract void func_76572_b(); + ++ @Deprecated //Forge: Use WorldType.createChunkGenerator + public abstract IChunkGenerator func_186060_c(); + + @Nullable +@@ -141,4 +142,101 @@ public abstract boolean func_76568_b(int p_76568_1_, int p_76568_2_); public abstract DimensionType func_186058_p(); @@ -103,6 +120,10 @@ + return !(this instanceof OverworldDimension); + } + ++ public World getWorld() { ++ return this.field_76579_a; ++ } ++ + public enum SleepResult { + ALLOW, DENY, BED_EXPLODES + } diff --git a/patches/minecraft/net/minecraft/world/dimension/EndDimension.java.patch b/patches/minecraft/net/minecraft/world/dimension/EndDimension.java.patch new file mode 100644 index 000000000..e9641b6ac --- /dev/null +++ b/patches/minecraft/net/minecraft/world/dimension/EndDimension.java.patch @@ -0,0 +1,39 @@ +--- a/net/minecraft/world/dimension/EndDimension.java ++++ b/net/minecraft/world/dimension/EndDimension.java +@@ -23,7 +23,7 @@ + private DragonFightManager field_186064_g; + + public void func_76572_b() { +- NBTTagCompound nbttagcompound = this.field_76579_a.func_72912_H().func_186347_a(DimensionType.THE_END); ++ NBTTagCompound nbttagcompound = this.field_76579_a.func_72912_H().getDimensionData(this.field_76579_a.field_73011_w.getId()); + this.field_186064_g = this.field_76579_a instanceof WorldServer ? new DragonFightManager((WorldServer)this.field_76579_a, nbttagcompound.func_74775_l("DragonFight")) : null; + this.field_191067_f = false; + } +@@ -109,7 +109,7 @@ + nbttagcompound.func_74782_a("DragonFight", this.field_186064_g.func_186088_a()); + } + +- this.field_76579_a.func_72912_H().func_186345_a(DimensionType.THE_END, nbttagcompound); ++ this.field_76579_a.func_72912_H().setDimensionData(this.field_76579_a.field_73011_w.getId(), nbttagcompound); + } + + public void func_186059_r() { +@@ -123,4 +123,18 @@ + public DragonFightManager func_186063_s() { + return this.field_186064_g; + } ++ ++ @Override ++ public void func_186061_a(net.minecraft.entity.player.EntityPlayerMP player) { ++ if (field_186064_g != null) { ++ field_186064_g.addPlayer(player); ++ } ++ } ++ ++ @Override ++ public void func_186062_b(net.minecraft.entity.player.EntityPlayerMP player) { ++ if (field_186064_g != null) { ++ field_186064_g.removePlayer(player); ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/world/dimension/OverworldDimension.java.patch b/patches/minecraft/net/minecraft/world/dimension/OverworldDimension.java.patch new file mode 100644 index 000000000..8540611af --- /dev/null +++ b/patches/minecraft/net/minecraft/world/dimension/OverworldDimension.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/dimension/OverworldDimension.java ++++ b/net/minecraft/world/dimension/OverworldDimension.java +@@ -51,7 +51,7 @@ + } + + public boolean func_186056_c(int p_186056_1_, int p_186056_2_) { +- return !this.field_76579_a.func_72916_c(p_186056_1_, p_186056_2_); ++ return !this.field_76579_a.func_72916_c(p_186056_1_, p_186056_2_) || !this.field_76579_a.field_73011_w.func_186058_p().shouldLoadSpawn(); + } + + protected void func_76572_b() { diff --git a/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch b/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch new file mode 100644 index 000000000..646eb076e --- /dev/null +++ b/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch @@ -0,0 +1,33 @@ +--- a/net/minecraft/world/end/DragonFightManager.java ++++ b/net/minecraft/world/end/DragonFightManager.java +@@ -80,6 +80,7 @@ + + this.field_186117_k = p_i46669_2_.func_74767_n("DragonKilled"); + this.field_186118_l = p_i46669_2_.func_74767_n("PreviouslyKilled"); ++ this.field_186120_n = !p_i46669_2_.func_74767_n("LegacyScanPerformed"); // Forge: fix MC-105080 + if (p_i46669_2_.func_74767_n("IsRespawning")) { + this.field_186122_p = DragonSpawnState.START; + } +@@ -114,6 +115,7 @@ + + nbttagcompound.func_74757_a("DragonKilled", this.field_186117_k); + nbttagcompound.func_74757_a("PreviouslyKilled", this.field_186118_l); ++ nbttagcompound.func_74757_a("LegacyScanPerformed", !this.field_186120_n); // Forge: fix MC-105080 + if (this.field_186121_o != null) { + nbttagcompound.func_74782_a("ExitPortalLocation", NBTUtil.func_186859_a(this.field_186121_o)); + } +@@ -502,6 +504,14 @@ + + } + ++ public void addPlayer(EntityPlayerMP player) { ++ this.field_186109_c.func_186760_a(player); ++ } ++ ++ public void removePlayer(EntityPlayerMP player) { ++ this.field_186109_c.func_186761_b(player); ++ } ++ + class LoadManager { + private DragonFightManager.LoadState field_210826_b; + diff --git a/patches/minecraft/net/minecraft/world/storage/DerivedWorldInfo.java.patch b/patches/minecraft/net/minecraft/world/storage/DerivedWorldInfo.java.patch new file mode 100644 index 000000000..de7dec1cf --- /dev/null +++ b/patches/minecraft/net/minecraft/world/storage/DerivedWorldInfo.java.patch @@ -0,0 +1,24 @@ +--- a/net/minecraft/world/storage/DerivedWorldInfo.java ++++ b/net/minecraft/world/storage/DerivedWorldInfo.java +@@ -179,11 +179,21 @@ + public void func_180783_e(boolean p_180783_1_) { + } + ++ @Deprecated //Use int dimension ID + public void func_186345_a(DimensionType p_186345_1_, NBTTagCompound p_186345_2_) { + this.field_76115_a.func_186345_a(p_186345_1_, p_186345_2_); + } + ++ public void setDimensionData(int dim, NBTTagCompound nbt) { ++ this.field_76115_a.setDimensionData(dim, nbt); ++ } ++ ++ @Deprecated //Use int dimension ID + public NBTTagCompound func_186347_a(DimensionType p_186347_1_) { + return this.field_76115_a.func_186347_a(p_186347_1_); + } ++ ++ public NBTTagCompound getDimensionData(int dim) { ++ return this.field_76115_a.getDimensionData(dim); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch index cbde0b32f..84beaaf3e 100644 --- a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -36,3 +36,14 @@ p_189551_1_.func_74768_a("xCenter", this.field_76201_a); p_189551_1_.func_74768_a("zCenter", this.field_76199_b); p_189551_1_.func_74774_a("scale", this.field_76197_d); +@@ -172,8 +172,8 @@ + if (f >= -63.0F && f1 >= -63.0F && f <= 63.0F && f1 <= 63.0F) { + p_191095_8_ = p_191095_8_ + (p_191095_8_ < 0.0D ? -8.0D : 8.0D); + b2 = (byte)((int)(p_191095_8_ * 16.0D / 360.0D)); +- if (this.field_76200_c < 0 && p_191095_2_ != null) { +- int l = (int)(p_191095_2_.func_72912_H().func_76073_f() / 10L); ++ if (p_191095_2_ != null && p_191095_2_.func_201672_e().field_73011_w.shouldMapSpin(p_191095_3_, p_191095_4_, p_191095_6_, p_191095_8_)) { ++ int l = (int)(p_191095_2_.func_201672_e().func_72820_D() / 10L); + b2 = (byte)(l * l * 34187121 + l * 121 >> 15 & 15); + } + } else { diff --git a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch new file mode 100644 index 000000000..e8f7bf824 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch @@ -0,0 +1,39 @@ +--- a/net/minecraft/world/storage/SaveHandler.java ++++ b/net/minecraft/world/storage/SaveHandler.java +@@ -150,6 +150,7 @@ + } + + file1.renameTo(file2); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_75753_1_, this.field_75771_c, p_75753_1_.func_110124_au().toString()); + } catch (Exception var5) { + field_151478_a.warn("Failed to save player data for {}", (Object)p_75753_1_.func_200200_C_().getString()); + } +@@ -173,6 +174,7 @@ + int i = nbttagcompound.func_150297_b("DataVersion", 3) ? nbttagcompound.func_74762_e("DataVersion") : -1; + p_75752_1_.func_70020_e(NBTUtil.func_210822_a(this.field_186341_a, DataFixTypes.PLAYER, nbttagcompound, i)); + } ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_75752_1_, field_75771_c, p_75752_1_.func_110124_au().toString()); + + return nbttagcompound; + } +@@ -210,4 +212,20 @@ + public DataFixer func_197718_i() { + return this.field_186341_a; + } ++ ++ public NBTTagCompound getPlayerNBT(net.minecraft.entity.player.EntityPlayerMP player) { ++ try { ++ File file1 = new File(this.field_75771_c, player.func_189512_bd() + ".dat"); ++ if (file1.exists() && file1.isFile()) { ++ NBTTagCompound nbt = CompressedStreamTools.func_74796_a(new FileInputStream(file1)); ++ if (nbt != null) { ++ nbt = NBTUtil.func_210822_a(this.field_186341_a, DataFixTypes.PLAYER, nbt, nbt.func_150297_b("DataVersion", 3) ? nbt.func_74762_e("DataVersion") : -1); ++ } ++ return nbt; ++ } ++ } catch (Exception exception) { ++ field_151478_a.warn("Failed to load player data for " + player.func_200200_C_()); ++ } ++ return null; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch new file mode 100644 index 000000000..ba547a2a7 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch @@ -0,0 +1,61 @@ +--- a/net/minecraft/world/storage/WorldInfo.java ++++ b/net/minecraft/world/storage/WorldInfo.java +@@ -76,7 +76,7 @@ + private int field_176155_J = 15; + private final Set field_197721_N = Sets.newHashSet(); + private final Set field_197722_O = Sets.newLinkedHashSet(); +- private final Map field_186348_N = Maps.newEnumMap(DimensionType.class); ++ private final Map field_186348_N = Maps.newHashMap(); + private NBTTagCompound field_201358_Q; + private final GameRules field_82577_x = new GameRules(); + +@@ -215,7 +215,7 @@ + NBTTagCompound nbttagcompound1 = p_i49564_1_.func_74775_l("DimensionData"); + + for(String s : nbttagcompound1.func_150296_c()) { +- this.field_186348_N.put(DimensionType.func_186069_a(Integer.parseInt(s)), nbttagcompound1.func_74775_l(s)); ++ this.field_186348_N.put(Integer.parseInt(s), nbttagcompound1.func_74775_l(s)); + } + } + +@@ -324,8 +324,9 @@ + p_76064_1_.func_74782_a("GameRules", this.field_82577_x.func_82770_a()); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + +- for(Entry entry : this.field_186348_N.entrySet()) { +- nbttagcompound1.func_74782_a(String.valueOf(((DimensionType)entry.getKey()).func_186068_a()), entry.getValue()); ++ for(Entry entry : this.field_186348_N.entrySet()) { ++ if (entry.getValue() == null || entry.getValue().isEmpty()) continue; ++ nbttagcompound1.func_74782_a(String.valueOf(entry.getKey()), entry.getValue()); + } + + p_76064_1_.func_74782_a("DimensionData", nbttagcompound1); +@@ -692,15 +693,26 @@ + }); + } + ++ @Deprecated //Use int dimension ID + public NBTTagCompound func_186347_a(DimensionType p_186347_1_) { +- NBTTagCompound nbttagcompound = this.field_186348_N.get(p_186347_1_); ++ return getDimensionData(p_186347_1_.func_186068_a()); ++ } ++ ++ public NBTTagCompound getDimensionData(int dim) { ++ NBTTagCompound nbttagcompound = this.field_186348_N.get(dim); + return nbttagcompound == null ? new NBTTagCompound() : nbttagcompound; + } + ++ @Deprecated //Use int dimension ID + public void func_186345_a(DimensionType p_186345_1_, NBTTagCompound p_186345_2_) { +- this.field_186348_N.put(p_186345_1_, p_186345_2_); ++ this.field_186348_N.put(p_186345_1_.func_186068_a(), p_186345_2_); + } + ++ //Dimension numerical ID version of setter, as two dimensions could have the same DimensionType. ID should be grabbed from the world NOT the Type ++ public void setDimensionData(int dim, NBTTagCompound nbt) { ++ this.field_186348_N.put(dim, nbt); ++ } ++ + @OnlyIn(Dist.CLIENT) + public int func_186344_K() { + return this.field_186350_c; diff --git a/patches/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch b/patches/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch new file mode 100644 index 000000000..05a74366f --- /dev/null +++ b/patches/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch @@ -0,0 +1,26 @@ +--- a/net/minecraft/world/storage/WorldSavedData.java ++++ b/net/minecraft/world/storage/WorldSavedData.java +@@ -2,7 +2,7 @@ + + import net.minecraft.nbt.NBTTagCompound; + +-public abstract class WorldSavedData { ++public abstract class WorldSavedData implements net.minecraftforge.common.util.INBTSerializable { + private final String field_76190_i; + private boolean field_76189_a; + +@@ -29,4 +29,14 @@ + public String func_195925_e() { + return this.field_76190_i; + } ++ ++ @Override ++ public void deserializeNBT(NBTTagCompound nbt) { ++ func_76184_a(nbt); ++ } ++ ++ @Override ++ public NBTTagCompound serializeNBT() { ++ return func_189551_b(new NBTTagCompound()); ++ } + } diff --git a/patches_old/minecraft/net/minecraft/entity/Entity.java.patch b/patches_old/minecraft/net/minecraft/entity/Entity.java.patch new file mode 100644 index 000000000..ab6086bf6 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/Entity.java.patch @@ -0,0 +1,463 @@ +--- ../src-base/minecraft/net/minecraft/entity/Entity.java ++++ ../src-work/minecraft/net/minecraft/entity/Entity.java +@@ -85,7 +85,7 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +-public abstract class Entity implements ICommandSender ++public abstract class Entity implements ICommandSender, net.minecraftforge.common.capabilities.ICapabilitySerializable + { + private static final Logger field_184243_a = LogManager.getLogger(); + private static final List field_190535_b = Collections.emptyList(); +@@ -200,7 +204,7 @@ + + if (p_i1582_1_ != null) + { +- this.field_71093_bK = p_i1582_1_.field_73011_w.func_186058_p().func_186068_a(); ++ this.field_71093_bK = p_i1582_1_.field_73011_w.getDimension(); + } + + this.field_70180_af = new EntityDataManager(this); +@@ -211,8 +215,16 @@ + this.field_70180_af.func_187214_a(field_184234_aB, Boolean.valueOf(false)); + this.field_70180_af.func_187214_a(field_189655_aD, Boolean.valueOf(false)); + this.func_70088_a(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); ++ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this); + } + ++ /** Forge: Used to store custom data for each entity. */ ++ private NBTTagCompound customEntityData; ++ public boolean captureDrops = false; ++ public java.util.ArrayList capturedDrops = new java.util.ArrayList(); ++ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities; ++ + public int func_145782_y() + { + return this.field_145783_c; +@@ -344,6 +356,7 @@ + this.field_70165_t = p_70107_1_; + this.field_70163_u = p_70107_3_; + this.field_70161_v = p_70107_5_; ++ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K) this.field_70170_p.func_72866_a(this, false); // Forge - Process chunk registration after moving. + float f = this.field_70130_N / 2.0F; + float f1 = this.field_70131_O; + this.func_174826_a(new AxisAlignedBB(p_70107_1_ - (double)f, p_70107_3_, p_70107_5_ - (double)f, p_70107_1_ + (double)f, p_70107_3_ + (double)f1, p_70107_5_ + (double)f)); +@@ -995,6 +1008,7 @@ + this.field_70165_t = (axisalignedbb.field_72340_a + axisalignedbb.field_72336_d) / 2.0D; + this.field_70163_u = axisalignedbb.field_72338_b; + this.field_70161_v = (axisalignedbb.field_72339_c + axisalignedbb.field_72334_f) / 2.0D; ++ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K) this.field_70170_p.func_72866_a(this, false); // Forge - Process chunk registration after moving. + } + + protected SoundEvent func_184184_Z() +@@ -1053,7 +1067,7 @@ + + protected void func_180429_a(BlockPos p_180429_1_, Block p_180429_2_) + { +- SoundType soundtype = p_180429_2_.func_185467_w(); ++ SoundType soundtype = p_180429_2_.getSoundType(field_70170_p.func_180495_p(p_180429_1_), field_70170_p, p_180429_1_, this); + + if (this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a()).func_177230_c() == Blocks.field_150431_aC) + { +@@ -1259,6 +1273,7 @@ + BlockPos blockpos = new BlockPos(i, j, k); + IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); + ++ if(!iblockstate.func_177230_c().addRunningEffects(iblockstate, field_70170_p, blockpos, this)) + if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE) + { + this.field_70170_p.func_175688_a(EnumParticleTypes.BLOCK_CRACK, this.field_70165_t + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, this.func_174813_aQ().field_72338_b + 0.1D, this.field_70161_v + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, -this.field_70159_w * 4.0D, 1.5D, -this.field_70179_y * 4.0D, Block.func_176210_f(iblockstate)); +@@ -1277,12 +1292,12 @@ + BlockPos blockpos = new BlockPos(this.field_70165_t, d0, this.field_70161_v); + IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); + ++ Boolean result = iblockstate.func_177230_c().isEntityInsideMaterial(this.field_70170_p, blockpos, iblockstate, this, d0, p_70055_1_, true); ++ if (result != null) return result; ++ + if (iblockstate.func_185904_a() == p_70055_1_) + { +- float f = BlockLiquid.func_149801_b(iblockstate.func_177230_c().func_176201_c(iblockstate)) - 0.11111111F; +- float f1 = (float)(blockpos.func_177956_o() + 1) - f; +- boolean flag = d0 < (double)f1; +- return !flag && this instanceof EntityPlayer ? false : flag; ++ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(p_70055_1_, this, blockpos); + } + else + { +@@ -1382,6 +1397,7 @@ + this.field_70126_B -= 360.0F; + } + ++ if (!this.field_70170_p.field_72995_K) this.field_70170_p.func_72964_e((int) Math.floor(this.field_70165_t) >> 4, (int) Math.floor(this.field_70161_v) >> 4); // Forge - ensure target chunk is loaded. + this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); + this.func_70101_b(p_70080_7_, p_70080_8_); + } +@@ -1707,6 +1723,7 @@ + { + p_189511_1_.func_74757_a("Glowing", this.field_184238_ar); + } ++ p_189511_1_.func_74757_a("UpdateBlocked", updateBlocked); + + if (!this.field_184236_aF.isEmpty()) + { +@@ -1720,6 +1737,9 @@ + p_189511_1_.func_74782_a("Tags", nbttaglist); + } + ++ if (customEntityData != null) p_189511_1_.func_74782_a("ForgeData", customEntityData); ++ if (this.capabilities != null) p_189511_1_.func_74782_a("ForgeCaps", this.capabilities.serializeNBT()); ++ + this.func_70014_b(p_189511_1_); + + if (this.func_184207_aI()) +@@ -1826,7 +1846,11 @@ + this.func_174810_b(p_70020_1_.func_74767_n("Silent")); + this.func_189654_d(p_70020_1_.func_74767_n("NoGravity")); + this.func_184195_f(p_70020_1_.func_74767_n("Glowing")); ++ updateBlocked = p_70020_1_.func_74767_n("UpdateBlocked"); + ++ if (p_70020_1_.func_74764_b("ForgeData")) customEntityData = p_70020_1_.func_74775_l("ForgeData"); ++ if (this.capabilities != null && p_70020_1_.func_74764_b("ForgeCaps")) this.capabilities.deserializeNBT(p_70020_1_.func_74775_l("ForgeCaps")); ++ + if (p_70020_1_.func_150297_b("Tags", 9)) + { + this.field_184236_aF.clear(); +@@ -1918,7 +1942,10 @@ + { + EntityItem entityitem = new EntityItem(this.field_70170_p, this.field_70165_t, this.field_70163_u + (double)p_70099_2_, this.field_70161_v, p_70099_1_); + entityitem.func_174869_p(); +- this.field_70170_p.func_72838_d(entityitem); ++ if (captureDrops) ++ this.capturedDrops.add(entityitem); ++ else ++ this.field_70170_p.func_72838_d(entityitem); + return entityitem; + } + } +@@ -1985,6 +2012,7 @@ + this.field_70159_w = 0.0D; + this.field_70181_x = 0.0D; + this.field_70179_y = 0.0D; ++ if(!updateBlocked) + this.func_70071_h_(); + + if (this.func_184218_aH()) +@@ -2032,6 +2060,7 @@ + } + } + ++ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_184205_1_, true)) return false; + if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) + { + if (this.func_184218_aH()) +@@ -2067,6 +2096,7 @@ + if (this.field_184239_as != null) + { + Entity entity = this.field_184239_as; ++ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entity, false)) return; + this.field_184239_as = null; + entity.func_184225_p(this); + } +@@ -2509,8 +2539,16 @@ + @Nullable + public Entity func_184204_a(int p_184204_1_) + { ++ if (this.field_70170_p.field_72995_K || this.field_70128_L) return null; ++ return changeDimension(p_184204_1_, this.func_184102_h().func_71218_a(p_184204_1_).func_85176_s()); ++ } ++ ++ @Nullable // Forge: Entities that require custom handling should override this method, not the other ++ public Entity changeDimension(int p_184204_1_, net.minecraftforge.common.util.ITeleporter teleporter) ++ { + if (!this.field_70170_p.field_72995_K && !this.field_70128_L) + { ++ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return null; + this.field_70170_p.field_72984_F.func_76320_a("changeDimension"); + MinecraftServer minecraftserver = this.func_184102_h(); + int i = this.field_71093_bK; +@@ -2518,7 +2556,7 @@ + WorldServer worldserver1 = minecraftserver.func_71218_a(p_184204_1_); + this.field_71093_bK = p_184204_1_; + +- if (i == 1 && p_184204_1_ == 1) ++ if (i == 1 && p_184204_1_ == 1 && teleporter.isVanilla()) + { + worldserver1 = minecraftserver.func_71218_a(0); + this.field_71093_bK = 0; +@@ -2529,22 +2567,23 @@ + this.field_70170_p.field_72984_F.func_76320_a("reposition"); + BlockPos blockpos; + +- if (p_184204_1_ == 1) ++ if (p_184204_1_ == 1 && teleporter.isVanilla()) + { + blockpos = worldserver1.func_180504_m(); + } + else + { +- double d0 = this.field_70165_t; +- double d1 = this.field_70161_v; ++ double moveFactor = worldserver.field_73011_w.getMovementFactor() / worldserver1.field_73011_w.getMovementFactor(); ++ double d0 = MathHelper.func_151237_a(this.field_70165_t * moveFactor, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D); ++ double d1 = MathHelper.func_151237_a(this.field_70161_v * moveFactor, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D); + double d2 = 8.0D; + +- if (p_184204_1_ == -1) ++ if (false && p_184204_1_ == -1) + { + d0 = MathHelper.func_151237_a(d0 / 8.0D, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D); + d1 = MathHelper.func_151237_a(d1 / 8.0D, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D); + } +- else if (p_184204_1_ == 0) ++ else if (false && p_184204_1_ == 0) + { + d0 = MathHelper.func_151237_a(d0 * 8.0D, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D); + d1 = MathHelper.func_151237_a(d1 * 8.0D, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D); +@@ -2554,8 +2593,7 @@ + d1 = (double)MathHelper.func_76125_a((int)d1, -29999872, 29999872); + float f = this.field_70177_z; + this.func_70012_b(d0, this.field_70163_u, d1, 90.0F, 0.0F); +- Teleporter teleporter = worldserver1.func_85176_s(); +- teleporter.func_180620_b(this, f); ++ teleporter.placeEntity(worldserver1, this, f); + blockpos = new BlockPos(this); + } + +@@ -2567,7 +2605,7 @@ + { + entity.func_180432_n(this); + +- if (i == 1 && p_184204_1_ == 1) ++ if (i == 1 && p_184204_1_ == 1 && teleporter.isVanilla()) + { + BlockPos blockpos1 = worldserver1.func_175672_r(worldserver1.func_175694_M()); + entity.func_174828_a(blockpos1, entity.field_70177_z, entity.field_70125_A); +@@ -2604,7 +2642,7 @@ + + public float func_180428_a(Explosion p_180428_1_, World p_180428_2_, BlockPos p_180428_3_, IBlockState p_180428_4_) + { +- return p_180428_4_.func_177230_c().func_149638_a(this); ++ return p_180428_4_.func_177230_c().getExplosionResistance(p_180428_2_, p_180428_3_, this, p_180428_1_); + } + + public boolean func_174816_a(Explosion p_174816_1_, World p_174816_2_, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_) +@@ -2901,6 +2939,218 @@ + EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_); + } + ++ /* ================================== Forge Start =====================================*/ ++ /** ++ * Internal use for keeping track of entities that are tracked by a world, to ++ * allow guarantees that entity position changes will force a chunk load, avoiding ++ * potential issues with entity desyncing and bad chunk data. ++ */ ++ private boolean isAddedToWorld; ++ ++ /** ++ * Gets whether this entity has been added to a world (for tracking). Specifically ++ * between the times when an entity is added to a world and the entity being removed ++ * from the world's tracked lists. See {@link World#onEntityAdded(Entity)} and ++ * {@link World#onEntityRemoved(Entity)}. ++ * ++ * @return True if this entity is being tracked by a world ++ */ ++ public final boolean isAddedToWorld() { return this.isAddedToWorld; } ++ ++ /** ++ * Called after the entity has been added to the world's ++ * ticking list. Can be overriden, but needs to call super ++ * to prevent MC-136995. ++ */ ++ public void onAddedToWorld() { ++ this.isAddedToWorld = true; ++ } ++ ++ /** ++ * Called after the entity has been removed to the world's ++ * ticking list. Can be overriden, but needs to call super ++ * to prevent MC-136995. ++ */ ++ public void onRemovedFromWorld() { ++ this.isAddedToWorld = false; ++ } ++ ++ /** ++ * Returns a NBTTagCompound that can be used to store custom data for this entity. ++ * It will be written, and read from disc, so it persists over world saves. ++ * @return A NBTTagCompound ++ */ ++ public NBTTagCompound getEntityData() ++ { ++ if (customEntityData == null) ++ { ++ customEntityData = new NBTTagCompound(); ++ } ++ return customEntityData; ++ } ++ ++ /** ++ * Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position. ++ * @return false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation. ++ */ ++ public boolean shouldRiderSit() ++ { ++ return true; ++ } ++ ++ /** ++ * Called when a user uses the creative pick block button on this entity. ++ * ++ * @param target The full target the player is looking at ++ * @return A ItemStack to add to the player's inventory, empty ItemStack if nothing should be added. ++ */ ++ public ItemStack getPickedResult(RayTraceResult target) ++ { ++ if (this instanceof net.minecraft.entity.item.EntityPainting) ++ { ++ return new ItemStack(net.minecraft.init.Items.field_151159_an); ++ } ++ else if (this instanceof EntityLeashKnot) ++ { ++ return new ItemStack(net.minecraft.init.Items.field_151058_ca); ++ } ++ else if (this instanceof net.minecraft.entity.item.EntityItemFrame) ++ { ++ ItemStack held = ((net.minecraft.entity.item.EntityItemFrame)this).func_82335_i(); ++ if (held.func_190926_b()) ++ { ++ return new ItemStack(net.minecraft.init.Items.field_151160_bD); ++ } ++ else ++ { ++ return held.func_77946_l(); ++ } ++ } ++ else if (this instanceof net.minecraft.entity.item.EntityMinecart) ++ { ++ return ((net.minecraft.entity.item.EntityMinecart)this).getCartItem(); ++ } ++ else if (this instanceof net.minecraft.entity.item.EntityBoat) ++ { ++ return new ItemStack(((EntityBoat)this).func_184455_j()); ++ } ++ else if (this instanceof net.minecraft.entity.item.EntityArmorStand) ++ { ++ return new ItemStack(net.minecraft.init.Items.field_179565_cj); ++ } ++ else if (this instanceof net.minecraft.entity.item.EntityEnderCrystal) ++ { ++ return new ItemStack(net.minecraft.init.Items.field_185158_cP); ++ } ++ else ++ { ++ ResourceLocation name = EntityList.func_191301_a(this); ++ if (name != null && EntityList.field_75627_a.containsKey(name)) ++ { ++ ItemStack stack = new ItemStack(net.minecraft.init.Items.field_151063_bx); ++ net.minecraft.item.ItemMonsterPlacer.func_185078_a(stack, name); ++ return stack; ++ } ++ } ++ return ItemStack.field_190927_a; ++ } ++ ++ public UUID getPersistentID() ++ { ++ return field_96093_i; ++ } ++ ++ /** ++ * Reset the entity ID to a new value. Not to be used from Mod code ++ */ ++ @Deprecated // TODO: remove (1.13?) ++ public final void resetEntityId() ++ { ++ this.field_145783_c = field_70152_a++; ++ } ++ ++ public boolean shouldRenderInPass(int pass) ++ { ++ return pass == 0; ++ } ++ ++ /** ++ * Returns true if the entity is of the @link{EnumCreatureType} provided ++ * @param type The EnumCreatureType type this entity is evaluating ++ * @param forSpawnCount If this is being invoked to check spawn count caps. ++ * @return If the creature is of the type provided ++ */ ++ public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) ++ { ++ if (forSpawnCount && (this instanceof EntityLiving) && ((EntityLiving)this).func_104002_bU()) return false; ++ return type.func_75598_a().isAssignableFrom(this.getClass()); ++ } ++ ++ /** ++ * If a rider of this entity can interact with this entity. Should return true on the ++ * ridden entity if so. ++ * ++ * @return if the entity can be interacted with from a rider ++ */ ++ public boolean canRiderInteract() ++ { ++ return false; ++ } ++ ++ /** ++ * If the rider should be dismounted from the entity when the entity goes under water ++ * ++ * @param rider The entity that is riding ++ * @return if the entity should be dismounted when under water ++ */ ++ public boolean shouldDismountInWater(Entity rider) ++ { ++ return this instanceof EntityLivingBase; ++ } ++ ++ @Override ++ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable net.minecraft.util.EnumFacing facing) ++ { ++ return capabilities != null && capabilities.hasCapability(capability, facing); ++ } ++ ++ @Override ++ @Nullable ++ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable net.minecraft.util.EnumFacing facing) ++ { ++ return capabilities == null ? null : capabilities.getCapability(capability, facing); ++ } ++ ++ public void deserializeNBT(NBTTagCompound nbt) ++ { ++ this.func_70020_e(nbt); ++ } ++ ++ public NBTTagCompound serializeNBT() ++ { ++ NBTTagCompound ret = new NBTTagCompound(); ++ ret.func_74778_a("id", this.func_70022_Q()); ++ return this.func_189511_e(ret); ++ } ++ ++ /** ++ * Checks if this {@link Entity} can trample a {@link Block}. ++ * ++ * @param world The world in which the block will be trampled ++ * @param block The block being tested ++ * @param pos The block pos ++ * @param fallDistance The fall distance ++ * @return {@code true} if this entity can trample, {@code false} otherwise ++ */ ++ public boolean canTrample(World world, Block block, BlockPos pos, float fallDistance) ++ { ++ return world.field_73012_v.nextFloat() < fallDistance - 0.5F ++ && this instanceof EntityLivingBase ++ && (this instanceof EntityPlayer || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(world, this)) ++ && this.field_70130_N * this.field_70130_N * this.field_70131_O > 0.512F; ++ } ++ /* ================================== Forge End =====================================*/ ++ + public void func_184178_b(EntityPlayerMP p_184178_1_) + { + } diff --git a/patches_old/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches_old/minecraft/net/minecraft/tileentity/TileEntity.java.patch index b93595c71..70d0e1ad1 100644 --- a/patches_old/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches_old/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -1,51 +1,8 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java -@@ -103,6 +108,8 @@ - catch (Throwable throwable1) - { - field_145852_a.error("Failed to create block entity {}", s, throwable1); -+ net.minecraftforge.fml.common.FMLLog.log.error("A TileEntity {}({}) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ s, oclass == null ? null : oclass.getName(), throwable1); - } - - if (tileentity != null) -@@ -115,6 +122,8 @@ - catch (Throwable throwable) - { - field_145852_a.error("Failed to load data for block entity {}", s, throwable); -+ net.minecraftforge.fml.common.FMLLog.log.error("A TileEntity {}({}) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ s, oclass.getName(), throwable); - tileentity = null; - } - } @@ -297,6 +305,204 @@ { } - -+ // -- BEGIN FORGE PATCHES -- -+ -+ /** -+ * Called when the chunk this TileEntity is on is Unloaded. -+ */ -+ public void onChunkUnload() -+ { -+ } -+ -+ private boolean isVanilla = getClass().getName().startsWith("net.minecraft."); -+ /** -+ * Called from Chunk.setBlockIDWithMetadata and Chunk.fillChunk, determines if this tile entity should be re-created when the ID, or Metadata changes. -+ * Use with caution as this will leave straggler TileEntities, or create conflicts with other TileEntities if not used properly. -+ * -+ * @param world Current world -+ * @param pos Tile's world position -+ * @param oldState The old ID of the block -+ * @param newState The new ID of the block (May be the same) -+ * @return true forcing the invalidation of the existing TE, false not to invalidate the existing TE -+ */ -+ public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) -+ { -+ return isVanilla ? (oldState.func_177230_c() != newSate.func_177230_c()) : oldState != newSate; -+ } + + public boolean shouldRenderInPass(int pass) + { @@ -117,28 +74,6 @@ + block instanceof net.minecraft.block.BlockSkull); + } + /** -+ * Determines if the player can overwrite the NBT data of this tile entity while they place it using a ItemStack. -+ * Added as a fix for MC-75630 - Exploit with signs and command blocks -+ * @return True to prevent NBT copy, false to allow. -+ */ -+ public boolean restrictNBTCopy() -+ { -+ return this instanceof TileEntityCommandBlock || -+ this instanceof TileEntityMobSpawner || -+ this instanceof TileEntitySign; -+ } -+ -+ -+ /** -+ * Called when this is first added to the world (by {@link World#addTileEntity(TileEntity)}). -+ * Override instead of adding {@code if (firstTick)} stuff in update. -+ */ -+ public void onLoad() -+ { -+ // NOOP -+ } -+ -+ /** + * If the TileEntitySpecialRenderer associated with this TileEntity can be batched in with another renderers, and won't access the GL state. + * If TileEntity returns true, then TESR should have the same functionality as (and probably extend) the FastTESR class. + */ diff --git a/patches_old/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches_old/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch deleted file mode 100644 index 8fbc3d27f..000000000 --- a/patches_old/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -@@ -130,17 +130,21 @@ - { - if (iblockstate.func_177230_c() != Blocks.field_150397_co) - { -- if (iblockstate.func_185891_c() >= 15 && iblockstate.func_177230_c() != Blocks.field_150357_h) -+ if (iblockstate.getLightOpacity(field_145850_b, blockpos$mutableblockpos) >= 15 && iblockstate.func_177230_c() != Blocks.field_150357_h) - { - this.field_146015_k = false; - this.field_174909_f.clear(); - break; - } -- -+ float[] customColor = iblockstate.func_177230_c().getBeaconColorMultiplier(iblockstate, this.field_145850_b, blockpos$mutableblockpos, func_174877_v()); -+ if (customColor != null) -+ afloat = customColor; -+ else { - tileentitybeacon$beamsegment.func_177262_a(); - continue; -+ } - } -- -+ else - afloat = ((EnumDyeColor)iblockstate.func_177229_b(BlockStainedGlassPane.field_176245_a)).func_193349_f(); - } - -@@ -181,7 +185,7 @@ - { - Block block = this.field_145850_b.func_180495_p(new BlockPos(j1, i2, k1)).func_177230_c(); - -- if (block != Blocks.field_150475_bE && block != Blocks.field_150340_R && block != Blocks.field_150484_ah && block != Blocks.field_150339_S) -+ if (!block.isBeaconBase(this.field_145850_b, new BlockPos(j1, i2, k1), func_174877_v())) - { - flag1 = false; - break; -@@ -395,7 +399,7 @@ - - public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) - { -- return p_94041_2_.func_77973_b() == Items.field_151166_bC || p_94041_2_.func_77973_b() == Items.field_151045_i || p_94041_2_.func_77973_b() == Items.field_151043_k || p_94041_2_.func_77973_b() == Items.field_151042_j; -+ return p_94041_2_.func_77973_b() != null && p_94041_2_.func_77973_b().isBeaconPayment(p_94041_2_); - } - - public String func_174875_k() diff --git a/patches_old/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch b/patches_old/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch deleted file mode 100644 index 78b80ff38..000000000 --- a/patches_old/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityChest.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityChest.java -@@ -116,6 +116,7 @@ - { - super.func_145836_u(); - this.field_145984_a = false; -+ doubleChestHandler = null; - } - - @SuppressWarnings("incomplete-switch") -@@ -167,6 +168,7 @@ - { - if (!this.field_145984_a) - { -+ if (this.field_145850_b == null || !this.field_145850_b.func_175697_a(this.field_174879_c, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbors - this.field_145984_a = true; - this.field_145991_k = this.func_174911_a(EnumFacing.WEST); - this.field_145990_j = this.func_174911_a(EnumFacing.EAST); -@@ -349,6 +351,29 @@ - } - } - -+ public net.minecraftforge.items.VanillaDoubleChestItemHandler doubleChestHandler; -+ -+ @SuppressWarnings("unchecked") -+ @Override -+ @Nullable -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable net.minecraft.util.EnumFacing facing) -+ { -+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) -+ { -+ if(doubleChestHandler == null || doubleChestHandler.needsRefresh()) -+ doubleChestHandler = net.minecraftforge.items.VanillaDoubleChestItemHandler.get(this); -+ if (doubleChestHandler != null && doubleChestHandler != net.minecraftforge.items.VanillaDoubleChestItemHandler.NO_ADJACENT_CHESTS_INSTANCE) -+ return (T) doubleChestHandler; -+ } -+ return super.getCapability(capability, facing); -+ } -+ -+ public net.minecraftforge.items.IItemHandler getSingleChestHandler() -+ { -+ return super.getCapability(net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); -+ } -+ -+ - public void func_145843_s() - { - super.func_145843_s(); diff --git a/patches_old/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches_old/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch deleted file mode 100644 index a758f873e..000000000 --- a/patches_old/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java -@@ -191,6 +191,7 @@ - - private boolean func_145883_k() - { -+ if (net.minecraftforge.items.VanillaInventoryCodeHooks.insertHook(this)) { return true; } - IInventory iinventory = this.func_145895_l(); - - if (iinventory == null) -@@ -297,6 +298,8 @@ - - public static boolean func_145891_a(IHopper p_145891_0_) - { -+ Boolean ret = net.minecraftforge.items.VanillaInventoryCodeHooks.extractHook(p_145891_0_); -+ if (ret != null) return ret; - IInventory iinventory = func_145884_b(p_145891_0_); - - if (iinventory != null) -@@ -396,6 +399,12 @@ - } - } - -+ -+ protected net.minecraftforge.items.IItemHandler createUnSidedHandler() -+ { -+ return new net.minecraftforge.items.VanillaHopperItemHandler(this); -+ } -+ - public static ItemStack func_174918_a(IInventory p_174918_0_, IInventory p_174918_1_, ItemStack p_174918_2_, @Nullable EnumFacing p_174918_3_) - { - if (p_174918_1_ instanceof ISidedInventory && p_174918_3_ != null) -@@ -516,9 +525,10 @@ - int j = MathHelper.func_76128_c(p_145893_3_); - int k = MathHelper.func_76128_c(p_145893_5_); - BlockPos blockpos = new BlockPos(i, j, k); -- Block block = p_145893_0_.func_180495_p(blockpos).func_177230_c(); -+ net.minecraft.block.state.IBlockState state = p_145893_0_.func_180495_p(blockpos); -+ Block block = state.func_177230_c(); - -- if (block.func_149716_u()) -+ if (block.hasTileEntity(state)) - { - TileEntity tileentity = p_145893_0_.func_175625_s(blockpos); - -@@ -611,4 +621,6 @@ - { - return this.field_145900_a; - } -+ -+ public long getLastUpdateTime() { return field_190578_g; } // Forge - } diff --git a/patches_old/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch b/patches_old/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch deleted file mode 100644 index 69eac2db7..000000000 --- a/patches_old/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityLockable.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityLockable.java -@@ -48,4 +48,27 @@ - { - return (ITextComponent)(this.func_145818_k_() ? new TextComponentString(this.func_70005_c_()) : new TextComponentTranslation(this.func_70005_c_(), new Object[0])); - } -+ -+ private net.minecraftforge.items.IItemHandler itemHandler; -+ -+ protected net.minecraftforge.items.IItemHandler createUnSidedHandler() -+ { -+ return new net.minecraftforge.items.wrapper.InvWrapper(this); -+ } -+ -+ @SuppressWarnings("unchecked") -+ @Override -+ @javax.annotation.Nullable -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, @javax.annotation.Nullable net.minecraft.util.EnumFacing facing) -+ { -+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) -+ return (T) (itemHandler == null ? (itemHandler = createUnSidedHandler()) : itemHandler); -+ return super.getCapability(capability, facing); -+ } -+ -+ @Override -+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, @javax.annotation.Nullable net.minecraft.util.EnumFacing facing) -+ { -+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); -+ } - } diff --git a/patches_old/minecraft/net/minecraft/tileentity/TileEntityLockableLoot.java.patch b/patches_old/minecraft/net/minecraft/tileentity/TileEntityLockableLoot.java.patch deleted file mode 100644 index 3ec94d9c6..000000000 --- a/patches_old/minecraft/net/minecraft/tileentity/TileEntityLockableLoot.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityLockableLoot.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityLockableLoot.java -@@ -73,7 +73,7 @@ - - if (p_184281_1_ != null) - { -- lootcontext$builder.func_186469_a(p_184281_1_.func_184817_da()); -+ lootcontext$builder.func_186469_a(p_184281_1_.func_184817_da()).func_186470_a(p_184281_1_); // Forge: add player to LootContext - } - - loottable.func_186460_a(this, random, lootcontext$builder.func_186471_a()); diff --git a/patches_old/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch b/patches_old/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch deleted file mode 100644 index e8d6a2688..000000000 --- a/patches_old/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityNote.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityNote.java -@@ -32,7 +32,9 @@ - - public void func_145877_a() - { -+ byte old = field_145879_a; - this.field_145879_a = (byte)((this.field_145879_a + 1) % 25); -+ if (!net.minecraftforge.common.ForgeHooks.onNoteChange(this, old)) return; - this.func_70296_d(); - } - diff --git a/patches_old/minecraft/net/minecraft/tileentity/TileEntityShulkerBox.java.patch b/patches_old/minecraft/net/minecraft/tileentity/TileEntityShulkerBox.java.patch deleted file mode 100644 index 10b195fa2..000000000 --- a/patches_old/minecraft/net/minecraft/tileentity/TileEntityShulkerBox.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityShulkerBox.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityShulkerBox.java -@@ -422,4 +422,9 @@ - OPENED, - CLOSING; - } -+ -+ protected net.minecraftforge.items.IItemHandler createUnSidedHandler() -+ { -+ return new net.minecraftforge.items.wrapper.SidedInvWrapper(this, EnumFacing.UP); -+ } - } diff --git a/patches_old/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch b/patches_old/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch deleted file mode 100644 index f0b24d2e3..000000000 --- a/patches_old/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntitySign.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntitySign.java -@@ -59,7 +59,7 @@ - } - public boolean func_70003_b(int p_70003_1_, String p_70003_2_) - { -- return true; -+ return p_70003_1_ <= 2; //Forge: Fixes MC-75630 - Exploit with signs and command blocks - } - public BlockPos func_180425_c() - { diff --git a/patches_old/minecraft/net/minecraft/world/BossInfo.java.patch b/patches_old/minecraft/net/minecraft/world/BossInfo.java.patch deleted file mode 100644 index 447890e81..000000000 --- a/patches_old/minecraft/net/minecraft/world/BossInfo.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/BossInfo.java -+++ ../src-work/minecraft/net/minecraft/world/BossInfo.java -@@ -2,8 +2,6 @@ - - import java.util.UUID; - import net.minecraft.util.text.ITextComponent; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - - public abstract class BossInfo - { -@@ -55,7 +53,6 @@ - return this.field_186751_c; - } - -- @SideOnly(Side.CLIENT) - public void func_186745_a(BossInfo.Color p_186745_1_) - { - this.field_186751_c = p_186745_1_; -@@ -66,7 +63,6 @@ - return this.field_186752_d; - } - -- @SideOnly(Side.CLIENT) - public void func_186746_a(BossInfo.Overlay p_186746_1_) - { - this.field_186752_d = p_186746_1_; diff --git a/patches_old/minecraft/net/minecraft/world/BossInfoServer.java.patch b/patches_old/minecraft/net/minecraft/world/BossInfoServer.java.patch deleted file mode 100644 index d9e3ba034..000000000 --- a/patches_old/minecraft/net/minecraft/world/BossInfoServer.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/BossInfoServer.java -+++ ../src-work/minecraft/net/minecraft/world/BossInfoServer.java -@@ -9,8 +9,6 @@ - import net.minecraft.network.play.server.SPacketUpdateBossInfo; - import net.minecraft.util.math.MathHelper; - import net.minecraft.util.text.ITextComponent; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - - public class BossInfoServer extends BossInfo - { -@@ -34,7 +32,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - public void func_186745_a(BossInfo.Color p_186745_1_) - { - if (p_186745_1_ != this.field_186751_c) -@@ -44,7 +41,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - public void func_186746_a(BossInfo.Overlay p_186746_1_) - { - if (p_186746_1_ != this.field_186752_d) diff --git a/patches_old/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches_old/minecraft/net/minecraft/world/ChunkCache.java.patch deleted file mode 100644 index fce0bcdfa..000000000 --- a/patches_old/minecraft/net/minecraft/world/ChunkCache.java.patch +++ /dev/null @@ -1,75 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/ChunkCache.java -+++ ../src-work/minecraft/net/minecraft/world/ChunkCache.java -@@ -61,7 +61,7 @@ - @Nullable - public TileEntity func_175625_s(BlockPos p_175625_1_) - { -- return this.func_190300_a(p_175625_1_, Chunk.EnumCreateEntityType.IMMEDIATE); -+ return this.func_190300_a(p_175625_1_, Chunk.EnumCreateEntityType.CHECK); // Forge: don't modify world from other threads - } - - @Nullable -@@ -69,6 +69,7 @@ - { - int i = (p_190300_1_.func_177958_n() >> 4) - this.field_72818_a; - int j = (p_190300_1_.func_177952_p() >> 4) - this.field_72816_b; -+ if (!withinBounds(i, j)) return null; - return this.field_72817_c[i][j].func_177424_a(p_190300_1_, p_190300_2_); - } - -@@ -112,6 +113,7 @@ - { - int i = (p_180494_1_.func_177958_n() >> 4) - this.field_72818_a; - int j = (p_180494_1_.func_177952_p() >> 4) - this.field_72816_b; -+ if (!withinBounds(i, j)) return net.minecraft.init.Biomes.field_76772_c; - return this.field_72817_c[i][j].func_177411_a(p_180494_1_, this.field_72815_e.func_72959_q()); - } - -@@ -149,6 +151,7 @@ - { - int i = (p_175629_2_.func_177958_n() >> 4) - this.field_72818_a; - int j = (p_175629_2_.func_177952_p() >> 4) - this.field_72816_b; -+ if (!withinBounds(i, j)) return p_175629_1_.field_77198_c; - return this.field_72817_c[i][j].func_177413_a(p_175629_1_, p_175629_2_); - } - } -@@ -160,7 +163,8 @@ - - public boolean func_175623_d(BlockPos p_175623_1_) - { -- return this.func_180495_p(p_175623_1_).func_185904_a() == Material.field_151579_a; -+ IBlockState state = this.func_180495_p(p_175623_1_); -+ return state.func_177230_c().isAir(state, this, p_175623_1_); - } - - @SideOnly(Side.CLIENT) -@@ -170,6 +174,7 @@ - { - int i = (p_175628_2_.func_177958_n() >> 4) - this.field_72818_a; - int j = (p_175628_2_.func_177952_p() >> 4) - this.field_72816_b; -+ if (!withinBounds(i, j)) return p_175628_1_.field_77198_c; - return this.field_72817_c[i][j].func_177413_a(p_175628_1_, p_175628_2_); - } - else -@@ -188,4 +193,21 @@ - { - return this.field_72815_e.func_175624_G(); - } -+ -+ @Override -+ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) -+ { -+ int x = (pos.func_177958_n() >> 4) - this.field_72818_a; -+ int z = (pos.func_177952_p() >> 4) - this.field_72816_b; -+ if (pos.func_177956_o() < 0 || pos.func_177956_o() >= 256) return _default; -+ if (!withinBounds(x, z)) return _default; -+ -+ IBlockState state = func_180495_p(pos); -+ return state.func_177230_c().isSideSolid(state, this, pos, side); -+ } -+ -+ private boolean withinBounds(int x, int z) -+ { -+ return x >= 0 && x < field_72817_c.length && z >= 0 && z < field_72817_c[x].length && field_72817_c[x][z] != null; -+ } - } diff --git a/patches_old/minecraft/net/minecraft/world/DimensionType.java.patch b/patches_old/minecraft/net/minecraft/world/DimensionType.java.patch deleted file mode 100644 index 06d76f880..000000000 --- a/patches_old/minecraft/net/minecraft/world/DimensionType.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/DimensionType.java -+++ ../src-work/minecraft/net/minecraft/world/DimensionType.java -@@ -13,6 +13,7 @@ - private final String field_186075_e; - private final String field_186076_f; - private final Class field_186077_g; -+ private boolean shouldLoadSpawn = false; - - private DimensionType(int p_i46672_3_, String p_i46672_4_, String p_i46672_5_, Class p_i46672_6_) - { -@@ -20,6 +21,7 @@ - this.field_186075_e = p_i46672_4_; - this.field_186076_f = p_i46672_5_; - this.field_186077_g = p_i46672_6_; -+ this.shouldLoadSpawn = p_i46672_3_ == 0; - } - - public int func_186068_a() -@@ -75,6 +77,20 @@ - throw new IllegalArgumentException("Invalid dimension id " + p_186069_0_); - } - -+ public boolean shouldLoadSpawn(){ return this.shouldLoadSpawn; } -+ public DimensionType setLoadSpawn(boolean value) { this.shouldLoadSpawn = value; return this; } -+ -+ private static Class[] ENUM_ARGS = {int.class, String.class, String.class, Class.class}; -+ static { net.minecraftforge.common.util.EnumHelper.testEnum(DimensionType.class, ENUM_ARGS); } -+ public static DimensionType register(String name, String suffix, int id, Class provider, boolean keepLoaded) -+ { -+ String enum_name = name.replace(" ", "_").toLowerCase(); -+ DimensionType ret = net.minecraftforge.common.util.EnumHelper.addEnum(DimensionType.class, enum_name, ENUM_ARGS, -+ id, name, suffix, provider); -+ return ret.setLoadSpawn(keepLoaded); -+ } -+ //TODO: Unregister? There is no way to really delete a enum value... -+ - public static DimensionType func_193417_a(String p_193417_0_) - { - for (DimensionType dimensiontype : values()) diff --git a/patches_old/minecraft/net/minecraft/world/Explosion.java.patch b/patches_old/minecraft/net/minecraft/world/Explosion.java.patch deleted file mode 100644 index 82f20efd5..000000000 --- a/patches_old/minecraft/net/minecraft/world/Explosion.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/Explosion.java -+++ ../src-work/minecraft/net/minecraft/world/Explosion.java -@@ -41,6 +41,7 @@ - private final float field_77280_f; - private final List field_77281_g; - private final Map field_77288_k; -+ private final Vec3d position; - - @SideOnly(Side.CLIENT) - public Explosion(World p_i45752_1_, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) -@@ -68,6 +69,7 @@ - this.field_77282_d = p_i45754_7_; - this.field_77286_a = p_i45754_10_; - this.field_82755_b = p_i45754_11_; -+ this.position = new Vec3d(this.field_77284_b, this.field_77285_c, this.field_77282_d); - } - - public void func_77278_a() -@@ -102,7 +104,7 @@ - - if (iblockstate.func_185904_a() != Material.field_151579_a) - { -- float f2 = this.field_77283_e != null ? this.field_77283_e.func_180428_a(this, this.field_77287_j, blockpos, iblockstate) : iblockstate.func_177230_c().func_149638_a((Entity)null); -+ float f2 = this.field_77283_e != null ? this.field_77283_e.func_180428_a(this, this.field_77287_j, blockpos, iblockstate) : iblockstate.func_177230_c().getExplosionResistance(field_77287_j, blockpos, (Entity)null, this); - f -= (f2 + 0.3F) * 0.3F; - } - -@@ -129,6 +131,7 @@ - int j2 = MathHelper.func_76128_c(this.field_77282_d - (double)f3 - 1.0D); - int j1 = MathHelper.func_76128_c(this.field_77282_d + (double)f3 + 1.0D); - List list = this.field_77287_j.func_72839_b(this.field_77283_e, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); -+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.field_77287_j, this, list, f3); - Vec3d vec3d = new Vec3d(this.field_77284_b, this.field_77285_c, this.field_77282_d); - - for (int k2 = 0; k2 < list.size(); ++k2) -@@ -228,8 +231,7 @@ - block.func_180653_a(this.field_77287_j, blockpos, this.field_77287_j.func_180495_p(blockpos), 1.0F / this.field_77280_f, 0); - } - -- this.field_77287_j.func_180501_a(blockpos, Blocks.field_150350_a.func_176223_P(), 3); -- block.func_180652_a(this.field_77287_j, blockpos, this); -+ block.onBlockExploded(this.field_77287_j, blockpos, this); - } - } - } -@@ -277,4 +279,6 @@ - { - return this.field_77281_g; - } -+ -+ public Vec3d getPosition(){ return this.position; } - } diff --git a/patches_old/minecraft/net/minecraft/world/IBlockAccess.java.patch b/patches_old/minecraft/net/minecraft/world/IBlockAccess.java.patch deleted file mode 100644 index 068be9ed2..000000000 --- a/patches_old/minecraft/net/minecraft/world/IBlockAccess.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/IBlockAccess.java -+++ ../src-work/minecraft/net/minecraft/world/IBlockAccess.java -@@ -28,4 +28,14 @@ - - @SideOnly(Side.CLIENT) - WorldType func_175624_G(); -+ -+ /** -+ * FORGE: isSideSolid, pulled up from {@link World} -+ * -+ * @param pos Position -+ * @param side Side -+ * @param _default default return value -+ * @return if the block is solid on the side -+ */ -+ boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default); - } diff --git a/patches_old/minecraft/net/minecraft/world/ServerWorldEventHandler.java.patch b/patches_old/minecraft/net/minecraft/world/ServerWorldEventHandler.java.patch deleted file mode 100644 index f67ef2483..000000000 --- a/patches_old/minecraft/net/minecraft/world/ServerWorldEventHandler.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/ServerWorldEventHandler.java -+++ ../src-work/minecraft/net/minecraft/world/ServerWorldEventHandler.java -@@ -55,7 +55,7 @@ - - public void func_184375_a(@Nullable EntityPlayer p_184375_1_, SoundEvent p_184375_2_, SoundCategory p_184375_3_, double p_184375_4_, double p_184375_6_, double p_184375_8_, float p_184375_10_, float p_184375_11_) - { -- this.field_72783_a.func_184103_al().func_148543_a(p_184375_1_, p_184375_4_, p_184375_6_, p_184375_8_, p_184375_10_ > 1.0F ? (double)(16.0F * p_184375_10_) : 16.0D, this.field_72782_b.field_73011_w.func_186058_p().func_186068_a(), new SPacketSoundEffect(p_184375_2_, p_184375_3_, p_184375_4_, p_184375_6_, p_184375_8_, p_184375_10_, p_184375_11_)); -+ this.field_72783_a.func_184103_al().func_148543_a(p_184375_1_, p_184375_4_, p_184375_6_, p_184375_8_, p_184375_10_ > 1.0F ? (double)(16.0F * p_184375_10_) : 16.0D, this.field_72782_b.field_73011_w.getDimension(), new SPacketSoundEffect(p_184375_2_, p_184375_3_, p_184375_4_, p_184375_6_, p_184375_8_, p_184375_10_, p_184375_11_)); - } - - public void func_147585_a(int p_147585_1_, int p_147585_2_, int p_147585_3_, int p_147585_4_, int p_147585_5_, int p_147585_6_) -@@ -77,7 +77,7 @@ - - public void func_180439_a(EntityPlayer p_180439_1_, int p_180439_2_, BlockPos p_180439_3_, int p_180439_4_) - { -- this.field_72783_a.func_184103_al().func_148543_a(p_180439_1_, (double)p_180439_3_.func_177958_n(), (double)p_180439_3_.func_177956_o(), (double)p_180439_3_.func_177952_p(), 64.0D, this.field_72782_b.field_73011_w.func_186058_p().func_186068_a(), new SPacketEffect(p_180439_2_, p_180439_3_, p_180439_4_, false)); -+ this.field_72783_a.func_184103_al().func_148543_a(p_180439_1_, (double)p_180439_3_.func_177958_n(), (double)p_180439_3_.func_177956_o(), (double)p_180439_3_.func_177952_p(), 64.0D, this.field_72782_b.field_73011_w.getDimension(), new SPacketEffect(p_180439_2_, p_180439_3_, p_180439_4_, false)); - } - - public void func_180440_a(int p_180440_1_, BlockPos p_180440_2_, int p_180440_3_) diff --git a/patches_old/minecraft/net/minecraft/world/Teleporter.java.patch b/patches_old/minecraft/net/minecraft/world/Teleporter.java.patch deleted file mode 100644 index 8b5983a4d..000000000 --- a/patches_old/minecraft/net/minecraft/world/Teleporter.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/Teleporter.java -+++ ../src-work/minecraft/net/minecraft/world/Teleporter.java -@@ -15,7 +15,7 @@ - import net.minecraft.util.math.ChunkPos; - import net.minecraft.util.math.MathHelper; - --public class Teleporter -+public class Teleporter implements net.minecraftforge.common.util.ITeleporter - { - protected final WorldServer field_85192_a; - protected final Random field_77187_a; -@@ -428,4 +428,13 @@ - this.field_85087_d = p_i45747_3_; - } - } -+ -+ @Override -+ public void placeEntity(World world, Entity entity, float yaw) -+ { -+ if (entity instanceof EntityPlayerMP) -+ func_180266_a(entity, yaw); -+ else -+ func_180620_b(entity, yaw); -+ } - } diff --git a/patches_old/minecraft/net/minecraft/world/World.java.patch b/patches_old/minecraft/net/minecraft/world/World.java.patch deleted file mode 100644 index 1757acc9e..000000000 --- a/patches_old/minecraft/net/minecraft/world/World.java.patch +++ /dev/null @@ -1,1153 +0,0 @@ ---- ../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 field_72996_f = Lists.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 capturedBlockSnapshots = new java.util.ArrayList(); -+ 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 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 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 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 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 func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate p_175674_3_) - { - List list = Lists.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 List func_175647_a(Class p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate 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 list = Lists.newArrayList(); - - for (int j3 = j2; j3 < k2; ++j3) -@@ -2930,11 +3145,13 @@ - - public void func_175650_b(Collection 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 getPersistentChunks() -+ { -+ return net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this); -+ } -+ -+ public Iterator getPersistentChunkIterable(Iterator 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 getCapability(net.minecraftforge.common.capabilities.Capability 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."); diff --git a/patches_old/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches_old/minecraft/net/minecraft/world/WorldProvider.java.patch index f43bb91d7..8ffa18bca 100644 --- a/patches_old/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches_old/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -70,27 +70,6 @@ } + /*======================================= Forge Start =========================================*/ -+ private net.minecraftforge.client.IRenderHandler skyRenderer = null; -+ private net.minecraftforge.client.IRenderHandler cloudRenderer = null; -+ private net.minecraftforge.client.IRenderHandler weatherRenderer = null; -+ private int dimensionId; -+ -+ /** -+ * Sets the providers current dimension ID, used in default getSaveFolder() -+ * Added to allow default providers to be registered for multiple dimensions. -+ * This is to denote the exact dimension ID opposed to the 'type' in WorldType -+ * -+ * @param dim Dimension ID -+ */ -+ public void setDimension(int dim) -+ { -+ this.dimensionId = dim; -+ } -+ public int getDimension() -+ { -+ return this.dimensionId; -+ } -+ + /** + * Returns the sub-folder of the world folder that this WorldProvider saves to. + * EXA: DIM1, DIM-1 @@ -103,22 +82,6 @@ + } + + /** -+ * The dimension's movement factor. -+ * Whenever a player or entity changes dimension from world A to world B, their coordinates are multiplied by -+ * worldA.provider.getMovementFactor() / worldB.provider.getMovementFactor() -+ * Example: Overworld factor is 1, nether factor is 8. Traveling from overworld to nether multiplies coordinates by 1/8. -+ * @return The movement factor -+ */ -+ public double getMovementFactor() -+ { -+ if (this instanceof WorldProviderHell) -+ { -+ return 8.0; -+ } -+ return 1.0; -+ } -+ -+ /** + * If this method returns true, then chunks received by the client will + * have {@link net.minecraft.world.chunk.Chunk#resetRelightChecks} called + * on them, queuing lighting checks for all air blocks in the chunk (and @@ -134,44 +97,6 @@ + return !(this instanceof WorldProviderSurface); + } + -+ @Nullable -+ @SideOnly(Side.CLIENT) -+ public net.minecraftforge.client.IRenderHandler getSkyRenderer() -+ { -+ return this.skyRenderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public void setSkyRenderer(net.minecraftforge.client.IRenderHandler skyRenderer) -+ { -+ this.skyRenderer = skyRenderer; -+ } -+ -+ @Nullable -+ @SideOnly(Side.CLIENT) -+ public net.minecraftforge.client.IRenderHandler getCloudRenderer() -+ { -+ return cloudRenderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public void setCloudRenderer(net.minecraftforge.client.IRenderHandler renderer) -+ { -+ cloudRenderer = renderer; -+ } -+ -+ @Nullable -+ @SideOnly(Side.CLIENT) -+ public net.minecraftforge.client.IRenderHandler getWeatherRenderer() -+ { -+ return weatherRenderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public void setWeatherRenderer(net.minecraftforge.client.IRenderHandler renderer) -+ { -+ weatherRenderer = renderer; -+ } + + /** + * Allows for manipulating the coloring of the lightmap texture. @@ -186,19 +111,6 @@ + * @see net.minecraft.client.renderer.EntityRenderer#updateLightmap(float) + */ + public void getLightmapColors(float partialTicks, float sunBrightness, float skyLight, float blockLight, float[] colors) {} -+ /** -+ * Determine if the cursor on the map should 'spin' when rendered, like it does for the player in the nether. -+ * -+ * @param entity The entity holding the map, playername, or frame-ENTITYID -+ * @param x X Position -+ * @param z Z Position -+ * @param rotation the regular rotation of the marker -+ * @return True to 'spin' the cursor -+ */ -+ public boolean shouldMapSpin(String entity, double x, double z, double rotation) -+ { -+ return dimensionId < 0; -+ } + + /** + * Determines the dimension the player will be respawned in, typically this brings them back to the overworld. @@ -212,20 +124,6 @@ + } + + /** -+ * Called from {@link World#initCapabilities()}, to gather capabilities for this world. -+ * It's safe to access world here since this is called after world is registered. -+ * -+ * On server, called directly after mapStorage and world data such as Scoreboard and VillageCollection are initialized. -+ * On client, called when world is constructed, just before world load event is called. -+ * Note that this method is always called before the world load event. -+ * @return initial holder for capabilities on the world -+ */ -+ @Nullable -+ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities() { -+ return null; -+ } -+ -+ /** + * Determines if the player can sleep in this world (or if the bed should explode for example). + * + * @param player The player that is attempting to sleep @@ -236,88 +134,6 @@ + { + return (this.func_76567_e() && this.field_76579_a.func_180494_b(pos) != net.minecraft.init.Biomes.field_76778_j) ? WorldSleepResult.ALLOW : WorldSleepResult.BED_EXPLODES; + } -+ -+ /*======================================= Start Moved From World =========================================*/ -+ -+ public Biome getBiomeForCoords(BlockPos pos) -+ { -+ return field_76579_a.getBiomeForCoordsBody(pos); -+ } -+ -+ public boolean isDaytime() -+ { -+ return field_76579_a.func_175657_ab() < 4; -+ } -+ -+ /** -+ * The current sun brightness factor for this dimension. -+ * 0.0f means no light at all, and 1.0f means maximum sunlight. -+ * This will be used for the "calculateSkylightSubtracted" -+ * which is for Sky light value calculation. -+ * -+ * @return The current brightness factor -+ * */ -+ public float getSunBrightnessFactor(float par1) -+ { -+ return field_76579_a.getSunBrightnessFactor(par1); -+ } -+ -+ /** -+ * Calculates the current moon phase factor. -+ * This factor is effective for slimes. -+ * (This method do not affect the moon rendering) -+ * */ -+ public float getCurrentMoonPhaseFactor() -+ { -+ return field_76579_a.getCurrentMoonPhaseFactorBody(); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3d getSkyColor(net.minecraft.entity.Entity cameraEntity, float partialTicks) -+ { -+ return field_76579_a.getSkyColorBody(cameraEntity, partialTicks); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3d getCloudColor(float partialTicks) -+ { -+ return field_76579_a.getCloudColorBody(partialTicks); -+ } -+ -+ /** -+ * Gets the Sun Brightness for rendering sky. -+ * */ -+ @SideOnly(Side.CLIENT) -+ public float getSunBrightness(float par1) -+ { -+ return field_76579_a.getSunBrightnessBody(par1); -+ } -+ -+ /** -+ * Gets the Star Brightness for rendering sky. -+ * */ -+ @SideOnly(Side.CLIENT) -+ public float getStarBrightness(float par1) -+ { -+ return field_76579_a.getStarBrightnessBody(par1); -+ } -+ -+ public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) -+ { -+ field_76579_a.field_72985_G = allowHostile; -+ field_76579_a.field_72992_H = allowPeaceful; -+ } -+ -+ public void calculateInitialWeather() -+ { -+ field_76579_a.calculateInitialWeatherBody(); -+ } -+ -+ public void updateWeather() -+ { -+ field_76579_a.updateWeatherBody(); -+ } -+ + public boolean canBlockFreeze(BlockPos pos, boolean byWater) + { + return field_76579_a.canBlockFreezeBody(pos, byWater); @@ -327,56 +143,6 @@ + { + return field_76579_a.canSnowAtBody(pos, checkLight); + } -+ public void setWorldTime(long time) -+ { -+ field_76579_a.field_72986_A.func_76068_b(time); -+ } -+ -+ public long getSeed() -+ { -+ return field_76579_a.field_72986_A.func_76063_b(); -+ } -+ -+ public long getWorldTime() -+ { -+ return field_76579_a.field_72986_A.func_76073_f(); -+ } -+ -+ public BlockPos getSpawnPoint() -+ { -+ net.minecraft.world.storage.WorldInfo info = field_76579_a.field_72986_A; -+ return new BlockPos(info.func_76079_c(), info.func_76075_d(), info.func_76074_e()); -+ } -+ -+ public void setSpawnPoint(BlockPos pos) -+ { -+ field_76579_a.field_72986_A.func_176143_a(pos); -+ } -+ -+ public boolean canMineBlock(net.minecraft.entity.player.EntityPlayer player, BlockPos pos) -+ { -+ return field_76579_a.canMineBlockBody(player, pos); -+ } -+ -+ public boolean isBlockHighHumidity(BlockPos pos) -+ { -+ return field_76579_a.func_180494_b(pos).func_76736_e(); -+ } -+ -+ public int getHeight() -+ { -+ return 256; -+ } -+ -+ public int getActualHeight() -+ { -+ return field_76576_e ? 128 : 256; -+ } -+ -+ public double getHorizon() -+ { -+ return field_76579_a.field_72986_A.func_76067_t().getHorizon(field_76579_a); -+ } + + public void resetRainAndThunder() + { diff --git a/patches_old/minecraft/net/minecraft/world/WorldProviderEnd.java.patch b/patches_old/minecraft/net/minecraft/world/WorldProviderEnd.java.patch deleted file mode 100644 index 8281c449f..000000000 --- a/patches_old/minecraft/net/minecraft/world/WorldProviderEnd.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldProviderEnd.java -+++ ../src-work/minecraft/net/minecraft/world/WorldProviderEnd.java -@@ -20,7 +20,7 @@ - public void func_76572_b() - { - this.field_76578_c = new BiomeProviderSingle(Biomes.field_76779_k); -- NBTTagCompound nbttagcompound = this.field_76579_a.func_72912_H().func_186347_a(DimensionType.THE_END); -+ NBTTagCompound nbttagcompound = this.field_76579_a.func_72912_H().getDimensionData(this.field_76579_a.field_73011_w.getDimension()); - this.field_186064_g = this.field_76579_a instanceof WorldServer ? new DragonFightManager((WorldServer)this.field_76579_a, nbttagcompound.func_74775_l("DragonFight")) : null; - } - -@@ -113,7 +113,7 @@ - nbttagcompound.func_74782_a("DragonFight", this.field_186064_g.func_186088_a()); - } - -- this.field_76579_a.func_72912_H().func_186345_a(DimensionType.THE_END, nbttagcompound); -+ this.field_76579_a.func_72912_H().setDimensionData(this.field_76579_a.field_73011_w.getDimension(), nbttagcompound); - } - - public void func_186059_r() -@@ -129,4 +129,22 @@ - { - return this.field_186064_g; - } -+ -+ @Override -+ public void func_186061_a(net.minecraft.entity.player.EntityPlayerMP player) -+ { -+ if (this.field_186064_g != null) -+ { -+ this.field_186064_g.addPlayer(player); -+ } -+ } -+ -+ @Override -+ public void func_186062_b(net.minecraft.entity.player.EntityPlayerMP player) -+ { -+ if (this.field_186064_g != null) -+ { -+ this.field_186064_g.removePlayer(player); -+ } -+ } - } diff --git a/patches_old/minecraft/net/minecraft/world/WorldProviderSurface.java.patch b/patches_old/minecraft/net/minecraft/world/WorldProviderSurface.java.patch deleted file mode 100644 index 1b588e11e..000000000 --- a/patches_old/minecraft/net/minecraft/world/WorldProviderSurface.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldProviderSurface.java -+++ ../src-work/minecraft/net/minecraft/world/WorldProviderSurface.java -@@ -9,6 +9,6 @@ - - public boolean func_186056_c(int p_186056_1_, int p_186056_2_) - { -- return !this.field_76579_a.func_72916_c(p_186056_1_, p_186056_2_); -+ return !this.field_76579_a.func_72916_c(p_186056_1_, p_186056_2_) || !this.field_76579_a.field_73011_w.func_186058_p().shouldLoadSpawn(); - } - } diff --git a/patches_old/minecraft/net/minecraft/world/WorldServer.java.patch b/patches_old/minecraft/net/minecraft/world/WorldServer.java.patch deleted file mode 100644 index f717bbb20..000000000 --- a/patches_old/minecraft/net/minecraft/world/WorldServer.java.patch +++ /dev/null @@ -1,304 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldServer.java -+++ ../src-work/minecraft/net/minecraft/world/WorldServer.java -@@ -101,30 +101,39 @@ - private int field_147489_T; - private final List field_94579_S = Lists.newArrayList(); - -+ /** Stores the recently processed (lighting) chunks */ -+ protected Set doneChunks = new java.util.HashSet(); -+ public List customTeleporters = new ArrayList(); -+ - public WorldServer(MinecraftServer p_i45921_1_, ISaveHandler p_i45921_2_, WorldInfo p_i45921_3_, int p_i45921_4_, Profiler p_i45921_5_) - { -- super(p_i45921_2_, p_i45921_3_, DimensionType.func_186069_a(p_i45921_4_).func_186070_d(), p_i45921_5_, false); -+ super(p_i45921_2_, p_i45921_3_, net.minecraftforge.common.DimensionManager.createProviderFor(p_i45921_4_), p_i45921_5_, false); - this.field_73061_a = p_i45921_1_; - this.field_73062_L = new EntityTracker(this); - this.field_73063_M = new PlayerChunkMap(this); -+ // Guarantee the dimension ID was not reset by the provider -+ int providerDim = this.field_73011_w.getDimension(); - this.field_73011_w.func_76558_a(this); -+ this.field_73011_w.setDimension(providerDim); - this.field_73020_y = this.func_72970_h(); -+ perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, p_i45921_2_)); - this.field_85177_Q = new Teleporter(this); - this.func_72966_v(); - this.func_72947_a(); - this.func_175723_af().func_177725_a(p_i45921_1_.func_175580_aG()); -+ net.minecraftforge.common.DimensionManager.setWorld(p_i45921_4_, this, field_73061_a); - } - - public World func_175643_b() - { - this.field_72988_C = new MapStorage(this.field_73019_z); - String s = VillageCollection.func_176062_a(this.field_73011_w); -- VillageCollection villagecollection = (VillageCollection)this.field_72988_C.func_75742_a(VillageCollection.class, s); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.func_75742_a(VillageCollection.class, s); - - if (villagecollection == null) - { - this.field_72982_D = new VillageCollection(this); -- this.field_72988_C.func_75745_a(s, this.field_72982_D); -+ this.perWorldStorage.func_75745_a(s, this.field_72982_D); - } - else - { -@@ -161,6 +170,7 @@ - this.func_175723_af().func_177750_a(this.field_72986_A.func_176137_E()); - } - -+ this.initCapabilities(); - return this; - } - -@@ -179,8 +189,8 @@ - { - if (this.func_82736_K().func_82766_b("doDaylightCycle")) - { -- long i = this.field_72986_A.func_76073_f() + 24000L; -- this.field_72986_A.func_76068_b(i - i % 24000L); -+ long i = this.func_72820_D() + 24000L; -+ this.func_72877_b(i - i % 24000L); - } - - this.func_73053_d(); -@@ -206,7 +216,7 @@ - - if (this.func_82736_K().func_82766_b("doDaylightCycle")) - { -- this.field_72986_A.func_76068_b(this.field_72986_A.func_76073_f() + 1L); -+ this.func_72877_b(this.func_72820_D() + 1L); - } - - this.field_72984_F.func_76318_c("tickPending"); -@@ -220,6 +230,10 @@ - this.field_175740_d.func_75528_a(); - this.field_72984_F.func_76318_c("portalForcer"); - this.field_85177_Q.func_85189_a(this.func_82737_E()); -+ for (Teleporter tele : customTeleporters) -+ { -+ tele.func_85189_a(func_82737_E()); -+ } - this.field_72984_F.func_76319_b(); - this.func_147488_Z(); - } -@@ -228,12 +242,14 @@ - public Biome.SpawnListEntry func_175734_a(EnumCreatureType p_175734_1_, BlockPos p_175734_2_) - { - List list = this.func_72863_F().func_177458_a(p_175734_1_, p_175734_2_); -+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, p_175734_1_, p_175734_2_, list); - return list != null && !list.isEmpty() ? (Biome.SpawnListEntry)WeightedRandom.func_76271_a(this.field_73012_v, list) : null; - } - - public boolean func_175732_a(EnumCreatureType p_175732_1_, Biome.SpawnListEntry p_175732_2_, BlockPos p_175732_3_) - { - List list = this.func_72863_F().func_177458_a(p_175732_1_, p_175732_3_); -+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, p_175732_1_, p_175732_3_, list); - return list != null && !list.isEmpty() ? list.contains(p_175732_2_) : false; - } - -@@ -279,10 +295,7 @@ - - private void func_73051_P() - { -- this.field_72986_A.func_76080_g(0); -- this.field_72986_A.func_76084_b(false); -- this.field_72986_A.func_76090_f(0); -- this.field_72986_A.func_76069_a(false); -+ this.field_73011_w.resetRainAndThunder(); - } - - public boolean func_73056_e() -@@ -375,7 +388,7 @@ - boolean flag1 = this.func_72911_I(); - this.field_72984_F.func_76320_a("pollingChunks"); - -- for (Iterator iterator = this.field_73063_M.func_187300_b(); iterator.hasNext(); this.field_72984_F.func_76319_b()) -+ for (Iterator iterator = getPersistentChunkIterable(this.field_73063_M.func_187300_b()); iterator.hasNext(); this.field_72984_F.func_76319_b()) - { - this.field_72984_F.func_76320_a("getChunk"); - Chunk chunk = iterator.next(); -@@ -387,7 +400,7 @@ - chunk.func_150804_b(false); - this.field_72984_F.func_76318_c("thunder"); - -- if (flag && flag1 && this.field_73012_v.nextInt(100000) == 0) -+ if (this.field_73011_w.canDoLightning(chunk) && flag && flag1 && this.field_73012_v.nextInt(100000) == 0) - { - this.field_73005_l = this.field_73005_l * 3 + 1013904223; - int l = this.field_73005_l >> 2; -@@ -415,13 +428,14 @@ - - this.field_72984_F.func_76318_c("iceandsnow"); - -- if (this.field_73012_v.nextInt(16) == 0) -+ if (this.field_73011_w.canDoRainSnowIce(chunk) && this.field_73012_v.nextInt(16) == 0) - { - this.field_73005_l = this.field_73005_l * 3 + 1013904223; - int j2 = this.field_73005_l >> 2; - BlockPos blockpos1 = this.func_175725_q(new BlockPos(j + (j2 & 15), 0, k + (j2 >> 8 & 15))); - BlockPos blockpos2 = blockpos1.func_177977_b(); - -+ if (this.func_175697_a(blockpos2, 1)) // Forge: check area to avoid loading neighbors in unloaded chunks - if (this.func_175662_w(blockpos2)) - { - this.func_175656_a(blockpos2, Blocks.field_150432_aD.func_176223_P()); -@@ -525,7 +539,10 @@ - { - if (p_175654_2_.func_149698_L()) - { -- if (this.func_175707_a(p_175654_1_.func_177982_a(-8, -8, -8), p_175654_1_.func_177982_a(8, 8, 8))) -+ //Keeping here as a note for future when it may be restored. -+ boolean isForced = getPersistentChunks().containsKey(new ChunkPos(p_175654_1_)); -+ int range = isForced ? 0 : 8; -+ if (this.func_175707_a(p_175654_1_.func_177982_a(-range, -range, -range), p_175654_1_.func_177982_a(range, range, range))) - { - IBlockState iblockstate = this.func_180495_p(p_175654_1_); - -@@ -561,6 +578,7 @@ - - public void func_180497_b(BlockPos p_180497_1_, Block p_180497_2_, int p_180497_3_, int p_180497_4_) - { -+ if (p_180497_2_ == null) return; //Forge: Prevent null blocks from ticking, can happen if blocks are removed in old worlds. TODO: Fix real issue causing block to be null. - NextTickListEntry nextticklistentry = new NextTickListEntry(p_180497_1_, p_180497_2_); - nextticklistentry.func_82753_a(p_180497_4_); - Material material = p_180497_2_.func_176223_P().func_185904_a(); -@@ -579,7 +597,7 @@ - - public void func_72939_s() - { -- if (this.field_73010_i.isEmpty()) -+ if (this.field_73010_i.isEmpty() && getPersistentChunks().isEmpty()) - { - if (this.field_80004_Q++ >= 300) - { -@@ -703,6 +721,9 @@ - { - NextTickListEntry nextticklistentry1 = iterator.next(); - iterator.remove(); -+ //Keeping here as a note for future when it may be restored. -+ //boolean isForced = getPersistentChunks().containsKey(new ChunkPos(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4)); -+ //byte b0 = isForced ? 0 : 8; - int k = 0; - - if (this.func_175707_a(nextticklistentry1.field_180282_a.func_177982_a(0, 0, 0), nextticklistentry1.field_180282_a.func_177982_a(0, 0, 0))) -@@ -829,6 +850,10 @@ - - public boolean func_175660_a(EntityPlayer p_175660_1_, BlockPos p_175660_2_) - { -+ return super.func_175660_a(p_175660_1_, p_175660_2_); -+ } -+ public boolean canMineBlockBody(EntityPlayer p_175660_1_, BlockPos p_175660_2_) -+ { - return !this.field_73061_a.func_175579_a(this, p_175660_2_, p_175660_1_) && this.func_175723_af().func_177746_a(p_175660_2_); - } - -@@ -894,6 +919,7 @@ - } - else - { -+ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; - this.field_72987_B = true; - BiomeProvider biomeprovider = this.field_73011_w.func_177499_m(); - List list = biomeprovider.func_76932_a(); -@@ -979,6 +1005,7 @@ - } - - chunkproviderserver.func_186027_a(p_73044_1_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); - - for (Chunk chunk : Lists.newArrayList(chunkproviderserver.func_189548_a())) - { -@@ -1023,6 +1050,7 @@ - this.field_72986_A.func_176135_e(this.func_175723_af().func_177732_i()); - this.field_73019_z.func_75755_a(this.field_72986_A, this.field_73061_a.func_184103_al().func_72378_q()); - this.field_72988_C.func_75744_a(); -+ this.perWorldStorage.func_75744_a(); - } - - public boolean func_72838_d(Entity p_72838_1_) -@@ -1034,7 +1062,7 @@ - { - for (Entity entity : Lists.newArrayList(p_175650_1_)) - { -- if (this.func_184165_i(entity)) -+ if (this.func_184165_i(entity) && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity, this))) - { - this.field_72996_f.add(entity); - this.func_72923_a(entity); -@@ -1115,7 +1143,7 @@ - { - if (super.func_72942_c(p_72942_1_)) - { -- this.field_73061_a.func_184103_al().func_148543_a((EntityPlayer)null, p_72942_1_.field_70165_t, p_72942_1_.field_70163_u, p_72942_1_.field_70161_v, 512.0D, this.field_73011_w.func_186058_p().func_186068_a(), new SPacketSpawnGlobalEntity(p_72942_1_)); -+ this.field_73061_a.func_184103_al().func_148543_a((EntityPlayer)null, p_72942_1_.field_70165_t, p_72942_1_.field_70163_u, p_72942_1_.field_70161_v, 512.0D, this.field_73011_w.getDimension(), new SPacketSpawnGlobalEntity(p_72942_1_)); - return true; - } - else -@@ -1137,6 +1165,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(false); - -@@ -1182,7 +1211,7 @@ - { - if (this.func_147485_a(blockeventdata)) - { -- this.field_73061_a.func_184103_al().func_148543_a((EntityPlayer)null, (double)blockeventdata.func_180328_a().func_177958_n(), (double)blockeventdata.func_180328_a().func_177956_o(), (double)blockeventdata.func_180328_a().func_177952_p(), 64.0D, this.field_73011_w.func_186058_p().func_186068_a(), new SPacketBlockAction(blockeventdata.func_180328_a(), blockeventdata.func_151337_f(), blockeventdata.func_151339_d(), blockeventdata.func_151338_e())); -+ this.field_73061_a.func_184103_al().func_148543_a((EntityPlayer)null, (double)blockeventdata.func_180328_a().func_177958_n(), (double)blockeventdata.func_180328_a().func_177956_o(), (double)blockeventdata.func_180328_a().func_177952_p(), 64.0D, this.field_73011_w.getDimension(), new SPacketBlockAction(blockeventdata.func_180328_a(), blockeventdata.func_151337_f(), blockeventdata.func_151339_d(), blockeventdata.func_151338_e())); - } - } - -@@ -1208,27 +1237,31 @@ - - if (this.field_73003_n != this.field_73004_o) - { -- this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(7, this.field_73004_o), this.field_73011_w.func_186058_p().func_186068_a()); -+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(7, this.field_73004_o), this.field_73011_w.getDimension()); - } - - if (this.field_73018_p != this.field_73017_q) - { -- this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.func_186058_p().func_186068_a()); -+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.getDimension()); - } - -+ /* The function in use here has been replaced in order to only send the weather info to players in the correct dimension, -+ * rather than to all players on the server. This is what causes the client-side rain, as the -+ * client believes that it has started raining locally, rather than in another dimension. -+ */ - if (flag != this.func_72896_J()) - { - if (flag) - { -- this.field_73061_a.func_184103_al().func_148540_a(new SPacketChangeGameState(2, 0.0F)); -+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(2, 0.0F), this.field_73011_w.getDimension()); - } - else - { -- this.field_73061_a.func_184103_al().func_148540_a(new SPacketChangeGameState(1, 0.0F)); -+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(1, 0.0F), this.field_73011_w.getDimension()); - } - -- this.field_73061_a.func_184103_al().func_148540_a(new SPacketChangeGameState(7, this.field_73004_o)); -- this.field_73061_a.func_184103_al().func_148540_a(new SPacketChangeGameState(8, this.field_73017_q)); -+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(7, this.field_73004_o), this.field_73011_w.getDimension()); -+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.getDimension()); - } - } - -@@ -1323,6 +1356,11 @@ - return this.field_193036_D; - } - -+ public java.io.File getChunkSaveLocation() -+ { -+ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)func_72863_F().field_73247_e).field_75825_d; -+ } -+ - static class ServerBlockEventList extends ArrayList - { - private ServerBlockEventList() diff --git a/patches_old/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches_old/minecraft/net/minecraft/world/WorldServerMulti.java.patch deleted file mode 100644 index c31730313..000000000 --- a/patches_old/minecraft/net/minecraft/world/WorldServerMulti.java.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldServerMulti.java -+++ ../src-work/minecraft/net/minecraft/world/WorldServerMulti.java -@@ -11,12 +11,13 @@ - public class WorldServerMulti extends WorldServer - { - private final WorldServer field_175743_a; -+ private IBorderListener borderListener; - - public WorldServerMulti(MinecraftServer p_i45923_1_, ISaveHandler p_i45923_2_, int p_i45923_3_, WorldServer p_i45923_4_, Profiler p_i45923_5_) - { - super(p_i45923_1_, p_i45923_2_, new DerivedWorldInfo(p_i45923_4_.func_72912_H()), p_i45923_3_, p_i45923_5_); - this.field_175743_a = p_i45923_4_; -- p_i45923_4_.func_175723_af().func_177737_a(new IBorderListener() -+ this.borderListener = new IBorderListener() - { - public void func_177694_a(WorldBorder p_177694_1_, double p_177694_2_) - { -@@ -46,11 +47,13 @@ - { - WorldServerMulti.this.func_175723_af().func_177724_b(p_177695_2_); - } -- }); -+ }; -+ this.field_175743_a.func_175723_af().func_177737_a(this.borderListener); - } - - protected void func_73042_a() throws MinecraftException - { -+ this.perWorldStorage.func_75744_a(); - } - - public World func_175643_b() -@@ -60,12 +63,12 @@ - this.field_184151_B = this.field_175743_a.func_184146_ak(); - this.field_191951_C = this.field_175743_a.func_191952_z(); - String s = VillageCollection.func_176062_a(this.field_73011_w); -- VillageCollection villagecollection = (VillageCollection)this.field_72988_C.func_75742_a(VillageCollection.class, s); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.func_75742_a(VillageCollection.class, s); - - if (villagecollection == null) - { - this.field_72982_D = new VillageCollection(this); -- this.field_72988_C.func_75745_a(s, this.field_72982_D); -+ this.perWorldStorage.func_75745_a(s, this.field_72982_D); - } - else - { -@@ -73,9 +76,18 @@ - this.field_72982_D.func_82566_a(this); - } - -+ this.initCapabilities(); - return this; - } - -+ -+ @Override -+ public void func_73041_k() -+ { -+ super.func_73041_k(); -+ this.field_175743_a.func_175723_af().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak. -+ } -+ - public void func_184166_c() - { - this.field_73011_w.func_186057_q(); diff --git a/patches_old/minecraft/net/minecraft/world/WorldType.java.patch b/patches_old/minecraft/net/minecraft/world/WorldType.java.patch deleted file mode 100644 index 729ef4876..000000000 --- a/patches_old/minecraft/net/minecraft/world/WorldType.java.patch +++ /dev/null @@ -1,110 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldType.java -+++ ../src-work/minecraft/net/minecraft/world/WorldType.java -@@ -113,4 +114,145 @@ - this.field_151361_l = true; - return this; - } -+ -+ public net.minecraft.world.biome.BiomeProvider getBiomeProvider(World world) -+ { -+ if (this == field_77138_c) -+ { -+ net.minecraft.world.gen.FlatGeneratorInfo flatgeneratorinfo = net.minecraft.world.gen.FlatGeneratorInfo.func_82651_a(world.func_72912_H().func_82571_y()); -+ return new net.minecraft.world.biome.BiomeProviderSingle(net.minecraft.world.biome.Biome.func_180276_a(flatgeneratorinfo.func_82648_a(), net.minecraft.init.Biomes.field_180279_ad)); -+ } -+ else if (this == field_180272_g) -+ { -+ return new net.minecraft.world.biome.BiomeProviderSingle(net.minecraft.init.Biomes.field_76772_c); -+ } -+ else -+ { -+ return new net.minecraft.world.biome.BiomeProvider(world.func_72912_H()); -+ } -+ } -+ -+ public net.minecraft.world.gen.IChunkGenerator getChunkGenerator(World world, String generatorOptions) -+ { -+ if (this == field_77138_c) return new net.minecraft.world.gen.ChunkGeneratorFlat(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions); -+ if (this == field_180272_g) return new net.minecraft.world.gen.ChunkGeneratorDebug(world); -+ if (this == field_180271_f) return new net.minecraft.world.gen.ChunkGeneratorOverworld(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions); -+ return new net.minecraft.world.gen.ChunkGeneratorOverworld(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions); -+ } -+ -+ public int getMinimumSpawnHeight(World world) -+ { -+ return this == field_77138_c ? 4 : world.func_181545_F() + 1; -+ } -+ -+ public double getHorizon(World world) -+ { -+ return this == field_77138_c ? 0.0D : 63.0D; -+ } -+ -+ public double voidFadeMagnitude() -+ { -+ return this == field_77138_c ? 1.0D : 0.03125D; -+ } -+ -+ /*=================================================== FORGE START ======================================*/ -+ private static int getNextID() -+ { -+ for (int x = 0; x < field_77139_a.length; x++) -+ { -+ if (field_77139_a[x] == null) -+ { -+ return x; -+ } -+ } -+ -+ int oldLen = field_77139_a.length; -+ field_77139_a = java.util.Arrays.copyOf(field_77139_a, oldLen + 16); -+ return oldLen; -+ } -+ -+ /** -+ * Creates a new world type, the ID is hidden and should not be referenced by modders. -+ * It will automatically expand the underlying workdType array if there are no IDs left. -+ * @param name -+ */ -+ public WorldType(String name) -+ { -+ this(getNextID(), name); -+ } -+ -+ /** -+ * Gets the spawn fuzz for players who join the world. -+ * Useful for void world types. -+ * @return Fuzz for entity initial spawn in blocks. -+ */ -+ public int getSpawnFuzz(WorldServer world, net.minecraft.server.MinecraftServer server) -+ { -+ return Math.max(0, server.func_184108_a(world)); -+ }+ -+ -+ /** -+ * Get the height to render the clouds for this world type -+ * @return The height to render clouds at -+ */ -+ public float getCloudHeight() -+ { -+ return 128.0F; -+ } -+ -+ /** -+ * Creates the GenLayerBiome used for generating the world with the specified ChunkProviderSettings JSON String -+ * *IF AND ONLY IF* this WorldType == WorldType.CUSTOMIZED. -+ * -+ * -+ * @param worldSeed The world seed -+ * @param parentLayer The parent layer to feed into any layer you return -+ * @param chunkSettings The ChunkGeneratorSettings constructed from the custom JSON -+ * @return A GenLayer that will return ints representing the Biomes to be generated, see GenLayerBiome -+ */ -+ public net.minecraft.world.gen.layer.GenLayer getBiomeLayer(long worldSeed, net.minecraft.world.gen.layer.GenLayer parentLayer, net.minecraft.world.gen.ChunkGeneratorSettings chunkSettings) -+ { -+ net.minecraft.world.gen.layer.GenLayer ret = new net.minecraft.world.gen.layer.GenLayerBiome(200L, parentLayer, this, chunkSettings); -+ ret = net.minecraft.world.gen.layer.GenLayerZoom.func_75915_a(1000L, ret, 2); -+ ret = new net.minecraft.world.gen.layer.GenLayerBiomeEdge(1000L, ret); -+ return ret; -+ } - } diff --git a/patches_old/minecraft/net/minecraft/world/biome/Biome.java.patch b/patches_old/minecraft/net/minecraft/world/biome/Biome.java.patch deleted file mode 100644 index 1f9850b39..000000000 --- a/patches_old/minecraft/net/minecraft/world/biome/Biome.java.patch +++ /dev/null @@ -1,201 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/Biome.java -+++ ../src-work/minecraft/net/minecraft/world/biome/Biome.java -@@ -50,7 +50,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - --public abstract class Biome -+public abstract class Biome extends net.minecraftforge.registries.IForgeRegistryEntry.Impl - { - private static final Logger field_150586_aC = LogManager.getLogger(); - protected static final IBlockState field_185365_a = Blocks.field_150348_b.func_176223_P(); -@@ -68,7 +68,7 @@ - protected static final WorldGenTrees field_76757_N = new WorldGenTrees(false); - protected static final WorldGenBigTree field_76758_O = new WorldGenBigTree(false); - protected static final WorldGenSwamp field_76763_Q = new WorldGenSwamp(); -- public static final RegistryNamespaced field_185377_q = new RegistryNamespaced(); -+ public static final RegistryNamespaced field_185377_q = net.minecraftforge.registries.GameData.getWrapper(Biome.class); - private final String field_76791_y; - private final float field_76748_D; - private final float field_76749_E; -@@ -86,6 +86,8 @@ - protected List field_76762_K = Lists.newArrayList(); - protected List field_76755_L = Lists.newArrayList(); - protected List field_82914_M = Lists.newArrayList(); -+ // Forge: Stores the spawnable lists for non-vanilla EnumCreatureTypes. Can't be an EnumMap as that doesn't handle new enum values being added after it's created. -+ protected java.util.Map> modSpawnableLists = com.google.common.collect.Maps.newHashMap(); - - public static int func_185362_a(Biome p_185362_0_) - { -@@ -130,11 +132,12 @@ - this.field_76761_J.add(new Biome.SpawnListEntry(EntityWitch.class, 5, 1, 1)); - this.field_76755_L.add(new Biome.SpawnListEntry(EntitySquid.class, 10, 4, 4)); - this.field_82914_M.add(new Biome.SpawnListEntry(EntityBat.class, 10, 8, 8)); -+ this.addDefaultFlowers(); - } - - public BiomeDecorator func_76729_a() - { -- return new BiomeDecorator(); -+ return getModdedBiomeDecorator(new BiomeDecorator()); - } - - public boolean func_185363_b() -@@ -178,7 +181,9 @@ - case AMBIENT: - return this.field_82914_M; - default: -- return Collections.emptyList(); -+ // Forge: Return a non-empty list for non-vanilla EnumCreatureTypes -+ if (!this.modSpawnableLists.containsKey(p_76747_1_)) this.modSpawnableLists.put(p_76747_1_, Lists.newArrayList()); -+ return this.modSpawnableLists.get(p_76747_1_); - } - } - -@@ -230,7 +235,7 @@ - { - double d0 = (double)MathHelper.func_76131_a(this.func_180626_a(p_180627_1_), 0.0F, 1.0F); - double d1 = (double)MathHelper.func_76131_a(this.func_76727_i(), 0.0F, 1.0F); -- return ColorizerGrass.func_77480_a(d0, d1); -+ return getModdedBiomeGrassColor(ColorizerGrass.func_77480_a(d0, d1)); - } - - public final void func_180628_b(World p_180628_1_, Random p_180628_2_, ChunkPrimer p_180628_3_, int p_180628_4_, int p_180628_5_, double p_180628_6_) -@@ -323,7 +328,7 @@ - { - double d0 = (double)MathHelper.func_76131_a(this.func_180626_a(p_180625_1_), 0.0F, 1.0F); - double d1 = (double)MathHelper.func_76131_a(this.func_76727_i(), 0.0F, 1.0F); -- return ColorizerFoliage.func_77470_a(d0, d1); -+ return getModdedBiomeFoliageColor(ColorizerFoliage.func_77470_a(d0, d1)); - } - - public Class func_150562_l() -@@ -389,7 +394,7 @@ - @SideOnly(Side.CLIENT) - public final int func_185361_o() - { -- return this.field_76759_H; -+ return getWaterColorMultiplier(); - } - - public final boolean func_150559_j() -@@ -397,6 +402,84 @@ - return this.field_76766_R; - } - -+ /* ========================================= FORGE START ======================================*/ -+ protected List flowers = new java.util.ArrayList(); -+ -+ public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) -+ { -+ return new net.minecraftforge.event.terraingen.DeferredBiomeDecorator(original); -+ } -+ -+ public int getWaterColorMultiplier() -+ { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor(this, field_76759_H); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.getNewColor(); -+ } -+ -+ public int getModdedBiomeGrassColor(int original) -+ { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor(this, original); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.getNewColor(); -+ } -+ -+ public int getModdedBiomeFoliageColor(int original) -+ { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor(this, original); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.getNewColor(); -+ } -+ -+ /** -+ * Weighted random holder class used to hold possible flowers -+ * that can spawn in this biome when bonemeal is used on grass. -+ */ -+ public static class FlowerEntry extends WeightedRandom.Item -+ { -+ public final net.minecraft.block.state.IBlockState state; -+ public FlowerEntry(net.minecraft.block.state.IBlockState state, int weight) -+ { -+ super(weight); -+ this.state = state; -+ } -+ } -+ -+ /** -+ * Adds the default flowers, as of 1.7, it is 2 yellow, and 1 red. I chose 10 to allow some wiggle room in the numbers. -+ */ -+ public void addDefaultFlowers() -+ { -+ addFlower(Blocks.field_150327_N.func_176223_P().func_177226_a(Blocks.field_150327_N.func_176494_l(), BlockFlower.EnumFlowerType.DANDELION), 20); -+ addFlower(Blocks.field_150328_O.func_176223_P().func_177226_a(Blocks.field_150328_O.func_176494_l(), BlockFlower.EnumFlowerType.POPPY), 10); -+ } -+ -+ /** Register a new plant to be planted when bonemeal is used on grass. -+ * @param state The block to place. -+ * @param weight The weight of the plant, where red flowers are -+ * 10 and yellow flowers are 20. -+ */ -+ public void addFlower(IBlockState state, int weight) -+ { -+ this.flowers.add(new FlowerEntry(state, weight)); -+ } -+ -+ public void plantFlower(World world, Random rand, BlockPos pos) -+ { -+ if (flowers.isEmpty()) return; -+ FlowerEntry flower = (FlowerEntry)WeightedRandom.func_76271_a(rand, flowers); -+ if (flower == null || flower.state == null || -+ (flower.state.func_177230_c() instanceof net.minecraft.block.BlockBush && -+ !((net.minecraft.block.BlockBush)flower.state.func_177230_c()).func_180671_f(world, pos, flower.state))) -+ { -+ return; -+ } -+ -+ world.func_180501_a(pos, flower.state, 3); -+ } -+ -+ /* ========================================= FORGE END ======================================*/ -+ - public static void func_185358_q() - { - func_185354_a(0, "ocean", new BiomeOcean((new Biome.BiomeProperties("Ocean")).func_185398_c(-1.0F).func_185400_d(0.1F))); -@@ -552,6 +635,7 @@ - public Class field_76300_b; - public int field_76301_c; - public int field_76299_d; -+ private final java.lang.reflect.Constructor ctr; - - public SpawnListEntry(Class p_i1970_1_, int p_i1970_2_, int p_i1970_3_, int p_i1970_4_) - { -@@ -559,12 +643,26 @@ - this.field_76300_b = p_i1970_1_; - this.field_76301_c = p_i1970_3_; - this.field_76299_d = p_i1970_4_; -+ -+ try -+ { -+ ctr = p_i1970_1_.getConstructor(World.class); -+ } -+ catch (NoSuchMethodException e) -+ { -+ throw new RuntimeException(e); -+ } - } - - public String toString() - { - return this.field_76300_b.getSimpleName() + "*(" + this.field_76301_c + "-" + this.field_76299_d + "):" + this.field_76292_a; - } -+ -+ public EntityLiving newInstance(World world) throws Exception -+ { -+ return ctr.newInstance(world); -+ } - } - - public static enum TempCategory diff --git a/patches_old/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches_old/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch deleted file mode 100644 index 8e65db285..000000000 --- a/patches_old/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch +++ /dev/null @@ -1,168 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeDecorator.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDecorator.java -@@ -92,8 +92,11 @@ - - protected void func_150513_a(Biome p_150513_1_, World p_150513_2_, Random p_150513_3_) - { -+ net.minecraft.util.math.ChunkPos forgeChunkPos = new net.minecraft.util.math.ChunkPos(field_180294_c); // actual ChunkPos instead of BlockPos, used for events -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(p_150513_2_, p_150513_3_, forgeChunkPos)); - this.func_76797_b(p_150513_2_, p_150513_3_); - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, forgeChunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND)) - for (int i = 0; i < this.field_76805_H; ++i) - { - int j = p_150513_3_.nextInt(16) + 8; -@@ -101,6 +104,7 @@ - this.field_76810_g.func_180709_b(p_150513_2_, p_150513_3_, p_150513_2_.func_175672_r(this.field_180294_c.func_177982_a(j, 0, k))); - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, forgeChunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CLAY)) - for (int i1 = 0; i1 < this.field_76806_I; ++i1) - { - int l1 = p_150513_3_.nextInt(16) + 8; -@@ -108,6 +112,7 @@ - this.field_76809_f.func_180709_b(p_150513_2_, p_150513_3_, p_150513_2_.func_175672_r(this.field_180294_c.func_177982_a(l1, 0, i6))); - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, forgeChunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND_PASS2)) - for (int j1 = 0; j1 < this.field_76801_G; ++j1) - { - int i2 = p_150513_3_.nextInt(16) + 8; -@@ -122,6 +127,7 @@ - ++k1; - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, forgeChunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE)) - for (int j2 = 0; j2 < k1; ++j2) - { - int k6 = p_150513_3_.nextInt(16) + 8; -@@ -136,6 +142,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, forgeChunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.BIG_SHROOM)) - for (int k2 = 0; k2 < this.field_76807_J; ++k2) - { - int l6 = p_150513_3_.nextInt(16) + 8; -@@ -143,6 +150,7 @@ - this.field_76826_u.func_180709_b(p_150513_2_, p_150513_3_, p_150513_2_.func_175645_m(this.field_180294_c.func_177982_a(l6, 0, k10))); - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, forgeChunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS)) - for (int l2 = 0; l2 < this.field_76802_A; ++l2) - { - int i7 = p_150513_3_.nextInt(16) + 8; -@@ -164,6 +172,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, forgeChunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) - for (int i3 = 0; i3 < this.field_76803_B; ++i3) - { - int j7 = p_150513_3_.nextInt(16) + 8; -@@ -177,6 +186,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, forgeChunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.DEAD_BUSH)) - for (int j3 = 0; j3 < this.field_76804_C; ++j3) - { - int k7 = p_150513_3_.nextInt(16) + 8; -@@ -190,6 +200,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, forgeChunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LILYPAD)) - for (int k3 = 0; k3 < this.field_76833_y; ++k3) - { - int l7 = p_150513_3_.nextInt(16) + 8; -@@ -216,6 +227,8 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, forgeChunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) -+ { - for (int l3 = 0; l3 < this.field_76798_D; ++l3) - { - if (p_150513_3_.nextInt(4) == 0) -@@ -266,7 +279,9 @@ - this.field_76827_t.func_180709_b(p_150513_2_, p_150513_3_, this.field_180294_c.func_177982_a(j4, l15, l8)); - } - } -- -+ } // End of Mushroom generation -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, forgeChunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.REED)) -+ { - for (int k4 = 0; k4 < this.field_76799_E; ++k4) - { - int i9 = p_150513_3_.nextInt(16) + 8; -@@ -292,7 +307,8 @@ - this.field_76825_v.func_180709_b(p_150513_2_, p_150513_3_, this.field_180294_c.func_177982_a(j9, i19, i13)); - } - } -- -+ } // End of Reed generation -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, forgeChunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.PUMPKIN)) - if (p_150513_3_.nextInt(32) == 0) - { - int i5 = p_150513_3_.nextInt(16) + 8; -@@ -306,6 +322,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, forgeChunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CACTUS)) - for (int j5 = 0; j5 < this.field_76800_F; ++j5) - { - int l9 = p_150513_3_.nextInt(16) + 8; -@@ -321,6 +338,7 @@ - - if (this.field_76808_K) - { -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, forgeChunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_WATER)) - for (int k5 = 0; k5 < 50; ++k5) - { - int i10 = p_150513_3_.nextInt(16) + 8; -@@ -335,6 +353,7 @@ - } - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_150513_2_, p_150513_3_, forgeChunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_LAVA)) - for (int l5 = 0; l5 < 20; ++l5) - { - int j10 = p_150513_3_.nextInt(16) + 8; -@@ -344,21 +363,35 @@ - (new WorldGenLiquids(Blocks.field_150356_k)).func_180709_b(p_150513_2_, p_150513_3_, blockpos3); - } - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(p_150513_2_, p_150513_3_, forgeChunkPos)); - } - - protected void func_76797_b(World p_76797_1_, Random p_76797_2_) - { -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(p_76797_1_, p_76797_2_, field_180294_c)); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_76823_i, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIRT)) - this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177790_J, this.field_76823_i, this.field_180293_d.field_177791_K, this.field_180293_d.field_177784_L); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_76820_j, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRAVEL)) - this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177786_N, this.field_76820_j, this.field_180293_d.field_177787_O, this.field_180293_d.field_177797_P); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_180297_k, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIORITE)) - this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177795_V, this.field_180297_k, this.field_180293_d.field_177794_W, this.field_180293_d.field_177801_X); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_180296_j, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRANITE)) - this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177799_R, this.field_180296_j, this.field_180293_d.field_177798_S, this.field_180293_d.field_177793_T); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_180295_l, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.ANDESITE)) - this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177802_Z, this.field_180295_l, this.field_180293_d.field_177846_aa, this.field_180293_d.field_177847_ab); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_76821_k, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.COAL)) - this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177845_ad, this.field_76821_k, this.field_180293_d.field_177851_ae, this.field_180293_d.field_177853_af); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_76818_l, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.IRON)) - this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177849_ah, this.field_76818_l, this.field_180293_d.field_177832_ai, this.field_180293_d.field_177834_aj); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_76819_m, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GOLD)) - this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177830_al, this.field_76819_m, this.field_180293_d.field_177840_am, this.field_180293_d.field_177842_an); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_180299_p, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.REDSTONE)) - this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177838_ap, this.field_180299_p, this.field_180293_d.field_177818_aq, this.field_180293_d.field_177816_ar); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_180298_q, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIAMOND)) - this.func_76795_a(p_76797_1_, p_76797_2_, this.field_180293_d.field_177812_at, this.field_180298_q, this.field_180293_d.field_177826_au, this.field_180293_d.field_177824_av); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_76831_p, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.LAPIS)) - this.func_76793_b(p_76797_1_, p_76797_2_, this.field_180293_d.field_177820_ax, this.field_76831_p, this.field_180293_d.field_177807_ay, this.field_180293_d.field_177805_az); -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(p_76797_1_, p_76797_2_, field_180294_c)); - } - - protected void func_76795_a(World p_76795_1_, Random p_76795_2_, int p_76795_3_, WorldGenerator p_76795_4_, int p_76795_5_, int p_76795_6_) diff --git a/patches_old/minecraft/net/minecraft/world/biome/BiomeDesert.java.patch b/patches_old/minecraft/net/minecraft/world/biome/BiomeDesert.java.patch deleted file mode 100644 index 8ad23bf52..000000000 --- a/patches_old/minecraft/net/minecraft/world/biome/BiomeDesert.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeDesert.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDesert.java -@@ -47,6 +47,7 @@ - { - super.func_180624_a(p_180624_1_, p_180624_2_, p_180624_3_); - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_180624_1_, p_180624_2_, new net.minecraft.util.math.ChunkPos(p_180624_3_), net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.DESERT_WELL)) - if (p_180624_2_.nextInt(1000) == 0) - { - int i = p_180624_2_.nextInt(16) + 8; -@@ -55,6 +56,7 @@ - (new WorldGenDesertWells()).func_180709_b(p_180624_1_, p_180624_2_, blockpos); - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_180624_1_, p_180624_2_, new net.minecraft.util.math.ChunkPos(p_180624_3_), net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FOSSIL)) - if (p_180624_2_.nextInt(64) == 0) - { - (new WorldGenFossils()).func_180709_b(p_180624_1_, p_180624_2_, p_180624_3_); diff --git a/patches_old/minecraft/net/minecraft/world/biome/BiomeForest.java.patch b/patches_old/minecraft/net/minecraft/world/biome/BiomeForest.java.patch deleted file mode 100644 index 479715fa2..000000000 --- a/patches_old/minecraft/net/minecraft/world/biome/BiomeForest.java.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeForest.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeForest.java -@@ -46,6 +46,17 @@ - { - this.field_76760_I.field_76832_z = -999; - } -+ -+ if (this.field_150632_aF == BiomeForest.Type.FLOWER) //Needs to be done here so we have access to this.type -+ { -+ this.flowers.clear(); -+ for (BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) -+ { -+ if (type.func_176964_a() == BlockFlower.EnumFlowerColor.YELLOW) continue; -+ if (type == BlockFlower.EnumFlowerType.BLUE_ORCHID) type = BlockFlower.EnumFlowerType.POPPY; -+ addFlower(net.minecraft.init.Blocks.field_150328_O.func_176223_P().func_177226_a(net.minecraft.init.Blocks.field_150328_O.func_176494_l(), type), 10); -+ } -+ } - } - - public WorldGenAbstractTree func_150567_a(Random p_150567_1_) -@@ -85,6 +96,8 @@ - this.func_185379_b(p_180624_1_, p_180624_2_, p_180624_3_); - } - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_180624_1_, p_180624_2_, new net.minecraft.util.math.ChunkPos(p_180624_3_), net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS)) -+ { // no tab for patch - int i = p_180624_2_.nextInt(5) - 3; - - if (this.field_150632_aF == BiomeForest.Type.FLOWER) -@@ -93,11 +106,13 @@ - } - - this.func_185378_a(p_180624_1_, p_180624_2_, p_180624_3_, i); -+ } - super.func_180624_a(p_180624_1_, p_180624_2_, p_180624_3_); - } - - public void func_185379_b(World p_185379_1_, Random p_185379_2_, BlockPos p_185379_3_) - { -+ - for (int i = 0; i < 4; ++i) - { - for (int j = 0; j < 4; ++j) -@@ -106,12 +121,12 @@ - int l = j * 4 + 1 + 8 + p_185379_2_.nextInt(3); - BlockPos blockpos = p_185379_1_.func_175645_m(p_185379_3_.func_177982_a(k, 0, l)); - -- if (p_185379_2_.nextInt(20) == 0) -+ if (p_185379_2_.nextInt(20) == 0 && net.minecraftforge.event.terraingen.TerrainGen.decorate(p_185379_1_, p_185379_2_, new net.minecraft.util.math.ChunkPos(p_185379_3_), blockpos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.BIG_SHROOM)) - { - WorldGenBigMushroom worldgenbigmushroom = new WorldGenBigMushroom(); - worldgenbigmushroom.func_180709_b(p_185379_1_, p_185379_2_, blockpos); - } -- else -+ else if (net.minecraftforge.event.terraingen.TerrainGen.decorate(p_185379_1_, p_185379_2_, new net.minecraft.util.math.ChunkPos(p_185379_3_), blockpos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE)) - { - WorldGenAbstractTree worldgenabstracttree = this.func_150567_a(p_185379_2_); - worldgenabstracttree.func_175904_e(); diff --git a/patches_old/minecraft/net/minecraft/world/biome/BiomeHills.java.patch b/patches_old/minecraft/net/minecraft/world/biome/BiomeHills.java.patch deleted file mode 100644 index 7f25b2cc3..000000000 --- a/patches_old/minecraft/net/minecraft/world/biome/BiomeHills.java.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeHills.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeHills.java -@@ -39,28 +39,21 @@ - public void func_180624_a(World p_180624_1_, Random p_180624_2_, BlockPos p_180624_3_) - { - super.func_180624_a(p_180624_1_, p_180624_2_, p_180624_3_); -- int i = 3 + p_180624_2_.nextInt(6); - -- for (int j = 0; j < i; ++j) -- { -- int k = p_180624_2_.nextInt(16); -- int l = p_180624_2_.nextInt(28) + 4; -- int i1 = p_180624_2_.nextInt(16); -- BlockPos blockpos = p_180624_3_.func_177982_a(k, l, i1); -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(p_180624_1_, p_180624_2_, p_180624_3_)); -+ WorldGenerator emeralds = new EmeraldGenerator(); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_180624_1_, p_180624_2_, emeralds, p_180624_3_, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.EMERALD)) -+ emeralds.func_180709_b(p_180624_1_, p_180624_2_, p_180624_3_); - -- if (p_180624_1_.func_180495_p(blockpos).func_177230_c() == Blocks.field_150348_b) -- { -- p_180624_1_.func_180501_a(blockpos, Blocks.field_150412_bA.func_176223_P(), 2); -- } -- } -- - for (int j1 = 0; j1 < 7; ++j1) - { - int k1 = p_180624_2_.nextInt(16); - int l1 = p_180624_2_.nextInt(64); - int i2 = p_180624_2_.nextInt(16); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_180624_1_, p_180624_2_, field_82915_S, p_180624_3_.func_177982_a(j1, k1, l1), net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.SILVERFISH)) - this.field_82915_S.func_180709_b(p_180624_1_, p_180624_2_, p_180624_3_.func_177982_a(k1, l1, i2)); - } -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(p_180624_1_, p_180624_2_, p_180624_3_)); - } - - public void func_180622_a(World p_180622_1_, Random p_180622_2_, ChunkPrimer p_180622_3_, int p_180622_4_, int p_180622_5_, double p_180622_6_) -@@ -88,4 +81,25 @@ - EXTRA_TREES, - MUTATED; - } -+ -+ private static class EmeraldGenerator extends WorldGenerator -+ { -+ @Override -+ public boolean func_180709_b(World worldIn, Random rand, BlockPos pos) -+ { -+ int count = 3 + rand.nextInt(6); -+ for (int i = 0; i < count; i++) -+ { -+ int offset = net.minecraftforge.common.ForgeModContainer.fixVanillaCascading ? 8 : 0; // MC-114332 -+ BlockPos blockpos = pos.func_177982_a(rand.nextInt(16) + offset, rand.nextInt(28) + 4, rand.nextInt(16) + offset); -+ -+ net.minecraft.block.state.IBlockState state = worldIn.func_180495_p(blockpos); -+ if (state.func_177230_c().isReplaceableOreGen(state, worldIn, blockpos, net.minecraft.block.state.pattern.BlockMatcher.func_177642_a(Blocks.field_150348_b))) -+ { -+ worldIn.func_180501_a(blockpos, Blocks.field_150412_bA.func_176223_P(), 16 | 2); -+ } -+ } -+ return true; -+ } -+ } - } diff --git a/patches_old/minecraft/net/minecraft/world/biome/BiomeJungle.java.patch b/patches_old/minecraft/net/minecraft/world/biome/BiomeJungle.java.patch deleted file mode 100644 index 6b4b003a1..000000000 --- a/patches_old/minecraft/net/minecraft/world/biome/BiomeJungle.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeJungle.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeJungle.java -@@ -81,10 +81,14 @@ - super.func_180624_a(p_180624_1_, p_180624_2_, p_180624_3_); - int i = p_180624_2_.nextInt(16) + 8; - int j = p_180624_2_.nextInt(16) + 8; -- int k = p_180624_2_.nextInt(p_180624_1_.func_175645_m(p_180624_3_.func_177982_a(i, 0, j)).func_177956_o() * 2); -+ int height = p_180624_1_.func_175645_m(p_180624_3_.func_177982_a(i, 0, j)).func_177956_o() * 2; // could == 0, which crashes nextInt -+ if (height < 1) height = 1; -+ int k = p_180624_2_.nextInt(height); -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_180624_1_, p_180624_2_, new net.minecraft.util.math.ChunkPos(p_180624_3_), p_180624_3_.func_177982_a(i, k, j), net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.PUMPKIN)) - (new WorldGenMelon()).func_180709_b(p_180624_1_, p_180624_2_, p_180624_3_.func_177982_a(i, k, j)); - WorldGenVines worldgenvines = new WorldGenVines(); - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_180624_1_, p_180624_2_, new net.minecraft.util.math.ChunkPos(p_180624_3_), net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) - for (int j1 = 0; j1 < 50; ++j1) - { - k = p_180624_2_.nextInt(16) + 8; diff --git a/patches_old/minecraft/net/minecraft/world/biome/BiomeMesa.java.patch b/patches_old/minecraft/net/minecraft/world/biome/BiomeMesa.java.patch deleted file mode 100644 index 5f13874f7..000000000 --- a/patches_old/minecraft/net/minecraft/world/biome/BiomeMesa.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeMesa.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeMesa.java -@@ -318,13 +318,13 @@ - @SideOnly(Side.CLIENT) - public int func_180625_c(BlockPos p_180625_1_) - { -- return 10387789; -+ return getModdedBiomeFoliageColor(10387789); - } - - @SideOnly(Side.CLIENT) - public int func_180627_b(BlockPos p_180627_1_) - { -- return 9470285; -+ return getModdedBiomeGrassColor(9470285); - } - - class Decorator extends BiomeDecorator -@@ -336,6 +336,7 @@ - protected void func_76797_b(World p_76797_1_, Random p_76797_2_) - { - super.func_76797_b(p_76797_1_, p_76797_2_); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_76797_1_, p_76797_2_, field_76819_m, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GOLD)) - this.func_76795_a(p_76797_1_, p_76797_2_, 20, this.field_76819_m, 32, 80); - } - } diff --git a/patches_old/minecraft/net/minecraft/world/biome/BiomePlains.java.patch b/patches_old/minecraft/net/minecraft/world/biome/BiomePlains.java.patch deleted file mode 100644 index 71561fc4c..000000000 --- a/patches_old/minecraft/net/minecraft/world/biome/BiomePlains.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomePlains.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomePlains.java -@@ -80,6 +80,7 @@ - this.field_76760_I.field_76803_B = 10; - field_180280_ag.func_180710_a(BlockDoublePlant.EnumPlantType.GRASS); - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_180624_1_, p_180624_2_, new net.minecraft.util.math.ChunkPos(p_180624_3_), net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) - for (int i = 0; i < 7; ++i) - { - int j = p_180624_2_.nextInt(16) + 8; -@@ -89,7 +90,7 @@ - } - } - -- if (this.field_150628_aC) -+ if (this.field_150628_aC && net.minecraftforge.event.terraingen.TerrainGen.decorate(p_180624_1_, p_180624_2_, new net.minecraft.util.math.ChunkPos(p_180624_3_), net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS)) - { - field_180280_ag.func_180710_a(BlockDoublePlant.EnumPlantType.SUNFLOWER); - -@@ -105,6 +106,21 @@ - super.func_180624_a(p_180624_1_, p_180624_2_, p_180624_3_); - } - -+ @Override -+ public void addDefaultFlowers() -+ { -+ BlockFlower red = net.minecraft.init.Blocks.field_150328_O; -+ BlockFlower yel = net.minecraft.init.Blocks.field_150327_N; -+ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.ORANGE_TULIP), 3); -+ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.RED_TULIP), 3); -+ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.PINK_TULIP), 3); -+ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.WHITE_TULIP), 3); -+ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.POPPY), 20); -+ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.HOUSTONIA), 20); -+ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.OXEYE_DAISY), 20); -+ addFlower(yel.func_176223_P().func_177226_a(yel.func_176494_l(), BlockFlower.EnumFlowerType.DANDELION), 30); -+ } -+ - public WorldGenAbstractTree func_150567_a(Random p_150567_1_) - { - return (WorldGenAbstractTree)(p_150567_1_.nextInt(3) == 0 ? field_76758_O : field_76757_N); diff --git a/patches_old/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch b/patches_old/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch deleted file mode 100644 index 2506b7829..000000000 --- a/patches_old/minecraft/net/minecraft/world/biome/BiomeProvider.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeProvider.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeProvider.java -@@ -22,11 +22,12 @@ - private GenLayer field_76945_e; - private final BiomeCache field_76942_f; - private final List field_76943_g; -+ public static List allowedBiomes = Lists.newArrayList(Biomes.field_76767_f, Biomes.field_76772_c, Biomes.field_76768_g, Biomes.field_76784_u, Biomes.field_76785_t, Biomes.field_76782_w, Biomes.field_76792_x); - - protected BiomeProvider() - { - this.field_76942_f = new BiomeCache(this); -- this.field_76943_g = Lists.newArrayList(Biomes.field_76767_f, Biomes.field_76772_c, Biomes.field_76768_g, Biomes.field_76784_u, Biomes.field_76785_t, Biomes.field_76782_w, Biomes.field_76792_x); -+ this.field_76943_g = Lists.newArrayList(allowedBiomes); - } - - private BiomeProvider(long p_i45744_1_, WorldType p_i45744_3_, String p_i45744_4_) -@@ -39,6 +40,7 @@ - } - - GenLayer[] agenlayer = GenLayer.func_180781_a(p_i45744_1_, p_i45744_3_, this.field_190945_a); -+ agenlayer = getModdedBiomeGenerators(p_i45744_3_, p_i45744_1_, agenlayer); - this.field_76944_d = agenlayer[0]; - this.field_76945_e = agenlayer[1]; - } -@@ -207,6 +209,13 @@ - this.field_76942_f.func_76838_a(); - } - -+ public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original) -+ { -+ net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens event = new net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens(worldType, seed, original); -+ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ return event.getNewBiomeGens(); -+ } -+ - public boolean func_190944_c() - { - return this.field_190945_a != null && this.field_190945_a.field_177779_F >= 0; diff --git a/patches_old/minecraft/net/minecraft/world/biome/BiomeSavanna.java.patch b/patches_old/minecraft/net/minecraft/world/biome/BiomeSavanna.java.patch deleted file mode 100644 index 5ba3254b4..000000000 --- a/patches_old/minecraft/net/minecraft/world/biome/BiomeSavanna.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeSavanna.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeSavanna.java -@@ -39,6 +39,7 @@ - { - field_180280_ag.func_180710_a(BlockDoublePlant.EnumPlantType.GRASS); - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_180624_1_, p_180624_2_, new net.minecraft.util.math.ChunkPos(p_180624_3_), net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) - for (int i = 0; i < 7; ++i) - { - int j = p_180624_2_.nextInt(16) + 8; diff --git a/patches_old/minecraft/net/minecraft/world/biome/BiomeSnow.java.patch b/patches_old/minecraft/net/minecraft/world/biome/BiomeSnow.java.patch deleted file mode 100644 index 01957a696..000000000 --- a/patches_old/minecraft/net/minecraft/world/biome/BiomeSnow.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeSnow.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeSnow.java -@@ -56,7 +56,7 @@ - - public void func_180624_a(World p_180624_1_, Random p_180624_2_, BlockPos p_180624_3_) - { -- if (this.field_150615_aC) -+ if (this.field_150615_aC && net.minecraftforge.event.terraingen.TerrainGen.decorate(p_180624_1_, p_180624_2_, new net.minecraft.util.math.ChunkPos(p_180624_3_), net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.ICE)) - { - for (int i = 0; i < 3; ++i) - { diff --git a/patches_old/minecraft/net/minecraft/world/biome/BiomeSwamp.java.patch b/patches_old/minecraft/net/minecraft/world/biome/BiomeSwamp.java.patch deleted file mode 100644 index b39501ffa..000000000 --- a/patches_old/minecraft/net/minecraft/world/biome/BiomeSwamp.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeSwamp.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeSwamp.java -@@ -79,6 +79,7 @@ - { - super.func_180624_a(p_180624_1_, p_180624_2_, p_180624_3_); - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_180624_1_, p_180624_2_, new net.minecraft.util.math.ChunkPos(p_180624_3_), net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FOSSIL)) - if (p_180624_2_.nextInt(64) == 0) - { - (new WorldGenFossils()).func_180709_b(p_180624_1_, p_180624_2_, p_180624_3_); -@@ -89,12 +90,18 @@ - public int func_180627_b(BlockPos p_180627_1_) - { - double d0 = field_180281_af.func_151601_a((double)p_180627_1_.func_177958_n() * 0.0225D, (double)p_180627_1_.func_177952_p() * 0.0225D); -- return d0 < -0.1D ? 5011004 : 6975545; -+ return getModdedBiomeGrassColor(d0 < -0.1D ? 5011004 : 6975545); - } - - @SideOnly(Side.CLIENT) - public int func_180625_c(BlockPos p_180625_1_) - { -- return 6975545; -+ return getModdedBiomeFoliageColor(6975545); - } -+ -+ @Override -+ public void addDefaultFlowers() -+ { -+ addFlower(Blocks.field_150328_O.func_176223_P().func_177226_a(Blocks.field_150328_O.func_176494_l(), BlockFlower.EnumFlowerType.BLUE_ORCHID), 10); -+ } - } diff --git a/patches_old/minecraft/net/minecraft/world/biome/BiomeTaiga.java.patch b/patches_old/minecraft/net/minecraft/world/biome/BiomeTaiga.java.patch deleted file mode 100644 index 575398368..000000000 --- a/patches_old/minecraft/net/minecraft/world/biome/BiomeTaiga.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeTaiga.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeTaiga.java -@@ -67,7 +67,7 @@ - - public void func_180624_a(World p_180624_1_, Random p_180624_2_, BlockPos p_180624_3_) - { -- if (this.field_150644_aH == BiomeTaiga.Type.MEGA || this.field_150644_aH == BiomeTaiga.Type.MEGA_SPRUCE) -+ if ((this.field_150644_aH == BiomeTaiga.Type.MEGA || this.field_150644_aH == BiomeTaiga.Type.MEGA_SPRUCE) && net.minecraftforge.event.terraingen.TerrainGen.decorate(p_180624_1_, p_180624_2_, new net.minecraft.util.math.ChunkPos(p_180624_3_), net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.ROCK)) - { - int i = p_180624_2_.nextInt(3); - -@@ -82,6 +82,7 @@ - - field_180280_ag.func_180710_a(BlockDoublePlant.EnumPlantType.FERN); - -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(p_180624_1_, p_180624_2_, new net.minecraft.util.math.ChunkPos(p_180624_3_), net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS)) - for (int i1 = 0; i1 < 7; ++i1) - { - int j1 = p_180624_2_.nextInt(16) + 8; diff --git a/patches_old/minecraft/net/minecraft/world/border/WorldBorder.java.patch b/patches_old/minecraft/net/minecraft/world/border/WorldBorder.java.patch deleted file mode 100644 index fea866e4c..000000000 --- a/patches_old/minecraft/net/minecraft/world/border/WorldBorder.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/border/WorldBorder.java -+++ ../src-work/minecraft/net/minecraft/world/border/WorldBorder.java -@@ -284,4 +284,9 @@ - iborderlistener.func_177690_b(this, p_177747_1_); - } - } -+ -+ public void removeListener(IBorderListener listener) -+ { -+ this.field_177758_a.remove(listener); -+ } - } diff --git a/patches_old/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch b/patches_old/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch deleted file mode 100644 index ed98b669a..000000000 --- a/patches_old/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/BlockStateContainer.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/BlockStateContainer.java -@@ -30,6 +30,10 @@ - - private void func_186012_b(int p_186012_1_) - { -+ setBits(p_186012_1_, false); -+ } -+ private void setBits(int p_186012_1_, boolean forceBits) -+ { - if (p_186012_1_ != this.field_186024_e) - { - this.field_186024_e = p_186012_1_; -@@ -47,6 +51,8 @@ - { - this.field_186022_c = field_186023_d; - this.field_186024_e = MathHelper.func_151241_e(Block.field_176229_d.func_186804_a()); -+ if (forceBits) -+ this.field_186024_e = p_186012_1_; - } - - this.field_186022_c.func_186041_a(field_186020_a); -@@ -102,11 +108,15 @@ - - if (this.field_186024_e != i) - { -- this.func_186012_b(i); -+ this.setBits(i, true); //Forge, Force bit density to fix network issues, resize below if needed. - } - - this.field_186022_c.func_186038_a(p_186010_1_); - p_186010_1_.func_186873_b(this.field_186021_b.func_188143_a()); -+ -+ int regSize = MathHelper.func_151241_e(Block.field_176229_d.func_186804_a()); -+ if (this.field_186022_c == field_186023_d && this.field_186024_e != regSize) // Resize bits to fit registry. -+ this.func_186008_a(regSize, field_186020_a); - } - - public void func_186009_b(PacketBuffer p_186009_1_) diff --git a/patches_old/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch b/patches_old/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch deleted file mode 100644 index 38e5ac4e7..000000000 --- a/patches_old/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java -@@ -22,18 +22,12 @@ - { - File file1 = this.func_75765_b(); - -- if (p_75763_1_ instanceof WorldProviderHell) -+ if (p_75763_1_.getSaveFolder() != null) - { -- File file3 = new File(file1, "DIM-1"); -+ File file3 = new File(file1, p_75763_1_.getSaveFolder()); - file3.mkdirs(); - return new AnvilChunkLoader(file3, this.field_186341_a); - } -- else if (p_75763_1_ instanceof WorldProviderEnd) -- { -- File file2 = new File(file1, "DIM1"); -- file2.mkdirs(); -- return new AnvilChunkLoader(file2, this.field_186341_a); -- } - else - { - return new AnvilChunkLoader(file1, this.field_186341_a); diff --git a/patches_old/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch b/patches_old/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch deleted file mode 100644 index 945276017..000000000 --- a/patches_old/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java -@@ -34,6 +34,8 @@ - - public void func_177484_a(int p_177484_1_, int p_177484_2_, int p_177484_3_, IBlockState p_177484_4_) - { -+ if (p_177484_4_ instanceof net.minecraftforge.common.property.IExtendedBlockState) -+ p_177484_4_ = ((net.minecraftforge.common.property.IExtendedBlockState) p_177484_4_).getClean(); - IBlockState iblockstate = this.func_177485_a(p_177484_1_, p_177484_2_, p_177484_3_); - Block block = iblockstate.func_177230_c(); - Block block1 = p_177484_4_.func_177230_c(); diff --git a/patches_old/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches_old/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch deleted file mode 100644 index 59c2aaaf2..000000000 --- a/patches_old/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/RegionFile.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/RegionFile.java -@@ -95,6 +95,12 @@ - } - } - -+ @Deprecated // TODO: remove (1.13) -+ public synchronized boolean chunkExists(int x, int z) -+ { -+ return func_76709_c(x, z); -+ } -+ - @Nullable - - public synchronized DataInputStream func_76704_a(int p_76704_1_, int p_76704_2_) diff --git a/patches_old/minecraft/net/minecraft/world/end/DragonFightManager.java.patch b/patches_old/minecraft/net/minecraft/world/end/DragonFightManager.java.patch deleted file mode 100644 index 1232aa902..000000000 --- a/patches_old/minecraft/net/minecraft/world/end/DragonFightManager.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/end/DragonFightManager.java -+++ ../src-work/minecraft/net/minecraft/world/end/DragonFightManager.java -@@ -82,6 +82,7 @@ - - this.field_186117_k = p_i46669_2_.func_74767_n("DragonKilled"); - this.field_186118_l = p_i46669_2_.func_74767_n("PreviouslyKilled"); -+ this.field_186120_n = !p_i46669_2_.func_74767_n("LegacyScanPerformed"); // Forge: fix MC-105080 - - if (p_i46669_2_.func_74767_n("IsRespawning")) - { -@@ -128,6 +129,7 @@ - - nbttagcompound.func_74757_a("DragonKilled", this.field_186117_k); - nbttagcompound.func_74757_a("PreviouslyKilled", this.field_186118_l); -+ nbttagcompound.func_74757_a("LegacyScanPerformed", !this.field_186120_n); // Forge: fix MC-105080 - - if (this.field_186121_o != null) - { -@@ -582,4 +584,14 @@ - } - } - } -+ -+ public void addPlayer(EntityPlayerMP player) -+ { -+ this.field_186109_c.func_186760_a(player); -+ } -+ -+ public void removePlayer(EntityPlayerMP player) -+ { -+ this.field_186109_c.func_186761_b(player); -+ } - } diff --git a/patches_old/minecraft/net/minecraft/world/storage/DerivedWorldInfo.java.patch b/patches_old/minecraft/net/minecraft/world/storage/DerivedWorldInfo.java.patch deleted file mode 100644 index 7c992734a..000000000 --- a/patches_old/minecraft/net/minecraft/world/storage/DerivedWorldInfo.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/DerivedWorldInfo.java -+++ ../src-work/minecraft/net/minecraft/world/storage/DerivedWorldInfo.java -@@ -218,13 +218,25 @@ - { - } - -+ @Deprecated - public void func_186345_a(DimensionType p_186345_1_, NBTTagCompound p_186345_2_) - { - this.field_76115_a.func_186345_a(p_186345_1_, p_186345_2_); - } - -+ @Deprecated - public NBTTagCompound func_186347_a(DimensionType p_186347_1_) - { - return this.field_76115_a.func_186347_a(p_186347_1_); - } -+ -+ public void setDimensionData(int dimensionID, NBTTagCompound compound) -+ { -+ this.field_76115_a.setDimensionData(dimensionID, compound); -+ } -+ -+ public NBTTagCompound getDimensionData(int dimensionID) -+ { -+ return this.field_76115_a.getDimensionData(dimensionID); -+ } - } diff --git a/patches_old/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches_old/minecraft/net/minecraft/world/storage/MapData.java.patch deleted file mode 100644 index df1ee059a..000000000 --- a/patches_old/minecraft/net/minecraft/world/storage/MapData.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/MapData.java -+++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java -@@ -20,7 +20,7 @@ - { - public int field_76201_a; - public int field_76199_b; -- public byte field_76200_c; -+ public int field_76200_c; //FML byte -> int - public boolean field_186210_e; - public boolean field_191096_f; - public byte field_76197_d; -@@ -45,7 +45,7 @@ - - public void func_76184_a(NBTTagCompound p_76184_1_) - { -- this.field_76200_c = p_76184_1_.func_74771_c("dimension"); -+ this.field_76200_c = p_76184_1_.func_74762_e("dimension"); - this.field_76201_a = p_76184_1_.func_74762_e("xCenter"); - this.field_76199_b = p_76184_1_.func_74762_e("zCenter"); - this.field_76197_d = p_76184_1_.func_74771_c("scale"); -@@ -97,7 +97,7 @@ - - public NBTTagCompound func_189551_b(NBTTagCompound p_189551_1_) - { -- p_189551_1_.func_74774_a("dimension", this.field_76200_c); -+ p_189551_1_.func_74768_a("dimension", this.field_76200_c); - p_189551_1_.func_74768_a("xCenter", this.field_76201_a); - p_189551_1_.func_74768_a("zCenter", this.field_76199_b); - p_189551_1_.func_74774_a("scale", this.field_76197_d); -@@ -208,9 +208,9 @@ - p_191095_8_ = p_191095_8_ + (p_191095_8_ < 0.0D ? -8.0D : 8.0D); - b2 = (byte)((int)(p_191095_8_ * 16.0D / 360.0D)); - -- if (this.field_76200_c < 0) -+ if (p_191095_2_.field_73011_w.shouldMapSpin(p_191095_3_, p_191095_4_, p_191095_6_, p_191095_8_)) - { -- int l = (int)(p_191095_2_.func_72912_H().func_76073_f() / 10L); -+ int l = (int)(p_191095_2_.func_72820_D() / 10L); - b2 = (byte)(l * l * 34187121 + l * 121 >> 15 & 15); - } - } diff --git a/patches_old/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch b/patches_old/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch deleted file mode 100644 index 60f926478..000000000 --- a/patches_old/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/SaveFormatOld.java -+++ ../src-work/minecraft/net/minecraft/world/storage/SaveFormatOld.java -@@ -109,6 +109,24 @@ - } - } - -+ //Forge: Special version of the above that runs during actual world loading and not metadata gathering. -+ public static WorldInfo loadAndFix(File file, DataFixer fixer, SaveHandler save) -+ { -+ try -+ { -+ NBTTagCompound nbt = CompressedStreamTools.func_74796_a(new FileInputStream(file)); -+ WorldInfo info = new WorldInfo(fixer.func_188257_a(FixTypes.LEVEL, nbt.func_74775_l("Data"))); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(save, info, nbt); -+ return info; -+ } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) { throw e; } -+ catch (Exception exception) -+ { -+ field_151479_b.error((String)("Exception reading " + file), (Throwable)exception); -+ return null; -+ } -+ } -+ - @SideOnly(Side.CLIENT) - public void func_75806_a(String p_75806_1_, String p_75806_2_) - { diff --git a/patches_old/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches_old/minecraft/net/minecraft/world/storage/SaveHandler.java.patch deleted file mode 100644 index c297315d0..000000000 --- a/patches_old/minecraft/net/minecraft/world/storage/SaveHandler.java.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java -+++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java -@@ -119,7 +119,7 @@ - - if (file1.exists()) - { -- WorldInfo worldinfo = SaveFormatOld.func_186353_a(file1, this.field_186341_a); -+ WorldInfo worldinfo = SaveFormatOld.loadAndFix(file1, this.field_186341_a, this); - - if (worldinfo != null) - { -@@ -127,8 +127,9 @@ - } - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); - file1 = new File(this.field_75770_b, "level.dat_old"); -- return file1.exists() ? SaveFormatOld.func_186353_a(file1, this.field_186341_a) : null; -+ return file1.exists() ? SaveFormatOld.loadAndFix(file1, this.field_186341_a, this) : null; - } - - public void func_75755_a(WorldInfo p_75755_1_, @Nullable NBTTagCompound p_75755_2_) -@@ -137,6 +138,8 @@ - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.func_74782_a("Data", nbttagcompound); - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, p_75755_1_, nbttagcompound1); -+ - try - { - File file1 = new File(this.field_75770_b, "level.dat_new"); -@@ -189,6 +192,7 @@ - } - - file1.renameTo(file2); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_75753_1_, this.field_75771_c, p_75753_1_.func_110124_au().toString()); - } - catch (Exception var5) - { -@@ -220,6 +224,7 @@ - p_75752_1_.func_70020_e(this.field_186341_a.func_188257_a(FixTypes.PLAYER, nbttagcompound)); - } - -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_75752_1_, field_75771_c, p_75752_1_.func_110124_au().toString()); - return nbttagcompound; - } - -@@ -261,4 +266,22 @@ - { - return this.field_186342_h; - } -+ -+ public NBTTagCompound getPlayerNBT(net.minecraft.entity.player.EntityPlayerMP player) -+ { -+ try -+ { -+ File file1 = new File(this.field_75771_c, player.func_110124_au().toString() + ".dat"); -+ -+ if (file1.exists() && file1.isFile()) -+ { -+ return CompressedStreamTools.func_74796_a(new FileInputStream(file1)); -+ } -+ } -+ catch (Exception exception) -+ { -+ field_151478_a.warn("Failed to load player data for " + player.func_70005_c_()); -+ } -+ return null; -+ } - } diff --git a/patches_old/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches_old/minecraft/net/minecraft/world/storage/WorldInfo.java.patch deleted file mode 100644 index 798480c46..000000000 --- a/patches_old/minecraft/net/minecraft/world/storage/WorldInfo.java.patch +++ /dev/null @@ -1,103 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java -+++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java -@@ -63,8 +63,9 @@ - private double field_176153_H = 0.2D; - private int field_176154_I = 5; - private int field_176155_J = 15; -- private final Map field_186348_N = Maps.newEnumMap(DimensionType.class); -+ private final Map field_186348_N = Maps.newHashMap(); - private GameRules field_82577_x = new GameRules(); -+ private java.util.Map additionalProperties; - - protected WorldInfo() - { -@@ -251,7 +252,7 @@ - - for (String s : nbttagcompound1.func_150296_c()) - { -- this.field_186348_N.put(DimensionType.func_186069_a(Integer.parseInt(s)), nbttagcompound1.func_74775_l(s)); -+ this.field_186348_N.put(Integer.parseInt(s), nbttagcompound1.func_74775_l(s)); - } - } - } -@@ -366,6 +367,7 @@ - p_76064_1_.func_74780_a("BorderSizeLerpTarget", this.field_176148_F); - p_76064_1_.func_74780_a("BorderWarningBlocks", (double)this.field_176154_I); - p_76064_1_.func_74780_a("BorderWarningTime", (double)this.field_176155_J); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().getDataFixer().writeVersionData(p_76064_1_); - - if (this.field_176158_z != null) - { -@@ -376,9 +378,10 @@ - p_76064_1_.func_74782_a("GameRules", this.field_82577_x.func_82770_a()); - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - -- for (Entry entry : this.field_186348_N.entrySet()) -+ for (Entry entry : this.field_186348_N.entrySet()) - { -- nbttagcompound1.func_74782_a(String.valueOf(((DimensionType)entry.getKey()).func_186068_a()), entry.getValue()); -+ if (entry.getValue() == null || entry.getValue().func_82582_d()) continue; -+ nbttagcompound1.func_74782_a(String.valueOf(entry.getKey()), entry.getValue()); - } - - p_76064_1_.func_74782_a("DimensionData", nbttagcompound1); -@@ -708,6 +711,7 @@ - - public void func_176144_a(EnumDifficulty p_176144_1_) - { -+ net.minecraftforge.common.ForgeHooks.onDifficultyChange(p_176144_1_, this.field_176158_z); - this.field_176158_z = p_176144_1_; - } - -@@ -805,18 +809,49 @@ - } - }); - } -+ /** -+ * Allow access to additional mod specific world based properties -+ * Used by FML to store mod list associated with a world, and maybe an id map -+ * Used by Forge to store the dimensions available to a world -+ * @param additionalProperties -+ */ -+ public void setAdditionalProperties(java.util.Map additionalProperties) -+ { -+ // one time set for this -+ if (this.additionalProperties == null) -+ { -+ this.additionalProperties = additionalProperties; -+ } -+ } - -+ public net.minecraft.nbt.NBTBase getAdditionalProperty(String additionalProperty) -+ { -+ return this.additionalProperties!=null? this.additionalProperties.get(additionalProperty) : null; -+ } -+ -+ @Deprecated //Use the int version below, and pass in dimension id NOT TYPE id - public NBTTagCompound func_186347_a(DimensionType p_186347_1_) - { -- NBTTagCompound nbttagcompound = this.field_186348_N.get(p_186347_1_); -+ return getDimensionData(p_186347_1_.func_186068_a()); -+ } -+ public NBTTagCompound getDimensionData(int dimensionIn) -+ { -+ NBTTagCompound nbttagcompound = this.field_186348_N.get(dimensionIn); - return nbttagcompound == null ? new NBTTagCompound() : nbttagcompound; - } - -+ @Deprecated //Use the int version below, and pass in dimension id NOT TYPE id - public void func_186345_a(DimensionType p_186345_1_, NBTTagCompound p_186345_2_) - { -- this.field_186348_N.put(p_186345_1_, p_186345_2_); -+ this.setDimensionData(p_186345_1_.func_186068_a(), p_186345_2_); - } - -+ //Dimension numerical ID version of setter, as two dimensions could in theory have the same DimensionType. ID should be grabbed from the world NOT the Type -+ public void setDimensionData(int dimensionID, NBTTagCompound compound) -+ { -+ this.field_186348_N.put(dimensionID, compound); -+ } -+ - @SideOnly(Side.CLIENT) - public int func_186344_K() - { diff --git a/patches_old/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch b/patches_old/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch deleted file mode 100644 index 2849daca6..000000000 --- a/patches_old/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/WorldSavedData.java -+++ ../src-work/minecraft/net/minecraft/world/storage/WorldSavedData.java -@@ -2,7 +2,7 @@ - - import net.minecraft.nbt.NBTTagCompound; - --public abstract class WorldSavedData -+public abstract class WorldSavedData implements net.minecraftforge.common.util.INBTSerializable - { - public final String field_76190_i; - private boolean field_76189_a; -@@ -30,4 +30,14 @@ - { - return this.field_76189_a; - } -+ -+ public void deserializeNBT(NBTTagCompound nbt) -+ { -+ this.func_76184_a(nbt); -+ } -+ -+ public NBTTagCompound serializeNBT() -+ { -+ return this.func_189551_b(new NBTTagCompound()); -+ } - } diff --git a/patches_old/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches_old_unknown/AnvilChunkLoader.java.patch similarity index 55% rename from patches_old/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch rename to patches_old_unknown/AnvilChunkLoader.java.patch index 2d4bf100d..7ce27f8f7 100644 --- a/patches_old/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch +++ b/patches_old_unknown/AnvilChunkLoader.java.patch @@ -3,13 +3,7 @@ @@ -49,9 +49,31 @@ this.field_193416_e = p_i46673_2_; } - -+ @Deprecated // TODO: remove (1.13) -+ public boolean chunkExists(World world, int x, int z) -+ { -+ return func_191063_a(x, z); -+ } -+ + @Nullable public Chunk func_75815_a(World p_75815_1_, int p_75815_2_, int p_75815_3_) throws IOException { @@ -92,100 +86,6 @@ nbttagcompound.func_74768_a("DataVersion", 1343); + net.minecraftforge.fml.common.FMLCommonHandler.instance().getDataFixer().writeVersionData(nbttagcompound); this.func_75820_a(p_75816_2_, p_75816_1_, nbttagcompound1); -+ net.minecraftforge.common.ForgeChunkManager.storeChunkNBT(p_75816_2_, nbttagcompound1); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(p_75816_2_, nbttagcompound)); this.func_75824_a(p_75816_2_.func_76632_l(), nbttagcompound); } catch (Exception exception) -@@ -305,11 +356,19 @@ - { - NBTTagCompound nbttagcompound2 = new NBTTagCompound(); - -+ try -+ { - if (entity.func_70039_c(nbttagcompound2)) - { - p_75820_1_.func_177409_g(true); - nbttaglist1.func_74742_a(nbttagcompound2); - } -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log.error("An Entity type {} has thrown an exception trying to write state. It will not persist. Report this to the mod author", -+ entity.getClass().getName(), e); -+ } - } - } - -@@ -318,8 +377,16 @@ - - for (TileEntity tileentity : p_75820_1_.func_177434_r().values()) - { -+ try -+ { - NBTTagCompound nbttagcompound3 = tileentity.func_189515_b(new NBTTagCompound()); - nbttaglist2.func_74742_a(nbttagcompound3); -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log.error("A TileEntity type {} has throw an exception trying to write state. It will not persist. Report this to the mod author", -+ tileentity.getClass().getName(), e); -+ } - } - - p_75820_3_.func_74782_a("TileEntities", nbttaglist2); -@@ -345,6 +412,18 @@ - - p_75820_3_.func_74782_a("TileTicks", nbttaglist3); - } -+ -+ if (p_75820_1_.getCapabilities() != null) -+ { -+ try -+ { -+ p_75820_3_.func_74782_a("ForgeCaps", p_75820_1_.getCapabilities().serializeNBT()); -+ } -+ catch (Exception exception) -+ { -+ net.minecraftforge.fml.common.FMLLog.log.error("A capability provider has thrown an exception trying to write state. It will not persist. Report this to the mod author", exception); -+ } -+ } - } - - private Chunk func_75823_a(World p_75823_1_, NBTTagCompound p_75823_2_) -@@ -388,6 +467,16 @@ - chunk.func_76616_a(p_75823_2_.func_74770_j("Biomes")); - } - -+ if (chunk.getCapabilities() != null && p_75823_2_.func_74764_b("ForgeCaps")) { -+ chunk.getCapabilities().deserializeNBT(p_75823_2_.func_74775_l("ForgeCaps")); -+ } -+ -+ // End this method here and split off entity loading to another method -+ return chunk; -+ } -+ -+ public void loadEntities(World p_75823_1_, NBTTagCompound p_75823_2_, Chunk chunk) -+ { - NBTTagList nbttaglist1 = p_75823_2_.func_150295_c("Entities", 10); - - for (int j1 = 0; j1 < nbttaglist1.func_74745_c(); ++j1) -@@ -431,8 +520,6 @@ - p_75823_1_.func_180497_b(new BlockPos(nbttagcompound3.func_74762_e("x"), nbttagcompound3.func_74762_e("y"), nbttagcompound3.func_74762_e("z")), block, nbttagcompound3.func_74762_e("t"), nbttagcompound3.func_74762_e("p")); - } - } -- -- return chunk; - } - - @Nullable -@@ -563,4 +650,9 @@ - return entity; - } - } -+ -+ public int getPendingSaveCount() -+ { -+ return this.field_75828_a.size(); -+ } - } diff --git a/patches_old_unknown/SaveHandler.java.patch b/patches_old_unknown/SaveHandler.java.patch new file mode 100644 index 000000000..fff7e9ea2 --- /dev/null +++ b/patches_old_unknown/SaveHandler.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java ++++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java +@@ -127,8 +127,9 @@ + } + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); + file1 = new File(this.field_75770_b, "level.dat_old"); + return file1.exists() ? SaveFormatOld.func_186353_a(file1, this.field_186341_a) : null; + } + + public void func_75755_a(WorldInfo p_75755_1_, @Nullable NBTTagCompound p_75755_2_) +@@ -137,6 +138,8 @@ + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.func_74782_a("Data", nbttagcompound); + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, p_75755_1_, nbttagcompound1); ++ + try + { + File file1 = new File(this.field_75770_b, "level.dat_new"); diff --git a/patches_old_unknown/World.java.patch b/patches_old_unknown/World.java.patch new file mode 100644 index 000000000..6349027dc --- /dev/null +++ b/patches_old_unknown/World.java.patch @@ -0,0 +1,150 @@ +--- ../src-base/minecraft/net/minecraft/world/World.java ++++ ../src-work/minecraft/net/minecraft/world/World.java +@@ -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) + { +@@ -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; + } +@@ -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; + } +@@ -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(); +@@ -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; +@@ -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; + } +@@ -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_); + } + } + \ No newline at end of file diff --git a/patches_old_unknown/WorldInfo.java.patch b/patches_old_unknown/WorldInfo.java.patch new file mode 100644 index 000000000..56454a8d6 --- /dev/null +++ b/patches_old_unknown/WorldInfo.java.patch @@ -0,0 +1,51 @@ +--- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java ++++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java +@@ -63,8 +63,9 @@ + private double field_176153_H = 0.2D; + private int field_176154_I = 5; + private int field_176155_J = 15; + private GameRules field_82577_x = new GameRules(); ++ private java.util.Map additionalProperties; + + protected WorldInfo() + { +@@ -366,6 +367,7 @@ + p_76064_1_.func_74780_a("BorderSizeLerpTarget", this.field_176148_F); + p_76064_1_.func_74780_a("BorderWarningBlocks", (double)this.field_176154_I); + p_76064_1_.func_74780_a("BorderWarningTime", (double)this.field_176155_J); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().getDataFixer().writeVersionData(p_76064_1_); + + if (this.field_176158_z != null) + { +@@ -708,6 +711,7 @@ + + public void func_176144_a(EnumDifficulty p_176144_1_) + { ++ net.minecraftforge.common.ForgeHooks.onDifficultyChange(p_176144_1_, this.field_176158_z); + this.field_176158_z = p_176144_1_; + } + +@@ -805,18 +809,49 @@ + } + }); + } ++ /** ++ * Allow access to additional mod specific world based properties ++ * Used by FML to store mod list associated with a world, and maybe an id map ++ * Used by Forge to store the dimensions available to a world ++ * @param additionalProperties ++ */ ++ public void setAdditionalProperties(java.util.Map additionalProperties) ++ { ++ // one time set for this ++ if (this.additionalProperties == null) ++ { ++ this.additionalProperties = additionalProperties; ++ } ++ } + ++ public net.minecraft.nbt.NBTBase getAdditionalProperty(String additionalProperty) ++ { ++ return this.additionalProperties!=null? this.additionalProperties.get(additionalProperty) : null; ++ } ++ \ No newline at end of file diff --git a/patches_old_unknown/WorldServer.java.patch b/patches_old_unknown/WorldServer.java.patch new file mode 100644 index 000000000..3b2ccd170 --- /dev/null +++ b/patches_old_unknown/WorldServer.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldServer.java ++++ ../src-work/minecraft/net/minecraft/world/WorldServer.java +@@ -525,7 +539,10 @@ + { + if (p_175654_2_.func_149698_L()) + { +- if (this.func_175707_a(p_175654_1_.func_177982_a(-8, -8, -8), p_175654_1_.func_177982_a(8, 8, 8))) ++ //Keeping here as a note for future when it may be restored. ++ boolean isForced = getPersistentChunks().containsKey(new ChunkPos(p_175654_1_)); ++ int range = isForced ? 0 : 8; ++ if (this.func_175707_a(p_175654_1_.func_177982_a(-range, -range, -range), p_175654_1_.func_177982_a(range, range, range))) + { + IBlockState iblockstate = this.func_180495_p(p_175654_1_); + +@@ -561,6 +578,7 @@ + + public void func_180497_b(BlockPos p_180497_1_, Block p_180497_2_, int p_180497_3_, int p_180497_4_) + { ++ if (p_180497_2_ == null) return; //Forge: Prevent null blocks from ticking, can happen if blocks are removed in old worlds. TODO: Fix real issue causing block to be null. + NextTickListEntry nextticklistentry = new NextTickListEntry(p_180497_1_, p_180497_2_); + nextticklistentry.func_82753_a(p_180497_4_); + Material material = p_180497_2_.func_176223_P().func_185904_a(); diff --git a/patches_old_unknown/WorldType.java.patch b/patches_old_unknown/WorldType.java.patch new file mode 100644 index 000000000..0bdd9002d --- /dev/null +++ b/patches_old_unknown/WorldType.java.patch @@ -0,0 +1,47 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldType.java ++++ ../src-work/minecraft/net/minecraft/world/WorldType.java +@@ -113,4 +114,145 @@ + this.field_151361_l = true; + return this; + } ++ ++ public int getMinimumSpawnHeight(World world) ++ { ++ return this == field_77138_c ? 4 : world.func_181545_F() + 1; ++ } ++ ++ public double voidFadeMagnitude() ++ { ++ return this == field_77138_c ? 1.0D : 0.03125D; ++ } ++ ++ /*=================================================== FORGE START ======================================*/ ++ ++ /** ++ * Gets the spawn fuzz for players who join the world. ++ * Useful for void world types. ++ * @return Fuzz for entity initial spawn in blocks. ++ */ ++ public int getSpawnFuzz(WorldServer world, net.minecraft.server.MinecraftServer server) ++ { ++ return Math.max(0, server.func_184108_a(world)); ++ } ++ ++ /** ++ * Creates the GenLayerBiome used for generating the world with the specified ChunkProviderSettings JSON String ++ * *IF AND ONLY IF* this WorldType == WorldType.CUSTOMIZED. ++ * ++ * ++ * @param worldSeed The world seed ++ * @param parentLayer The parent layer to feed into any layer you return ++ * @param chunkSettings The ChunkGeneratorSettings constructed from the custom JSON ++ * @return A GenLayer that will return ints representing the Biomes to be generated, see GenLayerBiome ++ */ ++ public net.minecraft.world.gen.layer.GenLayer getBiomeLayer(long worldSeed, net.minecraft.world.gen.layer.GenLayer parentLayer, net.minecraft.world.gen.ChunkGeneratorSettings chunkSettings) ++ { ++ net.minecraft.world.gen.layer.GenLayer ret = new net.minecraft.world.gen.layer.GenLayerBiome(200L, parentLayer, this, chunkSettings); ++ ret = net.minecraft.world.gen.layer.GenLayerZoom.func_75915_a(1000L, ret, 2); ++ ret = new net.minecraft.world.gen.layer.GenLayerBiomeEdge(1000L, ret); ++ return ret; ++ } + } diff --git a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java index 0e8a5e2c3..ee8d5519e 100644 --- a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java +++ b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java @@ -50,6 +50,7 @@ import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunk; import net.minecraft.world.chunk.storage.AnvilChunkLoader; import net.minecraft.world.storage.ThreadedFileIOBase; import net.minecraftforge.common.config.ConfigCategory; @@ -143,18 +144,6 @@ public class ForgeChunkManager } } - public static Iterator getPersistentChunksIterableFor(final World world, Iterator chunkIterator) - { - final ImmutableSetMultimap persistentChunksFor = getPersistentChunksFor(world); - final ImmutableSet.Builder builder = ImmutableSet.builder(); - world.profiler.startSection("forcedChunkLoading"); - builder.addAll(persistentChunksFor.keys().stream().filter(Objects::nonNull).map(input -> world.getChunk(input.x, input.z)).iterator()); - world.profiler.endStartSection("regularChunkLoading"); - builder.addAll(chunkIterator); - world.profiler.endSection(); - return builder.build().iterator(); - } - /** * All mods requiring chunkloading need to implement this to handle the * re-registration of chunk tickets at world loading time @@ -994,25 +983,29 @@ public class ForgeChunkManager } } - public static void storeChunkNBT(Chunk chunk, NBTTagCompound nbt) + public static void storeChunkNBT(World world, IChunk ichunk, NBTTagCompound nbt) { if (dormantChunkCacheSize == 0) return; - Cache cache = dormantChunkCache.get(chunk.getWorld()); + Cache cache = dormantChunkCache.get(world); if (cache == null) return; - ChunkEntry entry = cache.getIfPresent(ChunkPos.asLong(chunk.x, chunk.z)); + ChunkEntry entry = cache.getIfPresent(ichunk.getPos().asLong()); if (entry != null) { entry.nbt.setTag("Entities", nbt.getList("Entities", Constants.NBT.TAG_COMPOUND)); entry.nbt.setTag("TileEntities", nbt.getList("TileEntities", Constants.NBT.TAG_COMPOUND)); - ClassInheritanceMultiMap[] entityLists = chunk.getEntityLists(); - for (int i = 0; i < entityLists.length; ++i) + if (ichunk instanceof Chunk) { - entityLists[i] = new ClassInheritanceMultiMap<>(Entity.class); + Chunk chunk = (Chunk)ichunk; + ClassInheritanceMultiMap[] entityLists = chunk.getEntityLists(); + for (int i = 0; i < entityLists.length; ++i) + { + entityLists[i] = new ClassInheritanceMultiMap<>(Entity.class); + } + chunk.getTileEntityMap().clear(); } - chunk.getTileEntityMap().clear(); } } diff --git a/src/main/java/net/minecraftforge/common/ForgeConfig.java b/src/main/java/net/minecraftforge/common/ForgeConfig.java index 40c7a4c28..8967a3b6e 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfig.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfig.java @@ -154,12 +154,16 @@ public class ForgeConfig public static int clumpingThreshold() { return ForgeConfig.INSTANCE.configData.getOrElse("general.clumpingThreshold", 64); } + public static boolean removeErroringEntities() { + return ForgeConfig.INSTANCE.configData.getOrElse("general.removeErroringEntities", false); + } + public static boolean removeErroringTileEntities() { + return ForgeConfig.INSTANCE.configData.getOrElse("general.removeErroringTileEntities", false); + } } //General //public static boolean disableVersionCheck = false; - //public static boolean removeErroringEntities = false; - //public static boolean removeErroringTileEntities = false; //public static boolean fullBoundingBoxLadders = false; //public static boolean logCascadingWorldGeneration = true; // see Chunk#logCascadingWorldGeneration() //public static boolean fixVanillaCascading = false; diff --git a/src/main/java/net/minecraftforge/common/MinecraftForge.java b/src/main/java/net/minecraftforge/common/MinecraftForge.java index a451e66d7..7d37782fb 100644 --- a/src/main/java/net/minecraftforge/common/MinecraftForge.java +++ b/src/main/java/net/minecraftforge/common/MinecraftForge.java @@ -43,8 +43,6 @@ public class MinecraftForge * EVENT_BUS for everything else */ public static final IEventBus EVENT_BUS = IEventBus.create(); - public static final IEventBus TERRAIN_GEN_BUS = IEventBus.create(); - public static final IEventBus ORE_GEN_BUS = IEventBus.create(); static final ForgeInternalHandler INTERNAL_HANDLER = new ForgeInternalHandler(); private static final Logger LOGGER = LogManager.getLogger(); diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java b/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java index ad5bc87e5..63580f23a 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java @@ -22,9 +22,18 @@ package net.minecraftforge.common.extensions; import javax.annotation.Nullable; import net.minecraft.client.audio.MusicTicker; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; +import net.minecraft.world.WorldType; +import net.minecraft.world.biome.Biome; +import net.minecraft.world.chunk.Chunk; import net.minecraft.world.dimension.Dimension; import net.minecraft.world.dimension.NetherDimension; +import net.minecraft.world.storage.WorldInfo; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.IRenderHandler; @@ -105,12 +114,12 @@ public interface IForgeDimension void resetRainAndThunder(); - default boolean canDoLightning(net.minecraft.world.chunk.Chunk chunk) + default boolean canDoLightning(Chunk chunk) { return true; } - default boolean canDoRainSnowIce(net.minecraft.world.chunk.Chunk chunk) + default boolean canDoRainSnowIce(Chunk chunk) { return true; } @@ -126,4 +135,152 @@ public interface IForgeDimension { return null; } + + default Biome getBiome(BlockPos pos) + { + return getDimension().getWorld().getBiomeBody(pos); + } + + default boolean isDaytime() + { + return getDimension().getWorld().getSkylightSubtracted() < 4; + } + + /** + * The current sun brightness factor for this dimension. + * 0.0f means no light at all, and 1.0f means maximum sunlight. + * This will be used for the "calculateSkylightSubtracted" + * which is for Sky light value calculation. + * + * @return The current brightness factor + **/ + default float getSunBrightnessFactor(float partialTicks) + { + return getDimension().getWorld().getSunBrightnessFactor(partialTicks); + } + + /** + * Gets the Sun Brightness for rendering sky. + * */ + @OnlyIn(Dist.CLIENT) + default float getSunBrightness(float partialTicks) + { + return getDimension().getWorld().getSunBrightnessBody(partialTicks); + } + + @OnlyIn(Dist.CLIENT) + default Vec3d getSkyColor(Entity cameraEntity, float partialTicks) + { + return getDimension().getWorld().getSkyColorBody(cameraEntity, partialTicks); + } + + @OnlyIn(Dist.CLIENT) + default Vec3d getCloudColor(float partialTicks) + { + return getDimension().getWorld().getCloudColorBody(partialTicks); + } + + /** + * Calculates the current moon phase factor. + * This factor is effective for slimes. + * (This method do not affect the moon rendering) + * */ + default float getCurrentMoonPhaseFactor(long time) + { + return Dimension.MOON_PHASE_FACTORS[this.getDimension().getMoonPhase(time)]; + } + + /** + * Gets the Star Brightness for rendering sky. + * */ + @OnlyIn(Dist.CLIENT) + default float getStarBrightness(float partialTicks) + { + float f = getDimension().getWorld().getCelestialAngle(partialTicks); + float f1 = 1.0F - (MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.25F); + f1 = MathHelper.clamp(f1, 0.0F, 1.0F); + return f1 * f1 * 0.5F; + } + + default void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) { } + + default void calculateInitialWeather() + { + getDimension().getWorld().calculateInitialWeatherBody(); + } + + default void updateWeather() + { + getDimension().getWorld().updateWeatherBody(); + } + + default long getSeed() + { + return getDimension().getWorld().getWorldInfo().getSeed(); + } + + default long getWorldTime() + { + return getDimension().getWorld().getWorldInfo().getDayTime(); + } + + default void setWorldTime(long time) + { + getDimension().getWorld().getWorldInfo().setDayTime(time); + } + + default BlockPos getSpawnPoint() + { + WorldInfo info = getDimension().getWorld().getWorldInfo(); + return new BlockPos(info.getSpawnX(), info.getSpawnY(), info.getSpawnZ()); + } + + default void setSpawnPoint(BlockPos pos) + { + getDimension().getWorld().getWorldInfo().setSpawn(pos); + } + + default boolean canMineBlock(EntityPlayer player, BlockPos pos) + { + return getDimension().getWorld().canMineBlockBody(player, pos); + } + + default boolean isHighHumidity(BlockPos pos) + { + return getDimension().getWorld().getBiome(pos).isHighHumidity(); + } + + default int getHeight() + { + return 256; + } + + default int getActualHeight() + { + return getDimension().isNether() ? 128 : 256; + } + + default double getHorizon() + { + return getDimension().getWorld().getWorldInfo().getTerrainType().getHorizon(getDimension().getWorld()); + } + + default String getSaveFolder() + { + return getId() == 0 ? null : "DIM" + getId(); + } + + /** + * Determine if the cursor on the map should 'spin' when rendered, like it does for the player in the nether. + * + * @param entity The entity holding the map, playername, or frame-ENTITYID + * @param x X Position + * @param z Z Position + * @param rotation the regular rotation of the marker + * @return True to 'spin' the cursor + */ + default boolean shouldMapSpin(String entity, double x, double z, double rotation) + { + return getId() < 0; + } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java b/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java index 18fffb50c..b568f89d0 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java @@ -71,4 +71,12 @@ public interface IForgeTileEntity extends ICapabilitySerializable getPersistentChunks() + { + return ForgeChunkManager.getPersistentChunksFor((World)this); + } + + default Iterator getPersistentChunkIterable(Iterator chunkIterator) + { + @SuppressWarnings("resource") + World world = (World)this; + final ImmutableSetMultimap persistentChunksFor = getPersistentChunks(); + final ImmutableSet.Builder builder = ImmutableSet.builder(); + world.profiler.startSection("forcedChunkLoading"); + builder.addAll(persistentChunksFor.keys().stream().filter(Objects::nonNull).map(input -> world.getChunk(input.x, input.z)).iterator()); + world.profiler.endStartSection("regularChunkLoading"); + builder.addAll(chunkIterator); + world.profiler.endSection(); + return builder.build().iterator(); + } } diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index d8d54abdc..91b4ca11e 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -119,8 +119,6 @@ import net.minecraftforge.event.entity.player.SleepingLocationCheckEvent; import net.minecraftforge.event.entity.player.SleepingTimeCheckEvent; import net.minecraftforge.event.entity.player.UseHoeEvent; import net.minecraftforge.event.furnace.FurnaceFuelBurnTimeEvent; -import net.minecraftforge.event.terraingen.ChunkGeneratorEvent; -import net.minecraftforge.event.terraingen.PopulateChunkEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.BlockEvent.CreateFluidSourceEvent; import net.minecraftforge.event.world.BlockEvent.MultiPlaceEvent; @@ -128,6 +126,7 @@ import net.minecraftforge.event.world.BlockEvent.NeighborNotifyEvent; import net.minecraftforge.event.world.BlockEvent.PlaceEvent; import net.minecraftforge.event.world.ExplosionEvent; import net.minecraftforge.event.world.GetCollisionBoxesEvent; +import net.minecraftforge.event.world.SaplingGrowTreeEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.Event.Result; @@ -641,18 +640,6 @@ public class ForgeEventFactory return MinecraftForge.EVENT_BUS.post(new ProjectileImpactEvent.Throwable(throwable, ray)); } - public static boolean onReplaceBiomeBlocks(IChunkGenerator gen, int x, int z, ChunkPrimer primer, World world) - { - ChunkGeneratorEvent.ReplaceBiomeBlocks event = new ChunkGeneratorEvent.ReplaceBiomeBlocks(gen, x, z, primer, world); - net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); - return event.getResult() != net.minecraftforge.eventbus.api.Event.Result.DENY; - } - - public static void onChunkPopulate(boolean pre, IChunkGenerator gen, World world, Random rand, int x, int z, boolean hasVillageGenerated) - { - MinecraftForge.EVENT_BUS.post(pre ? new PopulateChunkEvent.Pre(gen, world, rand, x, z, hasVillageGenerated) : new PopulateChunkEvent.Post(gen, world, rand, x, z, hasVillageGenerated)); - } - public static LootTable loadLootTable(ResourceLocation name, LootTable table, LootTableManager lootTableManager) { LootTableLoadEvent event = new LootTableLoadEvent(name, table, lootTableManager); @@ -701,4 +688,11 @@ public class ForgeEventFactory Result result = event.getResult(); return result == Result.DEFAULT ? world.getGameRules().getBoolean("mobGriefing") : result == Result.ALLOW; } + + public static boolean saplingGrowTree(IWorld world, Random rand, BlockPos pos) + { + SaplingGrowTreeEvent event = new SaplingGrowTreeEvent(world, rand, pos); + MinecraftForge.EVENT_BUS.post(event); + return event.getResult() != Result.DENY; + } } diff --git a/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java b/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java deleted file mode 100644 index 8c49d3055..000000000 --- a/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.event.terraingen; - -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.Event; -import net.minecraft.block.state.IBlockState; -import net.minecraft.world.biome.Biome; - -import net.minecraftforge.eventbus.api.Event.HasResult; - -/** - * BiomeEvent is fired whenever an event involving biomes occurs.
- * If a method utilizes this {@link Event} as its parameter, the method will - * receive every child event of this class.
- *
- * All children of this event are fired on the {@link MinecraftForge#TERRAIN_GEN_BUS} - * unless stated otherwise in their Javadocs. - **/ -public class BiomeEvent extends net.minecraftforge.eventbus.api.Event -{ - private final Biome biome; - - public BiomeEvent(Biome biome) - { - this.biome = biome; - } - - public Biome getBiome() - { - return biome; - } - - /** - * BiomeColor is fired whenever an event involving biome colors occurs.
- * If a method utilizes this {@link net.minecraftforge.eventbus.api.Event} as its parameter, the method will - * receive every child event of this class.
- *
- * All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}. - **/ - public static class BiomeColor extends BiomeEvent - { - private final int originalColor; - private int newColor; - - public BiomeColor(Biome biome, int original) - { - super(biome); - originalColor = original; - setNewColor(original); - } - - public int getOriginalColor() - { - return originalColor; - } - - public int getNewColor() - { - return newColor; - } - - public void setNewColor(int newColor) - { - this.newColor = newColor; - } - } - - /** - * This event is fired when the village generator attempts to choose a block ID - * based on the village's biome. - * - * You can cancel the event to override default values - */ - @HasResult - public static class GetVillageBlockID extends BiomeEvent - { - private final IBlockState original; - private IBlockState replacement; - - public GetVillageBlockID(Biome biome, IBlockState original) - { - super(biome); - this.original = original; - } - - public IBlockState getOriginal() - { - return original; - } - - public IBlockState getReplacement() - { - return replacement; - } - - public void setReplacement(IBlockState replacement) - { - this.replacement = replacement; - } - } - - /** - * This event is fired when a biome is queried for its grass color. - */ - public static class GetGrassColor extends BiomeColor - { - public GetGrassColor(Biome biome, int original) - { - super(biome, original); - } - } - - /** - * This event is fired when a biome is queried for its grass color. - */ - public static class GetFoliageColor extends BiomeColor - { - public GetFoliageColor(Biome biome, int original) - { - super(biome, original); - } - } - - /** - * This event is fired when a biome is queried for its water color. - */ - public static class GetWaterColor extends BiomeColor - { - public GetWaterColor(Biome biome, int original) - { - super(biome, original); - } - } -} diff --git a/src/main/java/net/minecraftforge/event/terraingen/ChunkGeneratorEvent.java b/src/main/java/net/minecraftforge/event/terraingen/ChunkGeneratorEvent.java deleted file mode 100644 index d8b887a57..000000000 --- a/src/main/java/net/minecraftforge/event/terraingen/ChunkGeneratorEvent.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.event.terraingen; - -import net.minecraft.world.World; -import net.minecraft.world.chunk.ChunkPrimer; -import net.minecraft.world.gen.IChunkGenSettings; -import net.minecraft.world.gen.IChunkGenerator; - -import net.minecraftforge.eventbus.api.Event.HasResult; - -public class ChunkGeneratorEvent extends net.minecraftforge.eventbus.api.Event -{ - private final IChunkGenerator gen; - - public ChunkGeneratorEvent(IChunkGenerator gen) - { - this.gen = gen; - } - - public IChunkGenerator getGenerator() { return this.getGen(); } - - public IChunkGenerator getGen() - { - return gen; - } - - /** - * This event is fired when a chunks blocks are replaced by a biomes top and - * filler blocks. - * - * You can set the result to DENY to prevent the default replacement. - */ - @HasResult - public static class ReplaceBiomeBlocks extends ChunkGeneratorEvent - { - private final int x; - private final int z; - private final ChunkPrimer primer; - private final World world; // CAN BE NULL - - public ReplaceBiomeBlocks(IChunkGenerator chunkProvider, int x, int z, ChunkPrimer primer, World world) - { - super(chunkProvider); - this.x = x; - this.z = z; - this.primer = primer; - this.world = world; - } - - public int getX() { return x; } - public int getZ() { return z; } - public ChunkPrimer getPrimer() { return primer; } - public World getWorld() { return world; } - } - - /** - * This event is fired before a chunks terrain noise field is initialized. - * - * You can set the result to DENY to substitute your own noise field. - */ - @HasResult - public static class InitNoiseField extends ChunkGeneratorEvent - { - private double[] noisefield; - private final int posX; - private final int posY; - private final int posZ; - private final int sizeX; - private final int sizeY; - private final int sizeZ; - - public InitNoiseField(IChunkGenerator chunkProvider, double[] noisefield, int posX, int posY, int posZ, int sizeX, int sizeY, int sizeZ) - { - super(chunkProvider); - this.setNoisefield(noisefield); - this.posX = posX; - this.posY = posY; - this.posZ = posZ; - this.sizeX = sizeX; - this.sizeY = sizeY; - this.sizeZ = sizeZ; - } - - public double[] getNoisefield() { return noisefield; } - public void setNoisefield(double[] noisefield) { this.noisefield = noisefield; } - public int getPosX() { return posX; } - public int getPosY() { return posY; } - public int getPosZ() { return posZ; } - public int getSizeX() { return sizeX; } - public int getSizeY() { return sizeY; } - public int getSizeZ() { return sizeZ; } - } -} diff --git a/src/main/java/net/minecraftforge/event/terraingen/DecorateBiomeEvent.java b/src/main/java/net/minecraftforge/event/terraingen/DecorateBiomeEvent.java deleted file mode 100644 index d83f13695..000000000 --- a/src/main/java/net/minecraftforge/event/terraingen/DecorateBiomeEvent.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.event.terraingen; - -import java.util.Random; - -import javax.annotation.Nullable; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.ChunkPos; -import net.minecraft.world.World; -import net.minecraft.world.biome.Biome; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.Event; -import net.minecraftforge.eventbus.api.Event.HasResult; - -/** - * DecorateBiomeEvent is fired when a BiomeDecorator is created. - *
- * This event is fired whenever a BiomeDecorator is created in - * {@link DeferredBiomeDecorator#fireCreateEventAndReplace(Biome)}.
- *
- * {@link #world} contains the world that is being decorated.
- * {@link #rand} contains an instance of Random to be used.
- * {@link #chunkPos} contains the original chunk for the decorator.
- *
- * This event is not {@link net.minecraftforge.eventbus.api.Cancelable}. - *
- * This event does not have a result. {@link HasResult} - *
- * This event is fired on the {@link MinecraftForge#TERRAIN_GEN_BUS}. - **/ -public class DecorateBiomeEvent extends Event -{ - private final World world; - private final Random rand; - private final ChunkPos chunkPos; - - public DecorateBiomeEvent(World world, Random rand, ChunkPos chunkPos) - { - this.world = world; - this.rand = rand; - this.chunkPos = chunkPos; - } - - public World getWorld() - { - return world; - } - - public Random getRand() - { - return rand; - } - - public ChunkPos getChunkPos() - { - return chunkPos; - } - - /** - * This event is fired before a chunk is decorated with a biome feature. - */ - public static class Pre extends DecorateBiomeEvent - { - public Pre(World world, Random rand, ChunkPos chunkPos) - { - super(world, rand, chunkPos); - } - } - - /** - * This event is fired after a chunk is decorated with a biome feature. - */ - public static class Post extends DecorateBiomeEvent - { - public Post(World world, Random rand, ChunkPos chunkPos) - { - super(world, rand, chunkPos); - } - } - - /** - * This event is fired when a chunk is decorated with a biome feature. - *

- * You can set the result to DENY to prevent the default biome decoration. - */ - @HasResult - public static class Decorate extends DecorateBiomeEvent - { - /** - * Use {@link EventType#CUSTOM} to filter custom event types - */ - public enum EventType - { - BIG_SHROOM, CACTUS, CLAY, DEAD_BUSH, DESERT_WELL, LILYPAD, FLOWERS, FOSSIL, GRASS, ICE, LAKE_WATER, LAKE_LAVA, PUMPKIN, REED, ROCK, SAND, SAND_PASS2, SHROOM, TREE, CUSTOM - } - - private final EventType type; - @Nullable - private final BlockPos placementPos; - - public Decorate(World world, Random rand, ChunkPos chunkPos, @Nullable BlockPos placementPos, EventType type) - { - super(world, rand, chunkPos); - this.type = type; - this.placementPos = placementPos; - } - - public EventType getType() - { - return type; - } - - /** - * This may be anywhere inside the 2x2 chunk area for generation. - * To get the original chunk position of the generation before a random location was chosen, use {@link #getChunkPos()}. - * - * @return the position used for original decoration, or null if it is not specified. - */ - @Nullable - public BlockPos getPlacementPos() - { - return this.placementPos; - } - } -} diff --git a/src/main/java/net/minecraftforge/event/terraingen/InitMapGenEvent.java b/src/main/java/net/minecraftforge/event/terraingen/InitMapGenEvent.java deleted file mode 100644 index e65da5af6..000000000 --- a/src/main/java/net/minecraftforge/event/terraingen/InitMapGenEvent.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.event.terraingen; - -import net.minecraftforge.eventbus.api.Event; - -public class InitMapGenEvent extends Event -{ - /** Use CUSTOM to filter custom event types - */ - public static enum EventType { CAVE, MINESHAFT, NETHER_BRIDGE, NETHER_CAVE, RAVINE, SCATTERED_FEATURE, STRONGHOLD, VILLAGE, OCEAN_MONUMENT, WOODLAND_MANSION, END_CITY, CUSTOM } - - /* TODO: Re-Evaluate - private final EventType type; - private final MapGenBase originalGen; - private MapGenBase newGen; - - InitMapGenEvent(EventType type, MapGenBase original) - { - this.type = type; - this.originalGen = original; - this.setNewGen(original); - } - public EventType getType() { return type; } - public MapGenBase getOriginalGen() { return originalGen; } - public MapGenBase getNewGen() { return newGen; } - public void setNewGen(MapGenBase newGen) { this.newGen = newGen; } - */ -} diff --git a/src/main/java/net/minecraftforge/event/terraingen/InitNoiseGensEvent.java b/src/main/java/net/minecraftforge/event/terraingen/InitNoiseGensEvent.java deleted file mode 100644 index c93f0ffd6..000000000 --- a/src/main/java/net/minecraftforge/event/terraingen/InitNoiseGensEvent.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.event.terraingen; - -import java.util.Random; - -import net.minecraft.world.World; -import net.minecraft.world.gen.NoiseGeneratorOctaves; -import net.minecraft.world.gen.NoiseGeneratorPerlin; -import net.minecraft.world.gen.NoiseGeneratorSimplex; -import net.minecraftforge.event.world.WorldEvent; - -public class InitNoiseGensEvent extends WorldEvent -{ - private final Random rand; - private final T original; - private T newValues; - - @SuppressWarnings("unchecked") - public InitNoiseGensEvent(World world, Random rand, T original) - { - super(world); - this.rand = rand; - this.original = original; - this.newValues = (T)original.clone(); - } - public Random getRandom() { return this.rand; } - public T getOriginal() { return this.original; } - public T getNewValues() { return this.newValues; } - - public static class Context - { - private NoiseGeneratorOctaves lperlin1; - private NoiseGeneratorOctaves lperlin2; - private NoiseGeneratorOctaves perlin; - private NoiseGeneratorOctaves scale; - private NoiseGeneratorOctaves depth; - public Context(NoiseGeneratorOctaves lperlin1, NoiseGeneratorOctaves lperlin2, NoiseGeneratorOctaves perlin, - NoiseGeneratorOctaves scale, NoiseGeneratorOctaves depth) - { - this.lperlin1 = lperlin1; - this.lperlin2 = lperlin2; - this.perlin = perlin; - this.scale = scale; - this.depth = depth; - } - public NoiseGeneratorOctaves getLPerlin1() { return lperlin1; } - public NoiseGeneratorOctaves getLPerlin2() { return lperlin2; } - public NoiseGeneratorOctaves getPerlin() { return perlin; } - public NoiseGeneratorOctaves getScale() { return scale; } - public NoiseGeneratorOctaves getDepth() { return depth; } - public void setLPerlin1(NoiseGeneratorOctaves value) { this.lperlin1 = value; } - public void getLPerlin2(NoiseGeneratorOctaves value) { this.lperlin2 = value; } - public void getPerlin (NoiseGeneratorOctaves value) { this.perlin = value; } - public void getScale (NoiseGeneratorOctaves value) { this.scale = value; } - public void getDepth (NoiseGeneratorOctaves value) { this.depth = value; } - - @Override - public Context clone(){ return new Context(lperlin1, lperlin2, perlin, scale, depth); } - } - - public static class ContextOverworld extends Context - { - private NoiseGeneratorPerlin height; - private NoiseGeneratorOctaves forest; - - public ContextOverworld(NoiseGeneratorOctaves lperlin1, NoiseGeneratorOctaves lperlin2, NoiseGeneratorOctaves perlin, - NoiseGeneratorPerlin height, NoiseGeneratorOctaves scale, NoiseGeneratorOctaves depth, NoiseGeneratorOctaves forest) - { - super(lperlin1, lperlin2, perlin, scale, depth); - this.height = height; - this.forest = forest; - } - @Override - public ContextOverworld clone() { return new ContextOverworld(getLPerlin1(), getLPerlin2(), getPerlin(), height, getScale(), getDepth(), forest); } - public NoiseGeneratorPerlin getHeight() { return height; } - public NoiseGeneratorOctaves getForest() { return forest; } - - public void getHeight (NoiseGeneratorPerlin value) { this.height = value; } - public void getForest (NoiseGeneratorOctaves value) { this.forest = value; } - } - - public static class ContextEnd extends Context - { - private NoiseGeneratorSimplex island; - public ContextEnd(NoiseGeneratorOctaves lperlin1, NoiseGeneratorOctaves lperlin2, NoiseGeneratorOctaves perlin, - NoiseGeneratorOctaves scale, NoiseGeneratorOctaves depth, NoiseGeneratorSimplex island) - { - super(lperlin1, lperlin2, perlin, scale, depth); - this.island = island; - } - @Override - public ContextEnd clone() { return new ContextEnd(getLPerlin1(), getLPerlin2(), getPerlin(), getScale(), getDepth(), island); } - public NoiseGeneratorSimplex getIsland() { return island; } - public void getIsland (NoiseGeneratorSimplex value) { this.island = value; } - } - - - public static class ContextHell extends Context - { - private NoiseGeneratorOctaves perlin2; - private NoiseGeneratorOctaves perlin3; - - public ContextHell(NoiseGeneratorOctaves lperlin1, NoiseGeneratorOctaves lperlin2, NoiseGeneratorOctaves perlin, - NoiseGeneratorOctaves perlin2, NoiseGeneratorOctaves perlin3, NoiseGeneratorOctaves scale, NoiseGeneratorOctaves depth) - { - super(lperlin1, lperlin2, perlin, scale, depth); - this.perlin2 = perlin2; - this.perlin3 = perlin3; - } - @Override - public ContextHell clone() { return new ContextHell(getLPerlin1(), getLPerlin2(), getPerlin(), perlin2, perlin3, getScale(), getDepth()); } - public NoiseGeneratorOctaves getPerlin2() { return perlin2; } - public NoiseGeneratorOctaves getPerlin3() { return perlin3; } - public void getPerlin2 (NoiseGeneratorOctaves value) { this.perlin2 = value; } - public void getPerlin3 (NoiseGeneratorOctaves value) { this.perlin3 = value; } - } -} diff --git a/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java b/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java deleted file mode 100644 index cac0e264c..000000000 --- a/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.event.terraingen; - -import java.util.Random; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.eventbus.api.Event; - -//import net.minecraft.world.biome.BiomeDecorator; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.Cancelable; -import net.minecraftforge.eventbus.api.Event; -import net.minecraftforge.eventbus.api.Event.HasResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -//import net.minecraft.world.gen.feature.WorldGenerator; - -/** - * OreGenEvent is fired when an event involving ore generation occurs.
- * If a method utilizes this {@link net.minecraftforge.eventbus.api.Event} as its parameter, the method will - * receive every child event of this class.
- *
- * {@link #world} contains the world this event is occurring in.
- * {@link #rand} contains an instance of random that can be used in this event.
- * {@link #pos} contains the coordinates of the chunk position currently being populated with ores.
- *
- * All children of this event are fired on the {@link MinecraftForge#ORE_GEN_BUS}.
- **/ -public class OreGenEvent extends Event -{ - private final World world; - private final Random rand; - private final BlockPos pos; - - public OreGenEvent(World world, Random rand, BlockPos pos) - { - this.world = world; - this.rand = rand; - this.pos = pos; - } - - public World getWorld() - { - return world; - } - - public Random getRand() - { - return rand; - } - - public BlockPos getPos() - { - return pos; - } - - /** - * OreGenEvent.Pre is fired just before a chunk is populated with ores.
- * This event is fired just before ore generation in - * {@link BiomeDecorator#generateOres(World, Random)}.
- *
- * This event is not {@link net.minecraftforge.eventbus.api.Cancelable}.
- *
- * This event does not have a result. {@link HasResult}
- *
- * This event is fired on the {@link MinecraftForge#ORE_GEN_BUS}.
- **/ - public static class Pre extends OreGenEvent - { - public Pre(World world, Random rand, BlockPos pos) - { - super(world, rand, pos); - } - } - - /** - * OreGenEvent.Post is fired just after a chunk is populated with ores.
- * This event is fired just after ore generation in - * {@link BiomeDecorator#generateOres(World, Random)}.
- *
- * This event is not {@link net.minecraftforge.eventbus.api.Cancelable}.
- *
- * This event does not have a result. {@link HasResult}
- *
- * This event is fired on the {@link MinecraftForge#ORE_GEN_BUS}.
- **/ - public static class Post extends OreGenEvent - { - public Post(World world, Random rand, BlockPos pos) - { - super(world, rand, pos); - } - } - - /** - * GenerateMinable is fired when a mineable block is generated in a chunk.
- * This event is fired just after ore generation in - * {@link BiomeDecorator#generateOres(World, Random)}.
- *
- * {@link #type} contains the enum value for the Ore attempting to be generated.
- * {@link #generator} contains the WorldGenerator generating this ore.
- *
- * This event is not {@link net.minecraftforge.eventbus.api.Cancelable}.
- *
- * This event has a result. {@link HasResult}
- * This result determines whether the ore is allowed to be generated.
- *
- * This event is fired on the {@link MinecraftForge#ORE_GEN_BUS}.
- **/ - /* TODO Re-Evaluate - @HasResult - public static class GenerateMinable extends OreGenEvent - { - public static enum EventType { COAL, DIAMOND, DIRT, GOLD, GRAVEL, IRON, LAPIS, REDSTONE, QUARTZ, DIORITE, GRANITE, ANDESITE, EMERALD, SILVERFISH, CUSTOM } - - private final EventType type; - private final WorldGenerator generator; - - public GenerateMinable(World world, Random rand, WorldGenerator generator, BlockPos pos, EventType type) - { - super(world, rand, pos); - this.generator = generator; - this.type = type; - } - - public EventType getType() - { - return type; - } - - public WorldGenerator getGenerator() - { - return generator; - } - } - - */ -} diff --git a/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java b/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java deleted file mode 100644 index 2253ab4ba..000000000 --- a/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.event.terraingen; - -import java.util.Random; - -import net.minecraft.world.World; -import net.minecraft.world.gen.IChunkGenerator; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.Cancelable; -import net.minecraftforge.eventbus.api.Event; - -import net.minecraftforge.eventbus.api.Event.HasResult; - -/** - * PopulateChunkEvent is fired when an event involving chunk terrain feature population occurs.
- * If a method utilizes this {@link net.minecraftforge.eventbus.api.Event} as its parameter, the method will - * receive every child event of this class.
- *
- * {@link #world} contains the world this event is occurring in.
- * {@link #rand} contains an instance of random that can be used in this event.
- * {@link #chunkX} contains the x-coordinate of the chunk currently being populated with a terrain feature.
- * {@link #chunkZ} contains the z-coordinate of the chunk currently being populated with ores.
- * {@link #hasVillageGenerated} contains the boolean value stating if the chunk already has a village spawned in it.
- *
- * All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}, except {@link Populate}, which fires on the {@link MinecraftForge#TERRAIN_GEN_BUS}.
- **/ -public class PopulateChunkEvent extends ChunkGeneratorEvent -{ - private final World world; - private final Random rand; - private final int chunkX; - private final int chunkZ; - private final boolean hasVillageGenerated; - - public PopulateChunkEvent(IChunkGenerator gen, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) - { - super(gen); - this.world = world; - this.rand = rand; - this.chunkX = chunkX; - this.chunkZ = chunkZ; - this.hasVillageGenerated = hasVillageGenerated; - } - - public World getWorld() { return world; } - public Random getRand() { return rand; } - public int getChunkX() { return chunkX; } - public int getChunkZ() { return chunkZ; } - public boolean isHasVillageGenerated() { return hasVillageGenerated; } - /** - * PopulateChunkEvent.Pre is fired just before a chunk is populated a terrain feature.
- * This event is fired just before terrain feature generation in - * {@link ChunkProviderEnd#populate(int, int)}, - * {@link ChunkProviderOverworld#populate(int, int)}, - * and {@link ChunkProviderHell#populate(int, int)}.
- *
- * This event is not {@link Cancelable}.
- *
- * This event does not have a result. {@link HasResult}
- *
- * This event is fired on the {@link MinecraftForge#EVENT_BUS}.
- **/ - public static class Pre extends PopulateChunkEvent - { - public Pre(IChunkGenerator gen, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) - { - super(gen, world, rand, chunkX, chunkZ, hasVillageGenerated); - } - } - - /** - * PopulateChunkEvent.Post is fired just after a chunk is populated with a terrain feature.
- * This event is fired just after terrain feature generation in - * {@link ChunkProviderEnd#populate(int, int)}, - * {@link ChunkProviderOverworld#populate(int, int)}, - * and {@link ChunkProviderHell#populate(int, int)}.
- *
- * This event is not {@link Cancelable}.
- *
- * This event does not have a result. {@link HasResult}
- *
- * This event is fired on the {@link MinecraftForge#EVENT_BUS}.
- **/ - public static class Post extends PopulateChunkEvent - { - public Post(IChunkGenerator chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) - { - super(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated); - } - } - - /** - * PopulateChunkEvent.Populate is fired when a chunk is populated with a terrain feature.
- * This event is fired during terrain feature generation in - * {@link ChunkProviderEnd#populate(int, int)}, - * {@link ChunkProviderOverworld#populate(int, int)}, - * and {@link ChunkProviderHell#populate(int, int)}.
- *
- * {@link #type} contains the enum value for the terrain feature being generated.
- *
- * This event is not {@link Cancelable}.
- *
- * This event has a result. {@link HasResult}
- * This result determines if the chunk is populated with the terrain feature.
- *
- * This event is fired on the {@link MinecraftForge#EVENT_BUS}.
- **/ - @HasResult - public static class Populate extends PopulateChunkEvent - { - public EventType getType() - { - return type; - } - - /** Use CUSTOM to filter custom event types - */ - public static enum EventType { DUNGEON, FIRE, GLOWSTONE, ICE, LAKE, LAVA, NETHER_LAVA, NETHER_LAVA2, NETHER_MAGMA, ANIMALS, CUSTOM } - - private final EventType type; - - public Populate(IChunkGenerator gen, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated, EventType type) - { - super(gen, world, rand, chunkX, chunkZ, hasVillageGenerated); - this.type = type; - } - } -} diff --git a/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java b/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java deleted file mode 100644 index db99580c6..000000000 --- a/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.event.terraingen; - -import java.util.Random; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.ChunkPos; -import net.minecraft.world.IWorld; -import net.minecraft.world.World; -import net.minecraft.world.gen.IChunkGenerator; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate; -import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate; -import net.minecraftforge.eventbus.api.Event.Result; - -//import net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable; -import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate; -import net.minecraftforge.eventbus.api.Event.Result; - -public abstract class TerrainGen -{ - public static T getModdedNoiseGenerators(World world, Random rand, T original) - { - InitNoiseGensEvent event = new InitNoiseGensEvent<>(world, rand, original); - MinecraftForge.TERRAIN_GEN_BUS.post(event); - return event.getNewValues(); - } - - /* TODO Re-Evaluate - public static MapGenBase getModdedMapGen(MapGenBase original, InitMapGenEvent.EventType type) - { - InitMapGenEvent event = new InitMapGenEvent(type, original); - MinecraftForge.TERRAIN_GEN_BUS.post(event); - return event.getNewGen(); - } - */ - - public static boolean populate(IChunkGenerator chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated, Populate.EventType type) - { - PopulateChunkEvent.Populate event = new PopulateChunkEvent.Populate(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated, type); - MinecraftForge.TERRAIN_GEN_BUS.post(event); - return event.getResult() != Result.DENY; - } - - /** - * Use this method when there is a specific BlockPos location given for decoration. - * If only the chunk position is available, use {@link #decorate(World, Random, ChunkPos, Decorate.EventType)} instead. - * - * @param world the world being generated in - * @param rand the random generator used for decoration - * @param chunkPos the original chunk position used for generation, passed to the decorator - * @param placementPos the specific position used for generating a feature, somewhere in the 2x2 chunks used for decoration - * @param type the type of decoration - */ - public static boolean decorate(World world, Random rand, ChunkPos chunkPos, BlockPos placementPos, Decorate.EventType type) - { - Decorate event = new Decorate(world, rand, chunkPos, placementPos, type); - MinecraftForge.TERRAIN_GEN_BUS.post(event); - return event.getResult() != Result.DENY; - } - - /** - * Use this method when generation doesn't have a specific BlockPos location for generation in the chunk. - * If a specific BlockPos for generation is available, use {@link #decorate(World, Random, ChunkPos, BlockPos, Decorate.EventType)} instead. - * - * @param world the world being generated in - * @param rand the random generator used for decoration - * @param chunkPos the original chunk position used for generation, passed to the decorator - * @param type the type of decoration - */ - public static boolean decorate(World world, Random rand, ChunkPos chunkPos, Decorate.EventType type) - { - Decorate event = new Decorate(world, rand, chunkPos, null, type); - MinecraftForge.TERRAIN_GEN_BUS.post(event); - return event.getResult() != Result.DENY; - } - - @Deprecated - public static boolean decorate(World world, Random rand, BlockPos pos, Decorate.EventType type) - { - return decorate(world, rand, new ChunkPos(pos), type); - } - - /* TODO Re-Evaluate - public static boolean generateOre(World world, Random rand, WorldGenerator generator, BlockPos pos, GenerateMinable.EventType type) - { - GenerateMinable event = new GenerateMinable(world, rand, generator, pos, type); - MinecraftForge.ORE_GEN_BUS.post(event); - return event.getResult() != Result.DENY; - } - */ - - public static boolean saplingGrowTree(IWorld world, Random rand, BlockPos pos) - { - SaplingGrowTreeEvent event = new SaplingGrowTreeEvent(world, rand, pos); - MinecraftForge.TERRAIN_GEN_BUS.post(event); - return event.getResult() != Result.DENY; - } -} diff --git a/src/main/java/net/minecraftforge/event/terraingen/WorldTypeEvent.java b/src/main/java/net/minecraftforge/event/terraingen/WorldTypeEvent.java deleted file mode 100644 index 3104ae8cb..000000000 --- a/src/main/java/net/minecraftforge/event/terraingen/WorldTypeEvent.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.event.terraingen; - -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.Cancelable; -import net.minecraftforge.eventbus.api.Event; -import net.minecraft.world.gen.layer.GenLayer; -import net.minecraft.world.WorldType; - -/** - * WorldTypeEvent is fired when an event involving the world occurs.
- * If a method utilizes this {@link Event} as its parameter, the method will - * receive every child event of this class.
- *
- * {@link #worldType} contains the WorldType of the world this event is occurring in.
- *
- * All children of this event are fired on the {@link MinecraftForge#TERRAIN_GEN_BUS}.
- **/ -public class WorldTypeEvent extends Event -{ - private final WorldType worldType; - - public WorldTypeEvent(WorldType worldType) - { - this.worldType = worldType; - } - - public WorldType getWorldType() - { - return worldType; - } - - /** - * BiomeSize is fired when vanilla Minecraft attempts to generate biomes.
- * This event is fired during biome generation in - * {@link GenLayer#initializeAllBiomeGenerators(long, WorldType, ChunkProviderSettings)}.
- *
- * {@link #originalSize} the original size of the Biome.
- * {@link #newSize} the new size of the biome. Initially set to the {@link #originalSize}.
- * If {@link #newSize} is set to a new value, that value will be used for the Biome size.
- *
- * This event is not {@link Cancelable}.
- *
- * This event does not have a result. {@link HasResult}
- *
- * This event is fired on the {@link MinecraftForge#TERRAIN_GEN_BUS}.
- **/ - public static class BiomeSize extends WorldTypeEvent - { - private final int originalSize; - private int newSize; - - public BiomeSize(WorldType worldType, int original) - { - super(worldType); - originalSize = original; - setNewSize(original); - } - - public int getOriginalSize() - { - return originalSize; - } - - public int getNewSize() - { - return newSize; - } - - public void setNewSize(int newSize) - { - this.newSize = newSize; - } - } - - /** - * InitBiomeGens is fired when vanilla Minecraft attempts to initialize the biome providers.
- * This event is fired just during biome provider initialization in - * {@link BiomeProvider#BiomeProvider(long, WorldType, String)}.
- *
- * {@link #seed} the seed of the world.
- * {@link #originalBiomeGens} the array of GenLayers original intended for this Biome generation.
- * {@link #newBiomeGens} the array of GenLayers that will now be used for this Biome generation.
- * If {@link #newBiomeGens} is set to a new value, that value will be used for the Biome generator.
- *
- * This event is not {@link Cancelable}.
- *
- * This event does not have a result. {@link HasResult}
- *
- * This event is fired on the {@link MinecraftForge#TERRAIN_GEN_BUS}.
- **/ - public static class InitBiomeGens extends WorldTypeEvent - { - private final long seed; - private final GenLayer[] originalBiomeGens; - private GenLayer[] newBiomeGens; - - public InitBiomeGens(WorldType worldType, long seed, GenLayer[] original) - { - super(worldType); - this.seed = seed; - originalBiomeGens = original; - setNewBiomeGens(original.clone()); - } - - public long getSeed() - { - return seed; - } - - public GenLayer[] getOriginalBiomeGens() - { - return originalBiomeGens; - } - - public GenLayer[] getNewBiomeGens() - { - return newBiomeGens; - } - - public void setNewBiomeGens(GenLayer[] newBiomeGens) - { - this.newBiomeGens = newBiomeGens; - } - } -} diff --git a/src/main/java/net/minecraftforge/event/world/ChunkDataEvent.java b/src/main/java/net/minecraftforge/event/world/ChunkDataEvent.java index 30a7d024f..766f33692 100644 --- a/src/main/java/net/minecraftforge/event/world/ChunkDataEvent.java +++ b/src/main/java/net/minecraftforge/event/world/ChunkDataEvent.java @@ -20,7 +20,7 @@ package net.minecraftforge.event.world; import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunk; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.chunk.storage.AnvilChunkLoader; import net.minecraftforge.common.MinecraftForge; @@ -40,17 +40,17 @@ public class ChunkDataEvent extends ChunkEvent { private final NBTTagCompound data; - public ChunkDataEvent(Chunk chunk, NBTTagCompound data) + public ChunkDataEvent(IChunk chunk, NBTTagCompound data) { super(chunk); this.data = data; } - + public NBTTagCompound getData() { return data; } - + /** * ChunkDataEvent.Load is fired when vanilla Minecraft attempts to load Chunk data.
* This event is fired during chunk loading in @@ -64,15 +64,15 @@ public class ChunkDataEvent extends ChunkEvent **/ public static class Load extends ChunkDataEvent { - public Load(Chunk chunk, NBTTagCompound data) + public Load(IChunk chunk, NBTTagCompound data) { super(chunk, data); } } - + /** * ChunkDataEvent.Save is fired when vanilla Minecraft attempts to save Chunk data.
- * This event is fired during chunk saving in + * This event is fired during chunk saving in * {@link AnvilChunkLoader#saveChunk(World, Chunk)}.
*
* This event is not {@link net.minecraftforge.eventbus.api.Cancelable}.
@@ -83,7 +83,7 @@ public class ChunkDataEvent extends ChunkEvent **/ public static class Save extends ChunkDataEvent { - public Save(Chunk chunk, NBTTagCompound data) + public Save(IChunk chunk, NBTTagCompound data) { super(chunk, data); } diff --git a/src/main/java/net/minecraftforge/event/world/ChunkEvent.java b/src/main/java/net/minecraftforge/event/world/ChunkEvent.java index 5ca1566f0..e42983d64 100644 --- a/src/main/java/net/minecraftforge/event/world/ChunkEvent.java +++ b/src/main/java/net/minecraftforge/event/world/ChunkEvent.java @@ -20,10 +20,8 @@ package net.minecraftforge.event.world; import net.minecraft.client.multiplayer.ChunkProviderClient; -import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunk; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.Cancelable; -import net.minecraftforge.eventbus.api.Event; /** * ChunkEvent is fired when an event involving a chunk occurs.
@@ -36,15 +34,15 @@ import net.minecraftforge.eventbus.api.Event; **/ public class ChunkEvent extends WorldEvent { - private final Chunk chunk; + private final IChunk chunk; - public ChunkEvent(Chunk chunk) + public ChunkEvent(IChunk chunk) { super(chunk.getWorld()); this.chunk = chunk; } - public Chunk getChunk() + public IChunk getChunk() { return chunk; } @@ -63,7 +61,7 @@ public class ChunkEvent extends WorldEvent **/ public static class Load extends ChunkEvent { - public Load(Chunk chunk) + public Load(IChunk chunk) { super(chunk); } @@ -82,7 +80,7 @@ public class ChunkEvent extends WorldEvent **/ public static class Unload extends ChunkEvent { - public Unload(Chunk chunk) + public Unload(IChunk chunk) { super(chunk); } diff --git a/src/main/java/net/minecraftforge/event/terraingen/SaplingGrowTreeEvent.java b/src/main/java/net/minecraftforge/event/world/SaplingGrowTreeEvent.java similarity index 95% rename from src/main/java/net/minecraftforge/event/terraingen/SaplingGrowTreeEvent.java rename to src/main/java/net/minecraftforge/event/world/SaplingGrowTreeEvent.java index e3c8a5631..48d0901ae 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/SaplingGrowTreeEvent.java +++ b/src/main/java/net/minecraftforge/event/world/SaplingGrowTreeEvent.java @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.event.terraingen; +package net.minecraftforge.event.world; import java.util.Random; @@ -29,7 +29,6 @@ import net.minecraftforge.eventbus.api.Event.HasResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IWorld; import net.minecraft.world.World; -import net.minecraftforge.event.world.WorldEvent; /** * SaplingGrowTreeEvent is fired when a sapling grows into a tree.
diff --git a/src/main/java/net/minecraftforge/fml/common/LoaderException.java b/src/main/java/net/minecraftforge/fml/common/LoaderException.java index cbc869758..616be09ca 100644 --- a/src/main/java/net/minecraftforge/fml/common/LoaderException.java +++ b/src/main/java/net/minecraftforge/fml/common/LoaderException.java @@ -18,8 +18,6 @@ */ package net.minecraftforge.fml.common; -import net.minecraftforge.fml.common.EnhancedRuntimeException.WrappedPrintStream; - public class LoaderException extends EnhancedRuntimeException { diff --git a/src/main/java/net/minecraftforge/items/VanillaDoubleChestItemHandler.java b/src/main/java/net/minecraftforge/items/VanillaDoubleChestItemHandler.java deleted file mode 100644 index 39ead7611..000000000 --- a/src/main/java/net/minecraftforge/items/VanillaDoubleChestItemHandler.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.items; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -import java.lang.ref.WeakReference; - -import com.google.common.base.Objects; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -public class VanillaDoubleChestItemHandler extends WeakReference implements IItemHandlerModifiable -{ - // Dummy cache value to signify that we have checked and definitely found no adjacent chests - public static final VanillaDoubleChestItemHandler NO_ADJACENT_CHESTS_INSTANCE = new VanillaDoubleChestItemHandler(null, null, false); - private final boolean mainChestIsUpper; - private final TileEntityChest mainChest; - private final int hashCode; - - public VanillaDoubleChestItemHandler(@Nullable TileEntityChest mainChest, @Nullable TileEntityChest other, boolean mainChestIsUpper) - { - super(other); - this.mainChest = mainChest; - this.mainChestIsUpper = mainChestIsUpper; - hashCode = Objects.hashCode(mainChestIsUpper ? mainChest : other) * 31 + Objects.hashCode(!mainChestIsUpper ? mainChest : other); - } - - @Nullable - public static VanillaDoubleChestItemHandler get(TileEntityChest chest) - { - World world = chest.getWorld(); - BlockPos pos = chest.getPos(); - if (world == null || pos == null || !world.isBlockLoaded(pos)) - return null; // Still loading - - IBlockState state = chest.getBlockState(); - - EnumFacing[] horizontals = EnumFacing.BY_HORIZONTAL_INDEX; - for (int i = horizontals.length - 1; i >= 0; i--) // Use reverse order so we can return early - { - EnumFacing enumfacing = horizontals[i]; - BlockPos blockpos = pos.offset(enumfacing); - Block block = world.getBlockState(blockpos).getBlock(); - - if (block == state.getBlock()) - { - TileEntity otherTE = world.getTileEntity(blockpos); - - if (otherTE instanceof TileEntityChest) - { - TileEntityChest otherChest = (TileEntityChest) otherTE; - return new VanillaDoubleChestItemHandler(chest, otherChest, - enumfacing != net.minecraft.util.EnumFacing.WEST && enumfacing != net.minecraft.util.EnumFacing.NORTH); - - } - } - } - return NO_ADJACENT_CHESTS_INSTANCE; //All alone - } - - @Nullable - public TileEntityChest getChest(boolean accessingUpper) - { - if (accessingUpper == mainChestIsUpper) - return mainChest; - else - { - return getOtherChest(); - } - } - - @Nullable - private TileEntityChest getOtherChest() - { - TileEntityChest tileEntityChest = get(); - return tileEntityChest != null && !tileEntityChest.isRemoved() ? tileEntityChest : null; - } - - @Override - public int getSlots() - { - return 27 * 2; - } - - @Override - @Nonnull - public ItemStack getStackInSlot(int slot) - { - boolean accessingUpperChest = slot < 27; - int targetSlot = accessingUpperChest ? slot : slot - 27; - TileEntityChest chest = getChest(accessingUpperChest); - return chest != null ? chest.getStackInSlot(targetSlot) : ItemStack.EMPTY; - } - - @Override - public void setStackInSlot(int slot, @Nonnull ItemStack stack) - { - boolean accessingUpperChest = slot < 27; - int targetSlot = accessingUpperChest ? slot : slot - 27; - TileEntityChest chest = getChest(accessingUpperChest); - if (chest != null) - { - IItemHandler singleHandler = null; // TODO TileEntityChest patches chest.getSingleChestHandler(); - if (singleHandler instanceof IItemHandlerModifiable) - { - ((IItemHandlerModifiable) singleHandler).setStackInSlot(targetSlot, stack); - } - } - - chest = getChest(!accessingUpperChest); - if (chest != null) - chest.markDirty(); - } - - @Override - @Nonnull - public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) - { - boolean accessingUpperChest = slot < 27; - int targetSlot = accessingUpperChest ? slot : slot - 27; - TileEntityChest chest = getChest(accessingUpperChest); - if (chest == null) - return stack; - - int starting = stack.getCount(); - ItemStack ret = ItemStack.EMPTY; // TODO TileEntityChest patches chest.getSingleChestHandler().insertItem(targetSlot, stack, simulate); - if (ret.getCount() != starting && !simulate) - { - chest = getChest(!accessingUpperChest); - if (chest != null) - chest.markDirty(); - } - - return ret; - } - - @Override - @Nonnull - public ItemStack extractItem(int slot, int amount, boolean simulate) - { - boolean accessingUpperChest = slot < 27; - int targetSlot = accessingUpperChest ? slot : slot - 27; - TileEntityChest chest = getChest(accessingUpperChest); - if (chest == null) - return ItemStack.EMPTY; - - ItemStack ret = ItemStack.EMPTY; // TODO TileEntityChest patches chest.getSingleChestHandler().extractItem(targetSlot, amount, simulate); - if (!ret.isEmpty() && !simulate) - { - chest = getChest(!accessingUpperChest); - if (chest != null) - chest.markDirty(); - } - - return ret; - } - - @Override - public int getSlotLimit(int slot) - { - boolean accessingUpperChest = slot < 27; - return getChest(accessingUpperChest).getInventoryStackLimit(); - } - - @Override - public boolean isItemValid(int slot, @Nonnull ItemStack stack) - { - boolean accessingUpperChest = slot < 27; - int targetSlot = accessingUpperChest ? slot : slot - 27; - TileEntityChest chest = getChest(accessingUpperChest); - if (chest != null) - { - return false; // TODO TileEntityChest patches chest.getSingleChestHandler().isItemValid(targetSlot, stack); - } - return true; - } - - @Override - public boolean equals(Object o) - { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - VanillaDoubleChestItemHandler that = (VanillaDoubleChestItemHandler) o; - - if (hashCode != that.hashCode) - return false; - - final TileEntityChest otherChest = getOtherChest(); - if (mainChestIsUpper == that.mainChestIsUpper) - return Objects.equal(mainChest, that.mainChest) && Objects.equal(otherChest, that.getOtherChest()); - else - return Objects.equal(mainChest, that.getOtherChest()) && Objects.equal(otherChest, that.mainChest); - } - - @Override - public int hashCode() - { - return hashCode; - } - - public boolean needsRefresh() - { - if (this == NO_ADJACENT_CHESTS_INSTANCE) - return false; - TileEntityChest tileEntityChest = get(); - return tileEntityChest == null || tileEntityChest.isRemoved(); - } -} diff --git a/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java index 8cf581247..11add8d91 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/SidedInvWrapper.java @@ -43,7 +43,7 @@ public class SidedInvWrapper implements IItemHandlerModifiable return ret; } - protected SidedInvWrapper(ISidedInventory inv, EnumFacing side) + public SidedInvWrapper(ISidedInventory inv, EnumFacing side) { this.inv = inv; this.side = side;