diff --git a/.gitignore b/.gitignore index 2cf0497e94..5c737ddfae 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,7 @@ /patches-/ # FML changelog changelog.txt +/patches_old/ +/patches_old_bak/ +*.py +*.7z diff --git a/build.gradle b/build.gradle index 1076f49696..263f56e5a9 100644 --- a/build.gradle +++ b/build.gradle @@ -34,11 +34,12 @@ repositories { } minecraft { - version = '1.7.10' - mcpVersion = '9.05' + version = '1.8' + mcpVersion = '9.10' + mappings = 'snapshot_nodoc_20140930' fmlDir = projectDir.getAbsolutePath() + "/fml"; - mainClass = 'cpw.mods.fml.relauncher.ServerLaunchWrapper' - tweakClass = 'cpw.mods.fml.common.launcher.FMLTweaker' + mainClass = 'net.minecraftforge.fml.relauncher.ServerLaunchWrapper' + tweakClass = 'net.minecraftforge.fml.common.launcher.FMLTweaker' installerVersion = "1.4" } diff --git a/eclipse-workspace-dev.zip b/eclipse-workspace-dev.zip index e2388215ff..dcf255c588 100644 Binary files a/eclipse-workspace-dev.zip and b/eclipse-workspace-dev.zip differ diff --git a/fml b/fml index d00feb58c7..df6ec21f2d 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit d00feb58c762b0bbc506d79faf1ce40bc96732e9 +Subproject commit df6ec21f2dbb29285bb44096331c8c5d0f6fd48c diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 285581fac4..bb36e99d5b 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -1,233 +1,179 @@ --- ../src-base/minecraft/net/minecraft/block/Block.java +++ ../src-work/minecraft/net/minecraft/block/Block.java -@@ -3,24 +3,36 @@ - import cpw.mods.fml.common.registry.GameData; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+ -+import java.util.ArrayList; -+import java.util.HashMap; - import java.util.Iterator; - import java.util.List; - import java.util.Random; -+ - import net.minecraft.block.material.MapColor; - import net.minecraft.block.material.Material; -+import net.minecraft.client.particle.EffectRenderer; - import net.minecraft.client.renderer.texture.IIconRegister; - import net.minecraft.creativetab.CreativeTabs; - import net.minecraft.enchantment.EnchantmentHelper; - import net.minecraft.entity.Entity; - import net.minecraft.entity.EntityLivingBase; -+import net.minecraft.entity.EnumCreatureType; -+import net.minecraft.entity.boss.EntityDragon; -+import net.minecraft.entity.boss.EntityWither; - import net.minecraft.entity.item.EntityItem; - import net.minecraft.entity.item.EntityXPOrb; - import net.minecraft.entity.player.EntityPlayer; -+import net.minecraft.init.Blocks; - import net.minecraft.item.Item; -+import net.minecraft.item.ItemBlock; - import net.minecraft.item.ItemStack; - import net.minecraft.stats.StatList; -+import net.minecraft.tileentity.TileEntity; - import net.minecraft.tileentity.TileEntitySign; - import net.minecraft.util.AxisAlignedBB; -+import net.minecraft.util.ChunkCoordinates; - import net.minecraft.util.IIcon; - import net.minecraft.util.MovingObjectPosition; - import net.minecraft.util.RegistryNamespaced; -@@ -30,6 +42,15 @@ - import net.minecraft.world.Explosion; - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; -+import net.minecraft.world.WorldProviderEnd; -+import net.minecraftforge.common.EnumPlantType; -+import net.minecraftforge.common.ForgeHooks; -+import net.minecraftforge.common.IPlantable; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.common.util.ForgeDirection; -+import net.minecraftforge.common.util.RotationHelper; -+import net.minecraftforge.event.ForgeEventFactory; -+import static net.minecraftforge.common.util.ForgeDirection.*; - - public class Block - { -@@ -112,7 +133,8 @@ +@@ -140,7 +140,8 @@ public static Block func_149729_e(int p_149729_0_) { - return (Block)field_149771_c.func_148754_a(p_149729_0_); + Block ret = (Block)field_149771_c.func_148754_a(p_149729_0_); -+ return ret == null ? Blocks.field_150350_a : ret; ++ return ret == null ? net.minecraft.init.Blocks.field_150350_a : ret; } - public static Block func_149634_a(Item p_149634_0_) -@@ -483,9 +505,10 @@ + public static IBlockState func_176220_d(int p_176220_0_) +@@ -341,9 +342,10 @@ return this.field_149789_z; } -+ @Deprecated //Forge: New Metadata sensitive version. ++ @Deprecated //Forge: New State sensitive version. public boolean func_149716_u() { - return this.field_149758_A; -+ return hasTileEntity(0); ++ return hasTileEntity(func_176223_P()); } public final void func_149676_a(float p_149676_1_, float p_149676_2_, float p_149676_3_, float p_149676_4_, float p_149676_5_, float p_149676_6_) -@@ -502,13 +525,13 @@ - public int func_149677_c(IBlockAccess p_149677_1_, int p_149677_2_, int p_149677_3_, int p_149677_4_) +@@ -360,13 +362,13 @@ + public int func_176207_c(IBlockAccess p_176207_1_, BlockPos p_176207_2_) { - Block block = p_149677_1_.func_147439_a(p_149677_2_, p_149677_3_, p_149677_4_); -- int l = p_149677_1_.func_72802_i(p_149677_2_, p_149677_3_, p_149677_4_, block.func_149750_m()); -+ int l = p_149677_1_.func_72802_i(p_149677_2_, p_149677_3_, p_149677_4_, block.getLightValue(p_149677_1_, p_149677_2_, p_149677_3_, p_149677_4_)); + Block block = p_176207_1_.func_180495_p(p_176207_2_).func_177230_c(); +- int i = p_176207_1_.func_175626_b(p_176207_2_, block.func_149750_m()); ++ int i = p_176207_1_.func_175626_b(p_176207_2_, block.getLightValue(p_176207_1_, p_176207_2_)); - if (l == 0 && block instanceof BlockSlab) + if (i == 0 && block instanceof BlockSlab) { - --p_149677_3_; - block = p_149677_1_.func_147439_a(p_149677_2_, p_149677_3_, p_149677_4_); -- return p_149677_1_.func_72802_i(p_149677_2_, p_149677_3_, p_149677_4_, block.func_149750_m()); -+ return p_149677_1_.func_72802_i(p_149677_2_, p_149677_3_, p_149677_4_, block.getLightValue(p_149677_1_, p_149677_2_, p_149677_3_, p_149677_4_)); + p_176207_2_ = p_176207_2_.func_177977_b(); + block = p_176207_1_.func_180495_p(p_176207_2_).func_177230_c(); +- return p_176207_1_.func_175626_b(p_176207_2_, block.func_149750_m()); ++ return p_176207_1_.func_175626_b(p_176207_2_, block.getLightValue(p_176207_1_, p_176207_2_)); } else { -@@ -597,7 +620,13 @@ +@@ -442,7 +444,13 @@ - public void func_149726_b(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) {} + public void func_176213_c(World p_176213_1_, BlockPos p_176213_2_, IBlockState p_176213_3_) {} -- public void func_149749_a(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) {} -+ public void func_149749_a(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) +- public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) {} ++ public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) + { -+ if (hasTileEntity(p_149749_6_) && !(this instanceof BlockContainer)) ++ if (hasTileEntity(p_180663_3_) && !(this instanceof BlockContainer)) + { -+ p_149749_1_.func_147475_p(p_149749_2_, p_149749_3_, p_149749_4_); ++ p_180663_1_.func_175713_t(p_180663_2_); + } + } public int func_149745_a(Random p_149745_1_) { -@@ -611,8 +640,7 @@ +@@ -456,8 +464,7 @@ - public float func_149737_a(EntityPlayer p_149737_1_, World p_149737_2_, int p_149737_3_, int p_149737_4_, int p_149737_5_) + public float func_180647_a(EntityPlayer p_180647_1_, World p_180647_2_, BlockPos p_180647_3_) { -- float f = this.func_149712_f(p_149737_2_, p_149737_3_, p_149737_4_, p_149737_5_); -- return f < 0.0F ? 0.0F : (!p_149737_1_.func_146099_a(this) ? p_149737_1_.func_146096_a(this, false) / f / 100.0F : p_149737_1_.func_146096_a(this, true) / f / 30.0F); -+ return ForgeHooks.blockStrength(this, p_149737_1_, p_149737_2_, p_149737_3_, p_149737_4_, p_149737_5_); +- float f = this.func_176195_g(p_180647_2_, p_180647_3_); +- return f < 0.0F ? 0.0F : (!p_180647_1_.func_146099_a(this) ? p_180647_1_.func_180471_a(this) / f / 100.0F : p_180647_1_.func_180471_a(this) / f / 30.0F); ++ return net.minecraftforge.common.ForgeHooks.blockStrength(p_180647_2_.func_180495_p(p_180647_3_), p_180647_1_, p_180647_2_, p_180647_3_); } - public final void func_149697_b(World p_149697_1_, int p_149697_2_, int p_149697_3_, int p_149697_4_, int p_149697_5_, int p_149697_6_) -@@ -622,20 +650,16 @@ + public final void func_176226_b(World p_176226_1_, BlockPos p_176226_2_, IBlockState p_176226_3_, int p_176226_4_) +@@ -467,20 +474,16 @@ - public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { -- if (!p_149690_1_.field_72995_K) -+ if (!p_149690_1_.field_72995_K && !p_149690_1_.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe +- if (!p_180653_1_.field_72995_K) ++ if (!p_180653_1_.field_72995_K && !p_180653_1_.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe { -- int j1 = this.func_149679_a(p_149690_7_, p_149690_1_.field_73012_v); -+ ArrayList items = getDrops(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_7_); -+ p_149690_6_ = ForgeEventFactory.fireBlockHarvesting(items, p_149690_1_, this, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_7_, p_149690_6_, false, harvesters.get()); +- int j = this.func_149679_a(p_180653_5_, p_180653_1_.field_73012_v); ++ java.util.List items = getDrops(p_180653_1_, p_180653_2_, p_180653_1_.func_180495_p(p_180653_2_), p_180653_5_); ++ p_180653_4_ = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180653_1_, p_180653_2_, p_180653_3_, p_180653_5_, p_180653_4_, false, harvesters.get()); -- for (int k1 = 0; k1 < j1; ++k1) +- for (int k = 0; k < j; ++k) + for (ItemStack item : items) { - if (p_149690_1_.field_73012_v.nextFloat() <= p_149690_6_) + if (p_180653_1_.field_73012_v.nextFloat() <= p_180653_4_) { -- Item item = this.func_149650_a(p_149690_5_, p_149690_1_.field_73012_v, p_149690_7_); +- Item item = this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_); - - if (item != null) - { -- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(item, 1, this.func_149692_a(p_149690_5_))); +- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(item, 1, this.func_180651_a(p_180653_3_))); - } -+ this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, item); ++ func_180635_a(p_180653_1_, p_180653_2_, item); } } } -@@ -643,8 +667,13 @@ +@@ -488,8 +491,13 @@ - protected void func_149642_a(World p_149642_1_, int p_149642_2_, int p_149642_3_, int p_149642_4_, ItemStack p_149642_5_) + public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) { -- if (!p_149642_1_.field_72995_K && p_149642_1_.func_82736_K().func_82766_b("doTileDrops")) -+ if (!p_149642_1_.field_72995_K && p_149642_1_.func_82736_K().func_82766_b("doTileDrops") && !p_149642_1_.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe +- if (!p_180635_0_.field_72995_K && p_180635_0_.func_82736_K().func_82766_b("doTileDrops")) ++ if (!p_180635_0_.field_72995_K && p_180635_0_.func_82736_K().func_82766_b("doTileDrops") && !p_180635_0_.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe { + if (captureDrops.get()) + { -+ capturedDrops.get().add(p_149642_5_); ++ capturedDrops.get().add(p_180635_2_); + return; + } - float f = 0.7F; - double d0 = (double)(p_149642_1_.field_73012_v.nextFloat() * f) + (double)(1.0F - f) * 0.5D; - double d1 = (double)(p_149642_1_.field_73012_v.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -@@ -829,7 +858,7 @@ + float f = 0.5F; + double d0 = (double)(p_180635_0_.field_73012_v.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d1 = (double)(p_180635_0_.field_73012_v.nextFloat() * f) + (double)(1.0F - f) * 0.5D; +@@ -674,7 +682,7 @@ - public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { -- return p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_).field_149764_J.func_76222_j(); -+ return p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_).isReplaceable(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_); +- return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().field_149764_J.func_76222_j(); ++ return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().func_176200_f(p_176196_1_, p_176196_2_); } - public boolean func_149727_a(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) -@@ -922,25 +951,35 @@ - p_149636_2_.func_71064_a(StatList.field_75934_C[func_149682_b(this)], 1); - p_149636_2_.func_71020_j(0.025F); + public boolean func_180639_a(World p_180639_1_, BlockPos p_180639_2_, IBlockState p_180639_3_, EntityPlayer p_180639_4_, EnumFacing p_180639_5_, float p_180639_6_, float p_180639_7_, float p_180639_8_) +@@ -776,25 +784,35 @@ + p_180657_2_.func_71029_a(StatList.field_75934_C[func_149682_b(this)]); + p_180657_2_.func_71020_j(0.025F); -- if (this.func_149700_E() && EnchantmentHelper.func_77502_d(p_149636_2_)) -+ if (this.canSilkHarvest(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_) && EnchantmentHelper.func_77502_d(p_149636_2_)) +- if (this.func_149700_E() && EnchantmentHelper.func_77502_d(p_180657_2_)) ++ if (this.canSilkHarvest(p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), p_180657_2_) && EnchantmentHelper.func_77502_d(p_180657_2_)) { -+ ArrayList items = new ArrayList(); - ItemStack itemstack = this.func_149644_j(p_149636_6_); ++ java.util.ArrayList items = new java.util.ArrayList(); + ItemStack itemstack = this.func_180643_i(p_180657_4_); if (itemstack != null) { -- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, itemstack); +- func_180635_a(p_180657_1_, p_180657_3_, itemstack); + items.add(itemstack); } + -+ ForgeEventFactory.fireBlockHarvesting(items, p_149636_1_, this, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_, 0, 1.0f, true, p_149636_2_); -+ for (ItemStack is : items) ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), 0, 1.0f, true, p_180657_2_); ++ for (ItemStack stack : items) + { -+ this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, is); ++ func_180635_a(p_180657_1_, p_180657_3_, stack); + } } else { -+ harvesters.set(p_149636_2_); - int i1 = EnchantmentHelper.func_77517_e(p_149636_2_); - this.func_149697_b(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_, i1); ++ harvesters.set(p_180657_2_); + int i = EnchantmentHelper.func_77517_e(p_180657_2_); + this.func_176226_b(p_180657_1_, p_180657_3_, p_180657_4_, i); + harvesters.set(null); } } ++ @Deprecated //Forge: State sensitive version protected boolean func_149700_E() { - return this.func_149686_d() && !this.field_149758_A; -+ Integer meta = silk_check_meta.get(); -+ return this.func_149686_d() && !this.hasTileEntity(meta == null ? 0 : meta); ++ return this.func_149686_d() && !this.hasTileEntity(silk_check_state.get()); } - protected ItemStack func_149644_j(int p_149644_1_) -@@ -1116,6 +1155,1104 @@ - return null; + protected ItemStack func_180643_i(IBlockState p_180643_1_) +@@ -971,6 +989,1011 @@ + return Block.EnumOffsetType.NONE; } + /* ======================================== FORGE START =====================================*/ + //For ForgeInternal use Only! + protected ThreadLocal harvesters = new ThreadLocal(); -+ private ThreadLocal silk_check_meta = new ThreadLocal(); ++ private ThreadLocal silk_check_state = new ThreadLocal(); ++ protected static java.util.Random RANDOM = new java.util.Random(); // Useful for random things without a seed. + /** + * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15 + * + * @param world The current world -+ * @param x X Position -+ * @param y Y position -+ * @param z Z position ++ * @param pos Block position in world + * @return The light value + */ -+ public int getLightValue(IBlockAccess world, int x, int y, int z) ++ public int getLightValue(IBlockAccess world, BlockPos pos) + { -+ Block block = world.func_147439_a(x, y, z); ++ Block block = world.func_180495_p(pos).func_177230_c(); + if (block != this) + { -+ return block.getLightValue(world, x, y, z); ++ return block.getLightValue(world, pos); + } + return func_149750_m(); + } @@ -236,16 +182,11 @@ + * Checks if a player or entity can use this block to 'climb' like a ladder. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y position -+ * @param z Z position ++ * @param pos Block position in world + * @param entity The entity trying to use the ladder, CAN be null. + * @return True if the block should act like a ladder + */ -+ public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) -+ { -+ return false; -+ } ++ public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return false; } + + /** + * Return true if the block is a normal, solid cube. This @@ -253,12 +194,10 @@ + * others. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y position -+ * @param z Z position ++ * @param pos Block position in world + * @return True if the block is a full cube + */ -+ public boolean isNormalCube(IBlockAccess world, int x, int y, int z) ++ public boolean isNormalCube(IBlockAccess world, BlockPos pos) + { + return func_149688_o().func_76218_k() && func_149686_d() && !func_149744_f(); + } @@ -267,34 +206,46 @@ + * Checks if the block is a solid face on the given side, used by placement logic. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y position -+ * @param z Z position ++ * @param pos Block position in world + * @param side The side to check + * @return True if the block is solid on the specified side. + */ -+ public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) ++ public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) + { -+ int meta = world.func_72805_g(x, y, z); ++ IBlockState state = this.func_176221_a(world.func_180495_p(pos), world, pos); + + if (this instanceof BlockSlab) + { -+ return (((meta & 8) == 8 && (side == UP)) || func_149730_j()); ++ return func_149730_j() || (state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP); + } + else if (this instanceof BlockFarmland) + { -+ return (side != DOWN && side != UP); ++ return (side != EnumFacing.DOWN && side != EnumFacing.UP); + } + else if (this instanceof BlockStairs) + { -+ boolean flipped = ((meta & 4) != 0); -+ return ((meta & 3) + side.ordinal() == 5) || (side == UP && flipped); ++ boolean flipped = state.func_177229_b(BlockStairs.field_176308_b) == BlockStairs.EnumHalf.TOP; ++ BlockStairs.EnumShape shape = (BlockStairs.EnumShape)state.func_177229_b(BlockStairs.field_176310_M); ++ EnumFacing facing = (EnumFacing)state.func_177229_b(BlockStairs.field_176309_a); ++ if (side == EnumFacing.UP) return flipped; ++ if (facing == side) return true; ++ if (flipped) ++ { ++ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.func_176735_f(); ++ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.func_176746_e(); ++ } ++ else ++ { ++ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.func_176746_e(); ++ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.func_176735_f(); ++ } ++ return false; + } + else if (this instanceof BlockSnow) + { -+ return (meta & 7) == 7; ++ return ((Integer)state.func_177229_b(BlockSnow.field_176315_a)) >= 8; + } -+ else if (this instanceof BlockHopper && side == UP) ++ else if (this instanceof BlockHopper && side == EnumFacing.UP) + { + return true; + } @@ -302,22 +253,7 @@ + { + return true; + } -+ return isNormalCube(world, x, y, z); -+ } -+ -+ /** -+ * Determines if a new block can be replace the space occupied by this one, -+ * Used in the player's placement code to make the block act like water, and lava. -+ * -+ * @param world The current world -+ * @param x X Position -+ * @param y Y position -+ * @param z Z position -+ * @return True if the block is replaceable by another block -+ */ -+ public boolean isReplaceable(IBlockAccess world, int x, int y, int z) -+ { -+ return field_149764_J.func_76222_j(); ++ return isNormalCube(world, pos); + } + + /** @@ -325,12 +261,10 @@ + * to entities coming into contact with it. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y position -+ * @param z Z position ++ * @param pos Block position in world + * @return True if the block should deal damage + */ -+ public boolean isBurning(IBlockAccess world, int x, int y, int z) ++ public boolean isBurning(IBlockAccess world, BlockPos pos) + { + return false; + } @@ -342,12 +276,10 @@ + * to the player and otherwise interact as air would. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y position -+ * @param z Z position ++ * @param pos Block position in world + * @return True if the block considered air + */ -+ public boolean isAir(IBlockAccess world, int x, int y, int z) ++ public boolean isAir(IBlockAccess world, BlockPos pos) + { + return func_149688_o() == Material.field_151579_a; + } @@ -359,9 +291,9 @@ + * @param meta The block's current metadata + * @return True to spawn the drops + */ -+ public boolean canHarvestBlock(EntityPlayer player, int meta) ++ public boolean canHarvestBlock(IBlockAccess world, BlockPos pos, EntityPlayer player) + { -+ return ForgeHooks.canHarvestBlock(this, player, meta); ++ return net.minecraftforge.common.ForgeHooks.canHarvestBlock(this, player, world, pos); + } + + /** @@ -377,22 +309,14 @@ + * + * @param world The current world + * @param player The player damaging the block, may be null -+ * @param x X Position -+ * @param y Y position -+ * @param z Z position ++ * @param pos Block position in world + * @param willHarvest True if Block.harvestBlock will be called after this, if the return in true. + * Can be useful to delay the destruction of tile entities till after harvestBlock + * @return True if the block is actually destroyed. + */ -+ public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) ++ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) + { -+ return removedByPlayer(world, player, x, y, z); -+ } -+ -+ @Deprecated -+ public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) -+ { -+ return world.func_147468_f(x, y, z); ++ return world.func_175698_g(pos); + } + + /** @@ -400,15 +324,13 @@ + * 300 being a 100% chance, 0, being a 0% chance. + * + * @param world The current world -+ * @param x The blocks X position -+ * @param y The blocks Y position -+ * @param z The blocks Z position ++ * @param pos Block position in world + * @param face The face that the fire is coming from + * @return A number ranging from 0 to 300 relating used to determine if the block will be consumed by fire + */ -+ public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) ++ public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) + { -+ return Blocks.field_150480_ab.getFlammability(this); ++ return net.minecraft.init.Blocks.field_150480_ab.func_176532_c(this); + } + + /** @@ -416,15 +338,13 @@ + * + * + * @param world The current world -+ * @param x The blocks X position -+ * @param y The blocks Y position -+ * @param z The blocks Z position ++ * @param pos Block position in world + * @param face The face that the fire is coming from + * @return True if the face can be on fire, false otherwise. + */ -+ public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) ++ public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face) + { -+ return getFlammability(world, x, y, z, face) > 0; ++ return getFlammability(world, pos, face) > 0; + } + + /** @@ -432,15 +352,13 @@ + * The higher the number returned, the faster fire will spread around this block. + * + * @param world The current world -+ * @param x The blocks X position -+ * @param y The blocks Y position -+ * @param z The blocks Z position ++ * @param pos Block position in world + * @param face The face that the fire is coming from + * @return A number that is used to determine the speed of fire growth around the block + */ -+ public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) ++ public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) + { -+ return Blocks.field_150480_ab.getEncouragement(this); ++ return net.minecraft.init.Blocks.field_150480_ab.func_176534_d(this); + } + + /** @@ -449,20 +367,18 @@ + * Also prevents firing from dying from rain. + * + * @param world The current world -+ * @param x The blocks X position -+ * @param y The blocks Y position -+ * @param z The blocks Z position ++ * @param pos Block position in world + * @param metadata The blocks current metadata + * @param side The face that the fire is coming from + * @return True if this block sustains fire, meaning it will never go out. + */ -+ public boolean isFireSource(World world, int x, int y, int z, ForgeDirection side) ++ public boolean isFireSource(World world, BlockPos pos, EnumFacing side) + { -+ if (this == Blocks.field_150424_aL && side == UP) ++ if (this == net.minecraft.init.Blocks.field_150424_aL && side == EnumFacing.UP) + { + return true; + } -+ if ((world.field_73011_w instanceof WorldProviderEnd) && this == Blocks.field_150357_h && side == UP) ++ if ((world.field_73011_w instanceof net.minecraft.world.WorldProviderEnd) && this == net.minecraft.init.Blocks.field_150357_h && side == EnumFacing.UP) + { + return true; + } @@ -477,10 +393,10 @@ + * + * Return true from this function to specify this block has a tile entity. + * -+ * @param metadata Metadata of the current block ++ * @param state State of the current block + * @return True if block has a tile entity, false otherwise + */ -+ public boolean hasTileEntity(int metadata) ++ public boolean hasTileEntity(IBlockState state) + { + return isTileProvider; + } @@ -493,25 +409,25 @@ + * @param metadata The Metadata of the current block + * @return A instance of a class extending TileEntity + */ -+ public TileEntity createTileEntity(World world, int metadata) ++ public TileEntity createTileEntity(World world, IBlockState state) + { + if (isTileProvider) + { -+ return ((ITileEntityProvider)this).func_149915_a(world, metadata); ++ return ((ITileEntityProvider)this).func_149915_a(world, func_176201_c(state)); + } + return null; + } + + /** -+ * Metadata and fortune sensitive version, this replaces the old (int meta, Random rand) ++ * State and fortune sensitive version, this replaces the old (int meta, Random rand) + * version in 1.1. + * -+ * @param meta Blocks Metadata ++ * @param state Current state + * @param fortune Current item fortune level + * @param random Random number generator + * @return The number of items to drop + */ -+ public int quantityDropped(int meta, int fortune, Random random) ++ public int quantityDropped(IBlockState state, int fortune, Random random) + { + return func_149679_a(fortune, random); + } @@ -520,24 +436,24 @@ + * This returns a complete list of items dropped from this block. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position -+ * @param metadata Current metadata ++ * @param pos Block position in world ++ * @param state Current state + * @param fortune Breakers fortune level + * @return A ArrayList containing all items this block drops + */ -+ public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) ++ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { -+ ArrayList ret = new ArrayList(); ++ List ret = new java.util.ArrayList(); + -+ int count = quantityDropped(metadata, fortune, world.field_73012_v); ++ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); ++ ++ int count = quantityDropped(state, fortune, rand); + for(int i = 0; i < count; i++) + { -+ Item item = func_149650_a(metadata, world.field_73012_v, fortune); ++ Item item = this.func_180660_a(state, rand, fortune); + if (item != null) + { -+ ret.add(new ItemStack(item, 1, func_149692_a(metadata))); ++ ret.add(new ItemStack(item, 1, this.func_180651_a(state))); + } + } + return ret; @@ -547,18 +463,16 @@ + * Return true from this function if the player with silk touch can harvest this block directly, and not it's normal drops. + * + * @param world The world ++ * @param pos Block position in world ++ * @param state current block state + * @param player The player doing the harvesting -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position -+ * @param metadata The metadata + * @return True if the block can be directly harvested using silk touch + */ -+ public boolean canSilkHarvest(World world, EntityPlayer player, int x, int y, int z, int metadata) ++ public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) + { -+ silk_check_meta.set(metadata);; ++ silk_check_state.set(state);; + boolean ret = this.func_149700_E(); -+ silk_check_meta.set(null); ++ silk_check_state.set(null); + return ret; + } + @@ -566,25 +480,23 @@ + * Determines if a specified mob type can spawn on this block, returning false will + * prevent any mob from spawning on the block. + * -+ * @param type The Mob Category Type + * @param world The current world -+ * @param x The X Position -+ * @param y The Y Position -+ * @param z The Z Position ++ * @param pos Block position in world ++ * @param type The Mob Category Type + * @return True to allow a mob of the specified category to spawn, false to prevent it. + */ -+ public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) ++ public boolean canCreatureSpawn(IBlockAccess world, BlockPos pos, net.minecraft.entity.EntityLiving.SpawnPlacementType type) + { -+ int meta = world.func_72805_g(x, y, z); ++ IBlockState state = world.func_180495_p(pos); + if (this instanceof BlockSlab) + { -+ return (((meta & 8) == 8) || func_149730_j()); ++ return (func_149730_j() || state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP); + } + else if (this instanceof BlockStairs) + { -+ return ((meta & 4) != 0); ++ return state.func_177229_b(BlockStairs.field_176308_b) == BlockStairs.EnumHalf.TOP; + } -+ return isSideSolid(world, x, y, z, UP); ++ return isSideSolid(world, pos, EnumFacing.UP); + } + + /** @@ -593,15 +505,13 @@ + * perform the sleeping functionality in it's activated event. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position ++ * @param pos Block position in world + * @param player The player or camera entity, null in some cases. + * @return True to treat this as a bed + */ -+ public boolean isBed(IBlockAccess world, int x, int y, int z, EntityLivingBase player) ++ public boolean isBed(IBlockAccess world, BlockPos pos, Entity player) + { -+ return this == Blocks.field_150324_C; ++ return this == net.minecraft.init.Blocks.field_150324_C; + } + + /** @@ -609,16 +519,14 @@ + * waking up, or respawning at the bed. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position ++ * @param pos Block position in world + * @param player The player or camera entity, null in some cases. + * @return The spawn position + */ -+ public ChunkCoordinates getBedSpawnPosition(IBlockAccess world, int x, int y, int z, EntityPlayer player) ++ public BlockPos getBedSpawnPosition(IBlockAccess world, BlockPos pos, EntityPlayer player) + { + if (world instanceof World) -+ return BlockBed.func_149977_a((World)world, x, y, z, 0); ++ return BlockBed.func_176468_a((World)world, pos, 0); + return null; + } + @@ -626,16 +534,19 @@ + * Called when a user either starts or stops sleeping in the bed. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position ++ * @param pos Block position in world + * @param player The player or camera entity, null in some cases. + * @param occupied True if we are occupying the bed, or false if they are stopping use of the bed + */ -+ public void setBedOccupied(IBlockAccess world, int x, int y, int z, EntityPlayer player, boolean occupied) ++ public void setBedOccupied(IBlockAccess world, BlockPos pos, EntityPlayer player, boolean occupied) + { + if (world instanceof World) -+ BlockBed.func_149979_a((World)world, x, y, z, occupied); ++ { ++ IBlockState state = world.func_180495_p(pos); ++ state = state.func_177230_c().func_176221_a(state, world, pos); ++ state = state.func_177226_a(BlockBed.field_176471_b, true); ++ ((World)world).func_180501_a(pos, state, 4); ++ } + } + + /** @@ -643,50 +554,42 @@ + * are returned by BlockDirectional + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position ++ * @param pos Block position in world + * @return Bed direction + */ -+ public int getBedDirection(IBlockAccess world, int x, int y, int z) ++ public EnumFacing getBedDirection(IBlockAccess world, BlockPos pos) + { -+ return BlockBed.func_149895_l(world.func_72805_g(x, y, z)); ++ return (EnumFacing)func_176221_a(world.func_180495_p(pos), world, pos).func_177229_b(BlockDirectional.field_176387_N); + } + + /** + * Determines if the current block is the foot half of the bed. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position ++ * @param pos Block position in world + * @return True if the current block is the foot side of a bed. + */ -+ public boolean isBedFoot(IBlockAccess world, int x, int y, int z) ++ public boolean isBedFoot(IBlockAccess world, BlockPos pos) + { -+ return BlockBed.func_149975_b(world.func_72805_g(x, y, z)); ++ return func_176221_a(world.func_180495_p(pos), world, pos).func_177229_b(BlockBed.field_176472_a) == BlockBed.EnumPartType.FOOT; + } + + /** + * Called when a leaf should start its decay process. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position ++ * @param pos Block position in world + */ -+ public void beginLeavesDecay(World world, int x, int y, int z){} ++ public void beginLeavesDecay(World world, BlockPos pos){} + + /** + * Determines if this block can prevent leaves connected to it from decaying. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position ++ * @param pos Block position in world + * @return true if the presence this block can prevent leaves from decaying. + */ -+ public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) ++ public boolean canSustainLeaves(IBlockAccess world, BlockPos pos) + { + return false; + } @@ -695,12 +598,10 @@ + * Determines if this block is considered a leaf block, used to apply the leaf decay and generation system. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position ++ * @param pos Block position in world + * @return true if this block is considered leaves. + */ -+ public boolean isLeaves(IBlockAccess world, int x, int y, int z) ++ public boolean isLeaves(IBlockAccess world, BlockPos pos) + { + return func_149688_o() == Material.field_151584_j; + } @@ -709,12 +610,10 @@ + * Used during tree growth to determine if newly generated leaves can replace this block. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position ++ * @param pos Block position in world + * @return true if this block can be replaced by growing leaves. + */ -+ public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) ++ public boolean canBeReplacedByLeaves(IBlockAccess world, BlockPos pos) + { + return !func_149730_j(); + } @@ -722,88 +621,69 @@ + /** + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position ++ * @param pos Block position in world + * @return true if the block is wood (logs) + */ -+ public boolean isWood(IBlockAccess world, int x, int y, int z) ++ public boolean isWood(IBlockAccess world, BlockPos pos) + { -+ return false; ++ return false; + } + + /** + * Determines if the current block is replaceable by Ore veins during world generation. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position ++ * @param pos Block position in world + * @param target The generic target block the gen is looking for, Standards define stone + * for overworld generation, and neatherack for the nether. + * @return True to allow this block to be replaced by a ore + */ -+ public boolean isReplaceableOreGen(World world, int x, int y, int z, Block target) ++ public boolean isReplaceableOreGen(World world, BlockPos pos, com.google.common.base.Predicate target) + { -+ return this == target; ++ return target.apply(world.func_180495_p(pos)); + } + + /** + * Location sensitive version of getExplosionRestance + * -+ * @param par1Entity The entity that caused the explosion + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position -+ * @param explosionX Explosion source X Position -+ * @param explosionY Explosion source X Position -+ * @param explosionZ Explosion source X Position ++ * @param pos Block position in world ++ * @param exploder The entity that caused the explosion, can be null ++ * @param explosion The explosion + * @return The amount of the explosion absorbed. + */ -+ public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) ++ public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) + { -+ return func_149638_a(par1Entity); ++ return func_149638_a(exploder); + } + + /** + * Called when the block is destroyed by an explosion. + * Useful for allowing the block to take into account tile entities, -+ * metadata, etc. when exploded, before it is removed. ++ * state, etc. when exploded, before it is removed. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position ++ * @param pos Block position in world + * @param Explosion The explosion instance affecting the block + */ -+ public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) ++ public void onBlockExploded(World world, BlockPos pos, Explosion explosion) + { -+ world.func_147468_f(x, y, z); -+ func_149723_a(world, x, y, z, explosion); ++ world.func_175698_g(pos); ++ func_180652_a(world, pos, explosion); + } + + /** + * Determine if this block can make a redstone connection on the side provided, + * Useful to control which sides are inputs and outputs for redstone wires. + * -+ * Side: -+ * -1: UP -+ * 0: NORTH -+ * 1: EAST -+ * 2: SOUTH -+ * 3: WEST -+ * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position -+ * @param side The side that is trying to make the connection ++ * @param pos Block position in world ++ * @param side The side that is trying to make the connection, CAN BE NULL + * @return True to make the connection + */ -+ public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) ++ public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side) + { -+ return func_149744_f() && side != -1; ++ return func_149744_f() && side != null; + } + + /** @@ -811,33 +691,33 @@ + * Useful for creating your own block that torches can be on, such as fences. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position ++ * @param pos Block position in world + * @return True to allow the torch to be placed + */ -+ public boolean canPlaceTorchOnTop(World world, int x, int y, int z) ++ public boolean canPlaceTorchOnTop(IBlockAccess world, BlockPos pos) + { -+ if (isSideSolid(world, x, y, z, UP)) ++ if (isSideSolid(world, pos, EnumFacing.UP)) + { + return true; + } + else + { -+ return this == Blocks.field_150422_aJ || this == Blocks.field_150386_bk || this == Blocks.field_150359_w || this == Blocks.field_150463_bK; ++ return this instanceof BlockFence || this == net.minecraft.init.Blocks.field_150359_w || this == net.minecraft.init.Blocks.field_150463_bK || this == net.minecraft.init.Blocks.field_150399_cn; + } + } + ++ /** Dont think this exists in 1.8 anymore + /** + * Determines if this block should render in this pass. + * + * @param pass The pass in question + * @return True to render -+ */ ++ * / + public boolean canRenderInPass(int pass) + { + return pass == func_149701_w(); + } ++ */ + + /** + * Called when a user uses the creative pick block button on this block @@ -845,14 +725,9 @@ + * @param target The full target the player is looking at + * @return A ItemStack to add to the player's inventory, Null if nothing should be added. + */ -+ public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) ++ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos) + { -+ return getPickBlock(target, world, x, y, z); -+ } -+ @Deprecated -+ public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) -+ { -+ Item item = func_149694_d(world, x, y, z); ++ Item item = func_180665_b(world, pos); + + if (item == null) + { @@ -860,7 +735,7 @@ + } + + Block block = item instanceof ItemBlock && !func_149648_K() ? Block.func_149634_a(item) : this; -+ return new ItemStack(item, 1, block.func_149643_k(world, x, y, z)); ++ return new ItemStack(item, 1, block.func_176222_j(world, pos)); + } + + /** @@ -869,7 +744,7 @@ + * + * @return False to disallow spawning + */ -+ public boolean isFoliage(IBlockAccess world, int x, int y, int z) ++ public boolean isFoliage(IBlockAccess world, BlockPos pos) + { + return false; + } @@ -886,7 +761,7 @@ + * @return True to prevent vanilla digging particles form spawning. + */ + @SideOnly(Side.CLIENT) -+ public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) ++ public boolean addHitEffects(World worldObj, MovingObjectPosition target, net.minecraft.client.particle.EffectRenderer effectRenderer) + { + return false; + } @@ -898,15 +773,12 @@ + * that the location is this block. + * + * @param world The current world -+ * @param x X position to spawn the particle -+ * @param y Y position to spawn the particle -+ * @param z Z position to spawn the particle -+ * @param meta The metadata for the block before it was destroyed. ++ * @param pos Position to spawn the particle + * @param effectRenderer A reference to the current effect renderer. + * @return True to prevent vanilla break particles from spawning. + */ + @SideOnly(Side.CLIENT) -+ public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) ++ public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer) + { + return false; + } @@ -923,24 +795,23 @@ + * Water check if its still water + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z position ++ * @param pos Block position in world + * @param direction The direction relative to the given position the plant wants to be, typically its UP + * @param plantable The plant that wants to check + * @return True to allow the plant to be planted/stay. + */ -+ public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) ++ public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) + { -+ Block plant = plantable.getPlant(world, x, y + 1, z); -+ EnumPlantType plantType = plantable.getPlantType(world, x, y + 1, z); ++ IBlockState state = world.func_180495_p(pos); ++ IBlockState plant = plantable.getPlant(world, pos.func_177984_a()); ++ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.func_177984_a()); + -+ if (plant == Blocks.field_150434_aF && this == Blocks.field_150434_aF) ++ if (plant.func_177230_c() == net.minecraft.init.Blocks.field_150434_aF && this == net.minecraft.init.Blocks.field_150434_aF) + { + return true; + } + -+ if (plant == Blocks.field_150436_aH && this == Blocks.field_150436_aH) ++ if (plant.func_177230_c() == net.minecraft.init.Blocks.field_150436_aH && this == net.minecraft.init.Blocks.field_150436_aH) + { + return true; + } @@ -952,18 +823,18 @@ + + switch (plantType) + { -+ case Desert: return this == Blocks.field_150354_m; -+ case Nether: return this == Blocks.field_150425_aM; -+ case Crop: return this == Blocks.field_150458_ak; -+ case Cave: return isSideSolid(world, x, y, z, UP); -+ case Plains: return this == Blocks.field_150349_c || this == Blocks.field_150346_d || this == Blocks.field_150458_ak; -+ case Water: return world.func_147439_a(x, y, z).func_149688_o() == Material.field_151586_h && world.func_72805_g(x, y, z) == 0; ++ case Desert: return this == net.minecraft.init.Blocks.field_150354_m || this == net.minecraft.init.Blocks.field_150405_ch || this == net.minecraft.init.Blocks.field_150406_ce || this == net.minecraft.init.Blocks.field_150346_d; ++ case Nether: return this == net.minecraft.init.Blocks.field_150425_aM; ++ case Crop: return this == net.minecraft.init.Blocks.field_150458_ak; ++ case Cave: return isSideSolid(world, pos, EnumFacing.UP); ++ case Plains: return this == net.minecraft.init.Blocks.field_150349_c || this == net.minecraft.init.Blocks.field_150346_d || this == net.minecraft.init.Blocks.field_150458_ak; ++ case Water: return func_149688_o() == Material.field_151586_h && ((Integer)state.func_177229_b(BlockLiquid.field_176367_b)) == 0; + case Beach: -+ boolean isBeach = this == Blocks.field_150349_c || this == Blocks.field_150346_d || this == Blocks.field_150354_m; -+ boolean hasWater = (world.func_147439_a(x - 1, y, z ).func_149688_o() == Material.field_151586_h || -+ world.func_147439_a(x + 1, y, z ).func_149688_o() == Material.field_151586_h || -+ world.func_147439_a(x, y, z - 1).func_149688_o() == Material.field_151586_h || -+ world.func_147439_a(x, y, z + 1).func_149688_o() == Material.field_151586_h); ++ boolean isBeach = this == net.minecraft.init.Blocks.field_150349_c || this == net.minecraft.init.Blocks.field_150346_d || this == net.minecraft.init.Blocks.field_150354_m; ++ boolean hasWater = (world.func_180495_p(pos.func_177974_f()).func_177230_c().func_149688_o() == Material.field_151586_h || ++ world.func_180495_p(pos.func_177976_e()).func_177230_c().func_149688_o() == Material.field_151586_h || ++ world.func_180495_p(pos.func_177978_c()).func_177230_c().func_149688_o() == Material.field_151586_h || ++ world.func_180495_p(pos.func_177968_d()).func_177230_c().func_149688_o() == Material.field_151586_h); + return isBeach && hasWater; + } + @@ -980,18 +851,14 @@ + * Note: This happens DURING the generation, the generation may not be complete when this is called. + * + * @param world Current world -+ * @param x Soil X -+ * @param y Soil Y -+ * @param z Soil Z -+ * @param sourceX Plant growth location X -+ * @param sourceY Plant growth location Y -+ * @param sourceZ Plant growth location Z ++ * @param pos Block position in world ++ * @param source Source plant's position in world + */ -+ public void onPlantGrow(World world, int x, int y, int z, int sourceX, int sourceY, int sourceZ) ++ public void onPlantGrow(World world, BlockPos pos, BlockPos source) + { -+ if (this == Blocks.field_150349_c || this == Blocks.field_150458_ak) ++ if (this == net.minecraft.init.Blocks.field_150349_c || this == net.minecraft.init.Blocks.field_150458_ak) + { -+ world.func_147465_d(x, y, z, Blocks.field_150346_d, 0, 2); ++ world.func_180501_a(pos, net.minecraft.init.Blocks.field_150346_d.func_176223_P(), 2); + } + } + @@ -1001,16 +868,14 @@ + * Only vanilla case is tilledField when it is within range of water. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z position ++ * @param pos Block position in world + * @return True if the soil should be considered fertile. + */ -+ public boolean isFertile(World world, int x, int y, int z) ++ public boolean isFertile(World world, BlockPos pos) + { -+ if (this == Blocks.field_150458_ak) ++ if (this == net.minecraft.init.Blocks.field_150458_ak) + { -+ return world.func_72805_g(x, y, z) > 0; ++ return ((Integer)world.func_180495_p(pos).func_177229_b(BlockFarmland.field_176531_a)) > 0; + } + + return false; @@ -1025,12 +890,10 @@ + * rely on it for light info. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z position ++ * @param pos Block position in world + * @return The amount of light to block, 0 for air, 255 for fully opaque. + */ -+ public int getLightOpacity(IBlockAccess world, int x, int y, int z) ++ public int getLightOpacity(IBlockAccess world, BlockPos pos) + { + return func_149717_k(); + } @@ -1039,20 +902,18 @@ + * Determines if this block is can be destroyed by the specified entities normal behavior. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z position ++ * @param pos Block position in world + * @return True to allow the ender dragon to destroy this block + */ -+ public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) ++ public boolean canEntityDestroy(IBlockAccess world, BlockPos pos, Entity entity) + { -+ if (entity instanceof EntityWither) ++ if (entity instanceof net.minecraft.entity.boss.EntityWither) + { -+ return this != Blocks.field_150357_h && this != Blocks.field_150384_bq && this != Blocks.field_150378_br && this != Blocks.field_150483_bI; ++ return this != net.minecraft.init.Blocks.field_180401_cv && this != net.minecraft.init.Blocks.field_150357_h && this != net.minecraft.init.Blocks.field_150384_bq && this != net.minecraft.init.Blocks.field_150378_br && this != net.minecraft.init.Blocks.field_150483_bI; + } -+ else if (entity instanceof EntityDragon) ++ else if (entity instanceof net.minecraft.entity.boss.EntityDragon) + { -+ return this != Blocks.field_150343_Z && this != Blocks.field_150377_bs && this != Blocks.field_150357_h; ++ return this != net.minecraft.init.Blocks.field_180401_cv && this != net.minecraft.init.Blocks.field_150343_Z && this != net.minecraft.init.Blocks.field_150377_bs && this != net.minecraft.init.Blocks.field_150357_h && this != net.minecraft.init.Blocks.field_150483_bI; + } + + return true; @@ -1062,17 +923,13 @@ + * Determines if this block can be used as the base of a beacon. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z position -+ * @param beaconX Beacons X Position -+ * @param beaconY Beacons Y Position -+ * @param beaconZ Beacons Z Position ++ * @param pos Block position in world ++ * @param beacon Beacon position in world + * @return True, to support the beacon, and make it active with this block. + */ -+ public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) ++ public boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beacon) + { -+ return this == Blocks.field_150475_bE || this == Blocks.field_150340_R || this == Blocks.field_150484_ah || this == Blocks.field_150339_S; ++ return this == net.minecraft.init.Blocks.field_150475_bE || this == net.minecraft.init.Blocks.field_150340_R || this == net.minecraft.init.Blocks.field_150484_ah || this == net.minecraft.init.Blocks.field_150339_S; + } + + /** @@ -1081,64 +938,78 @@ + * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations. + * The method should return true if the rotation was successful though. + * -+ * @param worldObj The world -+ * @param x X position -+ * @param y Y position -+ * @param z Z position ++ * @param world The world ++ * @param pos Block position in world + * @param axis The axis to rotate around + * @return True if the rotation was successful, False if the rotation failed, or is not possible + */ -+ public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis) ++ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { -+ return RotationHelper.rotateVanillaBlock(this, worldObj, x, y, z, axis); ++ IBlockState state = world.func_180495_p(pos); ++ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) ++ { ++ if (prop.func_177701_a().equals("facing")) ++ { ++ world.func_175656_a(pos, state.func_177231_a(prop)); ++ return true; ++ } ++ } ++ return false; + } + + /** + * Get the rotations that can apply to the block at the specified coordinates. Null means no rotations are possible. + * Note, this is up to the block to decide. It may not be accurate or representative. -+ * @param worldObj The world -+ * @param x X position -+ * @param y Y position -+ * @param z Z position ++ * @param world The world ++ * @param pos Block position in world + * @return An array of valid axes to rotate around, or null for none or unknown + */ -+ public ForgeDirection[] getValidRotations(World worldObj, int x, int y, int z) ++ public EnumFacing[] getValidRotations(World world, BlockPos pos) + { -+ return RotationHelper.getValidVanillaBlockRotations(this); ++ IBlockState state = world.func_180495_p(pos); ++ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) ++ { ++ if (prop.func_177701_a().equals("facing") && prop.func_177699_b() == EnumFacing.class) ++ { ++ java.util.Collection values = ((java.util.Collection)prop.func_177700_c()); ++ return values.toArray(new EnumFacing[values.size()]); ++ } ++ } ++ return null; + } + + /** + * Determines the amount of enchanting power this block can provide to an enchanting table. + * @param world The World -+ * @param x X position -+ * @param y Y position -+ * @param z Z position ++ * @param pos Block position in world + * @return The amount of enchanting power this block produces. + */ -+ public float getEnchantPowerBonus(World world, int x, int y, int z) ++ public float getEnchantPowerBonus(World world, BlockPos pos) + { -+ return this == Blocks.field_150342_X ? 1 : 0; ++ return this == net.minecraft.init.Blocks.field_150342_X ? 1 : 0; + } + + /** -+ * Common way to recolour a block with an external tool ++ * Common way to recolor a block with an external tool + * @param world The world -+ * @param x X -+ * @param y Y -+ * @param z Z -+ * @param side The side hit with the colouring tool -+ * @param colour The colour to change to -+ * @return If the recolouring was successful ++ * @param pos Block position in world ++ * @param side The side hit with the coloring tool ++ * @param color The color to change to ++ * @return If the recoloring was successful + */ -+ public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour) ++ public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, net.minecraft.item.EnumDyeColor color) + { -+ if (this == Blocks.field_150325_L) ++ IBlockState state = world.func_180495_p(pos); ++ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) + { -+ int meta = world.func_72805_g(x, y, z); -+ if (meta != colour) ++ if (prop.func_177701_a().equals("color") && prop.func_177699_b() == net.minecraft.item.EnumDyeColor.class) + { -+ world.func_72921_c(x, y, z, colour, 3); -+ return true; ++ net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.func_177229_b(prop); ++ if (current != color) ++ { ++ world.func_175656_a(pos, state.func_177226_a(prop, color)); ++ return true; ++ } + } + } + return false; @@ -1148,11 +1019,11 @@ + * Gathers how much experience this block drops when broken. + * + * @param world The world -+ * @param metadata ++ * @param pos Block position + * @param fortune + * @return Amount of XP from breaking this block. + */ -+ public int getExpDrop(IBlockAccess world, int metadata, int fortune) ++ public int getExpDrop(IBlockAccess world, BlockPos pos, int fortune) + { + return 0; + } @@ -1160,27 +1031,19 @@ + /** + * Called when a tile entity on a side of this block changes is created or is destroyed. + * @param world The world -+ * @param x The x position of this block instance -+ * @param y The y position of this block instance -+ * @param z The z position of this block instance -+ * @param tileX The x position of the tile that changed -+ * @param tileY The y position of the tile that changed -+ * @param tileZ The z position of the tile that changed ++ * @param pos Block position in world ++ * @param neighbor Block position of neighbor + */ -+ public void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) -+ { -+ } ++ public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor){} + + /** + * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules. + * @param world The world -+ * @param x The x position of this block instance -+ * @param y The y position of this block instance -+ * @param z The z position of this block instance ++ * @param pos Block position in world + * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side + * @return Whether Block#isProvidingWeakPower should be called when determining indirect power + */ -+ public boolean shouldCheckWeakPower(IBlockAccess world, int x, int y, int z, int side) ++ public boolean shouldCheckWeakPower(IBlockAccess world, BlockPos pos, EnumFacing side) + { + return func_149721_r(); + } @@ -1191,18 +1054,16 @@ + * Similar to comparators. + * + * @param world The current world -+ * @param x X Position -+ * @param y Y position -+ * @param z Z position ++ * @param pos Block position in world + * @param side The side to check + * @return true To be notified of changes + */ -+ public boolean getWeakChanges(IBlockAccess world, int x, int y, int z) ++ public boolean getWeakChanges(IBlockAccess world, BlockPos pos) + { + return false; + } + -+ private String[] harvestTool = new String[16]; ++ private String[] harvestTool = new String[16];; + private int[] harvestLevel = new int[]{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; + /** + * Sets or removes the tool and level required to harvest this block. @@ -1217,9 +1078,10 @@ + */ + public void setHarvestLevel(String toolClass, int level) + { -+ for (int m = 0; m < 16; m++) ++ Iterator itr = func_176194_O().func_177619_a().iterator(); ++ while (itr.hasNext()) + { -+ setHarvestLevel(toolClass, level, m); ++ setHarvestLevel(toolClass, level, itr.next()); + } + } + @@ -1233,63 +1095,55 @@ + * Iron: 2 + * Diamond: 3 + * Gold: 0 -+ * @param metadata The specific metadata to set ++ * @param state The specific state. + */ -+ public void setHarvestLevel(String toolClass, int level, int metadata) ++ public void setHarvestLevel(String toolClass, int level, IBlockState state) + { -+ this.harvestTool[metadata] = toolClass; -+ this.harvestLevel[metadata] = level; ++ int idx = this.func_176201_c(state); ++ this.harvestTool[idx] = toolClass; ++ this.harvestLevel[idx] = level; + } + + /** + * Queries the class of tool required to harvest this block, if null is returned + * we assume that anything can harvest this block. -+ * -+ * @param metadata -+ * @return + */ -+ public String getHarvestTool(int metadata) ++ public String getHarvestTool(IBlockState state) + { -+ return harvestTool[metadata]; ++ return harvestTool[func_176201_c(state)]; + } + + /** -+ * Queries the harvest level of this item stack for the specifred tool class, ++ * Queries the harvest level of this item stack for the specified tool class, + * Returns -1 if this tool is not of the specified type + * + * @param stack This item stack instance + * @return Harvest level, or -1 if not the specified tool type. + */ -+ public int getHarvestLevel(int metadata) ++ public int getHarvestLevel(IBlockState state) + { -+ return harvestLevel[metadata]; ++ return harvestLevel[func_176201_c(state)]; + } + + /** + * Checks if the specified tool type is efficient on this block, + * meaning that it digs at full speed. -+ * -+ * @param type -+ * @param metadata -+ * @return + */ -+ public boolean isToolEffective(String type, int metadata) ++ public boolean isToolEffective(String type, IBlockState state) + { -+ if ("pickaxe".equals(type) && (this == Blocks.field_150450_ax || this == Blocks.field_150439_ay || this == Blocks.field_150343_Z)) ++ if ("pickaxe".equals(type) && (this == net.minecraft.init.Blocks.field_150450_ax || this == net.minecraft.init.Blocks.field_150439_ay || this == net.minecraft.init.Blocks.field_150343_Z)) + return false; -+ if (harvestTool[metadata] == null) return false; -+ return harvestTool[metadata].equals(type); ++ return type != null && getHarvestTool(state).equals(type); + } + -+ -+ // For Inernal use only to capture droped items inside getDrops -+ protected ThreadLocal captureDrops = new ThreadLocal() ++ // For Internal use only to capture droped items inside getDrops ++ protected static ThreadLocal captureDrops = new ThreadLocal() + { + @Override protected Boolean initialValue() { return false; } + }; -+ protected ThreadLocal> capturedDrops = new ThreadLocal>() ++ protected static ThreadLocal> capturedDrops = new ThreadLocal>() + { -+ @Override protected List initialValue() { return new ArrayList(); } ++ @Override protected List initialValue() { return new java.util.ArrayList(); } + }; + protected List captureDrops(boolean start) + { @@ -1307,6 +1161,6 @@ + } + /* ========================================= FORGE END ======================================*/ + - public static class SoundType - { - public final String field_150501_a; + public static void func_149671_p() + { + func_176215_a(0, field_176230_a, (new BlockAir()).func_149663_c("air")); diff --git a/patches/minecraft/net/minecraft/block/BlockAir.java.patch b/patches/minecraft/net/minecraft/block/BlockAir.java.patch new file mode 100644 index 0000000000..17ba5bdc76 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockAir.java.patch @@ -0,0 +1,9 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockAir.java ++++ ../src-work/minecraft/net/minecraft/block/BlockAir.java +@@ -36,4 +36,6 @@ + } + + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) {} ++ ++ public boolean func_176200_f(World worldIn, BlockPos pos){ return true; } + } diff --git a/patches/minecraft/net/minecraft/block/BlockBush.java.patch b/patches/minecraft/net/minecraft/block/BlockBush.java.patch index 04a0d41774..5555052a8f 100644 --- a/patches/minecraft/net/minecraft/block/BlockBush.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockBush.java.patch @@ -1,73 +1,54 @@ --- ../src-base/minecraft/net/minecraft/block/BlockBush.java +++ ../src-work/minecraft/net/minecraft/block/BlockBush.java -@@ -6,8 +6,13 @@ - import net.minecraft.init.Blocks; - import net.minecraft.util.AxisAlignedBB; - import net.minecraft.world.World; -+import net.minecraft.world.IBlockAccess; -+import net.minecraftforge.common.EnumPlantType; -+import net.minecraftforge.common.util.ForgeDirection; -+import net.minecraftforge.common.IPlantable; -+import static net.minecraftforge.common.EnumPlantType.*; +@@ -12,7 +12,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; -public class BlockBush extends Block -+public class BlockBush extends Block implements IPlantable ++public class BlockBush extends Block implements net.minecraftforge.common.IPlantable { private static final String __OBFID = "CL_00000208"; -@@ -27,7 +32,7 @@ +@@ -32,7 +32,7 @@ - public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { -- return super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.func_149854_a(p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_)); -+ return super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.func_149718_j(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_); +- return super.func_176196_c(p_176196_1_, p_176196_2_) && this.func_149854_a(p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c()); ++ return super.func_176196_c(p_176196_1_, p_176196_2_) && p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c().canSustainPlant(p_176196_1_, p_176196_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this); } protected boolean func_149854_a(Block p_149854_1_) -@@ -57,7 +62,7 @@ - - public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_) +@@ -85,4 +85,33 @@ { -- return this.func_149854_a(p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_)); -+ return p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_).canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this); - } - - public AxisAlignedBB func_149668_a(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) -@@ -79,4 +84,37 @@ - { - return 1; + return EnumWorldBlockLayer.CUTOUT; } + + @Override -+ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) ++ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ if (this == Blocks.field_150464_aj) return Crop; -+ if (this == Blocks.field_150459_bM) return Crop; -+ if (this == Blocks.field_150469_bN) return Crop; -+ if (this == Blocks.field_150394_bc) return Crop; -+ if (this == Blocks.field_150393_bb) return Crop; -+ if (this == Blocks.field_150330_I) return Desert; -+ if (this == Blocks.field_150392_bi) return Water; -+ if (this == Blocks.field_150337_Q) return Cave; -+ if (this == Blocks.field_150338_P) return Cave; -+ if (this == Blocks.field_150388_bm) return Nether; -+ if (this == Blocks.field_150345_g) return Plains; -+ if (this == Blocks.field_150329_H) return Plains; -+ if (this == Blocks.field_150398_cm) return Plains; -+ if (this == Blocks.field_150328_O) return Plains; -+ if (this == Blocks.field_150327_N) return Plains; -+ return Plains; ++ if (this == Blocks.field_150464_aj) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.field_150459_bM) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.field_150469_bN) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.field_150394_bc) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.field_150393_bb) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.field_150330_I) return net.minecraftforge.common.EnumPlantType.Desert; ++ if (this == Blocks.field_150392_bi) return net.minecraftforge.common.EnumPlantType.Water; ++ if (this == Blocks.field_150337_Q) return net.minecraftforge.common.EnumPlantType.Cave; ++ if (this == Blocks.field_150338_P) return net.minecraftforge.common.EnumPlantType.Cave; ++ if (this == Blocks.field_150388_bm) return net.minecraftforge.common.EnumPlantType.Nether; ++ if (this == Blocks.field_150345_g) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.field_150329_H) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.field_150398_cm) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.field_150328_O) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.field_150327_N) return net.minecraftforge.common.EnumPlantType.Plains; ++ return net.minecraftforge.common.EnumPlantType.Plains; + } + + @Override -+ public Block getPlant(IBlockAccess world, int x, int y, int z) ++ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ return this; -+ } -+ -+ @Override -+ public int getPlantMetadata(IBlockAccess world, int x, int y, int z) -+ { -+ return world.func_72805_g(x, y, z); ++ IBlockState state = world.func_180495_p(pos); ++ if (state.func_177230_c() != this) return func_176223_P(); ++ return state; + } } diff --git a/patches/minecraft/net/minecraft/block/BlockButton.java.patch b/patches/minecraft/net/minecraft/block/BlockButton.java.patch index c460728736..32ceabc592 100644 --- a/patches/minecraft/net/minecraft/block/BlockButton.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockButton.java.patch @@ -1,100 +1,55 @@ --- ../src-base/minecraft/net/minecraft/block/BlockButton.java +++ ../src-work/minecraft/net/minecraft/block/BlockButton.java -@@ -14,6 +14,9 @@ +@@ -18,6 +18,7 @@ + import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; ++import static net.minecraft.util.EnumFacing.*; -+import net.minecraftforge.common.util.ForgeDirection; -+import static net.minecraftforge.common.util.ForgeDirection.*; -+ public abstract class BlockButton extends Block { - private final boolean field_150047_a; -@@ -49,12 +52,19 @@ +@@ -57,7 +58,7 @@ - public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_) + public boolean func_176198_a(World p_176198_1_, BlockPos p_176198_2_, EnumFacing p_176198_3_) { -- return p_149707_5_ == 2 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ + 1).func_149721_r() ? true : (p_149707_5_ == 3 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ - 1).func_149721_r() ? true : (p_149707_5_ == 4 && p_149707_1_.func_147439_a(p_149707_2_ + 1, p_149707_3_, p_149707_4_).func_149721_r() ? true : p_149707_5_ == 5 && p_149707_1_.func_147439_a(p_149707_2_ - 1, p_149707_3_, p_149707_4_).func_149721_r())); -+ ForgeDirection dir = ForgeDirection.getOrientation(p_149707_5_); -+ return (dir == NORTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ + 1, NORTH)) || -+ (dir == SOUTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ - 1, SOUTH)) || -+ (dir == WEST && p_149707_1_.isSideSolid(p_149707_2_ + 1, p_149707_3_, p_149707_4_, WEST)) || -+ (dir == EAST && p_149707_1_.isSideSolid(p_149707_2_ - 1, p_149707_3_, p_149707_4_, EAST)); +- return p_176198_1_.func_180495_p(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d())).func_177230_c().func_149721_r(); ++ return p_176198_1_.isSideSolid(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d()), p_176198_3_, true); } - public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) +@@ -69,7 +70,7 @@ + { + EnumFacing enumfacing = aenumfacing[j]; + +- if (p_176196_1_.func_180495_p(p_176196_2_.func_177972_a(enumfacing)).func_177230_c().func_149721_r()) ++ if (p_176196_1_.isSideSolid(p_176196_2_.func_177972_a(enumfacing), enumfacing.func_176734_d(), true)) + { + return true; + } +@@ -80,7 +81,7 @@ + + public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) { -- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r())); -+ return (p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST)) || -+ (p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST)) || -+ (p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH)) || -+ (p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH)); +- return p_180642_1_.func_180495_p(p_180642_2_.func_177972_a(p_180642_3_.func_176734_d())).func_177230_c().func_149721_r() ? this.func_176223_P().func_177226_a(field_176585_a, p_180642_3_).func_177226_a(field_176584_b, Boolean.valueOf(false)) : this.func_176223_P().func_177226_a(field_176585_a, EnumFacing.DOWN).func_177226_a(field_176584_b, Boolean.valueOf(false)); ++ return p_180642_1_.isSideSolid(p_180642_2_.func_177972_a(p_180642_3_.func_176734_d()), p_180642_3_, true) ? this.func_176223_P().func_177226_a(field_176585_a, p_180642_3_).func_177226_a(field_176584_b, Boolean.valueOf(false)) : this.func_176223_P().func_177226_a(field_176585_a, EnumFacing.DOWN).func_177226_a(field_176584_b, Boolean.valueOf(false)); } - public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) -@@ -63,19 +73,21 @@ - int k1 = j1 & 8; - j1 &= 7; + public void func_176204_a(World p_176204_1_, BlockPos p_176204_2_, IBlockState p_176204_3_, Block p_176204_4_) +@@ -89,7 +90,7 @@ + { + EnumFacing enumfacing = (EnumFacing)p_176204_3_.func_177229_b(field_176585_a); -- if (p_149660_5_ == 2 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ + 1).func_149721_r()) -+ ForgeDirection dir = ForgeDirection.getOrientation(p_149660_5_); +- if (!p_176204_1_.func_180495_p(p_176204_2_.func_177972_a(enumfacing.func_176734_d())).func_177230_c().func_149721_r()) ++ if (!p_176204_1_.isSideSolid(p_176204_2_.func_177972_a(enumfacing.func_176734_d()), enumfacing, true)) + { + this.func_176226_b(p_176204_1_, p_176204_2_, p_176204_3_, 0); + p_176204_1_.func_175698_g(p_176204_2_); +@@ -338,6 +339,8 @@ + return new BlockState(this, new IProperty[] {field_176585_a, field_176584_b}); + } + ++ @Override public net.minecraft.item.Item func_180660_a(IBlockState state, Random rnd, int fortune){ return null; } + -+ if (dir == NORTH && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH)) + static final class SwitchEnumFacing { - j1 = 4; - } -- else if (p_149660_5_ == 3 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ - 1).func_149721_r()) -+ else if (dir == SOUTH && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH)) - { - j1 = 3; - } -- else if (p_149660_5_ == 4 && p_149660_1_.func_147439_a(p_149660_2_ + 1, p_149660_3_, p_149660_4_).func_149721_r()) -+ else if (dir == WEST && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST)) - { - j1 = 2; - } -- else if (p_149660_5_ == 5 && p_149660_1_.func_147439_a(p_149660_2_ - 1, p_149660_3_, p_149660_4_).func_149721_r()) -+ else if (dir == EAST && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST)) - { - j1 = 1; - } -@@ -89,7 +101,11 @@ - - private int func_150045_e(World p_150045_1_, int p_150045_2_, int p_150045_3_, int p_150045_4_) - { -- return p_150045_1_.func_147439_a(p_150045_2_ - 1, p_150045_3_, p_150045_4_).func_149721_r() ? 1 : (p_150045_1_.func_147439_a(p_150045_2_ + 1, p_150045_3_, p_150045_4_).func_149721_r() ? 2 : (p_150045_1_.func_147439_a(p_150045_2_, p_150045_3_, p_150045_4_ - 1).func_149721_r() ? 3 : (p_150045_1_.func_147439_a(p_150045_2_, p_150045_3_, p_150045_4_ + 1).func_149721_r() ? 4 : 1))); -+ if (p_150045_1_.isSideSolid(p_150045_2_ - 1, p_150045_3_, p_150045_4_, EAST)) return 1; -+ if (p_150045_1_.isSideSolid(p_150045_2_ + 1, p_150045_3_, p_150045_4_, WEST)) return 2; -+ if (p_150045_1_.isSideSolid(p_150045_2_, p_150045_3_, p_150045_4_ - 1, SOUTH)) return 3; -+ if (p_150045_1_.isSideSolid(p_150045_2_, p_150045_3_, p_150045_4_ + 1, NORTH)) return 4; -+ return 1; - } - - public void func_149695_a(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) -@@ -99,22 +115,22 @@ - int l = p_149695_1_.func_72805_g(p_149695_2_, p_149695_3_, p_149695_4_) & 7; - boolean flag = false; - -- if (!p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 1) -+ if (!p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST) && l == 1) - { - flag = true; - } - -- if (!p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 2) -+ if (!p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST) && l == 2) - { - flag = true; - } - -- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r() && l == 3) -+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH) && l == 3) - { - flag = true; - } - -- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r() && l == 4) -+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH) && l == 4) - { - flag = true; - } + static final int[] field_180420_a = new int[EnumFacing.values().length]; diff --git a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch index b79414ad8b..af39372ed6 100644 --- a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch @@ -1,49 +1,37 @@ --- ../src-base/minecraft/net/minecraft/block/BlockCactus.java +++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java -@@ -11,9 +11,13 @@ - import net.minecraft.util.AxisAlignedBB; - import net.minecraft.util.DamageSource; - import net.minecraft.util.IIcon; -+import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; -+import net.minecraftforge.common.EnumPlantType; -+import net.minecraftforge.common.util.ForgeDirection; -+import net.minecraftforge.common.IPlantable; +@@ -19,7 +19,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; -public class BlockCactus extends Block -+public class BlockCactus extends Block implements IPlantable ++public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable { - @SideOnly(Side.CLIENT) - private IIcon field_150041_a; -@@ -125,7 +129,7 @@ - else - { - Block block = p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_); -- return block == Blocks.field_150434_aF || block == Blocks.field_150354_m; -+ return block.canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this); + public static final PropertyInteger field_176587_a = PropertyInteger.func_177719_a("age", 0, 15); + private static final String __OBFID = "CL_00000210"; +@@ -115,7 +115,7 @@ } + + Block block = p_176586_1_.func_180495_p(p_176586_2_.func_177977_b()).func_177230_c(); +- return block == Blocks.field_150434_aF || block == Blocks.field_150354_m; ++ return block.canSustainPlant(p_176586_1_, p_176586_2_.func_177977_b(), EnumFacing.UP, this); } -@@ -141,4 +145,22 @@ - this.field_150041_a = p_149651_1_.func_94245_a(this.func_149641_N() + "_top"); - this.field_150040_b = p_149651_1_.func_94245_a(this.func_149641_N() + "_bottom"); + public void func_180634_a(World p_180634_1_, BlockPos p_180634_2_, IBlockState p_180634_3_, Entity p_180634_4_) +@@ -143,4 +143,16 @@ + { + return new BlockState(this, new IProperty[] {field_176587_a}); } + + @Override -+ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) ++ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ return EnumPlantType.Desert; ++ return net.minecraftforge.common.EnumPlantType.Desert; + } + + @Override -+ public Block getPlant(IBlockAccess world, int x, int y, int z) ++ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ return this; -+ } -+ -+ @Override -+ public int getPlantMetadata(IBlockAccess world, int x, int y, int z) -+ { -+ return -1; ++ return func_176223_P(); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockChest.java.patch b/patches/minecraft/net/minecraft/block/BlockChest.java.patch index a953bc497e..1ab56e42bb 100644 --- a/patches/minecraft/net/minecraft/block/BlockChest.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockChest.java.patch @@ -1,44 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockChest.java +++ ../src-work/minecraft/net/minecraft/block/BlockChest.java -@@ -24,6 +24,8 @@ - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; +@@ -531,7 +531,7 @@ -+import static net.minecraftforge.common.util.ForgeDirection.*; -+ - public class BlockChest extends BlockContainer - { - private final Random field_149955_b = new Random(); -@@ -408,7 +410,7 @@ - { - return null; - } -- else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_ + 1, p_149951_4_).func_149721_r()) -+ else if (p_149951_1_.isSideSolid(p_149951_2_, p_149951_3_ + 1, p_149951_4_, DOWN)) - { - return null; - } -@@ -416,19 +418,19 @@ - { - return null; - } -- else if (p_149951_1_.func_147439_a(p_149951_2_ - 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.func_147439_a(p_149951_2_ - 1, p_149951_3_ + 1, p_149951_4_).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_ - 1, p_149951_3_, p_149951_4_))) -+ else if (p_149951_1_.func_147439_a(p_149951_2_ - 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.isSideSolid(p_149951_2_ - 1, p_149951_3_ + 1, p_149951_4_, DOWN) || func_149953_o(p_149951_1_, p_149951_2_ - 1, p_149951_3_, p_149951_4_))) - { - return null; - } -- else if (p_149951_1_.func_147439_a(p_149951_2_ + 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.func_147439_a(p_149951_2_ + 1, p_149951_3_ + 1, p_149951_4_).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_ + 1, p_149951_3_, p_149951_4_))) -+ else if (p_149951_1_.func_147439_a(p_149951_2_ + 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.isSideSolid(p_149951_2_ + 1, p_149951_3_ + 1, p_149951_4_, DOWN) || func_149953_o(p_149951_1_, p_149951_2_ + 1, p_149951_3_, p_149951_4_))) - { - return null; - } -- else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ - 1) == this && (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_ + 1, p_149951_4_ - 1).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ - 1))) -+ else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ - 1) == this && (p_149951_1_.isSideSolid(p_149951_2_, p_149951_3_ + 1, p_149951_4_ - 1, DOWN) || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ - 1))) - { - return null; - } -- else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ + 1) == this && (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_ + 1, p_149951_4_ + 1).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ + 1))) -+ else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ + 1) == this && (p_149951_1_.isSideSolid(p_149951_2_, p_149951_3_ + 1, p_149951_4_ + 1, DOWN) || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ + 1))) - { - return null; - } + private boolean func_176456_n(World p_176456_1_, BlockPos p_176456_2_) + { +- return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).func_177230_c().func_149721_r(); ++ return p_176456_1_.isSideSolid(p_176456_2_.func_177984_a(), EnumFacing.DOWN, false); + } + + private boolean func_176453_o(World p_176453_1_, BlockPos p_176453_2_) diff --git a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch index 5e271ea592..cffac20370 100644 --- a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch @@ -1,46 +1,29 @@ --- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java +++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java -@@ -2,6 +2,7 @@ +@@ -137,7 +137,14 @@ - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.ArrayList; - import java.util.Random; - import net.minecraft.block.material.Material; - import net.minecraft.client.renderer.texture.IIconRegister; -@@ -160,6 +161,13 @@ - - public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { -+ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); +- int j = ((Integer)p_180653_3_.func_177229_b(field_176501_a)).intValue(); ++ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); + } + + @Override -+ public ArrayList getDrops(World world, int x, int y, int z, int p_149690_5_, int fortune) ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { -+ ArrayList dropped = super.getDrops(world, x, y, z, p_149690_5_, fortune); - int j1 = func_149987_c(p_149690_5_); ++ java.util.List dropped = super.getDrops(world, pos, state, fortune); ++ int j = ((Integer)state.func_177229_b(field_176501_a)).intValue(); byte b0 = 1; -@@ -170,8 +178,9 @@ + if (j >= 2) +@@ -147,8 +154,9 @@ - for (int k1 = 0; k1 < b0; ++k1) + for (int k = 0; k < b0; ++k) { -- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(Items.field_151100_aR, 1, 3)); -+ dropped.add(new ItemStack(Items.field_151100_aR, 1, 3)); +- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(Items.field_151100_aR, 1, EnumDyeColor.BROWN.func_176767_b())); ++ dropped.add(new ItemStack(Items.field_151100_aR, 1, EnumDyeColor.BROWN.func_176767_b())); } + return dropped; } @SideOnly(Side.CLIENT) -@@ -216,4 +225,10 @@ - ++j1; - p_149853_1_.func_72921_c(p_149853_3_, p_149853_4_, p_149853_5_, j1 << 2 | i1, 2); - } -+ -+ @Override -+ public Item func_149650_a(int par1, Random par2Random, int par3) -+ { -+ return null; -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch index 16dd140952..f214f74fc8 100644 --- a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -1,79 +1,68 @@ --- ../src-base/minecraft/net/minecraft/block/BlockCrops.java +++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java -@@ -2,6 +2,7 @@ - - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.ArrayList; - import java.util.Random; - import net.minecraft.client.renderer.texture.IIconRegister; - import net.minecraft.creativetab.CreativeTabs; -@@ -12,6 +13,7 @@ - import net.minecraft.util.IIcon; - import net.minecraft.util.MathHelper; - import net.minecraft.world.World; -+import net.minecraftforge.common.util.ForgeDirection; - - public class BlockCrops extends BlockBush implements IGrowable - { -@@ -89,11 +91,11 @@ - { +@@ -82,11 +82,11 @@ float f1 = 0.0F; + IBlockState iblockstate = p_180672_1_.func_180495_p(blockpos1.func_177982_a(i, 0, j)); -- if (p_149864_1_.func_147439_a(l, p_149864_3_ - 1, i1) == Blocks.field_150458_ak) -+ if (p_149864_1_.func_147439_a(l, p_149864_3_ - 1, i1).canSustainPlant(p_149864_1_, l, p_149864_3_ - 1, i1, ForgeDirection.UP, this)) +- if (iblockstate.func_177230_c() == Blocks.field_150458_ak) ++ if (iblockstate.func_177230_c().canSustainPlant(p_180672_1_, blockpos1.func_177982_a(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)p_180672_0_)) { f1 = 1.0F; -- if (p_149864_1_.func_72805_g(l, p_149864_3_ - 1, i1) > 0) -+ if (p_149864_1_.func_147439_a(l, p_149864_3_ - 1, i1).isFertile(p_149864_1_, l, p_149864_3_ - 1, i1)) +- if (((Integer)iblockstate.func_177229_b(BlockFarmland.field_176531_a)).intValue() > 0) ++ if (iblockstate.func_177230_c().isFertile(p_180672_1_, blockpos1.func_177982_a(i, 0, j))) { f1 = 3.0F; } -@@ -145,22 +147,6 @@ - public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) +@@ -143,24 +143,6 @@ + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { - super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, 0); + super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, 0); - -- if (!p_149690_1_.field_72995_K) +- if (!p_180653_1_.field_72995_K) - { -- if (p_149690_5_ >= 7) -- { -- int j1 = 3 + p_149690_7_; +- int j = ((Integer)p_180653_3_.func_177229_b(field_176488_a)).intValue(); - -- for (int k1 = 0; k1 < j1; ++k1) +- if (j >= 7) +- { +- int k = 3 + p_180653_5_; +- +- for (int l = 0; l < k; ++l) - { -- if (p_149690_1_.field_73012_v.nextInt(15) <= p_149690_5_) +- if (p_180653_1_.field_73012_v.nextInt(15) <= j) - { -- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(this.func_149866_i(), 1, 0)); +- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(this.func_149866_i(), 1, 0)); - } - } - } - } } - public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_) -@@ -204,4 +190,23 @@ + public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) +@@ -203,4 +185,26 @@ { - this.func_149863_m(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_); + return new BlockState(this, new IProperty[] {field_176488_a}); } + + @Override -+ public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) ++ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { -+ ArrayList ret = super.getDrops(world, x, y, z, metadata, fortune); ++ java.util.List ret = super.getDrops(world, pos, state, fortune); ++ int age = ((Integer)state.func_177229_b(field_176488_a)).intValue(); ++ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); + -+ if (metadata >= 7) ++ if (age >= 7) + { ++ int k = 3 + fortune; ++ + for (int i = 0; i < 3 + fortune; ++i) + { -+ if (world.field_73012_v.nextInt(15) <= metadata) ++ if (rand.nextInt(15) <= age) + { + ret.add(new ItemStack(this.func_149866_i(), 1, 0)); + } + } + } -+ + return ret; + } } diff --git a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch index 5a46765620..daeef6fe3c 100644 --- a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch @@ -1,45 +1,33 @@ --- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java +++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java -@@ -1,5 +1,7 @@ - package net.minecraft.block; - -+import java.util.ArrayList; -+import java.util.Arrays; - import java.util.Random; - import net.minecraft.block.material.Material; - import net.minecraft.entity.player.EntityPlayer; -@@ -8,9 +10,11 @@ - import net.minecraft.item.Item; - import net.minecraft.item.ItemStack; - import net.minecraft.stats.StatList; -+import net.minecraft.world.IBlockAccess; +@@ -13,7 +13,7 @@ + import net.minecraft.util.BlockPos; import net.minecraft.world.World; -+import net.minecraftforge.common.IShearable; -public class BlockDeadBush extends BlockBush -+public class BlockDeadBush extends BlockBush implements IShearable ++public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable { private static final String __OBFID = "CL_00000224"; -@@ -33,14 +37,15 @@ +@@ -41,14 +41,15 @@ - public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_) + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) { -- if (!p_149636_1_.field_72995_K && p_149636_2_.func_71045_bC() != null && p_149636_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) +- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) { -- p_149636_2_.func_71064_a(StatList.field_75934_C[Block.func_149682_b(this)], 1); -- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Blocks.field_150330_I, 1, p_149636_6_)); +- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); +- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150330_I, 1, 0)); - } - else - { - super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_); + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); } } + -+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) { return true; } ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } + @Override -+ public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ return new ArrayList(Arrays.asList(new ItemStack(Blocks.field_150330_I, 1, world.func_72805_g(x, y, z)))); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(Blocks.field_150330_I))); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch index 554d64cff0..c30049e6b3 100644 --- a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockDoor.java +++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java -@@ -249,7 +249,7 @@ +@@ -149,7 +149,7 @@ { if (this.field_149764_J == Material.field_151573_f) { @@ -9,12 +9,12 @@ } else { -@@ -367,7 +367,7 @@ +@@ -267,7 +267,7 @@ - public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { -- return p_149742_3_ >= 255 ? false : World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) && super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_ + 1, p_149742_4_); -+ return p_149742_3_ >= p_149742_1_.func_72800_K() - 1 ? false : World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) && super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_ + 1, p_149742_4_); +- return p_176196_2_.func_177956_o() >= 255 ? false : World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()) && super.func_176196_c(p_176196_1_, p_176196_2_) && super.func_176196_c(p_176196_1_, p_176196_2_.func_177984_a()); ++ return p_176196_2_.func_177956_o() >= p_176196_1_.func_72800_K() - 1 ? false : World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()) && super.func_176196_c(p_176196_1_, p_176196_2_) && super.func_176196_c(p_176196_1_, p_176196_2_.func_177984_a()); } public int func_149656_h() diff --git a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch index 0170e39fad..a5a811850c 100644 --- a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch @@ -1,52 +1,71 @@ --- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java +++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java -@@ -2,6 +2,7 @@ - - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.ArrayList; - import java.util.List; - import java.util.Random; - import net.minecraft.block.material.Material; -@@ -18,8 +19,9 @@ - import net.minecraft.util.MathHelper; - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; -+import net.minecraftforge.common.IShearable; +@@ -24,7 +24,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; -public class BlockDoublePlant extends BlockBush implements IGrowable -+public class BlockDoublePlant extends BlockBush implements IGrowable, IShearable ++public class BlockDoublePlant extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable { - public static final String[] field_149892_a = new String[] {"sunflower", "syringa", "grass", "fern", "rose", "paeonia"}; - @SideOnly(Side.CLIENT) -@@ -81,6 +83,7 @@ + public static final PropertyEnum field_176493_a = PropertyEnum.func_177709_a("variant", BlockDoublePlant.EnumPlantType.class); + public static final PropertyEnum field_176492_b = PropertyEnum.func_177709_a("half", BlockDoublePlant.EnumBlockHalf.class); +@@ -89,6 +89,8 @@ + Object object = flag ? this : p_176475_1_.func_180495_p(blockpos1).func_177230_c(); + Object object1 = flag ? p_176475_1_.func_180495_p(blockpos2).func_177230_c() : this; - public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_) ++ if (!flag) this.func_176226_b(p_176475_1_, p_176475_2_, p_176475_3_, 0); //Forge move above the setting to air. ++ + if (object == this) + { + p_176475_1_.func_180501_a(blockpos1, Blocks.field_150350_a.func_176223_P(), 3); +@@ -97,17 +99,13 @@ + if (object1 == this) + { + p_176475_1_.func_180501_a(blockpos2, Blocks.field_150350_a.func_176223_P(), 3); +- +- if (!flag) +- { +- this.func_176226_b(p_176475_1_, blockpos2, p_176475_3_, 0); +- } + } + } + } + + public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { -+ if (p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_, p_149718_4_) != this) return super.func_149718_j(p_149718_1_, p_149718_2_, p_149718_3_, p_149718_4_); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. - int l = p_149718_1_.func_72805_g(p_149718_2_, p_149718_3_, p_149718_4_); - return func_149887_c(l) ? p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == this : p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ + 1, p_149718_4_) == this && super.func_149718_j(p_149718_1_, p_149718_2_, p_149718_3_, p_149718_4_); ++ if (p_180671_3_.func_177230_c() != this) return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_3_); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. + if (p_180671_3_.func_177229_b(field_176492_b) == BlockDoublePlant.EnumBlockHalf.UPPER) + { + return p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c() == this; +@@ -157,7 +155,6 @@ + + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) + { +- if (p_180657_1_.field_72995_K || p_180657_2_.func_71045_bC() == null || p_180657_2_.func_71045_bC().func_77973_b() != Items.field_151097_aZ || p_180657_4_.func_177229_b(field_176492_b) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.func_176489_b(p_180657_1_, p_180657_3_, p_180657_4_, p_180657_2_)) + { + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); + } +@@ -296,6 +293,23 @@ + return Block.EnumOffsetType.XZ; } -@@ -262,4 +265,22 @@ - int l = this.func_149885_e(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_); - this.func_149642_a(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_, new ItemStack(this, 1, l)); - } -+ + + @Override -+ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) ++ public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos) + { -+ int metadata = world.func_72805_g(x, y, z); -+ int type = func_149890_d(metadata); -+ return func_149887_c(metadata) && (type == 3 || type == 4); ++ IBlockState state = world.func_180495_p(pos); ++ EnumPlantType type = (EnumPlantType)state.func_177229_b(field_176493_a); ++ return state.func_177229_b(field_176492_b) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS); + } -+ + @Override -+ public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ ArrayList ret = new ArrayList(); -+ int type = func_149890_d(world.func_72805_g(x, y, z)); -+ if (type == 3 || type == 2) -+ ret.add(new ItemStack(Blocks.field_150329_H, 2, type == 3 ? 2 : 1)); ++ java.util.List ret = new java.util.ArrayList(); ++ EnumPlantType type = (EnumPlantType)world.func_180495_p(pos).func_177229_b(field_176493_a); ++ if (type == EnumPlantType.FERN) ret.add(new ItemStack(Blocks.field_150329_H, 2, BlockTallGrass.EnumType.FERN.func_177044_a())); ++ if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.field_150329_H, 2, BlockTallGrass.EnumType.GRASS.func_177044_a())); + return ret; + } - } ++ + static enum EnumBlockHalf implements IStringSerializable + { + UPPER, diff --git a/patches/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch index c38ada9c6a..c7dd1fa255 100644 --- a/patches/minecraft/net/minecraft/block/BlockFalling.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch @@ -1,19 +1,10 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFalling.java +++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java -@@ -84,7 +84,7 @@ - { - Block block = p_149831_0_.func_147439_a(p_149831_1_, p_149831_2_, p_149831_3_); +@@ -85,6 +85,7 @@ -- if (block.field_149764_J == Material.field_151579_a) -+ if (block.isAir(p_149831_0_, p_149831_1_, p_149831_2_, p_149831_3_)) - { - return true; - } -@@ -94,6 +94,7 @@ - } - else - { -+ //TODO: King, take a look here when doing liquids! - Material material = block.field_149764_J; - return material == Material.field_151586_h ? true : material == Material.field_151587_i; - } + public static boolean func_180685_d(World p_180685_0_, BlockPos p_180685_1_) + { ++ if (p_180685_0_.func_175623_d(p_180685_1_)) return true; + Block block = p_180685_0_.func_180495_p(p_180685_1_).func_177230_c(); + Material material = block.field_149764_J; + return block == Blocks.field_150480_ab || material == Material.field_151579_a || material == Material.field_151586_h || material == Material.field_151587_i; diff --git a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch index d964fd5321..7547658d37 100644 --- a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch @@ -1,20 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java +++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java -@@ -12,6 +12,8 @@ - import net.minecraft.util.AxisAlignedBB; - import net.minecraft.util.IIcon; - import net.minecraft.world.World; -+import net.minecraftforge.common.IPlantable; -+import net.minecraftforge.common.util.ForgeDirection; +@@ -89,7 +89,7 @@ + private boolean func_176529_d(World p_176529_1_, BlockPos p_176529_2_) + { + Block block = p_176529_1_.func_180495_p(p_176529_2_.func_177984_a()).func_177230_c(); +- return block instanceof BlockCrops || block instanceof BlockStem; ++ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(p_176529_1_, p_176529_2_, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block); + } - public class BlockFarmland extends Block - { -@@ -94,7 +96,7 @@ - { - Block block = p_149822_1_.func_147439_a(l, p_149822_3_ + 1, i1); - -- if (block == Blocks.field_150464_aj || block == Blocks.field_150394_bc || block == Blocks.field_150393_bb || block == Blocks.field_150469_bN || block == Blocks.field_150459_bM) -+ if (block instanceof IPlantable && canSustainPlant(p_149822_1_, p_149822_2_, p_149822_3_, p_149822_4_, ForgeDirection.UP, (IPlantable)block)) - { - return true; - } + private boolean func_176530_e(World p_176530_1_, BlockPos p_176530_2_) diff --git a/patches/minecraft/net/minecraft/block/BlockFire.java.patch b/patches/minecraft/net/minecraft/block/BlockFire.java.patch index 362ffb861e..989c8cb5b3 100644 --- a/patches/minecraft/net/minecraft/block/BlockFire.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFire.java.patch @@ -1,309 +1,211 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFire.java +++ ../src-work/minecraft/net/minecraft/block/BlockFire.java -@@ -2,7 +2,10 @@ +@@ -42,18 +42,24 @@ + int j = p_176221_3_.func_177956_o(); + int k = p_176221_3_.func_177952_p(); - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.IdentityHashMap; -+import java.util.Map.Entry; - import java.util.Random; -+import com.google.common.collect.Maps; - import net.minecraft.block.material.MapColor; - import net.minecraft.block.material.Material; - import net.minecraft.client.renderer.texture.IIconRegister; -@@ -12,11 +15,15 @@ - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; - import net.minecraft.world.WorldProviderEnd; -+import net.minecraftforge.common.util.ForgeDirection; -+import static net.minecraftforge.common.util.ForgeDirection.*; - - public class BlockFire extends Block - { -- private int[] field_149849_a = new int[256]; -- private int[] field_149848_b = new int[256]; -+ @Deprecated -+ private int[] field_149849_a = new int[4096]; -+ @Deprecated -+ private int[] field_149848_b = new int[4096]; - @SideOnly(Side.CLIENT) - private IIcon[] field_149850_M; - private static final String __OBFID = "CL_00000245"; -@@ -54,10 +61,10 @@ - Blocks.field_150480_ab.func_149842_a(func_149682_b(Blocks.field_150404_cg), 60, 20); - } - -+ @Deprecated // Use setFireInfo - public void func_149842_a(int p_149842_1_, int p_149842_2_, int p_149842_3_) - { -- this.field_149849_a[p_149842_1_] = p_149842_2_; -- this.field_149848_b[p_149842_1_] = p_149842_3_; -+ this.setFireInfo((Block)Block.field_149771_c.func_148754_a(p_149842_1_), p_149842_2_, p_149842_3_); - } - - public AxisAlignedBB func_149668_a(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) -@@ -94,13 +101,8 @@ - { - if (p_149674_1_.func_82736_K().func_82766_b("doFireTick")) +- if (!World.func_175683_a(p_176221_2_, p_176221_3_.func_177977_b()) && !Blocks.field_150480_ab.func_176535_e(p_176221_2_, p_176221_3_.func_177977_b())) ++ if (!World.func_175683_a(p_176221_2_, p_176221_3_.func_177977_b()) && !Blocks.field_150480_ab.canCatchFire(p_176221_2_, p_176221_3_.func_177977_b(), EnumFacing.UP)) { -- boolean flag = p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - 1, p_149674_4_) == Blocks.field_150424_aL; -+ boolean flag = p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - 1, p_149674_4_).isFireSource(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP); + boolean flag = (i + j + k & 1) == 1; + boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1; + int l = 0; -- if (p_149674_1_.field_73011_w instanceof WorldProviderEnd && p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - 1, p_149674_4_) == Blocks.field_150357_h) +- if (this.func_176535_e(p_176221_2_, p_176221_3_.func_177984_a())) ++ if (this.canCatchFire(p_176221_2_, p_176221_3_.func_177984_a(), EnumFacing.DOWN)) + { + l = flag ? 1 : 2; + } + +- return p_176221_1_.func_177226_a(field_176545_N, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177978_c()))).func_177226_a(field_176546_O, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177974_f()))).func_177226_a(field_176541_P, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177968_d()))).func_177226_a(field_176539_Q, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177976_e()))).func_177226_a(field_176542_R, Integer.valueOf(l)).func_177226_a(field_176540_b, Boolean.valueOf(flag1)).func_177226_a(field_176544_M, Boolean.valueOf(flag)); ++ return p_176221_1_.func_177226_a(field_176545_N, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177978_c(), EnumFacing.SOUTH))) ++ .func_177226_a(field_176546_O, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177974_f(), EnumFacing.EAST ))) ++ .func_177226_a(field_176541_P, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177968_d(), EnumFacing.NORTH))) ++ .func_177226_a(field_176539_Q, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177976_e(), EnumFacing.EAST ))) ++ .func_177226_a(field_176542_R, Integer.valueOf(l)) ++ .func_177226_a(field_176540_b, Boolean.valueOf(flag1)) ++ .func_177226_a(field_176544_M, Boolean.valueOf(flag)); + } + else + { +@@ -109,6 +115,7 @@ + + public void func_180686_a(Block p_180686_1_, int p_180686_2_, int p_180686_3_) + { ++ if (p_180686_1_ == Blocks.field_150350_a) throw new IllegalArgumentException("Tried to set air on fire... This is bad."); + this.field_149849_a.put(p_180686_1_, Integer.valueOf(p_180686_2_)); + this.field_149848_b.put(p_180686_1_, Integer.valueOf(p_180686_3_)); + } +@@ -148,13 +155,8 @@ + } + + Block block = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_177230_c(); +- boolean flag = block == Blocks.field_150424_aL; ++ boolean flag = block.isFireSource(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP); + +- if (p_180650_1_.field_73011_w instanceof WorldProviderEnd && block == Blocks.field_150357_h) - { - flag = true; - } - - if (!this.func_149742_c(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_)) + if (!flag && p_180650_1_.func_72896_J() && this.func_176537_d(p_180650_1_, p_180650_2_)) { - p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_); -@@ -128,7 +130,7 @@ - p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_); - } - } -- else if (!flag && !this.func_149844_e(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_) && l == 15 && p_149674_5_.nextInt(4) == 0) -+ else if (!flag && !this.canCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP) && l == 15 && p_149674_5_.nextInt(4) == 0) - { - p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_); - } -@@ -142,12 +144,12 @@ - b0 = -50; + p_180650_1_.func_175698_g(p_180650_2_); +@@ -183,7 +185,7 @@ + return; } -- this.func_149841_a(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l); -- this.func_149841_a(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l); -- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, 250 + b0, p_149674_5_, l); -- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, 250 + b0, p_149674_5_, l); -- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1, 300 + b0, p_149674_5_, l); -- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1, 300 + b0, p_149674_5_, l); -+ this.tryCatchFire(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l, WEST ); -+ this.tryCatchFire(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l, EAST ); -+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, 250 + b0, p_149674_5_, l, UP ); -+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, 250 + b0, p_149674_5_, l, DOWN ); -+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1, 300 + b0, p_149674_5_, l, SOUTH); -+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1, 300 + b0, p_149674_5_, l, NORTH); - - for (int i1 = p_149674_2_ - 1; i1 <= p_149674_2_ + 1; ++i1) +- if (!this.func_176535_e(p_180650_1_, p_180650_2_.func_177977_b()) && i == 15 && p_180650_4_.nextInt(4) == 0) ++ if (!this.canCatchFire(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP) && i == 15 && p_180650_4_.nextInt(4) == 0) { -@@ -201,10 +203,16 @@ + p_180650_1_.func_175698_g(p_180650_2_); + return; +@@ -198,12 +200,12 @@ + b0 = -50; + } + +- this.func_176536_a(p_180650_1_, p_180650_2_.func_177974_f(), 300 + b0, p_180650_4_, i); +- this.func_176536_a(p_180650_1_, p_180650_2_.func_177976_e(), 300 + b0, p_180650_4_, i); +- this.func_176536_a(p_180650_1_, p_180650_2_.func_177977_b(), 250 + b0, p_180650_4_, i); +- this.func_176536_a(p_180650_1_, p_180650_2_.func_177984_a(), 250 + b0, p_180650_4_, i); +- this.func_176536_a(p_180650_1_, p_180650_2_.func_177978_c(), 300 + b0, p_180650_4_, i); +- this.func_176536_a(p_180650_1_, p_180650_2_.func_177968_d(), 300 + b0, p_180650_4_, i); ++ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177974_f(), 300 + b0, p_180650_4_, i, EnumFacing.WEST); ++ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177976_e(), 300 + b0, p_180650_4_, i, EnumFacing.EAST); ++ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177977_b(), 250 + b0, p_180650_4_, i, EnumFacing.UP); ++ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177984_a(), 250 + b0, p_180650_4_, i, EnumFacing.DOWN); ++ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177978_c(), 300 + b0, p_180650_4_, i, EnumFacing.SOUTH); ++ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177968_d(), 300 + b0, p_180650_4_, i, EnumFacing.NORTH); + + for (int j = -1; j <= 1; ++j) + { +@@ -262,22 +264,30 @@ return false; } -+ @Deprecated - private void func_149841_a(World p_149841_1_, int p_149841_2_, int p_149841_3_, int p_149841_4_, int p_149841_5_, Random p_149841_6_, int p_149841_7_) ++ @Deprecated // Use Block.getFlammability + public int func_176532_c(Block p_176532_1_) { -- int j1 = this.field_149848_b[Block.func_149682_b(p_149841_1_.func_147439_a(p_149841_2_, p_149841_3_, p_149841_4_))]; -+ this.tryCatchFire(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, p_149841_5_, p_149841_6_, p_149841_7_, UP); + Integer integer = (Integer)this.field_149848_b.get(p_176532_1_); + return integer == null ? 0 : integer.intValue(); + } + ++ @Deprecated // Use Block.getFlammability + public int func_176534_d(Block p_176534_1_) + { + Integer integer = (Integer)this.field_149849_a.get(p_176534_1_); + return integer == null ? 0 : integer.intValue(); + } + ++ @Deprecated // Use tryCatchFire with face below + private void func_176536_a(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_) + { +- int k = this.func_176532_c(p_176536_1_.func_180495_p(p_176536_2_).func_177230_c()); ++ this.tryCatchFire(p_176536_1_, p_176536_2_, p_176536_3_, p_176536_4_, p_176536_5_, EnumFacing.UP); + } -+ private void tryCatchFire(World p_149841_1_, int p_149841_2_, int p_149841_3_, int p_149841_4_, int p_149841_5_, Random p_149841_6_, int p_149841_7_, ForgeDirection face) ++ private void tryCatchFire(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_, EnumFacing face) + { -+ int j1 = p_149841_1_.func_147439_a(p_149841_2_, p_149841_3_, p_149841_4_).getFlammability(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, face); ++ int k = p_176536_1_.func_180495_p(p_176536_2_).func_177230_c().getFlammability(p_176536_1_, p_176536_2_, face); + - if (p_149841_6_.nextInt(p_149841_5_) < j1) + if (p_176536_4_.nextInt(p_176536_3_) < k) { - boolean flag = p_149841_1_.func_147439_a(p_149841_2_, p_149841_3_, p_149841_4_) == Blocks.field_150335_W; -@@ -234,7 +242,12 @@ - - private boolean func_149847_e(World p_149847_1_, int p_149847_2_, int p_149847_3_, int p_149847_4_) - { -- return this.func_149844_e(p_149847_1_, p_149847_2_ + 1, p_149847_3_, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_ - 1, p_149847_3_, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_ - 1, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_ + 1, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ - 1) ? true : this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ + 1))))); -+ return this.canCatchFire(p_149847_1_, p_149847_2_ + 1, p_149847_3_, p_149847_4_, WEST ) || -+ this.canCatchFire(p_149847_1_, p_149847_2_ - 1, p_149847_3_, p_149847_4_, EAST ) || -+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ - 1, p_149847_4_, UP ) || -+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ + 1, p_149847_4_, DOWN ) || -+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ - 1, SOUTH) || -+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ + 1, NORTH); - } - - private int func_149845_m(World p_149845_1_, int p_149845_2_, int p_149845_3_, int p_149845_4_) -@@ -247,12 +260,13 @@ - } - else + IBlockState iblockstate = p_176536_1_.func_180495_p(p_176536_2_); +@@ -314,7 +324,7 @@ { -- int l = this.func_149846_a(p_149845_1_, p_149845_2_ + 1, p_149845_3_, p_149845_4_, b0); -- l = this.func_149846_a(p_149845_1_, p_149845_2_ - 1, p_149845_3_, p_149845_4_, l); -- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_ - 1, p_149845_4_, l); -- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_ + 1, p_149845_4_, l); -- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ - 1, l); -- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ + 1, l); -+ int l = b0; -+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_ + 1, p_149845_3_, p_149845_4_, l, WEST ); -+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_ - 1, p_149845_3_, p_149845_4_, l, EAST ); -+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_ - 1, p_149845_4_, l, UP ); -+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_ + 1, p_149845_4_, l, DOWN ); -+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ - 1, l, SOUTH); -+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ + 1, l, NORTH); - return l; - } - } -@@ -262,15 +276,16 @@ + EnumFacing enumfacing = aenumfacing[j]; + +- if (this.func_176535_e(p_176533_1_, p_176533_2_.func_177972_a(enumfacing))) ++ if (this.canCatchFire(p_176533_1_, p_176533_2_.func_177972_a(enumfacing), enumfacing.func_176734_d())) + { + return true; + } +@@ -338,7 +348,7 @@ + for (int k = 0; k < j; ++k) + { + EnumFacing enumfacing = aenumfacing[k]; +- i = Math.max(this.func_176534_d(p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(enumfacing)).func_177230_c()), i); ++ i = Math.max(p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(enumfacing)).func_177230_c().getFlammability(p_176538_1_, p_176538_2_.func_177972_a(enumfacing), enumfacing.func_176734_d()), i); + } + + return i; +@@ -350,9 +360,10 @@ return false; } -+ @Deprecated - public boolean func_149844_e(IBlockAccess p_149844_1_, int p_149844_2_, int p_149844_3_, int p_149844_4_) ++ @Deprecated // Use canCatchFire with face sensitive version below + public boolean func_176535_e(IBlockAccess p_176535_1_, BlockPos p_176535_2_) { -- return this.field_149849_a[Block.func_149682_b(p_149844_1_.func_147439_a(p_149844_2_, p_149844_3_, p_149844_4_))] > 0; -+ return canCatchFire(p_149844_1_, p_149844_2_, p_149844_3_, p_149844_4_, UP); +- return this.func_176534_d(p_176535_1_.func_180495_p(p_176535_2_).func_177230_c()) > 0; ++ return canCatchFire(p_176535_1_, p_176535_2_, EnumFacing.UP); } -+ @Deprecated - public int func_149846_a(World p_149846_1_, int p_149846_2_, int p_149846_3_, int p_149846_4_, int p_149846_5_) - { -- int i1 = this.field_149849_a[Block.func_149682_b(p_149846_1_.func_147439_a(p_149846_2_, p_149846_3_, p_149846_4_))]; -- return i1 > p_149846_5_ ? i1 : p_149846_5_; -+ return getChanceToEncourageFire(p_149846_1_, p_149846_2_, p_149846_3_, p_149846_4_, p_149846_5_, UP); - } + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) +@@ -396,9 +407,9 @@ + double d1; + double d2; - public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) -@@ -314,9 +329,9 @@ - float f1; - float f2; - -- if (!World.func_147466_a(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_)) -+ if (!World.func_147466_a(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_, UP)) +- if (!World.func_175683_a(p_180655_1_, p_180655_2_.func_177977_b()) && !Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177977_b())) ++ if (!World.func_175683_a(p_180655_1_, p_180655_2_.func_177977_b()) && !Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177977_b(), EnumFacing.UP)) { -- if (Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_)) -+ if (Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_, EAST)) +- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177976_e())) ++ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177976_e(), EnumFacing.EAST)) { - for (l = 0; l < 2; ++l) + for (i = 0; i < 2; ++i) { -@@ -327,7 +342,7 @@ +@@ -409,7 +420,7 @@ } } -- if (Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_)) -+ if (Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_, WEST)) +- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177974_f())) ++ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177974_f(), EnumFacing.WEST)) { - for (l = 0; l < 2; ++l) + for (i = 0; i < 2; ++i) { -@@ -338,7 +353,7 @@ +@@ -420,7 +431,7 @@ } } -- if (Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1)) -+ if (Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1, SOUTH)) +- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177978_c())) ++ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177978_c(), EnumFacing.SOUTH)) { - for (l = 0; l < 2; ++l) + for (i = 0; i < 2; ++i) { -@@ -349,7 +364,7 @@ +@@ -431,7 +442,7 @@ } } -- if (Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1)) -+ if (Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1, NORTH)) +- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177968_d())) ++ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177968_d(), EnumFacing.NORTH)) { - for (l = 0; l < 2; ++l) + for (i = 0; i < 2; ++i) { -@@ -360,7 +375,7 @@ +@@ -442,7 +453,7 @@ } } -- if (Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_)) -+ if (Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_, DOWN)) +- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177984_a())) ++ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177984_a(), EnumFacing.DOWN)) { - for (l = 0; l < 2; ++l) + for (i = 0; i < 2; ++i) { -@@ -405,4 +420,101 @@ +@@ -490,4 +501,19 @@ { - return MapColor.field_151656_f; + return new BlockState(this, new IProperty[] {field_176543_a, field_176545_N, field_176546_O, field_176541_P, field_176539_Q, field_176542_R, field_176540_b, field_176544_M}); } + + /*================================= Forge Start ======================================*/ -+ private static class FireInfo -+ { -+ private int encouragement = 0; -+ private int flammibility = 0; -+ } -+ private IdentityHashMap blockInfo = Maps.newIdentityHashMap(); -+ -+ public void setFireInfo(Block block, int encouragement, int flammibility) -+ { -+ if (block == Blocks.field_150350_a) throw new IllegalArgumentException("Tried to set air on fire... This is bad."); -+ int id = Block.func_149682_b(block); -+ this.field_149849_a[id] = encouragement; -+ this.field_149848_b[id] = flammibility; -+ -+ FireInfo info = getInfo(block, true); -+ info.encouragement = encouragement; -+ info.flammibility = flammibility; -+ } -+ -+ private FireInfo getInfo(Block block, boolean garentee) -+ { -+ FireInfo ret = blockInfo.get(block); -+ if (ret == null && garentee) -+ { -+ ret = new FireInfo(); -+ blockInfo.put(block, ret); -+ } -+ return ret; -+ } -+ -+ public void rebuildFireInfo() -+ { -+ for (int x = 0; x < 4096; x++) -+ { -+ //If we care.. we could detect changes in here and make sure we keep them, however -+ //it's my thinking that anyone who hacks into the private variables should DIAF and we don't care about them. -+ field_149849_a[x] = 0; -+ field_149848_b[x] = 0; -+ } -+ -+ for (Entry e : blockInfo.entrySet()) -+ { -+ int id = Block.func_149682_b(e.getKey()); -+ if (id >= 0 && id < 4096) -+ { -+ field_149849_a[id] = e.getValue().encouragement; -+ field_149848_b[id] = e.getValue().flammibility; -+ } -+ } -+ } -+ -+ public int getFlammability(Block block) -+ { -+ int id = Block.func_149682_b(block); -+ return id >= 0 && id < 4096 ? field_149848_b[id] : 0; -+ } -+ -+ public int getEncouragement(Block block) -+ { -+ int id = Block.func_149682_b(block); -+ return id >= 0 && id < 4096 ? field_149849_a[id] : 0; -+ } -+ + /** + * Side sensitive version that calls the block function. -+ * ++ * + * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position ++ * @param pos Block position + * @param face The side the fire is coming from + * @return True if the face can catch fire. + */ -+ public boolean canCatchFire(IBlockAccess world, int x, int y, int z, ForgeDirection face) ++ public boolean canCatchFire(IBlockAccess world, BlockPos pos, EnumFacing face) + { -+ return world.func_147439_a(x, y, z).isFlammable(world, x, y, z, face); -+ } -+ -+ /** -+ * Side sensitive version that calls the block function. -+ * -+ * @param world The current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position -+ * @param oldChance The previous maximum chance. -+ * @param face The side the fire is coming from -+ * @return The chance of the block catching fire, or oldChance if it is higher -+ */ -+ public int getChanceToEncourageFire(IBlockAccess world, int x, int y, int z, int oldChance, ForgeDirection face) -+ { -+ int newChance = world.func_147439_a(x, y, z).getFireSpreadSpeed(world, x, y, z, face); -+ return (newChance > oldChance ? newChance : oldChance); ++ return world.func_180495_p(pos).func_177230_c().isFlammable(world, pos, face); + } + /*================================= Forge Start ======================================*/ } diff --git a/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch index 637b3bfad7..fc892d51eb 100644 --- a/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch @@ -1,53 +1,48 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java +++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java -@@ -2,6 +2,7 @@ +@@ -162,13 +162,6 @@ - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.ArrayList; - import java.util.Random; - import net.minecraft.block.material.Material; - import net.minecraft.entity.player.EntityPlayer; -@@ -138,13 +139,6 @@ - - public void func_149749_a(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) + public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) { -- TileEntityFlowerPot tileentityflowerpot = this.func_149929_e(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_); +- TileEntityFlowerPot tileentityflowerpot = this.func_176442_d(p_180663_1_, p_180663_2_); - - if (tileentityflowerpot != null && tileentityflowerpot.func_145965_a() != null) - { -- this.func_149642_a(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, new ItemStack(tileentityflowerpot.func_145965_a(), 1, tileentityflowerpot.func_145966_b())); +- func_180635_a(p_180663_1_, p_180663_2_, new ItemStack(tileentityflowerpot.func_145965_a(), 1, tileentityflowerpot.func_145966_b())); - } - - super.func_149749_a(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_); } -@@ -231,4 +225,28 @@ - - return new TileEntityFlowerPot(Item.func_150898_a((Block)object), b0); +@@ -388,6 +381,31 @@ + return EnumWorldBlockLayer.CUTOUT; } + + + /*============================FORGE START=====================================*/ + @Override -+ public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { -+ ArrayList ret = super.getDrops(world, x, y, z, metadata, fortune); -+ TileEntityFlowerPot te = this.func_149929_e(world, x, y, z); ++ java.util.List ret = super.getDrops(world, pos, state, fortune); ++ TileEntityFlowerPot te = world.func_175625_s(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.func_175625_s(pos) : null; + if (te != null && te.func_145965_a() != null) + ret.add(new ItemStack(te.func_145965_a(), 1, te.func_145966_b())); + return ret; + } + @Override -+ public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) ++ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) + { + if (willHarvest) return true; //If it will harvest, delay deletion of the block until after getDrops -+ return super.removedByPlayer(world, player, x, y, z, willHarvest); ++ return super.removedByPlayer(world, pos, player, willHarvest); + } + @Override -+ public void func_149636_a(World world, EntityPlayer player, int x, int y, int z, int meta) ++ public void func_180657_a(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { -+ super.func_149636_a(world, player, x, y, z, meta); -+ world.func_147468_f(x, y, z); ++ super.func_180657_a(world, player, pos, state, te); ++ world.func_175698_g(pos); + } + /*===========================FORGE END==========================================*/ - } ++ + public static enum EnumFlowerType implements IStringSerializable + { + EMPTY("empty"), diff --git a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch index 48d3edddf1..dec4d15142 100644 --- a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch @@ -1,37 +1,41 @@ --- ../src-base/minecraft/net/minecraft/block/BlockGrass.java +++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java -@@ -43,7 +43,7 @@ +@@ -59,7 +59,7 @@ { - if (!p_149674_1_.field_72995_K) + if (!p_180650_1_.field_72995_K) { -- if (p_149674_1_.func_72957_l(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ + 1, p_149674_4_).func_149717_k() > 2) -+ if (p_149674_1_.func_72957_l(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.getBlockLightOpacity(p_149674_2_, p_149674_3_ + 1, p_149674_4_) > 2) +- if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().func_149717_k() > 2) ++ if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().getLightOpacity(p_180650_1_, p_180650_2_.func_177984_a()) > 2) { - p_149674_1_.func_147449_b(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.field_150346_d); + p_180650_1_.func_175656_a(p_180650_2_, Blocks.field_150346_d.func_176223_P()); } -@@ -56,7 +56,7 @@ - int k1 = p_149674_4_ + p_149674_5_.nextInt(3) - 1; - Block block = p_149674_1_.func_147439_a(i1, j1 + 1, k1); +@@ -73,7 +73,7 @@ + Block block = p_180650_1_.func_180495_p(blockpos1.func_177984_a()).func_177230_c(); + IBlockState iblockstate1 = p_180650_1_.func_180495_p(blockpos1); -- if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.field_150346_d && p_149674_1_.func_72805_g(i1, j1, k1) == 0 && p_149674_1_.func_72957_l(i1, j1 + 1, k1) >= 4 && block.func_149717_k() <= 2) -+ if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.field_150346_d && p_149674_1_.func_72805_g(i1, j1, k1) == 0 && p_149674_1_.func_72957_l(i1, j1 + 1, k1) >= 4 && p_149674_1_.getBlockLightOpacity(i1, j1 + 1, k1) <= 2) - { - p_149674_1_.func_147449_b(i1, j1, k1, Blocks.field_150349_c); +- if (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos1.func_177984_a()) >= 4 && block.func_149717_k() <= 2) ++ if (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos1.func_177984_a()) >= 4 && block.getLightOpacity(p_180650_1_, blockpos1.func_177984_a()) <= 2) + { + p_180650_1_.func_175656_a(blockpos1, Blocks.field_150349_c.func_176223_P()); + } +@@ -120,18 +120,11 @@ + continue; } -@@ -184,15 +184,7 @@ + } +- else if (p_176474_1_.func_180495_p(blockpos2).func_177230_c().field_149764_J == Material.field_151579_a) ++ else if (p_176474_1_.func_175623_d(blockpos2)) + { + if (p_176474_2_.nextInt(8) == 0) + { +- BlockFlower.EnumFlowerType enumflowertype = p_176474_1_.func_180494_b(blockpos2).func_180623_a(p_176474_2_, blockpos2); +- BlockFlower blockflower = enumflowertype.func_176964_a().func_180346_a(); +- IBlockState iblockstate1 = blockflower.func_176223_P().func_177226_a(blockflower.func_176494_l(), enumflowertype); +- +- if (blockflower.func_180671_f(p_176474_1_, blockpos2, iblockstate1)) +- { +- p_176474_1_.func_180501_a(blockpos2, iblockstate1, 3); +- } ++ p_176474_1_.func_180494_b(blockpos2).plantFlower(p_176474_1_, p_176474_2_, blockpos2); } else { -- String s = p_149853_1_.func_72807_a(i1, k1).func_150572_a(p_149853_2_, i1, j1, k1); -- field_149992_a.debug("Flower in " + p_149853_1_.func_72807_a(i1, k1).field_76791_y + ": " + s); -- BlockFlower blockflower = BlockFlower.func_149857_e(s); -- -- if (blockflower != null && blockflower.func_149718_j(p_149853_1_, i1, j1, k1)) -- { -- int i2 = BlockFlower.func_149856_f(s); -- p_149853_1_.func_147465_d(i1, j1, k1, blockflower, i2, 3); -- } -+ p_149853_1_.func_72807_a(i1, k1).plantFlower(p_149853_1_, p_149853_2_, i1, j1, k1); - } - } - diff --git a/patches/minecraft/net/minecraft/block/BlockIce.java.patch b/patches/minecraft/net/minecraft/block/BlockIce.java.patch index 8f0df8ffac..b4f3090b0d 100644 --- a/patches/minecraft/net/minecraft/block/BlockIce.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockIce.java.patch @@ -1,50 +1,35 @@ --- ../src-base/minecraft/net/minecraft/block/BlockIce.java +++ ../src-work/minecraft/net/minecraft/block/BlockIce.java -@@ -2,6 +2,7 @@ +@@ -40,14 +40,17 @@ + p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); + p_180657_2_.func_71020_j(0.025F); - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.ArrayList; - import java.util.Random; - import net.minecraft.block.material.Material; - import net.minecraft.creativetab.CreativeTabs; -@@ -13,6 +14,7 @@ - import net.minecraft.world.EnumSkyBlock; - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; -+import net.minecraftforge.event.ForgeEventFactory; - - public class BlockIce extends BlockBreakable - { -@@ -43,14 +45,16 @@ - p_149636_2_.func_71064_a(StatList.field_75934_C[Block.func_149682_b(this)], 1); - p_149636_2_.func_71020_j(0.025F); - -- if (this.func_149700_E() && EnchantmentHelper.func_77502_d(p_149636_2_)) -+ if (this.canSilkHarvest(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_) && EnchantmentHelper.func_77502_d(p_149636_2_)) +- if (this.func_149700_E() && EnchantmentHelper.func_77502_d(p_180657_2_)) ++ if (this.canSilkHarvest(p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), p_180657_2_) && EnchantmentHelper.func_77502_d(p_180657_2_)) { -+ ArrayList items = new ArrayList(); - ItemStack itemstack = this.func_149644_j(p_149636_6_); ++ java.util.List items = new java.util.ArrayList(); + ItemStack itemstack = this.func_180643_i(p_180657_4_); - if (itemstack != null) - { -- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, itemstack); +- func_180635_a(p_180657_1_, p_180657_3_, itemstack); - } + if (itemstack != null) items.add(itemstack); + -+ ForgeEventFactory.fireBlockHarvesting(items, p_149636_1_, this, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_, 0, 1.0f, true, p_149636_2_); ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), 0, 1.0f, true, p_180657_2_); ++ + for (ItemStack is : items) -+ this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, is); ++ func_180635_a(p_180657_1_, p_180657_3_, is); } else { -@@ -61,7 +65,9 @@ +@@ -58,7 +61,9 @@ } - int i1 = EnchantmentHelper.func_77517_e(p_149636_2_); -+ harvesters.set(p_149636_2_); - this.func_149697_b(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_, i1); + int i = EnchantmentHelper.func_77517_e(p_180657_2_); ++ harvesters.set(p_180657_2_); + this.func_176226_b(p_180657_1_, p_180657_3_, p_180657_4_, i); + harvesters.set(null); - Material material = p_149636_1_.func_147439_a(p_149636_3_, p_149636_4_ - 1, p_149636_5_).func_149688_o(); + Material material = p_180657_1_.func_180495_p(p_180657_3_.func_177977_b()).func_177230_c().func_149688_o(); if (material.func_76230_c() || material.func_76224_d()) diff --git a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch index c586c85af7..0c31683820 100644 --- a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch @@ -1,93 +1,23 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLadder.java +++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java -@@ -5,10 +5,14 @@ - import java.util.Random; - import net.minecraft.block.material.Material; - import net.minecraft.creativetab.CreativeTabs; -+import net.minecraft.entity.EntityLivingBase; - import net.minecraft.util.AxisAlignedBB; - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; +@@ -80,7 +80,10 @@ -+import net.minecraftforge.common.util.ForgeDirection; -+import static net.minecraftforge.common.util.ForgeDirection.*; -+ - public class BlockLadder extends Block - { - private static final String __OBFID = "CL_00000262"; -@@ -79,29 +83,32 @@ - - public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { -- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r())); -+ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) || -+ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) || -+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) || -+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH); +- return p_176196_1_.func_180495_p(p_176196_2_.func_177976_e()).func_177230_c().func_149721_r() ? true : (p_176196_1_.func_180495_p(p_176196_2_.func_177974_f()).func_177230_c().func_149721_r() ? true : (p_176196_1_.func_180495_p(p_176196_2_.func_177978_c()).func_177230_c().func_149721_r() ? true : p_176196_1_.func_180495_p(p_176196_2_.func_177968_d()).func_177230_c().func_149721_r())); ++ return p_176196_1_.isSideSolid(p_176196_2_.func_177976_e(), EnumFacing.EAST, true) || ++ p_176196_1_.isSideSolid(p_176196_2_.func_177974_f(), EnumFacing.WEST, true) || ++ p_176196_1_.isSideSolid(p_176196_2_.func_177978_c(), EnumFacing.SOUTH, true) || ++ p_176196_1_.isSideSolid(p_176196_2_.func_177968_d(), EnumFacing.NORTH, true); } - public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) + public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) +@@ -124,7 +127,7 @@ + + protected boolean func_176381_b(World p_176381_1_, BlockPos p_176381_2_, EnumFacing p_176381_3_) { - int j1 = p_149660_9_; - -- if ((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ + 1).func_149721_r()) -+ if ((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH)) - { - j1 = 2; - } - -- if ((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ - 1).func_149721_r()) -+ if ((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH)) - { - j1 = 3; - } - -- if ((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.func_147439_a(p_149660_2_ + 1, p_149660_3_, p_149660_4_).func_149721_r()) -+ if ((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST)) - { - j1 = 4; - } - -- if ((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.func_147439_a(p_149660_2_ - 1, p_149660_3_, p_149660_4_).func_149721_r()) -+ if ((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST)) - { - j1 = 5; - } -@@ -114,22 +121,22 @@ - int l = p_149695_1_.func_72805_g(p_149695_2_, p_149695_3_, p_149695_4_); - boolean flag = false; - -- if (l == 2 && p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r()) -+ if (l == 2 && p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH)) - { - flag = true; - } - -- if (l == 3 && p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r()) -+ if (l == 3 && p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH)) - { - flag = true; - } - -- if (l == 4 && p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r()) -+ if (l == 4 && p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST)) - { - flag = true; - } - -- if (l == 5 && p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r()) -+ if (l == 5 && p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST)) - { - flag = true; - } -@@ -147,4 +154,10 @@ - { - return 1; +- return p_176381_1_.func_180495_p(p_176381_2_.func_177972_a(p_176381_3_.func_176734_d())).func_177230_c().func_149721_r(); ++ return p_176381_1_.isSideSolid(p_176381_2_.func_177972_a(p_176381_3_.func_176734_d()), p_176381_3_, true); } -+ -+ @Override -+ public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) -+ { -+ return true; -+ } - } + + @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch index 570196d986..270eade4c9 100644 --- a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch @@ -1,151 +1,108 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java +++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java -@@ -2,6 +2,7 @@ - - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.ArrayList; - import java.util.Random; - import net.minecraft.block.material.Material; - import net.minecraft.creativetab.CreativeTabs; -@@ -15,8 +16,9 @@ - import net.minecraft.world.ColorizerFoliage; - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; -+import net.minecraftforge.common.IShearable; +@@ -18,7 +18,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; -public abstract class BlockLeaves extends BlockLeavesBase -+public abstract class BlockLeaves extends BlockLeavesBase implements IShearable ++public abstract class BlockLeaves extends BlockLeavesBase implements net.minecraftforge.common.IShearable { - int[] field_150128_a; - @SideOnly(Side.CLIENT) -@@ -82,10 +84,10 @@ - { - for (int l1 = -b0; l1 <= b0; ++l1) - { -- if (p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1).func_149688_o() == Material.field_151584_j) -+ Block block = p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1); -+ if (block.isLeaves(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1)) + public static final PropertyBool field_176237_a = PropertyBool.func_177716_a("decayable"); + public static final PropertyBool field_176236_b = PropertyBool.func_177716_a("check_decay"); +@@ -76,9 +76,9 @@ + BlockPos blockpos1 = p_180663_2_.func_177982_a(i1, j1, k1); + IBlockState iblockstate1 = p_180663_1_.func_180495_p(blockpos1); + +- if (iblockstate1.func_177230_c().func_149688_o() == Material.field_151584_j && !((Boolean)iblockstate1.func_177229_b(field_176236_b)).booleanValue()) ++ if (iblockstate1.func_177230_c().isLeaves(p_180663_1_, blockpos1)) { -- int i2 = p_149749_1_.func_72805_g(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1); -- p_149749_1_.func_72921_c(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1, i2 | 8, 4); -+ block.beginLeavesDecay(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1); +- p_180663_1_.func_180501_a(blockpos1, iblockstate1.func_177226_a(field_176236_b, Boolean.valueOf(true)), 4); ++ iblockstate1.func_177230_c().beginLeavesDecay(p_180663_1_, blockpos1); } } } -@@ -127,9 +129,9 @@ +@@ -119,11 +119,12 @@ + { + for (i2 = -b0; i2 <= b0; ++i2) { - Block block = p_149674_1_.func_147439_a(p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2); +- Block block = p_180650_1_.func_180495_p(new BlockPos(j + k1, k + l1, l + i2)).func_177230_c(); ++ BlockPos tmp = new BlockPos(j + k1, k + l1, l + i2); ++ Block block = p_180650_1_.func_180495_p(tmp).func_177230_c(); - if (block != Blocks.field_150364_r && block != Blocks.field_150363_s) -+ if (!block.canSustainLeaves(p_149674_1_, p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2)) ++ if (!block.canSustainLeaves(p_180650_1_, tmp)) { - if (block.func_149688_o() == Material.field_151584_j) -+ if (block.isLeaves(p_149674_1_, p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2)) ++ if (block.isLeaves(p_180650_1_, tmp)) { - this.field_150128_a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2; + this.field_150128_a[(k1 + j1) * i1 + (l1 + j1) * b1 + i2 + j1] = -2; } -@@ -236,40 +238,7 @@ +@@ -230,40 +231,7 @@ - public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { -- if (!p_149690_1_.field_72995_K) +- if (!p_180653_1_.field_72995_K) - { -- int j1 = this.func_150123_b(p_149690_5_); +- int j = this.func_176232_d(p_180653_3_); - -- if (p_149690_7_ > 0) +- if (p_180653_5_ > 0) - { -- j1 -= 2 << p_149690_7_; +- j -= 2 << p_180653_5_; - -- if (j1 < 10) +- if (j < 10) - { -- j1 = 10; +- j = 10; - } - } - -- if (p_149690_1_.field_73012_v.nextInt(j1) == 0) +- if (p_180653_1_.field_73012_v.nextInt(j) == 0) - { -- Item item = this.func_149650_a(p_149690_5_, p_149690_1_.field_73012_v, p_149690_7_); -- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(item, 1, this.func_149692_a(p_149690_5_))); +- Item item = this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_); +- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(item, 1, this.func_180651_a(p_180653_3_))); - } - -- j1 = 200; +- j = 200; - -- if (p_149690_7_ > 0) +- if (p_180653_5_ > 0) - { -- j1 -= 10 << p_149690_7_; +- j -= 10 << p_180653_5_; - -- if (j1 < 40) +- if (j < 40) - { -- j1 = 40; +- j = 40; - } - } - -- this.func_150124_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, j1); +- this.func_176234_a(p_180653_1_, p_180653_2_, p_180653_3_, j); - } -+ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, 1.0f, p_149690_7_); ++ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); } - protected void func_150124_c(World p_150124_1_, int p_150124_2_, int p_150124_3_, int p_150124_4_, int p_150124_5_, int p_150124_6_) {} -@@ -281,13 +250,7 @@ - - public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_) - { -- if (!p_149636_1_.field_72995_K && p_149636_2_.func_71045_bC() != null && p_149636_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) - { -- p_149636_2_.func_71064_a(StatList.field_75934_C[Block.func_149682_b(this)], 1); -- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Item.func_150898_a(this), 1, p_149636_6_ & 3)); -- } -- else -- { - super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_); - } - } -@@ -318,4 +281,67 @@ + protected void func_176234_a(World p_176234_1_, BlockPos p_176234_2_, IBlockState p_176234_3_, int p_176234_4_) {} +@@ -298,4 +266,48 @@ } - public abstract String[] func_150125_e(); + public abstract BlockPlanks.EnumType func_176233_b(int p_176233_1_); + ++ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } ++ @Override public boolean isLeaves(IBlockAccess world, BlockPos pos){ return true; } + + @Override -+ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) ++ public void beginLeavesDecay(World world, BlockPos pos) + { -+ return true; -+ } -+ -+ @Override -+ public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) -+ { -+ ArrayList ret = new ArrayList(); -+ ret.add(new ItemStack(this, 1, world.func_72805_g(x, y, z) & 3)); -+ return ret; -+ } -+ -+ @Override -+ public void beginLeavesDecay(World world, int x, int y, int z) -+ { -+ -+ int i2 = world.func_72805_g(x, y, z); -+ -+ if ((i2 & 8) == 0) ++ IBlockState state = world.func_180495_p(pos); ++ if (!(Boolean)state.func_177229_b(field_176236_b)) + { -+ world.func_72921_c(x, y, z, i2 | 8, 4); ++ world.func_180501_a(pos, state.func_177226_a(field_176236_b, true), 4); + } -+ world.func_72921_c(x, y, z, world.func_72805_g(x, y, z) | 8, 4); + } + + @Override -+ public boolean isLeaves(IBlockAccess world, int x, int y, int z) ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { -+ return true; -+ } -+ -+ -+ @Override -+ public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) -+ { -+ ArrayList ret = new ArrayList(); -+ int chance = this.func_150123_b(metadata); ++ java.util.List ret = new java.util.ArrayList(); ++ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); ++ int chance = this.func_176232_d(state); + + if (fortune > 0) + { @@ -153,8 +110,8 @@ + if (chance < 10) chance = 10; + } + -+ if (world.field_73012_v.nextInt(chance) == 0) -+ ret.add(new ItemStack(this.func_149650_a(metadata, world.field_73012_v, fortune), 1, this.func_149692_a(metadata))); ++ if (rand.nextInt(chance) == 0) ++ ret.add(new ItemStack(func_180660_a(state, rand, fortune), 1, func_180651_a(state))); + + chance = 200; + if (fortune > 0) @@ -164,8 +121,10 @@ + } + + this.captureDrops(true); -+ this.func_150124_c(world, x, y, z, metadata, chance); // Dammet mojang ++ if (world instanceof World) ++ this.func_176234_a((World)world, pos, state, chance); // Dammet mojang + ret.addAll(this.captureDrops(false)); + return ret; + } ++ } diff --git a/patches/minecraft/net/minecraft/block/BlockLever.java.patch b/patches/minecraft/net/minecraft/block/BlockLever.java.patch index 940121ed08..ff826eb160 100644 --- a/patches/minecraft/net/minecraft/block/BlockLever.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLever.java.patch @@ -1,128 +1,67 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLever.java +++ ../src-work/minecraft/net/minecraft/block/BlockLever.java -@@ -10,6 +10,9 @@ - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; +@@ -47,24 +47,24 @@ + + public boolean func_176198_a(World p_176198_1_, BlockPos p_176198_2_, EnumFacing p_176198_3_) + { +- return p_176198_3_ == EnumFacing.UP && World.func_175683_a(p_176198_1_, p_176198_2_.func_177977_b()) ? true : this.func_176358_d(p_176198_1_, p_176198_2_.func_177972_a(p_176198_3_.func_176734_d())); ++ return p_176198_3_ == EnumFacing.UP && World.func_175683_a(p_176198_1_, p_176198_2_.func_177977_b()) ? true : p_176198_1_.isSideSolid(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d()), p_176198_3_); + } + + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) + { +- return this.func_176358_d(p_176196_1_, p_176196_2_.func_177976_e()) ? true : (this.func_176358_d(p_176196_1_, p_176196_2_.func_177974_f()) ? true : (this.func_176358_d(p_176196_1_, p_176196_2_.func_177978_c()) ? true : (this.func_176358_d(p_176196_1_, p_176196_2_.func_177968_d()) ? true : (World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()) ? true : this.func_176358_d(p_176196_1_, p_176196_2_.func_177984_a()))))); ++ return p_176196_1_.isSideSolid(p_176196_2_.func_177976_e(), EnumFacing.EAST ) || ++ p_176196_1_.isSideSolid(p_176196_2_.func_177974_f(), EnumFacing.WEST ) || ++ p_176196_1_.isSideSolid(p_176196_2_.func_177978_c(), EnumFacing.SOUTH) || ++ p_176196_1_.isSideSolid(p_176196_2_.func_177968_d(), EnumFacing.NORTH) || ++ p_176196_1_.isSideSolid(p_176196_2_.func_177977_b(), EnumFacing.UP ) || ++ p_176196_1_.isSideSolid(p_176196_2_.func_177984_a(), EnumFacing.DOWN ); + } + +- protected boolean func_176358_d(World p_176358_1_, BlockPos p_176358_2_) +- { +- return p_176358_1_.func_180495_p(p_176358_2_).func_177230_c().func_149721_r(); +- } +- + public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) + { + IBlockState iblockstate = this.func_176223_P().func_177226_a(field_176359_b, Boolean.valueOf(false)); + +- if (this.func_176358_d(p_180642_1_, p_180642_2_.func_177972_a(p_180642_3_.func_176734_d()))) ++ if (p_180642_1_.isSideSolid(p_180642_2_.func_177972_a(p_180642_3_.func_176734_d()), p_180642_3_)) + { + return iblockstate.func_177226_a(field_176360_a, BlockLever.EnumOrientation.func_176856_a(p_180642_3_, p_180642_8_.func_174811_aO())); + } +@@ -87,7 +87,7 @@ + + enumfacing1 = (EnumFacing)iterator.next(); + } +- while (enumfacing1 == p_180642_3_ || !this.func_176358_d(p_180642_1_, p_180642_2_.func_177972_a(enumfacing1.func_176734_d()))); ++ while (enumfacing1 == p_180642_3_ || !p_180642_1_.isSideSolid(p_180642_2_.func_177972_a(enumfacing1.func_176734_d()), enumfacing1)); + + return iblockstate.func_177226_a(field_176360_a, BlockLever.EnumOrientation.func_176856_a(enumfacing1, p_180642_8_.func_174811_aO())); + } +@@ -116,7 +116,8 @@ + + public void func_176204_a(World p_176204_1_, BlockPos p_176204_2_, IBlockState p_176204_3_, Block p_176204_4_) + { +- if (this.func_176356_e(p_176204_1_, p_176204_2_) && !this.func_176358_d(p_176204_1_, p_176204_2_.func_177972_a(((BlockLever.EnumOrientation)p_176204_3_.func_177229_b(field_176360_a)).func_176852_c().func_176734_d()))) ++ EnumFacing dir = ((BlockLever.EnumOrientation)p_176204_3_.func_177229_b(field_176360_a)).func_176852_c(); ++ if (this.func_176356_e(p_176204_1_, p_176204_2_) && !p_176204_1_.isSideSolid(p_176204_2_.func_177972_a(dir.func_176734_d()), dir)) + { + this.func_176226_b(p_176204_1_, p_176204_2_, p_176204_3_, 0); + p_176204_1_.func_175698_g(p_176204_2_); +@@ -235,6 +236,12 @@ + return new BlockState(this, new IProperty[] {field_176360_a, field_176359_b}); + } -+import net.minecraftforge.common.util.ForgeDirection; -+import static net.minecraftforge.common.util.ForgeDirection.*; + - public class BlockLever extends Block - { - private static final String __OBFID = "CL_00000264"; -@@ -42,12 +45,23 @@ - - public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_) ++ private boolean canAttach(World world, BlockPos pos, EnumFacing side) ++ { ++ return world.isSideSolid(pos, side); ++ } ++ + public static enum EnumOrientation implements IStringSerializable { -- return p_149707_5_ == 0 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_ + 1, p_149707_4_).func_149721_r() ? true : (p_149707_5_ == 1 && World.func_147466_a(p_149707_1_, p_149707_2_, p_149707_3_ - 1, p_149707_4_) ? true : (p_149707_5_ == 2 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ + 1).func_149721_r() ? true : (p_149707_5_ == 3 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ - 1).func_149721_r() ? true : (p_149707_5_ == 4 && p_149707_1_.func_147439_a(p_149707_2_ + 1, p_149707_3_, p_149707_4_).func_149721_r() ? true : p_149707_5_ == 5 && p_149707_1_.func_147439_a(p_149707_2_ - 1, p_149707_3_, p_149707_4_).func_149721_r())))); -+ ForgeDirection dir = ForgeDirection.getOrientation(p_149707_5_); -+ return (dir == DOWN && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_ + 1, p_149707_4_, DOWN )) || -+ (dir == UP && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_ - 1, p_149707_4_, UP )) || -+ (dir == NORTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ + 1, NORTH)) || -+ (dir == SOUTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ - 1, SOUTH)) || -+ (dir == WEST && p_149707_1_.isSideSolid(p_149707_2_ + 1, p_149707_3_, p_149707_4_, WEST )) || -+ (dir == EAST && p_149707_1_.isSideSolid(p_149707_2_ - 1, p_149707_3_, p_149707_4_, EAST )); - } - - public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) - { -- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r() ? true : (World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ + 1, p_149742_4_).func_149721_r())))); -+ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) || -+ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) || -+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) || -+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH) || -+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_ - 1, p_149742_4_, UP ) || -+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_ + 1, p_149742_4_, DOWN ); - } - - public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) -@@ -56,32 +70,32 @@ - int j1 = p_149660_9_ & 7; - byte b0 = -1; - -- if (p_149660_5_ == 0 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_ + 1, p_149660_4_).func_149721_r()) -+ if (p_149660_5_ == 0 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_ + 1, p_149660_4_, DOWN)) - { - b0 = 0; - } - -- if (p_149660_5_ == 1 && World.func_147466_a(p_149660_1_, p_149660_2_, p_149660_3_ - 1, p_149660_4_)) -+ if (p_149660_5_ == 1 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_ - 1, p_149660_4_, UP)) - { - b0 = 5; - } - -- if (p_149660_5_ == 2 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ + 1).func_149721_r()) -+ if (p_149660_5_ == 2 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH)) - { - b0 = 4; - } - -- if (p_149660_5_ == 3 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ - 1).func_149721_r()) -+ if (p_149660_5_ == 3 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH)) - { - b0 = 3; - } - -- if (p_149660_5_ == 4 && p_149660_1_.func_147439_a(p_149660_2_ + 1, p_149660_3_, p_149660_4_).func_149721_r()) -+ if (p_149660_5_ == 4 && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST)) - { - b0 = 2; - } - -- if (p_149660_5_ == 5 && p_149660_1_.func_147439_a(p_149660_2_ - 1, p_149660_3_, p_149660_4_).func_149721_r()) -+ if (p_149660_5_ == 5 && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST)) - { - b0 = 1; - } -@@ -147,42 +161,42 @@ - int l = p_149695_1_.func_72805_g(p_149695_2_, p_149695_3_, p_149695_4_) & 7; - boolean flag = false; - -- if (!p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 1) -+ if (!p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST) && l == 1) - { - flag = true; - } - -- if (!p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 2) -+ if (!p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST) && l == 2) - { - flag = true; - } - -- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r() && l == 3) -+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH) && l == 3) - { - flag = true; - } - -- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r() && l == 4) -+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH) && l == 4) - { - flag = true; - } - -- if (!World.func_147466_a(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_) && l == 5) -+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ - 1, p_149695_4_, UP) && l == 5) - { - flag = true; - } - -- if (!World.func_147466_a(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_) && l == 6) -+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ - 1, p_149695_4_, UP) && l == 6) - { - flag = true; - } - -- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_ + 1, p_149695_4_).func_149721_r() && l == 0) -+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ + 1, p_149695_4_, DOWN) && l == 0) - { - flag = true; - } - -- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_ + 1, p_149695_4_).func_149721_r() && l == 7) -+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ + 1, p_149695_4_, DOWN) && l == 7) - { - flag = true; - } + DOWN_X(0, "down_x", EnumFacing.DOWN), diff --git a/patches/minecraft/net/minecraft/block/BlockLiquid.java.patch b/patches/minecraft/net/minecraft/block/BlockLiquid.java.patch deleted file mode 100644 index 002dbc4138..0000000000 --- a/patches/minecraft/net/minecraft/block/BlockLiquid.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLiquid.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLiquid.java -@@ -67,7 +67,7 @@ - { - for (int l1 = -1; l1 <= 1; ++l1) - { -- int i2 = p_149720_1_.func_72807_a(p_149720_2_ + l1, p_149720_4_ + k1).field_76759_H; -+ int i2 = p_149720_1_.func_72807_a(p_149720_2_ + l1, p_149720_4_ + k1).getWaterColorMultiplier(); - l += (i2 & 16711680) >> 16; - i1 += (i2 & 65280) >> 8; - j1 += i2 & 255; diff --git a/patches/minecraft/net/minecraft/block/BlockLog.java.patch b/patches/minecraft/net/minecraft/block/BlockLog.java.patch index 3fe642a147..39ddc1c696 100644 --- a/patches/minecraft/net/minecraft/block/BlockLog.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLog.java.patch @@ -1,45 +1,24 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLog.java +++ ../src-work/minecraft/net/minecraft/block/BlockLog.java -@@ -7,6 +7,7 @@ - import net.minecraft.creativetab.CreativeTabs; - import net.minecraft.item.Item; - import net.minecraft.util.IIcon; -+import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; +@@ -38,9 +38,9 @@ + BlockPos blockpos1 = (BlockPos)iterator.next(); + IBlockState iblockstate1 = p_180663_1_.func_180495_p(blockpos1); - public abstract class BlockLog extends BlockRotatedPillar -@@ -53,14 +54,10 @@ +- if (iblockstate1.func_177230_c().func_149688_o() == Material.field_151584_j && !((Boolean)iblockstate1.func_177229_b(BlockLeaves.field_176236_b)).booleanValue()) ++ if (iblockstate1.func_177230_c().isLeaves(p_180663_1_, blockpos1)) { - for (int l1 = -b0; l1 <= b0; ++l1) - { -- if (p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1).func_149688_o() == Material.field_151584_j) -+ Block block = p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1); -+ if (block.isLeaves(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1)) - { -- int i2 = p_149749_1_.func_72805_g(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1); -- -- if ((i2 & 8) == 0) -- { -- p_149749_1_.func_72921_c(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1, i2 | 8, 4); -- } -+ block.beginLeavesDecay(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1); - } - } +- p_180663_1_.func_180501_a(blockpos1, iblockstate1.func_177226_a(BlockLeaves.field_176236_b, Boolean.valueOf(true)), 4); ++ iblockstate1.func_177230_c().beginLeavesDecay(p_180663_1_, blockpos1); } -@@ -79,4 +76,16 @@ - { - return this.field_150166_b[p_150161_1_ % this.field_150166_b.length]; + } + } +@@ -51,6 +51,9 @@ + return super.func_180642_a(p_180642_1_, p_180642_2_, p_180642_3_, p_180642_4_, p_180642_5_, p_180642_6_, p_180642_7_, p_180642_8_).func_177226_a(field_176299_a, BlockLog.EnumAxis.func_176870_a(p_180642_3_.func_176740_k())); } + ++ @Override public boolean canSustainLeaves(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } ++ @Override public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } + -+ @Override -+ public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) -+ { -+ return true; -+ } -+ -+ @Override -+ public boolean isWood(IBlockAccess world, int x, int y, int z) -+ { -+ return true; -+ } - } + public static enum EnumAxis implements IStringSerializable + { + X("x"), diff --git a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch index a5892b958c..cdc8c9e427 100644 --- a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch @@ -1,26 +1,17 @@ --- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java +++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java -@@ -7,6 +7,7 @@ - import net.minecraft.item.Item; - import net.minecraft.tileentity.TileEntity; - import net.minecraft.tileentity.TileEntityMobSpawner; -+import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; - - public class BlockMobSpawner extends BlockContainer -@@ -36,10 +37,15 @@ - public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) +@@ -39,10 +39,14 @@ + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { - super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); -- int j1 = 15 + p_149690_1_.field_73012_v.nextInt(15) + p_149690_1_.field_73012_v.nextInt(15); -- this.func_149657_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, j1); + super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); +- int j = 15 + p_180653_1_.field_73012_v.nextInt(15) + p_180653_1_.field_73012_v.nextInt(15); +- this.func_180637_b(p_180653_1_, p_180653_2_, j); } -+ private Random rand = new Random(); + @Override -+ public int getExpDrop(IBlockAccess world, int metadata, int fortune) ++ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ return 15 + rand.nextInt(15) + rand.nextInt(15); ++ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); + } + public boolean func_149662_c() diff --git a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch index 666debf3b2..bf17395b94 100644 --- a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch @@ -1,19 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java +++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java -@@ -4,6 +4,7 @@ - import net.minecraft.init.Blocks; - import net.minecraft.world.World; - import net.minecraft.world.gen.feature.WorldGenBigMushroom; -+import net.minecraftforge.common.util.ForgeDirection; - - public class BlockMushroom extends BlockBush implements IGrowable - { -@@ -85,7 +86,7 @@ - if (p_149718_3_ >= 0 && p_149718_3_ < 256) +@@ -76,7 +76,7 @@ + if (p_180671_2_.func_177956_o() >= 0 && p_180671_2_.func_177956_o() < 256) { - Block block = p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_); -- return block == Blocks.field_150391_bh || block == Blocks.field_150346_d && p_149718_1_.func_72805_g(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == 2 || p_149718_1_.func_72883_k(p_149718_2_, p_149718_3_, p_149718_4_) < 13 && this.func_149854_a(block); -+ return block == Blocks.field_150391_bh || block == Blocks.field_150346_d && p_149718_1_.func_72805_g(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == 2 || p_149718_1_.func_72883_k(p_149718_2_, p_149718_3_, p_149718_4_) < 13 && block.canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this); + IBlockState iblockstate1 = p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()); +- return iblockstate1.func_177230_c() == Blocks.field_150391_bh ? true : (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.PODZOL ? true : p_180671_1_.func_175699_k(p_180671_2_) < 13 && this.func_149854_a(iblockstate1.func_177230_c())); ++ return iblockstate1.func_177230_c() == Blocks.field_150391_bh ? true : (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.PODZOL ? true : p_180671_1_.func_175699_k(p_180671_2_) < 13 && iblockstate1.func_177230_c().canSustainPlant(p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this)); } else { diff --git a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch index db2d47ee40..4a2c0ac2c7 100644 --- a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch @@ -1,20 +1,20 @@ --- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java +++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java -@@ -37,7 +37,7 @@ +@@ -39,7 +39,7 @@ { - if (!p_149674_1_.field_72995_K) + if (!p_180650_1_.field_72995_K) { -- if (p_149674_1_.func_72957_l(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ + 1, p_149674_4_).func_149717_k() > 2) -+ if (p_149674_1_.func_72957_l(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.getBlockLightOpacity(p_149674_2_, p_149674_3_ + 1, p_149674_4_) > 2) +- if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().func_149717_k() > 2) ++ if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().getLightOpacity(p_180650_1_, p_180650_2_.func_177984_a()) > 2) { - p_149674_1_.func_147449_b(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.field_150346_d); + p_180650_1_.func_175656_a(p_180650_2_, Blocks.field_150346_d.func_176223_P().func_177226_a(BlockDirt.field_176386_a, BlockDirt.DirtType.DIRT)); } -@@ -50,7 +50,7 @@ - int k1 = p_149674_4_ + p_149674_5_.nextInt(3) - 1; - Block block = p_149674_1_.func_147439_a(i1, j1 + 1, k1); +@@ -53,7 +53,7 @@ + IBlockState iblockstate1 = p_180650_1_.func_180495_p(blockpos1); + Block block = p_180650_1_.func_180495_p(blockpos1.func_177984_a()).func_177230_c(); -- if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.field_150346_d && p_149674_1_.func_72805_g(i1, j1, k1) == 0 && p_149674_1_.func_72957_l(i1, j1 + 1, k1) >= 4 && block.func_149717_k() <= 2) -+ if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.field_150346_d && p_149674_1_.func_72805_g(i1, j1, k1) == 0 && p_149674_1_.func_72957_l(i1, j1 + 1, k1) >= 4 && p_149674_1_.getBlockLightOpacity(i1, j1 + 1, k1) <= 2) - { - p_149674_1_.func_147449_b(i1, j1, k1, this); - } +- if (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos1.func_177984_a()) >= 4 && block.func_149717_k() <= 2) ++ if (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos1.func_177984_a()) >= 4 && block.getLightOpacity(p_180650_1_, blockpos1.func_177984_a()) <= 2) + { + p_180650_1_.func_175656_a(blockpos1, this.func_176223_P()); + } diff --git a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch index 52c7094e31..374e2ef64f 100644 --- a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch @@ -1,58 +1,42 @@ --- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java +++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java -@@ -2,6 +2,7 @@ +@@ -36,7 +36,7 @@ - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.ArrayList; - import java.util.Random; - import net.minecraft.client.renderer.texture.IIconRegister; - import net.minecraft.creativetab.CreativeTabs; -@@ -11,6 +12,7 @@ - import net.minecraft.item.ItemStack; - import net.minecraft.util.IIcon; - import net.minecraft.world.World; -+import net.minecraftforge.common.util.ForgeDirection; - - public class BlockNetherWart extends BlockBush - { -@@ -33,7 +35,7 @@ - - public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_) + public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { -- return this.func_149854_a(p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_)); -+ return super.func_149718_j(p_149718_1_, p_149718_2_, p_149718_3_, p_149718_4_); +- return this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c()); ++ return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_3_); } - public void func_149674_a(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) -@@ -60,9 +62,12 @@ - return 6; + public void func_180650_b(World p_180650_1_, BlockPos p_180650_2_, IBlockState p_180650_3_, Random p_180650_4_) +@@ -52,9 +52,11 @@ + super.func_180650_b(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_4_); } + @SuppressWarnings("unused") - public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { -- if (!p_149690_1_.field_72995_K) -+ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); -+ -+ if (false && !p_149690_1_.field_72995_K) +- if (!p_180653_1_.field_72995_K) ++ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); ++ if (false && !p_180653_1_.field_72995_K) { - int j1 = 1; + int j = 1; -@@ -109,4 +114,23 @@ - this.field_149883_a[i] = p_149651_1_.func_94245_a(this.func_149641_N() + "_stage_" + i); - } +@@ -105,4 +107,24 @@ + { + return new BlockState(this, new IProperty[] {field_176486_a}); } + + @Override -+ public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) ++ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { -+ ArrayList ret = new ArrayList(); ++ java.util.List ret = new java.util.ArrayList(); ++ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); + int count = 1; + -+ if (metadata >= 3) ++ if (((Integer)state.func_177229_b(field_176486_a)) >= 3) + { -+ count = 2 + world.field_73012_v.nextInt(3) + (fortune > 0 ? world.field_73012_v.nextInt(fortune + 1) : 0); ++ count = 2 + rand.nextInt(3) + (fortune > 0 ? rand.nextInt(fortune + 1) : 0); + } + + for (int i = 0; i < count; i++) diff --git a/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch new file mode 100644 index 0000000000..150aabf9e3 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java ++++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java +@@ -105,14 +105,15 @@ + + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) + { +- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) + { +- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); +- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Item.func_150898_a(this), 1, ((BlockPlanks.EnumType)p_180657_4_.func_177229_b(field_176240_P)).func_176839_a() - 4)); +- } +- else +- { + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); + } + } ++ ++ @Override ++ public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.func_180495_p(pos); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.func_177229_b(field_176240_P)).func_176839_a() - 4))); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockNote.java.patch b/patches/minecraft/net/minecraft/block/BlockNote.java.patch index 2ad648f111..dd913e8f59 100644 --- a/patches/minecraft/net/minecraft/block/BlockNote.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNote.java.patch @@ -1,24 +1,23 @@ --- ../src-base/minecraft/net/minecraft/block/BlockNote.java +++ ../src-work/minecraft/net/minecraft/block/BlockNote.java -@@ -45,7 +45,9 @@ - - if (tileentitynote != null) +@@ -58,7 +58,9 @@ + if (tileentity instanceof TileEntityNote) { + TileEntityNote tileentitynote = (TileEntityNote)tileentity; + int old = tileentitynote.field_145879_a; tileentitynote.func_145877_a(); + if (old == tileentitynote.field_145879_a) return false; - tileentitynote.func_145878_a(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_); + tileentitynote.func_175108_a(p_180639_1_, p_180639_2_); } -@@ -73,6 +75,11 @@ +@@ -96,6 +98,10 @@ - public boolean func_149696_a(World p_149696_1_, int p_149696_2_, int p_149696_3_, int p_149696_4_, int p_149696_5_, int p_149696_6_) + public boolean func_180648_a(World p_180648_1_, BlockPos p_180648_2_, IBlockState p_180648_3_, int p_180648_4_, int p_180648_5_) { -+ int meta = p_149696_1_.func_72805_g(p_149696_2_, p_149696_3_, p_149696_4_); -+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_149696_1_, p_149696_2_, p_149696_3_, p_149696_4_, meta, p_149696_6_, p_149696_5_); ++ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_180648_1_, p_180648_2_, p_180648_3_, p_180648_5_, p_180648_4_); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false; -+ p_149696_5_ = e.instrument.ordinal(); -+ p_149696_6_ = e.getVanillaNoteId(); - float f = (float)Math.pow(2.0D, (double)(p_149696_6_ - 12) / 12.0D); - String s = "harp"; - ++ p_180648_4_ = e.instrument.ordinal(); ++ p_180648_5_ = e.getVanillaNoteId(); + float f = (float)Math.pow(2.0D, (double)(p_180648_5_ - 12) / 12.0D); + p_180648_1_.func_72908_a((double)p_180648_2_.func_177958_n() + 0.5D, (double)p_180648_2_.func_177956_o() + 0.5D, (double)p_180648_2_.func_177952_p() + 0.5D, "note." + this.func_176433_b(p_180648_4_), 3.0F, f); + p_180648_1_.func_175688_a(EnumParticleTypes.NOTE, (double)p_180648_2_.func_177958_n() + 0.5D, (double)p_180648_2_.func_177956_o() + 1.2D, (double)p_180648_2_.func_177952_p() + 0.5D, (double)p_180648_5_ / 24.0D, 0.0D, 0.0D, new int[0]); diff --git a/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch new file mode 100644 index 0000000000..4ee35dc7fb --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java ++++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java +@@ -155,4 +155,11 @@ + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); + } + } ++ ++ @Override ++ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.func_180495_p(pos); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.func_177229_b(field_176239_P)).func_176839_a()))); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockOre.java.patch b/patches/minecraft/net/minecraft/block/BlockOre.java.patch index 7ab468920a..8c026c147e 100644 --- a/patches/minecraft/net/minecraft/block/BlockOre.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockOre.java.patch @@ -1,58 +1,59 @@ --- ../src-base/minecraft/net/minecraft/block/BlockOre.java +++ ../src-work/minecraft/net/minecraft/block/BlockOre.java -@@ -7,6 +7,7 @@ - import net.minecraft.init.Items; +@@ -10,6 +10,7 @@ import net.minecraft.item.Item; + import net.minecraft.util.BlockPos; import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockOre extends Block -@@ -51,34 +52,40 @@ - public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) +@@ -54,34 +55,40 @@ + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { - super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); + super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); +- +- if (this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_) != Item.func_150898_a(this)) + } - -- if (this.func_149650_a(p_149690_5_, p_149690_1_.field_73012_v, p_149690_7_) != Item.func_150898_a(this)) -+ private Random rand = new Random(); + @Override -+ public int getExpDrop(IBlockAccess p_149690_1_, int p_149690_5_, int p_149690_7_) ++ public int getExpDrop(IBlockAccess world, BlockPos pos, int fortune) + { -+ if (this.func_149650_a(p_149690_5_, rand, p_149690_7_) != Item.func_150898_a(this)) ++ IBlockState state = world.func_180495_p(pos); ++ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); ++ if (this.func_180660_a(state, rand, fortune) != Item.func_150898_a(this)) { - int j1 = 0; + int j = 0; if (this == Blocks.field_150365_q) { -- j1 = MathHelper.func_76136_a(p_149690_1_.field_73012_v, 0, 2); -+ j1 = MathHelper.func_76136_a(rand, 0, 2); +- j = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 0, 2); ++ j = MathHelper.func_76136_a(rand, 0, 2); } else if (this == Blocks.field_150482_ag) { -- j1 = MathHelper.func_76136_a(p_149690_1_.field_73012_v, 3, 7); -+ j1 = MathHelper.func_76136_a(rand, 3, 7); +- j = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 3, 7); ++ j = MathHelper.func_76136_a(rand, 3, 7); } else if (this == Blocks.field_150412_bA) { -- j1 = MathHelper.func_76136_a(p_149690_1_.field_73012_v, 3, 7); -+ j1 = MathHelper.func_76136_a(rand, 3, 7); +- j = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 3, 7); ++ j = MathHelper.func_76136_a(rand, 3, 7); } else if (this == Blocks.field_150369_x) { -- j1 = MathHelper.func_76136_a(p_149690_1_.field_73012_v, 2, 5); -+ j1 = MathHelper.func_76136_a(rand, 2, 5); +- j = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 2, 5); ++ j = MathHelper.func_76136_a(rand, 2, 5); } else if (this == Blocks.field_150449_bY) { -- j1 = MathHelper.func_76136_a(p_149690_1_.field_73012_v, 2, 5); -+ j1 = MathHelper.func_76136_a(rand, 2, 5); +- j = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 2, 5); ++ j = MathHelper.func_76136_a(rand, 2, 5); } -- this.func_149657_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, j1); -+ return j1; +- this.func_180637_b(p_180653_1_, p_180653_2_, j); ++ return j; } + return 0; } - public int func_149692_a(int p_149692_1_) + public int func_176222_j(World p_176222_1_, BlockPos p_176222_2_) diff --git a/patches/minecraft/net/minecraft/block/BlockPane.java.patch b/patches/minecraft/net/minecraft/block/BlockPane.java.patch index 24b8608606..759b992b30 100644 --- a/patches/minecraft/net/minecraft/block/BlockPane.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPane.java.patch @@ -1,52 +1,41 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPane.java +++ ../src-work/minecraft/net/minecraft/block/BlockPane.java -@@ -15,6 +15,8 @@ - import net.minecraft.util.IIcon; - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; -+import net.minecraftforge.common.util.ForgeDirection; -+import static net.minecraftforge.common.util.ForgeDirection.*; +@@ -39,7 +39,10 @@ - public class BlockPane extends Block - { -@@ -62,10 +64,10 @@ - - public void func_149743_a(World p_149743_1_, int p_149743_2_, int p_149743_3_, int p_149743_4_, AxisAlignedBB p_149743_5_, List p_149743_6_, Entity p_149743_7_) + public IBlockState func_176221_a(IBlockState p_176221_1_, IBlockAccess p_176221_2_, BlockPos p_176221_3_) { -- boolean flag = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_, p_149743_3_, p_149743_4_ - 1)); -- boolean flag1 = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_, p_149743_3_, p_149743_4_ + 1)); -- boolean flag2 = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_ - 1, p_149743_3_, p_149743_4_)); -- boolean flag3 = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_ + 1, p_149743_3_, p_149743_4_)); -+ boolean flag = this.canPaneConnectTo(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_ - 1, NORTH); -+ boolean flag1 = this.canPaneConnectTo(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_ + 1, SOUTH); -+ boolean flag2 = this.canPaneConnectTo(p_149743_1_, p_149743_2_ - 1, p_149743_3_, p_149743_4_, WEST ); -+ boolean flag3 = this.canPaneConnectTo(p_149743_1_, p_149743_2_ + 1, p_149743_3_, p_149743_4_, EAST ); +- return p_176221_1_.func_177226_a(field_176241_b, Boolean.valueOf(this.func_150098_a(p_176221_2_.func_180495_p(p_176221_3_.func_177978_c()).func_177230_c()))).func_177226_a(field_176243_N, Boolean.valueOf(this.func_150098_a(p_176221_2_.func_180495_p(p_176221_3_.func_177968_d()).func_177230_c()))).func_177226_a(field_176244_O, Boolean.valueOf(this.func_150098_a(p_176221_2_.func_180495_p(p_176221_3_.func_177976_e()).func_177230_c()))).func_177226_a(field_176242_M, Boolean.valueOf(this.func_150098_a(p_176221_2_.func_180495_p(p_176221_3_.func_177974_f()).func_177230_c()))); ++ return p_176221_1_.func_177226_a(field_176241_b, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.NORTH)) ++ .func_177226_a(field_176243_N, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.SOUTH)) ++ .func_177226_a(field_176244_O, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.WEST)) ++ .func_177226_a(field_176242_M, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.EAST)); + } + + public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) +@@ -65,10 +68,10 @@ + + public void func_180638_a(World p_180638_1_, BlockPos p_180638_2_, IBlockState p_180638_3_, AxisAlignedBB p_180638_4_, List p_180638_5_, Entity p_180638_6_) + { +- boolean flag = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177978_c()).func_177230_c()); +- boolean flag1 = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177968_d()).func_177230_c()); +- boolean flag2 = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177976_e()).func_177230_c()); +- boolean flag3 = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177974_f()).func_177230_c()); ++ boolean flag = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.NORTH); ++ boolean flag1 = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.SOUTH); ++ boolean flag2 = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.WEST); ++ boolean flag3 = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.EAST); if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) { -@@ -117,10 +119,10 @@ - float f1 = 0.5625F; - float f2 = 0.4375F; - float f3 = 0.5625F; -- boolean flag = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_, p_149719_3_, p_149719_4_ - 1)); -- boolean flag1 = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_, p_149719_3_, p_149719_4_ + 1)); -- boolean flag2 = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_ - 1, p_149719_3_, p_149719_4_)); -- boolean flag3 = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_ + 1, p_149719_3_, p_149719_4_)); -+ boolean flag = this.canPaneConnectTo(p_149719_1_, p_149719_2_, p_149719_3_, p_149719_4_ - 1, NORTH); -+ boolean flag1 = this.canPaneConnectTo(p_149719_1_, p_149719_2_, p_149719_3_, p_149719_4_ + 1, SOUTH); -+ boolean flag2 = this.canPaneConnectTo(p_149719_1_, p_149719_2_ - 1, p_149719_3_, p_149719_4_, WEST ); -+ boolean flag3 = this.canPaneConnectTo(p_149719_1_, p_149719_2_ + 1, p_149719_3_, p_149719_4_, EAST ); - - if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) - { -@@ -186,4 +188,10 @@ - this.field_149761_L = p_149651_1_.func_94245_a(this.field_150101_M); - this.field_150102_N = p_149651_1_.func_94245_a(this.field_150100_a); +@@ -187,4 +190,11 @@ + { + return new BlockState(this, new IProperty[] {field_176241_b, field_176242_M, field_176244_O, field_176243_N}); } + -+ public boolean canPaneConnectTo(IBlockAccess world, int x, int y, int z, ForgeDirection dir) ++ public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) + { -+ return func_150098_a(world.func_147439_a(x, y, z)) || -+ world.isSideSolid(x, y, z, dir.getOpposite(), false); ++ BlockPos off = pos.func_177972_a(dir.func_176734_d()); ++ Block block = world.func_180495_p(off).func_177230_c(); ++ return func_150098_a(block) || block.isSideSolid(world, pos, dir); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch index 4fe844e47e..98c6e0962c 100644 --- a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch @@ -1,65 +1,31 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java +++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java -@@ -11,6 +11,7 @@ - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.init.Blocks; - import net.minecraft.item.ItemStack; -+import net.minecraft.server.management.PlayerManager; - import net.minecraft.tileentity.TileEntity; - import net.minecraft.tileentity.TileEntityPiston; - import net.minecraft.util.AxisAlignedBB; -@@ -360,7 +361,8 @@ - return false; - } - -- return !(p_150080_0_ instanceof ITileEntityProvider); -+ return !(p_150080_1_.func_147439_a(p_150080_2_, p_150080_3_, p_150080_4_).hasTileEntity(p_150080_1_.func_72805_g(p_150080_2_, p_150080_3_, p_150080_4_))); -+ - } - } - -@@ -375,14 +377,14 @@ - { - if (l1 < 13) - { -- if (j1 <= 0 || j1 >= 255) -+ if (j1 <= 0 || j1 >= p_150077_0_.func_72800_K()) - { - return false; - } - - Block block = p_150077_0_.func_147439_a(i1, j1, k1); - -- if (block.func_149688_o() != Material.field_151579_a) -+ if (!block.isAir(p_150077_0_, i1, j1, k1)) - { - if (!func_150080_a(block, p_150077_0_, i1, j1, k1, true)) - { -@@ -420,14 +422,14 @@ - { - if (l1 < 13) - { -- if (j1 <= 0 || j1 >= 255) -+ if (j1 <= 0 || j1 >= p_150079_1_.func_72800_K()) - { - return false; - } - - Block block = p_150079_1_.func_147439_a(i1, j1, k1); - -- if (block.func_149688_o() != Material.field_151579_a) -+ if (!block.isAir(p_150079_1_, i1, j1, k1)) - { - if (!func_150080_a(block, p_150079_1_, i1, j1, k1, true)) - { -@@ -448,7 +450,9 @@ - continue; +@@ -200,7 +200,7 @@ } - -- block.func_149697_b(p_150079_1_, i1, j1, k1, p_150079_1_.func_72805_g(i1, j1, k1), 0); -+ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. -+ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; -+ block.func_149690_a(p_150079_1_, i1, j1, k1, p_150079_1_.func_72805_g(i1, j1, k1), chance, 0); - p_150079_1_.func_147468_f(i1, j1, k1); } + +- if (!flag1 && block.func_149688_o() != Material.field_151579_a && func_180696_a(block, p_180648_1_, blockpos1, enumfacing.func_176734_d(), false) && (block.func_149656_h() == 0 || block == Blocks.field_150331_J || block == Blocks.field_150320_F)) ++ if (!flag1 && block.isAir(p_180648_1_, blockpos1) && func_180696_a(block, p_180648_1_, blockpos1, enumfacing.func_176734_d(), false) && (block.func_149656_h() == 0 || block == Blocks.field_150331_J || block == Blocks.field_150320_F)) + { + this.func_176319_a(p_180648_1_, p_180648_2_, enumfacing, false); + } +@@ -344,7 +344,7 @@ + return false; + } + +- return !(p_180696_0_ instanceof ITileEntityProvider); ++ return !(p_180696_0_.hasTileEntity(p_180696_1_.func_180495_p(p_180696_2_))); } + else + { +@@ -384,7 +384,9 @@ + { + blockpos1 = (BlockPos)list1.get(j); + Block block = p_176319_1_.func_180495_p(blockpos1).func_177230_c(); +- block.func_176226_b(p_176319_1_, blockpos1, p_176319_1_.func_180495_p(blockpos1), 0); ++ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. ++ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; ++ block.func_180653_a(p_176319_1_, blockpos1, p_176319_1_.func_180495_p(blockpos1), chance, 0); + p_176319_1_.func_175698_g(blockpos1); + --i; + ablock[i] = block; diff --git a/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch index 97245a1500..4f2d1c8a03 100644 --- a/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch @@ -1,47 +1,37 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java +++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java -@@ -2,11 +2,13 @@ +@@ -110,16 +110,7 @@ - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.ArrayList; - import java.util.Random; - import net.minecraft.block.material.Material; - import net.minecraft.client.renderer.texture.IIconRegister; - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.item.Item; -+import net.minecraft.item.ItemStack; - import net.minecraft.tileentity.TileEntity; - import net.minecraft.tileentity.TileEntityPiston; - import net.minecraft.util.AxisAlignedBB; -@@ -90,15 +92,7 @@ - - public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { -- if (!p_149690_1_.field_72995_K) +- if (!p_180653_1_.field_72995_K) - { -- TileEntityPiston tileentitypiston = this.func_149963_e(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_); +- TileEntityPiston tileentitypiston = this.func_176422_e(p_180653_1_, p_180653_2_); - - if (tileentitypiston != null) - { -- tileentitypiston.func_145861_a().func_149697_b(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, tileentitypiston.func_145832_p(), 0); +- IBlockState iblockstate1 = tileentitypiston.func_174927_b(); +- iblockstate1.func_177230_c().func_176226_b(p_180653_1_, p_180653_2_, iblockstate1, 0); - } - } -+ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); ++ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); } - public void func_149695_a(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) -@@ -231,4 +225,13 @@ + public MovingObjectPosition func_180636_a(World p_180636_1_, BlockPos p_180636_2_, Vec3 p_180636_3_, Vec3 p_180636_4_) +@@ -283,4 +274,16 @@ { - this.field_149761_L = p_149651_1_.func_94245_a("piston_top_normal"); + return new BlockState(this, new IProperty[] {field_176426_a, field_176425_b}); } + + @Override -+ public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { -+ TileEntityPiston te = this.func_149963_e(world, x, y, z); -+ if (te != null) -+ return te.func_145861_a().getDrops(world, x, y, z, te.func_145832_p(), 0); -+ return new ArrayList(); ++ TileEntityPiston tileentitypiston = this.func_176422_e(world, pos); ++ if (tileentitypiston != null) ++ { ++ IBlockState pushed = tileentitypiston.func_174927_b(); ++ return pushed.func_177230_c().getDrops(world, pos, pushed, fortune); ++ } ++ return new java.util.ArrayList(); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch index 7c89fb384b..2adf70eee2 100644 --- a/patches/minecraft/net/minecraft/block/BlockPotato.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch @@ -1,32 +1,25 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPotato.java +++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java -@@ -1,5 +1,6 @@ - package net.minecraft.block; - -+import java.util.ArrayList; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; - import net.minecraft.client.renderer.texture.IIconRegister; -@@ -46,14 +47,15 @@ - public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) +@@ -24,13 +24,14 @@ + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { - super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); -+ } - -- if (!p_149690_1_.field_72995_K) + super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); +- +- if (!p_180653_1_.field_72995_K) - { -- if (p_149690_5_ >= 7 && p_149690_1_.field_73012_v.nextInt(50) == 0) +- if (((Integer)p_180653_3_.func_177229_b(field_176488_a)).intValue() >= 7 && p_180653_1_.field_73012_v.nextInt(50) == 0) - { -- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(Items.field_151170_bI)); +- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(Items.field_151170_bI)); - } - } + } + @Override -+ public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) ++ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { -+ ArrayList ret = super.getDrops(world, x, y, z, metadata, fortune); -+ if (metadata >= 7 && world.field_73012_v.nextInt(50) == 0) ++ java.util.List ret = super.getDrops(world, pos, state, fortune); ++ java.util.Random rand = world instanceof World ? ((World)world).field_73012_v : new java.util.Random(); ++ if (((Integer)state.func_177229_b(field_176488_a)) >= 7 && rand.nextInt(50) == 0) + ret.add(new ItemStack(Items.field_151170_bI)); + return ret; - } - - @SideOnly(Side.CLIENT) ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch index ae47c3341c..87ac6e5da1 100644 --- a/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java +++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java -@@ -113,7 +113,7 @@ +@@ -109,7 +109,7 @@ - public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { -- return p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_).field_149764_J.func_76222_j() && World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_); -+ return p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_).isReplaceable(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_); +- return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().field_149764_J.func_76222_j() && World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()); ++ return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().func_176200_f(p_176196_1_, p_176196_2_) && World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()); } - public void func_149689_a(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) + public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) diff --git a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch index 0d5dcaf121..51ca5cb4e4 100644 --- a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch @@ -1,109 +1,51 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java +++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java -@@ -5,6 +5,7 @@ - import java.util.Random; - import net.minecraft.block.material.Material; - import net.minecraft.creativetab.CreativeTabs; -+import net.minecraft.entity.item.EntityMinecart; - import net.minecraft.init.Blocks; - import net.minecraft.util.AxisAlignedBB; - import net.minecraft.util.MovingObjectPosition; -@@ -25,7 +26,7 @@ - - public static final boolean func_150051_a(Block p_150051_0_) +@@ -33,7 +33,7 @@ + public static boolean func_176563_d(IBlockState p_176563_0_) { -- return p_150051_0_ == Blocks.field_150448_aq || p_150051_0_ == Blocks.field_150318_D || p_150051_0_ == Blocks.field_150319_E || p_150051_0_ == Blocks.field_150408_cc; -+ return p_150051_0_ instanceof BlockRailBase; + Block block = p_176563_0_.func_177230_c(); +- return block == Blocks.field_150448_aq || block == Blocks.field_150318_D || block == Blocks.field_150319_E || block == Blocks.field_150408_cc; ++ return block instanceof BlockRailBase; } protected BlockRailBase(boolean p_i45389_1_) -@@ -78,7 +79,7 @@ - - public int func_149645_b() - { -- return 9; -+ return renderType; - } - - public int func_149745_a(Random p_149745_1_) -@@ -193,6 +194,111 @@ - } +@@ -174,7 +174,56 @@ } + public abstract IProperty func_176560_l(); + /* ======================================== FORGE START =====================================*/ + /** + * Return true if the rail can make corners. + * Used by placement logic. + * @param world The world. -+ * @param x The rail X coordinate. -+ * @param y The rail Y coordinate. -+ * @param z The rail Z coordinate. ++ * @param pod Block's position in world + * @return True if the rail can make corners. + */ -+ public boolean isFlexibleRail(IBlockAccess world, int y, int x, int z) ++ public boolean isFlexibleRail(IBlockAccess world, BlockPos pos) + { -+ return !func_150050_e(); ++ return !this.field_150053_a; + } -+ + + /** + * Returns true if the rail can make up and down slopes. + * Used by placement logic. + * @param world The world. -+ * @param x The rail X coordinate. -+ * @param y The rail Y coordinate. -+ * @param z The rail Z coordinate. ++ * @param pod Block's position in world + * @return True if the rail can make slopes. + */ -+ public boolean canMakeSlopes(IBlockAccess world, int x, int y, int z) ++ public boolean canMakeSlopes(IBlockAccess world, BlockPos pos) + { + return true; + } + + /** -+ * Return the rail's metadata (without the power bit if the rail uses one). -+ * Can be used to make the cart think the rail something other than it is, -+ * for example when making diamond junctions or switches. -+ * The cart parameter will often be null unless it it called from EntityMinecart. -+ * -+ * Valid rail metadata is defined as follows: -+ * 0x0: flat track going North-South -+ * 0x1: flat track going West-East -+ * 0x2: track ascending to the East -+ * 0x3: track ascending to the West -+ * 0x4: track ascending to the North -+ * 0x5: track ascending to the South -+ * 0x6: WestNorth corner (connecting East and South) -+ * 0x7: EastNorth corner (connecting West and South) -+ * 0x8: EastSouth corner (connecting West and North) -+ * 0x9: WestSouth corner (connecting East and North) -+ * -+ * @param world The world. -+ * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart. -+ * @param y The rail X coordinate. -+ * @param x The rail Y coordinate. -+ * @param z The rail Z coordinate. -+ * @return The metadata. -+ */ -+ public int getBasicRailMetadata(IBlockAccess world, EntityMinecart cart, int x, int y, int z) -+ { -+ int meta = world.func_72805_g(x, y, z); -+ if(func_150050_e()) -+ { -+ meta = meta & 7; -+ } -+ return meta; -+ } -+ -+ /** + * Returns the max speed of the rail at the specified position. + * @param world The world. + * @param cart The cart on the rail, may be null. -+ * @param x The rail X coordinate. -+ * @param y The rail Y coordinate. -+ * @param z The rail Z coordinate. ++ * @param pod Block's position in world + * @return The max speed of the current rail. + */ -+ public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z) ++ public float getRailMaxSpeed(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) + { + return 0.4f; + } @@ -113,96 +55,68 @@ + * It is called once per update tick that the minecart is on the rail. + * @param world The world. + * @param cart The cart on the rail. -+ * @param y The rail X coordinate. -+ * @param x The rail Y coordinate. -+ * @param z The rail Z coordinate. ++ * @param pod Block's position in world + */ -+ public void onMinecartPass(World world, EntityMinecart cart, int y, int x, int z) ++ public void onMinecartPass(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) + { -+ } -+ -+ /** -+ * Forge: Moved render type to a field and a setter. -+ * This allows for a mod to change the render type -+ * for vanilla rails, and any mod rails that extend -+ * this class. -+ */ -+ private int renderType = 9; -+ -+ public void setRenderType(int value) -+ { -+ renderType = value; + } ++ + /* ======================================== FORGE END =====================================*/ + - public class Rail + public static enum EnumRailDirection implements IStringSerializable { - private World field_150660_b; -@@ -202,6 +308,7 @@ + NORTH_SOUTH(0, "north_south"), +@@ -251,6 +300,7 @@ private final boolean field_150656_f; - private List field_150657_g = new ArrayList(); + private final List field_150657_g = Lists.newArrayList(); private static final String __OBFID = "CL_00000196"; + private final boolean canMakeSlopes; - public Rail(World p_i45388_2_, int p_i45388_3_, int p_i45388_4_, int p_i45388_5_) + public Rail(World p_i45739_2_, BlockPos p_i45739_3_, IBlockState p_i45739_4_) { -@@ -209,19 +316,10 @@ - this.field_150661_c = p_i45388_3_; - this.field_150658_d = p_i45388_4_; - this.field_150659_e = p_i45388_5_; -- Block block = p_i45388_2_.func_147439_a(p_i45388_3_, p_i45388_4_, p_i45388_5_); -- int l = p_i45388_2_.func_72805_g(p_i45388_3_, p_i45388_4_, p_i45388_5_); -- -- if (((BlockRailBase)block).field_150053_a) -- { -- this.field_150656_f = true; -- l &= -9; -- } -- else -- { -- this.field_150656_f = false; -- } -- -+ BlockRailBase block = (BlockRailBase)p_i45388_2_.func_147439_a(p_i45388_3_, p_i45388_4_, p_i45388_5_); -+ int l = block.getBasicRailMetadata(p_i45388_2_, null, p_i45388_3_, p_i45388_4_, p_i45388_5_); -+ this.field_150656_f = !block.isFlexibleRail(p_i45388_2_, p_i45388_3_, p_i45388_4_, p_i45388_5_); -+ canMakeSlopes = block.canMakeSlopes(p_i45388_2_, p_i45388_3_, p_i45388_4_, p_i45388_5_); - this.func_150648_a(l); +@@ -259,7 +309,8 @@ + this.field_180366_e = p_i45739_4_; + this.field_180365_d = (BlockRailBase)p_i45739_4_.func_177230_c(); + BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)p_i45739_4_.func_177229_b(BlockRailBase.this.func_176560_l()); +- this.field_150656_f = this.field_180365_d.field_150053_a; ++ this.field_150656_f = !this.field_180365_d.isFlexibleRail(p_i45739_2_, p_i45739_3_); ++ canMakeSlopes = this.field_180365_d.canMakeSlopes(p_i45739_2_, p_i45739_3_); + this.func_180360_a(enumraildirection); } -@@ -412,7 +510,7 @@ +@@ -448,7 +499,7 @@ } } -- if (b0 == 0) -+ if (b0 == 0 && canMakeSlopes) +- if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) ++ if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) { - if (BlockRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c, this.field_150658_d + 1, this.field_150659_e - 1)) + if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a())) { -@@ -425,7 +523,7 @@ +@@ -461,7 +512,7 @@ } } -- if (b0 == 1) -+ if (b0 == 1 && canMakeSlopes) +- if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) ++ if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) { - if (BlockRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c + 1, this.field_150658_d + 1, this.field_150659_e)) + if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a())) { -@@ -570,7 +668,7 @@ +@@ -604,7 +655,7 @@ } } -- if (b0 == 0) -+ if (b0 == 0 && canMakeSlopes) +- if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) ++ if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) { - if (BlockRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c, this.field_150658_d + 1, this.field_150659_e - 1)) + if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a())) { -@@ -583,7 +681,7 @@ +@@ -617,7 +668,7 @@ } } -- if (b0 == 1) -+ if (b0 == 1 && canMakeSlopes) +- if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) ++ if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) { - if (BlockRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c + 1, this.field_150658_d + 1, this.field_150659_e)) + if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a())) { diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch index 706b86c329..cced215218 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch @@ -1,22 +1,24 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java -@@ -228,4 +228,19 @@ - { - return new TileEntityComparator(); +@@ -295,6 +295,21 @@ + return this.func_176223_P().func_177226_a(field_176387_N, p_180642_8_.func_174811_aO().func_176734_d()).func_177226_a(field_176464_a, Boolean.valueOf(false)).func_177226_a(field_176463_b, BlockRedstoneComparator.Mode.COMPARE); } + ++ @Override ++ public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) ++ { ++ if (pos.func_177956_o() == neighbor.func_177956_o() && world instanceof World) ++ { ++ func_176204_a((World)world, pos, world.func_180495_p(neighbor), world.func_180495_p(neighbor).func_177230_c()); ++ } ++ } + + @Override -+ public void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) -+ { -+ if (y == tileY && world instanceof World) -+ { -+ func_149695_a((World)world, x, y, z, world.func_147439_a(tileX, tileY, tileZ)); -+ } -+ } -+ -+ @Override -+ public boolean getWeakChanges(IBlockAccess world, int x, int y, int z) ++ public boolean getWeakChanges(IBlockAccess world, BlockPos pos) + { + return true; + } - } ++ + public static enum Mode implements IStringSerializable + { + COMPARE("compare"), diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch index b9f957d198..7716b8837c 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch @@ -1,29 +1,20 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java -@@ -10,6 +10,7 @@ - import net.minecraft.init.Items; - import net.minecraft.item.Item; - import net.minecraft.item.ItemStack; -+import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; - - public class BlockRedstoneOre extends Block -@@ -88,12 +89,17 @@ - public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) +@@ -92,12 +92,16 @@ + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { - super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); + super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); + } -- if (this.func_149650_a(p_149690_5_, p_149690_1_.field_73012_v, p_149690_7_) != Item.func_150898_a(this)) -+ private Random rand = new Random(); -+ @Override // World, meta, fortune -+ public int getExpDrop(IBlockAccess p_149690_1_, int p_149690_5_, int p_149690_7_) +- if (this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_) != Item.func_150898_a(this)) ++ @Override ++ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ if (this.func_149650_a(p_149690_5_, rand, p_149690_7_) != Item.func_150898_a(this)) ++ if (this.func_180660_a(world.func_180495_p(pos), RANDOM, fortune) != Item.func_150898_a(this)) { -- int j1 = 1 + p_149690_1_.field_73012_v.nextInt(5); -- this.func_149657_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, j1); -+ return 1 + rand.nextInt(5); +- int j = 1 + p_180653_1_.field_73012_v.nextInt(5); +- this.func_180637_b(p_180653_1_, p_180653_2_, j); ++ return 1 + RANDOM.nextInt(5); } + return 0; } diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch index dc64874228..b6a66a746e 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch @@ -1,11 +1,59 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java -@@ -405,7 +405,7 @@ - } - else if (!Blocks.field_150413_aR.func_149907_e(block)) +@@ -60,10 +60,10 @@ + BlockPos blockpos1 = p_176341_2_.func_177972_a(p_176341_3_); + Block block = p_176341_1_.func_180495_p(p_176341_2_.func_177972_a(p_176341_3_)).func_177230_c(); + +- if (!func_176343_a(p_176341_1_.func_180495_p(blockpos1), p_176341_3_) && (block.func_149637_q() || !func_176346_d(p_176341_1_.func_180495_p(blockpos1.func_177977_b())))) ++ if (!canRestoneConnect(p_176341_1_, blockpos1, p_176341_3_) && (block.func_149637_q() || !canRestoneConnect(p_176341_1_, blockpos1.func_177977_b(), null))) { -- return block.func_149744_f() && p_150174_4_ != -1; -+ return block.canConnectRedstone(p_150174_0_, p_150174_1_, p_150174_2_, p_150174_3_, p_150174_4_); + Block block1 = p_176341_1_.func_180495_p(p_176341_2_.func_177984_a()).func_177230_c(); +- return !block1.func_149637_q() && block.func_149637_q() && func_176346_d(p_176341_1_.func_180495_p(blockpos1.func_177984_a())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; ++ return !block1.func_149637_q() && block.func_149637_q() && canRestoneConnect(p_176341_1_, blockpos1.func_177984_a(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; } else { +@@ -393,35 +393,25 @@ + Block block = iblockstate.func_177230_c(); + boolean flag = block.func_149721_r(); + boolean flag1 = p_176339_1_.func_180495_p(p_176339_2_.func_177984_a()).func_177230_c().func_149721_r(); +- return !flag1 && flag && func_176340_e(p_176339_1_, blockpos1.func_177984_a()) ? true : (func_176343_a(iblockstate, p_176339_3_) ? true : (block == Blocks.field_150416_aS && iblockstate.func_177229_b(BlockRedstoneDiode.field_176387_N) == p_176339_3_ ? true : !flag && func_176340_e(p_176339_1_, blockpos1.func_177977_b()))); ++ return !flag1 && flag && canRestoneConnect(p_176339_1_, blockpos1.func_177984_a(), null) ? true : (canRestoneConnect(p_176339_1_, blockpos1, p_176339_3_) ? true : (block == Blocks.field_150416_aS && iblockstate.func_177229_b(BlockRedstoneDiode.field_176387_N) == p_176339_3_ ? true : !flag && canRestoneConnect(p_176339_1_, blockpos1.func_177977_b(), null))); + } + +- protected static boolean func_176340_e(IBlockAccess p_176340_0_, BlockPos p_176340_1_) ++ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side) + { +- return func_176346_d(p_176340_0_.func_180495_p(p_176340_1_)); +- } ++ IBlockState state = world.func_180495_p(pos); + +- protected static boolean func_176346_d(IBlockState p_176346_0_) +- { +- return func_176343_a(p_176346_0_, (EnumFacing)null); +- } +- +- protected static boolean func_176343_a(IBlockState p_176343_0_, EnumFacing p_176343_1_) +- { +- Block block = p_176343_0_.func_177230_c(); +- +- if (block == Blocks.field_150488_af) ++ if (state.func_177230_c() == Blocks.field_150488_af) + { + return true; + } +- else if (Blocks.field_150413_aR.func_149907_e(block)) ++ else if (Blocks.field_150413_aR.func_149907_e(state.func_177230_c())) + { +- EnumFacing enumfacing1 = (EnumFacing)p_176343_0_.func_177229_b(BlockRedstoneRepeater.field_176387_N); +- return enumfacing1 == p_176343_1_ || enumfacing1.func_176734_d() == p_176343_1_; ++ EnumFacing direction = (EnumFacing)state.func_177229_b(BlockRedstoneRepeater.field_176387_N); ++ return direction == side || direction.func_176734_d() == side; + } + else + { +- return block.func_149744_f() && p_176343_1_ != null; ++ return state.func_177230_c().canConnectRedstone(world, pos, side); + } + } + diff --git a/patches/minecraft/net/minecraft/block/BlockReed.java.patch b/patches/minecraft/net/minecraft/block/BlockReed.java.patch index 0b6296a504..49c149df06 100644 --- a/patches/minecraft/net/minecraft/block/BlockReed.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockReed.java.patch @@ -1,47 +1,35 @@ --- ../src-base/minecraft/net/minecraft/block/BlockReed.java +++ ../src-work/minecraft/net/minecraft/block/BlockReed.java -@@ -11,7 +11,11 @@ - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; +@@ -19,7 +19,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; -public class BlockReed extends Block -+import net.minecraftforge.common.EnumPlantType; -+import net.minecraftforge.common.util.ForgeDirection; -+import net.minecraftforge.common.IPlantable; -+ -+public class BlockReed extends Block implements IPlantable ++public class BlockReed extends Block implements net.minecraftforge.common.IPlantable { + public static final PropertyInteger field_176355_a = PropertyInteger.func_177719_a("age", 0, 15); private static final String __OBFID = "CL_00000300"; - -@@ -57,7 +61,7 @@ - public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) +@@ -67,6 +67,7 @@ + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { - Block block = p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_); -- return block == this ? true : (block != Blocks.field_150349_c && block != Blocks.field_150346_d && block != Blocks.field_150354_m ? false : (p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_ - 1, p_149742_4_).func_149688_o() == Material.field_151586_h ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_ - 1, p_149742_4_).func_149688_o() == Material.field_151586_h ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_ - 1).func_149688_o() == Material.field_151586_h ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_ + 1).func_149688_o() == Material.field_151586_h)))); -+ return block.canSustainPlant(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_, ForgeDirection.UP, this); - } + Block block = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c(); ++ if (block.canSustainPlant(p_176196_1_, p_176196_2_, EnumFacing.UP, this)) return true; - public void func_149695_a(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) -@@ -120,4 +124,22 @@ + if (block == this) + { +@@ -172,4 +173,15 @@ { - return p_149720_1_.func_72807_a(p_149720_2_, p_149720_4_).func_150558_b(p_149720_2_, p_149720_3_, p_149720_4_); + return new BlockState(this, new IProperty[] {field_176355_a}); } + + @Override -+ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) ++ public net.minecraftforge.common.EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) + { -+ return EnumPlantType.Beach; ++ return net.minecraftforge.common.EnumPlantType.Beach; + } -+ + @Override -+ public Block getPlant(IBlockAccess world, int x, int y, int z) ++ public IBlockState getPlant(IBlockAccess world, BlockPos pos) + { -+ return this; -+ } -+ -+ @Override -+ public int getPlantMetadata(IBlockAccess world, int x, int y, int z) -+ { -+ return world.func_72805_g(x, y, z); ++ return this.func_176223_P(); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch index 0a382e1163..b7fa64ce7a 100644 --- a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSapling.java +++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java -@@ -71,6 +71,7 @@ +@@ -66,6 +66,7 @@ - public void func_149878_d(World p_149878_1_, int p_149878_2_, int p_149878_3_, int p_149878_4_, Random p_149878_5_) + public void func_176476_e(World p_176476_1_, BlockPos p_176476_2_, IBlockState p_176476_3_, Random p_176476_4_) { -+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(p_149878_1_, p_149878_5_, p_149878_2_, p_149878_3_, p_149878_4_)) return; - int l = p_149878_1_.func_72805_g(p_149878_2_, p_149878_3_, p_149878_4_) & 7; - Object object = p_149878_5_.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true); - int i1 = 0; ++ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(p_176476_1_, p_176476_4_, p_176476_2_)) return; + Object object = p_176476_4_.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true); + int i = 0; + int j = 0; diff --git a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch index 2eeaf0255b..9fd41a7802 100644 --- a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch @@ -1,63 +1,55 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSkull.java +++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java -@@ -2,6 +2,7 @@ - - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.ArrayList; - import java.util.Iterator; - import java.util.Random; - import net.minecraft.block.material.Material; -@@ -109,8 +110,6 @@ - return p_149692_1_; +@@ -122,8 +122,6 @@ + return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).func_145904_a() : super.func_176222_j(p_176222_1_, p_176222_2_); } -- public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) {} +- public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) {} - - public void func_149681_a(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_) + public void func_176208_a(World p_176208_1_, BlockPos p_176208_2_, IBlockState p_176208_3_, EntityPlayer p_176208_4_) { - if (p_149681_6_.field_71075_bZ.field_75098_d) -@@ -118,19 +117,28 @@ - p_149681_5_ |= 8; - p_149681_1_.func_72921_c(p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, 4); + if (p_176208_4_.field_71075_bZ.field_75098_d) +@@ -131,13 +129,18 @@ + p_176208_3_ = p_176208_3_.func_177226_a(field_176417_b, Boolean.valueOf(true)); + p_176208_1_.func_180501_a(p_176208_2_, p_176208_3_, 4); } -+ this.func_149697_b(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, 0); ++ this.func_176226_b(p_176208_1_, p_176208_2_, p_176208_3_, 0); - super.func_149681_a(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, p_149681_6_); + super.func_176208_a(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_); } - public void func_149749_a(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) + public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) { -- if (!p_149749_1_.field_72995_K) -+ super.func_149749_a(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); +- if (!p_180663_1_.field_72995_K) ++ super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_); + } -+ -+ @Override -+ public ArrayList getDrops(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, int p_149749_6_, int fortune) ++ public java.util.List getDrops(IBlockAccess p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_, int fortune) + { -+ ArrayList ret = new ArrayList(); ++ java.util.List ret = new java.util.ArrayList(); { - if ((p_149749_6_ & 8) == 0) + if (!((Boolean)p_180663_3_.func_177229_b(field_176417_b)).booleanValue()) { - ItemStack itemstack = new ItemStack(Items.field_151144_bL, 1, this.func_149643_k(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_)); - TileEntitySkull tileentityskull = (TileEntitySkull)p_149749_1_.func_147438_o(p_149749_2_, p_149749_3_, p_149749_4_); - -+ if (tileentityskull == null) return ret; -+ - if (tileentityskull.func_145904_a() == 3 && tileentityskull.func_152108_a() != null) +@@ -146,7 +149,7 @@ + if (tileentity instanceof TileEntitySkull) { - itemstack.func_77982_d(new NBTTagCompound()); -@@ -139,11 +147,10 @@ - itemstack.func_77978_p().func_74782_a("SkullOwner", nbttagcompound); - } + TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; +- ItemStack itemstack = new ItemStack(Items.field_151144_bL, 1, this.func_176222_j(p_180663_1_, p_180663_2_)); ++ ItemStack itemstack = new ItemStack(Items.field_151144_bL, 1, tileentityskull.func_145904_a()); -- this.func_149642_a(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, itemstack); -+ ret.add(itemstack); + if (tileentityskull.func_145904_a() == 3 && tileentityskull.func_152108_a() != null) + { +@@ -156,12 +159,11 @@ + itemstack.func_77978_p().func_74782_a("SkullOwner", nbttagcompound); + } + +- func_180635_a(p_180663_1_, p_180663_2_, itemstack); ++ ret.add(itemstack); + } } - -- super.func_149749_a(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); +- super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_); } + return ret; } - public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_) + public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) diff --git a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch index 759c69a1cc..c7c1efbf12 100644 --- a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch @@ -1,35 +1,34 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSnow.java +++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java -@@ -73,7 +73,7 @@ - public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) +@@ -80,7 +80,7 @@ { - Block block = p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_); -- return block != Blocks.field_150432_aD && block != Blocks.field_150403_cj ? (block.func_149688_o() == Material.field_151584_j ? true : (block == this && (p_149742_1_.func_72805_g(p_149742_2_, p_149742_3_ - 1, p_149742_4_) & 7) == 7 ? true : block.func_149662_c() && block.field_149764_J.func_76230_c())) : false; -+ return block != Blocks.field_150432_aD && block != Blocks.field_150403_cj ? (block.isLeaves(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) ? true : (block == this && (p_149742_1_.func_72805_g(p_149742_2_, p_149742_3_ - 1, p_149742_4_) & 7) == 7 ? true : block.func_149662_c() && block.field_149764_J.func_76230_c())) : false; + IBlockState iblockstate = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()); + Block block = iblockstate.func_177230_c(); +- return block != Blocks.field_150432_aD && block != Blocks.field_150403_cj ? (block.func_149688_o() == Material.field_151584_j ? true : (block == this && ((Integer)iblockstate.func_177229_b(field_176315_a)).intValue() == 7 ? true : block.func_149662_c() && block.field_149764_J.func_76230_c())) : false; ++ return block != Blocks.field_150432_aD && block != Blocks.field_150403_cj ? (block.isLeaves(p_176196_1_, p_176196_2_.func_177977_b()) ? true : (block == this && ((Integer)iblockstate.func_177229_b(field_176315_a)).intValue() == 7 ? true : block.func_149662_c() && block.field_149764_J.func_76230_c())) : false; } - public void func_149695_a(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) -@@ -85,7 +85,6 @@ + public void func_176204_a(World p_176204_1_, BlockPos p_176204_2_, IBlockState p_176204_3_, Block p_176204_4_) +@@ -92,7 +92,6 @@ { - if (!this.func_149742_c(p_150155_1_, p_150155_2_, p_150155_3_, p_150155_4_)) + if (!this.func_176196_c(p_176314_1_, p_176314_2_)) { -- this.func_149697_b(p_150155_1_, p_150155_2_, p_150155_3_, p_150155_4_, p_150155_1_.func_72805_g(p_150155_2_, p_150155_3_, p_150155_4_), 0); - p_150155_1_.func_147468_f(p_150155_2_, p_150155_3_, p_150155_4_); +- this.func_176226_b(p_176314_1_, p_176314_2_, p_176314_3_, 0); + p_176314_1_.func_175698_g(p_176314_2_); return false; } -@@ -97,10 +96,8 @@ +@@ -104,9 +103,8 @@ - public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_) + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) { -- int i1 = p_149636_6_ & 7; -- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Items.field_151126_ay, i1 + 1, 0)); -+ super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_); - p_149636_1_.func_147468_f(p_149636_3_, p_149636_4_, p_149636_5_); -- p_149636_2_.func_71064_a(StatList.field_75934_C[Block.func_149682_b(this)], 1); +- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Items.field_151126_ay, ((Integer)p_180657_4_.func_177229_b(field_176315_a)).intValue() + 1, 0)); ++ super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); + p_180657_1_.func_175698_g(p_180657_3_); +- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); } - public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_) -@@ -110,14 +107,13 @@ + public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) +@@ -116,14 +114,13 @@ public int func_149745_a(Random p_149745_1_) { @@ -37,46 +36,18 @@ + return 1; } - public void func_149674_a(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) + public void func_180650_b(World p_180650_1_, BlockPos p_180650_2_, IBlockState p_180650_3_, Random p_180650_4_) { - if (p_149674_1_.func_72972_b(EnumSkyBlock.Block, p_149674_2_, p_149674_3_, p_149674_4_) > 11) + if (p_180650_1_.func_175642_b(EnumSkyBlock.BLOCK, p_180650_2_) > 11) { -- this.func_149697_b(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_1_.func_72805_g(p_149674_2_, p_149674_3_, p_149674_4_), 0); - p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_); +- this.func_176226_b(p_180650_1_, p_180650_2_, p_180650_1_.func_180495_p(p_180650_2_), 0); + p_180650_1_.func_175698_g(p_180650_2_); } } -@@ -127,4 +123,34 @@ +@@ -153,4 +150,6 @@ { - return p_149646_5_ == 1 ? true : super.func_149646_a(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_); + return new BlockState(this, new IProperty[] {field_176315_a}); } + -+ /** -+ * Metadata and fortune sensitive version, this replaces the old (int meta, Random rand) -+ * version in 1.1. -+ * -+ * @param meta Blocks Metadata -+ * @param fortune Current item fortune level -+ * @param random Random number generator -+ * @return The number of items to drop -+ */ -+ public int quantityDropped(int meta, int fortune, Random random) -+ { -+ return (meta & 7) + 1; -+ } -+ -+ /** -+ * Determines if a new block can be replace the space occupied by this one, -+ * Used in the player's placement code to make the block act like water, and lava. -+ * -+ * @param world The current world -+ * @param x X Position -+ * @param y Y position -+ * @param z Z position -+ * @return True if the block is replaceable by another block -+ */ -+ public boolean isReplaceable(IBlockAccess world, int x, int y, int z) -+ { -+ int meta = world.func_72805_g(x, y, z); -+ return meta >= 7 ? false : field_149764_J.func_76222_j(); -+ } ++ @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.func_177229_b(field_176315_a)) + 1; } } diff --git a/patches/minecraft/net/minecraft/block/BlockStem.java.patch b/patches/minecraft/net/minecraft/block/BlockStem.java.patch index 2bafd66229..ab4a31800f 100644 --- a/patches/minecraft/net/minecraft/block/BlockStem.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockStem.java.patch @@ -1,79 +1,45 @@ --- ../src-base/minecraft/net/minecraft/block/BlockStem.java +++ ../src-work/minecraft/net/minecraft/block/BlockStem.java -@@ -2,6 +2,7 @@ +@@ -108,7 +108,7 @@ + p_180650_2_ = p_180650_2_.func_177972_a(EnumFacing.Plane.HORIZONTAL.func_179518_a(p_180650_4_)); + Block block = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_177230_c(); - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.ArrayList; - import java.util.Random; - import net.minecraft.block.material.Material; - import net.minecraft.client.renderer.texture.IIconRegister; -@@ -14,6 +15,7 @@ - import net.minecraft.util.MathHelper; - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; -+import static net.minecraftforge.common.util.ForgeDirection.*; - - public class BlockStem extends BlockBush implements IGrowable - { -@@ -101,7 +103,7 @@ - - Block block = p_149674_1_.func_147439_a(j1, p_149674_3_ - 1, k1); - -- if (p_149674_1_.func_147439_a(j1, p_149674_3_, k1).field_149764_J == Material.field_151579_a && (block == Blocks.field_150458_ak || block == Blocks.field_150346_d || block == Blocks.field_150349_c)) -+ if (p_149674_1_.func_147437_c(j1, p_149674_3_, k1) && (block.canSustainPlant(p_149674_1_, j1, p_149674_3_ - 1, k1, UP, this) || block == Blocks.field_150346_d || block == Blocks.field_150349_c)) +- if (p_180650_1_.func_180495_p(p_180650_2_).func_177230_c().field_149764_J == Material.field_151579_a && (block == Blocks.field_150458_ak || block == Blocks.field_150346_d || block == Blocks.field_150349_c)) ++ if (p_180650_1_.func_175623_d(p_180650_2_) && (block.canSustainPlant(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP, this) || block == Blocks.field_150346_d || block == Blocks.field_150349_c)) { - p_149674_1_.func_147449_b(j1, p_149674_3_, k1, this.field_149877_a); + p_180650_1_.func_175656_a(p_180650_2_, this.field_149877_a.func_176223_P()); } -@@ -144,11 +146,11 @@ - Block block8 = p_149875_1_.func_147439_a(l, p_149875_3_ - 1, i1); - float f1 = 0.0F; - -- if (block8 == Blocks.field_150458_ak) -+ if (block8.canSustainPlant(p_149875_1_, l, p_149875_3_ - 1, i1, UP, this)) - { - f1 = 1.0F; - -- if (p_149875_1_.func_72805_g(l, p_149875_3_ - 1, i1) > 0) -+ if (block8.isFertile(p_149875_1_, l, p_149875_3_ - 1, i1)) - { - f1 = 3.0F; - } -@@ -211,11 +213,12 @@ - return l < 7 ? -1 : (p_149873_1_.func_147439_a(p_149873_2_ - 1, p_149873_3_, p_149873_4_) == this.field_149877_a ? 0 : (p_149873_1_.func_147439_a(p_149873_2_ + 1, p_149873_3_, p_149873_4_) == this.field_149877_a ? 1 : (p_149873_1_.func_147439_a(p_149873_2_, p_149873_3_, p_149873_4_ - 1) == this.field_149877_a ? 2 : (p_149873_1_.func_147439_a(p_149873_2_, p_149873_3_, p_149873_4_ + 1) == this.field_149877_a ? 3 : -1)))); - } - -+ @SuppressWarnings("unused") - public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) +@@ -162,24 +162,29 @@ + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { - super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); - -- if (!p_149690_1_.field_72995_K) -+ if (false && !p_149690_1_.field_72995_K) - { - Item item = null; - -@@ -282,4 +285,23 @@ - { - this.func_149874_m(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_); - } -+ -+ -+ @Override -+ public ArrayList getDrops(World world, int x, int y, int z, int meta, int fortune) -+ { -+ ArrayList ret = new ArrayList(); -+ -+ Item item = null; -+ item = field_149877_a == Blocks.field_150423_aK ? Items.field_151080_bb : item; -+ item = field_149877_a == Blocks.field_150440_ba ? Items.field_151081_bc : item; -+ -+ for (int i = 0; item != null && i < 3; i++) -+ { -+ if (world.field_73012_v.nextInt(15) <= meta) -+ ret.add(new ItemStack(item)); -+ } -+ -+ return ret; + super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); + } - } + +- if (!p_180653_1_.field_72995_K) ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); + { + Item item = this.func_176481_j(); + + if (item != null) + { +- int j = ((Integer)p_180653_3_.func_177229_b(field_176484_a)).intValue(); ++ int j = ((Integer)state.func_177229_b(field_176484_a)).intValue(); + + for (int k = 0; k < 3; ++k) + { +- if (p_180653_1_.field_73012_v.nextInt(15) <= j) ++ if (RANDOM.nextInt(15) <= j) + { +- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(item)); ++ ret.add(new ItemStack(item)); + } + } + } + } ++ return ret; + } + + protected Item func_176481_j() diff --git a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch index 4874336d4f..df5c0a0093 100644 --- a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch @@ -1,83 +1,66 @@ --- ../src-base/minecraft/net/minecraft/block/BlockTallGrass.java +++ ../src-work/minecraft/net/minecraft/block/BlockTallGrass.java -@@ -2,6 +2,7 @@ - - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.ArrayList; - import java.util.List; - import java.util.Random; - import net.minecraft.block.material.Material; -@@ -17,8 +18,10 @@ - import net.minecraft.world.ColorizerGrass; - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeHooks; -+import net.minecraftforge.common.IShearable; +@@ -23,7 +23,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; -public class BlockTallGrass extends BlockBush implements IGrowable -+public class BlockTallGrass extends BlockBush implements IGrowable, IShearable ++public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable { - private static final String[] field_149871_a = new String[] {"deadbush", "tallgrass", "fern"}; - @SideOnly(Side.CLIENT) -@@ -53,7 +56,7 @@ + public static final PropertyEnum field_176497_a = PropertyEnum.func_177709_a("type", BlockTallGrass.EnumType.class); + private static final String __OBFID = "CL_00000321"; +@@ -44,7 +44,7 @@ - public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_) + public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { -- return this.func_149854_a(p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_)); -+ return super.func_149718_j(p_149718_1_, p_149718_2_, p_149718_3_, p_149718_4_); +- return this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c()); ++ return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_3_); } - @SideOnly(Side.CLIENT) -@@ -71,7 +74,7 @@ + public boolean func_176200_f(World p_176200_1_, BlockPos p_176200_2_) +@@ -74,7 +74,7 @@ - public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_) + public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) { -- return p_149650_2_.nextInt(8) == 0 ? Items.field_151014_N : null; +- return p_180660_2_.nextInt(8) == 0 ? Items.field_151014_N : null; + return null; } public int func_149679_a(int p_149679_1_, Random p_149679_2_) -@@ -81,13 +84,7 @@ +@@ -84,13 +84,7 @@ - public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_) + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) { -- if (!p_149636_1_.field_72995_K && p_149636_2_.func_71045_bC() != null && p_149636_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) +- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) { -- p_149636_2_.func_71064_a(StatList.field_75934_C[Block.func_149682_b(this)], 1); -- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Blocks.field_150329_H, 1, p_149636_6_)); +- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); +- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150329_H, 1, ((BlockTallGrass.EnumType)p_180657_4_.func_177229_b(field_176497_a)).func_177044_a())); - } - else - { - super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_); + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); } } -@@ -143,4 +140,28 @@ - Blocks.field_150398_cm.func_149889_c(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_, b0, 2); +@@ -210,4 +204,22 @@ + } } } + ++ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } + @Override -+ public ArrayList getDrops(World world, int x, int y, int z, int meta, int fortune) ++ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) + { -+ ArrayList ret = new ArrayList(); -+ if (world.field_73012_v.nextInt(8) != 0) return ret; -+ ItemStack seed = ForgeHooks.getGrassSeed(world); ++ List ret = new java.util.ArrayList(); ++ ret.add(new ItemStack(Blocks.field_150329_H, 1, ((BlockTallGrass.EnumType)world.func_180495_p(pos).func_177229_b(field_176497_a)).func_177044_a())); ++ return ret; ++ } ++ @Override ++ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ List ret = new java.util.ArrayList(); ++ if (RANDOM.nextInt(8) != 0) return ret; ++ ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(RANDOM); + if (seed != null) ret.add(seed); + return ret; -+ } -+ -+ @Override -+ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) -+ { -+ return true; -+ } -+ -+ @Override -+ public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) -+ { -+ ArrayList ret = new ArrayList(); -+ ret.add(new ItemStack(this, 1, world.func_72805_g(x, y, z))); -+ return ret; + } } diff --git a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch index 046a08b75c..b7a92250f5 100644 --- a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch @@ -1,108 +1,38 @@ --- ../src-base/minecraft/net/minecraft/block/BlockTorch.java +++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java -@@ -10,6 +10,7 @@ - import net.minecraft.util.MovingObjectPosition; - import net.minecraft.util.Vec3; - import net.minecraft.world.World; -+import static net.minecraftforge.common.util.ForgeDirection.*; - - public class BlockTorch extends Block - { -@@ -51,13 +52,17 @@ +@@ -70,7 +70,7 @@ else { - Block block = p_150107_1_.func_147439_a(p_150107_2_, p_150107_3_, p_150107_4_); -- return block == Blocks.field_150422_aJ || block == Blocks.field_150386_bk || block == Blocks.field_150359_w || block == Blocks.field_150463_bK; -+ return block.canPlaceTorchOnTop(p_150107_1_, p_150107_2_, p_150107_3_, p_150107_4_); + Block block = p_176594_1_.func_180495_p(p_176594_2_).func_177230_c(); +- return block instanceof BlockFence || block == Blocks.field_150359_w || block == Blocks.field_150463_bK || block == Blocks.field_150399_cn; ++ return block.canPlaceTorchOnTop(p_176594_1_, p_176594_2_); } } - public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) +@@ -97,7 +97,7 @@ { -- return p_149742_1_.func_147445_c(p_149742_2_ - 1, p_149742_3_, p_149742_4_, true) ? true : (p_149742_1_.func_147445_c(p_149742_2_ + 1, p_149742_3_, p_149742_4_, true) ? true : (p_149742_1_.func_147445_c(p_149742_2_, p_149742_3_, p_149742_4_ - 1, true) ? true : (p_149742_1_.func_147445_c(p_149742_2_, p_149742_3_, p_149742_4_ + 1, true) ? true : this.func_150107_m(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_)))); -+ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST, true) || -+ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST, true) || -+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH, true) || -+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH, true) || -+ func_150107_m(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_); + BlockPos blockpos1 = p_176595_2_.func_177972_a(p_176595_3_.func_176734_d()); + boolean flag = p_176595_3_.func_176740_k().func_176722_c(); +- return flag && p_176595_1_.func_175677_d(blockpos1, true) || p_176595_3_.equals(EnumFacing.UP) && this.func_176594_d(p_176595_1_, blockpos1); ++ return flag && p_176595_1_.isSideSolid(blockpos1, p_176595_3_, true) || p_176595_3_.equals(EnumFacing.UP) && this.func_176594_d(p_176595_1_, blockpos1); } - public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) -@@ -69,22 +74,22 @@ - j1 = 5; - } + public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) +@@ -120,7 +120,7 @@ -- if (p_149660_5_ == 2 && p_149660_1_.func_147445_c(p_149660_2_, p_149660_3_, p_149660_4_ + 1, true)) -+ if (p_149660_5_ == 2 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH, true)) - { - j1 = 4; - } + enumfacing1 = (EnumFacing)iterator.next(); + } +- while (!p_180642_1_.func_175677_d(p_180642_2_.func_177972_a(enumfacing1.func_176734_d()), true)); ++ while (!p_180642_1_.isSideSolid(p_180642_2_.func_177972_a(enumfacing1.func_176734_d()), enumfacing1, true)); -- if (p_149660_5_ == 3 && p_149660_1_.func_147445_c(p_149660_2_, p_149660_3_, p_149660_4_ - 1, true)) -+ if (p_149660_5_ == 3 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH, true)) - { - j1 = 3; + return this.func_176223_P().func_177226_a(field_176596_a, enumfacing1); } - -- if (p_149660_5_ == 4 && p_149660_1_.func_147445_c(p_149660_2_ + 1, p_149660_3_, p_149660_4_, true)) -+ if (p_149660_5_ == 4 && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST, true)) - { - j1 = 2; - } - -- if (p_149660_5_ == 5 && p_149660_1_.func_147445_c(p_149660_2_ - 1, p_149660_3_, p_149660_4_, true)) -+ if (p_149660_5_ == 5 && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST, true)) - { - j1 = 1; - } -@@ -106,19 +111,19 @@ - { - if (p_149726_1_.func_72805_g(p_149726_2_, p_149726_3_, p_149726_4_) == 0) - { -- if (p_149726_1_.func_147445_c(p_149726_2_ - 1, p_149726_3_, p_149726_4_, true)) -+ if (p_149726_1_.isSideSolid(p_149726_2_ - 1, p_149726_3_, p_149726_4_, EAST, true)) - { - p_149726_1_.func_72921_c(p_149726_2_, p_149726_3_, p_149726_4_, 1, 2); - } -- else if (p_149726_1_.func_147445_c(p_149726_2_ + 1, p_149726_3_, p_149726_4_, true)) -+ else if (p_149726_1_.isSideSolid(p_149726_2_ + 1, p_149726_3_, p_149726_4_, WEST, true)) - { - p_149726_1_.func_72921_c(p_149726_2_, p_149726_3_, p_149726_4_, 2, 2); - } -- else if (p_149726_1_.func_147445_c(p_149726_2_, p_149726_3_, p_149726_4_ - 1, true)) -+ else if (p_149726_1_.isSideSolid(p_149726_2_, p_149726_3_, p_149726_4_ - 1, SOUTH, true)) - { - p_149726_1_.func_72921_c(p_149726_2_, p_149726_3_, p_149726_4_, 3, 2); - } -- else if (p_149726_1_.func_147445_c(p_149726_2_, p_149726_3_, p_149726_4_ + 1, true)) -+ else if (p_149726_1_.isSideSolid(p_149726_2_, p_149726_3_, p_149726_4_ + 1, NORTH, true)) - { - p_149726_1_.func_72921_c(p_149726_2_, p_149726_3_, p_149726_4_, 4, 2); - } -@@ -143,22 +148,22 @@ - int l = p_150108_1_.func_72805_g(p_150108_2_, p_150108_3_, p_150108_4_); +@@ -149,7 +149,7 @@ + EnumFacing enumfacing1 = enumfacing.func_176734_d(); boolean flag = false; -- if (!p_150108_1_.func_147445_c(p_150108_2_ - 1, p_150108_3_, p_150108_4_, true) && l == 1) -+ if (!p_150108_1_.isSideSolid(p_150108_2_ - 1, p_150108_3_, p_150108_4_, EAST, true) && l == 1) - { - flag = true; - } - -- if (!p_150108_1_.func_147445_c(p_150108_2_ + 1, p_150108_3_, p_150108_4_, true) && l == 2) -+ if (!p_150108_1_.isSideSolid(p_150108_2_ + 1, p_150108_3_, p_150108_4_, WEST, true) && l == 2) - { - flag = true; - } - -- if (!p_150108_1_.func_147445_c(p_150108_2_, p_150108_3_, p_150108_4_ - 1, true) && l == 3) -+ if (!p_150108_1_.isSideSolid(p_150108_2_, p_150108_3_, p_150108_4_ - 1, SOUTH, true) && l == 3) - { - flag = true; - } - -- if (!p_150108_1_.func_147445_c(p_150108_2_, p_150108_3_, p_150108_4_ + 1, true) && l == 4) -+ if (!p_150108_1_.isSideSolid(p_150108_2_, p_150108_3_, p_150108_4_ + 1, NORTH, true) && l == 4) +- if (axis.func_176722_c() && !p_176592_1_.func_175677_d(p_176592_2_.func_177972_a(enumfacing1), true)) ++ if (axis.func_176722_c() && !p_176592_1_.isSideSolid(p_176592_2_.func_177972_a(enumfacing1), enumfacing1, true)) { flag = true; } diff --git a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch index 764ccd8925..21ca8d0d9a 100644 --- a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch @@ -1,49 +1,43 @@ --- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java +++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java -@@ -11,9 +11,12 @@ - import net.minecraft.util.Vec3; - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; -+import net.minecraftforge.common.util.ForgeDirection; +@@ -25,6 +25,8 @@ public class BlockTrapDoor extends Block { + /** Set this to allow trapdoors to remain free-floating */ + public static boolean disableValidation = false; - private static final String __OBFID = "CL_00000327"; - - protected BlockTrapDoor(Material p_i45434_1_) -@@ -163,7 +166,7 @@ - --i1; - } - -- if (!func_150119_a(p_149695_1_.func_147439_a(i1, p_149695_3_, j1))) -+ if (!(func_150119_a(p_149695_1_.func_147439_a(i1, p_149695_3_, j1)) || p_149695_1_.isSideSolid(i1, p_149695_3_, j1, ForgeDirection.getOrientation((l & 3) + 2)))) - { - p_149695_1_.func_147468_f(p_149695_2_, p_149695_3_, p_149695_4_); - this.func_149697_b(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, l, 0); -@@ -218,6 +221,7 @@ - - public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_) + public static final PropertyDirection field_176284_a = PropertyDirection.func_177712_a("facing", EnumFacing.Plane.HORIZONTAL); + public static final PropertyBool field_176283_b = PropertyBool.func_177716_a("open"); + public static final PropertyEnum field_176285_M = PropertyEnum.func_177709_a("half", BlockTrapDoor.DoorHalf.class); +@@ -141,9 +143,10 @@ { -+ if (disableValidation) return true; - if (p_149707_5_ == 0) + if (!p_176204_1_.field_72995_K) { - return false; -@@ -248,7 +252,7 @@ - --p_149707_2_; - } ++ EnumFacing direction = (EnumFacing)p_176204_3_.func_177229_b(field_176284_a); + BlockPos blockpos1 = p_176204_2_.func_177972_a(((EnumFacing)p_176204_3_.func_177229_b(field_176284_a)).func_176734_d()); -- return func_150119_a(p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_)); -+ return func_150119_a(p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_)) || p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_, ForgeDirection.UP); - } +- if (!func_150119_a(p_176204_1_.func_180495_p(blockpos1).func_177230_c())) ++ if (!(func_150119_a(p_176204_1_.func_180495_p(blockpos1).func_177230_c()) || p_176204_1_.isSideSolid(blockpos1, direction, true))) + { + p_176204_1_.func_175698_g(p_176204_2_); + this.func_176226_b(p_176204_1_, p_176204_2_, p_176204_3_, 0); +@@ -187,7 +190,10 @@ + + public boolean func_176198_a(World p_176198_1_, BlockPos p_176198_2_, EnumFacing p_176198_3_) + { +- return !p_176198_3_.func_176740_k().func_176720_b() && func_150119_a(p_176198_1_.func_180495_p(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d())).func_177230_c()); ++ if (disableValidation) return true; ++ EnumFacing dir = p_176198_3_.func_176734_d(); ++ p_176198_2_ = p_176198_2_.func_177972_a(dir); ++ return !p_176198_3_.func_176740_k().func_176720_b() && (func_150119_a(p_176198_1_.func_180495_p(p_176198_2_).func_177230_c()) || p_176198_1_.isSideSolid(p_176198_2_, p_176198_3_, true)); } -@@ -259,6 +263,7 @@ + protected static EnumFacing func_176281_b(int p_176281_0_) +@@ -224,6 +230,7 @@ private static boolean func_150119_a(Block p_150119_0_) { + if (disableValidation) return true; return p_150119_0_.field_149764_J.func_76218_k() && p_150119_0_.func_149686_d() || p_150119_0_ == Blocks.field_150426_aN || p_150119_0_ instanceof BlockSlab || p_150119_0_ instanceof BlockStairs; } - } + diff --git a/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch b/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch index d2686dfbd0..f5b18908b9 100644 --- a/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch @@ -1,96 +1,29 @@ --- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java +++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java -@@ -9,6 +9,9 @@ - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; +@@ -60,7 +60,7 @@ -+import net.minecraftforge.common.util.ForgeDirection; -+import static net.minecraftforge.common.util.ForgeDirection.*; -+ - public class BlockTripWireHook extends Block - { - private static final String __OBFID = "CL_00000329"; -@@ -47,34 +50,41 @@ - - public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_) + public boolean func_176198_a(World p_176198_1_, BlockPos p_176198_2_, EnumFacing p_176198_3_) { -- return p_149707_5_ == 2 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ + 1).func_149721_r() ? true : (p_149707_5_ == 3 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ - 1).func_149721_r() ? true : (p_149707_5_ == 4 && p_149707_1_.func_147439_a(p_149707_2_ + 1, p_149707_3_, p_149707_4_).func_149721_r() ? true : p_149707_5_ == 5 && p_149707_1_.func_147439_a(p_149707_2_ - 1, p_149707_3_, p_149707_4_).func_149721_r())); -+ ForgeDirection dir = ForgeDirection.getOrientation(p_149707_5_); -+ return (dir == NORTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ + 1, NORTH)) || -+ (dir == SOUTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ - 1, SOUTH)) || -+ (dir == WEST && p_149707_1_.isSideSolid(p_149707_2_ + 1, p_149707_3_, p_149707_4_, WEST )) || -+ (dir == EAST && p_149707_1_.isSideSolid(p_149707_2_ - 1, p_149707_3_, p_149707_4_, EAST )); +- return p_176198_3_.func_176740_k().func_176722_c() && p_176198_1_.func_180495_p(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d())).func_177230_c().func_149721_r(); ++ return p_176198_3_.func_176740_k().func_176722_c() && p_176198_1_.isSideSolid(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d()), p_176198_3_, true); } - public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) - { -- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r())); -+ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) || -+ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) || -+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) || -+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH); + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) +@@ -77,7 +77,7 @@ + + enumfacing = (EnumFacing)iterator.next(); + } +- while (!p_176196_1_.func_180495_p(p_176196_2_.func_177972_a(enumfacing)).func_177230_c().func_149721_r()); ++ while (!p_176196_1_.isSideSolid(p_176196_2_.func_177972_a(enumfacing), enumfacing.func_176734_d(), true)); + + return true; } +@@ -107,7 +107,7 @@ + { + EnumFacing enumfacing = (EnumFacing)p_176204_3_.func_177229_b(field_176264_a); - public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) - { - byte b0 = 0; - -- if (p_149660_5_ == 2 && p_149660_1_.func_147445_c(p_149660_2_, p_149660_3_, p_149660_4_ + 1, true)) -+ if (p_149660_5_ == 2 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH, true)) - { - b0 = 2; - } - -- if (p_149660_5_ == 3 && p_149660_1_.func_147445_c(p_149660_2_, p_149660_3_, p_149660_4_ - 1, true)) -+ if (p_149660_5_ == 3 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH, true)) - { - b0 = 0; - } - -- if (p_149660_5_ == 4 && p_149660_1_.func_147445_c(p_149660_2_ + 1, p_149660_3_, p_149660_4_, true)) -+ if (p_149660_5_ == 4 && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST, true)) - { - b0 = 1; - } - -- if (p_149660_5_ == 5 && p_149660_1_.func_147445_c(p_149660_2_ - 1, p_149660_3_, p_149660_4_, true)) -+ if (p_149660_5_ == 5 && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST, true)) - { - b0 = 3; - } -@@ -97,22 +107,22 @@ - int i1 = l & 3; - boolean flag = false; - -- if (!p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r() && i1 == 3) -+ if (!p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST) && i1 == 3) +- if (!p_176204_1_.func_180495_p(p_176204_2_.func_177972_a(enumfacing.func_176734_d())).func_177230_c().func_149721_r()) ++ if (!p_176204_1_.isSideSolid(p_176204_2_.func_177972_a(enumfacing.func_176734_d()), enumfacing, true)) { - flag = true; - } - -- if (!p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r() && i1 == 1) -+ if (!p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST) && i1 == 1) - { - flag = true; - } - -- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r() && i1 == 0) -+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH) && i1 == 0) - { - flag = true; - } - -- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r() && i1 == 2) -+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH) && i1 == 2) - { - flag = true; - } -@@ -133,7 +143,7 @@ - boolean flag3 = (p_150136_6_ & 8) == 8; - boolean flag4 = !p_150136_5_; - boolean flag5 = false; -- boolean flag6 = !World.func_147466_a(p_150136_1_, p_150136_2_, p_150136_3_ - 1, p_150136_4_); -+ boolean flag6 = !p_150136_1_.isSideSolid(p_150136_2_, p_150136_3_ - 1, p_150136_4_, UP); - int l1 = Direction.field_71583_a[k1]; - int i2 = Direction.field_71581_b[k1]; - int j2 = 0; + this.func_176226_b(p_176204_1_, p_176204_2_, p_176204_3_, 0); + p_176204_1_.func_175698_g(p_176204_2_); diff --git a/patches/minecraft/net/minecraft/block/BlockVine.java.patch b/patches/minecraft/net/minecraft/block/BlockVine.java.patch index 8f92202167..5436620a39 100644 --- a/patches/minecraft/net/minecraft/block/BlockVine.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockVine.java.patch @@ -1,61 +1,42 @@ --- ../src-base/minecraft/net/minecraft/block/BlockVine.java +++ ../src-work/minecraft/net/minecraft/block/BlockVine.java -@@ -2,9 +2,11 @@ - - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.ArrayList; - import java.util.Random; - import net.minecraft.block.material.Material; - import net.minecraft.creativetab.CreativeTabs; -+import net.minecraft.entity.EntityLivingBase; - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.init.Blocks; - import net.minecraft.init.Items; -@@ -16,8 +18,10 @@ - import net.minecraft.world.ColorizerFoliage; - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeHooks; -+import net.minecraftforge.common.IShearable; +@@ -26,7 +26,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; -public class BlockVine extends Block -+public class BlockVine extends Block implements IShearable ++public class BlockVine extends Block implements net.minecraftforge.common.IShearable { - private static final String __OBFID = "CL_00000330"; + public static final PropertyBool field_176277_a = PropertyBool.func_177716_a("up"); + public static final PropertyBool field_176273_b = PropertyBool.func_177716_a("north"); +@@ -416,13 +416,7 @@ -@@ -375,14 +379,28 @@ - - public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_) + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) { -- if (!p_149636_1_.field_72995_K && p_149636_2_.func_71045_bC() != null && p_149636_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) +- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) { -- p_149636_2_.func_71064_a(StatList.field_75934_C[Block.func_149682_b(this)], 1); -- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Blocks.field_150395_bd, 1, 0)); +- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); +- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150395_bd, 1, 0)); - } - else - { - super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_); + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); } } -+ +@@ -508,6 +502,16 @@ + return i; + } + ++ /*************************FORGE START***********************************/ ++ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity){ return true; } ++ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } + @Override -+ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) ++ public java.util.List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) + { -+ return true; ++ return java.util.Arrays.asList(new ItemStack(this, 1)); + } ++ /*************************FORGE END***********************************/ + -+ @Override -+ public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) -+ { -+ ArrayList ret = new ArrayList(); -+ ret.add(new ItemStack(this, 1)); -+ return ret; -+ } -+ -+ @Override -+ public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) -+ { -+ return true; -+ } - } + static final class SwitchEnumFacing + { + static final int[] field_177057_a = new int[EnumFacing.values().length]; diff --git a/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch new file mode 100644 index 0000000000..aaff29d172 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java ++++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java +@@ -80,7 +80,7 @@ + { + Block block = this.field_177261_a.func_180495_p(p_177251_1_).func_177230_c(); + +- if (block.func_149688_o() == Material.field_151579_a) ++ if (block.isAir(field_177261_a, p_177251_1_)) + { + return true; + } +@@ -111,7 +111,7 @@ + BlockPos blockpos1 = p_177251_1_.func_177967_a(this.field_177257_d.func_176734_d(), i); + block = this.field_177261_a.func_180495_p(blockpos1).func_177230_c(); + +- if (block.func_149688_o() == Material.field_151579_a || !BlockPistonBase.func_180696_a(block, this.field_177261_a, blockpos1, this.field_177257_d, false) || blockpos1.equals(this.field_177259_b)) ++ if (block.isAir(field_177261_a, blockpos1)|| !BlockPistonBase.func_180696_a(block, this.field_177261_a, blockpos1, this.field_177257_d, false) || blockpos1.equals(this.field_177259_b)) + { + break; + } +@@ -159,7 +159,7 @@ + + block = this.field_177261_a.func_180495_p(blockpos2).func_177230_c(); + +- if (block.func_149688_o() == Material.field_151579_a) ++ if (block.isAir(field_177261_a, blockpos2)) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 9ec8287970..8fa08889c4 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,32 +1,23 @@ --- ../src-base/minecraft/net/minecraft/client/Minecraft.java +++ ../src-work/minecraft/net/minecraft/client/Minecraft.java -@@ -276,7 +276,6 @@ - this.func_71389_H(); - this.field_71449_j = p_i1103_1_; - field_147123_G.info("Setting user: " + p_i1103_1_.func_111285_a()); -- field_147123_G.info("(Session ID is " + p_i1103_1_.func_111286_b() + ")"); - this.field_71459_aj = p_i1103_5_; - this.field_71443_c = p_i1103_2_; - this.field_71440_d = p_i1103_3_; -@@ -430,7 +429,7 @@ - - try - { -- Display.create((new PixelFormat()).withDepthBits(24)); -+ net.minecraftforge.client.ForgeHooksClient.createDisplay(); - } - catch (LWJGLException lwjglexception) - { -@@ -541,7 +540,7 @@ +@@ -296,7 +296,6 @@ + this.field_152355_az = (new YggdrasilAuthenticationService(p_i45547_1_.field_178745_a.field_178751_c, UUID.randomUUID().toString())).createMinecraftSessionService(); + this.field_71449_j = p_i45547_1_.field_178745_a.field_178752_a; + field_147123_G.info("Setting user: " + this.field_71449_j.func_111285_a()); +- field_147123_G.info("(Session ID is " + this.field_71449_j.func_111286_b() + ")"); + this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a; + this.field_71443_c = p_i45547_1_.field_178743_b.field_178764_a > 0 ? p_i45547_1_.field_178743_b.field_178764_a : 1; + this.field_71440_d = p_i45547_1_.field_178743_b.field_178762_b > 0 ? p_i45547_1_.field_178743_b.field_178762_b : 1; +@@ -484,7 +483,7 @@ this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o); - FMLClientHandler.instance().finishMinecraftLoading(); + net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading(); this.func_71361_d("Post startup"); - this.field_71456_v = new GuiIngame(this); + this.field_71456_v = new net.minecraftforge.client.GuiIngameForge(this); if (this.field_71475_ae != null) { -@@ -761,11 +760,6 @@ +@@ -891,11 +890,6 @@ public void func_147108_a(GuiScreen p_147108_1_) { @@ -38,7 +29,7 @@ if (p_147108_1_ == null && this.field_71441_e == null) { p_147108_1_ = new GuiMainMenu(); -@@ -775,6 +769,17 @@ +@@ -905,6 +899,17 @@ p_147108_1_ = new GuiGameOver(); } @@ -52,69 +43,62 @@ + { + old.func_146281_b(); + } -+ ++ if (p_147108_1_ instanceof GuiMainMenu) { this.field_71474_y.field_74330_P = false; -@@ -1341,7 +1346,7 @@ +@@ -1388,7 +1393,7 @@ - if (this.field_71439_g.func_82246_f(i, j, k)) - { -- this.field_71452_i.func_78867_a(i, j, k, this.field_71476_x.field_72310_e); -+ this.field_71452_i.addBlockHitEffects(i, j, k, this.field_71476_x); - this.field_71439_g.func_71038_i(); - } + if (this.field_71441_e.func_180495_p(blockpos).func_177230_c().func_149688_o() != Material.field_151579_a && this.field_71442_b.func_180512_c(blockpos, this.field_71476_x.field_178784_b)) + { +- this.field_71452_i.func_180532_a(blockpos, this.field_71476_x.field_178784_b); ++ this.field_71452_i.addBlockHitEffects(blockpos, this.field_71476_x); + this.field_71439_g.func_71038_i(); } -@@ -1422,11 +1427,12 @@ - int j = this.field_71476_x.field_72312_c; - int k = this.field_71476_x.field_72309_d; + } +@@ -1468,15 +1473,19 @@ + case 2: + BlockPos blockpos = this.field_71476_x.func_178782_a(); -- if (this.field_71441_e.func_147439_a(i, j, k).func_149688_o() != Material.field_151579_a) -+ if (!this.field_71441_e.func_147439_a(i, j, k).isAir(field_71441_e, i, j, k)) +- if (this.field_71441_e.func_180495_p(blockpos).func_177230_c().func_149688_o() != Material.field_151579_a) ++ if (!this.field_71441_e.func_175623_d(blockpos)) { - int l = itemstack != null ? itemstack.field_77994_a : 0; + int i = itemstack != null ? itemstack.field_77994_a : 0; -- if (this.field_71442_b.func_78760_a(this.field_71439_g, this.field_71441_e, itemstack, i, j, k, this.field_71476_x.field_72310_e, this.field_71476_x.field_72307_f)) -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_71439_g, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, i, j, k, this.field_71476_x.field_72310_e, this.field_71441_e).isCanceled(); -+ if (result && this.field_71442_b.func_78760_a(this.field_71439_g, this.field_71441_e, itemstack, i, j, k, this.field_71476_x.field_72310_e, this.field_71476_x.field_72307_f)) ++ ++ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_71439_g, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.field_71441_e, blockpos, this.field_71476_x.field_178784_b).isCanceled(); ++ if (result) { //Forge: Kept separate to simplify patch + if (this.field_71442_b.func_178890_a(this.field_71439_g, this.field_71441_e, itemstack, blockpos, this.field_71476_x.field_178784_b, this.field_71476_x.field_72307_f)) { flag = false; this.field_71439_g.func_71038_i(); -@@ -1453,7 +1459,8 @@ - { - ItemStack itemstack1 = this.field_71439_g.field_71071_by.func_70448_g(); + } ++ } -- if (itemstack1 != null && this.field_71442_b.func_78769_a(this.field_71439_g, this.field_71441_e, itemstack1)) -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_71439_g, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, 0, 0, 0, -1, this.field_71441_e).isCanceled(); -+ if (result && itemstack1 != null && this.field_71442_b.func_78769_a(this.field_71439_g, this.field_71441_e, itemstack1)) - { - this.field_71460_t.field_78516_c.func_78445_c(); - } -@@ -1665,6 +1672,8 @@ + if (itemstack == null) + { +@@ -1697,6 +1706,8 @@ while (Mouse.next()) { + if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; + - j = Mouse.getEventButton(); - KeyBinding.func_74510_a(j - 100, Mouse.getEventButtonState()); + i = Mouse.getEventButton(); + KeyBinding.func_74510_a(i - 100, Mouse.getEventButtonState()); -@@ -2127,6 +2136,11 @@ +@@ -2217,6 +2228,8 @@ public void func_71353_a(WorldClient p_71353_1_, String p_71353_2_) { -+ if (field_71441_e != null) -+ { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(field_71441_e)); -+ } ++ if (field_71441_e != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(field_71441_e)); + if (p_71353_1_ == null) { NetHandlerPlayClient nethandlerplayclient = this.func_147114_u(); -@@ -2139,6 +2153,18 @@ - if (this.field_71437_Z != null) +@@ -2230,6 +2243,18 @@ { this.field_71437_Z.func_71263_m(); + this.field_71437_Z.func_175592_a(); + if (field_71461_s != null) + { + this.field_71461_s.func_73719_c(I18n.func_135052_a("forge.client.shutdown.internal")); @@ -130,37 +114,40 @@ } this.field_71437_Z = null; -@@ -2287,113 +2313,10 @@ +@@ -2361,134 +2386,11 @@ if (this.field_71476_x != null) { boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d; - int i = 0; - boolean flag1 = false; -- Item item; - int j; +- TileEntity tileentity = null; +- Object object; - if (this.field_71476_x.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK) - { -- j = this.field_71476_x.field_72311_b; -- int k = this.field_71476_x.field_72312_c; -- int l = this.field_71476_x.field_72309_d; -- Block block = this.field_71441_e.func_147439_a(j, k, l); +- BlockPos blockpos = this.field_71476_x.func_178782_a(); +- Block block = this.field_71441_e.func_180495_p(blockpos).func_177230_c(); - - if (block.func_149688_o() == Material.field_151579_a) - { - return; - } - -- item = block.func_149694_d(this.field_71441_e, j, k, l); +- object = block.func_180665_b(this.field_71441_e, blockpos); - -- if (item == null) +- if (object == null) - { - return; - } - -- flag1 = item.func_77614_k(); -- Block block1 = item instanceof ItemBlock && !block.func_149648_K() ? Block.func_149634_a(item) : block; -- i = block1.func_149643_k(this.field_71441_e, j, k, l); +- if (flag && GuiScreen.func_146271_m()) +- { +- tileentity = this.field_71441_e.func_175625_s(blockpos); +- } +- +- Block block1 = object instanceof ItemBlock && !block.func_149648_K() ? Block.func_149634_a((Item)object) : block; +- i = block1.func_176222_j(this.field_71441_e, blockpos); +- flag1 = ((Item)object).func_77614_k(); - } - else - { @@ -171,11 +158,11 @@ - - if (this.field_71476_x.field_72308_g instanceof EntityPainting) - { -- item = Items.field_151159_an; +- object = Items.field_151159_an; - } - else if (this.field_71476_x.field_72308_g instanceof EntityLeashKnot) - { -- item = Items.field_151058_ca; +- object = Items.field_151058_ca; - } - else if (this.field_71476_x.field_72308_g instanceof EntityItemFrame) - { @@ -184,11 +171,11 @@ - - if (itemstack == null) - { -- item = Items.field_151160_bD; +- object = Items.field_151160_bD; - } - else - { -- item = itemstack.func_77973_b(); +- object = itemstack.func_77973_b(); - i = itemstack.func_77960_j(); - flag1 = true; - } @@ -197,56 +184,74 @@ - { - EntityMinecart entityminecart = (EntityMinecart)this.field_71476_x.field_72308_g; - -- if (entityminecart.func_94087_l() == 2) +- switch (Minecraft.SwitchEnumMinecartType.field_178901_b[entityminecart.func_180456_s().ordinal()]) - { -- item = Items.field_151109_aJ; -- } -- else if (entityminecart.func_94087_l() == 1) -- { -- item = Items.field_151108_aI; -- } -- else if (entityminecart.func_94087_l() == 3) -- { -- item = Items.field_151142_bV; -- } -- else if (entityminecart.func_94087_l() == 5) -- { -- item = Items.field_151140_bW; -- } -- else if (entityminecart.func_94087_l() == 6) -- { -- item = Items.field_151095_cc; -- } -- else -- { -- item = Items.field_151143_au; +- case 1: +- object = Items.field_151109_aJ; +- break; +- case 2: +- object = Items.field_151108_aI; +- break; +- case 3: +- object = Items.field_151142_bV; +- break; +- case 4: +- object = Items.field_151140_bW; +- break; +- case 5: +- object = Items.field_151095_cc; +- break; +- default: +- object = Items.field_151143_au; - } - } - else if (this.field_71476_x.field_72308_g instanceof EntityBoat) - { -- item = Items.field_151124_az; +- object = Items.field_151124_az; +- } +- else if (this.field_71476_x.field_72308_g instanceof EntityArmorStand) +- { +- object = Items.field_179565_cj; - } - else - { -- item = Items.field_151063_bx; +- object = Items.field_151063_bx; - i = EntityList.func_75619_a(this.field_71476_x.field_72308_g); - flag1 = true; - -- if (i <= 0 || !EntityList.field_75627_a.containsKey(Integer.valueOf(i))) +- if (!EntityList.field_75627_a.containsKey(Integer.valueOf(i))) - { - return; - } - } - } - -- this.field_71439_g.field_71071_by.func_146030_a(item, i, flag1, flag); + InventoryPlayer inventoryplayer = this.field_71439_g.field_71071_by; + +- if (tileentity == null) +- { +- inventoryplayer.func_146030_a((Item)object, i, flag1, flag); +- } +- else +- { +- NBTTagCompound nbttagcompound1 = new NBTTagCompound(); +- tileentity.func_145841_b(nbttagcompound1); +- ItemStack itemstack1 = new ItemStack((Item)object, 1, i); +- itemstack1.func_77983_a("BlockEntityTag", nbttagcompound1); +- NBTTagCompound nbttagcompound = new NBTTagCompound(); +- NBTTagList nbttaglist = new NBTTagList(); +- nbttaglist.func_74742_a(new NBTTagString("(+NBT)")); +- nbttagcompound.func_74782_a("Lore", nbttaglist); +- itemstack1.func_77983_a("display", nbttagcompound); +- inventoryplayer.func_70299_a(inventoryplayer.field_70461_c, itemstack1); +- } - + if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.field_71476_x, this.field_71439_g, this.field_71441_e)) return; + // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions if (flag) { - j = this.field_71439_g.field_71069_bz.field_75151_b.size() - 9 + this.field_71439_g.field_71071_by.field_70461_c; -@@ -2659,8 +2582,15 @@ + int j = this.field_71439_g.field_71069_bz.field_75151_b.size() - 9 + inventoryplayer.field_70461_c; +@@ -2744,8 +2646,11 @@ p_70001_1_.func_152767_b("gl_max_texture_size", Integer.valueOf(func_71369_N())); } @@ -254,15 +259,11 @@ + private static int max_texture_size = -1; public static int func_71369_N() { -+ if (max_texture_size != -1) -+ { -+ return max_texture_size; -+ } -+ ++ if (max_texture_size != -1) return max_texture_size; for (int i = 16384; i > 0; i >>= 1) { GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); -@@ -2668,6 +2598,7 @@ +@@ -2753,6 +2658,7 @@ if (j != 0) { diff --git a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch index 6265a0c1c6..0aaeff1083 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -1,17 +1,17 @@ --- ../src-base/minecraft/net/minecraft/client/audio/SoundManager.java +++ ../src-work/minecraft/net/minecraft/client/audio/SoundManager.java -@@ -35,6 +35,10 @@ +@@ -36,6 +36,10 @@ import paulscode.sound.codecs.CodecJOrbis; import paulscode.sound.libraries.LibraryLWJGLOpenAL; -+import net.minecraftforge.client.*; ++import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.event.sound.*; +import net.minecraftforge.common.MinecraftForge; + @SideOnly(Side.CLIENT) public class SoundManager { -@@ -69,6 +73,7 @@ +@@ -70,6 +74,7 @@ { SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); @@ -19,7 +19,7 @@ } catch (SoundSystemException soundsystemexception) { -@@ -80,6 +85,7 @@ +@@ -81,6 +86,7 @@ { this.func_148613_b(); this.func_148608_i(); @@ -27,7 +27,7 @@ } private synchronized void func_148608_i() -@@ -302,6 +308,9 @@ +@@ -329,6 +335,9 @@ } else { @@ -37,7 +37,7 @@ SoundEventAccessorComposite soundeventaccessorcomposite = this.field_148622_c.func_147680_a(p_148611_1_.func_147650_b()); if (soundeventaccessorcomposite == null) -@@ -343,10 +352,12 @@ +@@ -370,10 +379,12 @@ if (soundpoolentry.func_148648_d()) { this.field_148620_e.newStreamingSource(false, s, func_148612_a(resourcelocation), resourcelocation.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f1); diff --git a/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch b/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch new file mode 100644 index 0000000000..fe59438649 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java ++++ ../src-work/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java +@@ -129,6 +129,6 @@ + f *= 1.0F - f1 * 0.15F; + } + +- return f; ++ return net.minecraftforge.client.ForgeHooksClient.getOffsetFOV(this, f); + } + } diff --git a/patches/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java.patch deleted file mode 100644 index ad795cf29d..0000000000 --- a/patches/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java -+++ ../src-work/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java -@@ -151,7 +151,8 @@ - } - } - -- public float func_70047_e() -+ @Override -+ public float getDefaultEyeHeight() - { - return 1.82F; - } diff --git a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch index 694d6082b6..f940dba5ac 100644 --- a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -1,85 +1,78 @@ --- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java +++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java -@@ -50,6 +50,9 @@ - import net.minecraft.util.ResourceLocation; - import net.minecraft.util.Session; +@@ -53,6 +53,9 @@ import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.PlaySoundAtEntityEvent; @SideOnly(Side.CLIENT) public class EntityPlayerSP extends AbstractClientPlayer -@@ -325,7 +328,7 @@ - f *= 1.0F - f1 * 0.15F; - } - -- return f; -+ return ForgeHooksClient.getOffsetFOV(this, f); +@@ -342,6 +345,15 @@ + this.field_71159_c.field_71456_v.func_146158_b().func_146227_a(p_146105_1_); } - public void func_71053_j() -@@ -479,20 +482,45 @@ - return this.field_70170_p.func_147439_a(p_71153_1_, p_71153_2_, p_71153_3_).func_149721_r(); - } - -+ private boolean isHeadspaceFree(int x, int y, int z, int height) ++ private boolean isHeadspaceFree(BlockPos pos, int height) + { -+ for (int i1 = 0; i1 < height; i1++) ++ for (int y = 0; y < height; y++) + { -+ if (func_71153_f(x, y + i1, z + 1)) return false; ++ if (func_175162_d(pos.func_177982_a(0, y, 0))) return false; + } + return true; + } + protected boolean func_145771_j(double p_145771_1_, double p_145771_3_, double p_145771_5_) { -+ if (this.field_70145_X) -+ { -+ return false; -+ } - int i = MathHelper.func_76128_c(p_145771_1_); - int j = MathHelper.func_76128_c(p_145771_3_); - int k = MathHelper.func_76128_c(p_145771_5_); - double d3 = p_145771_1_ - (double)i; - double d4 = p_145771_5_ - (double)k; + if (this.field_70145_X) +@@ -354,30 +366,34 @@ + double d3 = p_145771_1_ - (double)blockpos.func_177958_n(); + double d4 = p_145771_5_ - (double)blockpos.func_177952_p(); -- if (this.func_71153_f(i, j, k) || this.func_71153_f(i, j + 1, k)) -+ int entHeight = Math.max(Math.round(this.field_70131_O), 1); +- if (!this.func_175162_d(blockpos)) ++ int entHeight = Math.max(Math.round(this.field_70131_O), 1); + -+ boolean inTranslucentBlock = true; ++ boolean inTranslucentBlock = this.isHeadspaceFree(blockpos, entHeight); + -+ for (int i1 = 0; i1 < entHeight; i1++) - { -- boolean flag = !this.func_71153_f(i - 1, j, k) && !this.func_71153_f(i - 1, j + 1, k); -- boolean flag1 = !this.func_71153_f(i + 1, j, k) && !this.func_71153_f(i + 1, j + 1, k); -- boolean flag2 = !this.func_71153_f(i, j, k - 1) && !this.func_71153_f(i, j + 1, k - 1); -- boolean flag3 = !this.func_71153_f(i, j, k + 1) && !this.func_71153_f(i, j + 1, k + 1); -+ if (!this.func_71153_f(i, j + i1, k)) -+ { -+ inTranslucentBlock = false; -+ } -+ } -+ -+ if (inTranslucentBlock) -+ { -+ boolean flag = !isHeadspaceFree(i - 1, j, k, entHeight); -+ boolean flag1 = !isHeadspaceFree(i + 1, j, k, entHeight); -+ boolean flag2 = !isHeadspaceFree(i, j, k - 1, entHeight); -+ boolean flag3 = !isHeadspaceFree(i, j, k + 1, entHeight); - byte b0 = -1; - double d5 = 9999.0D; ++ if (inTranslucentBlock) + { + byte b0 = -1; + double d5 = 9999.0D; -@@ -576,6 +604,12 @@ +- if (this.func_175162_d(blockpos.func_177976_e()) && d3 < d5) ++ if (!this.isHeadspaceFree(blockpos.func_177976_e(), entHeight) && d3 < d5) + { + d5 = d3; + b0 = 0; + } + +- if (this.func_175162_d(blockpos.func_177974_f()) && 1.0D - d3 < d5) ++ if (!this.isHeadspaceFree(blockpos.func_177974_f(), entHeight) && 1.0D - d3 < d5) + { + d5 = 1.0D - d3; + b0 = 1; + } + +- if (this.func_175162_d(blockpos.func_177978_c()) && d4 < d5) ++ if (!this.isHeadspaceFree(blockpos.func_177978_c(), entHeight) && d4 < d5) + { + d5 = d4; + b0 = 4; + } + +- if (this.func_175162_d(blockpos.func_177968_d()) && 1.0D - d4 < d5) ++ if (!this.isHeadspaceFree(blockpos.func_177968_d(), entHeight) && 1.0D - d4 < d5) + { + d5 = 1.0D - d4; + b0 = 5; +@@ -445,6 +461,9 @@ public void func_85030_a(String p_85030_1_, float p_85030_2_, float p_85030_3_) { + PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(this, p_85030_1_, p_85030_2_, p_85030_3_); -+ if (MinecraftForge.EVENT_BUS.post(event)) -+ { -+ return; -+ } ++ if (MinecraftForge.EVENT_BUS.post(event)) return; + p_85030_1_ = event.name; - this.field_70170_p.func_72980_b(this.field_70165_t, this.field_70163_u - (double)this.field_70129_M, this.field_70161_v, p_85030_1_, p_85030_2_, p_85030_3_, false); + this.field_70170_p.func_72980_b(this.field_70165_t, this.field_70163_u, this.field_70161_v, p_85030_1_, p_85030_2_, p_85030_3_, false); } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch index f21e7fa51d..e6f87a3746 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch @@ -1,19 +1,11 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java -@@ -138,6 +138,7 @@ - public void func_146403_a(String p_146403_1_) - { - this.field_146297_k.field_71456_v.func_146158_b().func_146239_a(p_146403_1_); -+ if (net.minecraftforge.client.ClientCommandHandler.instance.func_71556_a(field_146297_k.field_71439_g, p_146403_1_) != 0) return; - this.field_146297_k.field_71439_g.func_71165_d(p_146403_1_); - } - -@@ -330,13 +331,14 @@ +@@ -217,13 +217,14 @@ this.field_146297_k.field_71456_v.func_146158_b().func_146234_a(new ChatComponentText(stringbuilder.toString()), 1); } - this.field_146415_a.func_146191_b((String)this.field_146412_t.get(this.field_146413_s++)); -+ this.field_146415_a.func_146191_b(EnumChatFormatting.func_110646_a((String)this.field_146412_t.get(this.field_146413_s++))); ++ this.field_146415_a.func_146191_b(net.minecraft.util.EnumChatFormatting.func_110646_a((String)this.field_146412_t.get(this.field_146413_s++))); } private void func_146405_a(String p_146405_1_, String p_146405_2_) @@ -21,10 +13,10 @@ if (p_146405_1_.length() >= 1) { + net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_146405_1_, p_146405_2_); - this.field_146297_k.field_71439_g.field_71174_a.func_147297_a(new C14PacketTabComplete(p_146405_1_)); - this.field_146414_r = true; - } -@@ -458,6 +460,13 @@ + BlockPos blockpos = null; + + if (this.field_146297_k.field_71476_x != null && this.field_146297_k.field_71476_x.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK) +@@ -285,6 +286,13 @@ String[] astring1 = p_146406_1_; int i = p_146406_1_.length; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch index 717664a40a..714b28a032 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch @@ -1,20 +1,27 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -@@ -320,7 +320,7 @@ +@@ -322,14 +322,7 @@ } else if (p_146284_1_.field_146127_k == 8) { -- this.field_146297_k.func_147108_a(new GuiCreateFlatWorld(this, this.field_146334_a)); -+ WorldType.field_77139_a[field_146331_K].onCustomizeButton(field_146297_k, this); +- if (WorldType.field_77139_a[this.field_146331_K] == WorldType.field_77138_c) +- { +- this.field_146297_k.func_147108_a(new GuiCreateFlatWorld(this, this.field_146334_a)); +- } +- else +- { +- this.field_146297_k.func_147108_a(new GuiCustomizeWorldScreen(this, this.field_146334_a)); +- } ++ WorldType.field_77139_a[this.field_146331_K].onCustomizeButton(field_146297_k, this); } } } -@@ -338,7 +338,7 @@ - this.field_146326_C.field_146125_m = this.field_146344_y; - this.field_146320_D.field_146125_m = this.field_146344_y; - this.field_146321_E.field_146125_m = this.field_146344_y; -- this.field_146322_F.field_146125_m = this.field_146344_y && WorldType.field_77139_a[this.field_146331_K] == WorldType.field_77138_c; -+ this.field_146322_F.field_146125_m = this.field_146344_y && WorldType.field_77139_a[this.field_146331_K].isCustomizable(); +@@ -381,7 +374,7 @@ + this.field_146326_C.field_146125_m = this.field_146344_y; + this.field_146320_D.field_146125_m = this.field_146344_y; + this.field_146321_E.field_146125_m = this.field_146344_y; +- this.field_146322_F.field_146125_m = this.field_146344_y && (WorldType.field_77139_a[this.field_146331_K] == WorldType.field_77138_c || WorldType.field_77139_a[this.field_146331_K] == WorldType.field_180271_f); ++ this.field_146322_F.field_146125_m = this.field_146344_y && WorldType.field_77139_a[this.field_146331_K].isCustomizable(); + } - if (this.field_146344_y) - { + this.func_146319_h(); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch index 43aaffc4f4..bb5fee56ef 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch @@ -1,18 +1,10 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java -@@ -25,6 +25,7 @@ - import net.minecraft.world.demo.DemoWorldServer; - import net.minecraft.world.storage.ISaveFormat; - import net.minecraft.world.storage.WorldInfo; -+import net.minecraftforge.client.ForgeHooksClient; - import org.apache.commons.io.Charsets; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -507,6 +508,7 @@ +@@ -511,6 +511,7 @@ this.func_73731_b(this.field_146289_q, brd, 2, this.field_146295_m - ( 10 + i * (this.field_146289_q.field_78288_b + 1)), 16777215); } } -+ ForgeHooksClient.renderMainMenu(this, field_146289_q, field_146294_l, field_146295_m); ++ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.field_146289_q, this.field_146294_l, this.field_146295_m); String s1 = "Copyright Mojang AB. Do not distribute!"; this.func_73731_b(this.field_146289_q, s1, this.field_146294_l - this.field_146289_q.func_78256_a(s1) - 2, this.field_146295_m - 10, -1); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiNewChat.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiNewChat.java.patch deleted file mode 100644 index 25cd758daf..0000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiNewChat.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiNewChat.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiNewChat.java -@@ -99,6 +99,7 @@ - byte b0 = 0; - int j2 = -j1 * 9; - func_73734_a(b0, j2 - 9, b0 + i1 + 4, j2, i2 / 2 << 24); -+ GL11.glEnable(GL11.GL_BLEND); // FORGE: BugFix MC-36812 Chat Opacity Broken in 1.7.x - String s = chatline.func_151461_a().func_150254_d(); - this.field_146247_f.field_71466_p.func_78261_a(s, b0, j2 - 8, 16777215 + (i2 << 24)); - GL11.glDisable(GL11.GL_ALPHA_TEST); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch index 986a5b8f10..28ebe9f9db 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch @@ -1,27 +1,26 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java -@@ -17,6 +17,10 @@ - import net.minecraft.client.renderer.entity.RenderItem; - import net.minecraft.item.ItemStack; +@@ -37,6 +37,9 @@ + import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.EnumChatFormatting; + import net.minecraft.util.IChatComponent; +import net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent; +import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; +import net.minecraftforge.common.MinecraftForge; -+ - import org.lwjgl.input.Keyboard; - import org.lwjgl.input.Mouse; - import org.lwjgl.opengl.GL11; -@@ -111,7 +115,8 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.StringUtils; +@@ -146,7 +149,8 @@ } } - this.func_146283_a(list, p_146285_2_, p_146285_3_); + FontRenderer font = p_146285_1_.func_77973_b().getFontRenderer(p_146285_1_); -+ drawHoveringText(list, p_146285_2_, p_146285_3_, (font == null ? field_146289_q : font)); ++ this.drawHoveringText(list, p_146285_2_, p_146285_3_, (font == null ? field_146289_q : font)); } protected void func_146279_a(String p_146279_1_, int p_146279_2_, int p_146279_3_) -@@ -121,6 +126,11 @@ +@@ -156,6 +160,11 @@ protected void func_146283_a(List p_146283_1_, int p_146283_2_, int p_146283_3_) { @@ -32,8 +31,8 @@ + { if (!p_146283_1_.isEmpty()) { - GL11.glDisable(GL12.GL_RESCALE_NORMAL); -@@ -133,7 +143,7 @@ + GlStateManager.func_179101_C(); +@@ -168,7 +177,7 @@ while (iterator.hasNext()) { String s = (String)iterator.next(); @@ -42,16 +41,24 @@ if (l > k) { -@@ -178,7 +188,7 @@ +@@ -213,7 +222,7 @@ for (int i2 = 0; i2 < p_146283_1_.size(); ++i2) { String s1 = (String)p_146283_1_.get(i2); -- this.field_146289_q.func_78261_a(s1, j2, k2, -1); -+ font.func_78261_a(s1, j2, k2, -1); +- this.field_146289_q.func_175063_a(s1, (float)j2, (float)k2, -1); ++ font.func_175063_a(s1, j2, k2, -1); if (i2 == 0) { -@@ -207,9 +217,14 @@ +@@ -441,6 +450,7 @@ + this.field_146297_k.field_71456_v.func_146158_b().func_146239_a(p_175281_1_); + } + ++ if (net.minecraftforge.client.ClientCommandHandler.instance.func_71556_a(field_146297_k.field_71439_g, p_175281_1_) != 0) return; + this.field_146297_k.field_71439_g.func_71165_d(p_175281_1_); + } + +@@ -454,9 +464,14 @@ if (guibutton.func_146116_c(this.field_146297_k, p_73864_1_, p_73864_2_)) { @@ -69,7 +76,7 @@ } } } -@@ -234,8 +249,12 @@ +@@ -482,8 +497,12 @@ this.field_146289_q = p_146280_1_.field_71466_p; this.field_146294_l = p_146280_2_; this.field_146295_m = p_146280_3_; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch index cdfaaa2e99..3850da1c0a 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -1,39 +1,40 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java -@@ -294,16 +294,7 @@ - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_FOG); - Tessellator tessellator = Tessellator.field_78398_a; -- this.field_148161_k.func_110434_K().func_110577_a(Gui.field_110325_k); -- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); -- float f1 = 32.0F; -- tessellator.func_78382_b(); -- tessellator.func_78378_d(2105376); -- tessellator.func_78374_a((double)this.field_148152_e, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); -- tessellator.func_78374_a((double)this.field_148151_d, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); -- tessellator.func_78374_a((double)this.field_148151_d, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); -- tessellator.func_78374_a((double)this.field_148152_e, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); -- tessellator.func_78381_a(); -+ drawContainerBackground(tessellator); - l1 = this.field_148152_e + this.field_148155_a / 2 - this.func_148139_c() / 2 + 2; - i2 = this.field_148153_b + 4 - (int)this.field_148169_q; +@@ -185,16 +185,7 @@ + GlStateManager.func_179106_n(); + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); +- this.field_148161_k.func_110434_K().func_110577_a(Gui.field_110325_k); +- GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); +- float f1 = 32.0F; +- worldrenderer.func_178970_b(); +- worldrenderer.func_178991_c(2105376); +- worldrenderer.func_178985_a((double)this.field_148152_e, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); +- worldrenderer.func_178985_a((double)this.field_148151_d, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); +- worldrenderer.func_178985_a((double)this.field_148151_d, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); +- worldrenderer.func_178985_a((double)this.field_148152_e, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); +- tessellator.func_78381_a(); ++ this.drawContainerBackground(tessellator); + int i1 = this.field_148152_e + this.field_148155_a / 2 - this.func_148139_c() / 2 + 2; + int j1 = this.field_148153_b + 4 - (int)this.field_148169_q; -@@ -475,4 +466,18 @@ +@@ -456,4 +447,19 @@ { return this.field_148149_f; } + + protected void drawContainerBackground(Tessellator tessellator) + { ++ WorldRenderer worldrenderer = tessellator.func_178180_c(); + this.field_148161_k.func_110434_K().func_110577_a(Gui.field_110325_k); -+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); ++ GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + float f1 = 32.0F; -+ tessellator.func_78382_b(); -+ tessellator.func_78378_d(2105376); -+ tessellator.func_78374_a((double)this.field_148152_e, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); -+ tessellator.func_78374_a((double)this.field_148151_d, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); -+ tessellator.func_78374_a((double)this.field_148151_d, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); -+ tessellator.func_78374_a((double)this.field_148152_e, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); ++ worldrenderer.func_178970_b(); ++ worldrenderer.func_178991_c(2105376); ++ worldrenderer.func_178985_a((double)this.field_148152_e, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); ++ worldrenderer.func_178985_a((double)this.field_148151_d, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); ++ worldrenderer.func_178985_a((double)this.field_148151_d, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); ++ worldrenderer.func_178985_a((double)this.field_148152_e, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); + tessellator.func_78381_a(); + } } diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch index 7fc8d0e2f5..28b9eefabc 100644 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch @@ -1,9 +1,9 @@ --- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java +++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java @@ -24,6 +24,9 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.input.Mouse; - import org.lwjgl.opengl.GL11; - import org.lwjgl.opengl.GL12; +import java.util.LinkedList; +import java.util.List; +import net.minecraftforge.common.AchievementPage; @@ -43,7 +43,7 @@ + this.field_146292_n.add(button = new GuiButton(2, (field_146294_l - field_146555_f) / 2 + 24, field_146295_m / 2 + 74, 125, 20, AchievementPage.getTitle(currentPage))); } - protected void func_146284_a(GuiButton p_146284_1_) + protected void func_146284_a(GuiButton p_146284_1_) throws IOException @@ -75,6 +91,16 @@ { this.field_146297_k.func_147108_a(this.field_146562_a); @@ -56,13 +56,13 @@ + { + currentPage = -1; + } -+ button.field_146126_j = AchievementPage.getTitle(currentPage); ++ this.button.field_146126_j = AchievementPage.getTitle(currentPage); + } } } -@@ -339,11 +365,12 @@ - int j4; +@@ -341,11 +367,12 @@ + int i4; int l4; - for (i3 = 0; i3 < AchievementList.field_76007_e.size(); ++i3) @@ -77,40 +77,40 @@ { j3 = achievement1.field_75993_a * 24 - k + 11; k3 = achievement1.field_75991_b * 24 - l + 11; -@@ -400,9 +427,9 @@ +@@ -401,9 +428,9 @@ int i5; int j5; -- for (l4 = 0; l4 < AchievementList.field_76007_e.size(); ++l4) -+ for (l4 = 0; l4 < achievementList.size(); ++l4) +- for (k3 = 0; k3 < AchievementList.field_76007_e.size(); ++k3) ++ for (k3 = 0; k3 < achievementList.size(); ++k3) { -- Achievement achievement2 = (Achievement)AchievementList.field_76007_e.get(l4); -+ Achievement achievement2 = (Achievement)achievementList.get(l4); - i5 = achievement2.field_75993_a * 24 - k; - j5 = achievement2.field_75991_b * 24 - l; +- Achievement achievement2 = (Achievement)AchievementList.field_76007_e.get(k3); ++ Achievement achievement2 = (Achievement)achievementList.get(k3); + l4 = achievement2.field_75993_a * 24 - k; + i5 = achievement2.field_75991_b * 24 - l; -@@ -444,6 +471,7 @@ +@@ -445,6 +472,7 @@ this.field_146297_k.func_110434_K().func_110577_a(field_146561_C); -+ GL11.glEnable(GL11.GL_BLEND);// Forge: Specifically enable blend because it is needed here. And we fix Generic RenderItem's leakage of it. ++ GlStateManager.func_179147_l(); // Forge: Specifically enable blend because it is needed here. And we fix Generic RenderItem's leakage of it. if (achievement2.func_75984_f()) { - this.func_73729_b(i5 - 2, j5 - 2, 26, 202, 26, 26); -@@ -452,6 +480,7 @@ + this.func_73729_b(l4 - 2, i5 - 2, 26, 202, 26, 26); +@@ -453,6 +481,7 @@ { - this.func_73729_b(i5 - 2, j5 - 2, 0, 202, 26, 26); + this.func_73729_b(l4 - 2, i5 - 2, 0, 202, 26, 26); } -+ GL11.glDisable(GL11.GL_BLEND); //Forge: Cleanup states we set. ++ GlStateManager.func_179084_k(); //Forge: Cleanup states we set. if (!this.field_146556_E.func_77442_b(achievement2)) { -@@ -460,7 +489,7 @@ - renderitem.field_77024_a = false; +@@ -461,7 +490,7 @@ + this.field_146296_j.func_175039_a(false); } -- GL11.glEnable(GL11.GL_LIGHTING); -+ GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure Lighting is disabled. Fixes MC-33065 - GL11.glEnable(GL11.GL_CULL_FACE); - renderitem.func_82406_b(this.field_146297_k.field_71466_p, this.field_146297_k.func_110434_K(), achievement2.field_75990_d, i5 + 3, j5 + 3); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); +- GlStateManager.func_179145_e(); ++ GlStateManager.func_179140_f(); //Forge: Make sure Lighting is disabled. Fixes MC-33065 + GlStateManager.func_179089_o(); + this.field_146296_j.func_180450_b(achievement2.field_75990_d, l4 + 3, i5 + 3); + GlStateManager.func_179112_b(770, 771); diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch index 955cd8412d..b795376e9c 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch @@ -1,51 +1,44 @@ --- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java +++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java -@@ -6,6 +6,7 @@ +@@ -5,6 +5,7 @@ import java.util.Iterator; import java.util.Set; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; + import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; - import net.minecraft.client.renderer.RenderHelper; -@@ -112,7 +113,11 @@ - } - } - -+ //Forge: Force lighting to be disabled as there are some issue where lighting would -+ //incorrectly be applied based on items that are in the inventory. -+ GL11.glDisable(GL11.GL_LIGHTING); - this.func_146979_b(p_73863_1_, p_73863_2_); -+ GL11.glEnable(GL11.GL_LIGHTING); - InventoryPlayer inventoryplayer = this.field_146297_k.field_71439_g.field_71071_by; - ItemStack itemstack = this.field_147012_x == null ? inventoryplayer.func_70445_o() : this.field_147012_x; - -@@ -176,8 +181,11 @@ - GL11.glTranslatef(0.0F, 0.0F, 32.0F); +@@ -178,8 +179,11 @@ + GlStateManager.func_179109_b(0.0F, 0.0F, 32.0F); this.field_73735_i = 200.0F; - field_146296_j.field_77023_b = 200.0F; -- field_146296_j.func_82406_b(this.field_146289_q, this.field_146297_k.func_110434_K(), p_146982_1_, p_146982_2_, p_146982_3_); -- field_146296_j.func_94148_a(this.field_146289_q, this.field_146297_k.func_110434_K(), p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x == null ? 0 : 8), p_146982_4_); + this.field_146296_j.field_77023_b = 200.0F; + FontRenderer font = null; + if (p_146982_1_ != null) font = p_146982_1_.func_77973_b().getFontRenderer(p_146982_1_); + if (font == null) font = field_146289_q; -+ field_146296_j.func_82406_b(font, this.field_146297_k.func_110434_K(), p_146982_1_, p_146982_2_, p_146982_3_); -+ field_146296_j.func_94148_a(font, this.field_146297_k.func_110434_K(), p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x == null ? 0 : 8), p_146982_4_); + this.field_146296_j.func_180450_b(p_146982_1_, p_146982_2_, p_146982_3_); +- this.field_146296_j.func_180453_a(this.field_146289_q, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x == null ? 0 : 8), p_146982_4_); ++ this.field_146296_j.func_180453_a(font, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x == null ? 0 : 8), p_146982_4_); this.field_73735_i = 0.0F; - field_146296_j.field_77023_b = 0.0F; + this.field_146296_j.field_77023_b = 0.0F; } -@@ -243,8 +251,10 @@ - if (iicon != null) +@@ -240,13 +244,12 @@ + + if (itemstack == null) + { +- String s1 = p_146977_1_.func_178171_c(); ++ TextureAtlasSprite textureatlassprite = p_146977_1_.getBackgroundSprite(); + +- if (s1 != null) ++ if (textureatlassprite != null) { - GL11.glDisable(GL11.GL_LIGHTING); -+ GL11.glEnable(GL11.GL_BLEND); // Forge: Blending needs to be enabled for this. - this.field_146297_k.func_110434_K().func_110577_a(TextureMap.field_110576_c); - this.func_94065_a(i, j, iicon, 16, 16); -+ GL11.glDisable(GL11.GL_BLEND); // Forge: And clean that up - GL11.glEnable(GL11.GL_LIGHTING); +- TextureAtlasSprite textureatlassprite = this.field_146297_k.func_147117_R().func_110572_b(s1); + GlStateManager.func_179140_f(); +- this.field_146297_k.func_110434_K().func_110577_a(TextureMap.field_110575_b); ++ this.field_146297_k.func_110434_K().func_110577_a(p_146977_1_.getBackgroundLocation()); + this.func_175175_a(i, j, textureatlassprite, 16, 16); + GlStateManager.func_179145_e(); flag1 = true; - } -@@ -458,6 +468,7 @@ +@@ -465,6 +468,7 @@ protected void func_146286_b(int p_146286_1_, int p_146286_2_, int p_146286_3_) { diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch index 6cd5a29429..b91737a77d 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -9,7 +9,7 @@ public GuiContainerCreative(EntityPlayer p_i1088_1_) { -@@ -185,7 +187,7 @@ +@@ -187,7 +189,7 @@ return; } @@ -18,30 +18,30 @@ { if (p_146984_3_ == 0) { -@@ -260,6 +262,13 @@ +@@ -262,6 +264,13 @@ this.func_147050_b(CreativeTabs.field_78032_a[i]); this.field_147059_E = new CreativeCrafting(this.field_146297_k); this.field_146297_k.field_71439_g.field_71069_bz.func_75132_a(this.field_147059_E); + int tabCount = CreativeTabs.field_78032_a.length; + if (tabCount > 12) + { -+ field_146292_n.add(new GuiButton(101, field_147003_i, field_147009_r - 50, 20, 20, "<")); ++ field_146292_n.add(new GuiButton(101, field_147003_i, field_147009_r - 50, 20, 20, "<")); + field_146292_n.add(new GuiButton(102, field_147003_i + field_146999_f - 20, field_147009_r - 50, 20, 20, ">")); + maxPages = ((tabCount - 12) / 10) + 1; + } } else { -@@ -281,7 +290,7 @@ +@@ -283,7 +292,7 @@ - protected void func_73869_a(char p_73869_1_, int p_73869_2_) + protected void func_73869_a(char p_73869_1_, int p_73869_2_) throws IOException { - if (field_147058_w != CreativeTabs.field_78027_g.func_78021_a()) + if (!CreativeTabs.field_78032_a[field_147058_w].hasSearchBar()) { if (GameSettings.func_100015_a(this.field_146297_k.field_71474_y.field_74310_D)) { -@@ -318,6 +327,15 @@ +@@ -320,6 +329,15 @@ { GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h; containercreative.field_148330_a.clear(); @@ -57,7 +57,7 @@ Iterator iterator = Item.field_150901_e.iterator(); while (iterator.hasNext()) -@@ -329,10 +347,17 @@ +@@ -331,10 +349,17 @@ item.func_150895_a(item, (CreativeTabs)null, containercreative.field_148330_a); } } @@ -75,25 +75,16 @@ for (int i = 0; i < j; ++i) { Enchantment enchantment = aenchantment[i]; -@@ -383,7 +408,7 @@ +@@ -385,7 +410,7 @@ { CreativeTabs creativetabs = CreativeTabs.field_78032_a[field_147058_w]; - if (creativetabs.func_78019_g()) + if (creativetabs != null && creativetabs.func_78019_g()) { - GL11.glDisable(GL11.GL_BLEND); + GlStateManager.func_179084_k(); this.field_146289_q.func_78276_b(I18n.func_135052_a(creativetabs.func_78024_c(), new Object[0]), 8, 6, 4210752); -@@ -403,7 +428,7 @@ - { - CreativeTabs creativetabs = acreativetabs[k1]; - -- if (this.func_147049_a(creativetabs, l, i1)) -+ if (creativetabs != null && this.func_147049_a(creativetabs, l, i1)) - { - return; - } -@@ -426,7 +451,7 @@ +@@ -428,7 +453,7 @@ { CreativeTabs creativetabs = acreativetabs[k1]; @@ -102,7 +93,7 @@ { this.func_147050_b(creativetabs); return; -@@ -439,11 +464,13 @@ +@@ -441,11 +466,13 @@ private boolean func_147055_p() { @@ -116,7 +107,7 @@ int i = field_147058_w; field_147058_w = p_147050_1_.func_78021_a(); GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h; -@@ -512,12 +539,14 @@ +@@ -514,12 +541,14 @@ if (this.field_147062_A != null) { @@ -132,7 +123,7 @@ this.func_147053_i(); } else -@@ -608,23 +637,45 @@ +@@ -590,23 +619,45 @@ super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_); CreativeTabs[] acreativetabs = CreativeTabs.field_78032_a; @@ -169,7 +160,7 @@ + { + String page = String.format("%d / %d", tabPage + 1, maxPages + 1); + int width = field_146289_q.func_78256_a(page); -+ GL11.glDisable(GL11.GL_LIGHTING); ++ GlStateManager.func_179140_f(); + this.field_73735_i = 300.0F; + field_146296_j.field_77023_b = 300.0F; + field_146289_q.func_78276_b(page, field_147003_i + (field_146999_f / 2) - (width / 2), field_147009_r - 44, -1); @@ -177,10 +168,10 @@ + field_146296_j.field_77023_b = 0.0F; + } + - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glDisable(GL11.GL_LIGHTING); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.func_179140_f(); } -@@ -693,17 +744,37 @@ +@@ -675,17 +726,36 @@ int k = acreativetabs.length; int l; @@ -195,7 +186,6 @@ this.field_146297_k.func_110434_K().func_110577_a(field_147061_u); + if (creativetabs1 == null) continue; -+ if (creativetabs1.func_78021_a() != field_147058_w) { this.func_147051_a(creativetabs1); @@ -219,7 +209,7 @@ this.field_146297_k.func_110434_K().func_110577_a(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.func_78015_f())); this.func_73729_b(this.field_147003_i, this.field_147009_r, 0, 0, this.field_146999_f, this.field_147000_g); this.field_147062_A.func_146194_f(); -@@ -718,6 +789,14 @@ +@@ -700,6 +770,14 @@ this.func_73729_b(i1, k + (int)((float)(l - k - 17) * this.field_147067_x), 232 + (this.func_147055_p() ? 0 : 12), 0, 12, 15); } @@ -234,7 +224,7 @@ this.func_147051_a(creativetabs); if (creativetabs == CreativeTabs.field_78036_m) -@@ -728,6 +807,15 @@ +@@ -710,6 +788,15 @@ protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) { @@ -250,16 +240,16 @@ int k = p_147049_1_.func_78020_k(); int l = 28 * k; byte b0 = 0; -@@ -828,6 +916,8 @@ +@@ -810,6 +897,8 @@ } - GL11.glDisable(GL11.GL_LIGHTING); -+ GL11.glColor3f(1F, 1F, 1F); //Forge: Reset color in case Items change it. -+ GL11.glEnable(GL11.GL_BLEND); //Forge: Make sure blend is enabled else tabs show a white border. + GlStateManager.func_179140_f(); ++ GlStateManager.func_179124_c(1F, 1F, 1F); //Forge: Reset color in case Items change it. ++ GlStateManager.func_179147_l(); //Forge: Make sure blend is enabled else tabs show a white border. this.func_73729_b(l, i1, j, k, 28, b0); this.field_73735_i = 100.0F; - field_146296_j.field_77023_b = 100.0F; -@@ -854,6 +944,15 @@ + this.field_146296_j.field_77023_b = 100.0F; +@@ -836,6 +925,15 @@ { this.field_146297_k.func_147108_a(new GuiStats(this, this.field_146297_k.field_71439_g.func_146107_m())); } diff --git a/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch b/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch index 3a4d6c6068..04667710a5 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch +++ b/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/client/model/ModelBase.java +++ ../src-work/minecraft/net/minecraft/client/model/ModelBase.java @@ -10,7 +10,6 @@ - import net.minecraft.entity.Entity; - import net.minecraft.entity.EntityLivingBase; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; -@SideOnly(Side.CLIENT) public abstract class ModelBase diff --git a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch index 436e2120f5..36bd887e5d 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch +++ b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch @@ -1,18 +1,18 @@ --- ../src-base/minecraft/net/minecraft/client/model/ModelBox.java +++ ../src-work/minecraft/net/minecraft/client/model/ModelBox.java @@ -4,7 +4,6 @@ - import cpw.mods.fml.relauncher.SideOnly; - import net.minecraft.client.renderer.Tessellator; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; -@SideOnly(Side.CLIENT) public class ModelBox { private PositionTextureVertex[] field_78253_h; -@@ -77,6 +76,7 @@ +@@ -82,6 +81,7 @@ } } + @SideOnly(Side.CLIENT) - public void func_78245_a(Tessellator p_78245_1_, float p_78245_2_) + public void func_178780_a(WorldRenderer p_178780_1_, float p_178780_2_) { for (int i = 0; i < this.field_78254_i.length; ++i) diff --git a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch index 86bde1f925..daaf765f9c 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/model/ModelRenderer.java +++ ../src-work/minecraft/net/minecraft/client/model/ModelRenderer.java -@@ -8,7 +8,6 @@ - import net.minecraft.client.renderer.Tessellator; +@@ -10,7 +10,6 @@ + import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; -@SideOnly(Side.CLIENT) public class ModelRenderer { public float field_78801_a; -@@ -102,6 +101,7 @@ +@@ -110,6 +109,7 @@ this.field_78798_e = p_78793_3_; } @@ -16,7 +16,7 @@ public void func_78785_a(float p_78785_1_) { if (!this.field_78807_k) -@@ -184,6 +184,7 @@ +@@ -192,6 +192,7 @@ } } @@ -24,7 +24,7 @@ public void func_78791_b(float p_78791_1_) { if (!this.field_78807_k) -@@ -219,6 +220,7 @@ +@@ -227,6 +228,7 @@ } } @@ -32,7 +32,7 @@ public void func_78794_c(float p_78794_1_) { if (!this.field_78807_k) -@@ -260,6 +262,7 @@ +@@ -268,6 +270,7 @@ } } diff --git a/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch b/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch index 8d92e8afdd..dbe66e3035 100644 --- a/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch +++ b/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch @@ -3,9 +3,9 @@ @@ -1,10 +1,7 @@ package net.minecraft.client.model; --import cpw.mods.fml.relauncher.Side; --import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.util.Vec3; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; -@SideOnly(Side.CLIENT) public class PositionTextureVertex diff --git a/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch b/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch index c318d7ea06..25d7668771 100644 --- a/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch +++ b/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch @@ -1,12 +1,11 @@ --- ../src-base/minecraft/net/minecraft/client/model/TexturedQuad.java +++ ../src-work/minecraft/net/minecraft/client/model/TexturedQuad.java -@@ -1,11 +1,8 @@ - package net.minecraft.client.model; - --import cpw.mods.fml.relauncher.Side; --import cpw.mods.fml.relauncher.SideOnly; +@@ -3,10 +3,7 @@ import net.minecraft.client.renderer.Tessellator; + import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.util.Vec3; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; -@SideOnly(Side.CLIENT) public class TexturedQuad diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch index d575e9cce9..0b34576b06 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch @@ -5,6 +5,6 @@ this.field_73236_b.func_76163_a(ChunkCoordIntPair.func_77272_a(p_73158_1_, p_73158_2_), chunk); this.field_73237_c.add(chunk); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); - chunk.field_76636_d = true; + chunk.func_177417_c(true); return chunk; } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index aeca0eff95..d57d6ad632 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -1,85 +1,69 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -@@ -28,6 +28,10 @@ - import net.minecraft.world.World; - import net.minecraft.world.WorldSettings; +@@ -113,6 +113,12 @@ + } + } -+import net.minecraftforge.common.ForgeHooks; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; -+ - @SideOnly(Side.CLIENT) - public class PlayerControllerMP - { -@@ -88,6 +92,12 @@ - - public boolean func_78751_a(int p_78751_1_, int p_78751_2_, int p_78751_3_, int p_78751_4_) - { + ItemStack stack = field_78776_a.field_71439_g.func_71045_bC(); -+ if (stack != null && stack.func_77973_b() != null && stack.func_77973_b().onBlockStartBreak(stack, p_78751_1_, p_78751_2_, p_78751_3_, field_78776_a.field_71439_g)) ++ if (stack != null && stack.func_77973_b() != null && stack.func_77973_b().onBlockStartBreak(stack, p_178888_1_, field_78776_a.field_71439_g)) + { + return false; + } + - if (this.field_78779_k.func_82752_c() && !this.field_78776_a.field_71439_g.func_82246_f(p_78751_1_, p_78751_2_, p_78751_3_)) + if (this.field_78779_k.func_77145_d() && this.field_78776_a.field_71439_g.func_70694_bm() != null && this.field_78776_a.field_71439_g.func_70694_bm().func_77973_b() instanceof ItemSword) { return false; -@@ -109,7 +119,7 @@ +@@ -130,7 +136,7 @@ + else { - worldclient.func_72926_e(2001, p_78751_1_, p_78751_2_, p_78751_3_, Block.func_149682_b(block) + (worldclient.func_72805_g(p_78751_1_, p_78751_2_, p_78751_3_) << 12)); - int i1 = worldclient.func_72805_g(p_78751_1_, p_78751_2_, p_78751_3_); -- boolean flag = worldclient.func_147468_f(p_78751_1_, p_78751_2_, p_78751_3_); -+ boolean flag = block.removedByPlayer(worldclient, field_78776_a.field_71439_g, p_78751_1_, p_78751_2_, p_78751_3_); + worldclient.func_175718_b(2001, p_178888_1_, Block.func_176210_f(iblockstate)); +- boolean flag = worldclient.func_175698_g(p_178888_1_); ++ boolean flag = block1.removedByPlayer(worldclient, p_178888_1_, field_78776_a.field_71439_g, false); if (flag) { -@@ -304,11 +314,18 @@ - float f2 = (float)p_78760_8_.field_72449_c - (float)p_78760_6_; - boolean flag = false; - -- if ((!p_78760_1_.func_70093_af() || p_78760_1_.func_70694_bm() == null) && p_78760_2_.func_147439_a(p_78760_4_, p_78760_5_, p_78760_6_).func_149727_a(p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_1_, p_78760_7_, f, f1, f2)) -+ if (p_78760_3_ != null && -+ p_78760_3_.func_77973_b() != null && -+ p_78760_3_.func_77973_b().onItemUseFirst(p_78760_3_, p_78760_1_, p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_7_, f, f1, f2)) +@@ -360,11 +366,19 @@ { -- flag = true; -+ return true; - } - -+ if (!p_78760_1_.func_70093_af() || p_78760_1_.func_70694_bm() == null || p_78760_1_.func_70694_bm().func_77973_b().doesSneakBypassUse(p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_1_)) -+ { -+ flag = p_78760_2_.func_147439_a(p_78760_4_, p_78760_5_, p_78760_6_).func_149727_a(p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_1_, p_78760_7_, f, f1, f2); -+ } -+ - if (!flag && p_78760_3_ != null && p_78760_3_.func_77973_b() instanceof ItemBlock) - { - ItemBlock itemblock = (ItemBlock)p_78760_3_.func_77973_b(); -@@ -340,7 +357,15 @@ - } - else - { -- return p_78760_3_.func_77943_a(p_78760_1_, p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_7_, f, f1, f2); -+ if (!p_78760_3_.func_77943_a(p_78760_1_, p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_7_, f, f1, f2)) -+ { -+ return false; -+ } -+ if (p_78760_3_.field_77994_a <= 0) -+ { -+ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(p_78760_1_, p_78760_3_)); -+ } -+ return true; - } - } - -@@ -359,9 +384,10 @@ - { - p_78769_1_.field_71071_by.field_70462_a[p_78769_1_.field_71071_by.field_70461_c] = itemstack1; - -- if (itemstack1.field_77994_a == 0) -+ if (itemstack1.field_77994_a <= 0) + if (this.field_78779_k != WorldSettings.GameType.SPECTATOR) { - p_78769_1_.field_71071_by.field_70462_a[p_78769_1_.field_71071_by.field_70461_c] = null; -+ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(p_78769_1_, itemstack1)); - } ++ ++ if (p_178890_3_ != null && ++ p_178890_3_.func_77973_b() != null && ++ p_178890_3_.func_77973_b().onItemUseFirst(p_178890_3_, p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) ++ { ++ return true; ++ } ++ + IBlockState iblockstate = p_178890_2_.func_180495_p(p_178890_4_); - return true; +- if ((!p_178890_1_.func_70093_af() || p_178890_1_.func_70694_bm() == null) && iblockstate.func_177230_c().func_180639_a(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2)) ++ if ((!p_178890_1_.func_70093_af() || p_178890_1_.func_70694_bm() == null || p_178890_1_.func_70694_bm().func_77973_b().doesSneakBypassUse(p_178890_2_, p_178890_4_, p_178890_1_))) + { +- flag = true; ++ flag = iblockstate.func_177230_c().func_180639_a(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2); + } + + if (!flag && p_178890_3_ != null && p_178890_3_.func_77973_b() instanceof ItemBlock) +@@ -397,7 +411,9 @@ + } + else + { +- return p_178890_3_.func_179546_a(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2); ++ if (!p_178890_3_.func_179546_a(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) return false; ++ if (p_178890_3_.field_77994_a <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_178890_1_, p_178890_3_); ++ return true; + } + } + else +@@ -428,9 +444,10 @@ + { + p_78769_1_.field_71071_by.field_70462_a[p_78769_1_.field_71071_by.field_70461_c] = itemstack1; + +- if (itemstack1.field_77994_a == 0) ++ if (itemstack1.field_77994_a <= 0) + { + p_78769_1_.field_71071_by.field_70462_a[p_78769_1_.field_71071_by.field_70461_c] = null; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_78769_1_, itemstack1); + } + + return true; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch index 84ebab846d..683abe065a 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch @@ -1,38 +1,12 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java -@@ -34,6 +34,9 @@ - import net.minecraft.world.chunk.IChunkProvider; - import net.minecraft.world.storage.SaveHandlerMP; - -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.world.WorldEvent; -+ - @SideOnly(Side.CLIENT) - public class WorldClient extends World - { -@@ -51,8 +54,11 @@ - super(new SaveHandlerMP(), "MpServer", WorldProvider.func_76570_a(p_i45063_3_), p_i45063_2_, p_i45063_5_); +@@ -54,8 +54,8 @@ + super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.func_76570_a(p_i45063_3_), p_i45063_5_, true); this.field_73035_a = p_i45063_1_; - this.field_73013_u = p_i45063_4_; -- this.func_72950_A(8, 64, 8); - this.field_72988_C = p_i45063_1_.field_147305_a; -+ this.field_72995_K = true; -+ this.finishSetup(); -+ this.func_72950_A(8, 64, 8); -+ MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(this)); - } - - public void func_72835_b() -@@ -261,6 +267,12 @@ - - protected void func_72979_l() - { -+ super.func_72979_l(); -+ } -+ -+ @Override -+ public void updateWeatherBody() -+ { - if (!this.field_73011_w.field_76576_e) - { - ; + this.func_72912_H().func_176144_a(p_i45063_4_); +- this.func_175652_B(new BlockPos(8, 64, 8)); + this.field_73011_w.func_76558_a(this); ++ this.func_175652_B(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect. + this.field_73020_y = this.func_72970_h(); + this.field_72988_C = new SaveDataMemoryStorage(); + this.func_72966_v(); diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch index 365c394770..f8f9eca1fa 100644 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch @@ -1,45 +1,41 @@ --- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java +++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java -@@ -195,6 +195,8 @@ - import net.minecraft.world.storage.ISaveHandler; - import net.minecraft.world.storage.MapData; - import net.minecraft.world.storage.MapStorage; -+import net.minecraftforge.client.event.ClientChatReceivedEvent; -+import net.minecraftforge.common.MinecraftForge; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -@@ -389,7 +391,8 @@ - +@@ -410,7 +410,8 @@ public void func_147286_a(S11PacketSpawnExperienceOrb p_147286_1_) { + PacketThreadUtil.func_180031_a(p_147286_1_, this, this.field_147299_f); - EntityXPOrb entityxporb = new EntityXPOrb(this.field_147300_g, (double)p_147286_1_.func_148984_d(), (double)p_147286_1_.func_148983_e(), (double)p_147286_1_.func_148982_f(), p_147286_1_.func_148986_g()); + EntityXPOrb entityxporb = new EntityXPOrb(this.field_147300_g, (double)p_147286_1_.func_148984_d() / 32.0D, (double)p_147286_1_.func_148983_e() / 32.0D, (double)p_147286_1_.func_148982_f() / 32.0D, p_147286_1_.func_148986_g()); + // FORGE: BugFix MC-12013 Wrong XP orb clientside spawn position entityxporb.field_70118_ct = p_147286_1_.func_148984_d(); entityxporb.field_70117_cu = p_147286_1_.func_148983_e(); entityxporb.field_70116_cv = p_147286_1_.func_148982_f(); -@@ -686,7 +689,11 @@ - +@@ -754,14 +755,15 @@ public void func_147251_a(S02PacketChat p_147251_1_) { -- this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(p_147251_1_.func_148915_c()); -+ ClientChatReceivedEvent event = new ClientChatReceivedEvent(p_147251_1_.func_148915_c()); -+ if (!MinecraftForge.EVENT_BUS.post(event) && event.message != null) -+ { -+ this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(event.message); -+ } - } + PacketThreadUtil.func_180031_a(p_147251_1_, this, this.field_147299_f); ++ net.minecraft.util.IChatComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_147251_1_.func_179841_c(), p_147251_1_.func_148915_c()); - public void func_147279_a(S0BPacketAnimation p_147279_1_) -@@ -1126,6 +1133,10 @@ - { - tileentity.func_145839_a(p_147273_1_.func_148857_g()); - } -+ else -+ { -+ tileentity.onDataPacket(field_147302_e, p_147273_1_); -+ } - } + if (p_147251_1_.func_179841_c() == 2) + { +- this.field_147299_f.field_71456_v.func_175188_a(p_147251_1_.func_148915_c(), false); ++ this.field_147299_f.field_71456_v.func_175188_a(message, false); + } + else + { +- this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(p_147251_1_.func_148915_c()); ++ this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(message); } } + +@@ -1137,6 +1139,10 @@ + { + tileentity.func_145839_a(p_147273_1_.func_148857_g()); + } ++ else ++ { ++ tileentity.onDataPacket(field_147302_e, p_147273_1_); ++ } + } + } + diff --git a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch index d53bc9485e..24d41ea24e 100644 --- a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -1,74 +1,33 @@ --- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java -@@ -16,9 +16,11 @@ - import net.minecraft.crash.CrashReportCategory; - import net.minecraft.entity.Entity; - import net.minecraft.util.MathHelper; -+import net.minecraft.util.MovingObjectPosition; - import net.minecraft.util.ReportedException; - import net.minecraft.util.ResourceLocation; - import net.minecraft.world.World; -+ - import org.lwjgl.opengl.GL11; +@@ -135,6 +135,7 @@ - @SideOnly(Side.CLIENT) -@@ -70,7 +72,10 @@ - - try - { -- entityfx.func_70071_h_(); -+ if (entityfx != null) -+ { -+ entityfx.func_70071_h_(); -+ } - } - catch (Throwable throwable) - { -@@ -95,7 +100,7 @@ - throw new ReportedException(crashreport); - } - -- if (entityfx.field_70128_L) -+ if (entityfx == null || entityfx.field_70128_L) - { - this.field_78876_b[i].remove(j--); - } -@@ -144,6 +149,7 @@ - for (int j = 0; j < this.field_78876_b[i].size(); ++j) - { - final EntityFX entityfx = (EntityFX)this.field_78876_b[i].get(j); -+ if (entityfx == null) continue; - tessellator.func_78380_c(entityfx.func_70070_b(p_78874_2_)); - - try -@@ -200,6 +206,7 @@ - for (int i = 0; i < list.size(); ++i) - { - EntityFX entityfx = (EntityFX)list.get(i); -+ if (entityfx == null) continue; - tessellator.func_78380_c(entityfx.func_70070_b(p_78872_2_)); - entityfx.func_70539_a(tessellator, p_78872_2_, f2, f6, f3, f4, f5); - } -@@ -218,7 +225,7 @@ - - public void func_147215_a(int p_147215_1_, int p_147215_2_, int p_147215_3_, Block p_147215_4_, int p_147215_5_) + public void func_78873_a(EntityFX p_78873_1_) { -- if (p_147215_4_.func_149688_o() != Material.field_151579_a) -+ if (!p_147215_4_.isAir(field_78878_a, p_147215_1_, p_147215_2_, p_147215_3_) && !p_147215_4_.addDestroyEffects(field_78878_a, p_147215_1_, p_147215_2_, p_147215_3_, p_147215_5_, this)) ++ if (p_78873_1_ == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs. + int i = p_78873_1_.func_70537_b(); + int j = p_78873_1_.func_174838_j() != 1.0F ? 0 : 1; + +@@ -361,7 +362,7 @@ + + public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_) + { +- if (p_180533_2_.func_177230_c().func_149688_o() != Material.field_151579_a) ++ if (p_180533_2_.func_177230_c().isAir(field_78878_a, p_180533_1_) && !p_180533_2_.func_177230_c().addDestroyEffects(field_78878_a, p_180533_1_, this)) { + p_180533_2_ = p_180533_2_.func_177230_c().func_176221_a(p_180533_2_, this.field_78878_a, p_180533_1_); byte b0 = 4; +@@ -467,4 +468,13 @@ -@@ -287,4 +294,13 @@ - { - return "" + (this.field_78876_b[0].size() + this.field_78876_b[1].size() + this.field_78876_b[2].size()); + return "" + i; } + -+ public void addBlockHitEffects(int x, int y, int z, MovingObjectPosition target) ++ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.MovingObjectPosition target) + { -+ Block block = field_78878_a.func_147439_a(x, y, z); ++ Block block = field_78878_a.func_180495_p(pos).func_177230_c(); + if (block != null && !block.addHitEffects(field_78878_a, target, this)) + { -+ func_78867_a(x, y, z, target.field_72310_e); ++ func_180532_a(pos, target.field_178784_b); + } + } } diff --git a/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch b/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch deleted file mode 100644 index ebe4cec4fe..0000000000 --- a/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/particle/EntityDiggingFX.java -+++ ../src-work/minecraft/net/minecraft/client/particle/EntityDiggingFX.java -@@ -12,20 +12,27 @@ - { - private Block field_145784_a; - private static final String __OBFID = "CL_00000932"; -+ private int side; - - public EntityDiggingFX(World p_i1234_1_, double p_i1234_2_, double p_i1234_4_, double p_i1234_6_, double p_i1234_8_, double p_i1234_10_, double p_i1234_12_, Block p_i1234_14_, int p_i1234_15_) - { -+ this(p_i1234_1_, p_i1234_2_, p_i1234_4_, p_i1234_6_, p_i1234_8_, p_i1234_10_, p_i1234_12_, p_i1234_14_, p_i1234_15_, p_i1234_1_.field_73012_v.nextInt(6)); -+ } -+ -+ public EntityDiggingFX(World p_i1234_1_, double p_i1234_2_, double p_i1234_4_, double p_i1234_6_, double p_i1234_8_, double p_i1234_10_, double p_i1234_12_, Block p_i1234_14_, int p_i1234_15_, int side) -+ { - super(p_i1234_1_, p_i1234_2_, p_i1234_4_, p_i1234_6_, p_i1234_8_, p_i1234_10_, p_i1234_12_); - this.field_145784_a = p_i1234_14_; -- this.func_110125_a(p_i1234_14_.func_149691_a(0, p_i1234_15_)); -+ this.func_110125_a(p_i1234_14_.func_149691_a(side, p_i1234_15_)); - this.field_70545_g = p_i1234_14_.field_149763_I; - this.field_70552_h = this.field_70553_i = this.field_70551_j = 0.6F; - this.field_70544_f /= 2.0F; -+ this.side = side; - } - - public EntityDiggingFX func_70596_a(int p_70596_1_, int p_70596_2_, int p_70596_3_) - { -- if (this.field_145784_a == Blocks.field_150349_c) -+ if (this.field_145784_a == Blocks.field_150349_c && this.side != 1) - { - return this; - } diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index 5f225cb145..783e96e00f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -1,162 +1,110 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java -@@ -51,6 +51,12 @@ - import org.lwjgl.opengl.GL11; - import org.lwjgl.opengl.GLContext; - import org.lwjgl.util.glu.Project; -+import net.minecraftforge.client.ForgeHooksClient; -+import net.minecraftforge.client.IRenderHandler; -+import net.minecraftforge.client.event.DrawBlockHighlightEvent; -+import net.minecraftforge.client.event.GuiScreenEvent.DrawScreenEvent; -+import net.minecraftforge.client.event.RenderWorldLastEvent; -+import net.minecraftforge.common.MinecraftForge; - - @SideOnly(Side.CLIENT) - public class EntityRenderer implements IResourceManagerReloadListener -@@ -358,7 +364,7 @@ +@@ -403,7 +403,7 @@ if (d3 < d2 || d2 == 0.0D) { -- if (entity == this.field_78531_r.field_71451_h.field_70154_o) -+ if (entity == this.field_78531_r.field_71451_h.field_70154_o && !entity.canRiderInteract()) +- if (entity1 == entity.field_70154_o) ++ if (entity1 == entity.field_70154_o && !entity.canRiderInteract()) { if (d2 == 0.0D) { -@@ -392,8 +398,15 @@ - - private void func_78477_e() - { -- EntityPlayerSP entityplayersp = (EntityPlayerSP)this.field_78531_r.field_71451_h; -- this.field_78501_T = entityplayersp.func_71151_f(); -+ if (field_78531_r.field_71451_h instanceof EntityPlayerSP) -+ { -+ EntityPlayerSP entityplayersp = (EntityPlayerSP)this.field_78531_r.field_71451_h; -+ this.field_78501_T = entityplayersp.func_71151_f(); -+ } -+ else -+ { -+ this.field_78501_T = field_78531_r.field_71439_g.func_71151_f(); -+ } - this.field_78506_S = this.field_78507_R; - this.field_78507_R += (this.field_78501_T - this.field_78507_R) * 0.5F; - -@@ -416,7 +429,7 @@ - } - else - { -- EntityPlayer entityplayer = (EntityPlayer)this.field_78531_r.field_71451_h; -+ EntityLivingBase entityplayer = (EntityLivingBase)this.field_78531_r.field_71451_h; - float f1 = 70.0F; - - if (p_78481_2_) -@@ -497,15 +510,7 @@ - - if (!this.field_78531_r.field_71474_y.field_74325_U) +@@ -556,14 +556,8 @@ { -- Block block = this.field_78531_r.field_71441_e.func_147439_a(MathHelper.func_76128_c(entitylivingbase.field_70165_t), MathHelper.func_76128_c(entitylivingbase.field_70163_u), MathHelper.func_76128_c(entitylivingbase.field_70161_v)); -- + BlockPos blockpos = new BlockPos(entity); + IBlockState iblockstate = this.field_78531_r.field_71441_e.func_180495_p(blockpos); +- Block block = iblockstate.func_177230_c(); ++ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.field_78531_r.field_71441_e, blockpos, iblockstate, entity); + - if (block == Blocks.field_150324_C) - { -- int i = this.field_78531_r.field_71441_e.func_72805_g(MathHelper.func_76128_c(entitylivingbase.field_70165_t), MathHelper.func_76128_c(entitylivingbase.field_70163_u), MathHelper.func_76128_c(entitylivingbase.field_70161_v)); -- int j = i & 3; -- GL11.glRotatef((float)(j * 90), 0.0F, 1.0F, 0.0F); +- int j = ((EnumFacing)iblockstate.func_177229_b(BlockBed.field_176387_N)).func_176736_b(); +- GlStateManager.func_179114_b((float)(j * 90), 0.0F, 1.0F, 0.0F); - } - -+ ForgeHooksClient.orientBedCamera(field_78531_r, entitylivingbase); - GL11.glRotatef(entitylivingbase.field_70126_B + (entitylivingbase.field_70177_z - entitylivingbase.field_70126_B) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F); - GL11.glRotatef(entitylivingbase.field_70127_C + (entitylivingbase.field_70125_A - entitylivingbase.field_70127_C) * p_78467_1_, -1.0F, 0.0F, 0.0F); + GlStateManager.func_179114_b(entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F); + GlStateManager.func_179114_b(entity.field_70127_C + (entity.field_70125_A - entity.field_70127_C) * p_78467_1_, -1.0F, 0.0F, 0.0F); } -@@ -1052,7 +1057,9 @@ +@@ -1081,7 +1075,7 @@ try { -- this.field_78531_r.field_71462_r.func_73863_a(k, l, p_78480_1_); -+ if (!MinecraftForge.EVENT_BUS.post(new DrawScreenEvent.Pre(this.field_78531_r.field_71462_r, k, l, p_78480_1_))) -+ this.field_78531_r.field_71462_r.func_73863_a(k, l, p_78480_1_); -+ MinecraftForge.EVENT_BUS.post(new DrawScreenEvent.Post(this.field_78531_r.field_71462_r, k, l, p_78480_1_)); +- this.field_78531_r.field_71462_r.func_73863_a(l, i1, p_78480_1_); ++ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.field_78531_r.field_71462_r, l, i1, p_78480_1_); } catch (Throwable throwable) { -@@ -1213,7 +1220,10 @@ - GL11.glPushMatrix(); - RenderHelper.func_74519_b(); - this.field_78531_r.field_71424_I.func_76318_c("entities"); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); - renderglobal.func_147589_a(entitylivingbase, frustrum, p_78471_1_); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); -+ //ToDo: Try and figure out how to make particles render sorted correctly.. {They render behind water} - RenderHelper.func_74518_a(); - this.func_78483_a((double)p_78471_1_); - GL11.glMatrixMode(GL11.GL_MODELVIEW); -@@ -1225,7 +1235,10 @@ - entityplayer = (EntityPlayer)entitylivingbase; - GL11.glDisable(GL11.GL_ALPHA_TEST); - this.field_78531_r.field_71424_I.func_76318_c("outline"); -- renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_78471_1_); -+ if (!ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, field_78531_r.field_71476_x, 0, entityplayer.field_71071_by.func_70448_g(), p_78471_1_)) -+ { -+ renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_78471_1_); -+ } - GL11.glEnable(GL11.GL_ALPHA_TEST); - } - } -@@ -1238,14 +1251,17 @@ - entityplayer = (EntityPlayer)entitylivingbase; - GL11.glDisable(GL11.GL_ALPHA_TEST); +@@ -1145,7 +1139,7 @@ + + if (this.field_78531_r.field_71442_b.func_178889_l() == WorldSettings.GameType.SPECTATOR) + { +- flag = block.func_149716_u() && this.field_78531_r.field_71441_e.func_175625_s(blockpos) instanceof IInventory; ++ flag = block.hasTileEntity(this.field_78531_r.field_71441_e.func_180495_p(blockpos)) && this.field_78531_r.field_71441_e.func_175625_s(blockpos) instanceof IInventory; + } + else + { +@@ -1296,7 +1290,9 @@ + GlStateManager.func_179094_E(); + RenderHelper.func_74519_b(); + this.field_78531_r.field_71424_I.func_76318_c("entities"); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); + renderglobal.func_180446_a(entity, frustum, p_175068_2_); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); + RenderHelper.func_74518_a(); + this.func_175072_h(); + GlStateManager.func_179128_n(5888); +@@ -1308,6 +1304,7 @@ + entityplayer = (EntityPlayer)entity; + GlStateManager.func_179118_c(); this.field_78531_r.field_71424_I.func_76318_c("outline"); -- renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_78471_1_); -+ if (!ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, field_78531_r.field_71476_x, 0, entityplayer.field_71071_by.func_70448_g(), p_78471_1_)) -+ { -+ renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_78471_1_); -+ } - GL11.glEnable(GL11.GL_ALPHA_TEST); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, field_78531_r.field_71476_x, 0, entityplayer.func_70694_bm(), p_175068_2_)) + renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_175068_2_); + GlStateManager.func_179141_d(); } +@@ -1321,6 +1318,7 @@ + entityplayer = (EntityPlayer)entity; + GlStateManager.func_179118_c(); + this.field_78531_r.field_71424_I.func_76318_c("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, field_78531_r.field_71476_x, 0, entityplayer.func_70694_bm(), p_175068_2_)) + renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_175068_2_); + GlStateManager.func_179141_d(); + } +@@ -1373,6 +1371,16 @@ + renderglobal.func_174977_a(EnumWorldBlockLayer.TRANSLUCENT, (double)p_175068_2_, p_175068_1_, entity); + } - this.field_78531_r.field_71424_I.func_76318_c("destroyProgress"); - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.func_148821_a(770, 1, 1, 0); -- renderglobal.func_72717_a(Tessellator.field_78398_a, (EntityPlayer)entitylivingbase, p_78471_1_); -+ renderglobal.drawBlockDamageTexture(Tessellator.field_78398_a, entitylivingbase, p_78471_1_); - GL11.glDisable(GL11.GL_BLEND); - - if (this.field_78532_q == 0) -@@ -1313,6 +1329,16 @@ - renderglobal.func_72719_a(entitylivingbase, 1, (double)p_78471_1_); - } - -+ if (this.field_78532_q == 0) //Only render if render pass 0 happens as well. -+ { -+ RenderHelper.func_74519_b(); -+ this.field_78531_r.field_71424_I.func_76318_c("entities"); -+ ForgeHooksClient.setRenderPass(1); -+ renderglobal.func_147589_a(entitylivingbase, frustrum, p_78471_1_); -+ ForgeHooksClient.setRenderPass(-1); -+ RenderHelper.func_74518_a(); -+ } ++ if (!this.field_175078_W) //Only render if render pass 0 happens as well. ++ { ++ RenderHelper.func_74519_b(); ++ this.field_78531_r.field_71424_I.func_76318_c("entities"); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); ++ renderglobal.func_180446_a(entity, frustum, p_175068_2_); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); ++ RenderHelper.func_74518_a(); ++ } + - GL11.glDepthMask(true); - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_BLEND); -@@ -1324,9 +1350,12 @@ - this.func_82829_a(renderglobal, p_78471_1_); - } + GlStateManager.func_179103_j(7424); + GlStateManager.func_179132_a(true); + GlStateManager.func_179089_o(); +@@ -1385,8 +1393,12 @@ + this.func_180437_a(renderglobal, p_175068_2_, p_175068_1_); + } -+ this.field_78531_r.field_71424_I.func_76318_c("FRenderLast"); -+ ForgeHooksClient.dispatchRenderLast(renderglobal, p_78471_1_); ++ this.field_78531_r.field_71424_I.func_76318_c("forge_render_last"); ++ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(renderglobal, p_175068_2_); + - this.field_78531_r.field_71424_I.func_76318_c("hand"); + this.field_78531_r.field_71424_I.func_76318_c("hand"); -- if (this.field_78503_V == 1.0D) -+ if (!ForgeHooksClient.renderFirstPersonHand(renderglobal, p_78471_1_, j) && this.field_78503_V == 1.0D) - { - GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); - this.func_78476_b(p_78471_1_, j); -@@ -1442,6 +1471,13 @@ ++ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(renderglobal, p_175068_2_, p_175068_1_)) + if (this.field_175074_C) + { + GlStateManager.func_179086_m(256); +@@ -1498,6 +1510,13 @@ protected void func_78474_d(float p_78474_1_) { -+ IRenderHandler renderer = null; -+ if ((renderer = this.field_78531_r.field_71441_e.field_73011_w.getWeatherRenderer()) != null) ++ net.minecraftforge.client.IRenderHandler renderer = this.field_78531_r.field_71441_e.field_73011_w.getWeatherRenderer(); ++ if (renderer != null) + { + renderer.render(p_78474_1_, this.field_78531_r.field_71441_e, field_78531_r); + return; @@ -165,39 +113,36 @@ float f1 = this.field_78531_r.field_71441_e.func_72867_j(p_78474_1_); if (f1 > 0.0F) -@@ -1791,6 +1827,13 @@ - this.field_78533_p = f7; +@@ -1835,6 +1854,13 @@ + this.field_175081_S = f8; } -+ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entitylivingbase, block, p_78466_1_, this.field_78518_n, this.field_78519_o, this.field_78533_p); -+ MinecraftForge.EVENT_BUS.post(event); ++ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, block, p_78466_1_, this.field_175080_Q, this.field_175082_R, this.field_175081_S); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + -+ this.field_78518_n = event.red; -+ this.field_78533_p = event.blue; -+ this.field_78519_o = event.green; ++ this.field_175080_Q = event.red; ++ this.field_175082_R = event.blue; ++ this.field_175081_S = event.green; + - GL11.glClearColor(this.field_78518_n, this.field_78519_o, this.field_78533_p, 0.0F); + GlStateManager.func_179082_a(this.field_175080_Q, this.field_175082_R, this.field_175081_S, 0.0F); } -@@ -1826,6 +1869,13 @@ - Block block = ActiveRenderInfo.func_151460_a(this.field_78531_r.field_71441_e, entitylivingbase, p_78468_2_); - float f1; +@@ -1854,6 +1880,10 @@ + Block block = ActiveRenderInfo.func_180786_a(this.field_78531_r.field_71441_e, entity, p_78468_2_); + float f1; -+ net.minecraftforge.client.event.EntityViewRenderEvent.FogDensity event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogDensity(this, entitylivingbase, block, p_78468_2_, 0.1F); -+ -+ if (MinecraftForge.EVENT_BUS.post(event)) -+ { -+ GL11.glFogf(GL11.GL_FOG_DENSITY, event.density); -+ } -+ else - if (entitylivingbase.func_70644_a(Potion.field_76440_q)) - { - f1 = 5.0F; -@@ -1930,6 +1980,7 @@ - GL11.glFogf(GL11.GL_FOG_START, f1 * 0.05F); - GL11.glFogf(GL11.GL_FOG_END, Math.min(f1, 192.0F) * 0.5F); - } -+ MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.EntityViewRenderEvent.RenderFogEvent(this, entitylivingbase, block, p_78468_2_, p_78468_1_, f1)); ++ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, block, p_78468_2_, 0.1F); ++ if (hook >= 0) ++ GlStateManager.func_179095_a(hook); ++ else + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70644_a(Potion.field_76440_q)) + { + f1 = 5.0F; +@@ -1931,6 +1961,7 @@ + GlStateManager.func_179102_b(f1 * 0.05F); + GlStateManager.func_179153_c(Math.min(f1, 192.0F) * 0.5F); } ++ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, p_78468_2_, p_78468_1_, f1); + } - GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GlStateManager.func_179142_g(); diff --git a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch index b7e41be707..63e6a2672d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java -@@ -75,6 +75,8 @@ +@@ -83,6 +83,8 @@ this.func_73729_b(i + 6, j + 7, 0 + l % 8 * 18, 198 + l / 8 * 18, 18, 18); } diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch deleted file mode 100644 index 3d876c13be..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ /dev/null @@ -1,167 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java -@@ -20,6 +20,7 @@ - import net.minecraft.item.Item; - import net.minecraft.item.ItemBlock; - import net.minecraft.item.ItemCloth; -+import net.minecraft.item.ItemMap; - import net.minecraft.item.ItemStack; - import net.minecraft.util.IIcon; - import net.minecraft.util.MathHelper; -@@ -28,6 +29,13 @@ - import org.lwjgl.opengl.GL11; - import org.lwjgl.opengl.GL12; - -+import net.minecraftforge.client.ForgeHooksClient; -+import net.minecraftforge.client.IItemRenderer; -+import net.minecraftforge.client.IItemRenderer.ItemRenderType; -+import net.minecraftforge.client.MinecraftForgeClient; -+import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*; -+import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*; -+ - @SideOnly(Side.CLIENT) - public class ItemRenderer - { -@@ -49,6 +57,11 @@ - - public void func_78443_a(EntityLivingBase p_78443_1_, ItemStack p_78443_2_, int p_78443_3_) - { -+ this.renderItem(p_78443_1_, p_78443_2_, p_78443_3_, EQUIPPED); -+ } -+ -+ public void renderItem(EntityLivingBase p_78443_1_, ItemStack p_78443_2_, int p_78443_3_, ItemRenderType type) -+ { - GL11.glPushMatrix(); - TextureManager texturemanager = this.field_78455_a.func_110434_K(); - Item item = p_78443_2_.func_77973_b(); -@@ -60,7 +73,13 @@ - GL11.glEnable(GL11.GL_CULL_FACE); - OpenGlHelper.func_148821_a(770, 771, 1, 0); - } -- -+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(p_78443_2_, type); -+ if (customRenderer != null) -+ { -+ texturemanager.func_110577_a(texturemanager.func_130087_a(p_78443_2_.func_94608_d())); -+ ForgeHooksClient.renderEquippedItem(type, customRenderer, field_147720_h, p_78443_1_, p_78443_2_); -+ } -+ else - if (p_78443_2_.func_94608_d() == 0 && item instanceof ItemBlock && RenderBlocks.func_147739_a(block.func_149645_b())) - { - texturemanager.func_110577_a(texturemanager.func_130087_a(0)); -@@ -104,7 +123,7 @@ - GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); - func_78439_a(tessellator, f1, f2, f, f3, iicon.func_94211_a(), iicon.func_94216_b(), 0.0625F); - -- if (p_78443_2_.func_77962_s() && p_78443_3_ == 0) -+ if (p_78443_2_.hasEffect(p_78443_3_)) - { - GL11.glDepthFunc(GL11.GL_EQUAL); - GL11.glDisable(GL11.GL_LIGHTING); -@@ -282,7 +301,7 @@ - Render render; - RenderPlayer renderplayer; - -- if (itemstack != null && itemstack.func_77973_b() == Items.field_151098_aY) -+ if (itemstack != null && itemstack.func_77973_b() instanceof ItemMap) - { - GL11.glPushMatrix(); - f13 = 0.8F; -@@ -349,12 +368,21 @@ - tessellator.func_78374_a((double)(128 + b0), (double)(0 - b0), 0.0D, 1.0D, 0.0D); - tessellator.func_78374_a((double)(0 - b0), (double)(0 - b0), 0.0D, 0.0D, 0.0D); - tessellator.func_78381_a(); -- MapData mapdata = Items.field_151098_aY.func_77873_a(itemstack, this.field_78455_a.field_71441_e); - -- if (mapdata != null) -+ IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP); -+ MapData mapdata = ((ItemMap)itemstack.func_77973_b()).func_77873_a(itemstack, this.field_78455_a.field_71441_e); -+ -+ if (custom == null) - { -- this.field_78455_a.field_71460_t.func_147701_i().func_148250_a(mapdata, false); -+ if (mapdata != null) -+ { -+ this.field_78455_a.field_71460_t.func_147701_i().func_148250_a(mapdata, false); -+ } - } -+ else -+ { -+ custom.renderItem(FIRST_PERSON_MAP, itemstack, field_78455_a.field_71439_g, field_78455_a.func_110434_K(), mapdata); -+ } - - GL11.glPopMatrix(); - } -@@ -455,17 +483,20 @@ - - if (itemstack.func_77973_b().func_77623_v()) - { -- this.func_78443_a(entityclientplayermp, itemstack, 0); -- int k1 = itemstack.func_77973_b().func_82790_a(itemstack, 1); -- f10 = (float)(k1 >> 16 & 255) / 255.0F; -- f11 = (float)(k1 >> 8 & 255) / 255.0F; -- f12 = (float)(k1 & 255) / 255.0F; -- GL11.glColor4f(1.0F * f10, 1.0F * f11, 1.0F * f12, 1.0F); -- this.func_78443_a(entityclientplayermp, itemstack, 1); -+ this.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON); -+ for (int x = 1; x < itemstack.func_77973_b().getRenderPasses(itemstack.func_77960_j()); x++) -+ { -+ int k1 = itemstack.func_77973_b().func_82790_a(itemstack, x); -+ f10 = (float)(k1 >> 16 & 255) / 255.0F; -+ f11 = (float)(k1 >> 8 & 255) / 255.0F; -+ f12 = (float)(k1 & 255) / 255.0F; -+ GL11.glColor4f(1.0F * f10, 1.0F * f11, 1.0F * f12, 1.0F); -+ this.renderItem(entityclientplayermp, itemstack, x, EQUIPPED_FIRST_PERSON); -+ } - } - else - { -- this.func_78443_a(entityclientplayermp, itemstack, 0); -+ this.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON); - } - - GL11.glPopMatrix(); -@@ -516,6 +547,7 @@ - - if (this.field_78455_a.field_71439_g.func_70027_ad()) - { -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderBlockOverlayEvent(this.field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.FIRE, Blocks.field_150480_ab, MathHelper.func_76128_c(this.field_78455_a.field_71439_g.field_70165_t), MathHelper.func_76128_c(this.field_78455_a.field_71439_g.field_70163_u), MathHelper.func_76128_c(this.field_78455_a.field_71439_g.field_70161_v)))) - this.func_78442_d(p_78447_1_); - } - -@@ -525,9 +557,11 @@ - int j = MathHelper.func_76128_c(this.field_78455_a.field_71439_g.field_70163_u); - int k = MathHelper.func_76128_c(this.field_78455_a.field_71439_g.field_70161_v); - Block block = this.field_78455_a.field_71441_e.func_147439_a(i, j, k); -+ int block2_X = i, block2_Y = j, block2_Z = k; - - if (this.field_78455_a.field_71441_e.func_147439_a(i, j, k).func_149721_r()) - { -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderBlockOverlayEvent(this.field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, block, i, j, k))) - this.func_78446_a(p_78447_1_, block.func_149733_h(2)); - } - else -@@ -544,18 +578,23 @@ - if (this.field_78455_a.field_71441_e.func_147439_a(i1, j1, k1).func_149721_r()) - { - block = this.field_78455_a.field_71441_e.func_147439_a(i1, j1, k1); -+ block2_X = i; -+ block2_Y = j; -+ block2_Z = k; - } - } - } - - if (block.func_149688_o() != Material.field_151579_a) - { -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderBlockOverlayEvent(this.field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, block, block2_X, block2_Y, block2_Z))) - this.func_78446_a(p_78447_1_, block.func_149733_h(2)); - } - } - - if (this.field_78455_a.field_71439_g.func_70055_a(Material.field_151586_h)) - { -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderBlockOverlayEvent(this.field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.WATER, Blocks.field_150355_j, MathHelper.func_76128_c(this.field_78455_a.field_71439_g.field_70165_t), MathHelper.func_76128_c(this.field_78455_a.field_71439_g.field_70163_u), MathHelper.func_76128_c(this.field_78455_a.field_71439_g.field_70161_v)))) - this.func_78448_c(p_78447_1_); - } - diff --git a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch index c022c25b2a..c10aed1e5b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java +++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java -@@ -54,6 +54,10 @@ - private static String field_153196_B = ""; +@@ -78,6 +78,10 @@ + public static int field_148826_e; private static final String __OBFID = "CL_00001179"; + /* Stores the last values sent into setLightmapTextureCoords */ @@ -11,7 +11,7 @@ public static void func_77474_a() { ContextCapabilities contextcapabilities = GLContext.getCapabilities(); -@@ -688,6 +692,12 @@ +@@ -813,6 +817,12 @@ { GL13.glMultiTexCoord2f(p_77475_0_, p_77475_1_, p_77475_2_); } diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderBlocks.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderBlocks.java.patch deleted file mode 100644 index 324c474235..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/RenderBlocks.java.patch +++ /dev/null @@ -1,128 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/RenderBlocks.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/RenderBlocks.java -@@ -52,6 +52,8 @@ - import org.lwjgl.opengl.GL11; - import org.lwjgl.opengl.GL12; - -+import static net.minecraftforge.common.util.ForgeDirection.*; -+ - @SideOnly(Side.CLIENT) - public class RenderBlocks - { -@@ -339,9 +341,9 @@ - public boolean func_147773_v(Block p_147773_1_, int p_147773_2_, int p_147773_3_, int p_147773_4_) - { - Tessellator tessellator = Tessellator.field_78398_a; -- int l = this.field_147845_a.func_72805_g(p_147773_2_, p_147773_3_, p_147773_4_); -- int i1 = BlockBed.func_149895_l(l); -- boolean flag = BlockBed.func_149975_b(l); -+ Block bed = this.field_147845_a.func_147439_a(p_147773_2_, p_147773_3_, p_147773_4_); -+ int i1 = bed.getBedDirection(field_147845_a, p_147773_2_, p_147773_3_, p_147773_4_); -+ boolean flag = bed.isBedFoot(field_147845_a, p_147773_2_, p_147773_3_, p_147773_4_); - float f = 0.5F; - float f1 = 1.0F; - float f2 = 0.8F; -@@ -350,6 +352,7 @@ - tessellator.func_78380_c(j1); - tessellator.func_78386_a(f, f, f); - IIcon iicon = this.func_147793_a(p_147773_1_, this.field_147845_a, p_147773_2_, p_147773_3_, p_147773_4_, 0); -+ if (func_147744_b()) iicon = field_147840_d; //BugFix Proper breaking texture on underside - double d0 = (double)iicon.func_94209_e(); - double d1 = (double)iicon.func_94212_f(); - double d2 = (double)iicon.func_94206_g(); -@@ -366,6 +369,7 @@ - tessellator.func_78380_c(p_147773_1_.func_149677_c(this.field_147845_a, p_147773_2_, p_147773_3_ + 1, p_147773_4_)); - tessellator.func_78386_a(f1, f1, f1); - iicon = this.func_147793_a(p_147773_1_, this.field_147845_a, p_147773_2_, p_147773_3_, p_147773_4_, 1); -+ if (func_147744_b()) iicon = field_147840_d; //BugFix Proper breaking texture on underside - d0 = (double)iicon.func_94209_e(); - d1 = (double)iicon.func_94212_f(); - d2 = (double)iicon.func_94206_g(); -@@ -2040,7 +2044,7 @@ - double d10; - double d11; - -- if (!World.func_147466_a(this.field_147845_a, p_147801_2_, p_147801_3_ - 1, p_147801_4_) && !Blocks.field_150480_ab.func_149844_e(this.field_147845_a, p_147801_2_, p_147801_3_ - 1, p_147801_4_)) -+ if (!World.func_147466_a(this.field_147845_a, p_147801_2_, p_147801_3_ - 1, p_147801_4_) && !Blocks.field_150480_ab.canCatchFire(this.field_147845_a, p_147801_2_, p_147801_3_ - 1, p_147801_4_, UP)) - { - float f2 = 0.2F; - float f1 = 0.0625F; -@@ -2060,7 +2064,7 @@ - d0 = d5; - } - -- if (Blocks.field_150480_ab.func_149844_e(this.field_147845_a, p_147801_2_ - 1, p_147801_3_, p_147801_4_)) -+ if (Blocks.field_150480_ab.canCatchFire(this.field_147845_a, p_147801_2_ - 1, p_147801_3_, p_147801_4_, EAST)) - { - tessellator.func_78374_a((double)((float)p_147801_2_ + f2), (double)((float)p_147801_3_ + f + f1), (double)(p_147801_4_ + 1), d2, d1); - tessellator.func_78374_a((double)(p_147801_2_ + 0), (double)((float)(p_147801_3_ + 0) + f1), (double)(p_147801_4_ + 1), d2, d3); -@@ -2072,7 +2076,7 @@ - tessellator.func_78374_a((double)((float)p_147801_2_ + f2), (double)((float)p_147801_3_ + f + f1), (double)(p_147801_4_ + 1), d2, d1); - } - -- if (Blocks.field_150480_ab.func_149844_e(this.field_147845_a, p_147801_2_ + 1, p_147801_3_, p_147801_4_)) -+ if (Blocks.field_150480_ab.canCatchFire(this.field_147845_a, p_147801_2_ + 1, p_147801_3_, p_147801_4_, WEST)) - { - tessellator.func_78374_a((double)((float)(p_147801_2_ + 1) - f2), (double)((float)p_147801_3_ + f + f1), (double)(p_147801_4_ + 0), d0, d1); - tessellator.func_78374_a((double)(p_147801_2_ + 1 - 0), (double)((float)(p_147801_3_ + 0) + f1), (double)(p_147801_4_ + 0), d0, d3); -@@ -2084,7 +2088,7 @@ - tessellator.func_78374_a((double)((float)(p_147801_2_ + 1) - f2), (double)((float)p_147801_3_ + f + f1), (double)(p_147801_4_ + 0), d0, d1); - } - -- if (Blocks.field_150480_ab.func_149844_e(this.field_147845_a, p_147801_2_, p_147801_3_, p_147801_4_ - 1)) -+ if (Blocks.field_150480_ab.canCatchFire(this.field_147845_a, p_147801_2_, p_147801_3_, p_147801_4_ - 1, SOUTH)) - { - tessellator.func_78374_a((double)(p_147801_2_ + 0), (double)((float)p_147801_3_ + f + f1), (double)((float)p_147801_4_ + f2), d2, d1); - tessellator.func_78374_a((double)(p_147801_2_ + 0), (double)((float)(p_147801_3_ + 0) + f1), (double)(p_147801_4_ + 0), d2, d3); -@@ -2096,7 +2100,7 @@ - tessellator.func_78374_a((double)(p_147801_2_ + 0), (double)((float)p_147801_3_ + f + f1), (double)((float)p_147801_4_ + f2), d2, d1); - } - -- if (Blocks.field_150480_ab.func_149844_e(this.field_147845_a, p_147801_2_, p_147801_3_, p_147801_4_ + 1)) -+ if (Blocks.field_150480_ab.canCatchFire(this.field_147845_a, p_147801_2_, p_147801_3_, p_147801_4_ + 1, NORTH)) - { - tessellator.func_78374_a((double)(p_147801_2_ + 1), (double)((float)p_147801_3_ + f + f1), (double)((float)(p_147801_4_ + 1) - f2), d0, d1); - tessellator.func_78374_a((double)(p_147801_2_ + 1), (double)((float)(p_147801_3_ + 0) + f1), (double)(p_147801_4_ + 1 - 0), d0, d3); -@@ -2108,7 +2112,7 @@ - tessellator.func_78374_a((double)(p_147801_2_ + 1), (double)((float)p_147801_3_ + f + f1), (double)((float)(p_147801_4_ + 1) - f2), d0, d1); - } - -- if (Blocks.field_150480_ab.func_149844_e(this.field_147845_a, p_147801_2_, p_147801_3_ + 1, p_147801_4_)) -+ if (Blocks.field_150480_ab.canCatchFire(this.field_147845_a, p_147801_2_, p_147801_3_ + 1, p_147801_4_, DOWN)) - { - d5 = (double)p_147801_2_ + 0.5D + 0.5D; - d6 = (double)p_147801_2_ + 0.5D - 0.5D; -@@ -3121,10 +3125,10 @@ - double d16 = (double)p_147767_2_ + 0.5D + 0.0625D; - double d17 = (double)p_147767_4_ + 0.5D - 0.0625D; - double d18 = (double)p_147767_4_ + 0.5D + 0.0625D; -- boolean flag = p_147767_1_.func_150098_a(this.field_147845_a.func_147439_a(p_147767_2_, p_147767_3_, p_147767_4_ - 1)); -- boolean flag1 = p_147767_1_.func_150098_a(this.field_147845_a.func_147439_a(p_147767_2_, p_147767_3_, p_147767_4_ + 1)); -- boolean flag2 = p_147767_1_.func_150098_a(this.field_147845_a.func_147439_a(p_147767_2_ - 1, p_147767_3_, p_147767_4_)); -- boolean flag3 = p_147767_1_.func_150098_a(this.field_147845_a.func_147439_a(p_147767_2_ + 1, p_147767_3_, p_147767_4_)); -+ boolean flag = p_147767_1_.canPaneConnectTo(this.field_147845_a, p_147767_2_, p_147767_3_, p_147767_4_ - 1, NORTH); -+ boolean flag1 = p_147767_1_.canPaneConnectTo(this.field_147845_a, p_147767_2_, p_147767_3_, p_147767_4_ + 1, SOUTH); -+ boolean flag2 = p_147767_1_.canPaneConnectTo(this.field_147845_a, p_147767_2_ - 1, p_147767_3_, p_147767_4_, WEST ); -+ boolean flag3 = p_147767_1_.canPaneConnectTo(this.field_147845_a, p_147767_2_ + 1, p_147767_3_, p_147767_4_, EAST ); - boolean flag4 = p_147767_1_.func_149646_a(this.field_147845_a, p_147767_2_, p_147767_3_ + 1, p_147767_4_, 1); - boolean flag5 = p_147767_1_.func_149646_a(this.field_147845_a, p_147767_2_, p_147767_3_ - 1, p_147767_4_, 0); - double d19 = 0.01D; -@@ -8247,4 +8251,18 @@ - - return (IIcon)p_147758_1_; - } -+ -+ /*==================================== FORGE START ===========================================*/ -+ private static RenderBlocks instance; -+ /** -+ * Returns a single lazy loaded instance of RenderBlocks, for use in mods who -+ * don't care about the interaction of other objects on the current state of the RenderBlocks they are using. -+ * @return A global instance of RenderBlocks -+ */ -+ public static RenderBlocks getInstance() -+ { -+ if (instance == null) instance = new RenderBlocks(); -+ return instance; -+ } -+ /*==================================== FORGE END =============================================*/ - } diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index 25e522e027..e7f5b1855c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -1,130 +1,134 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java +++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java -@@ -79,6 +79,9 @@ - import org.lwjgl.opengl.ARBOcclusionQuery; - import org.lwjgl.opengl.GL11; +@@ -517,8 +517,10 @@ -+import net.minecraftforge.client.IRenderHandler; -+import net.minecraftforge.client.MinecraftForgeClient; -+ - @SideOnly(Side.CLIENT) - public class RenderGlobal implements IWorldAccess - { -@@ -376,8 +379,10 @@ - - public void func_147589_a(EntityLivingBase p_147589_1_, ICamera p_147589_2_, float p_147589_3_) + public void func_180446_a(Entity p_180446_1_, ICamera p_180446_2_, float p_180446_3_) { -+ int pass = MinecraftForgeClient.getRenderPass(); ++ int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass(); if (this.field_72740_G > 0) { + if (pass > 0) return; --this.field_72740_G; } else -@@ -388,9 +393,12 @@ +@@ -529,9 +531,12 @@ this.field_72769_h.field_72984_F.func_76320_a("prepare"); - TileEntityRendererDispatcher.field_147556_a.func_147542_a(this.field_72769_h, this.field_72777_q.func_110434_K(), this.field_72777_q.field_71466_p, this.field_72777_q.field_71451_h, p_147589_3_); - RenderManager.field_78727_a.func_147938_a(this.field_72769_h, this.field_72777_q.func_110434_K(), this.field_72777_q.field_71466_p, this.field_72777_q.field_71451_h, this.field_72777_q.field_147125_j, this.field_72777_q.field_71474_y, p_147589_3_); + TileEntityRendererDispatcher.field_147556_a.func_178470_a(this.field_72769_h, this.field_72777_q.func_110434_K(), this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), p_180446_3_); + this.field_175010_j.func_180597_a(this.field_72769_h, this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), this.field_72777_q.field_147125_j, this.field_72777_q.field_71474_y, p_180446_3_); + if (pass == 0) // no indentation to shrink patch + { this.field_72748_H = 0; this.field_72749_I = 0; this.field_72750_J = 0; + } - EntityLivingBase entitylivingbase1 = this.field_72777_q.field_71451_h; - double d3 = entitylivingbase1.field_70142_S + (entitylivingbase1.field_70165_t - entitylivingbase1.field_70142_S) * (double)p_147589_3_; - double d4 = entitylivingbase1.field_70137_T + (entitylivingbase1.field_70163_u - entitylivingbase1.field_70137_T) * (double)p_147589_3_; -@@ -419,13 +427,17 @@ - this.field_72777_q.field_71460_t.func_78463_b((double)p_147589_3_); + Entity entity1 = this.field_72777_q.func_175606_aa(); + double d3 = entity1.field_70142_S + (entity1.field_70165_t - entity1.field_70142_S) * (double)p_180446_3_; + double d4 = entity1.field_70137_T + (entity1.field_70163_u - entity1.field_70137_T) * (double)p_180446_3_; +@@ -543,13 +548,17 @@ + this.field_72777_q.field_71460_t.func_180436_i(); this.field_72769_h.field_72984_F.func_76318_c("global"); List list = this.field_72769_h.func_72910_y(); -+ if (pass == 0) // no indentation for smaller patch size ++ if (pass == 0) // no indentation to shrink patch + { this.field_72748_H = list.size(); + } int i; - Entity entity; + Entity entity2; for (i = 0; i < this.field_72769_h.field_73007_j.size(); ++i) { - entity = (Entity)this.field_72769_h.field_73007_j.get(i); -+ if (!entity.shouldRenderInPass(pass)) continue; + entity2 = (Entity)this.field_72769_h.field_73007_j.get(i); ++ if (!entity2.shouldRenderInPass(pass)) continue; ++this.field_72749_I; - if (entity.func_145770_h(d0, d1, d2)) -@@ -439,6 +451,7 @@ - for (i = 0; i < list.size(); ++i) - { - entity = (Entity)list.get(i); -+ if (!entity.shouldRenderInPass(pass)) continue; - boolean flag = entity.func_145770_h(d0, d1, d2) && (entity.field_70158_ak || p_147589_2_.func_78546_a(entity.field_70121_D) || entity.field_70153_n == this.field_72777_q.field_71439_g); + if (entity2.func_145770_h(d0, d1, d2)) +@@ -571,6 +580,7 @@ + for (i = 0; i < list.size(); ++i) + { + entity2 = (Entity)list.get(i); ++ if (!entity2.shouldRenderInPass(pass)) continue; + boolean flag = this.field_72777_q.func_175606_aa() instanceof EntityLivingBase && ((EntityLivingBase)this.field_72777_q.func_175606_aa()).func_70608_bn(); + boolean flag1 = entity2.func_145770_h(d0, d1, d2) && (entity2.field_70158_ak || p_180446_2_.func_78546_a(entity2.func_174813_aQ()) || entity2.field_70153_n == this.field_72777_q.field_71439_g) && entity2 instanceof EntityPlayer; - if (!flag && entity instanceof EntityLiving) -@@ -464,7 +477,11 @@ +@@ -605,6 +615,7 @@ + while (iterator2.hasNext()) + { + Entity entity3 = (Entity)iterator2.next(); ++ if (!entity3.shouldRenderInPass(pass)) continue; + boolean flag2 = this.field_175010_j.func_178635_a(entity3, p_180446_2_, d0, d1, d2) || entity3.field_70153_n == this.field_72777_q.field_71439_g; - for (i = 0; i < this.field_147598_a.size(); ++i) - { -- TileEntityRendererDispatcher.field_147556_a.func_147544_a((TileEntity)this.field_147598_a.get(i), p_147589_3_); -+ TileEntity tile = (TileEntity)this.field_147598_a.get(i); -+ if (tile.shouldRenderInPass(pass) && p_147589_2_.func_78546_a(tile.getRenderBoundingBox())) -+ { -+ TileEntityRendererDispatcher.field_147556_a.func_147544_a(tile, p_147589_3_); -+ } + if (flag2) +@@ -640,6 +651,7 @@ + while (iterator1.hasNext()) + { + tileentity = (TileEntity)iterator1.next(); ++ if (!tileentity.shouldRenderInPass(pass) || !p_180446_2_.func_78546_a(tileentity.getRenderBoundingBox())) continue; + TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity, p_180446_3_, -1); + } } +@@ -671,7 +683,7 @@ - this.field_72777_q.field_71460_t.func_78483_a((double)p_147589_3_); -@@ -941,6 +958,12 @@ + Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c(); - public void func_72714_a(float p_72714_1_) +- if (tileentity != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull)) ++ if (tileentity != null && tileentity.shouldRenderInPass(pass) && tileentity.canRenderBreaking() && p_180446_2_.func_78546_a(tileentity.getRenderBoundingBox())) + { + TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity, p_180446_3_, destroyblockprogress.func_73106_e()); + } +@@ -1151,6 +1163,12 @@ + + public void func_174976_a(float p_174976_1_, int p_174976_2_) { -+ IRenderHandler skyProvider = null; -+ if ((skyProvider = this.field_72777_q.field_71441_e.field_73011_w.getSkyRenderer()) != null) ++ net.minecraftforge.client.IRenderHandler renderer = this.field_72769_h.field_73011_w.getSkyRenderer(); ++ if (renderer != null) + { -+ skyProvider.render(p_72714_1_, this.field_72769_h, field_72777_q); ++ renderer.render(p_174976_1_, field_72769_h, field_72777_q); + return; + } - if (this.field_72777_q.field_71441_e.field_73011_w.field_76574_g == 1) + if (this.field_72777_q.field_71441_e.field_73011_w.func_177502_q() == 1) { - GL11.glDisable(GL11.GL_FOG); -@@ -1179,6 +1202,12 @@ + this.func_180448_r(); +@@ -1381,6 +1399,12 @@ - public void func_72718_b(float p_72718_1_) + public void func_180447_b(float p_180447_1_, int p_180447_2_) { -+ IRenderHandler renderer = null; -+ if ((renderer = field_72769_h.field_73011_w.getCloudRenderer()) != null) ++ net.minecraftforge.client.IRenderHandler renderer = this.field_72777_q.field_71441_e.field_73011_w.getCloudRenderer(); ++ if (renderer != null) + { -+ renderer.render(p_72718_1_, field_72769_h, field_72777_q); ++ renderer.render(p_180447_1_, this.field_72777_q.field_71441_e, field_72777_q); + return; + } if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) { if (this.field_72777_q.field_71474_y.field_74347_j) -@@ -1579,6 +1608,11 @@ +@@ -1805,8 +1829,11 @@ + double d4 = (double)blockpos.func_177956_o() - d1; + double d5 = (double)blockpos.func_177952_p() - d2; + Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c(); ++ TileEntity te = this.field_72769_h.func_175625_s(blockpos); ++ boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; ++ if (!hasBreak) hasBreak = te != null && te.canRenderBreaking(); - public void func_72717_a(Tessellator p_72717_1_, EntityPlayer p_72717_2_, float p_72717_3_) - { -+ drawBlockDamageTexture(p_72717_1_, (EntityLivingBase)p_72717_2_, p_72717_3_); -+ } -+ -+ public void drawBlockDamageTexture(Tessellator p_72717_1_, EntityLivingBase p_72717_2_, float p_72717_3_) -+ { - double d0 = p_72717_2_.field_70142_S + (p_72717_2_.field_70165_t - p_72717_2_.field_70142_S) * (double)p_72717_3_; - double d1 = p_72717_2_.field_70137_T + (p_72717_2_.field_70163_u - p_72717_2_.field_70137_T) * (double)p_72717_3_; - double d2 = p_72717_2_.field_70136_U + (p_72717_2_.field_70161_v - p_72717_2_.field_70136_U) * (double)p_72717_3_; -@@ -1798,12 +1832,15 @@ +- if (!(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull)) ++ if (!hasBreak) + { + if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) + { +@@ -1949,13 +1976,16 @@ + if (p_174961_1_ != null) { - ItemRecord itemrecord = ItemRecord.func_150926_b(p_72702_1_); - + ItemRecord itemrecord = ItemRecord.func_150926_b(p_174961_1_); + ResourceLocation resource = null; + if (itemrecord != null) { this.field_72777_q.field_71456_v.func_73833_a(itemrecord.func_150927_i()); -+ resource = itemrecord.getRecordResource(p_72702_1_); ++ resource = itemrecord.getRecordResource(p_174961_1_); } -- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.func_147675_a(new ResourceLocation(p_72702_1_), (float)p_72702_2_, (float)p_72702_3_, (float)p_72702_4_); -+ if (resource == null) resource = new ResourceLocation(p_72702_1_); -+ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.func_147675_a(resource, (float)p_72702_2_, (float)p_72702_3_, (float)p_72702_4_); - this.field_147593_P.put(chunkcoordinates, positionedsoundrecord); +- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.func_147675_a(new ResourceLocation(p_174961_1_), (float)p_174961_2_.func_177958_n(), (float)p_174961_2_.func_177956_o(), (float)p_174961_2_.func_177952_p()); ++ if (resource == null) resource = new ResourceLocation(p_174961_1_); ++ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.func_147675_a(resource, (float)p_174961_2_.func_177958_n(), (float)p_174961_2_.func_177956_o(), (float)p_174961_2_.func_177952_p()); + this.field_147593_P.put(p_174961_2_, positionedsoundrecord); this.field_72777_q.func_147118_V().func_147682_a(positionedsoundrecord); } diff --git a/patches/minecraft/net/minecraft/client/renderer/Tessellator.java.patch b/patches/minecraft/net/minecraft/client/renderer/Tessellator.java.patch deleted file mode 100644 index dbc672fe4b..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/Tessellator.java.patch +++ /dev/null @@ -1,145 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/Tessellator.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/Tessellator.java -@@ -7,6 +7,7 @@ - import java.nio.FloatBuffer; - import java.nio.IntBuffer; - import java.nio.ShortBuffer; -+import java.util.Arrays; - import java.util.PriorityQueue; - import net.minecraft.client.shader.TesselatorVertexState; - import net.minecraft.client.util.QuadComparator; -@@ -15,10 +16,17 @@ - @SideOnly(Side.CLIENT) - public class Tessellator - { -- private ByteBuffer field_78394_d; -- private IntBuffer field_147568_c; -- private FloatBuffer field_147566_d; -- private ShortBuffer field_147567_e; -+ private static int nativeBufferSize = 0x200000; -+ private static int trivertsInBuffer = (nativeBufferSize / 48) * 6; -+ public static boolean renderingWorldRenderer = false; -+ public boolean defaultTexture = false; -+ private int rawBufferSize = 0; -+ public int textureID = 0; -+ -+ private static ByteBuffer field_78394_d = GLAllocation.func_74524_c(nativeBufferSize * 4); -+ private static IntBuffer field_147568_c = field_78394_d.asIntBuffer(); -+ private static FloatBuffer field_147566_d = field_78394_d.asFloatBuffer(); -+ private static ShortBuffer field_147567_e = field_78394_d.asShortBuffer(); - private int[] field_78405_h; - private int field_78406_i; - private double field_78403_j; -@@ -44,14 +52,17 @@ - - private Tessellator(int p_i1250_1_) - { -- this.field_78388_E = p_i1250_1_; -- this.field_78394_d = GLAllocation.func_74524_c(p_i1250_1_ * 4); -- this.field_147568_c = this.field_78394_d.asIntBuffer(); -- this.field_147566_d = this.field_78394_d.asFloatBuffer(); -- this.field_147567_e = this.field_78394_d.asShortBuffer(); -- this.field_78405_h = new int[p_i1250_1_]; - } - -+ public Tessellator() -+ { -+ } -+ -+ static -+ { -+ field_78398_a.defaultTexture = true; -+ } -+ - public int func_78381_a() - { - if (!this.field_78415_z) -@@ -62,12 +73,15 @@ - { - this.field_78415_z = false; - -- if (this.field_78406_i > 0) -+ int offs = 0; -+ while (offs < field_78406_i) - { -+ int vtc = Math.min(field_78406_i - offs, nativeBufferSize >> 5); - this.field_147568_c.clear(); -- this.field_147568_c.put(this.field_78405_h, 0, this.field_147569_p); -+ this.field_147568_c.put(this.field_78405_h, offs * 8, vtc * 8); - this.field_78394_d.position(0); -- this.field_78394_d.limit(this.field_147569_p * 4); -+ this.field_78394_d.limit(vtc * 32); -+ offs += vtc; - - if (this.field_78400_o) - { -@@ -102,7 +116,7 @@ - this.field_147566_d.position(0); - GL11.glVertexPointer(3, 32, this.field_147566_d); - GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); -- GL11.glDrawArrays(this.field_78409_u, 0, this.field_78406_i); -+ GL11.glDrawArrays(this.field_78409_u, 0, vtc); - GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); - - if (this.field_78400_o) -@@ -128,6 +142,12 @@ - } - } - -+ if (rawBufferSize > 0x20000 && field_147569_p < (rawBufferSize << 3)) -+ { -+ rawBufferSize = 0x10000; -+ field_78405_h = new int[rawBufferSize]; -+ } -+ - int i = this.field_147569_p * 4; - this.func_78379_d(); - return i; -@@ -162,6 +182,14 @@ - - public void func_147565_a(TesselatorVertexState p_147565_1_) - { -+ while (p_147565_1_.func_147572_a().length > rawBufferSize && rawBufferSize > 0) -+ { -+ rawBufferSize <<= 1; -+ } -+ if (rawBufferSize > field_78405_h.length) -+ { -+ field_78405_h = new int[rawBufferSize]; -+ } - System.arraycopy(p_147565_1_.func_147572_a(), 0, this.field_78405_h, 0, p_147565_1_.func_147572_a().length); - this.field_147569_p = p_147565_1_.func_147576_b(); - this.field_78406_i = p_147565_1_.func_147575_c(); -@@ -301,6 +329,19 @@ - - public void func_78377_a(double p_78377_1_, double p_78377_3_, double p_78377_5_) - { -+ if (field_147569_p >= rawBufferSize - 32) -+ { -+ if (rawBufferSize == 0) -+ { -+ rawBufferSize = 0x10000; -+ field_78405_h = new int[rawBufferSize]; -+ } -+ else -+ { -+ rawBufferSize *= 2; -+ field_78405_h = Arrays.copyOf(field_78405_h, rawBufferSize); -+ } -+ } - ++this.field_78411_s; - - if (this.field_78400_o) -@@ -329,12 +370,6 @@ - this.field_78405_h[this.field_147569_p + 2] = Float.floatToRawIntBits((float)(p_78377_5_ + this.field_78417_x)); - this.field_147569_p += 8; - ++this.field_78406_i; -- -- if (this.field_78406_i % 4 == 0 && this.field_147569_p >= this.field_78388_E - 32) -- { -- this.func_78381_a(); -- this.field_78415_z = true; -- } - } - - public void func_78378_d(int p_78378_1_) diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch deleted file mode 100644 index db5e237b2c..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch +++ /dev/null @@ -1,85 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/WorldRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/WorldRenderer.java -@@ -28,7 +28,7 @@ - private TesselatorVertexState field_147894_y; - public World field_78924_a; - private int field_78942_y = -1; -- private static Tessellator field_78941_z = Tessellator.field_78398_a; -+ //private static Tessellator tessellator = Tessellator.instance; - public static int field_78922_b; - public int field_78923_c; - public int field_78920_d; -@@ -132,6 +132,7 @@ - { - ++field_78922_b; - RenderBlocks renderblocks = new RenderBlocks(chunkcache); -+ net.minecraftforge.client.ForgeHooksClient.setWorldRendererRB(renderblocks); - this.field_78917_C = 0; - this.field_147894_y = null; - -@@ -157,7 +158,7 @@ - this.func_147890_b(k2); - } - -- if (k2 == 0 && block.func_149716_u()) -+ if (k2 == 0 && block.hasTileEntity(chunkcache.func_72805_g(j3, l2, i3))) - { - TileEntity tileentity = chunkcache.func_147438_o(j3, l2, i3); - -@@ -173,7 +174,9 @@ - { - flag = true; - } -- else if (k3 == k2) -+ -+ if (!block.canRenderInPass(k2)) continue; -+ - { - flag1 |= renderblocks.func_147805_b(block, j3, l2, i3); - -@@ -210,6 +213,7 @@ - break; - } - } -+ net.minecraftforge.client.ForgeHooksClient.setWorldRendererRB(null); - } - - HashSet hashset1 = new HashSet(); -@@ -232,21 +236,23 @@ - GL11.glTranslatef(-8.0F, -8.0F, -8.0F); - GL11.glScalef(f, f, f); - GL11.glTranslatef(8.0F, 8.0F, 8.0F); -- field_78941_z.func_78382_b(); -- field_78941_z.func_78373_b((double)(-this.field_78923_c), (double)(-this.field_78920_d), (double)(-this.field_78921_e)); -+ net.minecraftforge.client.ForgeHooksClient.onPreRenderWorld(this, p_147890_1_); -+ Tessellator.field_78398_a.func_78382_b(); -+ Tessellator.field_78398_a.func_78373_b((double)(-this.field_78923_c), (double)(-this.field_78920_d), (double)(-this.field_78921_e)); - } - - private void func_147891_a(int p_147891_1_, EntityLivingBase p_147891_2_) - { - if (p_147891_1_ == 1 && !this.field_78928_m[p_147891_1_]) - { -- this.field_147894_y = field_78941_z.func_147564_a((float)p_147891_2_.field_70165_t, (float)p_147891_2_.field_70163_u, (float)p_147891_2_.field_70161_v); -+ this.field_147894_y = Tessellator.field_78398_a.func_147564_a((float)p_147891_2_.field_70165_t, (float)p_147891_2_.field_70163_u, (float)p_147891_2_.field_70161_v); - } - -- this.field_78917_C += field_78941_z.func_78381_a(); -+ this.field_78917_C += Tessellator.field_78398_a.func_78381_a(); -+ net.minecraftforge.client.ForgeHooksClient.onPostRenderWorld(this, p_147891_1_); - GL11.glPopMatrix(); - GL11.glEndList(); -- field_78941_z.func_78373_b(0.0D, 0.0D, 0.0D); -+ Tessellator.field_78398_a.func_78373_b(0.0D, 0.0D, 0.0D); - } - - public void func_147889_b(EntityLivingBase p_147889_1_) -@@ -254,7 +260,7 @@ - if (this.field_147894_y != null && !this.field_78928_m[1]) - { - this.func_147890_b(1); -- field_78941_z.func_147565_a(this.field_147894_y); -+ Tessellator.field_78398_a.func_147565_a(this.field_147894_y); - this.func_147891_a(1, p_147889_1_); - } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch new file mode 100644 index 0000000000..d223b064c7 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java +@@ -150,7 +150,7 @@ + visgraph.func_178606_a(mutableblockpos); + } + +- if (block.func_149716_u()) ++ if (block.hasTileEntity(iblockstate)) + { + TileEntity tileentity = regionrendercache.func_175625_s(new BlockPos(mutableblockpos)); + diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch deleted file mode 100644 index 2dbec6b107..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch +++ /dev/null @@ -1,122 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java -@@ -54,11 +54,13 @@ - this.field_82425_h = new ModelBiped(0.5F); - } - -+ @Deprecated //Use the more sensitive version getArmorResource below - public static ResourceLocation func_110857_a(ItemArmor p_110857_0_, int p_110857_1_) - { - return func_110858_a(p_110857_0_, p_110857_1_, (String)null); - } - -+ @Deprecated //Use the more sensitive version getArmorResource below - public static ResourceLocation func_110858_a(ItemArmor p_110858_0_, int p_110858_1_, String p_110858_2_) - { - String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {field_82424_k[p_110858_0_.field_77880_c], Integer.valueOf(p_110858_1_ == 2 ? 2 : 1), p_110858_2_ == null ? "" : String.format("_%s", new Object[]{p_110858_2_})}); -@@ -84,7 +86,7 @@ - if (item instanceof ItemArmor) - { - ItemArmor itemarmor = (ItemArmor)item; -- this.func_110776_a(func_110857_a(itemarmor, p_77032_2_)); -+ this.func_110776_a(getArmorResource(p_77032_1_, itemstack, p_77032_2_, null)); - ModelBiped modelbiped = p_77032_2_ == 2 ? this.field_82425_h : this.field_82423_g; - modelbiped.field_78116_c.field_78806_j = p_77032_2_ == 0; - modelbiped.field_78114_d.field_78806_j = p_77032_2_ == 0; -@@ -93,14 +95,16 @@ - modelbiped.field_78113_g.field_78806_j = p_77032_2_ == 1; - modelbiped.field_78123_h.field_78806_j = p_77032_2_ == 2 || p_77032_2_ == 3; - modelbiped.field_78124_i.field_78806_j = p_77032_2_ == 2 || p_77032_2_ == 3; -+ modelbiped = net.minecraftforge.client.ForgeHooksClient.getArmorModel(p_77032_1_, itemstack, p_77032_2_, modelbiped); - this.func_77042_a(modelbiped); - modelbiped.field_78095_p = this.field_77045_g.field_78095_p; - modelbiped.field_78093_q = this.field_77045_g.field_78093_q; - modelbiped.field_78091_s = this.field_77045_g.field_78091_s; - -- if (itemarmor.func_82812_d() == ItemArmor.ArmorMaterial.CLOTH) -+ //Move out of if to allow for more then just CLOTH to have color -+ int j = itemarmor.func_82814_b(itemstack); -+ if (j != -1) - { -- int j = itemarmor.func_82814_b(itemstack); - float f1 = (float)(j >> 16 & 255) / 255.0F; - float f2 = (float)(j >> 8 & 255) / 255.0F; - float f3 = (float)(j & 255) / 255.0F; -@@ -138,7 +142,7 @@ - - if (item instanceof ItemArmor) - { -- this.func_110776_a(func_110858_a((ItemArmor)item, p_82408_2_, "overlay")); -+ this.func_110776_a(getArmorResource(p_82408_1_, itemstack, p_82408_2_, "overlay")); - float f1 = 1.0F; - GL11.glColor3f(1.0F, 1.0F, 1.0F); - } -@@ -189,9 +193,12 @@ - this.field_77071_a.field_78116_c.func_78794_c(0.0625F); - item = itemstack1.func_77973_b(); - -+ net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient.getItemRenderer(itemstack1, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED); -+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack1, net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D)); -+ - if (item instanceof ItemBlock) - { -- if (RenderBlocks.func_147739_a(Block.func_149634_a(item).func_149645_b())) -+ if (is3D || RenderBlocks.func_147739_a(Block.func_149634_a(item).func_149645_b())) - { - f1 = 0.625F; - GL11.glTranslatef(0.0F, -0.25F, 0.0F); -@@ -243,7 +250,10 @@ - this.field_77071_a.field_78112_f.func_78794_c(0.0625F); - GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F); - -- if (item instanceof ItemBlock && RenderBlocks.func_147739_a(Block.func_149634_a(item).func_149645_b())) -+ net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient.getItemRenderer(itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED); -+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack, net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D)); -+ -+ if (item instanceof ItemBlock && (is3D || RenderBlocks.func_147739_a(Block.func_149634_a(item).func_149645_b()))) - { - f1 = 0.5F; - GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); -@@ -292,7 +302,7 @@ - - if (itemstack.func_77973_b().func_77623_v()) - { -- for (i = 0; i <= 1; ++i) -+ for (i = 0; i < itemstack.func_77973_b().getRenderPasses(itemstack.func_77960_j()); ++i) - { - int j = itemstack.func_77973_b().func_82790_a(itemstack, i); - f5 = (float)(j >> 16 & 255) / 255.0F; -@@ -350,4 +360,33 @@ - { - this.func_76986_a((EntityLiving)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } -+ -+ /*=================================== FORGE START =========================================*/ -+ /** -+ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. -+ * -+ * @param entity Entity wearing the armor -+ * @param stack ItemStack for the armor -+ * @param slot Slot ID that the item is in -+ * @param type Subtype, can be null or "overlay" -+ * @return ResourceLocation pointing at the armor's texture -+ */ -+ public static ResourceLocation getArmorResource(Entity entity, ItemStack stack, int slot, String type) -+ { -+ ItemArmor item = (ItemArmor)stack.func_77973_b(); -+ String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", -+ field_82424_k[item.field_77880_c], (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); -+ -+ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); -+ ResourceLocation resourcelocation = (ResourceLocation)field_110859_k.get(s1); -+ -+ if (resourcelocation == null) -+ { -+ resourcelocation = new ResourceLocation(s1); -+ field_110859_k.put(s1, resourcelocation); -+ } -+ -+ return resourcelocation; -+ } -+ /*=================================== FORGE END ===========================================*/ - } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch new file mode 100644 index 0000000000..bad096c41a --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch @@ -0,0 +1,67 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java +@@ -42,7 +42,7 @@ + boolean flag = p_177077_9_.func_177556_c(); + int i = this.func_177078_a(itemstack); + float f1 = 0.25F; +- float f2 = MathHelper.func_76126_a(((float)p_177077_1_.func_174872_o() + p_177077_8_) / 10.0F + p_177077_1_.field_70290_d) * 0.1F + 0.1F; ++ float f2 = shouldBob() ? MathHelper.func_76126_a(((float)p_177077_1_.func_174872_o() + p_177077_8_) / 10.0F + p_177077_1_.field_70290_d) * 0.1F + 0.1F : 0.0F; + GlStateManager.func_179109_b((float)p_177077_2_, (float)p_177077_4_ + f2 + 0.25F, (float)p_177077_6_); + float f3; + +@@ -109,6 +109,9 @@ + IBakedModel ibakedmodel = this.field_177080_a.func_175037_a().func_178089_a(itemstack); + int i = this.func_177077_a(p_177075_1_, p_177075_2_, p_177075_4_, p_177075_6_, p_177075_9_, ibakedmodel); + ++ // Forge: Call to IItemRenderer, For now Its disabled. ++ //i = net.minecraftforge.client.ForgeHooksClient.renderEntityItem(p_177075_1_, itemstack, this.field_177079_e, this.renderManager.renderEngine, i); ++ + for (int j = 0; j < i; ++j) + { + if (ibakedmodel.func_177556_c()) +@@ -129,8 +132,19 @@ + } + else + { ++ GlStateManager.func_179094_E(); ++ // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug... ++ if (j > 0 && shouldSpreadItems()) ++ { ++ float f2 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; ++ float f3 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; ++ float f4 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; ++ GlStateManager.func_179109_b(f2, f3, 0.046875F); ++ } + this.field_177080_a.func_180454_a(itemstack, ibakedmodel); ++ if (!shouldSpreadItems()) + GlStateManager.func_179109_b(0.0F, 0.0F, 0.046875F); ++ GlStateManager.func_179121_F(); + } + } + +@@ -161,4 +175,25 @@ + { + this.func_177075_a((EntityItem)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + } ++ ++ /*==================================== FORGE START ===========================================*/ ++ ++ /** ++ * Items should spread out when rendered in 3d? ++ * @return ++ */ ++ public boolean shouldSpreadItems() ++ { ++ return true; ++ } ++ ++ /** ++ * Items should have a bob effect ++ * @return ++ */ ++ public boolean shouldBob() ++ { ++ return true; ++ } ++ /*==================================== FORGE END =============================================*/ + } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch index c1a6d7b3bc..321f6b1464 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -1,332 +1,57 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java -@@ -18,6 +18,7 @@ - import net.minecraft.crash.CrashReportCategory; - import net.minecraft.entity.Entity; - import net.minecraft.entity.item.EntityItem; -+import net.minecraft.item.Item; - import net.minecraft.item.ItemBlock; - import net.minecraft.item.ItemCloth; - import net.minecraft.item.ItemStack; -@@ -28,6 +29,8 @@ - import org.lwjgl.opengl.GL11; - import org.lwjgl.opengl.GL12; - -+import net.minecraftforge.client.ForgeHooksClient; -+ - @SideOnly(Side.CLIENT) - public class RenderItem extends Render - { -@@ -55,7 +58,7 @@ - TextureUtil.func_152777_a(false, false, 1.0F); - this.field_77025_h.setSeed(187L); - GL11.glPushMatrix(); -- float f2 = MathHelper.func_76126_a(((float)p_76986_1_.field_70292_b + p_76986_9_) / 10.0F + p_76986_1_.field_70290_d) * 0.1F + 0.1F; -+ float f2 = shouldBob() ? MathHelper.func_76126_a(((float)p_76986_1_.field_70292_b + p_76986_9_) / 10.0F + p_76986_1_.field_70290_d) * 0.1F + 0.1F : 0F; - float f3 = (((float)p_76986_1_.field_70292_b + p_76986_9_) / 20.0F + p_76986_1_.field_70290_d) * (180F / (float)Math.PI); - byte b0 = 1; - -@@ -79,12 +82,19 @@ - b0 = 5; - } - -+ b0 = getMiniBlockCount(itemstack, b0); -+ - GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_ + f2, (float)p_76986_6_); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - float f6; - float f7; - int k; - -+ if (ForgeHooksClient.renderEntityItem(p_76986_1_, itemstack, f2, f3, field_77025_h, field_76990_c.field_78724_e, field_147909_c, b0)) -+ { -+ ; -+ } -+ else // Code Style break here to prevent the patch from editing this line - if (itemstack.func_94608_d() == 0 && itemstack.func_77973_b() instanceof ItemBlock && RenderBlocks.func_147739_a(Block.func_149634_a(itemstack.func_77973_b()).func_149645_b())) - { - Block block = Block.func_149634_a(itemstack.func_77973_b()); -@@ -139,7 +149,7 @@ - { - float f5; - -- if (itemstack.func_94608_d() == 1 && itemstack.func_77973_b().func_77623_v()) -+ if (/*itemstack.getItemSpriteNumber() == 1 &&*/ itemstack.func_77973_b().func_77623_v()) - { - if (field_82407_g) - { -@@ -151,10 +161,10 @@ - GL11.glScalef(0.5F, 0.5F, 0.5F); - } - -- for (int j = 0; j <= 1; ++j) -+ for (int j = 0; j < itemstack.func_77973_b().getRenderPasses(itemstack.func_77960_j()); ++j) - { - this.field_77025_h.setSeed(187L); -- IIcon iicon1 = itemstack.func_77973_b().func_77618_c(itemstack.func_77960_j(), j); -+ IIcon iicon1 = itemstack.func_77973_b().getIcon(itemstack, j); - - if (this.field_77024_a) - { -@@ -163,11 +173,11 @@ - f6 = (float)(k >> 8 & 255) / 255.0F; - f7 = (float)(k & 255) / 255.0F; - GL11.glColor4f(f5, f6, f7, 1.0F); -- this.func_77020_a(p_76986_1_, iicon1, b0, p_76986_9_, f5, f6, f7); -+ this.renderDroppedItem(p_76986_1_, iicon1, b0, p_76986_9_, f5, f6, f7, j); - } - else - { -- this.func_77020_a(p_76986_1_, iicon1, b0, p_76986_9_, 1.0F, 1.0F, 1.0F); -+ this.renderDroppedItem(p_76986_1_, iicon1, b0, p_76986_9_, 1.0F, 1.0F, 1.0F, j); - } - } +@@ -302,6 +302,10 @@ + modelresourcelocation = new ModelResourceLocation("bow_pulling_0", "inventory"); } -@@ -226,6 +236,11 @@ - - private void func_77020_a(EntityItem p_77020_1_, IIcon p_77020_2_, int p_77020_3_, float p_77020_4_, float p_77020_5_, float p_77020_6_, float p_77020_7_) - { -+ this.renderDroppedItem(p_77020_1_, p_77020_2_, p_77020_3_, p_77020_4_, p_77020_5_, p_77020_6_, p_77020_7_, 0); -+ } -+ -+ private void renderDroppedItem(EntityItem p_77020_1_, IIcon p_77020_2_, int p_77020_3_, float p_77020_4_, float p_77020_5_, float p_77020_6_, float p_77020_7_, int pass) -+ { - Tessellator tessellator = Tessellator.field_78398_a; - - if (p_77020_2_ == null) -@@ -280,11 +295,24 @@ - b0 = 4; } - -+ b0 = getMiniItemCount(itemstack, b0); -+ - GL11.glTranslatef(-f7, -f8, -((f9 + f10) * (float)b0 / 2.0F)); - - for (int k = 0; k < b0; ++k) - { -- GL11.glTranslatef(0.0F, 0.0F, f9 + f10); -+ // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug... -+ if (k > 0 && shouldSpreadItems()) -+ { -+ float x = (field_77025_h.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; -+ float y = (field_77025_h.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; -+ float z = (field_77025_h.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; -+ GL11.glTranslatef(x, y, f9 + f10); -+ } -+ else -+ { -+ GL11.glTranslatef(0f, 0f, f9 + f10); -+ } - - if (itemstack.func_94608_d() == 0) - { -@@ -298,7 +326,7 @@ - GL11.glColor4f(p_77020_5_, p_77020_6_, p_77020_7_, 1.0F); - ItemRenderer.func_78439_a(tessellator, f15, f4, f14, f5, ((IIcon)p_77020_2_).func_94211_a(), ((IIcon)p_77020_2_).func_94216_b(), f9); - -- if (itemstack.func_77962_s()) -+ if (itemstack.hasEffect(pass)) - { - GL11.glDepthFunc(GL11.GL_EQUAL); - GL11.glDisable(GL11.GL_LIGHTING); -@@ -366,6 +394,11 @@ - - public void func_77015_a(FontRenderer p_77015_1_, TextureManager p_77015_2_, ItemStack p_77015_3_, int p_77015_4_, int p_77015_5_) - { -+ this.renderItemIntoGUI(p_77015_1_, p_77015_2_, p_77015_3_, p_77015_4_, p_77015_5_, false); -+ } -+ -+ public void renderItemIntoGUI(FontRenderer p_77015_1_, TextureManager p_77015_2_, ItemStack p_77015_3_, int p_77015_4_, int p_77015_5_, boolean renderEffect) -+ { - int k = p_77015_3_.func_77960_j(); - Object object = p_77015_3_.func_77954_c(); - int l; -@@ -442,11 +475,13 @@ - GL11.glColorMask(true, true, true, true); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glEnable(GL11.GL_ALPHA_TEST); -- OpenGlHelper.func_148821_a(770, 771, 1, 0); - -- for (l = 0; l <= 1; ++l) -+ Item item = p_77015_3_.func_77973_b(); -+ for (l = 0; l < item.getRenderPasses(k); ++l) - { -- IIcon iicon = p_77015_3_.func_77973_b().func_77618_c(k, l); -+ OpenGlHelper.func_148821_a(770, 771, 1, 0); -+ p_77015_2_.func_110577_a(item.func_94901_k() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c); -+ IIcon iicon = item.getIcon(p_77015_3_, l); - int i1 = p_77015_3_.func_77973_b().func_82790_a(p_77015_3_, l); - f = (float)(i1 >> 16 & 255) / 255.0F; - float f1 = (float)(i1 >> 8 & 255) / 255.0F; -@@ -457,7 +492,18 @@ - GL11.glColor4f(f, f1, f2, 1.0F); - } - -+ GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure that render states are reset, ad renderEffect can derp them up. -+ GL11.glEnable(GL11.GL_ALPHA_TEST); -+ - this.func_94149_a(p_77015_4_, p_77015_5_, iicon, 16, 16); -+ -+ GL11.glDisable(GL11.GL_ALPHA_TEST); -+ GL11.glEnable(GL11.GL_LIGHTING); -+ -+ if (renderEffect && p_77015_3_.hasEffect(l)) -+ { -+ renderEffect(p_77015_2_, p_77015_4_, p_77015_5_); -+ } - } - - GL11.glEnable(GL11.GL_LIGHTING); -@@ -485,14 +531,27 @@ - GL11.glColor4f(f3, f4, f, 1.0F); - } - -+ GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure that render states are reset, a renderEffect can derp them up. -+ GL11.glEnable(GL11.GL_ALPHA_TEST); -+ GL11.glEnable(GL11.GL_BLEND); -+ - this.func_94149_a(p_77015_4_, p_77015_5_, (IIcon)object, 16, 16); -+ - GL11.glEnable(GL11.GL_LIGHTING); -+ GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glDisable(GL11.GL_BLEND); -+ -+ if (renderEffect && p_77015_3_.hasEffect(0)) ++ else + { -+ renderEffect(p_77015_2_, p_77015_4_, p_77015_5_); ++ modelresourcelocation = item.getModel(p_175049_1_, entityplayer, p_175049_1_.func_77988_m() - entityplayer.func_71052_bv()); + } -+ GL11.glEnable(GL11.GL_LIGHTING); - } - GL11.glEnable(GL11.GL_CULL_FACE); - } - -+ @SuppressWarnings("unused") - public void func_82406_b(FontRenderer p_82406_1_, TextureManager p_82406_2_, final ItemStack p_82406_3_, int p_82406_4_, int p_82406_5_) - { - if (p_82406_3_ != null) -@@ -501,7 +560,10 @@ - - try + if (modelresourcelocation != null) { -- this.func_77015_a(p_82406_1_, p_82406_2_, p_82406_3_, p_82406_4_, p_82406_5_); -+ if (!ForgeHooksClient.renderInventoryItem(this.field_147909_c, p_82406_2_, p_82406_3_, field_77024_a, field_77023_b, (float)p_82406_4_, (float)p_82406_5_)) -+ { -+ this.renderItemIntoGUI(p_82406_1_, p_82406_2_, p_82406_3_, p_82406_4_, p_82406_5_, true); -+ } - } - catch (Throwable throwable) - { -@@ -542,7 +604,8 @@ - throw new ReportedException(crashreport); +@@ -485,10 +489,11 @@ + GlStateManager.func_179126_j(); } -- if (p_82406_3_.func_77962_s()) -+ // Forge: Bugfix, Move this to a per-render pass, modders must handle themselves -+ if (false && p_82406_3_.func_77962_s()) +- if (p_180453_2_.func_77951_h()) ++ if (p_180453_2_.func_77973_b().showDurabilityBar(p_180453_2_)) { - GL11.glDepthFunc(GL11.GL_EQUAL); - GL11.glDisable(GL11.GL_LIGHTING); -@@ -562,6 +625,23 @@ - } - } - -+ public void renderEffect(TextureManager manager, int x, int y) -+ { -+ GL11.glDepthFunc(GL11.GL_EQUAL); -+ GL11.glDisable(GL11.GL_LIGHTING); -+ GL11.glDepthMask(false); -+ manager.func_110577_a(field_110798_h); -+ GL11.glEnable(GL11.GL_ALPHA_TEST); -+ GL11.glEnable(GL11.GL_BLEND); -+ GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); -+ this.func_77018_a(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20); -+ GL11.glDepthMask(true); -+ GL11.glDisable(GL11.GL_BLEND); -+ GL11.glDisable(GL11.GL_ALPHA_TEST); -+ GL11.glEnable(GL11.GL_LIGHTING); -+ GL11.glDepthFunc(GL11.GL_LEQUAL); -+ } -+ - private void func_77018_a(int p_77018_1_, int p_77018_2_, int p_77018_3_, int p_77018_4_, int p_77018_5_) - { - for (int j1 = 0; j1 < 2; ++j1) -@@ -608,10 +688,11 @@ - GL11.glEnable(GL11.GL_DEPTH_TEST); - } - -- if (p_94148_3_.func_77951_h()) -+ if (p_94148_3_.func_77973_b().showDurabilityBar(p_94148_3_)) - { -- int j1 = (int)Math.round(13.0D - (double)p_94148_3_.func_77952_i() * 13.0D / (double)p_94148_3_.func_77958_k()); -- int k = (int)Math.round(255.0D - (double)p_94148_3_.func_77952_i() * 255.0D / (double)p_94148_3_.func_77958_k()); -+ double health = p_94148_3_.func_77973_b().getDurabilityForDisplay(p_94148_3_); +- int j1 = (int)Math.round(13.0D - (double)p_180453_2_.func_77952_i() * 13.0D / (double)p_180453_2_.func_77958_k()); +- int k = (int)Math.round(255.0D - (double)p_180453_2_.func_77952_i() * 255.0D / (double)p_180453_2_.func_77958_k()); ++ double health = p_180453_2_.func_77973_b().getDurabilityForDisplay(p_180453_2_); + int j1 = (int)Math.round(13.0D - health * 13.0D); + int k = (int)Math.round(255.0D - health * 255.0D); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDisable(GL11.GL_TEXTURE_2D); -@@ -623,7 +704,7 @@ - this.func_77017_a(tessellator, p_94148_4_ + 2, p_94148_5_ + 13, 13, 2, 0); - this.func_77017_a(tessellator, p_94148_4_ + 2, p_94148_5_ + 13, 12, 1, i1); - this.func_77017_a(tessellator, p_94148_4_ + 2, p_94148_5_ + 13, j1, 1, l); -- GL11.glEnable(GL11.GL_BLEND); -+ //GL11.glEnable(GL11.GL_BLEND); // Forge: Disable Bled because it screws with a lot of things down the line. - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glEnable(GL11.GL_LIGHTING); -@@ -664,4 +745,54 @@ + GlStateManager.func_179140_f(); + GlStateManager.func_179097_i(); + GlStateManager.func_179090_x(); +@@ -501,7 +506,7 @@ + this.func_175044_a(worldrenderer, p_180453_3_ + 2, p_180453_4_ + 13, 13, 2, 0); + this.func_175044_a(worldrenderer, p_180453_3_ + 2, p_180453_4_ + 13, 12, 1, i1); + this.func_175044_a(worldrenderer, p_180453_3_ + 2, p_180453_4_ + 13, j1, 1, l); +- GlStateManager.func_179147_l(); ++ //GlStateManager.enableBlend(); // Forge: Disable Bled because it screws with a lot of things down the line. + GlStateManager.func_179141_d(); + GlStateManager.func_179098_w(); + GlStateManager.func_179145_e(); +@@ -1078,6 +1083,19 @@ { - this.func_76986_a((EntityItem)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + this.field_175059_m.func_178085_b(); } -+ -+ /*==================================== FORGE START ===========================================*/ -+ -+ /** -+ * Items should spread out when rendered in 3d? -+ * @return -+ */ -+ public boolean shouldSpreadItems() -+ { -+ return true; -+ } -+ -+ /** -+ * Items should have a bob effect -+ * @return -+ */ -+ public boolean shouldBob() -+ { -+ return true; -+ } -+ -+ public byte getMiniBlockCount(ItemStack stack, byte original) -+ { -+ return original; -+ } -+ -+ /** -+ * Allows for a subclass to override how many rendered items appear in a -+ * "mini item 3d stack" -+ * @param stack The item stack -+ * @param original The default amount vanilla would use -+ * @return -+ */ -+ public byte getMiniItemCount(ItemStack stack, byte original) -+ { -+ return original; -+ } -+ ++ /*==================================== FORGE START ===========================================* / + private static RenderItem instance; + /** + * Returns a single lazy loaded instance of RenderItem, for use in mods who + * don't care about the interaction of other objects on the current state of the RenderItem they are using. + * @return A global instance of RenderItem -+ */ ++ * / + public static RenderItem getInstance() + { + if (instance == null) instance = new RenderItem(); + return instance; + } + /*==================================== FORGE END =============================================*/ - } + + @SideOnly(Side.CLIENT) + diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch index c23b896d0f..1ab103657f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -1,19 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -@@ -212,11 +212,13 @@ - if (p_147938_4_.func_70608_bn()) - { - Block block = p_147938_1_.func_147439_a(MathHelper.func_76128_c(p_147938_4_.field_70165_t), MathHelper.func_76128_c(p_147938_4_.field_70163_u), MathHelper.func_76128_c(p_147938_4_.field_70161_v)); -+ int x = MathHelper.func_76128_c(p_147938_4_.field_70165_t); -+ int y = MathHelper.func_76128_c(p_147938_4_.field_70163_u); -+ int z = MathHelper.func_76128_c(p_147938_4_.field_70161_v); +@@ -241,9 +241,9 @@ + IBlockState iblockstate = p_180597_1_.func_180495_p(new BlockPos(p_180597_3_)); + Block block = iblockstate.func_177230_c(); - if (block == Blocks.field_150324_C) -+ if (block.isBed(p_147938_1_, x, y, z, p_147938_4_)) ++ if (block.isBed(p_180597_1_, new BlockPos(p_180597_3_), (EntityLivingBase)p_180597_3_)) { -- int i = p_147938_1_.func_72805_g(MathHelper.func_76128_c(p_147938_4_.field_70165_t), MathHelper.func_76128_c(p_147938_4_.field_70163_u), MathHelper.func_76128_c(p_147938_4_.field_70161_v)); -- int j = i & 3; -+ int j = block.getBedDirection(p_147938_1_, x, y, z); - this.field_78735_i = (float)(j * 90 + 180); +- int i = ((EnumFacing)iblockstate.func_177229_b(BlockBed.field_176387_N)).func_176736_b(); ++ int i = block.getBedDirection(p_180597_1_, new BlockPos(p_180597_3_)).func_176736_b(); + this.field_78735_i = (float)(i * 90 + 180); this.field_78732_j = 0.0F; } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch deleted file mode 100644 index d98717b08d..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ /dev/null @@ -1,143 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -@@ -50,6 +50,13 @@ - { - ItemStack itemstack = p_77032_1_.field_71071_by.func_70440_f(3 - p_77032_2_); - -+ net.minecraftforge.client.event.RenderPlayerEvent.SetArmorModel event = new net.minecraftforge.client.event.RenderPlayerEvent.SetArmorModel(p_77032_1_, this, 3 - p_77032_2_, p_77032_3_, itemstack); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.result != -1) -+ { -+ return event.result; -+ } -+ - if (itemstack != null) - { - Item item = itemstack.func_77973_b(); -@@ -57,7 +64,7 @@ - if (item instanceof ItemArmor) - { - ItemArmor itemarmor = (ItemArmor)item; -- this.func_110776_a(RenderBiped.func_110857_a(itemarmor, p_77032_2_)); -+ this.func_110776_a(RenderBiped.getArmorResource(p_77032_1_, itemstack, p_77032_2_, null)); - ModelBiped modelbiped = p_77032_2_ == 2 ? this.field_77111_i : this.field_77108_b; - modelbiped.field_78116_c.field_78806_j = p_77032_2_ == 0; - modelbiped.field_78114_d.field_78806_j = p_77032_2_ == 0; -@@ -66,14 +73,16 @@ - modelbiped.field_78113_g.field_78806_j = p_77032_2_ == 1; - modelbiped.field_78123_h.field_78806_j = p_77032_2_ == 2 || p_77032_2_ == 3; - modelbiped.field_78124_i.field_78806_j = p_77032_2_ == 2 || p_77032_2_ == 3; -+ modelbiped = net.minecraftforge.client.ForgeHooksClient.getArmorModel(p_77032_1_, itemstack, p_77032_2_, modelbiped); - this.func_77042_a(modelbiped); - modelbiped.field_78095_p = this.field_77045_g.field_78095_p; - modelbiped.field_78093_q = this.field_77045_g.field_78093_q; - modelbiped.field_78091_s = this.field_77045_g.field_78091_s; - -- if (itemarmor.func_82812_d() == ItemArmor.ArmorMaterial.CLOTH) -+ //Move outside if to allow for more then just CLOTH -+ int j = itemarmor.func_82814_b(itemstack); -+ if (j != -1) - { -- int j = itemarmor.func_82814_b(itemstack); - float f1 = (float)(j >> 16 & 255) / 255.0F; - float f2 = (float)(j >> 8 & 255) / 255.0F; - float f3 = (float)(j & 255) / 255.0F; -@@ -111,7 +120,7 @@ - - if (item instanceof ItemArmor) - { -- this.func_110776_a(RenderBiped.func_110858_a((ItemArmor)item, p_82408_2_, "overlay")); -+ this.func_110776_a(RenderBiped.getArmorResource(p_82408_1_, itemstack, p_82408_2_, "overlay")); - GL11.glColor3f(1.0F, 1.0F, 1.0F); - } - } -@@ -119,6 +128,7 @@ - - public void func_76986_a(AbstractClientPlayer p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_76986_1_, this, p_76986_9_))) return; - GL11.glColor3f(1.0F, 1.0F, 1.0F); - ItemStack itemstack = p_76986_1_.field_71071_by.func_70448_g(); - this.field_77108_b.field_78120_m = this.field_77111_i.field_78120_m = this.field_77109_a.field_78120_m = itemstack != null ? 1 : 0; -@@ -149,6 +159,7 @@ - this.field_77108_b.field_78118_o = this.field_77111_i.field_78118_o = this.field_77109_a.field_78118_o = false; - this.field_77108_b.field_78117_n = this.field_77111_i.field_78117_n = this.field_77109_a.field_78117_n = false; - this.field_77108_b.field_78120_m = this.field_77111_i.field_78120_m = this.field_77109_a.field_78120_m = 0; -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_76986_1_, this, p_76986_9_)); - } - - protected ResourceLocation func_110775_a(AbstractClientPlayer p_110775_1_) -@@ -158,12 +169,14 @@ - - protected void func_77029_c(AbstractClientPlayer p_77029_1_, float p_77029_2_) - { -+ net.minecraftforge.client.event.RenderPlayerEvent.Specials.Pre event = new net.minecraftforge.client.event.RenderPlayerEvent.Specials.Pre(p_77029_1_, this, p_77029_2_); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; - GL11.glColor3f(1.0F, 1.0F, 1.0F); - super.func_77029_c(p_77029_1_, p_77029_2_); - super.func_85093_e(p_77029_1_, p_77029_2_); - ItemStack itemstack = p_77029_1_.field_71071_by.func_70440_f(3); - -- if (itemstack != null) -+ if (itemstack != null && event.renderHelmet) - { - GL11.glPushMatrix(); - this.field_77109_a.field_78116_c.func_78794_c(0.0625F); -@@ -171,7 +184,10 @@ - - if (itemstack.func_77973_b() instanceof ItemBlock) - { -- if (RenderBlocks.func_147739_a(Block.func_149634_a(itemstack.func_77973_b()).func_149645_b())) -+ net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient.getItemRenderer(itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED); -+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack, net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D)); -+ -+ if (is3D || RenderBlocks.func_147739_a(Block.func_149634_a(itemstack.func_77973_b()).func_149645_b())) - { - f1 = 0.625F; - GL11.glTranslatef(0.0F, -0.25F, 0.0F); -@@ -232,6 +248,7 @@ - } - - boolean flag = p_77029_1_.func_152122_n(); -+ flag = event.renderCape && flag; - float f4; - - if (flag && !p_77029_1_.func_82150_aj() && !p_77029_1_.func_82238_cc()) -@@ -283,7 +300,7 @@ - - ItemStack itemstack1 = p_77029_1_.field_71071_by.func_70448_g(); - -- if (itemstack1 != null) -+ if (itemstack1 != null && event.renderItem) - { - GL11.glPushMatrix(); - this.field_77109_a.field_78112_f.func_78794_c(0.0625F); -@@ -301,7 +318,10 @@ - enumaction = itemstack1.func_77975_n(); - } - -- if (itemstack1.func_77973_b() instanceof ItemBlock && RenderBlocks.func_147739_a(Block.func_149634_a(itemstack1.func_77973_b()).func_149645_b())) -+ net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient.getItemRenderer(itemstack1, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED); -+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack1, net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D)); -+ -+ if (is3D || itemstack1.func_77973_b() instanceof ItemBlock && RenderBlocks.func_147739_a(Block.func_149634_a(itemstack1.func_77973_b()).func_149645_b())) - { - f2 = 0.5F; - GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); -@@ -358,7 +378,7 @@ - - if (itemstack1.func_77973_b().func_77623_v()) - { -- for (k = 0; k <= 1; ++k) -+ for (k = 0; k < itemstack1.func_77973_b().getRenderPasses(itemstack1.func_77960_j()); ++k) - { - int i = itemstack1.func_77973_b().func_82790_a(itemstack1, k); - f12 = (float)(i >> 16 & 255) / 255.0F; -@@ -380,6 +400,7 @@ - - GL11.glPopMatrix(); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Specials.Post(p_77029_1_, this, p_77029_2_)); - } - - protected void func_77041_b(AbstractClientPlayer p_77041_1_, float p_77041_2_) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch deleted file mode 100644 index 3a7a58bdbc..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java -@@ -13,6 +13,10 @@ - import net.minecraft.item.ItemStack; - import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; -+import net.minecraftforge.client.IItemRenderer; -+import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*; -+import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*; -+import net.minecraftforge.client.MinecraftForgeClient; - - @SideOnly(Side.CLIENT) - public class RenderSnowMan extends RenderLiving -@@ -38,7 +42,10 @@ - GL11.glPushMatrix(); - this.field_77094_a.field_78195_c.func_78794_c(0.0625F); - -- if (RenderBlocks.func_147739_a(Block.func_149634_a(itemstack.func_77973_b()).func_149645_b())) -+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED); -+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D)); -+ -+ if (is3D || RenderBlocks.func_147739_a(Block.func_149634_a(itemstack.func_77973_b()).func_149645_b())) - { - float f1 = 0.625F; - GL11.glTranslatef(0.0F, -0.34375F, 0.0F); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch index a0a91f6604..8ec1b5cbc1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -1,63 +1,49 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java -@@ -20,6 +20,9 @@ - import net.minecraft.util.ResourceLocation; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -+import net.minecraftforge.client.event.RenderLivingEvent; -+import net.minecraftforge.common.MinecraftForge; -+ - import org.lwjgl.opengl.GL11; - import org.lwjgl.opengl.GL12; - -@@ -32,6 +35,9 @@ - protected ModelBase field_77046_h; +@@ -40,6 +40,9 @@ + protected boolean field_177098_i = false; private static final String __OBFID = "CL_00001012"; + public static float NAME_TAG_RANGE = 64.0f; + public static float NAME_TAG_RANGE_SNEAK = 32.0f; + - public RendererLivingEntity(ModelBase p_i1261_1_, float p_i1261_2_) + public RendererLivingEntity(RenderManager p_i46156_1_, ModelBase p_i46156_2_, float p_i46156_3_) { - this.field_77045_g = p_i1261_1_; -@@ -62,6 +68,7 @@ + super(p_i46156_1_); +@@ -83,6 +86,7 @@ public void func_76986_a(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { -+ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_))) return; - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_CULL_FACE); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_))) return; + GlStateManager.func_179094_E(); + GlStateManager.func_179129_p(); this.field_77045_g.field_78095_p = this.func_77040_d(p_76986_1_, p_76986_9_); -@@ -271,6 +278,7 @@ - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glPopMatrix(); - this.func_77033_b(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_); -+ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_)); +@@ -193,6 +197,7 @@ + { + super.func_76986_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_)); } - protected void func_77036_a(EntityLivingBase p_77036_1_, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float p_77036_7_) -@@ -416,6 +424,7 @@ + protected boolean func_177088_c(EntityLivingBase p_177088_1_) +@@ -472,10 +477,11 @@ - protected void func_77033_b(EntityLivingBase p_77033_1_, double p_77033_2_, double p_77033_4_, double p_77033_6_) + public void func_77033_b(EntityLivingBase p_77033_1_, double p_77033_2_, double p_77033_4_, double p_77033_6_) { -+ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Pre(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_))) return; - GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); - ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_))) return; if (this.func_110813_b(p_77033_1_)) -@@ -423,7 +432,7 @@ - float f = 1.6F; - float f1 = 0.016666668F * f; + { double d3 = p_77033_1_.func_70068_e(this.field_76990_c.field_78734_h); -- float f2 = p_77033_1_.func_70093_af() ? 32.0F : 64.0F; -+ float f2 = p_77033_1_.func_70093_af() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; +- float f = p_77033_1_.func_70093_af() ? 32.0F : 64.0F; ++ float f = p_77033_1_.func_70093_af() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; - if (d3 < (double)(f2 * f2)) + if (d3 < (double)(f * f)) { -@@ -467,6 +476,7 @@ +@@ -522,6 +528,7 @@ } } } -+ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Post(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_)); } protected boolean func_110813_b(EntityLivingBase p_110813_1_) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch new file mode 100644 index 0000000000..652dead4e5 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch @@ -0,0 +1,95 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java +@@ -56,31 +56,32 @@ + ModelBase modelbase = this.func_177175_a(p_177182_9_); + modelbase.func_178686_a(this.field_177190_a.func_177087_b()); + modelbase.func_78086_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_); ++ modelbase = net.minecraftforge.client.ForgeHooksClient.getArmorModel(p_177182_1_, itemstack, p_177182_9_, modelbase); + this.func_177179_a(modelbase, p_177182_9_); + boolean flag = this.func_177180_b(p_177182_9_); +- this.field_177190_a.func_110776_a(this.func_177181_a(itemarmor, flag)); ++ this.field_177190_a.func_110776_a(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, null)); + +- switch (LayerArmorBase.SwitchArmorMaterial.field_178747_a[itemarmor.func_82812_d().ordinal()]) + { +- case 1: +- int j = itemarmor.func_82814_b(itemstack); ++ int j = itemarmor.func_82814_b(itemstack); ++ if (j != -1) //Allow this for anything, not only cloth. ++ { + float f7 = (float)(j >> 16 & 255) / 255.0F; + float f8 = (float)(j >> 8 & 255) / 255.0F; + float f9 = (float)(j & 255) / 255.0F; + GlStateManager.func_179131_c(this.field_177184_f * f7, this.field_177185_g * f8, this.field_177192_h * f9, this.field_177187_e); + modelbase.func_78088_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); +- this.field_177190_a.func_110776_a(this.func_177178_a(itemarmor, flag, "overlay")); +- case 2: +- case 3: +- case 4: +- case 5: ++ this.field_177190_a.func_110776_a(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, "overlay")); ++ } ++ { // Non-cloth + GlStateManager.func_179131_c(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); + modelbase.func_78088_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); +- default: ++ } ++ { // Default, Why is this a switch? there were no breaks. + if (!this.field_177193_i && itemstack.func_77948_v()) + { + this.func_177183_a(p_177182_1_, modelbase, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); + } ++ } + } + } + } +@@ -135,11 +136,13 @@ + GlStateManager.func_179084_k(); + } + ++ @Deprecated //Use the more sensitive version getArmorResource below + private ResourceLocation func_177181_a(ItemArmor p_177181_1_, boolean p_177181_2_) + { + return this.func_177178_a(p_177181_1_, p_177181_2_, (String)null); + } + ++ @Deprecated //Use the more sensitive version getArmorResource below + private ResourceLocation func_177178_a(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) + { + String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.func_82812_d().func_179242_c(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); +@@ -158,6 +161,35 @@ + + protected abstract void func_177179_a(ModelBase p_177179_1_, int p_177179_2_); + ++ /*=================================== FORGE START =========================================*/ ++ /** ++ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. ++ * ++ * @param entity Entity wearing the armor ++ * @param stack ItemStack for the armor ++ * @param slot Slot ID that the item is in ++ * @param type Subtype, can be null or "overlay" ++ * @return ResourceLocation pointing at the armor's texture ++ */ ++ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, int slot, String type) ++ { ++ ItemArmor item = (ItemArmor)stack.func_77973_b(); ++ String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", ++ ((ItemArmor)stack.func_77973_b()).func_82812_d().func_179242_c(), (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); ++ ++ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); ++ ResourceLocation resourcelocation = (ResourceLocation)field_177191_j.get(s1); ++ ++ if (resourcelocation == null) ++ { ++ resourcelocation = new ResourceLocation(s1); ++ field_177191_j.put(s1, resourcelocation); ++ } ++ ++ return resourcelocation; ++ } ++ /*=================================== FORGE END ===========================================*/ ++ + @SideOnly(Side.CLIENT) + + static final class SwitchArmorMaterial diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch index 6b84351f11..8b755ed75d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -1,37 +1,23 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -@@ -8,12 +8,14 @@ - import java.util.Iterator; - import java.util.List; - import java.util.concurrent.Callable; -+import net.minecraft.client.resources.IResourceManager; - import net.minecraft.client.resources.data.AnimationFrame; - import net.minecraft.client.resources.data.AnimationMetadataSection; - import net.minecraft.crash.CrashReport; - import net.minecraft.crash.CrashReportCategory; - import net.minecraft.util.IIcon; - import net.minecraft.util.ReportedException; -+import net.minecraft.util.ResourceLocation; - - @SideOnly(Side.CLIENT) - public class TextureAtlasSprite implements IIcon -@@ -427,4 +429,28 @@ +@@ -410,4 +410,30 @@ { return "TextureAtlasSprite{name=\'" + this.field_110984_i + '\'' + ", frameCount=" + this.field_110976_a.size() + ", rotated=" + this.field_130222_e + ", x=" + this.field_110975_c + ", y=" + this.field_110974_d + ", height=" + this.field_130224_d + ", width=" + this.field_130223_c + ", u0=" + this.field_110979_l + ", u1=" + this.field_110980_m + ", v0=" + this.field_110977_n + ", v1=" + this.field_110978_o + '}'; } + ++ /*===================================== FORGE START =====================================*/ + /** -+ * The result of this function determines is the below 'load' function is called, and the ++ * The result of this function determines is the below 'load' function is called, and the + * default vanilla loading code is bypassed completely. + * @param manager + * @param location + * @return True to use your own custom load code and bypass vanilla loading. + */ -+ public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location) ++ public boolean hasCustomLoader(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location) + { + return false; + } -+ ++ + /** + * Load the specified resource as this sprite's data. + * Returning false from this function will prevent this icon from being stitched onto the master texture. @@ -39,8 +25,9 @@ + * @param location File resource location + * @return False to prevent this Icon from being stitched + */ -+ public boolean load(IResourceManager manager, ResourceLocation location) ++ public boolean load(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location) + { + return true; + } ++ /*===================================== FORGE END ======================================*/ } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index a320f4a8bc..d588e09c77 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -1,30 +1,15 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java -@@ -29,6 +29,7 @@ - import net.minecraft.util.MathHelper; - import net.minecraft.util.ReportedException; - import net.minecraft.util.ResourceLocation; -+import net.minecraftforge.client.ForgeHooksClient; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -@@ -91,11 +92,14 @@ - - public void func_110571_b(IResourceManager p_110571_1_) - { -+ func_110573_f(); //Re-gather list of Icons, allows for addition/removal of blocks/items after this map was initially constructed. -+ - int i = Minecraft.func_71369_N(); - Stitcher stitcher = new Stitcher(i, i, true, 0, this.field_147636_j); - this.field_94252_e.clear(); +@@ -91,6 +91,7 @@ this.field_94258_i.clear(); int j = Integer.MAX_VALUE; -+ ForgeHooksClient.onTextureStitchedPre(this); + int k = 1 << this.field_147636_j; ++ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); Iterator iterator = this.field_110574_e.entrySet().iterator(); - TextureAtlasSprite textureatlassprite; -@@ -106,6 +110,16 @@ - textureatlassprite = (TextureAtlasSprite)entry.getValue(); + while (iterator.hasNext()) +@@ -100,6 +101,16 @@ + ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.func_94215_i()); ResourceLocation resourcelocation1 = this.func_147634_a(resourcelocation, 0); + if (textureatlassprite.hasCustomLoader(p_110571_1_, resourcelocation)) @@ -40,26 +25,19 @@ try { IResource iresource = p_110571_1_.func_110536_a(resourcelocation1); -@@ -274,6 +288,7 @@ - textureatlassprite = (TextureAtlasSprite)iterator2.next(); - textureatlassprite.func_94217_a(this.field_94249_f); +@@ -275,6 +286,9 @@ + textureatlassprite2.func_94217_a(this.field_94249_f); } -+ ForgeHooksClient.onTextureStitchedPost(this); + ++ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); ++ ++ if (!net.minecraftforge.common.ForgeModContainer.disableStitchedFileSaving) + TextureUtil.func_177055_a(this.field_94254_c.replaceAll("/", "_"), this.func_110552_b(), this.field_147636_j, stitcher.func_110935_a(), stitcher.func_110936_b()); } - private ResourceLocation func_147634_a(ResourceLocation p_147634_1_, int p_147634_2_) -@@ -347,7 +362,7 @@ - { - throw new IllegalArgumentException("Name cannot be null!"); - } -- else if (p_94245_1_.indexOf(47) == -1 && p_94245_1_.indexOf(92) == -1) -+ else if (p_94245_1_.indexOf(92) == -1) // Disable backslashes (\) in texture asset paths. - { - Object object = (TextureAtlasSprite)this.field_110574_e.get(p_94245_1_); - -@@ -403,4 +418,37 @@ +@@ -341,4 +355,37 @@ { - this.field_147637_k = p_147632_1_; + return this.field_94249_f; } + + //=================================================================================================== diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch index 1093c0637d..cba0de8461 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java +++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java -@@ -176,6 +176,9 @@ - GL11.glTranslatef(0.16F, -0.16F, 0.0F); - } +@@ -106,6 +106,9 @@ + + GlStateManager.func_179114_b((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F); + net.minecraftforge.client.event.RenderItemInFrameEvent event = new net.minecraftforge.client.event.RenderItemInFrameEvent(p_82402_1_, this); + if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) @@ -10,11 +10,11 @@ if (item == Items.field_151098_aY) { this.field_76990_c.field_78724_e.func_110577_a(field_110789_a); -@@ -244,6 +247,7 @@ - } +@@ -165,6 +168,7 @@ + textureatlassprite.func_94219_l(); } } + } - GL11.glPopMatrix(); - } + GlStateManager.func_179145_e(); + GlStateManager.func_179121_F(); diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java.patch deleted file mode 100644 index c5ccfbcf63..0000000000 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java -@@ -1,5 +1,6 @@ - package net.minecraft.client.renderer.tileentity; - -+import cpw.mods.fml.common.FMLLog; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; - import java.util.Calendar; -@@ -52,7 +53,14 @@ - - if (block instanceof BlockChest && i == 0) - { -+ try -+ { - ((BlockChest)block).func_149954_e(p_147500_1_.func_145831_w(), p_147500_1_.field_145851_c, p_147500_1_.field_145848_d, p_147500_1_.field_145849_e); -+ } -+ catch (ClassCastException e) -+ { -+ FMLLog.severe("Attempted to render a chest at %d, %d, %d that was not a chest", p_147500_1_.field_145851_c, p_147500_1_.field_145848_d, p_147500_1_.field_145849_e); -+ } - i = p_147500_1_.func_145832_p(); - } - diff --git a/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch b/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch new file mode 100644 index 0000000000..c002dd01fb --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/FallbackResourceManager.java ++++ ../src-work/minecraft/net/minecraft/client/resources/FallbackResourceManager.java +@@ -70,6 +70,7 @@ + throw new FileNotFoundException(p_110536_1_.toString()); + } + ++ @SuppressWarnings("resource") + protected InputStream func_177245_a(ResourceLocation p_177245_1_, IResourcePack p_177245_2_) throws IOException + { + InputStream inputstream = p_177245_2_.func_110590_a(p_177245_1_); diff --git a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch index a0449e25aa..b552a439ca 100644 --- a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch +++ b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/client/shader/Framebuffer.java +++ ../src-work/minecraft/net/minecraft/client/shader/Framebuffer.java -@@ -117,8 +117,17 @@ +@@ -119,8 +119,17 @@ if (this.field_147619_e) { OpenGlHelper.func_153176_h(OpenGlHelper.field_153199_f, this.field_147624_h); -+ if (net.minecraftforge.client.MinecraftForgeClient.getStencilBits() == 0) ++ if (!this.stencilEnabled) + { OpenGlHelper.func_153186_a(OpenGlHelper.field_153199_f, 33190, this.field_147622_a, this.field_147620_b); OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, OpenGlHelper.field_153201_h, OpenGlHelper.field_153199_f, this.field_147624_h); @@ -18,3 +18,40 @@ } this.func_147614_f(); +@@ -281,4 +290,36 @@ + GlStateManager.func_179086_m(i); + this.func_147609_e(); + } ++ ++ /*================================ FORGE START ================================================*/ ++ private boolean stencilEnabled = false; ++ /** ++ * Attempts to enabled 8 bits of stencil buffer on this FrameBuffer. ++ * Modders must call this directly to set things up. ++ * This is to prevent the default cause where graphics cards do not support stencil bits. ++ * Modders should check the below 'isStencilEnabled' to check if another modder has already enabled them. ++ * ++ * Note: ++ * As of now the only thing that is checked is if FBOs are supported entirely, in the future ++ * we may expand to check for errors. ++ * ++ * @return True if the FBO was re-initialized with stencil bits. ++ */ ++ public boolean enableStencil() ++ { ++ if (!OpenGlHelper.func_148822_b()) return false; ++ stencilEnabled = true; ++ this.func_147613_a(field_147621_c, field_147618_d); ++ return true; //TODO: Find a way to detect if this failed? ++ } ++ ++ /** ++ * Returns wither or not this FBO has been successfully initialized with stencil bits. ++ * If not, and a modder wishes it to be, they must call enableStencil. ++ */ ++ public boolean isStencilEnabled() ++ { ++ return this.stencilEnabled; ++ } ++ /*================================ FORGE END ================================================*/ + } diff --git a/patches/minecraft/net/minecraft/command/CommandFill.java.patch b/patches/minecraft/net/minecraft/command/CommandFill.java.patch new file mode 100644 index 0000000000..9a592ec08c --- /dev/null +++ b/patches/minecraft/net/minecraft/command/CommandFill.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/command/CommandFill.java ++++ ../src-work/minecraft/net/minecraft/command/CommandFill.java +@@ -52,6 +52,7 @@ + { + i = func_175764_a(p_71515_2_[7], 0, 15); + } ++ IBlockState state = block.func_176203_a(i); + + BlockPos blockpos2 = new BlockPos(Math.min(blockpos.func_177958_n(), blockpos1.func_177958_n()), Math.min(blockpos.func_177956_o(), blockpos1.func_177956_o()), Math.min(blockpos.func_177952_p(), blockpos1.func_177952_p())); + BlockPos blockpos3 = new BlockPos(Math.max(blockpos.func_177958_n(), blockpos1.func_177958_n()), Math.max(blockpos.func_177956_o(), blockpos1.func_177956_o()), Math.max(blockpos.func_177952_p(), blockpos1.func_177952_p())); +@@ -79,7 +80,7 @@ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + +- if (p_71515_2_.length >= 10 && block.func_149716_u()) ++ if (p_71515_2_.length >= 10 && block.hasTileEntity(state)) + { + String s = func_147178_a(p_71515_1_, p_71515_2_, 9).func_150260_c(); + +@@ -121,7 +122,7 @@ + continue; + } + } +- else if (p_71515_2_[8].equals("replace") && !block.func_149716_u()) ++ else if (p_71515_2_[8].equals("replace") && !block.hasTileEntity(state)) + { + if (p_71515_2_.length > 9) + { diff --git a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch index 78f0141792..0d3e80726c 100644 --- a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch @@ -1,29 +1,19 @@ --- ../src-base/minecraft/net/minecraft/command/CommandHandler.java +++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java -@@ -14,6 +14,9 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.CommandEvent; -+ - public class CommandHandler implements ICommandManager - { - private static final Logger field_147175_a = LogManager.getLogger(); -@@ -47,6 +50,16 @@ - - if (icommand.func_71519_b(p_71556_1_)) - { -+ CommandEvent event = new CommandEvent(icommand, p_71556_1_, astring); -+ if (MinecraftForge.EVENT_BUS.post(event)) +@@ -48,6 +48,16 @@ + } + else if (icommand.func_71519_b(p_71556_1_)) + { ++ net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(icommand, p_71556_1_, astring); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) ++ { ++ if (event.exception != null) + { -+ if (event.exception != null) -+ { -+ throw event.exception; -+ } -+ return 1; ++ com.google.common.base.Throwables.propagateIfPossible(event.exception); + } ++ return 1; ++ } + - if (i > -1) - { - EntityPlayerMP[] aentityplayermp = PlayerSelector.func_82380_c(p_71556_1_, astring[i]); + if (i > -1) + { + List list = PlayerSelector.func_179656_b(p_71556_1_, astring[i], Entity.class); diff --git a/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch b/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch new file mode 100644 index 0000000000..8ef370f35f --- /dev/null +++ b/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/command/server/CommandSetBlock.java ++++ ../src-work/minecraft/net/minecraft/command/server/CommandSetBlock.java +@@ -54,6 +54,8 @@ + i = func_175764_a(p_71515_2_[4], 0, 15); + } + ++ IBlockState state = block.func_176203_a(i); ++ + World world = p_71515_1_.func_130014_f_(); + + if (!world.func_175667_e(blockpos)) +@@ -65,7 +67,7 @@ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + +- if (p_71515_2_.length >= 7 && block.func_149716_u()) ++ if (p_71515_2_.length >= 7 && block.hasTileEntity(state)) + { + String s = func_147178_a(p_71515_1_, p_71515_2_, 6).func_150260_c(); + diff --git a/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch b/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch new file mode 100644 index 0000000000..0542a21e8f --- /dev/null +++ b/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/command/server/CommandTestForBlock.java ++++ ../src-work/minecraft/net/minecraft/command/server/CommandTestForBlock.java +@@ -74,7 +74,7 @@ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + +- if (p_71515_2_.length >= 6 && block.func_149716_u()) ++ if (p_71515_2_.length >= 6 && block.hasTileEntity(block.func_176203_a(i))) + { + String s = func_147178_a(p_71515_1_, p_71515_2_, 5).func_150260_c(); + diff --git a/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch index 2294ae87a3..9deb81cc3a 100644 --- a/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch +++ b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/crash/CrashReportCategory.java +++ ../src-work/minecraft/net/minecraft/crash/CrashReportCategory.java -@@ -127,8 +127,11 @@ +@@ -128,8 +128,11 @@ } else { diff --git a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch index 5cf367dec8..5e24561f75 100644 --- a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch +++ b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch @@ -1,12 +1,12 @@ --- ../src-base/minecraft/net/minecraft/creativetab/CreativeTabs.java +++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java -@@ -138,8 +138,22 @@ +@@ -139,8 +139,22 @@ private ItemStack field_151245_t; private static final String __OBFID = "CL_00000005"; -+ public CreativeTabs(String lable) ++ public CreativeTabs(String label) + { -+ this(getNextID(), lable); ++ this(getNextID(), label); + } + public CreativeTabs(int p_i1853_1_, String p_i1853_2_) @@ -23,7 +23,7 @@ this.field_78033_n = p_i1853_1_; this.field_78034_o = p_i1853_2_; field_78032_a[p_i1853_1_] = this; -@@ -222,12 +236,20 @@ +@@ -223,12 +237,20 @@ @SideOnly(Side.CLIENT) public int func_78020_k() { @@ -44,28 +44,27 @@ return this.field_78033_n < 6; } -@@ -278,10 +300,18 @@ +@@ -278,10 +300,17 @@ + while (iterator.hasNext()) { Item item = (Item)iterator.next(); ++ if (item == null) ++ { ++ continue; ++ } - if (item != null && item.func_77640_w() == this) -+ if (item == null) ++ for (CreativeTabs tab : item.getCreativeTabs()) { - item.func_150895_a(item, this, p_78018_1_); -+ continue; - } -+ -+ for (CreativeTabs tab : item.getCreativeTabs()) -+ { + if (tab == this) + { + item.func_150895_a(item, this, p_78018_1_); + } -+ } + } } - if (this.func_111225_m() != null) -@@ -319,4 +349,39 @@ +@@ -320,4 +349,39 @@ } } } diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch index 94cf1637be..696fbf0119 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/enchantment/Enchantment.java +++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java -@@ -50,7 +50,7 @@ +@@ -62,7 +62,7 @@ - if (field_77331_b[p_i1926_1_] != null) + if (field_180311_a[p_i45771_1_] != null) { - throw new IllegalArgumentException("Duplicate enchantment id!"); -+ throw new IllegalArgumentException("Duplicate enchantment id! " + this.getClass() + " and " + field_77331_b[p_i1926_1_].getClass() + " Enchantment ID:" + p_i1926_1_); ++ throw new IllegalArgumentException("Duplicate enchantment id! " + this.getClass() + " and " + field_180311_a[p_i45771_1_].getClass() + " Enchantment ID:" + p_i45771_1_); } else { -@@ -124,6 +124,45 @@ +@@ -156,6 +156,45 @@ public void func_151367_b(EntityLivingBase p_151367_1_, Entity p_151367_2_, int p_151367_3_) {} @@ -35,7 +35,7 @@ + try + { + net.minecraftforge.common.util.EnumHelper.setFailsafeFieldValue(bookSetter, null, -+ com.google.common.collect.ObjectArrays.concat(field_92090_c, enchantment)); ++ com.google.common.collect.ObjectArrays.concat(field_77331_b, enchantment)); + } + catch (Exception e) + { @@ -54,4 +54,4 @@ + static { - ArrayList var0 = new ArrayList(); + ArrayList var0 = Lists.newArrayList(); diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index 242648eb0e..b1b56a5d50 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java +++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java -@@ -293,7 +293,7 @@ +@@ -308,7 +308,7 @@ public static int func_77514_a(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) { Item item = p_77514_3_.func_77973_b(); @@ -9,7 +9,7 @@ if (k <= 0) { -@@ -346,7 +346,7 @@ +@@ -361,7 +361,7 @@ public static List func_77513_b(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_) { Item item = p_77513_1_.func_77973_b(); @@ -18,7 +18,7 @@ if (j <= 0) { -@@ -435,7 +435,8 @@ +@@ -450,7 +450,8 @@ { Enchantment enchantment = aenchantment[k]; diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index 82cb0ddeae..537f4f47af 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -1,154 +1,78 @@ --- ../src-base/minecraft/net/minecraft/entity/Entity.java +++ ../src-work/minecraft/net/minecraft/entity/Entity.java -@@ -1,7 +1,10 @@ - package net.minecraft.entity; - -+import cpw.mods.fml.common.FMLLog; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.ArrayList; -+import java.util.HashMap; - import java.util.List; - import java.util.Random; - import java.util.UUID; -@@ -13,9 +16,14 @@ - import net.minecraft.crash.CrashReportCategory; - import net.minecraft.enchantment.EnchantmentProtection; - import net.minecraft.entity.effect.EntityLightningBolt; -+import net.minecraft.entity.item.EntityBoat; - import net.minecraft.entity.item.EntityItem; -+import net.minecraft.entity.item.EntityItemFrame; -+import net.minecraft.entity.item.EntityMinecart; -+import net.minecraft.entity.item.EntityPainting; - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.init.Blocks; -+import net.minecraft.init.Items; - import net.minecraft.item.Item; - import net.minecraft.item.ItemStack; - import net.minecraft.nbt.NBTTagCompound; -@@ -30,12 +38,17 @@ - import net.minecraft.util.Direction; - import net.minecraft.util.IChatComponent; - import net.minecraft.util.MathHelper; -+import net.minecraft.util.MovingObjectPosition; - import net.minecraft.util.ReportedException; - import net.minecraft.util.StatCollector; - import net.minecraft.util.Vec3; - import net.minecraft.world.Explosion; - import net.minecraft.world.World; - import net.minecraft.world.WorldServer; -+import net.minecraftforge.common.IExtendedEntityProperties; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.EntityEvent; -+import net.minecraftforge.fluids.IFluidBlock; - - public abstract class Entity - { -@@ -116,7 +129,14 @@ - protected UUID field_96093_i; - public Entity.EnumEntitySize field_70168_am; +@@ -128,6 +128,14 @@ + private final CommandResultStats field_174837_as; private static final String __OBFID = "CL_00001533"; + + /** Forge: Used to store custom data for each entity. */ + private NBTTagCompound customEntityData; + public boolean captureDrops = false; -+ public ArrayList capturedDrops = new ArrayList(); ++ public java.util.ArrayList capturedDrops = new java.util.ArrayList(); + private UUID persistentID; - -+ protected HashMap extendedProperties; ++ ++ protected java.util.HashMap extendedProperties; + public int func_145782_y() { return this.field_145783_c; -@@ -153,6 +173,15 @@ - this.field_70180_af.func_75682_a(0, Byte.valueOf((byte)0)); - this.field_70180_af.func_75682_a(1, Short.valueOf((short)300)); +@@ -171,6 +179,7 @@ + this.field_70180_af.func_75682_a(2, ""); + this.field_70180_af.func_75682_a(4, Byte.valueOf((byte)0)); this.func_70088_a(); -+ -+ extendedProperties = new HashMap(); -+ -+ MinecraftForge.EVENT_BUS.post(new EntityEvent.EntityConstructing(this)); -+ -+ for (IExtendedEntityProperties props : this.extendedProperties.values()) -+ { -+ props.init(this, p_i1582_1_); -+ } ++ extendedProperties = net.minecraftforge.event.ForgeEventFactory.onEntityConstructing(this, p_i1582_1_); } protected abstract void func_70088_a(); -@@ -991,9 +1020,22 @@ +@@ -1010,10 +1019,7 @@ if (block.func_149688_o() == p_70055_1_) { -- float f = BlockLiquid.func_149801_b(this.field_70170_p.func_72805_g(i, j, k)) - 0.11111111F; -- float f1 = (float)(j + 1) - f; -- return d0 < (double)f1; -+ double filled = 1.0f; //If it's not a liquid assume it's a solid block -+ if (block instanceof IFluidBlock) -+ { -+ filled = ((IFluidBlock)block).getFilledPercentage(field_70170_p, i, j, k); -+ } -+ -+ if (filled < 0) -+ { -+ filled *= -1; -+ //filled -= 0.11111111F; //Why this is needed.. not sure... -+ return d0 > (double)(j + (1 - filled)); -+ } -+ else -+ { -+ return d0 < (double)(j + filled); -+ } +- 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 { -@@ -1278,8 +1320,27 @@ - p_70109_1_.func_74768_a("PortalCooldown", this.field_71088_bW); - p_70109_1_.func_74772_a("UUIDMost", this.func_110124_au().getMostSignificantBits()); - p_70109_1_.func_74772_a("UUIDLeast", this.func_110124_au().getLeastSignificantBits()); -- this.func_70014_b(p_70109_1_); -+ if (customEntityData != null) -+ { -+ p_70109_1_.func_74782_a("ForgeData", customEntityData); -+ } +@@ -1378,6 +1384,21 @@ + p_70109_1_.func_74757_a("Silent", this.func_174814_R()); + } -+ for (String identifier : this.extendedProperties.keySet()) -+ { -+ try -+ { -+ IExtendedEntityProperties props = this.extendedProperties.get(identifier); -+ props.saveNBTData(p_70109_1_); -+ } -+ catch (Throwable t) -+ { -+ FMLLog.severe("Failed to save extended properties for %s. This is a mod issue.", identifier); -+ t.printStackTrace(); -+ } -+ } -+ -+ this.func_70014_b(p_70109_1_); -+ - if (this.field_70154_o != null) - { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); -@@ -1345,6 +1406,30 @@ - - this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); - this.func_70101_b(this.field_70177_z, this.field_70125_A); -+ if (p_70020_1_.func_74764_b("ForgeData")) -+ { -+ customEntityData = p_70020_1_.func_74775_l("ForgeData"); -+ } -+ ++ if (customEntityData != null) p_70109_1_.func_74782_a("ForgeData", customEntityData); + for (String identifier : this.extendedProperties.keySet()) + { + try + { -+ IExtendedEntityProperties props = this.extendedProperties.get(identifier); ++ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); ++ props.saveNBTData(p_70109_1_); ++ } ++ catch (Throwable t) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe("Failed to save extended properties for %s. This is a mod issue.", identifier); ++ t.printStackTrace(); ++ } ++ } ++ + this.func_70014_b(p_70109_1_); + + if (this.field_70154_o != null) +@@ -1458,6 +1479,28 @@ + this.func_174805_g(p_70020_1_.func_74767_n("CustomNameVisible")); + this.field_174837_as.func_179668_a(p_70020_1_); + this.func_174810_b(p_70020_1_.func_74767_n("Silent")); ++ ++ if (p_70020_1_.func_74764_b("ForgeData")) customEntityData = p_70020_1_.func_74775_l("ForgeData"); ++ for (String identifier : this.extendedProperties.keySet()) ++ { ++ try ++ { ++ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); + props.loadNBTData(p_70020_1_); + } + catch (Throwable t) + { -+ FMLLog.severe("Failed to load extended properties for %s. This is a mod issue.", identifier); ++ net.minecraftforge.fml.common.FMLLog.severe("Failed to load extended properties for %s. This is a mod issue.", identifier); + t.printStackTrace(); + } + } @@ -158,26 +82,23 @@ + { + this.field_96093_i = new UUID(p_70020_1_.func_74763_f("PersistentIDMSB"), p_70020_1_.func_74763_f("PersistentIDLSB")); + } ++ this.func_70037_a(p_70020_1_); if (this.func_142008_O()) -@@ -1423,7 +1508,14 @@ +@@ -1536,7 +1579,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.field_145804_b = 10; + entityitem.func_174869_p(); - this.field_70170_p.func_72838_d(entityitem); + if (captureDrops) -+ { -+ capturedDrops.add(entityitem); -+ } ++ this.capturedDrops.add(entityitem); + else -+ { + this.field_70170_p.func_72838_d(entityitem); -+ } return entityitem; } else -@@ -1687,7 +1779,7 @@ +@@ -1810,7 +1856,7 @@ public boolean func_70115_ae() { @@ -186,19 +107,20 @@ } public boolean func_70093_af() -@@ -1988,7 +2080,7 @@ +@@ -2103,7 +2149,7 @@ - public float func_145772_a(Explosion p_145772_1_, World p_145772_2_, int p_145772_3_, int p_145772_4_, int p_145772_5_, Block p_145772_6_) + public float func_180428_a(Explosion p_180428_1_, World p_180428_2_, BlockPos p_180428_3_, IBlockState p_180428_4_) { -- return p_145772_6_.func_149638_a(this); -+ return p_145772_6_.getExplosionResistance(this, p_145772_2_, p_145772_3_, p_145772_4_, p_145772_5_, field_70165_t, field_70163_u + func_70047_e(), field_70161_v); +- 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_.func_177963_a(0, func_70047_e(), 0), this, p_180428_1_); } - public boolean func_145774_a(Explosion p_145774_1_, World p_145774_2_, int p_145774_3_, int p_145774_4_, int p_145774_5_, Block p_145774_6_, float p_145774_7_) -@@ -2058,6 +2150,174 @@ - - public void func_145781_i(int p_145781_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_) +@@ -2357,4 +2403,176 @@ + EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_); + } ++ + /* ================================== Forge Start =====================================*/ + /** + * Returns a NBTTagCompound that can be used to store custom data for this entity. @@ -231,40 +153,44 @@ + */ + public ItemStack getPickedResult(MovingObjectPosition target) + { -+ if (this instanceof EntityPainting) ++ if (this instanceof net.minecraft.entity.item.EntityPainting) + { -+ return new ItemStack(Items.field_151159_an); ++ return new ItemStack(net.minecraft.init.Items.field_151159_an); + } + else if (this instanceof EntityLeashKnot) + { -+ return new ItemStack(Items.field_151058_ca); ++ return new ItemStack(net.minecraft.init.Items.field_151058_ca); + } -+ else if (this instanceof EntityItemFrame) ++ else if (this instanceof net.minecraft.entity.item.EntityItemFrame) + { -+ ItemStack held = ((EntityItemFrame)this).func_82335_i(); ++ ItemStack held = ((net.minecraft.entity.item.EntityItemFrame)this).func_82335_i(); + if (held == null) + { -+ return new ItemStack(Items.field_151160_bD); ++ return new ItemStack(net.minecraft.init.Items.field_151160_bD); + } + else + { + return held.func_77946_l(); + } + } -+ else if (this instanceof EntityMinecart) ++ else if (this instanceof net.minecraft.entity.item.EntityMinecart) + { -+ return ((EntityMinecart)this).getCartItem(); ++ return ((net.minecraft.entity.item.EntityMinecart)this).getCartItem(); + } -+ else if (this instanceof EntityBoat) ++ else if (this instanceof net.minecraft.entity.item.EntityBoat) + { -+ return new ItemStack(Items.field_151124_az); ++ return new ItemStack(net.minecraft.init.Items.field_151124_az); ++ } ++ else if (this instanceof net.minecraft.entity.item.EntityArmorStand) ++ { ++ return new ItemStack(net.minecraft.init.Items.field_179565_cj); + } + else + { + int id = EntityList.func_75619_a(this); + if (id > 0 && EntityList.field_75627_a.containsKey(id)) + { -+ return new ItemStack(Items.field_151063_bx, 1, id); ++ return new ItemStack(net.minecraft.init.Items.field_151063_bx, 1, id); + } + } + return null; @@ -305,16 +231,16 @@ + * @param properties The instanceof IExtendedProperties to register + * @return The identifier that was used to register the extended properties. Empty String indicates an error. If your requested key already existed, this will return a modified one that is unique. + */ -+ public String registerExtendedProperties(String identifier, IExtendedEntityProperties properties) ++ public String registerExtendedProperties(String identifier, net.minecraftforge.common.IExtendedEntityProperties properties) + { + if (identifier == null) + { -+ FMLLog.warning("Someone is attempting to register extended properties using a null identifier. This is not allowed. Aborting. This may have caused instability."); ++ net.minecraftforge.fml.common.FMLLog.warning("Someone is attempting to register extended properties using a null identifier. This is not allowed. Aborting. This may have caused instability."); + return ""; + } + if (properties == null) + { -+ FMLLog.warning("Someone is attempting to register null extended properties. This is not allowed. Aborting. This may have caused instability."); ++ net.minecraftforge.fml.common.FMLLog.warning("Someone is attempting to register null extended properties. This is not allowed. Aborting. This may have caused instability."); + return ""; + } + @@ -327,7 +253,7 @@ + + if (baseIdentifier != identifier) + { -+ FMLLog.info("An attempt was made to register exended properties using an existing key. The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier); ++ net.minecraftforge.fml.common.FMLLog.info("An attempt was made to register exended properties using an existing key. The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier); + } + + this.extendedProperties.put(identifier, properties); @@ -339,7 +265,7 @@ + * @param identifier The key that identifies the extended properties. + * @return The instance of IExtendedProperties that was found, or null. + */ -+ public IExtendedEntityProperties getExtendedProperties(String identifier) ++ public net.minecraftforge.common.IExtendedEntityProperties getExtendedProperties(String identifier) + { + return this.extendedProperties.get(identifier); + } @@ -366,7 +292,4 @@ + return this instanceof EntityLivingBase; + } + /* ================================== Forge End =====================================*/ -+ - public static enum EnumEntitySize - { - SIZE_1, + } diff --git a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch index 6ad55fe904..5a09c37259 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch @@ -1,35 +1,25 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java -@@ -34,6 +34,9 @@ - import net.minecraft.world.EnumDifficulty; - import net.minecraft.world.World; - import net.minecraft.world.WorldServer; -+import net.minecraftforge.common.ForgeHooks; -+import cpw.mods.fml.common.eventhandler.Event.Result; -+import net.minecraftforge.event.ForgeEventFactory; - - public abstract class EntityLiving extends EntityLivingBase - { -@@ -117,6 +120,7 @@ +@@ -124,6 +124,7 @@ public void func_70624_b(EntityLivingBase p_70624_1_) { this.field_70696_bz = p_70624_1_; -+ ForgeHooks.onLivingSetAttackTarget(this, p_70624_1_); ++ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70624_1_); } public boolean func_70686_a(Class p_70686_1_) -@@ -476,10 +480,22 @@ +@@ -507,10 +508,22 @@ protected void func_70623_bb() { -+ Result result = null; ++ net.minecraftforge.fml.common.eventhandler.Event.Result result = null; if (this.field_82179_bU) { this.field_70708_bq = 0; } -+ else if ((this.field_70708_bq & 0x1F) == 0x1F && (result = ForgeEventFactory.canEntityDespawn(this)) != Result.DEFAULT) ++ else if ((this.field_70708_bq & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT) + { -+ if (result == Result.DENY) ++ if (result == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { + this.field_70708_bq = 0; + } @@ -41,8 +31,8 @@ else { EntityPlayer entityplayer = this.field_70170_p.func_72890_a(this, -1.0D); -@@ -642,7 +658,6 @@ - return this.field_70170_p.func_72855_b(this.field_70121_D) && this.field_70170_p.func_72945_a(this, this.field_70121_D).isEmpty() && !this.field_70170_p.func_72953_d(this.field_70121_D); +@@ -628,7 +641,6 @@ + return this.field_70170_p.func_72917_a(this.func_174813_aQ(), this) && this.field_70170_p.func_72945_a(this, this.func_174813_aQ()).isEmpty() && !this.field_70170_p.func_72953_d(this.func_174813_aQ()); } - @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 570364755f..39dd54d3f7 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -1,22 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -19,6 +19,7 @@ - import net.minecraft.entity.item.EntityItem; - import net.minecraft.entity.item.EntityXPOrb; - import net.minecraft.entity.monster.EntityZombie; -+import net.minecraft.entity.passive.EntityPig; - import net.minecraft.entity.passive.EntityWolf; - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.entity.player.EntityPlayerMP; -@@ -48,6 +49,7 @@ - import net.minecraft.util.Vec3; - import net.minecraft.world.World; - import net.minecraft.world.WorldServer; -+import net.minecraftforge.common.ForgeHooks; - - public abstract class EntityLivingBase extends Entity - { -@@ -225,7 +227,7 @@ +@@ -233,7 +233,7 @@ } } @@ -25,15 +9,15 @@ { this.func_70078_a((Entity)null); } -@@ -374,6 +376,7 @@ +@@ -377,6 +377,7 @@ { this.field_70755_b = p_70604_1_; this.field_70756_c = this.field_70173_aa; -+ ForgeHooks.onLivingSetAttackTarget(this, p_70604_1_); ++ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70604_1_); } public EntityLivingBase func_110144_aD() -@@ -661,7 +664,6 @@ +@@ -672,7 +673,6 @@ return this.func_70668_bt() == EnumCreatureAttribute.UNDEAD; } @@ -41,15 +25,15 @@ public void func_70618_n(int p_70618_1_) { this.field_70713_bf.remove(Integer.valueOf(p_70618_1_)); -@@ -730,6 +732,7 @@ +@@ -741,6 +741,7 @@ public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { -+ if (ForgeHooks.onLivingAttack(this, p_70097_1_, p_70097_2_)) return false; - if (this.func_85032_ar()) ++ if (net.minecraftforge.common.ForgeHooks.onLivingAttack(this, p_70097_1_, p_70097_2_)) return false; + if (this.func_180431_b(p_70097_1_)) { return false; -@@ -796,9 +799,9 @@ +@@ -806,9 +807,9 @@ this.field_70718_bc = 100; this.field_70717_bb = (EntityPlayer)entity; } @@ -61,42 +45,32 @@ if (entitywolf.func_70909_n()) { -@@ -883,6 +886,7 @@ +@@ -894,6 +895,7 @@ public void func_70645_a(DamageSource p_70645_1_) { -+ if (ForgeHooks.onLivingDeath(this, p_70645_1_)) return; ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; Entity entity = p_70645_1_.func_76346_g(); EntityLivingBase entitylivingbase = this.func_94060_bK(); -@@ -908,6 +912,10 @@ +@@ -919,6 +921,9 @@ i = EnchantmentHelper.func_77519_f((EntityLivingBase)entity); } + captureDrops = true; + capturedDrops.clear(); -+ int j = 0; + if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")) { this.func_70628_a(this.field_70718_bc > 0, i); -@@ -915,7 +923,7 @@ - - if (this.field_70718_bc > 0) - { -- int j = this.field_70146_Z.nextInt(200) - i; -+ j = this.field_70146_Z.nextInt(200) - i; - - if (j < 5) - { -@@ -923,6 +931,16 @@ - } +@@ -929,6 +934,16 @@ + this.func_82164_bB(); } } + + captureDrops = false; + -+ if (!ForgeHooks.onLivingDrops(this, p_70645_1_, capturedDrops, i, field_70718_bc > 0, j)) ++ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, p_70645_1_, capturedDrops, i, field_70718_bc > 0)) + { + for (EntityItem item : capturedDrops) + { @@ -106,80 +80,67 @@ } this.field_70170_p.func_72960_a(this, (byte)3); -@@ -971,7 +989,7 @@ - int j = MathHelper.func_76128_c(this.field_70121_D.field_72338_b); +@@ -977,7 +992,7 @@ + int j = MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b); int k = MathHelper.func_76128_c(this.field_70161_v); - Block block = this.field_70170_p.func_147439_a(i, j, k); -- return block == Blocks.field_150468_ap || block == Blocks.field_150395_bd; -+ return ForgeHooks.isLivingOnLadder(block, field_70170_p, i, j, k, this); + Block block = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)).func_177230_c(); +- return (block == Blocks.field_150468_ap || block == Blocks.field_150395_bd) && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).func_175149_v()); ++ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(block, field_70170_p, new BlockPos(i, j, k), this); } public boolean func_70089_S() -@@ -981,6 +999,8 @@ +@@ -987,6 +1002,9 @@ - protected void func_70069_a(float p_70069_1_) + public void func_180430_e(float p_180430_1_, float p_180430_2_) { -+ p_70069_1_ = ForgeHooks.onLivingFall(this, p_70069_1_); -+ if (p_70069_1_ <= 0) return; - super.func_70069_a(p_70069_1_); ++ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, p_180430_1_, p_180430_2_); ++ if (ret == null) return; ++ p_180430_1_ = ret[0]; p_180430_2_ = ret[1]; + super.func_180430_e(p_180430_1_, p_180430_2_); PotionEffect potioneffect = this.func_70660_b(Potion.field_76430_j); - float f1 = potioneffect != null ? (float)(potioneffect.func_76458_c() + 1) : 0.0F; -@@ -1060,7 +1080,7 @@ - { - if (this instanceof EntityZombie) - { -- p_70672_2_ = p_70672_2_; -+ //par2 = par2; // Forge: Noop Warning - } - - int i; -@@ -1104,6 +1124,8 @@ + float f2 = potioneffect != null ? (float)(potioneffect.func_76458_c() + 1) : 0.0F; +@@ -1105,6 +1123,8 @@ { - if (!this.func_85032_ar()) + if (!this.func_180431_b(p_70665_1_)) { -+ p_70665_2_ = ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_); ++ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_); + if (p_70665_2_ <= 0) return; p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); float f1 = p_70665_2_; -@@ -1152,6 +1174,17 @@ +@@ -1153,6 +1173,11 @@ public void func_71038_i() { + ItemStack stack = this.func_70694_bm(); -+ + if (stack != null && stack.func_77973_b() != null) + { -+ Item item = stack.func_77973_b(); -+ if (item.onEntitySwing(this, stack)) -+ { -+ return; -+ } ++ if (stack.func_77973_b().onEntitySwing(this, stack)) return; + } -+ if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) { this.field_110158_av = -1; -@@ -1347,6 +1380,7 @@ +@@ -1359,6 +1384,7 @@ } this.field_70160_al = true; -+ ForgeHooks.onLivingJump(this); ++ net.minecraftforge.common.ForgeHooks.onLivingJump(this); } - public void func_70612_e(float p_70612_1_, float p_70612_2_) -@@ -1521,6 +1555,7 @@ + protected void func_70629_bd() +@@ -1545,6 +1571,7 @@ public void func_70071_h_() { -+ if (ForgeHooks.onLivingUpdate(this)) return; ++ if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return; super.func_70071_h_(); if (!this.field_70170_p.field_72995_K) -@@ -2007,6 +2042,44 @@ - return this.func_96124_cp() != null ? this.func_96124_cp().func_142054_a(p_142012_1_) : false; +@@ -2000,4 +2027,39 @@ + { + this.field_70752_e = true; } - ++ + /*** + * Removes all potion effects that have curativeItem as a curative item for its effect + * @param curativeItem The itemstack we are using to cure potion effects @@ -187,11 +148,7 @@ + public void curePotionEffects(ItemStack curativeItem) + { + Iterator potionKey = field_70713_bf.keySet().iterator(); -+ -+ if (field_70170_p.field_72995_K) -+ { -+ return; -+ } ++ if (field_70170_p.field_72995_K) return; + + while (potionKey.hasNext()) + { @@ -202,6 +159,7 @@ + { + potionKey.remove(); + func_70688_c(effect); ++ this.field_70752_e = true; + } + } + } @@ -215,9 +173,6 @@ + */ + public boolean shouldRiderFaceForward(EntityPlayer player) + { -+ return this instanceof EntityPig; ++ return this instanceof net.minecraft.entity.passive.EntityPig; + } -+ - public void func_152111_bt() {} - - public void func_152112_bu() {} + } diff --git a/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch b/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch new file mode 100644 index 0000000000..db7a4fe199 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java +@@ -111,6 +111,7 @@ + + public boolean func_130002_c(EntityPlayer p_130002_1_) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; + this.field_145824_a.func_175574_a(p_130002_1_); + return false; + } diff --git a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch b/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch index 0945a9e8b4..393e5adf30 100644 --- a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch @@ -1,12 +1,12 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java +++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java -@@ -337,4 +337,23 @@ +@@ -357,4 +357,23 @@ } } } -+ ++ + /* ======================================== FORGE START =====================================*/ -+ ++ + // don't expose the EntityTrackerEntry directly so mods can't mess with the data in there as easily + /** + * Get all players tracking the given Entity. The Entity must be part of the World that this Tracker belongs to. @@ -21,6 +21,6 @@ + else + return java.util.Collections.unmodifiableSet(entry.field_73134_o); + } -+ ++ + /* ======================================== FORGE END =====================================*/ } diff --git a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch index b34ba7a310..f83481e405 100644 --- a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java +++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java -@@ -436,12 +436,14 @@ +@@ -445,12 +445,14 @@ p_73117_1_.field_71135_a.func_147359_a(new S1DPacketEntityEffect(this.field_73132_a.func_145782_y(), potioneffect)); } } diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch index 1df3009cd4..453f8aaea3 100644 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch @@ -1,64 +1,60 @@ --- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java +++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java -@@ -3,6 +3,7 @@ - import net.minecraft.entity.EntityCreature; - import net.minecraft.entity.EntityLivingBase; - import net.minecraft.pathfinding.PathEntity; -+import net.minecraft.pathfinding.PathPoint; - import net.minecraft.util.MathHelper; - import net.minecraft.world.World; - -@@ -21,6 +22,8 @@ +@@ -20,11 +20,14 @@ + private double field_151495_j; private double field_151496_k; private static final String __OBFID = "CL_00001595"; ++ private int failedPathFindingPenalty = 0; ++ private boolean canPenalize = false; -+ private int failedPathFindingPenalty; -+ public EntityAIAttackOnCollide(EntityCreature p_i1635_1_, Class p_i1635_2_, double p_i1635_3_, boolean p_i1635_5_) { this(p_i1635_1_, p_i1635_3_, p_i1635_5_); -@@ -54,8 +57,16 @@ + this.field_75444_h = p_i1635_2_; ++ canPenalize = field_75444_h == null || !net.minecraft.entity.player.EntityPlayer.class.isAssignableFrom(field_75444_h); //Only enable delaying when not targeting players. + } + + public EntityAIAttackOnCollide(EntityCreature p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) +@@ -54,6 +57,19 @@ } else { -- this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase); -- return this.field_75438_g != null; -+ if (-- this.field_75445_i <= 0) ++ if (canPenalize) + { -+ this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase); -+ this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); -+ return this.field_75438_g != null; -+ } -+ else -+ { -+ return true; -+ } - } - } - -@@ -89,8 +100,25 @@ - this.field_151497_i = entitylivingbase.field_70165_t; - this.field_151495_j = entitylivingbase.field_70121_D.field_72338_b; - this.field_151496_k = entitylivingbase.field_70161_v; -- this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); -+ this.field_75445_i = failedPathFindingPenalty + 4 + this.field_75441_b.func_70681_au().nextInt(7); - -+ if (this.field_75441_b.func_70661_as().func_75505_d() != null) -+ { -+ PathPoint finalPathPoint = this.field_75441_b.func_70661_as().func_75505_d().func_75870_c(); -+ if (finalPathPoint != null && entitylivingbase.func_70092_e(finalPathPoint.field_75839_a, finalPathPoint.field_75837_b, finalPathPoint.field_75838_c) < 1) ++ if (--this.field_75445_i <= 0) + { -+ failedPathFindingPenalty = 0; ++ this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase); ++ this.field_151497_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); ++ return this.field_75438_g != null; ++ } ++ else ++ { ++ return true; ++ } ++ } + this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase); + return this.field_75438_g != null; + } +@@ -91,6 +107,23 @@ + this.field_151496_k = entitylivingbase.field_70161_v; + this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); + ++ if (this.canPenalize) ++ { ++ this.field_151497_i += failedPathFindingPenalty; ++ if (this.field_75441_b.func_70661_as().func_75505_d() != null) ++ { ++ net.minecraft.pathfinding.PathPoint finalPathPoint = this.field_75441_b.func_70661_as().func_75505_d().func_75870_c(); ++ if (finalPathPoint != null && entitylivingbase.func_70092_e(finalPathPoint.field_75839_a, finalPathPoint.field_75837_b, finalPathPoint.field_75838_c) < 1) ++ failedPathFindingPenalty = 0; ++ else ++ failedPathFindingPenalty += 10; + } + else + { + failedPathFindingPenalty += 10; + } + } -+ else -+ { -+ failedPathFindingPenalty += 10; -+ } + if (d0 > 1024.0D) { diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch index 82e4e9967b..8f01432d9a 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java +++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java -@@ -477,9 +477,9 @@ +@@ -486,9 +486,9 @@ { - Block block = this.field_70170_p.func_147439_a(k1, l1, i2); + Block block = this.field_70170_p.func_180495_p(new BlockPos(k1, l1, i2)).func_177230_c(); - if (block.func_149688_o() != Material.field_151579_a) -+ if (!block.isAir(field_70170_p, k1, l1, i2)) ++ if (!block.isAir(field_70170_p, new BlockPos(k1, l1, i2))) { -- if (block != Blocks.field_150343_Z && block != Blocks.field_150377_bs && block != Blocks.field_150357_h && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) -+ if (block.canEntityDestroy(field_70170_p, k1, l1, i2, this) && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) +- if (block != Blocks.field_180401_cv && block != Blocks.field_150343_Z && block != Blocks.field_150377_bs && block != Blocks.field_150357_h && block != Blocks.field_150483_bI && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) ++ if (block.canEntityDestroy(field_70170_p, new BlockPos(k1, l1, i2), this) && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { - flag1 = this.field_70170_p.func_147468_f(k1, l1, i2) || flag1; + flag1 = this.field_70170_p.func_175698_g(new BlockPos(k1, l1, i2)) || flag1; } diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch index e2accd93bc..e683f35dca 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/entity/boss/EntityWither.java +++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java -@@ -347,7 +347,7 @@ +@@ -351,7 +351,7 @@ int l = j1 + i2; - Block block = this.field_70170_p.func_147439_a(j2, k, l); + Block block = this.field_70170_p.func_180495_p(new BlockPos(j2, k, l)).func_177230_c(); -- if (block.func_149688_o() != Material.field_151579_a && block != Blocks.field_150357_h && block != Blocks.field_150384_bq && block != Blocks.field_150378_br && block != Blocks.field_150483_bI) -+ if (!block.isAir(field_70170_p, j2, k, l) && block.canEntityDestroy(field_70170_p, j2, k, l, this)) +- if (block.func_149688_o() != Material.field_151579_a && block != Blocks.field_150357_h && block != Blocks.field_150384_bq && block != Blocks.field_150378_br && block != Blocks.field_150483_bI && block != Blocks.field_180401_cv) ++ if (!block.isAir(field_70170_p, new BlockPos(j2, k, l)) && block.canEntityDestroy(field_70170_p, new BlockPos(j2, k, l), this)) { - flag = this.field_70170_p.func_147480_a(j2, k, l, true) || flag; + flag = this.field_70170_p.func_175655_b(new BlockPos(j2, k, l), true) || flag; } diff --git a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch index 4d83b19174..6a8a40087d 100644 --- a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch +++ b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch @@ -1,9 +1,9 @@ --- ../src-base/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java +++ ../src-work/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java -@@ -102,7 +102,8 @@ - for (int l = 0; l < list.size(); ++l) +@@ -92,7 +92,8 @@ + for (int i = 0; i < list.size(); ++i) { - Entity entity = (Entity)list.get(l); + Entity entity = (Entity)list.get(i); - entity.func_70077_a(this); + if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this)) + entity.func_70077_a(this); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch index d0c5756c58..c12ef4d21f 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch @@ -1,31 +1,24 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java -@@ -9,6 +9,8 @@ - import net.minecraft.util.DamageSource; - import net.minecraft.util.MovingObjectPosition; - import net.minecraft.world.World; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.living.EnderTeleportEvent; +@@ -50,6 +50,9 @@ - public class EntityEnderPearl extends EntityThrowable - { -@@ -50,14 +52,18 @@ - - if (entityplayermp.field_71135_a.func_147362_b().func_150724_d() && entityplayermp.field_70170_p == this.field_70170_p) + if (entityplayermp.field_71135_a.func_147362_b().func_150724_d() && entityplayermp.field_70170_p == this.field_70170_p && !entityplayermp.func_70608_bn()) { -+ EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, this.field_70165_t, this.field_70163_u, this.field_70161_v, 5.0F); -+ if (!MinecraftForge.EVENT_BUS.post(event)) ++ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(entityplayermp, this.field_70165_t, this.field_70163_u, this.field_70161_v, 5.0F); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) + { // Don't indent to lower patch size - if (this.func_85052_h().func_70115_ae()) + if (this.field_70146_Z.nextFloat() < 0.05F && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) { - this.func_85052_h().func_70078_a((Entity)null); + EntityEndermite entityendermite = new EntityEndermite(this.field_70170_p); +@@ -63,9 +66,10 @@ + entitylivingbase.func_70078_a((Entity)null); } -- this.func_85052_h().func_70634_a(this.field_70165_t, this.field_70163_u, this.field_70161_v); -+ this.func_85052_h().func_70634_a(event.targetX, event.targetY, event.targetZ); - this.func_85052_h().field_70143_R = 0.0F; -- this.func_85052_h().func_70097_a(DamageSource.field_76379_h, 5.0F); -+ this.func_85052_h().func_70097_a(DamageSource.field_76379_h, event.attackDamage); +- entitylivingbase.func_70634_a(this.field_70165_t, this.field_70163_u, this.field_70161_v); ++ entitylivingbase.func_70634_a(event.targetX, event.targetY, event.targetZ); + entitylivingbase.field_70143_R = 0.0F; +- entitylivingbase.func_70097_a(DamageSource.field_76379_h, 5.0F); ++ entitylivingbase.func_70097_a(DamageSource.field_76379_h, event.attackDamage); + } } } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch index 18ff726f84..7d9b58e89a 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch @@ -1,21 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java -@@ -14,10 +14,13 @@ - import net.minecraft.util.MathHelper; - import net.minecraft.util.StatCollector; - import net.minecraft.world.World; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.item.ItemExpireEvent; -+import net.minecraftforge.event.entity.player.EntityItemPickupEvent; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -- - import cpw.mods.fml.common.FMLCommonHandler; -+import cpw.mods.fml.common.eventhandler.Event.Result; - - public class EntityItem extends Entity - { -@@ -30,6 +33,11 @@ +@@ -31,6 +31,11 @@ public float field_70290_d; private static final String __OBFID = "CL_00001669"; @@ -27,112 +12,75 @@ public EntityItem(World p_i1709_1_, double p_i1709_2_, double p_i1709_4_, double p_i1709_6_) { super(p_i1709_1_); -@@ -46,8 +54,9 @@ - - public EntityItem(World p_i1710_1_, double p_i1710_2_, double p_i1710_4_, double p_i1710_6_, ItemStack p_i1710_8_) +@@ -48,6 +53,7 @@ { -- this(p_i1710_1_, p_i1710_2_, p_i1710_4_, p_i1710_6_); -+ this(p_i1710_1_, p_i1710_2_, p_i1710_4_, p_i1710_6_); + this(p_i1710_1_, p_i1710_2_, p_i1710_4_, p_i1710_6_); this.func_92058_a(p_i1710_8_); + this.lifespan = (p_i1710_8_.func_77973_b() == null ? 6000 : p_i1710_8_.func_77973_b().getEntityLifespan(p_i1710_8_, p_i1710_1_)); } protected boolean func_70041_e_() -@@ -71,6 +80,15 @@ +@@ -71,6 +77,8 @@ public void func_70071_h_() { + ItemStack stack = this.func_70096_w().func_82710_f(10); -+ if (stack != null && stack.func_77973_b() != null) -+ { -+ if (stack.func_77973_b().onEntityItemUpdate(this)) -+ { -+ return; -+ } -+ } -+ ++ if (stack != null && stack.func_77973_b() != null && stack.func_77973_b().onEntityItemUpdate(this)) return; if (this.func_92059_d() == null) { this.func_70106_y(); -@@ -126,8 +144,30 @@ +@@ -131,8 +139,16 @@ - ++this.field_70292_b; + this.func_70072_I(); - if (!this.field_70170_p.field_72995_K && this.field_70292_b >= 6000) + ItemStack item = func_70096_w().func_82710_f(10); -+ ++ + if (!this.field_70170_p.field_72995_K && this.field_70292_b >= lifespan) { -+ if (item != null) -+ { -+ ItemExpireEvent event = new ItemExpireEvent(this, (item.func_77973_b() == null ? 6000 : item.func_77973_b().getEntityLifespan(item, field_70170_p))); -+ if (MinecraftForge.EVENT_BUS.post(event)) -+ { -+ lifespan += event.extraLife; -+ } -+ else -+ { -+ this.func_70106_y(); -+ } -+ } -+ else -+ { -+ this.func_70106_y(); -+ } ++ int hook = net.minecraftforge.event.ForgeEventFactory.onItemExpire(this, item); ++ if (hook < 0) this.func_70106_y(); ++ else this.lifespan += hook; + } -+ + if (item != null && item.field_77994_a <= 0) + { this.func_70106_y(); } } -@@ -242,6 +282,7 @@ - { +@@ -276,6 +292,7 @@ p_70014_1_.func_74777_a("Health", (short)((byte)this.field_70291_e)); p_70014_1_.func_74777_a("Age", (short)this.field_70292_b); + p_70014_1_.func_74777_a("PickupDelay", (short)this.field_145804_b); + p_70014_1_.func_74768_a("Lifespan", lifespan); if (this.func_145800_j() != null) { -@@ -277,20 +318,39 @@ +@@ -316,20 +333,23 @@ NBTTagCompound nbttagcompound1 = p_70037_1_.func_74775_l("Item"); this.func_92058_a(ItemStack.func_77949_a(nbttagcompound1)); - if (this.func_92059_d() == null) +- { +- this.func_70106_y(); +- } + ItemStack item = func_70096_w().func_82710_f(10); -+ -+ if (item == null || item.field_77994_a <= 0) - { - this.func_70106_y(); - } -+ -+ if (p_70037_1_.func_74764_b("Lifespan")) -+ { -+ lifespan = p_70037_1_.func_74762_e("Lifespan"); -+ } ++ if (item == null || item.field_77994_a <= 0) this.func_70106_y(); ++ if (p_70037_1_.func_74764_b("Lifespan")) lifespan = p_70037_1_.func_74762_e("Lifespan"); } public void func_70100_b_(EntityPlayer p_70100_1_) { if (!this.field_70170_p.field_72995_K) { -+ if (this.field_145804_b > 0) -+ { -+ return; -+ } -+ -+ EntityItemPickupEvent event = new EntityItemPickupEvent(p_70100_1_, this); -+ -+ if (MinecraftForge.EVENT_BUS.post(event)) -+ { -+ return; -+ } -+ ++ if (this.field_145804_b > 0) return; ItemStack itemstack = this.func_92059_d(); int i = itemstack.field_77994_a; - if (this.field_145804_b == 0 && (this.field_145802_g == null || 6000 - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_70005_c_())) && p_70100_1_.field_71071_by.func_70441_a(itemstack)) -+ if (this.field_145804_b <= 0 && (this.field_145802_g == null || lifespan - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_70005_c_())) && (event.getResult() == Result.ALLOW || i <= 0 || p_70100_1_.field_71071_by.func_70441_a(itemstack))) ++ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, p_70100_1_, itemstack); ++ if (hook < 0) return; ++ ++ if (this.field_145804_b <= 0 && (this.field_145802_g == null || lifespan - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_70005_c_())) && (hook == 1 || i <= 0 || p_70100_1_.field_71071_by.func_70441_a(itemstack))) { if (itemstack.func_77973_b() == Item.func_150898_a(Blocks.field_150364_r)) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch index 3c2d913aed..66f3aa25f9 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -1,17 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecart.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecart.java -@@ -23,6 +23,10 @@ - import net.minecraft.util.Vec3; - import net.minecraft.world.World; - import net.minecraft.world.WorldServer; -+import net.minecraftforge.common.IMinecartCollisionHandler; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.minecart.MinecartCollisionEvent; -+import net.minecraftforge.event.entity.minecart.MinecartUpdateEvent; - - public abstract class EntityMinecart extends Entity - { -@@ -43,6 +47,20 @@ +@@ -52,6 +52,20 @@ private double field_70506_as; private static final String __OBFID = "CL_00001670"; @@ -21,7 +10,7 @@ + public static double defaultDragAir = 0.94999998807907104D; + protected boolean canUseRail = true; + protected boolean canBePushed = true; -+ private static IMinecartCollisionHandler collisionHandler = null; ++ private static net.minecraftforge.common.IMinecartCollisionHandler collisionHandler = null; + + /* Instance versions of the above physics properties */ + private float currentSpeedRail = getMaxCartSpeedOnRail(); @@ -32,23 +21,17 @@ public EntityMinecart(World p_i1712_1_) { super(p_i1712_1_); -@@ -89,17 +107,25 @@ +@@ -97,17 +111,19 @@ public AxisAlignedBB func_70114_g(Entity p_70114_1_) { -+ if (getCollisionHandler() != null) -+ { -+ return getCollisionHandler().getCollisionBox(this, p_70114_1_); -+ } - return p_70114_1_.func_70104_M() ? p_70114_1_.field_70121_D : null; ++ if (getCollisionHandler() != null) return getCollisionHandler().getCollisionBox(this, p_70114_1_); + return p_70114_1_.func_70104_M() ? p_70114_1_.func_174813_aQ() : null; } public AxisAlignedBB func_70046_E() { -+ if (getCollisionHandler() != null) -+ { -+ return getCollisionHandler().getBoundingBox(this); -+ } ++ if (getCollisionHandler() != null) return getCollisionHandler().getBoundingBox(this); return null; } @@ -59,65 +42,43 @@ } public EntityMinecart(World p_i1713_1_, double p_i1713_2_, double p_i1713_4_, double p_i1713_6_) -@@ -302,19 +328,20 @@ - double d2 = 0.0078125D; - Block block = this.field_70170_p.func_147439_a(l, i, i1); +@@ -309,7 +325,7 @@ + BlockPos blockpos = new BlockPos(j, i, k); + IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); -- if (BlockRailBase.func_150051_a(block)) -+ if (canUseRail() && BlockRailBase.func_150051_a(block)) +- if (BlockRailBase.func_176563_d(iblockstate)) ++ if (canUseRail() && BlockRailBase.func_176563_d(iblockstate)) { -- int j = this.field_70170_p.func_72805_g(l, i, i1); -- this.func_145821_a(l, i, i1, d0, d2, block, j); -+ float railMaxSpeed = ((BlockRailBase)block).getRailMaxSpeed(field_70170_p, this, l, i, i1); -+ double maxSpeed = Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); -+ this.func_145821_a(l, i, i1, maxSpeed, getSlopeAdjustment(), block, ((BlockRailBase)block).getBasicRailMetadata(field_70170_p, this, l, i, i1)); + this.func_180460_a(blockpos, iblockstate); - if (block == Blocks.field_150408_cc) - { -- this.func_96095_a(l, i, i1, (j & 8) != 0); -+ this.func_96095_a(l, i, i1, (field_70170_p.func_72805_g(l, i, i1) & 8) != 0); - } - } - else - { -- this.func_94088_b(d0); -+ this.func_94088_b(field_70122_E ? d0 : getMaxSpeedAirLateral()); - } - - this.func_145775_I(); -@@ -341,8 +368,19 @@ +@@ -347,7 +363,10 @@ } this.func_70101_b(this.field_70177_z, this.field_70125_A); -- List list = this.field_70170_p.func_72839_b(this, this.field_70121_D.func_72314_b(0.20000000298023224D, 0.0D, 0.20000000298023224D)); - +- Iterator iterator = this.field_70170_p.func_72839_b(this, this.func_174813_aQ().func_72314_b(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator(); + AxisAlignedBB box; -+ if (getCollisionHandler() != null) -+ { -+ box = getCollisionHandler().getMinecartCollisionBox(this); -+ } -+ else -+ { -+ box = field_70121_D.func_72314_b(0.2D, 0.0D, 0.2D); -+ } -+ -+ List list = this.field_70170_p.func_72839_b(this, box); -+ - if (list != null && !list.isEmpty()) - { - for (int k = 0; k < list.size(); ++k) -@@ -365,6 +403,8 @@ ++ if (getCollisionHandler() != null) box = this.getCollisionHandler().getMinecartCollisionBox(this); ++ else box = this.func_174813_aQ().func_72314_b(0.20000000298023224D, 0.0D, 0.20000000298023224D); ++ Iterator iterator = this.field_70170_p.func_72839_b(this, box).iterator(); - this.field_70153_n = null; + while (iterator.hasNext()) + { +@@ -370,6 +389,7 @@ } -+ -+ MinecraftForge.EVENT_BUS.post(new MinecartUpdateEvent(this, l, i, i1)); + + this.func_70072_I(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition())); } } -@@ -392,6 +432,17 @@ - this.field_70179_y = p_94088_1_; - } +@@ -382,10 +402,21 @@ + + protected void func_180459_n() + { +- double d0 = this.func_174898_m(); ++ double d0 = field_70122_E ? this.func_174898_m() : getMaxSpeedAirLateral(); + this.field_70159_w = MathHelper.func_151237_a(this.field_70159_w, -d0, d0); + this.field_70179_y = MathHelper.func_151237_a(this.field_70179_y, -d0, d0); + double moveY = field_70181_x; + if(getMaxSpeedAirVertical() > 0 && field_70181_x > getMaxSpeedAirVertical()) @@ -133,7 +94,7 @@ if (this.field_70122_E) { this.field_70159_w *= 0.5D; -@@ -399,13 +450,13 @@ +@@ -393,13 +424,13 @@ this.field_70179_y *= 0.5D; } @@ -151,71 +112,77 @@ } } -@@ -419,7 +470,7 @@ - - if (p_145821_8_ == Blocks.field_150318_D) - { -- flag = (p_145821_9_ & 8) != 0; -+ flag = (field_70170_p.func_72805_g(p_145821_1_, p_145821_2_, p_145821_3_) & 8) != 0; +@@ -418,25 +449,25 @@ flag1 = !flag; } -@@ -498,7 +549,7 @@ +- double d0 = 0.0078125D; ++ double slopeAdjustment = getSlopeAdjustment(); + BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.func_177229_b(blockrailbase.func_176560_l()); + + switch (EntityMinecart.SwitchEnumMinecartType.field_180036_b[enumraildirection.ordinal()]) + { + case 1: +- this.field_70159_w -= 0.0078125D; ++ this.field_70159_w -= slopeAdjustment; + ++this.field_70163_u; + break; + case 2: +- this.field_70159_w += 0.0078125D; ++ this.field_70159_w += slopeAdjustment; + ++this.field_70163_u; + break; + case 3: +- this.field_70179_y += 0.0078125D; ++ this.field_70179_y += slopeAdjustment; + ++this.field_70163_u; + break; + case 4: +- this.field_70179_y -= 0.0078125D; ++ this.field_70179_y -= slopeAdjustment; + ++this.field_70163_u; + } + +@@ -485,7 +516,7 @@ } } - if (flag1) + if (flag1 && shouldDoRailFunctions()) { - d7 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); + d6 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); -@@ -546,37 +597,9 @@ - this.field_70165_t = d8 + d2 * d7; - this.field_70161_v = d9 + d3 * d7; - this.func_70107_b(this.field_70165_t, this.field_70163_u + (double)this.field_70129_M, this.field_70161_v); -- d12 = this.field_70159_w; -- d13 = this.field_70179_y; +@@ -533,20 +564,8 @@ + this.field_70165_t = d7 + d1 * d6; + this.field_70161_v = d8 + d2 * d6; + this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); +- d11 = this.field_70159_w; +- d12 = this.field_70179_y; ++ this.moveMinecartOnRail(p_180460_1_); - if (this.field_70153_n != null) - { +- d11 *= 0.75D; - d12 *= 0.75D; -- d13 *= 0.75D; -- } -+ moveMinecartOnRail(p_145821_1_, p_145821_2_, p_145821_3_, p_145821_4_); - -- if (d12 < -p_145821_4_) -- { -- d12 = -p_145821_4_; - } - -- if (d12 > p_145821_4_) -- { -- d12 = p_145821_4_; -- } +- double d13 = this.func_174898_m(); +- d11 = MathHelper.func_151237_a(d11, -d13, d13); +- d12 = MathHelper.func_151237_a(d12, -d13, d13); +- this.func_70091_d(d11, 0.0D, d12); - -- if (d13 < -p_145821_4_) -- { -- d13 = -p_145821_4_; -- } -- -- if (d13 > p_145821_4_) -- { -- d13 = p_145821_4_; -- } -- -- this.func_70091_d(d12, 0.0D, d13); -- - if (aint[0][1] != 0 && MathHelper.func_76128_c(this.field_70165_t) - p_145821_1_ == aint[0][0] && MathHelper.func_76128_c(this.field_70161_v) - p_145821_3_ == aint[0][2]) + if (aint[0][1] != 0 && MathHelper.func_76128_c(this.field_70165_t) - p_180460_1_.func_177958_n() == aint[0][0] && MathHelper.func_76128_c(this.field_70161_v) - p_180460_1_.func_177952_p() == aint[0][2]) { this.func_70107_b(this.field_70165_t, this.field_70163_u + (double)aint[0][1], this.field_70161_v); -@@ -613,8 +636,13 @@ - this.field_70179_y = d6 * (double)(i1 - p_145821_3_); +@@ -583,8 +602,14 @@ + this.field_70179_y = d5 * (double)(i - p_180460_1_.func_177952_p()); } - if (flag) ++ + if(shouldDoRailFunctions()) { -+ ((BlockRailBase)p_145821_8_).onMinecartPass(field_70170_p, this, p_145821_1_, p_145821_2_, p_145821_3_); ++ ((BlockRailBase)p_180460_2_.func_177230_c()).onMinecartPass(field_70170_p, this, p_180460_1_); + } + + if (flag && shouldDoRailFunctions()) @@ -223,42 +190,12 @@ double d15 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); if (d15 > 0.01D) -@@ -684,13 +712,8 @@ - } - else - { -- int l = this.field_70170_p.func_72805_g(i, j, k); -+ int l = ((BlockRailBase)block).getBasicRailMetadata(field_70170_p, this, i, j, k); - -- if (((BlockRailBase)block).func_150050_e()) -- { -- l &= 7; -- } -- - p_70495_3_ = (double)j; - - if (l >= 2 && l <= 5) -@@ -735,14 +758,9 @@ - - if (BlockRailBase.func_150051_a(block)) - { -- int l = this.field_70170_p.func_72805_g(i, j, k); -+ int l = ((BlockRailBase)block).getBasicRailMetadata(field_70170_p, this, i, j, k); - p_70489_3_ = (double)j; - -- if (((BlockRailBase)block).func_150050_e()) -- { -- l &= 7; -- } -- - if (l >= 2 && l <= 5) - { - p_70489_3_ = (double)(j + 1); -@@ -838,11 +856,17 @@ +@@ -824,13 +849,20 @@ public void func_70108_f(Entity p_70108_1_) { -+ MinecraftForge.EVENT_BUS.post(new MinecartCollisionEvent(this, p_70108_1_)); ++ ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, p_70108_1_)); + if (getCollisionHandler() != null) + { + getCollisionHandler().onEntityCollision(this, p_70108_1_); @@ -266,71 +203,78 @@ + } if (!this.field_70170_p.field_72995_K) { - if (p_70108_1_ != this.field_70153_n) + if (!p_70108_1_.field_70145_X && !this.field_70145_X) { -- if (p_70108_1_ instanceof EntityLivingBase && !(p_70108_1_ instanceof EntityPlayer) && !(p_70108_1_ instanceof EntityIronGolem) && this.func_94087_l() == 0 && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D && this.field_70153_n == null && p_70108_1_.field_70154_o == null) -+ if (p_70108_1_ instanceof EntityLivingBase && !(p_70108_1_ instanceof EntityPlayer) && !(p_70108_1_ instanceof EntityIronGolem) && canBeRidden() && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D && this.field_70153_n == null && p_70108_1_.field_70154_o == null) + if (p_70108_1_ != this.field_70153_n) { - p_70108_1_.func_70078_a(this); - } -@@ -888,7 +912,7 @@ - double d7 = p_70108_1_.field_70159_w + this.field_70159_w; - double d8 = p_70108_1_.field_70179_y + this.field_70179_y; +- if (p_70108_1_ instanceof EntityLivingBase && !(p_70108_1_ instanceof EntityPlayer) && !(p_70108_1_ instanceof EntityIronGolem) && this.func_180456_s() == EntityMinecart.EnumMinecartType.RIDEABLE && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D && this.field_70153_n == null && p_70108_1_.field_70154_o == null) ++ if (p_70108_1_ instanceof EntityLivingBase && !(p_70108_1_ instanceof EntityPlayer) && !(p_70108_1_ instanceof EntityIronGolem) && canBeRidden() && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D && this.field_70153_n == null && p_70108_1_.field_70154_o == null) + { + p_70108_1_.func_70078_a(this); + } +@@ -876,7 +908,7 @@ + double d7 = p_70108_1_.field_70159_w + this.field_70159_w; + double d8 = p_70108_1_.field_70179_y + this.field_70179_y; -- if (((EntityMinecart)p_70108_1_).func_94087_l() == 2 && this.func_94087_l() != 2) -+ if (((EntityMinecart)p_70108_1_).isPoweredCart() && !isPoweredCart()) - { - this.field_70159_w *= 0.20000000298023224D; - this.field_70179_y *= 0.20000000298023224D; -@@ -896,7 +920,7 @@ - p_70108_1_.field_70159_w *= 0.949999988079071D; - p_70108_1_.field_70179_y *= 0.949999988079071D; - } -- else if (((EntityMinecart)p_70108_1_).func_94087_l() != 2 && this.func_94087_l() == 2) -+ else if (((EntityMinecart)p_70108_1_).isPoweredCart() && !isPoweredCart()) - { - p_70108_1_.field_70159_w *= 0.20000000298023224D; - p_70108_1_.field_70179_y *= 0.20000000298023224D; -@@ -1065,4 +1089,216 @@ - { - return this.field_94102_c; +- if (((EntityMinecart)p_70108_1_).func_180456_s() == EntityMinecart.EnumMinecartType.FURNACE && this.func_180456_s() != EntityMinecart.EnumMinecartType.FURNACE) ++ if (((EntityMinecart)p_70108_1_).isPoweredCart() && !isPoweredCart()) + { + this.field_70159_w *= 0.20000000298023224D; + this.field_70179_y *= 0.20000000298023224D; +@@ -884,7 +916,7 @@ + p_70108_1_.field_70159_w *= 0.949999988079071D; + p_70108_1_.field_70179_y *= 0.949999988079071D; + } +- else if (((EntityMinecart)p_70108_1_).func_180456_s() != EntityMinecart.EnumMinecartType.FURNACE && this.func_180456_s() == EntityMinecart.EnumMinecartType.FURNACE) ++ else if (((EntityMinecart)p_70108_1_).isPoweredCart() && isPoweredCart()) + { + p_70108_1_.field_70159_w *= 0.20000000298023224D; + p_70108_1_.field_70179_y *= 0.20000000298023224D; +@@ -1049,6 +1081,221 @@ + } } + + /* =================================== FORGE START ===========================================*/ ++ private BlockPos getCurrentRailPosition() ++ { ++ int x = MathHelper.func_76128_c(this.field_70165_t); ++ int y = MathHelper.func_76128_c(this.field_70163_u); ++ int z = MathHelper.func_76128_c(this.field_70161_v); ++ ++ if (BlockRailBase.func_176562_d(this.field_70170_p, new BlockPos(x, y - 1, z))) y--; ++ return new BlockPos(x, y, z); ++ } ++ ++ protected double getMaxSpeed() ++ { ++ if (!canUseRail()) return func_174898_m(); ++ BlockPos pos = this.getCurrentRailPosition(); ++ IBlockState state = this.field_70170_p.func_180495_p(pos); ++ if (!BlockRailBase.func_176563_d(state)) return func_174898_m(); ++ ++ float railMaxSpeed = ((BlockRailBase)state.func_177230_c()).getRailMaxSpeed(field_70170_p, this, pos); ++ return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); ++ } ++ + /** + * Moved to allow overrides. + * This code handles minecart movement and speed capping when on a rail. + */ -+ public void moveMinecartOnRail(int x, int y, int z, double par4){ -+ double d12 = this.field_70159_w; -+ double d13 = this.field_70179_y; ++ public void moveMinecartOnRail(BlockPos pos) ++ { ++ double mX = this.field_70159_w; ++ double mZ = this.field_70179_y; + + if (this.field_70153_n != null) + { -+ d12 *= 0.75D; -+ d13 *= 0.75D; ++ mX *= 0.75D; ++ mZ *= 0.75D; + } + -+ if (d12 < -par4) -+ { -+ d12 = -par4; -+ } -+ -+ if (d12 > par4) -+ { -+ d12 = par4; -+ } -+ -+ if (d13 < -par4) -+ { -+ d13 = -par4; -+ } -+ -+ if (d13 > par4) -+ { -+ d13 = par4; -+ } -+ -+ this.func_70091_d(d12, 0.0D, d13); ++ double max = this.getMaxSpeed(); ++ mX = MathHelper.func_151237_a(mX, -max, max); ++ mZ = MathHelper.func_151237_a(mZ, -max, max); ++ this.func_70091_d(mX, 0.0D, mZ); + } + + /** @@ -338,7 +282,7 @@ + * is registered, returns null + * @return The collision handler or null + */ -+ public static IMinecartCollisionHandler getCollisionHandler() ++ public static net.minecraftforge.common.IMinecartCollisionHandler getCollisionHandler() + { + return collisionHandler; + } @@ -348,7 +292,7 @@ + * that is currently set. + * @param handler The new handler + */ -+ public static void setCollisionHandler(IMinecartCollisionHandler handler) ++ public static void setCollisionHandler(net.minecraftforge.common.IMinecartCollisionHandler handler) + { + collisionHandler = handler; + } @@ -419,7 +363,7 @@ + */ + public boolean isPoweredCart() + { -+ return func_94087_l()== 2; ++ return func_180456_s() == EntityMinecart.EnumMinecartType.FURNACE; + } + + /** @@ -428,11 +372,7 @@ + */ + public boolean canBeRidden() + { -+ if(this instanceof EntityMinecartEmpty) -+ { -+ return true; -+ } -+ return false; ++ return this.func_180456_s() == EntityMinecart.EnumMinecartType.RIDEABLE; + } + + /** @@ -506,5 +446,9 @@ + { + return 0.0078125D; + } ++ + /* =================================== FORGE END ===========================================*/ - } ++ + public static enum EnumMinecartType + { + RIDEABLE(0, "MinecartRideable"), diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch index 14d600cf6c..86de5e86a3 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java -@@ -234,6 +234,7 @@ +@@ -173,6 +173,7 @@ public boolean func_130002_c(EntityPlayer p_130002_1_) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch index 7c4ed912d0..3db54ba041 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java -@@ -19,6 +19,7 @@ +@@ -20,6 +20,7 @@ public boolean func_130002_c(EntityPlayer p_130002_1_) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch index 324b3a1c4f..0b88415240 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java -@@ -122,6 +122,7 @@ +@@ -132,6 +132,7 @@ public boolean func_130002_c(EntityPlayer p_130002_1_) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch index 1c80d61474..cf2c9b8c1b 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java -@@ -50,6 +50,7 @@ +@@ -57,6 +57,7 @@ public boolean func_130002_c(EntityPlayer p_130002_1_) { + if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; if (!this.field_70170_p.field_72995_K) { - p_130002_1_.func_96125_a(this); + p_130002_1_.func_71007_a(this); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch index e259f177d2..6ce41fa89b 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch @@ -1,19 +1,10 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityXPOrb.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java -@@ -9,6 +9,8 @@ - import net.minecraft.util.DamageSource; - import net.minecraft.util.MathHelper; - import net.minecraft.world.World; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; - - public class EntityXPOrb extends Entity - { -@@ -204,6 +206,7 @@ +@@ -198,6 +198,7 @@ { if (this.field_70532_c == 0 && p_70100_1_.field_71090_bL == 0) { -+ if (MinecraftForge.EVENT_BUS.post(new PlayerPickupXpEvent(p_70100_1_, this))) return; ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(p_70100_1_, this))) return; p_70100_1_.field_71090_bL = 2; this.field_70170_p.func_72956_a(p_70100_1_, "random.orb", 0.1F, 0.5F * ((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.7F + 1.8F)); p_70100_1_.func_71001_a(this, 1); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch index 60db956180..f3ec30644c 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -1,46 +1,11 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java -@@ -1,6 +1,8 @@ - package net.minecraft.entity.monster; - -+import java.util.IdentityHashMap; - import java.util.UUID; -+import com.google.common.collect.Maps; - import net.minecraft.block.Block; - import net.minecraft.block.material.Material; - import net.minecraft.entity.Entity; -@@ -19,11 +21,14 @@ - import net.minecraft.util.MathHelper; - import net.minecraft.util.Vec3; - import net.minecraft.world.World; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.living.EnderTeleportEvent; - - public class EntityEnderman extends EntityMob - { - private static final UUID field_110192_bp = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0"); - private static final AttributeModifier field_110193_bq = (new AttributeModifier(field_110192_bp, "Attacking speed boost", 6.199999809265137D, 0)).func_111168_a(false); -+ @Deprecated //DO NOT TOUCH THIS EVER - private static boolean[] field_70827_d = new boolean[256]; - private int field_70828_e; - private int field_70826_g; -@@ -154,7 +159,7 @@ - j = MathHelper.func_76128_c(this.field_70161_v - 2.0D + this.field_70146_Z.nextDouble() * 4.0D); - block = this.field_70170_p.func_147439_a(k, i, j); - -- if (field_70827_d[Block.func_149682_b(block)]) -+ if (EntityEnderman.getCarriable(block)) - { - this.func_146081_a(block); - this.func_70817_b(this.field_70170_p.func_72805_g(k, i, j)); -@@ -265,12 +270,16 @@ +@@ -204,12 +204,14 @@ protected boolean func_70825_j(double p_70825_1_, double p_70825_3_, double p_70825_5_) { -+ EnderTeleportEvent event = new EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0); -+ if (MinecraftForge.EVENT_BUS.post(event)){ -+ return false; -+ } ++ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; double d3 = this.field_70165_t; double d4 = this.field_70163_u; double d5 = this.field_70161_v; @@ -51,38 +16,22 @@ + this.field_70163_u = event.targetY; + this.field_70161_v = event.targetZ; boolean flag = false; - int i = MathHelper.func_76128_c(this.field_70165_t); - int j = MathHelper.func_76128_c(this.field_70163_u); -@@ -415,7 +424,7 @@ - } - } + BlockPos blockpos = new BlockPos(this.field_70165_t, this.field_70163_u, this.field_70161_v); -- return false; -+ return super.func_70097_a(p_70097_1_, p_70097_2_); +@@ -565,4 +567,16 @@ } - else - { -@@ -450,5 +459,23 @@ - field_70827_d[Block.func_149682_b(Blocks.field_150423_aK)] = true; - field_70827_d[Block.func_149682_b(Blocks.field_150440_ba)] = true; - field_70827_d[Block.func_149682_b(Blocks.field_150391_bh)] = true; -+ for (int x = 0; x < field_70827_d.length; x++) -+ { -+ if (field_70827_d[x]) setCarriable(Block.func_149729_e(x), true); -+ } + } } + + /*===================================== Forge Start ==============================*/ -+ private static IdentityHashMap carriable; + public static void setCarriable(Block block, boolean canCarry) + { -+ if (carriable == null) carriable = new IdentityHashMap(4096); -+ carriable.put(block, canCarry); ++ if (canCarry) field_70827_d.add(block); ++ else field_70827_d.remove(block); + } + public static boolean getCarriable(Block block) + { -+ Boolean ret = carriable.get(block); -+ return ret != null ? ret : false; ++ return field_70827_d.contains(block); + } + /*===================================== Forge End ==============================*/ } diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch index 4c1c213c24..ec3e099712 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java -@@ -99,6 +99,7 @@ +@@ -105,6 +105,7 @@ { this.field_70181_x = (double)(0.42F + (float)this.func_70809_q() * 0.1F); this.field_70160_al = true; + net.minecraftforge.common.ForgeHooks.onLivingJump(this); } - protected void func_70069_a(float p_70069_1_) {} + protected void func_180466_bG() diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch index 6fc5675edc..0ac7da22d6 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch @@ -1,49 +1,35 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java -@@ -41,6 +41,10 @@ - import net.minecraft.util.MathHelper; - import net.minecraft.world.EnumDifficulty; - import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeModContainer; -+import cpw.mods.fml.common.eventhandler.Event.Result; -+import net.minecraftforge.event.ForgeEventFactory; -+import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent; - - public class EntityZombie extends EntityMob - { -@@ -78,7 +82,7 @@ - this.func_110148_a(SharedMonsterAttributes.field_111265_b).func_111128_a(40.0D); +@@ -89,7 +89,7 @@ + this.func_110148_a(SharedMonsterAttributes.field_111265_b).func_111128_a(35.0D); this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(0.23000000417232513D); this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111128_a(3.0D); - this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * 0.10000000149011612D); -+ this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * ForgeModContainer.zombieSummonBaseChance); ++ this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); } protected void func_70088_a() -@@ -233,12 +237,28 @@ +@@ -231,12 +231,25 @@ entitylivingbase = (EntityLivingBase)p_70097_1_.func_76346_g(); } -- if (entitylivingbase != null && this.field_70170_p.field_73013_u == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e()) -+ +- if (entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e()) + int i = MathHelper.func_76128_c(this.field_70165_t); + int j = MathHelper.func_76128_c(this.field_70163_u); + int k = MathHelper.func_76128_c(this.field_70161_v); + -+ SummonAidEvent summonAid = ForgeEventFactory.fireZombieSummonAid(this, field_70170_p, i, j, k, entitylivingbase, this.func_110148_a(field_110186_bp).func_111126_e()); -+ -+ if (summonAid.getResult() == Result.DENY) ++ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, field_70170_p, i, j, k, entitylivingbase, this.func_110148_a(field_110186_bp).func_111126_e()); ++ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true; ++ ++ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || ++ entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e()) { - int i = MathHelper.func_76128_c(this.field_70165_t); - int j = MathHelper.func_76128_c(this.field_70163_u); - int k = MathHelper.func_76128_c(this.field_70161_v); - EntityZombie entityzombie = new EntityZombie(this.field_70170_p); -+ return true; -+ } -+ else if (summonAid.getResult() == Result.ALLOW || entitylivingbase != null && this.field_70170_p.field_73013_u == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e()) -+ { + EntityZombie entityzombie; -+ if (summonAid.customSummonedAid != null && summonAid.getResult() == Result.ALLOW) ++ if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) + { + entityzombie = summonAid.customSummonedAid; + } @@ -54,21 +40,21 @@ for (int l = 0; l < 50; ++l) { -@@ -253,7 +273,7 @@ - if (this.field_70170_p.func_72855_b(entityzombie.field_70121_D) && this.field_70170_p.func_72945_a(entityzombie, entityzombie.field_70121_D).isEmpty() && !this.field_70170_p.func_72953_d(entityzombie.field_70121_D)) +@@ -251,7 +264,7 @@ + if (!this.field_70170_p.func_175636_b((double)i1, (double)j1, (double)k1, 7.0D) && this.field_70170_p.func_72917_a(entityzombie.func_174813_aQ(), entityzombie) && this.field_70170_p.func_72945_a(entityzombie, entityzombie.func_174813_aQ()).isEmpty() && !this.field_70170_p.func_72953_d(entityzombie.func_174813_aQ())) { this.field_70170_p.func_72838_d(entityzombie); - entityzombie.func_70624_b(entitylivingbase); + if (entitylivingbase != null) entityzombie.func_70624_b(entitylivingbase); - entityzombie.func_110161_a((IEntityLivingData)null); + entityzombie.func_180482_a(this.field_70170_p.func_175649_E(new BlockPos(entityzombie)), (IEntityLivingData)null); this.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); entityzombie.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); -@@ -439,7 +459,7 @@ +@@ -458,7 +471,7 @@ - if (p_110161_1_1 == null) + if (p_180482_2_1 == null) { -- p_110161_1_1 = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < 0.05F, this.field_70170_p.field_73012_v.nextFloat() < 0.05F, null); -+ p_110161_1_1 = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < ForgeModContainer.zombieBabyChance, this.field_70170_p.field_73012_v.nextFloat() < 0.05F, null); +- p_180482_2_1 = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < 0.05F, this.field_70170_p.field_73012_v.nextFloat() < 0.05F, null); ++ p_180482_2_1 = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance, this.field_70170_p.field_73012_v.nextFloat() < 0.05F, null); } - if (p_110161_1_1 instanceof EntityZombie.GroupData) + if (p_180482_2_1 instanceof EntityZombie.GroupData) diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch index 72f00a77d9..54fe1eaff2 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityHorse.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityHorse.java -@@ -1227,6 +1227,7 @@ +@@ -1260,6 +1260,7 @@ } this.field_110277_bt = 0.0F; diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch index 0a33c197ac..9d9d51edf5 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch @@ -1,86 +1,62 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityMooshroom.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityMooshroom.java -@@ -1,14 +1,18 @@ - package net.minecraft.entity.passive; - -+import java.util.ArrayList; -+ - import net.minecraft.entity.EntityAgeable; - import net.minecraft.entity.item.EntityItem; - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.init.Blocks; - import net.minecraft.init.Items; - import net.minecraft.item.ItemStack; -+import net.minecraft.world.IBlockAccess; +@@ -9,7 +9,7 @@ + import net.minecraft.util.EnumParticleTypes; import net.minecraft.world.World; -+import net.minecraftforge.common.IShearable; -public class EntityMooshroom extends EntityCow -+public class EntityMooshroom extends EntityCow implements IShearable ++public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable { private static final String __OBFID = "CL_00001645"; -@@ -37,32 +41,7 @@ +@@ -20,6 +20,7 @@ + this.field_175506_bl = Blocks.field_150391_bh; + } + ++ @SuppressWarnings("unused") + public boolean func_70085_c(EntityPlayer p_70085_1_) + { + ItemStack itemstack = p_70085_1_.field_71071_by.func_70448_g(); +@@ -39,7 +40,7 @@ } } - if (itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) ++ if (false && itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) //Forge Disable, Moved to onSheared { -- this.func_70106_y(); -- this.field_70170_p.func_72869_a("largeexplode", this.field_70165_t, this.field_70163_u + (double)(this.field_70131_O / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D); -- -- if (!this.field_70170_p.field_72995_K) -- { -- EntityCow entitycow = new EntityCow(this.field_70170_p); -- entitycow.func_70012_b(this.field_70165_t, this.field_70163_u, this.field_70161_v, this.field_70177_z, this.field_70125_A); -- entitycow.func_70606_j(this.func_110143_aJ()); -- entitycow.field_70761_aq = this.field_70761_aq; -- this.field_70170_p.func_72838_d(entitycow); -- -- for (int i = 0; i < 5; ++i) -- { -- this.field_70170_p.func_72838_d(new EntityItem(this.field_70170_p, this.field_70165_t, this.field_70163_u + (double)this.field_70131_O, this.field_70161_v, new ItemStack(Blocks.field_150337_Q))); -- } -- -- itemstack.func_77972_a(1, p_70085_1_); -- this.func_85030_a("mob.sheep.shear", 1.0F, 1.0F); -- } -- -- return true; -- } -- else -- { - return super.func_70085_c(p_70085_1_); - } - } -@@ -71,4 +50,30 @@ + this.func_70106_y(); + this.field_70170_p.func_175688_a(EnumParticleTypes.EXPLOSION_LARGE, this.field_70165_t, this.field_70163_u + (double)(this.field_70131_O / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D, new int[0]); +@@ -79,4 +80,33 @@ { return new EntityMooshroom(this.field_70170_p); } + ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos){ return func_70874_b() >= 0; } + @Override -+ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos, int fortune) + { -+ return func_70874_b() >= 0; -+ } ++ this.func_70106_y(); ++ this.field_70170_p.func_175688_a(EnumParticleTypes.EXPLOSION_LARGE, this.field_70165_t, this.field_70163_u + (double)(this.field_70131_O / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D, new int[0]); + -+ @Override -+ public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) -+ { -+ func_70106_y(); -+ EntityCow entitycow = new EntityCow(field_70170_p); -+ entitycow.func_70012_b(field_70165_t, field_70163_u, field_70161_v, field_70177_z, field_70125_A); ++ EntityCow entitycow = new EntityCow(this.field_70170_p); ++ entitycow.func_70012_b(this.field_70165_t, this.field_70163_u, this.field_70161_v, this.field_70177_z, this.field_70125_A); + entitycow.func_70606_j(this.func_110143_aJ()); -+ entitycow.field_70761_aq = field_70761_aq; -+ field_70170_p.func_72838_d(entitycow); -+ field_70170_p.func_72869_a("largeexplode", field_70165_t, field_70163_u + (double)(field_70131_O / 2.0F), field_70161_v, 0.0D, 0.0D, 0.0D); ++ entitycow.field_70761_aq = this.field_70761_aq; + -+ ArrayList ret = new ArrayList(); -+ for (int i = 0; i < 5; i++) ++ if (this.func_145818_k_()) ++ { ++ entitycow.func_96094_a(this.func_95999_t()); ++ } ++ ++ this.field_70170_p.func_72838_d(entitycow); ++ ++ java.util.List ret = new java.util.ArrayList(); ++ for (int i = 0; i < 5; ++i) + { + ret.add(new ItemStack(Blocks.field_150337_Q)); + } -+ func_85030_a("mob.sheep.shear", 1.0F, 1.0F); ++ ++ this.func_85030_a("mob.sheep.shear", 1.0F, 1.0F); + return ret; + } } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch index f110d1d71d..6219ce05ba 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java -@@ -281,7 +281,7 @@ +@@ -276,7 +276,7 @@ - Block block = this.field_70170_p.func_147439_a(i, j - 1, k); + Block block = this.field_70170_p.func_180495_p(blockpos.func_177977_b()).func_177230_c(); -- if (block == Blocks.field_150349_c || block.func_149688_o() == Material.field_151584_j) -+ if (block == Blocks.field_150349_c || block.isLeaves(field_70170_p, i, j - 1, k)) - { - return true; - } +- if (block == Blocks.field_150349_c || block.func_149688_o() == Material.field_151584_j) ++ if (block == Blocks.field_150349_c || block.isLeaves(field_70170_p, blockpos.func_177977_b())) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch index 98dd31ca5b..6faf82c502 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch @@ -1,76 +1,44 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntitySheep.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntitySheep.java -@@ -2,6 +2,7 @@ - - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.ArrayList; - import java.util.Random; - import net.minecraft.block.Block; - import net.minecraft.entity.EntityAgeable; -@@ -27,9 +28,11 @@ - import net.minecraft.item.crafting.CraftingManager; - import net.minecraft.nbt.NBTTagCompound; - import net.minecraft.util.MathHelper; -+import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; -+import net.minecraftforge.common.IShearable; +@@ -35,7 +35,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; -public class EntitySheep extends EntityAnimal -+public class EntitySheep extends EntityAnimal implements IShearable ++public class EntitySheep extends EntityAnimal implements net.minecraftforge.common.IShearable { private final InventoryCrafting field_90016_e = new InventoryCrafting(new Container() { -@@ -124,28 +127,6 @@ +@@ -142,11 +142,12 @@ + } + } ++ @SuppressWarnings("unused") public boolean func_70085_c(EntityPlayer p_70085_1_) { -- ItemStack itemstack = p_70085_1_.field_71071_by.func_70448_g(); -- -- if (itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) -- { -- if (!this.field_70170_p.field_72995_K) -- { -- this.func_70893_e(true); -- int i = 1 + this.field_70146_Z.nextInt(3); -- -- for (int j = 0; j < i; ++j) -- { -- EntityItem entityitem = this.func_70099_a(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, this.func_70896_n()), 1.0F); -- entityitem.field_70181_x += (double)(this.field_70146_Z.nextFloat() * 0.05F); -- entityitem.field_70159_w += (double)((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.1F); -- entityitem.field_70179_y += (double)((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.1F); -- } -- } -- -- itemstack.func_77972_a(1, p_70085_1_); -- this.func_85030_a("mob.sheep.shear", 1.0F, 1.0F); -- } -- - return super.func_70085_c(p_70085_1_); - } + ItemStack itemstack = p_70085_1_.field_71071_by.func_70448_g(); -@@ -290,4 +271,24 @@ - { - return 15 - ((EntitySheep)p_90013_1_).func_70896_n(); +- if (itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) ++ if (false && itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) //Forge: Moved to onSheared + { + if (!this.field_70170_p.field_72995_K) + { +@@ -334,4 +335,19 @@ + field_175514_bm.put(EnumDyeColor.RED, new float[] {0.6F, 0.2F, 0.2F}); + field_175514_bm.put(EnumDyeColor.BLACK, new float[] {0.1F, 0.1F, 0.1F}); } + ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return !this.func_70892_o() && !this.func_70631_g_(); } + @Override -+ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ return !func_70892_o() && !func_70631_g_(); -+ } ++ this.func_70893_e(true); ++ int i = 1 + this.field_70146_Z.nextInt(3); ++ ++ java.util.List ret = new java.util.ArrayList(); ++ for (int j = 0; j < i; ++j) ++ ret.add(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, this.func_175509_cj().func_176765_a())); + -+ @Override -+ public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) -+ { -+ ArrayList ret = new ArrayList(); -+ func_70893_e(true); -+ int i = 1 + field_70146_Z.nextInt(3); -+ for (int j = 0; j < i; j++) -+ { -+ ret.add(new ItemStack(Blocks.field_150325_L, 1, func_70896_n())); -+ } + this.func_85030_a("mob.sheep.shear", 1.0F, 1.0F); + return ret; + } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch index 4785b4f689..5fc7b52bc8 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java -@@ -180,7 +180,7 @@ +@@ -229,7 +229,7 @@ ItemStack itemstack = p_70085_1_.field_71071_by.func_70448_g(); boolean flag = itemstack != null && itemstack.func_77973_b() == Items.field_151063_bx; - if (!flag && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_()) + if (!flag && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_() && !p_70085_1_.func_70093_af()) { - if (!this.field_70170_p.field_72995_K) + if (!this.field_70170_p.field_72995_K && (this.field_70963_i == null || this.field_70963_i.size() > 0)) { diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index d7d3003ba6..9961bd6a60 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -1,23 +1,9 @@ --- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java +++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java -@@ -8,9 +8,12 @@ - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; - import java.util.Collection; -+import java.util.HashMap; - import java.util.Iterator; - import java.util.List; - import java.util.UUID; -+import java.util.Map.Entry; -+ - import net.minecraft.block.Block; - import net.minecraft.block.BlockBed; - import net.minecraft.block.material.Material; -@@ -77,8 +80,24 @@ +@@ -77,9 +77,23 @@ import net.minecraft.world.WorldSettings; - import net.minecraft.world.chunk.IChunkProvider; - -+import net.minecraftforge.common.ForgeHooks; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.common.ISpecialArmor.ArmorProperties; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.ForgeEventFactory; @@ -28,77 +14,63 @@ +import net.minecraftforge.event.entity.player.PlayerDropsEvent; +import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent; +import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; -+ - public abstract class EntityPlayer extends EntityLivingBase implements ICommandSender + + public abstract class EntityPlayer extends EntityLivingBase { + public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; -+ private HashMap spawnChunkMap = new HashMap(); -+ private HashMap spawnForcedMap = new HashMap(); ++ private java.util.HashMap spawnChunkMap = new java.util.HashMap(); ++ private java.util.HashMap spawnForcedMap = new java.util.HashMap(); + public InventoryPlayer field_71071_by = new InventoryPlayer(this); private InventoryEnderChest field_71078_a = new InventoryEnderChest(); public Container field_71069_bz; -@@ -129,6 +148,7 @@ - this.func_70012_b((double)chunkcoordinates.field_71574_a + 0.5D, (double)(chunkcoordinates.field_71572_b + 1), (double)chunkcoordinates.field_71573_c + 0.5D, 0.0F, 0.0F); - this.field_70741_aB = 180.0F; - this.field_70174_ab = 20; -+ this.eyeHeight = this.getDefaultEyeHeight(); - } - - protected void func_110147_ax() -@@ -172,7 +192,8 @@ +@@ -176,7 +190,8 @@ { if (this.field_71074_e != null) { - this.field_71074_e.func_77974_b(this.field_70170_p, this, this.field_71072_f); -+ if (!ForgeEventFactory.onUseItemStop(this, field_71074_e, field_71072_f)) ++ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_71074_e, this.field_71072_f)) + this.field_71074_e.func_77974_b(this.field_70170_p, this, this.field_71072_f); } this.func_71041_bz(); -@@ -203,14 +224,23 @@ +@@ -214,6 +229,14 @@ if (itemstack == this.field_71074_e) { -- if (this.field_71072_f <= 25 && this.field_71072_f % 4 == 0) -+ field_71072_f = ForgeEventFactory.onItemUseTick(this, field_71074_e, field_71072_f); ++ field_71072_f = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_71074_e, field_71072_f); + if (field_71072_f <= 0) - { -- this.func_71010_c(itemstack, 5); ++ { + this.func_71036_o(); - } -- -- if (--this.field_71072_f == 0 && !this.field_70170_p.field_72995_K) ++ } + else ++ { // Forge Keep unindented to lower patch ++ field_71074_e.func_77973_b().onUsingTick(field_71074_e, this, field_71072_f); //Forge Added + if (this.field_71072_f <= 25 && this.field_71072_f % 4 == 0) { -- this.func_71036_o(); -+ field_71074_e.func_77973_b().onUsingTick(field_71074_e, this, field_71072_f); -+ if (this.field_71072_f <= 25 && this.field_71072_f % 4 == 0) -+ { -+ this.func_71010_c(itemstack, 5); -+ } -+ -+ if (--this.field_71072_f == 0 && !this.field_70170_p.field_72995_K) -+ { -+ this.func_71036_o(); -+ } + this.func_71010_c(itemstack, 5); +@@ -223,6 +246,7 @@ + { + this.func_71036_o(); } ++ } } else -@@ -257,7 +287,7 @@ + { +@@ -268,7 +292,7 @@ super.func_70071_h_(); - if (!this.field_70170_p.field_72995_K && this.field_71070_bA != null && !this.field_71070_bA.func_75145_c(this)) -+ if (!this.field_70170_p.field_72995_K && this.field_71070_bA != null && !ForgeHooks.canInteractWith(this, this.field_71070_bA)) ++ if (!this.field_70170_p.field_72995_K && this.field_71070_bA != null && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.field_71070_bA)) { this.func_71053_j(); this.field_71070_bA = this.field_71069_bz; -@@ -388,11 +418,13 @@ +@@ -415,11 +439,13 @@ int i = this.field_71074_e.field_77994_a; ItemStack itemstack = this.field_71074_e.func_77950_b(this.field_70170_p, this); -+ itemstack = ForgeEventFactory.onItemUseFinish(this, field_71074_e, field_71072_f, itemstack); ++ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, field_71074_e, field_71072_f, itemstack); + if (itemstack != this.field_71074_e || itemstack != null && itemstack.field_77994_a != i) { @@ -109,7 +81,7 @@ { this.field_71071_by.field_70462_a[this.field_71071_by.field_70461_c] = null; } -@@ -466,11 +498,11 @@ +@@ -479,11 +505,11 @@ this.field_71109_bG = 0.0F; this.func_71015_k(this.field_70165_t - d0, this.field_70163_u - d1, this.field_70161_v - d2); @@ -123,11 +95,11 @@ } } } -@@ -595,11 +627,15 @@ +@@ -613,11 +639,15 @@ public void func_70645_a(DamageSource p_70645_1_) { -+ if (ForgeHooks.onLivingDeath(this, p_70645_1_)) return; ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; super.func_70645_a(p_70645_1_); this.func_70105_a(0.2F, 0.2F); this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); @@ -139,28 +111,17 @@ if (this.func_70005_c_().equals("Notch")) { this.func_146097_a(new ItemStack(Items.field_151034_e, 1), true, false); -@@ -610,6 +646,20 @@ +@@ -628,6 +658,9 @@ this.field_71071_by.func_70436_m(); } + captureDrops = false; -+ -+ if (!field_70170_p.field_72995_K) -+ { -+ PlayerDropsEvent event = new PlayerDropsEvent(this, p_70645_1_, capturedDrops, field_70718_bc > 0); -+ if (!MinecraftForge.EVENT_BUS.post(event)) -+ { -+ for (EntityItem item : capturedDrops) -+ { -+ func_71012_a(item); -+ } -+ } -+ } ++ if (!field_70170_p.field_72995_K) net.minecraftforge.event.ForgeEventFactory.onPlayerDrops(this, p_70645_1_, capturedDrops, field_70718_bc > 0); + if (p_70645_1_ != null) { this.field_70159_w = (double)(-MathHelper.func_76134_b((this.field_70739_aP + this.field_70177_z) * (float)Math.PI / 180.0F) * 0.1F); -@@ -661,12 +711,25 @@ +@@ -716,12 +749,25 @@ public EntityItem func_71040_bB(boolean p_71040_1_) { @@ -175,7 +136,7 @@ + if (stack.func_77973_b().onDroppedByPlayer(stack, this)) + { + int count = p_71040_1_ && this.field_71071_by.func_70448_g() != null ? this.field_71071_by.func_70448_g().field_77994_a : 1; -+ return ForgeHooks.onPlayerTossEvent(this, field_71071_by.func_70298_a(field_71071_by.field_70461_c, count), true); ++ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, field_71071_by.func_70298_a(field_71071_by.field_70461_c, count), true); + } + + return null; @@ -184,11 +145,11 @@ public EntityItem func_71019_a(ItemStack p_71019_1_, boolean p_71019_2_) { - return this.func_146097_a(p_71019_1_, false, false); -+ return ForgeHooks.onPlayerTossEvent(this, p_71019_1_, false); ++ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, p_71019_1_, false); } public EntityItem func_146097_a(ItemStack p_146097_1_, boolean p_146097_2_, boolean p_146097_3_) -@@ -722,13 +785,31 @@ +@@ -782,13 +828,25 @@ public void func_71012_a(EntityItem p_71012_1_) { @@ -200,55 +161,38 @@ this.field_70170_p.func_72838_d(p_71012_1_); } -+ @Deprecated //Metadata sensitive version, named getBreakSpeed - public float func_146096_a(Block p_146096_1_, boolean p_146096_2_) ++ @Deprecated //Use location sensitive version below + public float func_180471_a(Block p_180471_1_) { -- float f = this.field_71071_by.func_146023_a(p_146096_1_); -+ return getBreakSpeed(p_146096_1_, p_146096_2_, 0, 0, -1, 0); +- float f = this.field_71071_by.func_146023_a(p_180471_1_); ++ return getBreakSpeed(p_180471_1_.func_176223_P(), new BlockPos(0, -1, 0)); + } -+ @Deprecated //Location Specifc, one below, remove in 1.8 -+ public float getBreakSpeed(Block p_146096_1_, boolean p_146096_2_, int meta) -+ { -+ return getBreakSpeed(p_146096_1_, p_146096_2_, meta, 0, -1, 0); -+ } -+ -+ public float getBreakSpeed(Block p_146096_1_, boolean p_146096_2_, int meta, int x, int y, int z) ++ public float getBreakSpeed(IBlockState state, BlockPos pos) + { + ItemStack stack = field_71071_by.func_70448_g(); -+ float f = (stack == null ? 1.0F : stack.func_77973_b().getDigSpeed(stack, p_146096_1_, meta)); ++ float f = (stack == null ? 1.0F : stack.func_77973_b().getDigSpeed(stack, state)); + if (f > 1.0F) { int i = EnchantmentHelper.func_77509_b(this); -@@ -738,7 +819,9 @@ - { - float f1 = (float)(i * i + 1); - -- if (!itemstack.func_150998_b(p_146096_1_) && f <= 1.0F) -+ boolean canHarvest = ForgeHooks.canToolHarvestBlock(p_146096_1_, meta, itemstack); -+ -+ if (!canHarvest && f <= 1.0F) - { - f += f1 * 0.08F; - } -@@ -769,12 +852,13 @@ +@@ -838,12 +896,13 @@ f /= 5.0F; } - return f; -+ f = ForgeEventFactory.getBreakSpeed(this, p_146096_1_, meta, f, x, y, z); ++ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos); + return (f < 0 ? 0 : f); } public boolean func_146099_a(Block p_146099_1_) { - return this.field_71071_by.func_146025_b(p_146099_1_); -+ return ForgeEventFactory.doPlayerHarvestCheck(this, p_146099_1_, this.field_71071_by.func_146025_b(p_146099_1_)); ++ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_146099_1_, this.field_71071_by.func_146025_b(p_146099_1_)); } public void func_70037_a(NBTTagCompound p_70037_1_) -@@ -803,6 +887,16 @@ +@@ -879,6 +938,16 @@ this.field_82248_d = p_70037_1_.func_74767_n("SpawnForced"); } @@ -258,29 +202,29 @@ + { + NBTTagCompound spawndata = (NBTTagCompound)spawnlist.func_150305_b(i); + int spawndim = spawndata.func_74762_e("Dim"); -+ this.spawnChunkMap.put(spawndim, new ChunkCoordinates(spawndata.func_74762_e("SpawnX"), spawndata.func_74762_e("SpawnY"), spawndata.func_74762_e("SpawnZ"))); ++ this.spawnChunkMap.put(spawndim, new BlockPos(spawndata.func_74762_e("SpawnX"), spawndata.func_74762_e("SpawnY"), spawndata.func_74762_e("SpawnZ"))); + this.spawnForcedMap.put(spawndim, spawndata.func_74767_n("SpawnForced")); + } + this.field_71100_bB.func_75112_a(p_70037_1_); this.field_71075_bZ.func_75095_b(p_70037_1_); -@@ -833,6 +927,23 @@ +@@ -910,6 +979,23 @@ p_70014_1_.func_74757_a("SpawnForced", this.field_82248_d); } + NBTTagList spawnlist = new NBTTagList(); -+ for (Entry entry : this.spawnChunkMap.entrySet()) ++ for (java.util.Map.Entry entry : this.spawnChunkMap.entrySet()) + { -+ ChunkCoordinates spawn = entry.getValue(); ++ BlockPos spawn = entry.getValue(); + if (spawn == null) continue; + Boolean forced = spawnForcedMap.get(entry.getKey()); + if (forced == null) forced = false; + NBTTagCompound spawndata = new NBTTagCompound(); + spawndata.func_74768_a("Dim", entry.getKey()); -+ spawndata.func_74768_a("SpawnX", spawn.field_71574_a); -+ spawndata.func_74768_a("SpawnY", spawn.field_71572_b); -+ spawndata.func_74768_a("SpawnZ", spawn.field_71573_c); ++ spawndata.func_74768_a("SpawnX", spawn.func_177958_n()); ++ spawndata.func_74768_a("SpawnY", spawn.func_177956_o()); ++ spawndata.func_74768_a("SpawnZ", spawn.func_177952_p()); + spawndata.func_74757_a("SpawnForced", forced); + spawnlist.func_74742_a(spawndata); + } @@ -289,28 +233,19 @@ this.field_71100_bB.func_75117_b(p_70014_1_); this.field_71075_bZ.func_75091_a(p_70014_1_); p_70014_1_.func_74782_a("EnderItems", this.field_71078_a.func_70487_g()); -@@ -854,7 +965,7 @@ - - public float func_70047_e() - { -- return 0.12F; -+ return eyeHeight; - } - - protected void func_71061_d_() -@@ -864,6 +975,7 @@ +@@ -923,6 +1009,7 @@ public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { -+ if (ForgeHooks.onLivingAttack(this, p_70097_1_, p_70097_2_)) return false; - if (this.func_85032_ar()) ++ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, p_70097_1_, p_70097_2_)) return false; + if (this.func_180431_b(p_70097_1_)) { return false; -@@ -965,12 +1077,15 @@ +@@ -1023,12 +1110,15 @@ { - if (!this.func_85032_ar()) + if (!this.func_180431_b(p_70665_1_)) { -+ p_70665_2_ = ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_); ++ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_); + if (p_70665_2_ <= 0) return; if (!p_70665_1_.func_76363_c() && this.func_70632_aY() && p_70665_2_ > 0.0F) { @@ -318,129 +253,109 @@ } - p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); -+ p_70665_2_ = ArmorProperties.ApplyArmor(this, field_71071_by.field_70460_b, p_70665_1_, p_70665_2_); ++ p_70665_2_ = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, field_71071_by.field_70460_b, p_70665_1_, p_70665_2_); + if (p_70665_2_ <= 0) return; p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); float f1 = p_70665_2_; p_70665_2_ = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F); -@@ -1004,6 +1119,7 @@ +@@ -1076,6 +1166,7 @@ + } + else + { ++ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, p_70998_1_)) return false; + ItemStack itemstack = this.func_71045_bC(); + ItemStack itemstack1 = itemstack != null ? itemstack.func_77946_l() : null; - public boolean func_70998_m(Entity p_70998_1_) - { -+ if (MinecraftForge.EVENT_BUS.post(new EntityInteractEvent(this, p_70998_1_))) return false; - ItemStack itemstack = this.func_71045_bC(); - ItemStack itemstack1 = itemstack != null ? itemstack.func_77946_l() : null; - -@@ -1054,7 +1170,9 @@ +@@ -1127,7 +1218,9 @@ public void func_71028_bD() { + ItemStack orig = func_71045_bC(); this.field_71071_by.func_70299_a(this.field_71071_by.field_70461_c, (ItemStack)null); -+ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this, orig)); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, orig); } public double func_70033_W() -@@ -1064,6 +1182,15 @@ +@@ -1137,6 +1230,7 @@ public void func_71059_n(Entity p_71059_1_) { -+ if (MinecraftForge.EVENT_BUS.post(new AttackEntityEvent(this, p_71059_1_))) -+ { -+ return; -+ } -+ ItemStack stack = func_71045_bC(); -+ if (stack != null && stack.func_77973_b().onLeftClickEntity(stack, this, p_71059_1_)) -+ { -+ return; -+ } ++ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, p_71059_1_)) return; if (p_71059_1_.func_70075_an()) { if (!p_71059_1_.func_85031_j(this)) -@@ -1211,6 +1338,12 @@ +@@ -1307,6 +1401,8 @@ - public EntityPlayer.EnumStatus func_71018_a(int p_71018_1_, int p_71018_2_, int p_71018_3_) + public EntityPlayer.EnumStatus func_180469_a(BlockPos p_180469_1_) { -+ PlayerSleepInBedEvent event = new PlayerSleepInBedEvent(this, p_71018_1_, p_71018_2_, p_71018_3_); -+ MinecraftForge.EVENT_BUS.post(event); -+ if (event.result != null) -+ { -+ return event.result; -+ } ++ EntityPlayer.EnumStatus ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, p_180469_1_); ++ if (ret != null) return ret; if (!this.field_70170_p.field_72995_K) { if (this.func_70608_bn() || !this.func_70089_S()) -@@ -1253,8 +1386,7 @@ +@@ -1348,7 +1444,7 @@ - if (this.field_70170_p.func_72899_e(p_71018_1_, p_71018_2_, p_71018_3_)) + if (this.field_70170_p.func_175667_e(p_180469_1_)) { -- int i1 = this.field_70170_p.func_72805_g(p_71018_1_, p_71018_2_, p_71018_3_); -- int l = BlockBed.func_149895_l(i1); -+ int l = field_70170_p.func_147439_a(p_71018_1_, p_71018_2_, p_71018_3_).getBedDirection(field_70170_p, p_71018_1_, p_71018_2_, p_71018_3_); - float f1 = 0.5F; +- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(p_180469_1_).func_177229_b(BlockDirectional.field_176387_N); ++ EnumFacing enumfacing = this.field_70170_p.func_180495_p(p_180469_1_).func_177230_c().getBedDirection(field_70170_p, p_180469_1_); float f = 0.5F; + float f1 = 0.5F; -@@ -1317,15 +1449,17 @@ +@@ -1411,13 +1507,14 @@ public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) { -+ MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerWakeUpEvent(this)); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this); this.func_70105_a(0.6F, 1.8F); - this.func_71061_d_(); - ChunkCoordinates chunkcoordinates = this.field_71081_bT; - ChunkCoordinates chunkcoordinates1 = this.field_71081_bT; -+ Block block = (chunkcoordinates == null ? null : field_70170_p.func_147439_a(chunkcoordinates.field_71574_a, chunkcoordinates.field_71572_b, chunkcoordinates.field_71573_c)); + IBlockState iblockstate = this.field_70170_p.func_180495_p(this.field_71081_bT); -- if (chunkcoordinates != null && this.field_70170_p.func_147439_a(chunkcoordinates.field_71574_a, chunkcoordinates.field_71572_b, chunkcoordinates.field_71573_c) == Blocks.field_150324_C) -+ if (chunkcoordinates != null && block.isBed(field_70170_p, chunkcoordinates.field_71574_a, chunkcoordinates.field_71572_b, chunkcoordinates.field_71573_c, this)) +- if (this.field_71081_bT != null && iblockstate.func_177230_c() == Blocks.field_150324_C) ++ if (this.field_71081_bT != null && iblockstate.func_177230_c().isBed(field_70170_p, field_71081_bT, this)) { -- BlockBed.func_149979_a(this.field_70170_p, chunkcoordinates.field_71574_a, chunkcoordinates.field_71572_b, chunkcoordinates.field_71573_c, false); -- chunkcoordinates1 = BlockBed.func_149977_a(this.field_70170_p, chunkcoordinates.field_71574_a, chunkcoordinates.field_71572_b, chunkcoordinates.field_71573_c, 0); -+ block.setBedOccupied(this.field_70170_p, chunkcoordinates.field_71574_a, chunkcoordinates.field_71572_b, chunkcoordinates.field_71573_c, this, false); -+ chunkcoordinates1 = block.getBedSpawnPosition(this.field_70170_p, chunkcoordinates.field_71574_a, chunkcoordinates.field_71572_b, chunkcoordinates.field_71573_c, this); +- this.field_70170_p.func_180501_a(this.field_71081_bT, iblockstate.func_177226_a(BlockBed.field_176471_b, Boolean.valueOf(false)), 4); +- BlockPos blockpos = BlockBed.func_176468_a(this.field_70170_p, this.field_71081_bT, 0); ++ iblockstate.func_177230_c().setBedOccupied(field_70170_p, field_71081_bT, this, false); ++ BlockPos blockpos = iblockstate.func_177230_c().getBedSpawnPosition(field_70170_p, field_71081_bT, this); - if (chunkcoordinates1 == null) + if (blockpos == null) { -@@ -1359,7 +1493,7 @@ +@@ -1444,12 +1541,12 @@ - private boolean func_71065_l() + private boolean func_175143_p() { -- return this.field_70170_p.func_147439_a(this.field_71081_bT.field_71574_a, this.field_71081_bT.field_71572_b, this.field_71081_bT.field_71573_c) == Blocks.field_150324_C; -+ return this.field_70170_p.func_147439_a(this.field_71081_bT.field_71574_a, this.field_71081_bT.field_71572_b, this.field_71081_bT.field_71573_c).isBed(field_70170_p, field_71081_bT.field_71574_a, field_71081_bT.field_71572_b, field_71081_bT.field_71573_c, this); +- return this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c() == Blocks.field_150324_C; ++ return this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c().isBed(field_70170_p, field_71081_bT, this); } - public static ChunkCoordinates func_71056_a(World p_71056_0_, ChunkCoordinates p_71056_1_, boolean p_71056_2_) -@@ -1370,9 +1504,9 @@ - ichunkprovider.func_73158_c(p_71056_1_.field_71574_a - 3 >> 4, p_71056_1_.field_71573_c + 3 >> 4); - ichunkprovider.func_73158_c(p_71056_1_.field_71574_a + 3 >> 4, p_71056_1_.field_71573_c + 3 >> 4); - -- if (p_71056_0_.func_147439_a(p_71056_1_.field_71574_a, p_71056_1_.field_71572_b, p_71056_1_.field_71573_c) == Blocks.field_150324_C) -+ if (p_71056_0_.func_147439_a(p_71056_1_.field_71574_a, p_71056_1_.field_71572_b, p_71056_1_.field_71573_c).isBed(p_71056_0_, p_71056_1_.field_71574_a, p_71056_1_.field_71572_b, p_71056_1_.field_71573_c, null)) + public static BlockPos func_180467_a(World p_180467_0_, BlockPos p_180467_1_, boolean p_180467_2_) + { +- if (p_180467_0_.func_180495_p(p_180467_1_).func_177230_c() != Blocks.field_150324_C) ++ if (!p_180467_0_.func_180495_p(p_180467_1_).func_177230_c().isBed(p_180467_0_, p_180467_1_, null)) { -- ChunkCoordinates chunkcoordinates1 = BlockBed.func_149977_a(p_71056_0_, p_71056_1_.field_71574_a, p_71056_1_.field_71572_b, p_71056_1_.field_71573_c, 0); -+ ChunkCoordinates chunkcoordinates1 = p_71056_0_.func_147439_a(p_71056_1_.field_71574_a, p_71056_1_.field_71572_b, p_71056_1_.field_71573_c).getBedSpawnPosition(p_71056_0_, p_71056_1_.field_71574_a, p_71056_1_.field_71572_b, p_71056_1_.field_71573_c, null); - return chunkcoordinates1; + if (!p_180467_2_) + { +@@ -1466,7 +1563,7 @@ } else -@@ -1390,8 +1524,10 @@ + { +- return BlockBed.func_176468_a(p_180467_0_, p_180467_1_, 0); ++ return p_180467_0_.func_180495_p(p_180467_1_).func_177230_c().getBedSpawnPosition(p_180467_0_, p_180467_1_, null); + } + } + +@@ -1475,7 +1572,7 @@ { if (this.field_71081_bT != null) { -- int i = this.field_70170_p.func_72805_g(this.field_71081_bT.field_71574_a, this.field_71081_bT.field_71572_b, this.field_71081_bT.field_71573_c); -- int j = BlockBed.func_149895_l(i); -+ int x = field_71081_bT.field_71574_a; -+ int y = field_71081_bT.field_71572_b; -+ int z = field_71081_bT.field_71573_c; -+ int j = field_70170_p.func_147439_a(x, y, z).getBedDirection(field_70170_p, x, y, z); +- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(this.field_71081_bT).func_177229_b(BlockDirectional.field_176387_N); ++ EnumFacing enumfacing = this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c().getBedDirection(field_70170_p, field_71081_bT); - switch (j) + switch (EntityPlayer.SwitchEnumFacing.field_179420_a[enumfacing.ordinal()]) { -@@ -1447,18 +1583,25 @@ +@@ -1513,16 +1610,22 @@ - public void func_146105_b(IChatComponent p_146105_1_) {} - -+ @Deprecated - public ChunkCoordinates func_70997_bJ() + public BlockPos func_180470_cg() { - return this.field_71077_c; + return getBedLocation(this.field_71093_bK); @@ -453,57 +368,37 @@ + return isSpawnForced(this.field_71093_bK); } - public void func_71063_a(ChunkCoordinates p_71063_1_, boolean p_71063_2_) + public void func_180473_a(BlockPos p_180473_1_, boolean p_180473_2_) { + if (this.field_71093_bK != 0) + { -+ setSpawnChunk(p_71063_1_, p_71063_2_, this.field_71093_bK); ++ setSpawnChunk(p_180473_1_, p_180473_2_, this.field_71093_bK); + return; + } - if (p_71063_1_ != null) + if (p_180473_1_ != null) { - this.field_71077_c = new ChunkCoordinates(p_71063_1_); -@@ -1632,6 +1775,10 @@ + this.field_71077_c = p_180473_1_; +@@ -1704,6 +1807,10 @@ - super.func_70069_a(p_70069_1_); + super.func_180430_e(p_180430_1_, p_180430_2_); } + else + { -+ MinecraftForge.EVENT_BUS.post(new PlayerFlyableFallEvent(this, p_70069_1_)); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, p_180430_1_, p_180430_2_); + } } - protected String func_146067_o(int p_146067_1_) -@@ -1674,11 +1821,6 @@ - } - else - { -- if (p_70620_1_.func_77973_b().func_77623_v()) -- { -- return p_70620_1_.func_77973_b().func_77618_c(p_70620_1_.func_77960_j(), p_70620_2_); -- } -- - if (this.field_71074_e != null && p_70620_1_.func_77973_b() == Items.field_151031_f) - { - int j = p_70620_1_.func_77988_m() - this.field_71072_f; -@@ -1698,6 +1840,7 @@ - return Items.field_151031_f.func_94599_c(0); - } - } -+ iicon = p_70620_1_.func_77973_b().getIcon(p_70620_1_, p_70620_2_, this, field_71074_e, field_71072_f); - } - - return iicon; -@@ -1781,6 +1924,8 @@ + protected void func_71061_d_() +@@ -1839,6 +1946,8 @@ { if (p_71008_1_ != this.field_71074_e) { -+ p_71008_2_ = ForgeEventFactory.onItemUseStart(this, p_71008_1_, p_71008_2_); ++ p_71008_2_ = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, p_71008_1_, p_71008_2_); + if (p_71008_2_ <= 0) return; this.field_71074_e = p_71008_1_; this.field_71072_f = p_71008_2_; -@@ -1864,6 +2009,10 @@ +@@ -1908,6 +2017,10 @@ this.field_71106_cc = p_71049_1_.field_71106_cc; this.func_85040_s(p_71049_1_.func_71037_bA()); this.field_82152_aq = p_71049_1_.field_82152_aq; @@ -514,10 +409,10 @@ } else if (this.field_70170_p.func_82736_K().func_82766_b("keepInventory")) { -@@ -1875,6 +2024,18 @@ - } +@@ -1920,6 +2033,18 @@ this.field_71078_a = p_71049_1_.field_71078_a; + this.func_70096_w().func_75692_b(10, Byte.valueOf(p_71049_1_.func_70096_w().func_75683_a(10))); + + this.spawnChunkMap = p_71049_1_.spawnChunkMap; + this.spawnForcedMap = p_71049_1_.spawnForcedMap; @@ -529,16 +424,16 @@ + { + getEntityData().func_74782_a(PERSISTED_NBT_TAG, old.func_74775_l(PERSISTED_NBT_TAG)); + } -+ MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerEvent.Clone(this, p_71049_1_, !p_71049_2_)); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, p_71049_1_, !p_71049_2_); } protected boolean func_70041_e_() -@@ -1913,7 +2074,14 @@ +@@ -1953,7 +2078,14 @@ public void func_70062_b(int p_70062_1_, ItemStack p_70062_2_) { - this.field_71071_by.field_70460_b[p_70062_1_] = p_70062_2_; -+ if (p_70062_1_ == 0) ++ if (p_70062_1_ == 0) //Forge: Fix issue in Player where it doen't take into account selected item + { + this.field_71071_by.field_70462_a[this.field_71071_by.field_70461_c] = p_70062_2_; + } @@ -549,43 +444,27 @@ } @SideOnly(Side.CLIENT) -@@ -1958,7 +2126,7 @@ +@@ -1998,7 +2130,7 @@ public IChatComponent func_145748_c_() { - ChatComponentText chatcomponenttext = new ChatComponentText(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.func_70005_c_())); -+ ChatComponentText chatcomponenttext = new ChatComponentText(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.getDisplayName())); ++ ChatComponentText chatcomponenttext = new ChatComponentText(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.getDisplayNameString())); chatcomponenttext.func_150256_b().func_150241_a(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.func_70005_c_() + " ")); - return chatcomponenttext; - } -@@ -2041,6 +2209,118 @@ - FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); + chatcomponenttext.func_150256_b().func_150209_a(this.func_174823_aP()); + chatcomponenttext.func_150256_b().func_179989_a(this.func_70005_c_()); +@@ -2157,6 +2289,101 @@ + net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); } -+ /* ======================================== FORGE START =====================================*/ -+ @SideOnly(Side.CLIENT) -+ @Override -+ public Vec3 func_70666_h(float par1) -+ { -+ if (par1 == 1.0F) -+ { -+ return Vec3.func_72443_a(this.field_70165_t, this.field_70163_u + (this.func_70047_e() - this.getDefaultEyeHeight()), this.field_70161_v); -+ } -+ else -+ { -+ double d0 = this.field_70169_q + (this.field_70165_t - this.field_70169_q) * (double)par1; -+ double d1 = this.field_70167_r + (this.field_70163_u - this.field_70167_r) * (double)par1 + (this.func_70047_e() - this.getDefaultEyeHeight()); -+ double d2 = this.field_70166_s + (this.field_70161_v - this.field_70166_s) * (double)par1; -+ return Vec3.func_72443_a(d0, d1, d2); -+ } -+ } + ++ /* ======================================== FORGE START =====================================*/ + /** + * A dimension aware version of getBedLocation. + * @param dimension The dimension to get the bed spawn for + * @return The player specific spawn location for the dimension. May be null. + */ -+ public ChunkCoordinates getBedLocation(int dimension) ++ public BlockPos getBedLocation(int dimension) + { + return dimension == 0 ? field_71077_c : spawnChunkMap.get(dimension); + } @@ -607,17 +486,17 @@ + /** + * A dimension aware version of setSpawnChunk. + * This functions identically, but allows you to specify which dimension to affect, rather than affecting the player's current dimension. -+ * @param chunkCoordinates The spawn point to set as the player-specific spawn point for the dimension ++ * @param pos The spawn point to set as the player-specific spawn point for the dimension + * @param forced Whether or not the respawn code should check for a bed at this location (true means it won't check for a bed) + * @param dimension Which dimension to apply the player-specific respawn point to + */ -+ public void setSpawnChunk(ChunkCoordinates chunkCoordinates, boolean forced, int dimension) ++ public void setSpawnChunk(BlockPos pos, boolean forced, int dimension) + { + if (dimension == 0) + { -+ if (chunkCoordinates != null) ++ if (pos != null) + { -+ field_71077_c = new ChunkCoordinates(chunkCoordinates); ++ field_71077_c = pos; + field_82248_d = forced; + } + else @@ -628,9 +507,9 @@ + return; + } + -+ if (chunkCoordinates != null) ++ if (pos != null) + { -+ spawnChunkMap.put(dimension, new ChunkCoordinates(chunkCoordinates)); ++ spawnChunkMap.put(dimension, pos); + spawnForcedMap.put(dimension, forced); + } + else @@ -640,9 +519,8 @@ + } + } + -+ public float eyeHeight; + private String displayname; -+ ++ + /** + * Returns the default eye height of the player + * @return player default eye height @@ -656,7 +534,7 @@ + * Get the currently computed display name, cached for efficiency. + * @return the current display name + */ -+ public String getDisplayName() ++ public String getDisplayNameString() + { + if(this.displayname == null) + { @@ -674,6 +552,6 @@ + } + /* ======================================== FORGE END =====================================*/ + - public static enum EnumStatus + public static enum EnumChatVisibility { - OK, + FULL(0, "options.chat.visibility.full"), diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index e68a921598..34da0f4a39 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -1,58 +1,33 @@ --- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java +++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -@@ -100,6 +100,12 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -127,14 +127,15 @@ + public boolean field_71136_j; + private static final String __OBFID = "CL_00001440"; -+import net.minecraft.entity.item.EntityItem; -+import net.minecraftforge.common.ForgeHooks; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.player.PlayerDropsEvent; -+import net.minecraftforge.event.world.ChunkWatchEvent; -+ - public class EntityPlayerMP extends EntityPlayer implements ICrafting - { - private static final Logger field_147102_bM = LogManager.getLogger(); -@@ -132,19 +138,11 @@ ++ @SuppressWarnings("unused") + public EntityPlayerMP(MinecraftServer p_i45285_1_, WorldServer p_i45285_2_, GameProfile p_i45285_3_, ItemInWorldManager p_i45285_4_) + { super(p_i45285_2_, p_i45285_3_); p_i45285_4_.field_73090_b = this; this.field_71134_c = p_i45285_4_; -- ChunkCoordinates chunkcoordinates = p_i45285_2_.func_72861_E(); -+ ChunkCoordinates chunkcoordinates = p_i45285_2_.field_73011_w.getRandomizedSpawnPoint(); - int i = chunkcoordinates.field_71574_a; - int j = chunkcoordinates.field_71573_c; - int k = chunkcoordinates.field_71572_b; +- BlockPos blockpos = p_i45285_2_.func_175694_M(); ++ BlockPos blockpos = p_i45285_2_.field_73011_w.getRandomizedSpawnPoint(); -- if (!p_i45285_2_.field_73011_w.field_76576_e && p_i45285_2_.func_72912_H().func_76077_q() != WorldSettings.GameType.ADVENTURE) -- { -- int l = Math.max(5, p_i45285_1_.func_82357_ak() - 6); -- i += this.field_70146_Z.nextInt(l * 2) - l; -- j += this.field_70146_Z.nextInt(l * 2) - l; -- k = p_i45285_2_.func_72825_h(i, j); -- } -- - this.field_71133_b = p_i45285_1_; - this.field_147103_bO = p_i45285_1_.func_71203_ab().func_152602_a(this); - this.field_70138_W = 0.0F; -@@ -198,7 +196,7 @@ - - public float func_70047_e() - { -- return 1.62F; -+ return super.func_70047_e(); - } - - public void func_70071_h_() -@@ -213,7 +211,7 @@ +- if (!p_i45285_2_.field_73011_w.func_177495_o() && p_i45285_2_.func_72912_H().func_76077_q() != WorldSettings.GameType.ADVENTURE) ++ if (false && !p_i45285_2_.field_73011_w.func_177495_o() && p_i45285_2_.func_72912_H().func_76077_q() != WorldSettings.GameType.ADVENTURE) + { + int i = Math.max(5, p_i45285_1_.func_82357_ak() - 6); + int j = MathHelper.func_76128_c(p_i45285_2_.func_175723_af().func_177729_b((double)blockpos.func_177958_n(), (double)blockpos.func_177952_p())); +@@ -227,7 +228,7 @@ this.field_71070_bA.func_75142_b(); - if (!this.field_70170_p.field_72995_K && !this.field_71070_bA.func_75145_c(this)) -+ if (!this.field_70170_p.field_72995_K && !ForgeHooks.canInteractWith(this, this.field_71070_bA)) ++ if (!this.field_70170_p.field_72995_K && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.field_71070_bA)) { this.func_71053_j(); this.field_71070_bA = this.field_71069_bz; -@@ -255,7 +253,8 @@ +@@ -269,7 +270,8 @@ if (chunk.func_150802_k()) { arraylist.add(chunk); @@ -62,20 +37,23 @@ iterator1.remove(); } } -@@ -283,6 +282,7 @@ +@@ -305,6 +307,7 @@ { chunk = (Chunk)iterator2.next(); this.func_71121_q().func_73039_n().func_85172_a(this, chunk); -+ MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.Watch(chunk.func_76632_l(), this)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk.func_76632_l(), this)); } } } -@@ -402,11 +402,25 @@ +@@ -440,6 +443,7 @@ public void func_70645_a(DamageSource p_70645_1_) { -+ if (ForgeHooks.onLivingDeath(this, p_70645_1_)) return; - this.field_71133_b.func_71203_ab().func_148539_a(this.func_110142_aN().func_151521_b()); ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; + if (this.field_70170_p.func_82736_K().func_82766_b("showDeathMessages")) + { + Team team = this.func_96124_cp(); +@@ -463,7 +467,20 @@ if (!this.field_70170_p.func_82736_K().func_82766_b("keepInventory")) { @@ -85,10 +63,10 @@ this.field_71071_by.func_70436_m(); + + captureDrops = false; -+ PlayerDropsEvent event = new PlayerDropsEvent(this, p_70645_1_, capturedDrops, field_70718_bc > 0); -+ if (!MinecraftForge.EVENT_BUS.post(event)) ++ net.minecraftforge.event.entity.player.PlayerDropsEvent event = new net.minecraftforge.event.entity.player.PlayerDropsEvent(this, p_70645_1_, capturedDrops, field_70718_bc > 0); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) + { -+ for (EntityItem item : capturedDrops) ++ for (net.minecraft.entity.item.EntityItem item : capturedDrops) + { + func_71012_a(item); + } @@ -96,28 +74,11 @@ } Collection collection = this.field_70170_p.func_96441_U().func_96520_a(IScoreObjectiveCriteria.field_96642_c); -@@ -806,6 +820,7 @@ +@@ -849,6 +866,7 @@ { if (p_71064_1_ != null) { -+ if (p_71064_1_.func_75967_d() && MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.AchievementEvent(this, (net.minecraft.stats.Achievement) p_71064_1_))) return; ++ if (p_71064_1_.func_75967_d() && net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.AchievementEvent(this, (net.minecraft.stats.Achievement) p_71064_1_))) return; this.field_147103_bO.func_150871_b(this, p_71064_1_, p_71064_2_); Iterator iterator = this.func_96123_co().func_96520_a(p_71064_1_.func_150952_k()).iterator(); -@@ -1021,4 +1036,16 @@ - { - return this.field_143005_bX; - } -+ -+ /* ===================================== FORGE START =====================================*/ -+ /** -+ * Returns the default eye height of the player -+ * @return player default eye height -+ */ -+ @Override -+ public float getDefaultEyeHeight() -+ { -+ return 1.62F; -+ } -+ /* ===================================== FORGE END =====================================*/ - } diff --git a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch index 864d4ab127..49675d1be2 100644 --- a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java +++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java -@@ -311,6 +311,14 @@ +@@ -319,6 +319,14 @@ this.field_70462_a[i].func_77945_a(this.field_70458_d.field_70170_p, this.field_70458_d, i, this.field_70461_c == i); } } diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch index f432affd3e..14c20d7781 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch @@ -1,9 +1,16 @@ --- ../src-base/minecraft/net/minecraft/entity/projectile/EntityFishHook.java +++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityFishHook.java -@@ -551,6 +551,12 @@ +@@ -562,11 +562,19 @@ + } + } + ++ @SuppressWarnings("unused") + private ItemStack func_146033_f() + { float f = this.field_70170_p.field_73012_v.nextFloat(); int i = EnchantmentHelper.func_151386_g(this.field_146042_b); int j = EnchantmentHelper.func_151387_h(this.field_146042_b); ++ + if (true) + { + this.field_146042_b.func_71064_a(net.minecraftforge.common.FishingHooks.getFishableCategory(f, i, j).stat, 1); diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch index 561e6c890c..8f34fa6a98 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerBeacon.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerBeacon.java -@@ -156,7 +156,7 @@ +@@ -132,7 +132,7 @@ public boolean func_75214_a(ItemStack p_75214_1_) { - return p_75214_1_ == null ? false : p_75214_1_.func_77973_b() == Items.field_151166_bC || p_75214_1_.func_77973_b() == Items.field_151045_i || p_75214_1_.func_77973_b() == Items.field_151043_k || p_75214_1_.func_77973_b() == Items.field_151042_j; -+ return p_75214_1_ != null && p_75214_1_.func_77973_b() != null && p_75214_1_.func_77973_b().isBeaconPayment(p_75214_1_); ++ return p_75214_1_ == null ? false : p_75214_1_.func_77973_b().isBeaconPayment(p_75214_1_); } public int func_75219_a() diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch index 805491a277..63936eee07 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch @@ -1,28 +1,20 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java -@@ -5,6 +5,7 @@ - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.entity.player.InventoryPlayer; - import net.minecraft.init.Items; -+import net.minecraft.item.ItemPotion; - import net.minecraft.item.ItemStack; - import net.minecraft.stats.AchievementList; - import net.minecraft.tileentity.TileEntityBrewingStand; -@@ -194,7 +195,7 @@ +@@ -190,7 +190,7 @@ public void func_82870_a(EntityPlayer p_82870_1_, ItemStack p_82870_2_) { - if (p_82870_2_.func_77973_b() == Items.field_151068_bn && p_82870_2_.func_77960_j() > 0) -+ if (p_82870_2_.func_77973_b() instanceof ItemPotion && p_82870_2_.func_77960_j() > 0) ++ if (p_82870_2_.func_77973_b() instanceof net.minecraft.item.ItemPotion && p_82870_2_.func_77960_j() > 0) { - this.field_75244_a.func_71064_a(AchievementList.field_76001_A, 1); + this.field_75244_a.func_71029_a(AchievementList.field_76001_A); } -@@ -204,7 +205,7 @@ +@@ -200,7 +200,7 @@ public static boolean func_75243_a_(ItemStack p_75243_0_) { - return p_75243_0_ != null && (p_75243_0_.func_77973_b() == Items.field_151068_bn || p_75243_0_.func_77973_b() == Items.field_151069_bo); -+ return p_75243_0_ != null && (p_75243_0_.func_77973_b() instanceof ItemPotion || p_75243_0_.func_77973_b() == Items.field_151069_bo); ++ return p_75243_0_ != null && (p_75243_0_.func_77973_b() instanceof net.minecraft.item.ItemPotion || p_75243_0_.func_77973_b() == Items.field_151069_bo); } } } diff --git a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch index e47ea37269..a3832a4d92 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch @@ -1,14 +1,28 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerEnchantment.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerEnchantment.java -@@ -12,6 +12,7 @@ - import net.minecraft.init.Items; - import net.minecraft.item.ItemStack; +@@ -14,6 +14,7 @@ import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeHooks; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; ++import net.minecraftforge.oredict.OreDictionary; public class ContainerEnchantment extends Container { -@@ -116,6 +117,7 @@ +@@ -68,9 +69,12 @@ + this.func_75146_a(new Slot(this.field_75168_e, 1, 35, 47) + { + private static final String __OBFID = "CL_00002185"; ++ java.util.ArrayList ores = net.minecraftforge.oredict.OreDictionary.getOres("gemLapis"); + public boolean func_75214_a(ItemStack p_75214_1_) + { +- return p_75214_1_.func_77973_b() == Items.field_151100_aR && EnumDyeColor.func_176766_a(p_75214_1_.func_77960_j()) == EnumDyeColor.BLUE; ++ for (ItemStack ore : ores) ++ if (net.minecraftforge.oredict.OreDictionary.itemMatches(ore, p_75214_1_, false)) return true; ++ return false; + } + }); + int i; +@@ -152,6 +156,7 @@ { i = 0; int j; @@ -16,56 +30,56 @@ for (j = -1; j <= 1; ++j) { -@@ -123,37 +125,15 @@ +@@ -159,37 +164,15 @@ { - if ((j != 0 || k != 0) && this.field_75172_h.func_147437_c(this.field_75173_i + k, this.field_75170_j, this.field_75171_k + j) && this.field_75172_h.func_147437_c(this.field_75173_i + k, this.field_75170_j + 1, this.field_75171_k + j)) + if ((j != 0 || k != 0) && this.field_75172_h.func_175623_d(this.field_178150_j.func_177982_a(k, 0, j)) && this.field_75172_h.func_175623_d(this.field_178150_j.func_177982_a(k, 1, j))) { -- if (this.field_75172_h.func_147439_a(this.field_75173_i + k * 2, this.field_75170_j, this.field_75171_k + j * 2) == Blocks.field_150342_X) +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 0, j * 2)).func_177230_c() == Blocks.field_150342_X) - { - ++i; - } -+ power += ForgeHooks.getEnchantPower(field_75172_h, field_75173_i + k * 2, field_75170_j, field_75171_k + j * 2); -+ power += ForgeHooks.getEnchantPower(field_75172_h, field_75173_i + k * 2, field_75170_j + 1, field_75171_k + j * 2); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 0, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 1, j * 2)); -- if (this.field_75172_h.func_147439_a(this.field_75173_i + k * 2, this.field_75170_j + 1, this.field_75171_k + j * 2) == Blocks.field_150342_X) +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 1, j * 2)).func_177230_c() == Blocks.field_150342_X) - { - ++i; - } - if (k != 0 && j != 0) { -- if (this.field_75172_h.func_147439_a(this.field_75173_i + k * 2, this.field_75170_j, this.field_75171_k + j) == Blocks.field_150342_X) +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 0, j)).func_177230_c() == Blocks.field_150342_X) - { - ++i; - } - -- if (this.field_75172_h.func_147439_a(this.field_75173_i + k * 2, this.field_75170_j + 1, this.field_75171_k + j) == Blocks.field_150342_X) +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 1, j)).func_177230_c() == Blocks.field_150342_X) - { - ++i; - } - -- if (this.field_75172_h.func_147439_a(this.field_75173_i + k, this.field_75170_j, this.field_75171_k + j * 2) == Blocks.field_150342_X) +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k, 0, j * 2)).func_177230_c() == Blocks.field_150342_X) - { - ++i; - } - -- if (this.field_75172_h.func_147439_a(this.field_75173_i + k, this.field_75170_j + 1, this.field_75171_k + j * 2) == Blocks.field_150342_X) +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k, 1, j * 2)).func_177230_c() == Blocks.field_150342_X) - { - ++i; - } -+ power += ForgeHooks.getEnchantPower(field_75172_h, field_75173_i + k * 2, field_75170_j, field_75171_k + j ); -+ power += ForgeHooks.getEnchantPower(field_75172_h, field_75173_i + k * 2, field_75170_j + 1, field_75171_k + j ); -+ power += ForgeHooks.getEnchantPower(field_75172_h, field_75173_i + k, field_75170_j, field_75171_k + j * 2); -+ power += ForgeHooks.getEnchantPower(field_75172_h, field_75173_i + k, field_75170_j + 1, field_75171_k + j * 2); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 0, j)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 1, j)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k, 0, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k, 1, j * 2)); } } } -@@ -161,7 +141,7 @@ +@@ -199,7 +182,7 @@ for (j = 0; j < 3; ++j) { - this.field_75167_g[j] = EnchantmentHelper.func_77514_a(this.field_75169_l, j, i, itemstack); + this.field_75167_g[j] = EnchantmentHelper.func_77514_a(this.field_75169_l, j, (int)power, itemstack); - } + this.field_178151_h[j] = -1; - this.func_75142_b(); + if (this.field_75167_g[j] < j + 1) diff --git a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch index 71e2843171..2637c44fde 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerPlayer.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java -@@ -48,7 +48,8 @@ +@@ -47,7 +47,8 @@ } public boolean func_75214_a(ItemStack p_75214_1_) { @@ -9,4 +9,4 @@ + return p_75214_1_.func_77973_b().isValidArmor(p_75214_1_, k, field_82862_h); } @SideOnly(Side.CLIENT) - public IIcon func_75212_b() + public String func_178171_c() diff --git a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch index 1ba939729e..c50d640b01 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch @@ -1,45 +1,37 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java -@@ -12,6 +12,7 @@ - import net.minecraft.init.Items; - import net.minecraft.item.ItemStack; - import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeHooks; - import org.apache.commons.lang3.StringUtils; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -66,6 +67,8 @@ +@@ -73,6 +73,8 @@ p_82870_1_.func_82242_a(-ContainerRepair.this.field_82854_e); } -+ float breakChance = ForgeHooks.onAnvilRepair(p_82870_1_, p_82870_2_, ContainerRepair.this.field_82853_g.func_70301_a(0), ContainerRepair.this.field_82853_g.func_70301_a(1)); -+ ++ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(p_82870_1_, p_82870_2_, ContainerRepair.this.field_82853_g.func_70301_a(0), ContainerRepair.this.field_82853_g.func_70301_a(1)); ++ ContainerRepair.this.field_82853_g.func_70299_a(0, (ItemStack)null); if (ContainerRepair.this.field_82856_l > 0) -@@ -89,7 +92,7 @@ - +@@ -97,7 +99,7 @@ ContainerRepair.this.field_82854_e = 0; + IBlockState iblockstate = p_i45807_2_.func_180495_p(p_i45807_3_); -- if (!p_82870_1_.field_71075_bZ.field_75098_d && !p_i1800_2_.field_72995_K && p_i1800_2_.func_147439_a(p_i1800_3_, p_i1800_4_, p_i1800_5_) == Blocks.field_150467_bQ && p_82870_1_.func_70681_au().nextFloat() < 0.12F) -+ if (!p_82870_1_.field_71075_bZ.field_75098_d && !p_i1800_2_.field_72995_K && p_i1800_2_.func_147439_a(p_i1800_3_, p_i1800_4_, p_i1800_5_) == Blocks.field_150467_bQ && p_82870_1_.func_70681_au().nextFloat() < breakChance) +- if (!p_82870_1_.field_71075_bZ.field_75098_d && !p_i45807_2_.field_72995_K && iblockstate.func_177230_c() == Blocks.field_150467_bQ && p_82870_1_.func_70681_au().nextFloat() < 0.12F) ++ if (!p_82870_1_.field_71075_bZ.field_75098_d && !p_i45807_2_.field_72995_K && iblockstate.func_177230_c() == Blocks.field_150467_bQ && p_82870_1_.func_70681_au().nextFloat() < breakChance) { - int i1 = p_i1800_2_.func_72805_g(p_i1800_3_, p_i1800_4_, p_i1800_5_); - int k = i1 & 3; -@@ -170,6 +173,7 @@ + int k = ((Integer)iblockstate.func_177229_b(BlockAnvil.field_176505_b)).intValue(); + ++k; +@@ -177,6 +179,7 @@ if (itemstack2 != null) { -+ if (!ForgeHooks.onAnvilChange(this, itemstack, itemstack2, field_82852_f, field_82857_m, k2)) return; - flag = itemstack2.func_77973_b() == Items.field_151134_bR && Items.field_151134_bR.func_92110_g(itemstack2).func_74745_c() > 0; - - if (itemstack1.func_77984_f() && itemstack1.func_77973_b().func_82789_a(itemstack, itemstack2)) -@@ -373,6 +377,8 @@ - k2 = Math.max(1, k2 / 2); ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, field_82852_f, field_82857_m, i2)) return; + flag7 = itemstack2.func_77973_b() == Items.field_151134_bR && Items.field_151134_bR.func_92110_g(itemstack2).func_74745_c() > 0; + int k; + int l; +@@ -322,6 +325,8 @@ + } } -+ if (flag && !itemstack1.func_77973_b().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = null; ++ if (flag7 && !itemstack1.func_77973_b().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = null; + - this.field_82854_e = k2 + i; - - if (i <= 0) + if (StringUtils.isBlank(this.field_82857_m)) + { + if (itemstack.func_82837_s()) diff --git a/patches/minecraft/net/minecraft/inventory/Slot.java.patch b/patches/minecraft/net/minecraft/inventory/Slot.java.patch index c9851f7018..0eb96c5194 100644 --- a/patches/minecraft/net/minecraft/inventory/Slot.java.patch +++ b/patches/minecraft/net/minecraft/inventory/Slot.java.patch @@ -1,63 +1,38 @@ --- ../src-base/minecraft/net/minecraft/inventory/Slot.java +++ ../src-work/minecraft/net/minecraft/inventory/Slot.java -@@ -2,9 +2,11 @@ +@@ -1,5 +1,6 @@ + package net.minecraft.inventory; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import net.minecraft.client.renderer.texture.TextureMap; ++import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; - import net.minecraft.util.IIcon; -+import net.minecraft.util.ResourceLocation; - - public class Slot - { -@@ -15,6 +17,13 @@ - public int field_75221_f; - private static final String __OBFID = "CL_00001762"; - -+ /** Position within background texture file, normally -1 which causes no background to be drawn. */ -+ protected IIcon backgroundIcon = null; -+ -+ /** Background texture file assigned to this slot, if any. Vanilla "/gui/items.png" is used if this is null. */ -+ @SideOnly(Side.CLIENT) -+ protected ResourceLocation texture; -+ - public Slot(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) - { - this.field_75224_c = p_i1824_1_; -@@ -97,7 +106,7 @@ + import net.minecraftforge.fml.relauncher.Side; +@@ -86,7 +87,7 @@ @SideOnly(Side.CLIENT) - public IIcon func_75212_b() + public String func_178171_c() { - return null; -+ return backgroundIcon; ++ return backgroundName; } - @SideOnly(Side.CLIENT) -@@ -105,4 +114,46 @@ + public ItemStack func_75209_a(int p_75209_1_) +@@ -109,4 +110,64 @@ { return true; } + + /*========================================= FORGE START =====================================*/ ++ protected String backgroundName = null; ++ protected net.minecraft.util.ResourceLocation backgroundLocation = null; ++ protected Object backgroundMap; + /** + * Gets the path of the texture file to use for the background image of this slot when drawing the GUI. + * @return String: The texture file that will be used in GuiContainer.drawSlotInventory for the slot background. + */ + @SideOnly(Side.CLIENT) -+ public ResourceLocation getBackgroundIconTexture() ++ public net.minecraft.util.ResourceLocation getBackgroundLocation() + { -+ return (texture == null ? TextureMap.field_110576_c : texture); -+ } -+ -+ /** -+ * Sets which icon index to use as the background image of the slot when it's empty. -+ * @param icon The icon to use, null for none -+ */ -+ public void setBackgroundIcon(IIcon icon) -+ { -+ backgroundIcon = icon; ++ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.TextureMap.field_110575_b : backgroundLocation); + } + + /** @@ -65,9 +40,33 @@ + * @param textureFilename String: Path of texture file to use, or null to use "/gui/items.png" + */ + @SideOnly(Side.CLIENT) -+ public void setBackgroundIconTexture(ResourceLocation texture) ++ public void setBackgroundLocation(net.minecraft.util.ResourceLocation texture) + { -+ this.texture = texture; ++ this.backgroundLocation = texture; ++ } ++ ++ /** ++ * Sets which icon index to use as the background image of the slot when it's empty. ++ * Getter is func_178171_c ++ * @param icon The icon to use, null for none ++ */ ++ public void setBackgroundName(String name) ++ { ++ this.backgroundName = name; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() ++ { ++ String name = func_178171_c(); ++ return name == null ? null : getBackgroundMap().func_110572_b(name); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ protected net.minecraft.client.renderer.texture.TextureMap getBackgroundMap() ++ { ++ if (backgroundMap == null) backgroundMap = Minecraft.func_71410_x().func_147117_R(); ++ return (net.minecraft.client.renderer.texture.TextureMap)backgroundMap; + } + + /** diff --git a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch index 5126d6546a..d2095ad8df 100644 --- a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch +++ b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch @@ -1,30 +1,12 @@ --- ../src-base/minecraft/net/minecraft/inventory/SlotCrafting.java +++ ../src-work/minecraft/net/minecraft/inventory/SlotCrafting.java -@@ -10,6 +10,8 @@ - import net.minecraft.item.ItemStack; - import net.minecraft.item.ItemSword; - import net.minecraft.stats.AchievementList; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; +@@ -115,7 +115,9 @@ + { + net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, field_75239_a); + this.func_75208_c(p_82870_2_); ++ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(p_82870_1_); + ItemStack[] aitemstack = CraftingManager.func_77594_a().func_180303_b(this.field_75239_a, p_82870_1_.field_70170_p); ++ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); - public class SlotCrafting extends Slot - { -@@ -115,10 +117,16 @@ - { - this.field_75239_a.func_70298_a(i, 1); - -- if (itemstack1.func_77973_b().func_77634_r()) -+ if (itemstack1.func_77973_b().hasContainerItem(itemstack1)) - { -- ItemStack itemstack2 = new ItemStack(itemstack1.func_77973_b().func_77668_q()); -+ ItemStack itemstack2 = itemstack1.func_77973_b().getContainerItem(itemstack1); - -+ if (itemstack2 != null && itemstack2.func_77984_f() && itemstack2.func_77960_j() > itemstack2.func_77958_k()) -+ { -+ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(field_75238_b, itemstack2)); -+ continue; -+ } -+ - if (!itemstack1.func_77973_b().func_77630_h(itemstack1) || !this.field_75238_b.field_71071_by.func_70441_a(itemstack2)) - { - if (this.field_75239_a.func_70301_a(i) == null) + for (int i = 0; i < aitemstack.length; ++i) + { diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 9222192743..608b1c326d 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -1,57 +1,14 @@ --- ../src-base/minecraft/net/minecraft/item/Item.java +++ ../src-work/minecraft/net/minecraft/item/Item.java -@@ -7,10 +7,12 @@ - import cpw.mods.fml.common.registry.GameData; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.util.HashMap; - import java.util.HashSet; - import java.util.Iterator; - import java.util.List; - import java.util.Random; -+import java.util.Set; - import java.util.UUID; - import net.minecraft.block.Block; - import net.minecraft.block.BlockDirt; -@@ -27,13 +29,18 @@ - import net.minecraft.block.BlockWall; - import net.minecraft.block.BlockWood; - import net.minecraft.block.material.Material; -+import net.minecraft.client.gui.FontRenderer; -+import net.minecraft.client.gui.ScaledResolution; -+import net.minecraft.client.model.ModelBiped; - import net.minecraft.client.renderer.texture.IIconRegister; - import net.minecraft.creativetab.CreativeTabs; - import net.minecraft.entity.Entity; - import net.minecraft.entity.EntityLivingBase; -+import net.minecraft.entity.item.EntityItem; - import net.minecraft.entity.item.EntityItemFrame; - import net.minecraft.entity.item.EntityPainting; - import net.minecraft.entity.player.EntityPlayer; -+import net.minecraft.entity.player.EntityPlayerMP; - import net.minecraft.init.Blocks; - import net.minecraft.init.Items; - import net.minecraft.potion.Potion; -@@ -44,7 +51,10 @@ - import net.minecraft.util.RegistryNamespaced; - import net.minecraft.util.StatCollector; - import net.minecraft.util.Vec3; -+import net.minecraft.util.WeightedRandomChestContent; - import net.minecraft.world.World; -+import net.minecraftforge.common.ChestGenHooks; -+import net.minecraftforge.common.util.EnumHelper; - - public class Item - { -@@ -450,6 +460,7 @@ +@@ -129,6 +129,7 @@ return p_77654_1_; } -+ @Deprecated ++ @Deprecated // Use ItemStack sensitive version below. public int func_77639_j() { return this.field_77777_bU; -@@ -568,6 +579,7 @@ +@@ -242,6 +243,7 @@ return this.field_77700_c; } @@ -59,15 +16,7 @@ public boolean func_77634_r() { return this.field_77700_c != null; -@@ -625,6 +637,7 @@ - } - - @SideOnly(Side.CLIENT) -+ @Deprecated - public boolean func_77636_d(ItemStack p_77636_1_) - { - return p_77636_1_.func_77948_v(); -@@ -637,7 +650,7 @@ +@@ -311,7 +313,7 @@ public boolean func_77616_k(ItemStack p_77616_1_) { @@ -76,36 +25,34 @@ } protected MovingObjectPosition func_77621_a(World p_77621_1_, EntityPlayer p_77621_2_, boolean p_77621_3_) -@@ -646,7 +659,7 @@ - float f1 = p_77621_2_.field_70127_C + (p_77621_2_.field_70125_A - p_77621_2_.field_70127_C) * f; - float f2 = p_77621_2_.field_70126_B + (p_77621_2_.field_70177_z - p_77621_2_.field_70126_B) * f; - double d0 = p_77621_2_.field_70169_q + (p_77621_2_.field_70165_t - p_77621_2_.field_70169_q) * (double)f; -- double d1 = p_77621_2_.field_70167_r + (p_77621_2_.field_70163_u - p_77621_2_.field_70167_r) * (double)f + 1.62D - (double)p_77621_2_.field_70129_M; -+ double d1 = p_77621_2_.field_70167_r + (p_77621_2_.field_70163_u - p_77621_2_.field_70167_r) * (double)f + (double)(p_77621_1_.field_72995_K ? p_77621_2_.func_70047_e() - p_77621_2_.getDefaultEyeHeight() : p_77621_2_.func_70047_e()); // isRemote check to revert changes to ray trace position due to adding the eye height clientside and player yOffset differences - double d2 = p_77621_2_.field_70166_s + (p_77621_2_.field_70161_v - p_77621_2_.field_70166_s) * (double)f; - Vec3 vec3 = Vec3.func_72443_a(d0, d1, d2); - float f3 = MathHelper.func_76134_b(-f2 * 0.017453292F - (float)Math.PI); -@@ -656,6 +669,10 @@ - float f7 = f4 * f5; - float f8 = f3 * f5; +@@ -319,7 +321,7 @@ + float f = p_77621_2_.field_70127_C + (p_77621_2_.field_70125_A - p_77621_2_.field_70127_C); + float f1 = p_77621_2_.field_70126_B + (p_77621_2_.field_70177_z - p_77621_2_.field_70126_B); + double d0 = p_77621_2_.field_70169_q + (p_77621_2_.field_70165_t - p_77621_2_.field_70169_q); +- double d1 = p_77621_2_.field_70167_r + (p_77621_2_.field_70163_u - p_77621_2_.field_70167_r) + (double)p_77621_2_.func_70047_e(); ++ double d1 = p_77621_2_.field_70167_r + (p_77621_2_.field_70163_u - p_77621_2_.field_70167_r) + (double)(p_77621_1_.field_72995_K ? p_77621_2_.func_70047_e() - p_77621_2_.getDefaultEyeHeight() : p_77621_2_.func_70047_e()); // isRemote check to revert changes to ray trace position due to adding the eye height clientside and player yOffset differences + double d2 = p_77621_2_.field_70166_s + (p_77621_2_.field_70161_v - p_77621_2_.field_70166_s); + Vec3 vec3 = new Vec3(d0, d1, d2); + float f2 = MathHelper.func_76134_b(-f1 * 0.017453292F - (float)Math.PI); +@@ -329,6 +331,10 @@ + float f6 = f3 * f4; + float f7 = f2 * f4; double d3 = 5.0D; -+ if (p_77621_2_ instanceof EntityPlayerMP) ++ if (p_77621_2_ instanceof net.minecraft.entity.player.EntityPlayerMP) + { -+ d3 = ((EntityPlayerMP)p_77621_2_).field_71134_c.getBlockReachDistance(); ++ d3 = ((net.minecraft.entity.player.EntityPlayerMP)p_77621_2_).field_71134_c.getBlockReachDistance(); + } - Vec3 vec31 = vec3.func_72441_c((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); + Vec3 vec31 = vec3.func_72441_c((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); return p_77621_1_.func_147447_a(vec3, vec31, p_77621_3_, !p_77621_3_, false); } -@@ -711,6 +728,7 @@ - this.field_77791_bV = p_94581_1_.func_94245_a(this.func_111208_A()); +@@ -366,11 +372,564 @@ + return false; } -+ @Deprecated ++ @Deprecated // Use ItemStack sensitive version below. public Multimap func_111205_h() { return HashMultimap.create(); -@@ -728,6 +746,591 @@ - return this.field_111218_cA == null ? "MISSING_ICON_ITEM_" + field_150901_e.func_148757_b(this) + "_" + this.field_77774_bZ : this.field_111218_cA; } + /* ======================================== FORGE START =====================================*/ @@ -136,13 +83,11 @@ + * @param stack The Item Stack + * @param player The Player that used the item + * @param world The Current World -+ * @param x Target X Position -+ * @param y Target Y Position -+ * @param z Target Z Position ++ * @param pos Target position + * @param side The side of the target hit + * @return Return true to prevent any further processing. + */ -+ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) ++ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + return false; + } @@ -150,15 +95,15 @@ + /** + * Metadata-sensitive version of getStrVsBlock + * @param itemstack The Item Stack -+ * @param block The block the item is trying to break -+ * @param metadata The items current metadata ++ * @param state The block state + * @return The damage strength + */ -+ public float getDigSpeed(ItemStack itemstack, Block block, int metadata) ++ public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state) + { -+ return func_150893_a(itemstack, block); ++ return func_150893_a(itemstack, state.func_177230_c()); + } + ++ + protected boolean canRepair = true; + /** + * Called by CraftingManager to determine if an item is reparable. @@ -185,13 +130,11 @@ + * Note: In SMP, this is called on both client and server sides! + * + * @param itemstack The current ItemStack -+ * @param X The X Position -+ * @param Y The X Position -+ * @param Z The X Position ++ * @param pos Block's position in world + * @param player The Player that is wielding the item + * @return True to prevent harvesting, false to continue as normal + */ -+ public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player) ++ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) + { + return false; + } @@ -224,29 +167,15 @@ + /** + * Player, Render pass, and item usage sensitive version of getIconIndex. + * -+ * @param stack The item stack to get the icon for. (Usually this, and usingItem will be the same if usingItem is not null) -+ * @param renderPass The pass to get the icon for, 0 is default. ++ * @param stack The item stack to get the icon for. + * @param player The player holding the item -+ * @param usingItem The item the player is actively using. Can be null if not using anything. + * @param useRemaining The ticks remaining for the active item. -+ * @return The icon index ++ * @return Null to use default model, or a custom ModelResourceLocation for the stage of use. + */ -+ public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.resources.model.ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) + { -+ return getIcon(stack, renderPass); -+ } -+ -+ /** -+ * Returns the number of render passes/layers this item has. -+ * Usually equates to ItemRenderer.renderItem being called for this many passes. -+ * Does not get called unless requiresMultipleRenderPasses() is true; -+ * -+ * @param metadata The item's metadata -+ * @return The number of passes to run. -+ */ -+ public int getRenderPasses(int metadata) -+ { -+ return func_77623_v() ? 2 : 1; ++ return null; + } + + /** @@ -317,13 +246,13 @@ + } + + /** -+ * Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner ++ * Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner + * control over the update of the item without having to write a subclass. -+ * ++ * + * @param entityItem The entity Item + * @return Return true to skip any further update code. + */ -+ public boolean onEntityItemUpdate(EntityItem entityItem) ++ public boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem) + { + return false; + } @@ -360,11 +289,12 @@ + * @param stack to render for + * @param pass the multi-render pass + * @return the icon -+ */ ++ * / + public IIcon getIcon(ItemStack stack, int pass) + { -+ return func_77618_c(stack.func_77960_j(), pass); ++ return func_77618_c(stack.getMetadata(), pass); + } ++ */ + + /** + * Generates the base Random item for a specific instance of the chest gen, @@ -375,7 +305,7 @@ + * @param original Original result registered with the chest gen hooks. + * @return New values to use as the random item, typically this will be original + */ -+ public WeightedRandomChestContent getChestGenBase(ChestGenHooks chest, Random rnd, WeightedRandomChestContent original) ++ public net.minecraft.util.WeightedRandomChestContent getChestGenBase(net.minecraftforge.common.ChestGenHooks chest, Random rnd, net.minecraft.util.WeightedRandomChestContent original) + { + if (this instanceof ItemEnchantedBook) + { @@ -390,29 +320,20 @@ + * + * Should this item, when held, allow sneak-clicks to pass through to the underlying block? + * -+ * @param world The world -+ * @param x The X Position -+ * @param y The X Position -+ * @param z The X Position ++ * @param world The world ++ * @param pos Block position in world + * @param player The Player that is wielding the item + * @return + */ -+ public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player) ++ public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player) + { + return false; + } + + /** + * Called to tick armor in the armor slot. Override to do something -+ * -+ * @param world -+ * @param player -+ * @param itemStack + */ -+ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) -+ { -+ -+ } ++ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){} + + /** + * Determines if the specific ItemStack can be placed in the specified armor slot. @@ -450,13 +371,13 @@ + } + + /** -+ * Called by RenderBiped and RenderPlayer to determine the armor texture that -+ * should be use for the currently equiped item. -+ * This will only be called on instances of ItemArmor. -+ * ++ * Called by RenderBiped and RenderPlayer to determine the armor texture that ++ * should be use for the currently equipped item. ++ * This will only be called on instances of ItemArmor. ++ * + * Returning null from this function will use the default value. -+ * -+ * @param stack ItemStack for the equpt armor ++ * ++ * @param stack ItemStack for the equipped armor + * @param entity The entity wearing the armor + * @param slot The slot the armor is in + * @param type The subtype, can be null or "overlay" @@ -470,37 +391,37 @@ + /** + * Returns the font renderer used to render tooltips and overlays for this item. + * Returning null will use the standard font renderer. -+ * ++ * + * @param stack The current item stack + * @return A instance of FontRenderer or null to use default + */ + @SideOnly(Side.CLIENT) -+ public FontRenderer getFontRenderer(ItemStack stack) ++ public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack) + { + return null; + } + + /** + * Override this method to have an item handle its own armor rendering. -+ * -+ * @param entityLiving The entity wearing the armor -+ * @param itemStack The itemStack to render the model of ++ * ++ * @param entityLiving The entity wearing the armor ++ * @param itemStack The itemStack to render the model of + * @param armorSlot 0=head, 1=torso, 2=legs, 3=feet -+ * ++ * + * @return A ModelBiped to render instead of the default + */ + @SideOnly(Side.CLIENT) -+ public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) ++ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) + { + return null; + } + + /** + * Called when a entity tries to play the 'swing' animation. -+ * ++ * + * @param entityLiving The entity swinging the item. + * @param stack The Item stack -+ * @return True to cancel any further processing by EntityLiving ++ * @return True to cancel any further processing by EntityLiving + */ + public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) + { @@ -508,19 +429,16 @@ + } + + /** -+ * Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet. ++ * Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet. + * This is where pumpkins would render there overlay. -+ * ++ * + * @param stack The ItemStack that is equipped + * @param player Reference to the current client entity + * @param resolution Resolution information about the current viewport and configured GUI Scale + * @param partialTicks Partial ticks for the renderer, useful for interpolation -+ * @param hasScreen If the player has a screen up, which will be rendered after this. -+ * @param mouseX Mouse's X position on screen -+ * @param mouseY Mouse's Y position on screen + */ + @SideOnly(Side.CLIENT) -+ public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, ScaledResolution resolution, float partialTicks, boolean hasScreen, int mouseX, int mouseY){} ++ public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, net.minecraft.client.gui.ScaledResolution resolution, float partialTicks){} + + /** + * Return the itemDamage represented by this ItemStack. Defaults to the itemDamage field on ItemStack, but can be overridden here for other sources such as NBT. @@ -533,8 +451,12 @@ + return stack.field_77991_e; + } + -+ @Deprecated // This isn't 'display' its normal Damage, the above function is 'Aux' data, but the same value. -+ public int getDisplayDamage(ItemStack stack) ++ /** ++ * This used to be 'display damage' but its really just 'aux' data in the ItemStack, usually shares the same variable as damage. ++ * @param stack ++ * @return ++ */ ++ public int getMetadata(ItemStack stack) + { + return stack.field_77991_e; + } @@ -543,7 +465,7 @@ + * Determines if the durability bar should be rendered for this item. + * Defaults to vanilla stack.isDamaged behavior. + * But modders can use this for any data they wish. -+ * ++ * + * @param stack The current Item Stack + * @return True if it should render the 'durability' bar. + */ @@ -554,7 +476,7 @@ + + /** + * Queries the percentage of the 'Durability' bar that should be drawn. -+ * ++ * + * @param stack The current ItemStack + * @return 1.0 for 100% 0 for 0% + */ @@ -562,9 +484,9 @@ + { + return (double)stack.func_77952_i() / (double)stack.func_77958_k(); + } -+ ++ + /** -+ * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item, ++ * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item, + * but can be overridden here for other sources such as NBT. + * + * @param stack The itemstack that is damaged @@ -601,29 +523,20 @@ + } + + /** -+ * ItemStack sensitive version of {@link #canHarvestBlock(Block)} ++ * ItemStack sensitive version of {@link #canHarvestBlock(Block)} + * @param par1Block The block trying to harvest + * @param itemStack The itemstack used to harvest the block + * @return true if can harvest the block + */ + public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) + { -+ return func_150897_b(par1Block); ++ return func_150897_b(par1Block); + } + + /** -+ * Render Pass sensitive version of hasEffect() -+ */ -+ @SideOnly(Side.CLIENT) -+ public boolean hasEffect(ItemStack par1ItemStack, int pass) -+ { -+ return func_77636_d(par1ItemStack) && (pass == 0 || this != Items.field_151068_bn); -+ } -+ -+ /** -+ * Gets the maximum number of items that this stack should be able to hold. ++ * Gets the maximum number of items that this stack should be able to hold. + * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit() -+ * ++ * + * @param stack The ItemStack + * @return THe maximum number this item can be stacked to + */ @@ -632,10 +545,10 @@ + return this.func_77639_j(); + } + -+ private HashMap toolClasses = new HashMap(); ++ private java.util.Map toolClasses = new java.util.HashMap(); + /** + * Sets or removes the harvest level for the specified tool class. -+ * ++ * + * @param toolClass Class + * @param level Harvest level: + * Wood: 0 @@ -652,7 +565,7 @@ + toolClasses.put(toolClass, level); + } + -+ public Set getToolClasses(ItemStack stack) ++ public java.util.Set getToolClasses(ItemStack stack) + { + return toolClasses.keySet(); + } @@ -660,7 +573,7 @@ + /** + * Queries the harvest level of this item stack for the specifred tool class, + * Returns -1 if this tool is not of the specified type -+ * ++ * + * @param stack This item stack instance + * @param toolClass Tool Class + * @return Harvest level, or -1 if not the specified tool type. @@ -668,12 +581,12 @@ + public int getHarvestLevel(ItemStack stack, String toolClass) + { + Integer ret = toolClasses.get(toolClass); -+ return ret == null ? -1 : ret; ++ return ret == null ? -1 : ret; + } -+ ++ + /** + * ItemStack sensitive version of getItemEnchantability -+ * ++ * + * @param stack The ItemStack + * @return the item echantability value + */ @@ -681,7 +594,7 @@ + { + return func_77619_b(); + } -+ ++ + /** + * Whether this Item can be used as a payment to activate the vanilla beacon. + * @param stack the ItemStack @@ -693,10 +606,11 @@ + } + /* ======================================== FORGE END =====================================*/ + - public static enum ToolMaterial ++ + public static void func_150900_l() { - WOOD(0, 59, 2.0F, 0.0F, 15), -@@ -743,6 +1346,9 @@ + func_179214_a(Blocks.field_150348_b, (new ItemMultiTexture(Blocks.field_150348_b, Blocks.field_150348_b, new Function() +@@ -936,6 +1495,9 @@ private static final String __OBFID = "CL_00000042"; @@ -706,7 +620,7 @@ private ToolMaterial(int p_i1874_3_, int p_i1874_4_, float p_i1874_5_, float p_i1874_6_, int p_i1874_7_) { this.field_78001_f = p_i1874_3_; -@@ -779,7 +1385,15 @@ +@@ -972,7 +1534,15 @@ public Item func_150995_f() { diff --git a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch index 8c21039da5..243ace407f 100644 --- a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch @@ -1,32 +1,32 @@ --- ../src-base/minecraft/net/minecraft/item/ItemArmor.java +++ ../src-work/minecraft/net/minecraft/item/ItemArmor.java -@@ -221,7 +221,7 @@ +@@ -192,7 +192,7 @@ if (itemstack1 == null) { - p_77659_3_.func_70062_b(i, p_77659_1_.func_77946_l()); -+ p_77659_3_.func_70062_b(i + 1, p_77659_1_.func_77946_l()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. ++ p_77659_3_.func_70062_b(i + 1, p_77659_1_.func_77946_l()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. p_77659_1_.field_77994_a = 0; } -@@ -259,6 +259,9 @@ +@@ -213,6 +213,9 @@ private static final String __OBFID = "CL_00001768"; + //Added by forge for custom Armor materials. + public Item customCraftingMaterial = null; + - private ArmorMaterial(int p_i1827_3_, int[] p_i1827_4_, int p_i1827_5_) + private ArmorMaterial(String p_i45789_3_, int p_i45789_4_, int[] p_i45789_5_, int p_i45789_6_) { - this.field_78048_f = p_i1827_3_; -@@ -283,7 +286,15 @@ + this.field_179243_f = p_i45789_3_; +@@ -238,7 +241,15 @@ public Item func_151685_b() { -- return this == CLOTH ? Items.field_151116_aA : (this == CHAIN ? Items.field_151042_j : (this == GOLD ? Items.field_151043_k : (this == IRON ? Items.field_151042_j : (this == DIAMOND ? Items.field_151045_i : null)))); +- return this == LEATHER ? Items.field_151116_aA : (this == CHAIN ? Items.field_151042_j : (this == GOLD ? Items.field_151043_k : (this == IRON ? Items.field_151042_j : (this == DIAMOND ? Items.field_151045_i : null)))); + switch (this) + { -+ case CLOTH: return Items.field_151116_aA; ++ case LEATHER: return Items.field_151116_aA; + case CHAIN: return Items.field_151042_j; + case GOLD: return Items.field_151043_k; + case IRON: return Items.field_151042_j; @@ -34,5 +34,5 @@ + default: return customCraftingMaterial; + } } - } - } + + @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch index b5533470ea..4d24c5010e 100644 --- a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch @@ -1,42 +1,26 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBlock.java +++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java -@@ -50,7 +50,7 @@ - { - p_77648_7_ = 1; - } -- else if (block != Blocks.field_150395_bd && block != Blocks.field_150329_H && block != Blocks.field_150330_I) -+ else if (block != Blocks.field_150395_bd && block != Blocks.field_150329_H && block != Blocks.field_150330_I && !block.isReplaceable(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_)) - { - if (p_77648_7_ == 0) - { -@@ -100,14 +100,8 @@ - int i1 = this.func_77647_b(p_77648_1_.func_77960_j()); - int j1 = this.field_150939_a.func_149660_a(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_8_, p_77648_9_, p_77648_10_, i1); +@@ -63,16 +63,8 @@ + int i = this.func_77647_b(p_180614_1_.func_77960_j()); + IBlockState iblockstate1 = this.field_150939_a.func_180642_a(p_180614_3_, p_180614_4_, p_180614_5_, p_180614_6_, p_180614_7_, p_180614_8_, i, p_180614_2_); -- if (p_77648_3_.func_147465_d(p_77648_4_, p_77648_5_, p_77648_6_, this.field_150939_a, j1, 3)) -+ if (placeBlockAt(p_77648_1_, p_77648_2_, p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_8_, p_77648_9_, p_77648_10_, j1)) +- if (p_180614_3_.func_180501_a(p_180614_4_, iblockstate1, 3)) ++ if (placeBlockAt(p_180614_1_, p_180614_2_, p_180614_3_, p_180614_4_, p_180614_5_, p_180614_6_, p_180614_7_, p_180614_8_, iblockstate1)) { -- if (p_77648_3_.func_147439_a(p_77648_4_, p_77648_5_, p_77648_6_) == this.field_150939_a) +- iblockstate1 = p_180614_3_.func_180495_p(p_180614_4_); +- +- if (iblockstate1.func_177230_c() == this.field_150939_a) - { -- this.field_150939_a.func_149689_a(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, p_77648_2_, p_77648_1_); -- this.field_150939_a.func_149714_e(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, j1); +- func_179224_a(p_180614_3_, p_180614_4_, p_180614_1_); +- this.field_150939_a.func_180633_a(p_180614_3_, p_180614_4_, iblockstate1, p_180614_2_, p_180614_1_); - } - - p_77648_3_.func_72908_a((double)((float)p_77648_4_ + 0.5F), (double)((float)p_77648_5_ + 0.5F), (double)((float)p_77648_6_ + 0.5F), this.field_150939_a.field_149762_H.func_150496_b(), (this.field_150939_a.field_149762_H.func_150497_c() + 1.0F) / 2.0F, this.field_150939_a.field_149762_H.func_150494_d() * 0.8F); - --p_77648_1_.field_77994_a; + p_180614_3_.func_72908_a((double)((float)p_180614_4_.func_177958_n() + 0.5F), (double)((float)p_180614_4_.func_177956_o() + 0.5F), (double)((float)p_180614_4_.func_177952_p() + 0.5F), this.field_150939_a.field_149762_H.func_150496_b(), (this.field_150939_a.field_149762_H.func_150497_c() + 1.0F) / 2.0F, this.field_150939_a.field_149762_H.func_150494_d() * 0.8F); + --p_180614_1_.field_77994_a; } -@@ -129,7 +123,7 @@ - { - p_150936_5_ = 1; - } -- else if (block != Blocks.field_150395_bd && block != Blocks.field_150329_H && block != Blocks.field_150330_I) -+ else if (block != Blocks.field_150395_bd && block != Blocks.field_150329_H && block != Blocks.field_150330_I && !block.isReplaceable(p_150936_1_, p_150936_2_, p_150936_3_, p_150936_4_)) - { - if (p_150936_5_ == 0) - { -@@ -197,4 +191,29 @@ - this.field_150938_b = p_94581_1_.func_94245_a(s); - } +@@ -157,4 +149,26 @@ + { + return this.field_150939_a; } + + /** @@ -47,20 +31,17 @@ + * @param player The player who is placing the block. Can be null if the block is not being placed by a player. + * @param side The side the player (or machine) right-clicked on. + */ -+ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) ++ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) + { ++ if (!world.func_180501_a(pos, newState, 3)) return false; + -+ if (!world.func_147465_d(x, y, z, field_150939_a, metadata, 3)) -+ { -+ return false; -+ } ++ IBlockState state = world.func_180495_p(pos); ++ if (state.func_177230_c() == this.field_150939_a) ++ { ++ func_179224_a(world, pos, stack); ++ this.field_150939_a.func_180633_a(world, pos, state, player, stack); ++ } + -+ if (world.func_147439_a(x, y, z) == field_150939_a) -+ { -+ field_150939_a.func_149689_a(world, x, y, z, player, stack); -+ field_150939_a.func_149714_e(world, x, y, z, metadata); -+ } -+ -+ return true; ++ return true; + } } diff --git a/patches/minecraft/net/minecraft/item/ItemBow.java.patch b/patches/minecraft/net/minecraft/item/ItemBow.java.patch index 8f47865d36..44892d3704 100644 --- a/patches/minecraft/net/minecraft/item/ItemBow.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBow.java.patch @@ -1,27 +1,12 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBow.java +++ ../src-work/minecraft/net/minecraft/item/ItemBow.java -@@ -11,6 +11,9 @@ - import net.minecraft.init.Items; - import net.minecraft.util.IIcon; - import net.minecraft.world.World; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.player.ArrowLooseEvent; -+import net.minecraftforge.event.entity.player.ArrowNockEvent; - - public class ItemBow extends Item - { -@@ -28,11 +31,20 @@ +@@ -23,11 +23,15 @@ public void func_77615_a(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_) { + int j = this.func_77626_a(p_77615_1_) - p_77615_4_; -+ -+ ArrowLooseEvent event = new ArrowLooseEvent(p_77615_3_, p_77615_1_, j); -+ MinecraftForge.EVENT_BUS.post(event); -+ if (event.isCanceled()) -+ { -+ return; -+ } ++ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(p_77615_3_, p_77615_1_, j); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; + j = event.charge; + boolean flag = p_77615_3_.field_71075_bZ.field_75098_d || EnchantmentHelper.func_77506_a(Enchantment.field_77342_w.field_77352_x, p_77615_1_) > 0; @@ -32,16 +17,12 @@ float f = (float)j / 20.0F; f = (f * f + f * 2.0F) / 3.0F; -@@ -108,6 +120,13 @@ +@@ -105,6 +109,9 @@ public ItemStack func_77659_a(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { -+ ArrowNockEvent event = new ArrowNockEvent(p_77659_3_, p_77659_1_); -+ MinecraftForge.EVENT_BUS.post(event); -+ if (event.isCanceled()) -+ { -+ return event.result; -+ } ++ net.minecraftforge.event.entity.player.ArrowNockEvent event = new net.minecraftforge.event.entity.player.ArrowNockEvent(p_77659_3_, p_77659_1_); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return event.result; + if (p_77659_3_.field_71075_bZ.field_75098_d || p_77659_3_.field_71071_by.func_146028_b(Items.field_151032_g)) { diff --git a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch index bff933b1cd..e8ae79af8a 100644 --- a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch @@ -1,44 +1,12 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBucket.java +++ ../src-work/minecraft/net/minecraft/item/ItemBucket.java -@@ -8,6 +8,9 @@ - import net.minecraft.init.Items; - import net.minecraft.util.MovingObjectPosition; - import net.minecraft.world.World; -+import cpw.mods.fml.common.eventhandler.Event; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.player.FillBucketEvent; - - public class ItemBucket extends Item - { -@@ -32,6 +35,31 @@ +@@ -37,6 +37,9 @@ } else { -+ FillBucketEvent event = new FillBucketEvent(p_77659_3_, p_77659_1_, p_77659_2_, movingobjectposition); -+ if (MinecraftForge.EVENT_BUS.post(event)) -+ { -+ return p_77659_1_; -+ } ++ ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(p_77659_3_, p_77659_2_, p_77659_1_, movingobjectposition); ++ if (ret != null) return ret; + -+ if (event.getResult() == Event.Result.ALLOW) -+ { -+ if (p_77659_3_.field_71075_bZ.field_75098_d) -+ { -+ return p_77659_1_; -+ } -+ -+ if (--p_77659_1_.field_77994_a <= 0) -+ { -+ return event.result; -+ } -+ -+ if (!p_77659_3_.field_71071_by.func_70441_a(event.result)) -+ { -+ p_77659_3_.func_71019_a(event.result, false); -+ } -+ -+ return p_77659_1_; -+ } if (movingobjectposition.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK) { - int i = movingobjectposition.field_72311_b; + BlockPos blockpos = movingobjectposition.func_178782_a(); diff --git a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch b/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch index 30a8765574..4fa7c76aaf 100644 --- a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBucketMilk.java +++ ../src-work/minecraft/net/minecraft/item/ItemBucketMilk.java -@@ -24,7 +24,7 @@ +@@ -25,7 +25,7 @@ if (!p_77654_2_.field_72995_K) { @@ -8,4 +8,4 @@ + p_77654_3_.curePotionEffects(p_77654_1_); } - return p_77654_1_.field_77994_a <= 0 ? new ItemStack(Items.field_151133_ar) : p_77654_1_; + p_77654_3_.func_71029_a(StatList.field_75929_E[Item.func_150891_b(this)]); diff --git a/patches/minecraft/net/minecraft/item/ItemDye.java.patch b/patches/minecraft/net/minecraft/item/ItemDye.java.patch index e1f4cf4055..68f1abec6e 100644 --- a/patches/minecraft/net/minecraft/item/ItemDye.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemDye.java.patch @@ -1,75 +1,54 @@ --- ../src-base/minecraft/net/minecraft/item/ItemDye.java +++ ../src-work/minecraft/net/minecraft/item/ItemDye.java -@@ -1,5 +1,6 @@ - package net.minecraft.item; +@@ -48,7 +48,7 @@ -+import cpw.mods.fml.common.eventhandler.Event.Result; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; - import java.util.List; -@@ -17,6 +18,10 @@ - import net.minecraft.util.IIcon; - import net.minecraft.util.MathHelper; - import net.minecraft.world.World; -+import net.minecraft.world.WorldServer; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.common.util.FakePlayerFactory; -+import net.minecraftforge.event.entity.player.BonemealEvent; - - public class ItemDye extends Item - { -@@ -57,7 +62,7 @@ - { - if (p_77648_1_.func_77960_j() == 15) + if (enumdyecolor == EnumDyeColor.WHITE) { -- if (func_150919_a(p_77648_1_, p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_)) -+ if (applyBonemeal(p_77648_1_, p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, p_77648_2_)) +- if (func_179234_a(p_180614_1_, p_180614_3_, p_180614_4_)) ++ if (applyBonemeal(p_180614_1_, p_180614_3_, p_180614_4_, p_180614_2_)) { - if (!p_77648_3_.field_72995_K) + if (!p_180614_3_.field_72995_K) { -@@ -125,8 +130,30 @@ +@@ -98,8 +98,18 @@ - public static boolean func_150919_a(ItemStack p_150919_0_, World p_150919_1_, int p_150919_2_, int p_150919_3_, int p_150919_4_) + public static boolean func_179234_a(ItemStack p_179234_0_, World p_179234_1_, BlockPos p_179234_2_) { -+ if (p_150919_1_ instanceof WorldServer) -+ return applyBonemeal(p_150919_0_, p_150919_1_, p_150919_2_, p_150919_3_, p_150919_4_, FakePlayerFactory.getMinecraft((WorldServer)p_150919_1_)); ++ if (p_179234_1_ instanceof net.minecraft.world.WorldServer) ++ return applyBonemeal(p_179234_0_, p_179234_1_, p_179234_2_, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.WorldServer)p_179234_1_)); + return false; + } + -+ public static boolean applyBonemeal(ItemStack p_150919_0_, World p_150919_1_, int p_150919_2_, int p_150919_3_, int p_150919_4_, EntityPlayer player) ++ public static boolean applyBonemeal(ItemStack p_179234_0_, World p_179234_1_, BlockPos p_179234_2_, EntityPlayer player) + { - Block block = p_150919_1_.func_147439_a(p_150919_2_, p_150919_3_, p_150919_4_); + IBlockState iblockstate = p_179234_1_.func_180495_p(p_179234_2_); -+ BonemealEvent event = new BonemealEvent(player, p_150919_1_, block, p_150919_2_, p_150919_3_, p_150919_4_); -+ if (MinecraftForge.EVENT_BUS.post(event)) -+ { -+ return false; -+ } ++ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, p_179234_1_, p_179234_2_, iblockstate, p_179234_0_); ++ if (hook != 0) return hook > 0; + -+ if (event.getResult() == Result.ALLOW) -+ { -+ if (!p_150919_1_.field_72995_K) -+ { -+ p_150919_0_.field_77994_a--; -+ } -+ return true; -+ } -+ - if (block instanceof IGrowable) + if (iblockstate.func_177230_c() instanceof IGrowable) { - IGrowable igrowable = (IGrowable)block; -@@ -172,6 +199,16 @@ - p_150918_0_.func_72869_a("happyVillager", (double)((float)p_150918_1_ + field_77697_d.nextFloat()), (double)p_150918_2_ + (double)field_77697_d.nextFloat() * block.func_149669_A(), (double)((float)p_150918_3_ + field_77697_d.nextFloat()), d0, d1, d2); + IGrowable igrowable = (IGrowable)iblockstate.func_177230_c(); +@@ -133,7 +143,7 @@ + + Block block = p_180617_0_.func_180495_p(p_180617_1_).func_177230_c(); + +- if (block.func_149688_o() != Material.field_151579_a) ++ if (block.isAir(p_180617_0_, p_180617_1_)) + { + block.func_180654_a(p_180617_0_, p_180617_1_); + +@@ -145,6 +155,16 @@ + p_180617_0_.func_175688_a(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)p_180617_1_.func_177958_n() + field_77697_d.nextFloat()), (double)p_180617_1_.func_177956_o() + (double)field_77697_d.nextFloat() * block.func_149669_A(), (double)((float)p_180617_1_.func_177952_p() + field_77697_d.nextFloat()), d0, d1, d2, new int[0]); } } + else + { -+ for (int i1 = 0; i1 < p_150918_4_; ++i1) ++ for (int i1 = 0; i1 < p_180617_2_; ++i1) + { + double d0 = field_77697_d.nextGaussian() * 0.02D; + double d1 = field_77697_d.nextGaussian() * 0.02D; + double d2 = field_77697_d.nextGaussian() * 0.02D; -+ p_150918_0_.func_72869_a("happyVillager", (double)((float)p_150918_1_ + field_77697_d.nextFloat()), (double)p_150918_2_ + (double)field_77697_d.nextFloat() * 1.0f, (double)((float)p_150918_3_ + field_77697_d.nextFloat()), d0, d1, d2); ++ p_180617_0_.func_175688_a(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)p_180617_1_.func_177958_n() + field_77697_d.nextFloat()), (double)p_180617_1_.func_177956_o() + (double)field_77697_d.nextFloat() * 1.0f, (double)((float)p_180617_1_.func_177952_p() + field_77697_d.nextFloat()), d0, d1, d2, new int[0]); + } + } } diff --git a/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch index 572f9373a9..cf8ab00132 100644 --- a/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/item/ItemFlintAndSteel.java +++ ../src-work/minecraft/net/minecraft/item/ItemFlintAndSteel.java -@@ -55,7 +55,7 @@ +@@ -29,7 +29,7 @@ } else { -- if (p_77648_3_.func_147439_a(p_77648_4_, p_77648_5_, p_77648_6_).func_149688_o() == Material.field_151579_a) -+ if (p_77648_3_.func_147437_c(p_77648_4_, p_77648_5_, p_77648_6_)) +- if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180614_3_.func_175623_d(p_180614_4_)) { - p_77648_3_.func_72908_a((double)p_77648_4_ + 0.5D, (double)p_77648_5_ + 0.5D, (double)p_77648_6_ + 0.5D, "fire.ignite", 1.0F, field_77697_d.nextFloat() * 0.4F + 0.8F); - p_77648_3_.func_147449_b(p_77648_4_, p_77648_5_, p_77648_6_, Blocks.field_150480_ab); + p_180614_3_.func_72908_a((double)p_180614_4_.func_177958_n() + 0.5D, (double)p_180614_4_.func_177956_o() + 0.5D, (double)p_180614_4_.func_177952_p() + 0.5D, "fire.ignite", 1.0F, field_77697_d.nextFloat() * 0.4F + 0.8F); + p_180614_3_.func_175656_a(p_180614_4_, Blocks.field_150480_ab.func_176223_P()); diff --git a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch index 4cd796265e..3d3e201efe 100644 --- a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch @@ -1,41 +1,17 @@ --- ../src-base/minecraft/net/minecraft/item/ItemHoe.java +++ ../src-work/minecraft/net/minecraft/item/ItemHoe.java -@@ -1,5 +1,6 @@ - package net.minecraft.item; - -+import cpw.mods.fml.common.eventhandler.Event.Result; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; - import net.minecraft.block.Block; -@@ -8,6 +9,8 @@ - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.init.Blocks; - import net.minecraft.world.World; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.player.UseHoeEvent; - - public class ItemHoe extends Item - { -@@ -30,9 +33,21 @@ +@@ -34,10 +34,13 @@ } else { -+ UseHoeEvent event = new UseHoeEvent(p_77648_2_, p_77648_1_, p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_); -+ if (MinecraftForge.EVENT_BUS.post(event)) -+ { -+ return false; -+ } ++ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(p_180614_1_, p_180614_2_, p_180614_3_, p_180614_4_); ++ if (hook != 0) return hook > 0; + -+ if (event.getResult() == Result.ALLOW) -+ { -+ p_77648_1_.func_77972_a(1, p_77648_2_); -+ return true; -+ } -+ - Block block = p_77648_3_.func_147439_a(p_77648_4_, p_77648_5_, p_77648_6_); + IBlockState iblockstate = p_180614_3_.func_180495_p(p_180614_4_); + Block block = iblockstate.func_177230_c(); -- if (p_77648_7_ != 0 && p_77648_3_.func_147439_a(p_77648_4_, p_77648_5_ + 1, p_77648_6_).func_149688_o() == Material.field_151579_a && (block == Blocks.field_150349_c || block == Blocks.field_150346_d)) -+ if (p_77648_7_ != 0 && p_77648_3_.func_147439_a(p_77648_4_, p_77648_5_ + 1, p_77648_6_).isAir(p_77648_3_, p_77648_4_, p_77648_5_ + 1, p_77648_6_) && (block == Blocks.field_150349_c || block == Blocks.field_150346_d)) +- if (p_180614_5_ != EnumFacing.DOWN && p_180614_3_.func_180495_p(p_180614_4_.func_177984_a()).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180614_5_ != EnumFacing.DOWN && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) { - Block block1 = Blocks.field_150458_ak; - p_77648_3_.func_72908_a((double)((float)p_77648_4_ + 0.5F), (double)((float)p_77648_5_ + 0.5F), (double)((float)p_77648_6_ + 0.5F), block1.field_149762_H.func_150498_e(), (block1.field_149762_H.func_150497_c() + 1.0F) / 2.0F, block1.field_149762_H.func_150494_d() * 0.8F); + if (block == Blocks.field_150349_c) + { diff --git a/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch b/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch index 1196c91dac..efc47a1a0d 100644 --- a/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch @@ -1,13 +1,13 @@ --- ../src-base/minecraft/net/minecraft/item/ItemLilyPad.java +++ ../src-work/minecraft/net/minecraft/item/ItemLilyPad.java -@@ -46,7 +46,14 @@ +@@ -51,7 +51,14 @@ - if (p_77659_2_.func_147439_a(i, j, k).func_149688_o() == Material.field_151586_h && p_77659_2_.func_72805_g(i, j, k) == 0 && p_77659_2_.func_147437_c(i, j + 1, k)) + if (iblockstate.func_177230_c().func_149688_o() == Material.field_151586_h && ((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue() == 0 && p_77659_2_.func_175623_d(blockpos1)) { + // special case for handling block placement with water lilies -+ net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(p_77659_2_, i, j + 1, k); - p_77659_2_.func_147449_b(i, j + 1, k, Blocks.field_150392_bi); -+ if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(p_77659_3_, blocksnapshot, net.minecraftforge.common.util.ForgeDirection.UP).isCanceled()) ++ net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(p_77659_2_, blockpos1); + p_77659_2_.func_175656_a(blockpos1, Blocks.field_150392_bi.func_176223_P()); ++ if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(p_77659_3_, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) + { + blocksnapshot.restore(true, false); + return p_77659_1_; diff --git a/patches/minecraft/net/minecraft/item/ItemRecord.java.patch b/patches/minecraft/net/minecraft/item/ItemRecord.java.patch index 1ae2786d9a..e36f4fca64 100644 --- a/patches/minecraft/net/minecraft/item/ItemRecord.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemRecord.java.patch @@ -1,35 +1,18 @@ --- ../src-base/minecraft/net/minecraft/item/ItemRecord.java +++ ../src-work/minecraft/net/minecraft/item/ItemRecord.java -@@ -10,6 +10,7 @@ - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.init.Blocks; - import net.minecraft.util.IIcon; -+import net.minecraft.util.ResourceLocation; - import net.minecraft.util.StatCollector; - import net.minecraft.world.World; - -@@ -24,7 +25,7 @@ - this.field_150929_a = p_i45350_1_; - this.field_77777_bU = 1; - this.func_77637_a(CreativeTabs.field_78026_f); -- field_150928_b.put(p_i45350_1_, this); -+ field_150928_b.put("records." + p_i45350_1_, this); //Forge Bug Fix: RenderGlobal adds a "records." when looking up below. - } - - @SideOnly(Side.CLIENT) -@@ -77,4 +78,15 @@ +@@ -75,4 +75,15 @@ { return (ItemRecord)field_150928_b.get(p_150926_0_); } + + /** + * Retrieves the resource location of the sound to play for this record. -+ * ++ * + * @param name The name of the record to play + * @return The resource location for the audio, null to use default. + */ -+ public ResourceLocation getRecordResource(String name) ++ public net.minecraft.util.ResourceLocation getRecordResource(String name) + { -+ return new ResourceLocation(name); ++ return new net.minecraft.util.ResourceLocation(name); + } } diff --git a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch index 687666d937..ff7b8fae95 100644 --- a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch @@ -1,49 +1,37 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSeedFood.java +++ ../src-work/minecraft/net/minecraft/item/ItemSeedFood.java -@@ -2,9 +2,13 @@ - - import net.minecraft.block.Block; - import net.minecraft.entity.player.EntityPlayer; -+import net.minecraft.world.IBlockAccess; +@@ -6,7 +6,7 @@ + import net.minecraft.util.EnumFacing; import net.minecraft.world.World; -+import net.minecraftforge.common.EnumPlantType; -+import net.minecraftforge.common.IPlantable; -+import net.minecraftforge.common.util.ForgeDirection; -public class ItemSeedFood extends ItemFood -+public class ItemSeedFood extends ItemFood implements IPlantable ++public class ItemSeedFood extends ItemFood implements net.minecraftforge.common.IPlantable { private Block field_150908_b; private Block field_82809_c; -@@ -25,7 +29,7 @@ - } - else if (p_77648_2_.func_82247_a(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_) && p_77648_2_.func_82247_a(p_77648_4_, p_77648_5_ + 1, p_77648_6_, p_77648_7_, p_77648_1_)) +@@ -29,7 +29,7 @@ { -- if (p_77648_3_.func_147439_a(p_77648_4_, p_77648_5_, p_77648_6_) == this.field_82809_c && p_77648_3_.func_147437_c(p_77648_4_, p_77648_5_ + 1, p_77648_6_)) -+ if (p_77648_3_.func_147439_a(p_77648_4_, p_77648_5_, p_77648_6_).canSustainPlant(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, ForgeDirection.UP, this) && p_77648_3_.func_147437_c(p_77648_4_, p_77648_5_ + 1, p_77648_6_)) - { - p_77648_3_.func_147449_b(p_77648_4_, p_77648_5_ + 1, p_77648_6_, this.field_150908_b); - --p_77648_1_.field_77994_a; -@@ -41,4 +45,22 @@ + return false; + } +- else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c() == this.field_82809_c && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) ++ else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().canSustainPlant(p_180614_3_, p_180614_4_, EnumFacing.UP, this) && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) + { + p_180614_3_.func_175656_a(p_180614_4_.func_177984_a(), this.field_150908_b.func_176223_P()); + --p_180614_1_.field_77994_a; +@@ -40,4 +40,16 @@ return false; } } + + @Override -+ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) ++ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ return EnumPlantType.Crop; ++ return net.minecraftforge.common.EnumPlantType.Crop; + } + + @Override -+ public Block getPlant(IBlockAccess world, int x, int y, int z) ++ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ return field_150908_b; -+ } -+ -+ @Override -+ public int getPlantMetadata(IBlockAccess world, int x, int y, int z) -+ { -+ return 0; ++ return this.field_150908_b.func_176223_P(); + } } diff --git a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch index 697ffac1a8..eef2fbf141 100644 --- a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch @@ -1,50 +1,37 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSeeds.java +++ ../src-work/minecraft/net/minecraft/item/ItemSeeds.java -@@ -3,9 +3,14 @@ - import net.minecraft.block.Block; - import net.minecraft.creativetab.CreativeTabs; - import net.minecraft.entity.player.EntityPlayer; -+import net.minecraft.init.Blocks; -+import net.minecraft.world.IBlockAccess; +@@ -7,7 +7,7 @@ + import net.minecraft.util.EnumFacing; import net.minecraft.world.World; -+import net.minecraftforge.common.EnumPlantType; -+import net.minecraftforge.common.IPlantable; -+import net.minecraftforge.common.util.ForgeDirection; -public class ItemSeeds extends Item -+public class ItemSeeds extends Item implements IPlantable ++public class ItemSeeds extends Item implements net.minecraftforge.common.IPlantable { private Block field_150925_a; private Block field_77838_b; -@@ -26,7 +31,7 @@ - } - else if (p_77648_2_.func_82247_a(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_) && p_77648_2_.func_82247_a(p_77648_4_, p_77648_5_ + 1, p_77648_6_, p_77648_7_, p_77648_1_)) +@@ -30,7 +30,7 @@ { -- if (p_77648_3_.func_147439_a(p_77648_4_, p_77648_5_, p_77648_6_) == this.field_77838_b && p_77648_3_.func_147437_c(p_77648_4_, p_77648_5_ + 1, p_77648_6_)) -+ if (p_77648_3_.func_147439_a(p_77648_4_, p_77648_5_, p_77648_6_).canSustainPlant(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, ForgeDirection.UP, this) && p_77648_3_.func_147437_c(p_77648_4_, p_77648_5_ + 1, p_77648_6_)) - { - p_77648_3_.func_147449_b(p_77648_4_, p_77648_5_ + 1, p_77648_6_, this.field_150925_a); - --p_77648_1_.field_77994_a; -@@ -42,4 +47,22 @@ + return false; + } +- else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c() == this.field_77838_b && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) ++ else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().canSustainPlant(p_180614_3_, p_180614_4_, EnumFacing.UP, this) && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) + { + p_180614_3_.func_175656_a(p_180614_4_.func_177984_a(), this.field_150925_a.func_176223_P()); + --p_180614_1_.field_77994_a; +@@ -41,4 +41,16 @@ return false; } } + + @Override -+ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) ++ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ return field_150925_a == Blocks.field_150388_bm ? EnumPlantType.Nether : EnumPlantType.Crop; ++ return this.field_150925_a == net.minecraft.init.Blocks.field_150388_bm ? net.minecraftforge.common.EnumPlantType.Nether : net.minecraftforge.common.EnumPlantType.Crop; + } + + @Override -+ public Block getPlant(IBlockAccess world, int x, int y, int z) ++ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ return field_150925_a; -+ } -+ -+ @Override -+ public int getPlantMetadata(IBlockAccess world, int x, int y, int z) -+ { -+ return 0; ++ return this.field_150925_a.func_176223_P(); + } } diff --git a/patches/minecraft/net/minecraft/item/ItemShears.java.patch b/patches/minecraft/net/minecraft/item/ItemShears.java.patch index fdded4de9b..3ce6e4da7d 100644 --- a/patches/minecraft/net/minecraft/item/ItemShears.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemShears.java.patch @@ -1,65 +1,46 @@ --- ../src-base/minecraft/net/minecraft/item/ItemShears.java +++ ../src-work/minecraft/net/minecraft/item/ItemShears.java -@@ -1,11 +1,20 @@ - package net.minecraft.item; +@@ -21,13 +21,12 @@ -+import java.util.ArrayList; -+import java.util.Random; -+ - import net.minecraft.block.Block; - import net.minecraft.block.material.Material; - import net.minecraft.creativetab.CreativeTabs; -+import net.minecraft.enchantment.Enchantment; -+import net.minecraft.enchantment.EnchantmentHelper; - import net.minecraft.entity.EntityLivingBase; -+import net.minecraft.entity.item.EntityItem; -+import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.init.Blocks; -+import net.minecraft.stats.StatList; - import net.minecraft.world.World; -+import net.minecraftforge.common.IShearable; - - public class ItemShears extends Item - { -@@ -20,13 +29,12 @@ - - public boolean func_150894_a(ItemStack p_150894_1_, World p_150894_2_, Block p_150894_3_, int p_150894_4_, int p_150894_5_, int p_150894_6_, EntityLivingBase p_150894_7_) + public boolean func_179218_a(ItemStack p_179218_1_, World p_179218_2_, Block p_179218_3_, BlockPos p_179218_4_, EntityLivingBase p_179218_5_) { -- if (p_150894_3_.func_149688_o() != Material.field_151584_j && p_150894_3_ != Blocks.field_150321_G && p_150894_3_ != Blocks.field_150329_H && p_150894_3_ != Blocks.field_150395_bd && p_150894_3_ != Blocks.field_150473_bD) -+ if (p_150894_3_.func_149688_o() != Material.field_151584_j && p_150894_3_ != Blocks.field_150321_G && p_150894_3_ != Blocks.field_150329_H && p_150894_3_ != Blocks.field_150395_bd && p_150894_3_ != Blocks.field_150473_bD && !(p_150894_3_ instanceof IShearable)) +- if (p_179218_3_.func_149688_o() != Material.field_151584_j && p_179218_3_ != Blocks.field_150321_G && p_179218_3_ != Blocks.field_150329_H && p_179218_3_ != Blocks.field_150395_bd && p_179218_3_ != Blocks.field_150473_bD && p_179218_3_ != Blocks.field_150325_L) ++ if (p_179218_3_.func_149688_o() != Material.field_151584_j && p_179218_3_ != Blocks.field_150321_G && p_179218_3_ != Blocks.field_150329_H && p_179218_3_ != Blocks.field_150395_bd && p_179218_3_ != Blocks.field_150473_bD && p_179218_3_ != Blocks.field_150325_L && !(p_179218_3_ instanceof net.minecraftforge.common.IShearable)) { - return super.func_150894_a(p_150894_1_, p_150894_2_, p_150894_3_, p_150894_4_, p_150894_5_, p_150894_6_, p_150894_7_); + return super.func_179218_a(p_179218_1_, p_179218_2_, p_179218_3_, p_179218_4_, p_179218_5_); } else { -- p_150894_1_.func_77972_a(1, p_150894_7_); +- p_179218_1_.func_77972_a(1, p_179218_5_); return true; } } -@@ -40,4 +48,69 @@ +@@ -41,4 +40,71 @@ { return p_150893_2_ != Blocks.field_150321_G && p_150893_2_.func_149688_o() != Material.field_151584_j ? (p_150893_2_ == Blocks.field_150325_L ? 5.0F : super.func_150893_a(p_150893_1_, p_150893_2_)) : 15.0F; } + ++ + @Override -+ public boolean func_111207_a(ItemStack itemstack, EntityPlayer player, EntityLivingBase entity) ++ public boolean func_111207_a(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity) + { + if (entity.field_70170_p.field_72995_K) + { + return false; + } -+ if (entity instanceof IShearable) ++ if (entity instanceof net.minecraftforge.common.IShearable) + { -+ IShearable target = (IShearable)entity; -+ if (target.isShearable(itemstack, entity.field_70170_p, (int)entity.field_70165_t, (int)entity.field_70163_u, (int)entity.field_70161_v)) ++ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)entity; ++ BlockPos pos = new BlockPos(entity.field_70165_t, entity.field_70163_u, entity.field_70161_v); ++ if (target.isShearable(itemstack, entity.field_70170_p, pos)) + { -+ ArrayList drops = target.onSheared(itemstack, entity.field_70170_p, (int)entity.field_70165_t, (int)entity.field_70163_u, (int)entity.field_70161_v, -+ EnchantmentHelper.func_77506_a(Enchantment.field_77346_s.field_77352_x, itemstack)); ++ java.util.List drops = target.onSheared(itemstack, entity.field_70170_p, pos, ++ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.enchantment.Enchantment.field_77346_s.field_77352_x, itemstack)); + -+ Random rand = new Random(); ++ java.util.Random rand = new java.util.Random(); + for(ItemStack stack : drops) + { -+ EntityItem ent = entity.func_70099_a(stack, 1.0F); ++ net.minecraft.entity.item.EntityItem ent = entity.func_70099_a(stack, 1.0F); + ent.field_70181_x += rand.nextFloat() * 0.05F; + ent.field_70159_w += (rand.nextFloat() - rand.nextFloat()) * 0.1F; + ent.field_70179_y += (rand.nextFloat() - rand.nextFloat()) * 0.1F; @@ -72,21 +53,21 @@ + } + + @Override -+ public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) ++ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, net.minecraft.entity.player.EntityPlayer player) + { + if (player.field_70170_p.field_72995_K) + { + return false; + } -+ Block block = player.field_70170_p.func_147439_a(x, y, z); -+ if (block instanceof IShearable) ++ Block block = player.field_70170_p.func_180495_p(pos).func_177230_c(); ++ if (block instanceof net.minecraftforge.common.IShearable) + { -+ IShearable target = (IShearable)block; -+ if (target.isShearable(itemstack, player.field_70170_p, x, y, z)) ++ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)block; ++ if (target.isShearable(itemstack, player.field_70170_p, pos)) + { -+ ArrayList drops = target.onSheared(itemstack, player.field_70170_p, x, y, z, -+ EnchantmentHelper.func_77506_a(Enchantment.field_77346_s.field_77352_x, itemstack)); -+ Random rand = new Random(); ++ java.util.List drops = target.onSheared(itemstack, player.field_70170_p, pos, ++ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.enchantment.Enchantment.field_77346_s.field_77352_x, itemstack)); ++ java.util.Random rand = new java.util.Random(); + + for(ItemStack stack : drops) + { @@ -94,13 +75,13 @@ + double d = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d1 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d2 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ EntityItem entityitem = new EntityItem(player.field_70170_p, (double)x + d, (double)y + d1, (double)z + d2, stack); -+ entityitem.field_145804_b = 10; ++ net.minecraft.entity.item.EntityItem entityitem = new net.minecraft.entity.item.EntityItem(player.field_70170_p, (double)pos.func_177958_n() + d, (double)pos.func_177956_o() + d1, (double)pos.func_177952_p() + d2, stack); ++ entityitem.func_174869_p(); + player.field_70170_p.func_72838_d(entityitem); + } + + itemstack.func_77972_a(1, player); -+ player.func_71064_a(StatList.field_75934_C[Block.func_149682_b(block)], 1); ++ player.func_71064_a(net.minecraft.stats.StatList.field_75934_C[Block.func_149682_b(block)], 1); + } + } + return false; diff --git a/patches/minecraft/net/minecraft/item/ItemSkull.java.patch b/patches/minecraft/net/minecraft/item/ItemSkull.java.patch index b17ccc8d56..e8e9e4445e 100644 --- a/patches/minecraft/net/minecraft/item/ItemSkull.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSkull.java.patch @@ -1,32 +1,31 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSkull.java +++ ../src-work/minecraft/net/minecraft/item/ItemSkull.java -@@ -36,11 +36,16 @@ +@@ -35,6 +35,11 @@ - public boolean func_77648_a(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) + public boolean func_180614_a(ItemStack p_180614_1_, EntityPlayer p_180614_2_, World p_180614_3_, BlockPos p_180614_4_, EnumFacing p_180614_5_, float p_180614_6_, float p_180614_7_, float p_180614_8_) { -+ if(p_77648_3_.func_147439_a(p_77648_4_, p_77648_5_, p_77648_6_).isReplaceable(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_) && p_77648_7_ != 0) ++ if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_176200_f(p_180614_3_, p_180614_4_) && p_180614_5_ != EnumFacing.DOWN) + { -+ p_77648_7_ = 1; -+ p_77648_5_--; ++ p_180614_5_ = EnumFacing.UP; ++ p_180614_4_ = p_180614_4_.func_177977_b(); + } - if (p_77648_7_ == 0) + if (p_180614_5_ == EnumFacing.DOWN) { return false; - } -- else if (!p_77648_3_.func_147439_a(p_77648_4_, p_77648_5_, p_77648_6_).func_149688_o().func_76220_a()) -+ else if (!p_77648_3_.isSideSolid(p_77648_4_, p_77648_5_, p_77648_6_, net.minecraftforge.common.util.ForgeDirection.getOrientation(p_77648_7_))) - { - return false; - } -@@ -71,8 +76,11 @@ - ++p_77648_4_; - } +@@ -47,7 +52,7 @@ -+ } -+ { - if (!p_77648_3_.field_72995_K) + if (!flag) { -+ if (!Blocks.field_150465_bP.func_149707_d(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_)) return false; - p_77648_3_.func_147465_d(p_77648_4_, p_77648_5_, p_77648_6_, Blocks.field_150465_bP, p_77648_7_, 2); - int i1 = 0; +- if (!p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_149688_o().func_76220_a()) ++ if (!p_180614_3_.isSideSolid(p_180614_4_, p_180614_5_, true)) + { + return false; + } +@@ -67,6 +72,7 @@ + { + if (!p_180614_3_.field_72995_K) + { ++ if (!Blocks.field_150465_bP.func_176198_a(p_180614_3_, p_180614_4_, p_180614_5_)) return false; + p_180614_3_.func_180501_a(p_180614_4_, Blocks.field_150465_bP.func_176223_P().func_177226_a(BlockSkull.field_176418_a, p_180614_5_), 3); + int i = 0; diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index f0d3176e38..b2b98c4820 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -1,22 +1,14 @@ --- ../src-base/minecraft/net/minecraft/item/ItemStack.java +++ ../src-work/minecraft/net/minecraft/item/ItemStack.java -@@ -33,6 +33,7 @@ - import net.minecraft.util.IIcon; - import net.minecraft.util.StatCollector; - import net.minecraft.world.World; -+import net.minecraftforge.event.ForgeEventFactory; +@@ -129,6 +129,7 @@ - public final class ItemStack - { -@@ -124,6 +125,7 @@ - - public boolean func_77943_a(EntityPlayer p_77943_1_, World p_77943_2_, int p_77943_3_, int p_77943_4_, int p_77943_5_, int p_77943_6_, float p_77943_7_, float p_77943_8_, float p_77943_9_) + public boolean func_179546_a(EntityPlayer p_179546_1_, World p_179546_2_, BlockPos p_179546_3_, EnumFacing p_179546_4_, float p_179546_5_, float p_179546_6_, float p_179546_7_) { -+ if (!p_77943_2_.field_72995_K) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, p_77943_1_, p_77943_2_, p_77943_3_, p_77943_4_, p_77943_5_, p_77943_6_, p_77943_7_, p_77943_8_, p_77943_9_); - boolean flag = this.func_77973_b().func_77648_a(this, p_77943_1_, p_77943_2_, p_77943_3_, p_77943_4_, p_77943_5_, p_77943_6_, p_77943_7_, p_77943_8_, p_77943_9_); ++ if (!p_179546_2_.field_72995_K) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, p_179546_1_, p_179546_2_, p_179546_3_, p_179546_4_, p_179546_5_, p_179546_6_, p_179546_7_); + boolean flag = this.func_77973_b().func_180614_a(this, p_179546_1_, p_179546_2_, p_179546_3_, p_179546_4_, p_179546_5_, p_179546_6_, p_179546_7_); if (flag) -@@ -182,7 +184,7 @@ +@@ -201,7 +202,7 @@ public int func_77976_d() { @@ -25,16 +17,16 @@ } public boolean func_77985_e() -@@ -192,7 +194,7 @@ +@@ -211,7 +212,7 @@ public boolean func_77984_f() { -- return this.field_151002_e.func_77612_l() <= 0 ? false : !this.func_77942_o() || !this.func_77978_p().func_74767_n("Unbreakable"); -+ return this.field_151002_e.getMaxDamage(this) <= 0 ? false : !this.func_77942_o() || !this.func_77978_p().func_74767_n("Unbreakable"); +- return this.field_151002_e == null ? false : (this.field_151002_e.func_77612_l() <= 0 ? false : !this.func_77942_o() || !this.func_77978_p().func_74767_n("Unbreakable")); ++ return this.field_151002_e == null ? false : (this.field_151002_e.getMaxDamage(this) <= 0 ? false : !this.func_77942_o() || !this.func_77978_p().func_74767_n("Unbreakable")); } public boolean func_77981_g() -@@ -202,32 +204,27 @@ +@@ -221,32 +222,27 @@ public boolean func_77951_h() { @@ -45,13 +37,13 @@ public int func_77952_i() { - return this.field_77991_e; -+ return func_77973_b().getDisplayDamage(this); ++ return func_77973_b().getDamage(this); } public int func_77960_j() { - return this.field_77991_e; -+ return func_77973_b().getDamage(this); ++ return func_77973_b().getMetadata(this); } public void func_77964_b(int p_77964_1_) @@ -68,22 +60,22 @@ public int func_77958_k() { - return this.field_151002_e.func_77612_l(); -+ return func_77973_b().getMaxDamage(this); ++ return this.field_151002_e.getMaxDamage(this); } public boolean func_96631_a(int p_96631_1_, Random p_96631_2_) -@@ -259,8 +256,8 @@ +@@ -278,8 +274,8 @@ } } - this.field_77991_e += p_96631_1_; - return this.field_77991_e > this.func_77958_k(); -+ func_77964_b(func_77960_j() + p_96631_1_); //Redirect through Item's callback if applicable. -+ return func_77960_j() > func_77958_k(); ++ func_77964_b(func_77952_i() + p_96631_1_); //Redirect through Item's callback if applicable. ++ return func_77952_i() > func_77958_k(); } } -@@ -319,7 +316,7 @@ +@@ -338,7 +334,7 @@ public boolean func_150998_b(Block p_150998_1_) { @@ -92,33 +84,16 @@ } public boolean func_111282_a(EntityPlayer p_111282_1_, EntityLivingBase p_111282_2_) -@@ -626,16 +623,24 @@ - { - arraylist.add("Durability: " + (this.func_77958_k() - this.func_77952_i()) + " / " + this.func_77958_k()); +@@ -753,6 +749,8 @@ + } } -+ ForgeEventFactory.onItemTooltip(this, p_82840_1_, arraylist, p_82840_2_); ++ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, p_82840_1_, arraylist, p_82840_2_); ++ return arraylist; } -+ @Deprecated - @SideOnly(Side.CLIENT) - public boolean func_77962_s() - { -- return this.func_77973_b().func_77636_d(this); -+ return hasEffect(0); - } - -+ @SideOnly(Side.CLIENT) -+ public boolean hasEffect(int pass) -+ { -+ return this.func_77973_b().hasEffect(this, pass); -+ } -+ - public EnumRarity func_77953_t() - { - return this.func_77973_b().func_77613_e(this); -@@ -737,7 +742,7 @@ +@@ -863,7 +861,7 @@ } else { diff --git a/patches/minecraft/net/minecraft/item/ItemTool.java.patch b/patches/minecraft/net/minecraft/item/ItemTool.java.patch index c59633eb5e..14126a8950 100644 --- a/patches/minecraft/net/minecraft/item/ItemTool.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemTool.java.patch @@ -1,21 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemTool.java +++ ../src-work/minecraft/net/minecraft/item/ItemTool.java -@@ -1,5 +1,6 @@ - package net.minecraft.item; - -+import com.google.common.collect.ImmutableSet; - import com.google.common.collect.Multimap; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -@@ -10,6 +11,7 @@ - import net.minecraft.entity.SharedMonsterAttributes; - import net.minecraft.entity.ai.attributes.AttributeModifier; - import net.minecraft.world.World; -+import net.minecraftforge.common.ForgeHooks; - - public class ItemTool extends Item - { -@@ -28,6 +30,18 @@ +@@ -29,6 +29,18 @@ this.field_77864_a = p_i45333_2_.func_77998_b(); this.field_77865_bY = p_i45333_1_ + p_i45333_2_.func_78000_c(); this.func_77637_a(CreativeTabs.field_78040_i); @@ -34,7 +19,7 @@ } public float func_150893_a(ItemStack p_150893_1_, Block p_150893_2_) -@@ -83,4 +97,37 @@ +@@ -84,4 +96,38 @@ multimap.put(SharedMonsterAttributes.field_111264_e.func_111108_a(), new AttributeModifier(field_111210_e, "Tool modifier", (double)this.field_77865_bY, 0)); return multimap; } @@ -58,17 +43,18 @@ + @Override + public Set getToolClasses(ItemStack stack) + { -+ return toolClass != null ? ImmutableSet.of(toolClass) : super.getToolClasses(stack); ++ return toolClass != null ? com.google.common.collect.ImmutableSet.of(toolClass) : super.getToolClasses(stack); + } + + @Override -+ public float getDigSpeed(ItemStack stack, Block block, int meta) ++ public float getDigSpeed(ItemStack stack, net.minecraft.block.state.IBlockState state) + { -+ if (ForgeHooks.isToolEffective(stack, block, meta)) ++ for (String type : getToolClasses(stack)) + { -+ return field_77864_a; ++ if (state.func_177230_c().isToolEffective(type, state)) ++ return field_77864_a; + } -+ return super.getDigSpeed(stack, block, meta); ++ return super.getDigSpeed(stack, state); + } + /*===================================== FORGE END =================================*/ } diff --git a/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch b/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch deleted file mode 100644 index ed515cbc7a..0000000000 --- a/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/CraftingManager.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/CraftingManager.java -@@ -299,7 +299,7 @@ - } - } - -- if (i == 2 && itemstack.func_77973_b() == itemstack1.func_77973_b() && itemstack.field_77994_a == 1 && itemstack1.field_77994_a == 1 && itemstack.func_77973_b().func_77645_m()) -+ if (i == 2 && itemstack.func_77973_b() == itemstack1.func_77973_b() && itemstack.field_77994_a == 1 && itemstack1.field_77994_a == 1 && itemstack.func_77973_b().isRepairable()) - { - Item item = itemstack.func_77973_b(); - int j1 = item.func_77612_l() - itemstack.func_77952_i(); diff --git a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch index d5a9159a1b..93edfe568e 100644 --- a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java +++ ../src-work/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java -@@ -107,6 +107,9 @@ +@@ -113,6 +113,9 @@ public float func_151398_b(ItemStack p_151398_1_) { diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch index ebb53f2b01..aa829dcaf2 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/RecipeFireworks.java +++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeFireworks.java -@@ -89,9 +89,9 @@ +@@ -90,9 +90,9 @@ { this.field_92102_a = new ItemStack(Items.field_151152_bP); @@ -11,7 +11,7 @@ nbttagcompound1 = new NBTTagCompound(); NBTTagList nbttaglist = new NBTTagList(); -@@ -108,8 +108,8 @@ +@@ -109,8 +109,8 @@ nbttagcompound1.func_74782_a("Explosions", nbttaglist); nbttagcompound1.func_74774_a("Flight", (byte)j); nbttagcompound.func_74782_a("Fireworks", nbttagcompound1); @@ -21,3 +21,16 @@ return true; } +@@ -253,11 +253,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.func_70301_a(i); +- +- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) +- { +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch new file mode 100644 index 0000000000..e45703adcb --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java +@@ -27,7 +27,7 @@ + { + ItemStack itemstack1 = (ItemStack)arraylist.get(0); + +- if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.field_77994_a != 1 || itemstack.field_77994_a != 1 || !itemstack1.func_77973_b().func_77645_m()) ++ if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.field_77994_a != 1 || itemstack.field_77994_a != 1 || !itemstack1.func_77973_b().isRepairable()) + { + return false; + } +@@ -55,7 +55,7 @@ + { + ItemStack itemstack1 = (ItemStack)arraylist.get(0); + +- if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.field_77994_a != 1 || itemstack.field_77994_a != 1 || !itemstack1.func_77973_b().func_77645_m()) ++ if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.field_77994_a != 1 || itemstack.field_77994_a != 1 || !itemstack1.func_77973_b().isRepairable()) + { + return null; + } +@@ -68,7 +68,7 @@ + ItemStack itemstack2 = (ItemStack)arraylist.get(0); + itemstack = (ItemStack)arraylist.get(1); + +- if (itemstack2.func_77973_b() == itemstack.func_77973_b() && itemstack2.field_77994_a == 1 && itemstack.field_77994_a == 1 && itemstack2.func_77973_b().func_77645_m()) ++ if (itemstack2.func_77973_b() == itemstack.func_77973_b() && itemstack2.field_77994_a == 1 && itemstack.field_77994_a == 1 && itemstack2.func_77973_b().isRepairable()) + { + Item item = itemstack2.func_77973_b(); + int j = item.func_77612_l() - itemstack2.func_77952_i(); +@@ -105,11 +105,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.func_70301_a(i); +- +- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) +- { +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch new file mode 100644 index 0000000000..4a45ed51b4 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java +@@ -153,11 +153,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.func_70301_a(i); +- +- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) +- { +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch new file mode 100644 index 0000000000..55cf592f52 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipesBanners.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesBanners.java +@@ -143,11 +143,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.func_70301_a(i); +- +- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) +- { +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; +@@ -375,9 +371,9 @@ + + if (itemstack != null) + { +- if (itemstack.func_77973_b().func_77634_r()) ++ if (itemstack.func_77973_b().hasContainerItem(itemstack)) + { +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + else if (itemstack.func_77942_o() && TileEntityBanner.func_175113_c(itemstack) > 0) + { diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch new file mode 100644 index 0000000000..7a60d54d04 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java +@@ -110,11 +110,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.func_70301_a(i); +- +- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) +- { +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch new file mode 100644 index 0000000000..719da837b1 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/ShapedRecipes.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/ShapedRecipes.java +@@ -34,11 +34,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.func_70301_a(i); +- +- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) +- { +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch new file mode 100644 index 0000000000..50228d8633 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java +@@ -32,11 +32,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.func_70301_a(i); +- +- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) +- { +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch index 3e1d5829a6..4c3ac6063a 100644 --- a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch +++ b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch @@ -1,22 +1,23 @@ --- ../src-base/minecraft/net/minecraft/nbt/CompressedStreamTools.java +++ ../src-work/minecraft/net/minecraft/nbt/CompressedStreamTools.java -@@ -1,7 +1,5 @@ - package net.minecraft.nbt; +@@ -17,8 +17,6 @@ + import net.minecraft.crash.CrashReport; + import net.minecraft.crash.CrashReportCategory; + import net.minecraft.util.ReportedException; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; --import cpw.mods.fml.relauncher.Side; --import cpw.mods.fml.relauncher.SideOnly; - import java.io.BufferedInputStream; - import java.io.BufferedOutputStream; - import java.io.ByteArrayInputStream; -@@ -91,7 +89,6 @@ - return bytearrayoutputstream.toByteArray(); + public class CompressedStreamTools + { +@@ -55,7 +53,6 @@ + } } - @SideOnly(Side.CLIENT) public static void func_74793_a(NBTTagCompound p_74793_0_, File p_74793_1_) throws IOException { File file2 = new File(p_74793_1_.getAbsolutePath() + "_tmp"); -@@ -182,7 +179,6 @@ +@@ -146,7 +143,6 @@ } } @@ -24,17 +25,11 @@ public static void func_74795_b(NBTTagCompound p_74795_0_, File p_74795_1_) throws IOException { DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(p_74795_1_)); -@@ -197,13 +193,11 @@ +@@ -161,7 +157,6 @@ } } - @SideOnly(Side.CLIENT) public static NBTTagCompound func_74797_a(File p_74797_0_) throws IOException { - return func_152458_a(p_74797_0_, NBTSizeTracker.field_152451_a); - } - -- @SideOnly(Side.CLIENT) - public static NBTTagCompound func_152458_a(File p_152458_0_, NBTSizeTracker p_152458_1_) throws IOException - { - if (!p_152458_0_.exists()) + if (!p_74797_0_.exists()) diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch deleted file mode 100644 index 5d16574309..0000000000 --- a/patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTTagList.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTTagList.java -@@ -1,7 +1,5 @@ - package net.minecraft.nbt; - --import cpw.mods.fml.relauncher.Side; --import cpw.mods.fml.relauncher.SideOnly; - import java.io.DataInput; - import java.io.DataOutput; - import java.io.IOException; -@@ -91,7 +89,6 @@ - this.field_74747_a.add(p_74742_1_); - } - -- @SideOnly(Side.CLIENT) - public void func_150304_a(int p_150304_1_, NBTBase p_150304_2_) - { - if (p_150304_1_ >= 0 && p_150304_1_ < this.field_74747_a.size()) -@@ -114,7 +111,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - public NBTBase func_74744_a(int p_74744_1_) - { - return (NBTBase)this.field_74747_a.remove(p_74744_1_); diff --git a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch index cc1d23ada8..fbcc44e76b 100644 --- a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch +++ b/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -1,98 +1,90 @@ --- ../src-base/minecraft/net/minecraft/network/NetHandlerPlayServer.java +++ ../src-work/minecraft/net/minecraft/network/NetHandlerPlayServer.java -@@ -86,6 +86,14 @@ +@@ -93,6 +93,14 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.MinecraftForge; -+import cpw.mods.fml.common.eventhandler.Event; ++import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraftforge.event.ForgeEventFactory; +import net.minecraftforge.event.ServerChatEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; + - public class NetHandlerPlayServer implements INetHandlerPlayServer + public class NetHandlerPlayServer implements INetHandlerPlayServer, IUpdatePlayerListBox { private static final Logger field_147370_c = LogManager.getLogger(); -@@ -222,6 +230,11 @@ +@@ -246,6 +254,8 @@ this.field_147369_b.field_70154_o.func_70043_V(); } -+ if (!this.field_147380_r) //Fixes teleportation kick while riding entities -+ { -+ return; -+ } ++ if (!this.field_147380_r) return; //Fixes teleportation kick while riding entities + this.field_147367_d.func_71203_ab().func_72358_d(this.field_147369_b); - if (this.field_147380_r) -@@ -299,9 +312,10 @@ - d4 = d1 - this.field_147369_b.field_70165_t; - double d5 = d2 - this.field_147369_b.field_70163_u; - double d6 = d3 - this.field_147369_b.field_70161_v; -- double d7 = Math.min(Math.abs(d4), Math.abs(this.field_147369_b.field_70159_w)); -- double d8 = Math.min(Math.abs(d5), Math.abs(this.field_147369_b.field_70181_x)); -- double d9 = Math.min(Math.abs(d6), Math.abs(this.field_147369_b.field_70179_y)); + if (this.field_147369_b.field_70154_o != null) +@@ -324,9 +334,10 @@ + double d11 = d8 - this.field_147369_b.field_70165_t; + double d12 = d9 - this.field_147369_b.field_70163_u; + double d13 = d10 - this.field_147369_b.field_70161_v; +- double d14 = Math.min(Math.abs(d11), Math.abs(this.field_147369_b.field_70159_w)); +- double d15 = Math.min(Math.abs(d12), Math.abs(this.field_147369_b.field_70181_x)); +- double d16 = Math.min(Math.abs(d13), Math.abs(this.field_147369_b.field_70179_y)); + //BUGFIX: min -> max, grabs the highest distance -+ double d7 = Math.max(Math.abs(d4), Math.abs(this.field_147369_b.field_70159_w)); -+ double d8 = Math.max(Math.abs(d5), Math.abs(this.field_147369_b.field_70181_x)); -+ double d9 = Math.max(Math.abs(d6), Math.abs(this.field_147369_b.field_70179_y)); - double d10 = d7 * d7 + d8 * d8 + d9 * d9; ++ double d14 = Math.max(Math.abs(d11), Math.abs(this.field_147369_b.field_70159_w)); ++ double d15 = Math.max(Math.abs(d12), Math.abs(this.field_147369_b.field_70181_x)); ++ double d16 = Math.max(Math.abs(d13), Math.abs(this.field_147369_b.field_70179_y)); + double d17 = d14 * d14 + d15 * d15 + d16 * d16; - if (d10 > 100.0D && (!this.field_147367_d.func_71264_H() || !this.field_147367_d.func_71214_G().equals(this.field_147369_b.func_70005_c_()))) -@@ -319,6 +333,11 @@ + if (d17 > 100.0D && (!this.field_147367_d.func_71264_H() || !this.field_147367_d.func_71214_G().equals(this.field_147369_b.func_70005_c_()))) +@@ -344,6 +355,8 @@ this.field_147369_b.func_70664_aZ(); } -+ if (!this.field_147380_r) //Fixes "Moved Too Fast" kick when being teleported while moving -+ { -+ return; -+ } ++ if (!this.field_147380_r) return; //Fixes "Moved Too Fast" kick when being teleported while moving + - this.field_147369_b.func_70091_d(d4, d5, d6); + this.field_147369_b.func_70091_d(d11, d12, d13); this.field_147369_b.field_70122_E = p_147347_1_.func_149465_i(); - this.field_147369_b.func_71000_j(d4, d5, d6); -@@ -341,10 +360,15 @@ + double d18 = d12; +@@ -365,6 +378,8 @@ field_147370_c.warn(this.field_147369_b.func_70005_c_() + " moved wrongly!"); } -+ if (!this.field_147380_r) //Fixes "Moved Too Fast" kick when being teleported while moving -+ { -+ return; -+ } ++ if (!this.field_147380_r) return; //Fixes "Moved Too Fast" kick when being teleported while moving + - this.field_147369_b.func_70080_a(d1, d2, d3, f1, f2); - boolean flag2 = worldserver.func_72945_a(this.field_147369_b, this.field_147369_b.field_70121_D.func_72329_c().func_72331_e((double)f3, (double)f3, (double)f3)).isEmpty(); + this.field_147369_b.func_70080_a(d8, d9, d10, f1, f2); + this.field_147369_b.func_71000_j(this.field_147369_b.field_70165_t - d0, this.field_147369_b.field_70163_u - d1, this.field_147369_b.field_70161_v - d2); -- if (flag && (flag1 || !flag2) && !this.field_147369_b.func_70608_bn()) -+ if (flag && (flag1 || !flag2) && !this.field_147369_b.func_70608_bn() && !this.field_147369_b.field_70145_X) +@@ -372,7 +387,7 @@ { - this.func_147364_a(this.field_147373_o, this.field_147382_p, this.field_147381_q, f1, f2); - return; -@@ -352,7 +376,7 @@ + boolean flag2 = worldserver.func_72945_a(this.field_147369_b, this.field_147369_b.func_174813_aQ().func_72331_e((double)f3, (double)f3, (double)f3)).isEmpty(); - AxisAlignedBB axisalignedbb = this.field_147369_b.field_70121_D.func_72329_c().func_72314_b((double)f3, (double)f3, (double)f3).func_72321_a(0.0D, -0.55D, 0.0D); - -- if (!this.field_147367_d.func_71231_X() && !this.field_147369_b.field_71134_c.func_73083_d() && !worldserver.func_72829_c(axisalignedbb)) -+ if (!this.field_147367_d.func_71231_X() && !this.field_147369_b.field_71134_c.func_73083_d() && !worldserver.func_72829_c(axisalignedbb) && !this.field_147369_b.field_71075_bZ.field_75101_c) - { - if (d11 >= -0.03125D) +- if (flag && (flag1 || !flag2) && !this.field_147369_b.func_70608_bn()) ++ if (flag && (flag1 || !flag2) && !this.field_147369_b.func_70608_bn() && !this.field_147369_b.field_70145_X) { -@@ -371,6 +395,11 @@ + this.func_147364_a(this.field_147373_o, this.field_147382_p, this.field_147381_q, f1, f2); + return; +@@ -381,7 +396,7 @@ + + AxisAlignedBB axisalignedbb = this.field_147369_b.func_174813_aQ().func_72314_b((double)f3, (double)f3, (double)f3).func_72321_a(0.0D, -0.55D, 0.0D); + +- if (!this.field_147367_d.func_71231_X() && !this.field_147369_b.field_71075_bZ.field_75101_c && !worldserver.func_72829_c(axisalignedbb)) ++ if (!this.field_147367_d.func_71231_X() && !this.field_147369_b.field_71075_bZ.field_75101_c && !worldserver.func_72829_c(axisalignedbb) && !this.field_147369_b.field_71075_bZ.field_75101_c) + { + if (d18 >= -0.03125D) + { +@@ -400,6 +415,8 @@ this.field_147365_f = 0; } -+ if (!this.field_147380_r) //Fixes "Moved Too Fast" kick when being teleported while moving -+ { -+ return; -+ } ++ if (!this.field_147380_r) return; //Fixes "Moved Too Fast" kick when being teleported while moving + this.field_147369_b.field_70122_E = p_147347_1_.func_149465_i(); this.field_147367_d.func_71203_ab().func_72358_d(this.field_147369_b); - this.field_147369_b.func_71122_b(this.field_147369_b.field_70163_u - d0, p_147347_1_.func_149465_i()); -@@ -439,7 +468,10 @@ - double d2 = this.field_147369_b.field_70161_v - ((double)k + 0.5D); + this.field_147369_b.func_71122_b(this.field_147369_b.field_70163_u - d7, p_147347_1_.func_149465_i()); +@@ -489,7 +506,10 @@ + double d2 = this.field_147369_b.field_70161_v - ((double)blockpos.func_177952_p() + 0.5D); double d3 = d0 * d0 + d1 * d1 + d2 * d2; - if (d3 > 36.0D) @@ -103,46 +95,42 @@ { return; } -@@ -487,6 +519,7 @@ +@@ -540,6 +560,7 @@ WorldServer worldserver = this.field_147367_d.func_71218_a(this.field_147369_b.field_71093_bK); ItemStack itemstack = this.field_147369_b.field_71071_by.func_70448_g(); boolean flag = false; + boolean placeResult = true; - int i = p_147346_1_.func_149576_c(); - int j = p_147346_1_.func_149571_d(); - int k = p_147346_1_.func_149570_e(); -@@ -500,7 +533,11 @@ + BlockPos blockpos = p_147346_1_.func_179724_a(); + EnumFacing enumfacing = EnumFacing.func_82600_a(p_147346_1_.func_149568_f()); + this.field_147369_b.func_143004_u(); +@@ -551,7 +572,11 @@ return; } -- this.field_147369_b.field_71134_c.func_73085_a(this.field_147369_b, worldserver, itemstack); -+ PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(field_147369_b, PlayerInteractEvent.Action.RIGHT_CLICK_AIR, 0, 0, 0, -1, worldserver); ++ PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(field_147369_b, PlayerInteractEvent.Action.RIGHT_CLICK_AIR, worldserver, new BlockPos(0, 0, 0), null); + if (event.useItem != Event.Result.DENY) + { -+ this.field_147369_b.field_71134_c.func_73085_a(this.field_147369_b, worldserver, itemstack); + this.field_147369_b.field_71134_c.func_73085_a(this.field_147369_b, worldserver, itemstack); + } } - else if (p_147346_1_.func_149571_d() >= this.field_147367_d.func_71207_Z() - 1 && (p_147346_1_.func_149568_f() == 1 || p_147346_1_.func_149571_d() >= this.field_147367_d.func_71207_Z())) + else if (blockpos.func_177956_o() >= this.field_147367_d.func_71207_Z() - 1 && (enumfacing == EnumFacing.UP || blockpos.func_177956_o() >= this.field_147367_d.func_71207_Z())) { -@@ -511,9 +548,15 @@ +@@ -562,9 +587,12 @@ } else { -- if (this.field_147380_r && this.field_147369_b.func_70092_e((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D) < 64.0D && !this.field_147367_d.func_96290_a(worldserver, i, j, k, this.field_147369_b)) +- if (this.field_147380_r && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < 64.0D && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos)) + double dist = field_147369_b.field_71134_c.getBlockReachDistance() + 1; + dist *= dist; -+ if (this.field_147380_r && this.field_147369_b.func_70092_e((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D) < dist && !this.field_147367_d.func_96290_a(worldserver, i, j, k, this.field_147369_b)) ++ if (this.field_147380_r && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < dist && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos)) { -- this.field_147369_b.field_71134_c.func_73078_a(this.field_147369_b, worldserver, itemstack, i, j, k, l, p_147346_1_.func_149573_h(), p_147346_1_.func_149569_i(), p_147346_1_.func_149575_j()); +- this.field_147369_b.field_71134_c.func_180236_a(this.field_147369_b, worldserver, itemstack, blockpos, enumfacing, p_147346_1_.func_149573_h(), p_147346_1_.func_149569_i(), p_147346_1_.func_149575_j()); + // record block place result so we can update client itemstack size if place event was cancelled. -+ if (!this.field_147369_b.field_71134_c.func_73078_a(this.field_147369_b, worldserver, itemstack, i, j, k, l, p_147346_1_.func_149573_h(), p_147346_1_.func_149569_i(), p_147346_1_.func_149575_j())) -+ { -+ placeResult = false; -+ } ++ placeResult = this.field_147369_b.field_71134_c.func_180236_a(this.field_147369_b, worldserver, itemstack, blockpos, enumfacing, p_147346_1_.func_149573_h(), p_147346_1_.func_149569_i(), p_147346_1_.func_149575_j()); } flag = true; -@@ -572,7 +615,7 @@ +@@ -592,7 +620,7 @@ this.field_147369_b.field_71070_bA.func_75142_b(); this.field_147369_b.field_71137_h = false; @@ -151,7 +139,7 @@ { this.func_147359_a(new S2FPacketSetSlot(this.field_147369_b.field_71070_bA.field_75152_c, slot.field_75222_d, this.field_147369_b.field_71071_by.func_70448_g())); } -@@ -677,6 +720,8 @@ +@@ -765,6 +793,8 @@ else { ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", new Object[] {this.field_147369_b.func_145748_c_(), s}); @@ -160,7 +148,7 @@ this.field_147367_d.func_71203_ab().func_148544_a(chatcomponenttranslation1, false); } -@@ -812,7 +857,7 @@ +@@ -907,7 +937,7 @@ return; } diff --git a/patches/minecraft/net/minecraft/network/play/server/S21PacketChunkData.java.patch b/patches/minecraft/net/minecraft/network/play/server/S21PacketChunkData.java.patch deleted file mode 100644 index 9dc0a82ab8..0000000000 --- a/patches/minecraft/net/minecraft/network/play/server/S21PacketChunkData.java.patch +++ /dev/null @@ -1,79 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/play/server/S21PacketChunkData.java -+++ ../src-work/minecraft/net/minecraft/network/play/server/S21PacketChunkData.java -@@ -3,6 +3,7 @@ - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; - import java.io.IOException; -+import java.util.concurrent.Semaphore; - import java.util.zip.DataFormatException; - import java.util.zip.Deflater; - import java.util.zip.Inflater; -@@ -26,6 +27,7 @@ - private int field_149285_h; - private static byte[] field_149286_i = new byte[196864]; - private static final String __OBFID = "CL_00001304"; -+ private Semaphore deflateGate; - - public S21PacketChunkData() {} - -@@ -35,17 +37,22 @@ - this.field_149282_b = p_i45196_1_.field_76647_h; - this.field_149279_g = p_i45196_2_; - S21PacketChunkData.Extracted extracted = func_149269_a(p_i45196_1_, p_i45196_2_, p_i45196_3_); -- Deflater deflater = new Deflater(-1); - this.field_149280_d = extracted.field_150281_c; - this.field_149283_c = extracted.field_150280_b; -+ this.field_149278_f = extracted.field_150282_a; -+ this.deflateGate = new Semaphore(1); -+ } - -+ private void deflate() -+ { -+ Deflater deflater = new Deflater(-1); - try - { -- this.field_149278_f = extracted.field_150282_a; -- deflater.setInput(extracted.field_150282_a, 0, extracted.field_150282_a.length); -+ deflater.setInput(this.field_149278_f, 0, this.field_149278_f.length); - deflater.finish(); -- this.field_149281_e = new byte[extracted.field_150282_a.length]; -- this.field_149285_h = deflater.deflate(this.field_149281_e); -+ byte[] deflated = new byte[this.field_149278_f.length]; -+ this.field_149285_h = deflater.deflate(deflated); -+ this.field_149281_e = deflated; - } - finally - { -@@ -75,13 +82,16 @@ - p_148837_1_.readBytes(field_149286_i, 0, this.field_149285_h); - int i = 0; - int j; -+ int msb = 0; //BugFix: MC does not read the MSB array from the packet properly, causing issues for servers that use blocks > 256 - - for (j = 0; j < 16; ++j) - { - i += this.field_149283_c >> j & 1; -+ msb += this.field_149283_c >> j & 1; - } - - j = 12288 * i; -+ j += 2048 * msb; - - if (this.field_149279_g) - { -@@ -108,6 +118,15 @@ - - public void func_148840_b(PacketBuffer p_148840_1_) throws IOException - { -+ if (this.field_149281_e == null) -+ { -+ deflateGate.acquireUninterruptibly(); -+ if (this.field_149281_e == null) -+ { -+ deflate(); -+ } -+ deflateGate.release(); -+ } - p_148840_1_.writeInt(this.field_149284_a); - p_148840_1_.writeInt(this.field_149282_b); - p_148840_1_.writeBoolean(this.field_149279_g); diff --git a/patches/minecraft/net/minecraft/network/play/server/S26PacketMapChunkBulk.java.patch b/patches/minecraft/net/minecraft/network/play/server/S26PacketMapChunkBulk.java.patch deleted file mode 100644 index 04eb440f48..0000000000 --- a/patches/minecraft/net/minecraft/network/play/server/S26PacketMapChunkBulk.java.patch +++ /dev/null @@ -1,84 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/play/server/S26PacketMapChunkBulk.java -+++ ../src-work/minecraft/net/minecraft/network/play/server/S26PacketMapChunkBulk.java -@@ -4,6 +4,7 @@ - import cpw.mods.fml.relauncher.SideOnly; - import java.io.IOException; - import java.util.List; -+import java.util.concurrent.Semaphore; - import java.util.zip.DataFormatException; - import java.util.zip.Deflater; - import java.util.zip.Inflater; -@@ -25,6 +26,8 @@ - private boolean field_149267_h; - private static byte[] field_149268_i = new byte[0]; - private static final String __OBFID = "CL_00001306"; -+ private int maxLen = 0; -+ private Semaphore deflateGate; - - public S26PacketMapChunkBulk() {} - -@@ -43,15 +46,6 @@ - { - Chunk chunk = (Chunk)p_i45197_1_.get(k); - S21PacketChunkData.Extracted extracted = S21PacketChunkData.func_149269_a(chunk, true, 65535); -- -- if (field_149268_i.length < j + extracted.field_150282_a.length) -- { -- byte[] abyte = new byte[j + extracted.field_150282_a.length]; -- System.arraycopy(field_149268_i, 0, abyte, 0, field_149268_i.length); -- field_149268_i = abyte; -- } -- -- System.arraycopy(extracted.field_150282_a, 0, field_149268_i, j, extracted.field_150282_a.length); - j += extracted.field_150282_a.length; - this.field_149266_a[k] = chunk.field_76635_g; - this.field_149264_b[k] = chunk.field_76647_h; -@@ -59,15 +53,28 @@ - this.field_149262_d[k] = extracted.field_150281_c; - this.field_149260_f[k] = extracted.field_150282_a; - } -+ this.deflateGate = new Semaphore(1); -+ maxLen = j; -+ } - -+ private void deflate() -+ { -+ byte[] data = new byte[maxLen]; -+ int offset = 0; -+ for (int x = 0; x < field_149260_f.length; x++) -+ { -+ System.arraycopy(field_149260_f[x], 0, data, offset, field_149260_f[x].length); -+ offset += field_149260_f[x].length; -+ } - Deflater deflater = new Deflater(-1); - - try - { -- deflater.setInput(field_149268_i, 0, j); -+ deflater.setInput(data, 0, data.length); - deflater.finish(); -- this.field_149263_e = new byte[j]; -- this.field_149261_g = deflater.deflate(this.field_149263_e); -+ byte[] deflated = new byte[data.length]; -+ this.field_149261_g = deflater.deflate(deflated); -+ this.field_149263_e = deflated; - } - finally - { -@@ -148,6 +155,16 @@ - - public void func_148840_b(PacketBuffer p_148840_1_) throws IOException - { -+ if (this.field_149263_e == null) -+ { -+ deflateGate.acquireUninterruptibly(); -+ if (this.field_149263_e == null) -+ { -+ deflate(); -+ } -+ deflateGate.release(); -+ } -+ - p_148840_1_.writeShort(this.field_149266_a.length); - p_148840_1_.writeInt(this.field_149261_g); - p_148840_1_.writeBoolean(this.field_149267_h); diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches/minecraft/net/minecraft/potion/Potion.java.patch index 32c3587c27..5892ca8c81 100644 --- a/patches/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches/minecraft/net/minecraft/potion/Potion.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/potion/Potion.java +++ ../src-work/minecraft/net/minecraft/potion/Potion.java -@@ -307,4 +307,27 @@ +@@ -330,4 +330,27 @@ { return p_111183_2_.func_111164_d() * (double)(p_111183_1_ + 1); } -+ ++ + /* ======================================== FORGE START =====================================*/ -+ ++ + /** -+ * If the standard PotionEffect text (name and duration) should be drawn when this potion is active. ++ * If the standard PotionEffect text (name and duration) should be drawn when this potion is active. + * @param effect the active PotionEffect + * @return true to draw the standard text + */ @@ -16,7 +16,7 @@ + { + return true; + } -+ ++ + /** + * Called to draw the this Potion onto the player's inventory when it's active. + * This can be used to e.g. render Potion icons from your own texture. diff --git a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch index 1d789ea8fe..11e08cb035 100644 --- a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -1,46 +1,32 @@ --- ../src-base/minecraft/net/minecraft/potion/PotionEffect.java +++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java -@@ -1,8 +1,13 @@ - package net.minecraft.potion; - -+import java.util.ArrayList; -+import java.util.List; -+ - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; - import net.minecraft.entity.EntityLivingBase; -+import net.minecraft.init.Items; -+import net.minecraft.item.ItemStack; - import net.minecraft.nbt.NBTTagCompound; - - public class PotionEffect -@@ -15,6 +20,8 @@ - @SideOnly(Side.CLIENT) +@@ -19,6 +19,8 @@ private boolean field_100013_f; + private boolean field_180156_h; private static final String __OBFID = "CL_00001529"; + /** List of ItemStack that can cure the potion effect **/ -+ private List curativeItems; ++ private java.util.List curativeItems; public PotionEffect(int p_i1574_1_, int p_i1574_2_) { -@@ -32,6 +39,8 @@ - this.field_76460_b = p_i1576_2_; - this.field_76461_c = p_i1576_3_; - this.field_82724_e = p_i1576_4_; -+ this.curativeItems = new ArrayList(); -+ this.curativeItems.add(new ItemStack(Items.field_151117_aB)); +@@ -37,6 +39,8 @@ + this.field_76461_c = p_i45896_3_; + this.field_82724_e = p_i45896_4_; + this.field_180156_h = p_i45896_5_; ++ this.curativeItems = new java.util.ArrayList(); ++ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.field_151117_aB)); } public PotionEffect(PotionEffect p_i1577_1_) -@@ -39,6 +48,7 @@ - this.field_76462_a = p_i1577_1_.field_76462_a; - this.field_76460_b = p_i1577_1_.field_76460_b; +@@ -46,6 +50,7 @@ this.field_76461_c = p_i1577_1_.field_76461_c; + this.field_82724_e = p_i1577_1_.field_82724_e; + this.field_180156_h = p_i1577_1_.field_180156_h; + this.curativeItems = p_i1577_1_.curativeItems; } public void func_76452_a(PotionEffect p_76452_1_) -@@ -197,4 +207,62 @@ +@@ -224,4 +229,62 @@ { return this.field_100013_f; } @@ -50,7 +36,7 @@ + * Returns a list of curative items for the potion effect + * @return The list (ItemStack) of curative items for the potion effect + */ -+ public List getCurativeItems() ++ public java.util.List getCurativeItems() + { + return this.curativeItems; + } @@ -60,10 +46,10 @@ + * @param stack The ItemStack being checked against the list of curative items for the potion effect + * @return true if the given ItemStack is in the list of curative items for the potion effect, false otherwise + */ -+ public boolean isCurativeItem(ItemStack stack) ++ public boolean isCurativeItem(net.minecraft.item.ItemStack stack) + { + boolean found = false; -+ for (ItemStack curativeItem : this.curativeItems) ++ for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) + { + if (curativeItem.func_77969_a(stack)) + { @@ -78,7 +64,7 @@ + * Sets the array of curative items for the potion effect + * @param curativeItems The list of ItemStacks being set to the potion effect + */ -+ public void setCurativeItems(List curativeItems) ++ public void setCurativeItems(java.util.List curativeItems) + { + this.curativeItems = curativeItems; + } @@ -87,10 +73,10 @@ + * Adds the given stack to list of curative items for the potion effect + * @param stack The ItemStack being added to the curative item list + */ -+ public void addCurativeItem(ItemStack stack) ++ public void addCurativeItem(net.minecraft.item.ItemStack stack) + { + boolean found = false; -+ for (ItemStack curativeItem : this.curativeItems) ++ for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) + { + if (curativeItem.func_77969_a(stack)) + { diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index f0d5e0c731..4fc77c41e7 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -1,25 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java +++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java -@@ -27,6 +27,7 @@ - import java.util.Arrays; - import java.util.Collections; - import java.util.Date; -+import java.util.Hashtable; - import java.util.Iterator; - import java.util.List; - import java.util.Random; -@@ -75,6 +76,10 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -+import net.minecraftforge.common.DimensionManager; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.world.WorldEvent; -+ - public abstract class MinecraftServer implements ICommandSender, Runnable, IPlayerUsage - { - private static final Logger field_147145_h = LogManager.getLogger(); -@@ -92,7 +97,7 @@ +@@ -99,7 +99,7 @@ @SideOnly(Side.SERVER) private String field_71320_r; private int field_71319_s = -1; @@ -28,35 +9,36 @@ private ServerConfigurationManager field_71318_t; private boolean field_71317_u = true; private boolean field_71316_v; -@@ -109,7 +114,8 @@ +@@ -116,7 +116,8 @@ private int field_71280_D; private int field_143008_E = 0; public final long[] field_71311_j = new long[100]; - public long[][] field_71312_k; + //public long[][] timeOfLastDimensionTick; -+ public Hashtable worldTickTimes = new Hashtable(); ++ public java.util.Hashtable worldTickTimes = new java.util.Hashtable(); private KeyPair field_71292_I; private String field_71293_J; private String field_71294_K; -@@ -191,8 +197,6 @@ +@@ -222,8 +223,6 @@ { this.func_71237_c(p_71247_1_); this.func_71192_d("menu.loadingLevel"); - this.field_71305_c = new WorldServer[3]; - this.field_71312_k = new long[this.field_71305_c.length][100]; ISaveHandler isavehandler = this.field_71310_m.func_75804_a(p_71247_1_, true); + this.func_175584_a(this.func_71270_I(), isavehandler); WorldInfo worldinfo = isavehandler.func_75757_d(); - WorldSettings worldsettings; -@@ -212,46 +216,21 @@ - worldsettings.func_77159_a(); +@@ -254,47 +253,21 @@ + worldsettings = new WorldSettings(worldinfo); } - for (int j = 0; j < this.field_71305_c.length; ++j) -+ WorldServer overWorld = (func_71242_L() ? new DemoWorldServer(this, isavehandler, p_71247_2_, 0, field_71304_b) : new WorldServer(this, isavehandler, p_71247_2_, 0, worldsettings, field_71304_b)); -+ for (int dim : DimensionManager.getStaticDimensionIDs()) ++ WorldServer overWorld = (WorldServer)(func_71242_L() ? new DemoWorldServer(this, isavehandler, worldinfo, 0, field_71304_b).func_175643_b() : new WorldServer(this, isavehandler, worldinfo, 0, field_71304_b).func_175643_b()); ++ overWorld.func_72963_a(worldsettings); ++ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) { - byte b0 = 0; -+ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, isavehandler, p_71247_2_, dim, worldsettings, overWorld, field_71304_b)); ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)new WorldServerMulti(this, isavehandler, dim, overWorld, field_71304_b).func_175643_b()); + world.func_72954_a(new WorldManager(this, world)); - if (j == 1) @@ -73,16 +55,18 @@ - { - if (this.func_71242_L()) - { -- this.field_71305_c[j] = new DemoWorldServer(this, isavehandler, p_71247_2_, b0, this.field_71304_b); +- this.field_71305_c[j] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.field_71304_b)).func_175643_b(); - } - else - { -- this.field_71305_c[j] = new WorldServer(this, isavehandler, p_71247_2_, b0, worldsettings, this.field_71304_b); +- this.field_71305_c[j] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, b0, this.field_71304_b)).func_175643_b(); - } +- +- this.field_71305_c[j].func_72963_a(worldsettings); - } - else - { -- this.field_71305_c[j] = new WorldServerMulti(this, isavehandler, p_71247_2_, b0, worldsettings, this.field_71305_c[0], this.field_71304_b); +- this.field_71305_c[j] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.field_71305_c[0], this.field_71304_b)).func_175643_b(); - } - - this.field_71305_c[j].func_72954_a(new WorldManager(this, this.field_71305_c[j])); @@ -92,16 +76,24 @@ - this.field_71305_c[j].func_72912_H().func_76060_a(this.func_71265_f()); + world.func_72912_H().func_76060_a(this.func_71265_f()); } - -- this.field_71318_t.func_72364_a(this.field_71305_c); -+ MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); } +- this.field_71318_t.func_72364_a(this.field_71305_c); + this.field_71318_t.func_72364_a(new WorldServer[]{ overWorld }); this.func_147139_a(this.func_147135_j()); this.func_71222_d(); } -@@ -320,6 +299,7 @@ +@@ -309,7 +282,7 @@ + this.func_71192_d("menu.generatingTerrain"); + byte b0 = 0; + field_147145_h.info("Preparing start region for level " + b0); +- WorldServer worldserver = this.field_71305_c[b0]; ++ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(b0); + BlockPos blockpos = worldserver.func_175694_M(); + long j = func_130071_aq(); + +@@ -371,6 +344,7 @@ if (!this.field_71290_O) { WorldServer[] aworldserver = this.field_71305_c; @@ -109,82 +101,82 @@ int i = aworldserver.length; for (int j = 0; j < i; ++j) -@@ -372,8 +352,15 @@ +@@ -423,8 +397,15 @@ for (int i = 0; i < this.field_71305_c.length; ++i) { WorldServer worldserver = this.field_71305_c[i]; -+ MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(worldserver)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); worldserver.func_73041_k(); } + + WorldServer[] tmp = field_71305_c; + for (WorldServer world : tmp) + { -+ DimensionManager.setWorld(world.field_73011_w.field_76574_g, null); ++ net.minecraftforge.common.DimensionManager.setWorld(world.field_73011_w.func_177502_q(), null); + } } if (this.field_71307_n.func_76468_d()) -@@ -606,15 +593,18 @@ - public void func_71190_q() - { - this.field_71304_b.func_76320_a("levels"); -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.tick(); - int i; +@@ -681,15 +662,18 @@ + } -- for (i = 0; i < this.field_71305_c.length; ++i) -+ Integer[] ids = DimensionManager.getIDs(this.field_71315_w % 200 == 0); + this.field_71304_b.func_76318_c("levels"); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.tick(); + int j; + +- for (j = 0; j < this.field_71305_c.length; ++j) ++ Integer[] ids = net.minecraftforge.common.DimensionManager.getIDs(this.field_71315_w % 200 == 0); + for (int x = 0; x < ids.length; x++) { + int id = ids[x]; - long j = System.nanoTime(); + long i = System.nanoTime(); -- if (i == 0 || this.func_71255_r()) +- if (j == 0 || this.func_71255_r()) + if (id == 0 || this.func_71255_r()) { -- WorldServer worldserver = this.field_71305_c[i]; -+ WorldServer worldserver = DimensionManager.getWorld(id); +- WorldServer worldserver = this.field_71305_c[j]; ++ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(id); this.field_71304_b.func_76320_a(worldserver.func_72912_H().func_76065_j()); - this.field_71304_b.func_76320_a("pools"); - this.field_71304_b.func_76319_b(); -@@ -660,9 +650,11 @@ + + if (this.field_71315_w % 20 == 0) +@@ -733,9 +717,11 @@ this.field_71304_b.func_76319_b(); } -- this.field_71312_k[i][this.field_71315_w % 100] = System.nanoTime() - j; -+ worldTickTimes.get(id)[this.field_71315_w % 100] = System.nanoTime() - j; +- this.field_71312_k[j][this.field_71315_w % 100] = System.nanoTime() - i; ++ worldTickTimes.get(id)[this.field_71315_w % 100] = System.nanoTime() - i; } + this.field_71304_b.func_76318_c("dim_unloading"); -+ DimensionManager.unloadWorlds(worldTickTimes); ++ net.minecraftforge.common.DimensionManager.unloadWorlds(worldTickTimes); this.field_71304_b.func_76318_c("connection"); this.func_147137_ag().func_151269_c(); this.field_71304_b.func_76318_c("players"); -@@ -707,7 +699,13 @@ +@@ -774,7 +760,13 @@ public WorldServer func_71218_a(int p_71218_1_) { - return p_71218_1_ == -1 ? this.field_71305_c[1] : (p_71218_1_ == 1 ? this.field_71305_c[2] : this.field_71305_c[0]); -+ WorldServer ret = DimensionManager.getWorld(p_71218_1_); ++ WorldServer ret = net.minecraftforge.common.DimensionManager.getWorld(p_71218_1_); + if (ret == null) + { -+ DimensionManager.initDimension(p_71218_1_); -+ ret = DimensionManager.getWorld(p_71218_1_); ++ net.minecraftforge.common.DimensionManager.initDimension(p_71218_1_); ++ ret = net.minecraftforge.common.DimensionManager.getWorld(p_71218_1_); + } + return ret; } public String func_71249_w() -@@ -971,6 +969,7 @@ +@@ -1025,6 +1017,7 @@ if (worldserver != null) { -+ MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(worldserver)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); worldserver.func_73041_k(); } } -@@ -1451,7 +1450,6 @@ - this.field_147141_M = p_155759_1_; +@@ -1607,7 +1600,6 @@ + this.field_71319_s = p_71208_1_; } - @SideOnly(Side.SERVER) diff --git a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch index 3cbe1472d3..351c82dafe 100644 --- a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -1,38 +1,36 @@ --- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java +++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java -@@ -23,6 +23,9 @@ - import net.minecraft.world.WorldType; - import net.minecraft.world.demo.DemoWorldServer; - import net.minecraft.world.storage.ISaveHandler; -+import net.minecraftforge.common.DimensionManager; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.world.WorldEvent; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -@@ -54,44 +57,23 @@ +@@ -74,8 +74,6 @@ protected void func_71247_a(String p_71247_1_, String p_71247_2_, long p_71247_3_, WorldType p_71247_5_, String p_71247_6_) { this.func_71237_c(p_71247_1_); - this.field_71305_c = new WorldServer[3]; - this.field_71312_k = new long[this.field_71305_c.length][100]; ISaveHandler isavehandler = this.func_71254_M().func_75804_a(p_71247_1_, true); + this.func_175584_a(this.func_71270_I(), isavehandler); + WorldInfo worldinfo = isavehandler.func_75757_d(); +@@ -88,45 +86,25 @@ + { + worldinfo.func_76062_a(p_71247_2_); + } ++ WorldServer overWorld = (func_71242_L() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.field_71304_b)).func_175643_b() : ++ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.field_71304_b)).func_175643_b()); ++ overWorld.func_72963_a(this.field_71350_m); - for (int j = 0; j < this.field_71305_c.length; ++j) -+ WorldServer overWorld = (func_71242_L() ? new DemoWorldServer(this, isavehandler, p_71247_2_, 0, field_71304_b) : new WorldServer(this, isavehandler, p_71247_2_, 0, field_71350_m, field_71304_b)); -+ for (int dim : DimensionManager.getStaticDimensionIDs()) ++ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) { - byte b0 = 0; -+ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, isavehandler, p_71247_2_, dim, field_71350_m, overWorld, field_71304_b)); -+ world.func_72954_a(new WorldManager(this, world)); - if (j == 1) ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.field_71304_b)).func_175643_b()); ++ world.func_72954_a(new WorldManager(this, world)); + if (!this.func_71264_H()) { - b0 = -1; + world.func_72912_H().func_76060_a(func_71265_f()); } - +- - if (j == 2) - { - b0 = 1; @@ -42,24 +40,29 @@ - { - if (this.func_71242_L()) - { -- this.field_71305_c[j] = new DemoWorldServer(this, isavehandler, p_71247_2_, b0, this.field_71304_b); +- this.field_71305_c[j] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.field_71304_b)).func_175643_b(); - } - else - { -- this.field_71305_c[j] = new WorldServer(this, isavehandler, p_71247_2_, b0, this.field_71350_m, this.field_71304_b); +- this.field_71305_c[j] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, b0, this.field_71304_b)).func_175643_b(); - } +- +- this.field_71305_c[j].func_72963_a(this.field_71350_m); - } - else - { -- this.field_71305_c[j] = new WorldServerMulti(this, isavehandler, p_71247_2_, b0, this.field_71350_m, this.field_71305_c[0], this.field_71304_b); +- this.field_71305_c[j] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.field_71305_c[0], this.field_71304_b)).func_175643_b(); - } - - this.field_71305_c[j].func_72954_a(new WorldManager(this, this.field_71305_c[j])); -- this.func_71203_ab().func_72364_a(this.field_71305_c); -+ MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); } +- this.func_71203_ab().func_72364_a(this.field_71305_c); + this.func_71203_ab().func_72364_a(new WorldServer[]{ overWorld }); - this.func_147139_a(this.func_147135_j()); - this.func_71222_d(); - } + +- if (this.field_71305_c[0].func_72912_H().func_176130_y() == null) ++ if (overWorld.func_72912_H().func_176130_y() == null) + { + this.func_147139_a(this.field_71349_l.field_71474_y.field_74318_M); + } diff --git a/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch index 0ab15349bf..e6f9ccfe84 100644 --- a/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch @@ -1,21 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/management/ItemInWorldManager.java +++ ../src-work/minecraft/net/minecraft/server/management/ItemInWorldManager.java -@@ -7,12 +7,23 @@ - import net.minecraft.item.ItemStack; - import net.minecraft.item.ItemSword; - import net.minecraft.network.play.server.S23PacketBlockChange; -+import net.minecraft.tileentity.TileEntity; - import net.minecraft.world.World; - import net.minecraft.world.WorldServer; - import net.minecraft.world.WorldSettings; -+import net.minecraftforge.common.ForgeHooks; -+import net.minecraftforge.common.MinecraftForge; -+import cpw.mods.fml.common.eventhandler.Event; -+import net.minecraftforge.event.ForgeEventFactory; -+import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; -+import net.minecraftforge.event.entity.player.PlayerInteractEvent; -+import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; -+import net.minecraftforge.event.world.BlockEvent; +@@ -22,6 +22,8 @@ public class ItemInWorldManager { @@ -24,225 +9,239 @@ public World field_73092_a; public EntityPlayerMP field_73090_b; private WorldSettings.GameType field_73091_c; -@@ -126,6 +137,13 @@ +@@ -137,6 +139,14 @@ + + public void func_180784_a(BlockPos p_180784_1_, EnumFacing p_180784_2_) { - if (!this.field_73091_c.func_82752_c() || this.field_73090_b.func_82246_f(p_73074_1_, p_73074_2_, p_73074_3_)) ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_73090_b, ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, field_73092_a, p_180784_1_, p_180784_2_); ++ if (event.isCanceled()) ++ { ++ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180784_1_)); ++ return; ++ } ++ + if (this.func_73083_d()) { -+ PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(field_73090_b, Action.LEFT_CLICK_BLOCK, p_73074_1_, p_73074_2_, p_73074_3_, p_73074_4_, field_73092_a); -+ if (event.isCanceled()) -+ { -+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(p_73074_1_, p_73074_2_, p_73074_3_, field_73092_a)); + if (!this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_)) +@@ -171,18 +181,35 @@ + } + } + +- this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); ++ // + this.field_73089_e = this.field_73100_i; + float f = 1.0F; + +- if (block.func_149688_o() != Material.field_151579_a) ++ if (!block.isAir(field_73092_a, p_180784_1_)) + { +- block.func_180649_a(this.field_73092_a, p_180784_1_, this.field_73090_b); ++ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ block.func_180649_a(this.field_73092_a, p_180784_1_, this.field_73090_b); ++ this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); ++ } ++ else ++ { ++ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180784_1_)); ++ } + f = block.func_180647_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180784_1_); + } + +- if (block.func_149688_o() != Material.field_151579_a && f >= 1.0F) ++ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { ++ if (f >= 1.0F) ++ { ++ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180784_1_)); ++ } + return; + } + - if (this.func_73083_d()) - { - if (!this.field_73092_a.func_72886_a((EntityPlayer)null, p_73074_1_, p_73074_2_, p_73074_3_, p_73074_4_)) -@@ -135,19 +153,36 @@ ++ if (block.isAir(field_73092_a, p_180784_1_) && f >= 1.0F) ++ { + this.func_180237_b(p_180784_1_); } else - { -- this.field_73092_a.func_72886_a((EntityPlayer)null, p_73074_1_, p_73074_2_, p_73074_3_, p_73074_4_); - this.field_73089_e = this.field_73100_i; - float f = 1.0F; - Block block = this.field_73092_a.func_147439_a(p_73074_1_, p_73074_2_, p_73074_3_); - -- if (block.func_149688_o() != Material.field_151579_a) -+ -+ if (!block.isAir(field_73092_a, p_73074_1_, p_73074_2_, p_73074_3_)) - { -- block.func_149699_a(this.field_73092_a, p_73074_1_, p_73074_2_, p_73074_3_, this.field_73090_b); -- f = block.func_149737_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_73074_1_, p_73074_2_, p_73074_3_); -+ if (event.useBlock != Event.Result.DENY) -+ { -+ block.func_149699_a(field_73092_a, p_73074_1_, p_73074_2_, p_73074_3_, field_73090_b); -+ field_73092_a.func_72886_a(null, p_73074_1_, p_73074_2_, p_73074_3_, p_73074_4_); -+ } -+ else -+ { -+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(p_73074_1_, p_73074_2_, p_73074_3_, field_73092_a)); -+ } -+ f = block.func_149737_a(field_73090_b, field_73090_b.field_70170_p, p_73074_1_, p_73074_2_, p_73074_3_); - } - -- if (block.func_149688_o() != Material.field_151579_a && f >= 1.0F) -+ if (event.useItem == Event.Result.DENY) - { -+ if (f >= 1.0f) -+ { -+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(p_73074_1_, p_73074_2_, p_73074_3_, field_73092_a)); -+ } -+ return; -+ } -+ -+ if (!block.isAir(field_73092_a, p_73074_1_, p_73074_2_, p_73074_3_) && f >= 1.0F) -+ { - this.func_73084_b(p_73074_1_, p_73074_2_, p_73074_3_); - } - else -@@ -171,7 +206,7 @@ - int l = this.field_73100_i - this.field_73089_e; - Block block = this.field_73092_a.func_147439_a(p_73082_1_, p_73082_2_, p_73082_3_); +@@ -203,7 +230,7 @@ + int i = this.field_73100_i - this.field_73089_e; + Block block = this.field_73092_a.func_180495_p(p_180785_1_).func_177230_c(); - if (block.func_149688_o() != Material.field_151579_a) -+ if (!block.isAir(field_73092_a, p_73082_1_, p_73082_2_, p_73082_3_)) ++ if (block.isAir(field_73092_a, p_180785_1_)) { - float f = block.func_149737_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_73082_1_, p_73082_2_, p_73082_3_) * (float)(l + 1); + float f = block.func_180647_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180785_1_) * (float)(i + 1); -@@ -202,10 +237,14 @@ +@@ -232,9 +259,13 @@ - private boolean func_73079_d(int p_73079_1_, int p_73079_2_, int p_73079_3_) + private boolean func_180235_c(BlockPos p_180235_1_) { -+ return removeBlock(p_73079_1_, p_73079_2_, p_73079_3_, false); ++ return removeBlock(p_180235_1_, false); + } -+ private boolean removeBlock(int p_73079_1_, int p_73079_2_, int p_73079_3_, boolean canHarvest) ++ private boolean removeBlock(BlockPos p_180235_1_, boolean canHarvest) + { - Block block = this.field_73092_a.func_147439_a(p_73079_1_, p_73079_2_, p_73079_3_); - int l = this.field_73092_a.func_72805_g(p_73079_1_, p_73079_2_, p_73079_3_); - block.func_149681_a(this.field_73092_a, p_73079_1_, p_73079_2_, p_73079_3_, l, this.field_73090_b); -- boolean flag = this.field_73092_a.func_147468_f(p_73079_1_, p_73079_2_, p_73079_3_); -+ boolean flag = block.removedByPlayer(field_73092_a, field_73090_b, p_73079_1_, p_73079_2_, p_73079_3_, canHarvest); + IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180235_1_); + iblockstate.func_177230_c().func_176208_a(this.field_73092_a, p_180235_1_, iblockstate, this.field_73090_b); +- boolean flag = this.field_73092_a.func_175698_g(p_180235_1_); ++ boolean flag = iblockstate.func_177230_c().removedByPlayer(field_73092_a, p_180235_1_, field_73090_b, canHarvest); if (flag) { -@@ -217,29 +256,32 @@ +@@ -246,7 +277,8 @@ - public boolean func_73084_b(int p_73084_1_, int p_73084_2_, int p_73084_3_) + public boolean func_180237_b(BlockPos p_180237_1_) { -- if (this.field_73091_c.func_82752_c() && !this.field_73090_b.func_82246_f(p_73084_1_, p_73084_2_, p_73084_3_)) -+ BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(field_73092_a, field_73091_c, field_73090_b, p_73084_1_, p_73084_2_, p_73084_3_); -+ if (event.isCanceled()) +- if (this.field_73091_c.func_77145_d() && this.field_73090_b.func_70694_bm() != null && this.field_73090_b.func_70694_bm().func_77973_b() instanceof ItemSword) ++ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(field_73092_a, field_73091_c, field_73090_b, p_180237_1_); ++ if (exp == -1) { return false; } -- else if (this.field_73091_c.func_77145_d() && this.field_73090_b.func_70694_bm() != null && this.field_73090_b.func_70694_bm().func_77973_b() instanceof ItemSword) -- { -- return false; -- } - else - { +@@ -255,40 +287,21 @@ + IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180237_1_); + TileEntity tileentity = this.field_73092_a.func_175625_s(p_180237_1_); + +- if (this.field_73091_c.func_82752_c()) +- { +- if (this.field_73091_c == WorldSettings.GameType.SPECTATOR) +- { +- return false; +- } + ItemStack stack = field_73090_b.func_71045_bC(); -+ if (stack != null && stack.func_77973_b().onBlockStartBreak(stack, p_73084_1_, p_73084_2_, p_73084_3_, field_73090_b)) -+ { -+ return false; -+ } - Block block = this.field_73092_a.func_147439_a(p_73084_1_, p_73084_2_, p_73084_3_); - int l = this.field_73092_a.func_72805_g(p_73084_1_, p_73084_2_, p_73084_3_); - this.field_73092_a.func_72889_a(this.field_73090_b, 2001, p_73084_1_, p_73084_2_, p_73084_3_, Block.func_149682_b(block) + (this.field_73092_a.func_72805_g(p_73084_1_, p_73084_2_, p_73084_3_) << 12)); -- boolean flag = this.func_73079_d(p_73084_1_, p_73084_2_, p_73084_3_); -+ boolean flag = false; ++ if (stack != null && stack.func_77973_b().onBlockStartBreak(stack, p_180237_1_, field_73090_b)) return false; + +- if (!this.field_73090_b.func_175142_cm()) +- { +- ItemStack itemstack = this.field_73090_b.func_71045_bC(); +- +- if (itemstack == null) +- { +- return false; +- } +- +- if (!itemstack.func_179544_c(iblockstate.func_177230_c())) +- { +- return false; +- } +- } +- } +- + this.field_73092_a.func_180498_a(this.field_73090_b, 2001, p_180237_1_, Block.func_176210_f(iblockstate)); +- boolean flag1 = this.func_180235_c(p_180237_1_); ++ boolean flag1 = false; if (this.func_73083_d()) { -+ flag = this.func_73079_d(p_73084_1_, p_73084_2_, p_73084_3_); - this.field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(p_73084_1_, p_73084_2_, p_73084_3_, this.field_73092_a)); ++ flag1 = this.func_180235_c(p_180237_1_); + this.field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(this.field_73092_a, p_180237_1_)); } else { - ItemStack itemstack = this.field_73090_b.func_71045_bC(); -- boolean flag1 = this.field_73090_b.func_146099_a(block); -+ boolean flag1 = block.canHarvestBlock(field_73090_b, l); + ItemStack itemstack1 = this.field_73090_b.func_71045_bC(); +- boolean flag = this.field_73090_b.func_146099_a(iblockstate.func_177230_c()); ++ boolean flag = iblockstate.func_177230_c().canHarvestBlock(field_73092_a, p_180237_1_, field_73090_b); - if (itemstack != null) + if (itemstack1 != null) { -@@ -251,12 +293,18 @@ +@@ -300,12 +313,18 @@ } } -+ flag = this.removeBlock(p_73084_1_, p_73084_2_, p_73084_3_, flag1); - if (flag && flag1) ++ flag1 = this.removeBlock(p_180237_1_, flag); + if (flag1 && flag) { - block.func_149636_a(this.field_73092_a, this.field_73090_b, p_73084_1_, p_73084_2_, p_73084_3_, l); + iblockstate.func_177230_c().func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, iblockstate, tileentity); } } -+ // Drop experience -+ if (!this.func_73083_d() && flag && event != null) ++ // Drop experiance ++ if (!this.func_73083_d() && flag1 && exp > 0) + { -+ block.func_149657_c(this.field_73092_a, p_73084_1_, p_73084_2_, p_73084_3_, event.getExpToDrop()); ++ iblockstate.func_177230_c().func_180637_b(field_73092_a, p_180237_1_, exp); + } - return flag; + return flag1; } } -@@ -288,6 +336,7 @@ - if (itemstack1.field_77994_a == 0) +@@ -343,6 +362,7 @@ + if (itemstack1.field_77994_a == 0) + { + p_73085_1_.field_71071_by.field_70462_a[p_73085_1_.field_71071_by.field_70461_c] = null; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_73085_1_, itemstack1); + } + + if (!p_73085_1_.func_71039_bw()) +@@ -387,33 +407,51 @@ + } + else + { +- if (!p_180236_1_.func_70093_af() || p_180236_1_.func_70694_bm() == null) ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(p_180236_1_, ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, p_180236_2_, p_180236_4_, p_180236_5_); ++ if (event.isCanceled()) { - p_73085_1_.field_71071_by.field_70462_a[p_73085_1_.field_71071_by.field_70461_c] = null; -+ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(field_73090_b, itemstack1)); +- IBlockState iblockstate = p_180236_2_.func_180495_p(p_180236_4_); +- +- if (iblockstate.func_177230_c().func_180639_a(p_180236_2_, p_180236_4_, iblockstate, p_180236_1_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_)) +- { +- return true; +- } ++ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180236_4_)); ++ return false; } - if (!p_73085_1_.func_71039_bw()) -@@ -301,31 +350,70 @@ - - public boolean func_73078_a(EntityPlayer p_73078_1_, World p_73078_2_, ItemStack p_73078_3_, int p_73078_4_, int p_73078_5_, int p_73078_6_, int p_73078_7_, float p_73078_8_, float p_73078_9_, float p_73078_10_) - { -- if ((!p_73078_1_.func_70093_af() || p_73078_1_.func_70694_bm() == null) && p_73078_2_.func_147439_a(p_73078_4_, p_73078_5_, p_73078_6_).func_149727_a(p_73078_2_, p_73078_4_, p_73078_5_, p_73078_6_, p_73078_1_, p_73078_7_, p_73078_8_, p_73078_9_, p_73078_10_)) -+ PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(p_73078_1_, Action.RIGHT_CLICK_BLOCK, p_73078_4_, p_73078_5_, p_73078_6_, p_73078_7_, p_73078_2_); -+ if (event.isCanceled()) - { -- return true; -+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(p_73078_4_, p_73078_5_, p_73078_6_, field_73092_a)); -+ return false; +- if (p_180236_3_ == null) ++ if (p_180236_3_ != null && p_180236_3_.func_77973_b().onItemUseFirst(p_180236_3_, p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_)) + { +- return false; ++ if (p_180236_3_.field_77994_a <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(field_73090_b, p_180236_3_); ++ return true; + } +- else if (this.func_73083_d()) ++ ++ IBlockState iblockstate = p_180236_2_.func_180495_p(p_180236_4_); ++ boolean isAir = p_180236_2_.func_175623_d(p_180236_4_); ++ boolean useBlock = !p_180236_1_.func_70093_af() || p_180236_1_.func_70694_bm() == null; ++ if (!useBlock) useBlock = p_180236_1_.func_70694_bm().func_77973_b().doesSneakBypassUse(p_180236_2_, p_180236_4_, p_180236_1_); ++ boolean result = false; ++ ++ if (useBlock) + { +- int j = p_180236_3_.func_77960_j(); +- int i = p_180236_3_.field_77994_a; +- boolean flag = p_180236_3_.func_179546_a(p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); +- p_180236_3_.func_77964_b(j); +- p_180236_3_.field_77994_a = i; +- return flag; ++ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ result = iblockstate.func_177230_c().func_180639_a(p_180236_2_, p_180236_4_, iblockstate, p_180236_1_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); ++ } ++ else ++ { ++ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180236_4_)); ++ result = event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW; ++ } + } +- else ++ if (p_180236_3_ != null && !result && event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { +- return p_180236_3_.func_179546_a(p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); ++ int meta = p_180236_3_.func_77960_j(); ++ int size = p_180236_3_.field_77994_a; ++ result = p_180236_3_.func_179546_a(p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); ++ if (func_73083_d()) ++ { ++ p_180236_3_.func_77964_b(meta); ++ p_180236_3_.field_77994_a = size; ++ } ++ if (p_180236_3_.field_77994_a <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(field_73090_b, p_180236_3_); + } ++ return result; } -- else if (p_73078_3_ == null) -+ -+ if (p_73078_3_ != null && p_73078_3_.func_77973_b().onItemUseFirst(p_73078_3_, p_73078_1_, p_73078_2_, p_73078_4_, p_73078_5_, p_73078_6_, p_73078_7_, p_73078_8_, p_73078_9_, p_73078_10_)) - { -- return false; -+ if (p_73078_3_.field_77994_a <= 0) ForgeEventFactory.onPlayerDestroyItem(field_73090_b, p_73078_3_); -+ return true; - } -- else if (this.func_73083_d()) -+ -+ Block block = p_73078_2_.func_147439_a(p_73078_4_, p_73078_5_, p_73078_6_); -+ boolean isAir = block.isAir(p_73078_2_, p_73078_4_, p_73078_5_, p_73078_6_); -+ boolean useBlock = !p_73078_1_.func_70093_af() || p_73078_1_.func_70694_bm() == null; -+ if (!useBlock) useBlock = p_73078_1_.func_70694_bm().func_77973_b().doesSneakBypassUse(p_73078_2_, p_73078_4_, p_73078_5_, p_73078_6_, p_73078_1_); -+ boolean result = false; -+ -+ if (useBlock) - { -- int i1 = p_73078_3_.func_77960_j(); -- int j1 = p_73078_3_.field_77994_a; -- boolean flag = p_73078_3_.func_77943_a(p_73078_1_, p_73078_2_, p_73078_4_, p_73078_5_, p_73078_6_, p_73078_7_, p_73078_8_, p_73078_9_, p_73078_10_); -- p_73078_3_.func_77964_b(i1); -- p_73078_3_.field_77994_a = j1; -- return flag; -+ if (event.useBlock != Event.Result.DENY) -+ { -+ result = block.func_149727_a(p_73078_2_, p_73078_4_, p_73078_5_, p_73078_6_, p_73078_1_, p_73078_7_, p_73078_8_, p_73078_9_, p_73078_10_); -+ } -+ else -+ { -+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(p_73078_4_, p_73078_5_, p_73078_6_, field_73092_a)); -+ result = event.useItem != Event.Result.ALLOW; -+ } - } -- else -+ -+ if (p_73078_3_ != null && !result && event.useItem != Event.Result.DENY) - { -- return p_73078_3_.func_77943_a(p_73078_1_, p_73078_2_, p_73078_4_, p_73078_5_, p_73078_6_, p_73078_7_, p_73078_8_, p_73078_9_, p_73078_10_); -+ int meta = p_73078_3_.func_77960_j(); -+ int size = p_73078_3_.field_77994_a; -+ result = p_73078_3_.func_77943_a(p_73078_1_, p_73078_2_, p_73078_4_, p_73078_5_, p_73078_6_, p_73078_7_, p_73078_8_, p_73078_9_, p_73078_10_); -+ if (func_73083_d()) -+ { -+ p_73078_3_.func_77964_b(meta); -+ p_73078_3_.field_77994_a = size; -+ } -+ if (p_73078_3_.field_77994_a <= 0) ForgeEventFactory.onPlayerDestroyItem(field_73090_b, p_73078_3_); - } -+ -+ /* Re-enable if this causes bukkit incompatibility, or re-write client side to only send a single packet per right click. -+ if (par3ItemStack != null && ((!result && event.useItem != Event.Result.DENY) || event.useItem == Event.Result.ALLOW)) -+ { -+ this.tryUseItem(thisPlayerMP, par2World, par3ItemStack); -+ }*/ -+ return result; } - public void func_73080_a(WorldServer p_73080_1_) +@@ -421,4 +459,13 @@ { this.field_73092_a = p_73080_1_; } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch index b2ae9a0a2c..1399c4384b 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java +++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java -@@ -120,15 +120,24 @@ +@@ -122,15 +122,24 @@ int j = (int)p_72683_1_.field_70161_v >> 4; p_72683_1_.field_71131_d = p_72683_1_.field_70165_t; p_72683_1_.field_71132_e = p_72683_1_.field_70161_v; @@ -26,7 +26,7 @@ this.field_72699_b.add(p_72683_1_); this.func_72691_b(p_72683_1_); } -@@ -230,6 +239,7 @@ +@@ -232,6 +241,7 @@ int i1 = this.field_72698_e; int j1 = i - k; int k1 = j - l; @@ -34,7 +34,7 @@ if (j1 != 0 || k1 != 0) { -@@ -239,7 +249,7 @@ +@@ -241,7 +251,7 @@ { if (!this.func_72684_a(l1, i2, k, l, i1)) { @@ -43,7 +43,7 @@ } if (!this.func_72684_a(l1 - j1, i2 - k1, i, j, i1)) -@@ -257,6 +267,18 @@ +@@ -259,6 +269,18 @@ this.func_72691_b(p_72685_1_); p_72685_1_.field_71131_d = p_72685_1_.field_70165_t; p_72685_1_.field_71132_e = p_72685_1_.field_70161_v; @@ -62,7 +62,7 @@ } } } -@@ -331,15 +353,24 @@ +@@ -334,12 +356,21 @@ private int field_73262_e; private int field_73260_f; private long field_111198_g; @@ -81,43 +81,36 @@ { this.field_73264_c = new ChunkCoordIntPair(p_i1518_2_, p_i1518_3_); - PlayerManager.this.func_72688_a().field_73059_b.func_73158_c(p_i1518_2_, p_i1518_3_); -+ PlayerManager.this.field_72701_a.field_73059_b.loadChunk(p_i1518_2_, p_i1518_3_, this.loadedRunnable); ++ PlayerManager.this.func_72688_a().field_73059_b.loadChunk(p_i1518_2_, p_i1518_3_, this.loadedRunnable); } -- public void func_73255_a(EntityPlayerMP p_73255_1_) -+ public void func_73255_a(final EntityPlayerMP p_73255_1_) - { - if (this.field_73263_b.contains(p_73255_1_)) - { -@@ -353,7 +384,26 @@ + public void func_73255_a(EntityPlayerMP p_73255_1_) +@@ -356,7 +387,24 @@ } this.field_73263_b.add(p_73255_1_); -- p_73255_1_.field_71129_f.add(this.field_73264_c); -+ Runnable playerRunnable; -+ ++ Runnable playerRunnable = null; + if (this.loaded) + { -+ playerRunnable = null; -+ p_73255_1_.field_71129_f.add(this.field_73264_c); + p_73255_1_.field_71129_f.add(this.field_73264_c); + } + else + { ++ final EntityPlayerMP tmp = p_73255_1_; + playerRunnable = new Runnable() + { + public void run() + { -+ p_73255_1_.field_71129_f.add(PlayerInstance.this.field_73264_c); ++ tmp.field_71129_f.add(PlayerInstance.this.field_73264_c); + } + }; + PlayerManager.this.func_72688_a().field_73059_b.loadChunk(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b, playerRunnable); + } -+ + this.players.put(p_73255_1_, playerRunnable); } } -@@ -361,6 +411,24 @@ +@@ -364,6 +412,24 @@ { if (this.field_73263_b.contains(p_73252_1_)) { @@ -142,7 +135,7 @@ Chunk chunk = PlayerManager.this.field_72701_a.func_72964_e(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b); if (chunk.func_150802_k()) -@@ -368,9 +436,12 @@ +@@ -371,9 +437,12 @@ p_73252_1_.field_71135_a.func_147359_a(new S21PacketChunkData(chunk, true, 0)); } @@ -155,16 +148,16 @@ if (this.field_73263_b.isEmpty()) { long i = (long)this.field_73264_c.field_77276_a + 2147483647L | (long)this.field_73264_c.field_77275_b + 2147483647L << 32; -@@ -408,7 +479,7 @@ +@@ -411,7 +480,7 @@ this.field_73260_f |= 1 << (p_151253_2_ >> 4); - if (this.field_73262_e < 64) -+ //if (this.numberOfTilesToUpdate < 64) //Forge; Cache everything, so always run ++ //Forge; Cache everything, so always run { short short1 = (short)(p_151253_1_ << 12 | p_151253_3_ << 8 | p_151253_2_); -@@ -420,6 +491,10 @@ +@@ -423,6 +492,10 @@ } } @@ -175,7 +168,7 @@ this.field_151254_d[this.field_73262_e++] = short1; } } -@@ -437,6 +512,7 @@ +@@ -440,6 +513,7 @@ } } @@ -183,18 +176,18 @@ public void func_73254_a() { if (this.field_73262_e != 0) -@@ -452,7 +528,7 @@ - k = this.field_73264_c.field_77275_b * 16 + (this.field_151254_d[0] >> 8 & 15); - this.func_151251_a(new S23PacketBlockChange(i, j, k, PlayerManager.this.field_72701_a)); +@@ -456,7 +530,7 @@ + BlockPos blockpos = new BlockPos(i, j, k); + this.func_151251_a(new S23PacketBlockChange(PlayerManager.this.field_72701_a, blockpos)); -- if (PlayerManager.this.field_72701_a.func_147439_a(i, j, k).func_149716_u()) -+ if (PlayerManager.this.field_72701_a.func_147439_a(i, j, k).hasTileEntity(PlayerManager.this.field_72701_a.func_72805_g(i, j, k))) +- if (PlayerManager.this.field_72701_a.func_180495_p(blockpos).func_177230_c().func_149716_u()) ++ if (PlayerManager.this.field_72701_a.func_180495_p(blockpos).func_177230_c().hasTileEntity(PlayerManager.this.field_72701_a.func_180495_p(blockpos))) { - this.func_151252_a(PlayerManager.this.field_72701_a.func_147438_o(i, j, k)); + this.func_151252_a(PlayerManager.this.field_72701_a.func_175625_s(blockpos)); } -@@ -461,13 +537,14 @@ +@@ -465,13 +539,14 @@ { - int l; + int i1; - if (this.field_73262_e == 64) + if (this.field_73262_e == net.minecraftforge.common.ForgeModContainer.clumpingThreshold) @@ -209,23 +202,23 @@ { if ((this.field_73260_f & 1 << k) != 0) { -@@ -484,14 +561,17 @@ +@@ -488,7 +563,10 @@ else { this.func_151251_a(new S22PacketMultiBlockChange(this.field_73262_e, this.field_151254_d, PlayerManager.this.field_72701_a.func_72964_e(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b))); -- + } -+ + + { //Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small + WorldServer world = PlayerManager.this.field_72701_a; for (i = 0; i < this.field_73262_e; ++i) { - j = this.field_73264_c.field_77276_a * 16 + (this.field_151254_d[i] >> 12 & 15); - k = this.field_151254_d[i] & 255; - l = this.field_73264_c.field_77275_b * 16 + (this.field_151254_d[i] >> 8 & 15); + j = (this.field_151254_d[i] >> 12 & 15) + this.field_73264_c.field_77276_a * 16; +@@ -496,7 +574,7 @@ + i1 = (this.field_151254_d[i] >> 8 & 15) + this.field_73264_c.field_77275_b * 16; + BlockPos blockpos1 = new BlockPos(j, k, i1); -- if (PlayerManager.this.field_72701_a.func_147439_a(j, k, l).func_149716_u()) -+ if (world.func_147439_a(j, k, l).hasTileEntity(world.func_72805_g(j, k, l))) +- if (PlayerManager.this.field_72701_a.func_180495_p(blockpos1).func_177230_c().func_149716_u()) ++ if (world.func_180495_p(blockpos1).func_177230_c().hasTileEntity(world.func_180495_p(blockpos1))) { - this.func_151252_a(PlayerManager.this.field_72701_a.func_147438_o(j, k, l)); + this.func_151252_a(PlayerManager.this.field_72701_a.func_175625_s(blockpos1)); } diff --git a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch index 4c5b20d916..cdab17b173 100644 --- a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -1,41 +1,24 @@ --- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java +++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java -@@ -55,11 +55,15 @@ - import net.minecraft.util.EnumChatFormatting; - import net.minecraft.util.IChatComponent; - import net.minecraft.util.MathHelper; -+import net.minecraft.world.Teleporter; - import net.minecraft.world.World; -+import net.minecraft.world.WorldProvider; - import net.minecraft.world.WorldServer; - import net.minecraft.world.WorldSettings; - import net.minecraft.world.demo.DemoWorldManager; - import net.minecraft.world.storage.IPlayerFileData; -+import net.minecraftforge.common.chunkio.ChunkIOExecutor; -+ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -@@ -108,7 +112,17 @@ - String s = gameprofile1 == null ? gameprofile.getName() : gameprofile1.getName(); +@@ -112,6 +112,17 @@ playerprofilecache.func_152649_a(gameprofile); NBTTagCompound nbttagcompound = this.func_72380_a(p_72355_2_); -- p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK)); -+ + p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK)); ++ + World playerWorld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); -+ if (playerWorld==null) ++ if (playerWorld == null) + { + p_72355_2_.field_71093_bK=0; + playerWorld=this.field_72400_f.func_71218_a(0); -+ ChunkCoordinates spawnPoint = playerWorld.field_73011_w.getRandomizedSpawnPoint(); -+ p_72355_2_.func_70107_b(spawnPoint.field_71574_a, spawnPoint.field_71572_b, spawnPoint.field_71573_c); ++ BlockPos spawnPoint = playerWorld.field_73011_w.getRandomizedSpawnPoint(); ++ p_72355_2_.func_70107_b(spawnPoint.func_177958_n(), spawnPoint.func_177956_o(), spawnPoint.func_177952_p()); + } -+ ++ + p_72355_2_.func_70029_a(playerWorld); p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p); String s1 = "local"; -@@ -242,6 +256,7 @@ +@@ -273,6 +284,7 @@ p_72380_1_.func_70020_e(nbttagcompound); nbttagcompound1 = nbttagcompound; field_148546_d.debug("loading single player"); @@ -43,23 +26,23 @@ } else { -@@ -269,6 +284,7 @@ - this.func_148540_a(new S38PacketPlayerListItem(p_72377_1_.func_70005_c_(), true, 1000)); - this.field_72404_b.add(p_72377_1_); +@@ -301,6 +313,7 @@ + this.field_177454_f.put(p_72377_1_.func_110124_au(), p_72377_1_); + this.func_148540_a(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {p_72377_1_})); WorldServer worldserver = this.field_72400_f.func_71218_a(p_72377_1_.field_71093_bK); -+ ChunkIOExecutor.adjustPoolSize(this.func_72394_k()); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k()); worldserver.func_72838_d(p_72377_1_); this.func_72375_a(p_72377_1_, (WorldServer)null); -@@ -301,6 +317,7 @@ - worldserver.func_73040_p().func_72695_c(p_72367_1_); +@@ -334,6 +347,7 @@ this.field_72404_b.remove(p_72367_1_); + this.field_177454_f.remove(p_72367_1_.func_110124_au()); this.field_148547_k.remove(p_72367_1_.func_110124_au()); + net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k()); - this.func_148540_a(new S38PacketPlayerListItem(p_72367_1_.func_70005_c_(), false, 9999)); + this.func_148540_a(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {p_72367_1_})); } -@@ -382,13 +399,23 @@ +@@ -415,13 +429,23 @@ public EntityPlayerMP func_72368_a(EntityPlayerMP p_72368_1_, int p_72368_2_, boolean p_72368_3_) { @@ -78,35 +61,35 @@ p_72368_1_.func_71121_q().func_73040_p().func_72695_c(p_72368_1_); this.field_72404_b.remove(p_72368_1_); this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK).func_72973_f(p_72368_1_); -- ChunkCoordinates chunkcoordinates = p_72368_1_.func_70997_bJ(); +- BlockPos blockpos = p_72368_1_.func_180470_cg(); - boolean flag1 = p_72368_1_.func_82245_bX(); -+ ChunkCoordinates chunkcoordinates = p_72368_1_.getBedLocation(p_72368_2_); ++ BlockPos blockpos = p_72368_1_.getBedLocation(p_72368_2_); + boolean flag1 = p_72368_1_.isSpawnForced(p_72368_2_); p_72368_1_.field_71093_bK = p_72368_2_; Object object; -@@ -404,6 +431,7 @@ +@@ -437,6 +461,7 @@ EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), (ItemInWorldManager)object); entityplayermp1.field_71135_a = p_72368_1_.field_71135_a; entityplayermp1.func_71049_a(p_72368_1_, p_72368_3_); + entityplayermp1.field_71093_bK = p_72368_2_; entityplayermp1.func_145769_d(p_72368_1_.func_145782_y()); + entityplayermp1.func_174817_o(p_72368_1_); WorldServer worldserver = this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK); - this.func_72381_a(entityplayermp1, p_72368_1_, worldserver); -@@ -448,6 +476,11 @@ +@@ -483,6 +508,11 @@ public void func_72356_a(EntityPlayerMP p_72356_1_, int p_72356_2_) { + transferPlayerToDimension(p_72356_1_, p_72356_2_, field_72400_f.func_71218_a(p_72356_2_).func_85176_s()); + } + -+ public void transferPlayerToDimension(EntityPlayerMP p_72356_1_, int p_72356_2_, Teleporter teleporter) ++ public void transferPlayerToDimension(EntityPlayerMP p_72356_1_, int p_72356_2_, net.minecraft.world.Teleporter teleporter) + { int j = p_72356_1_.field_71093_bK; WorldServer worldserver = this.field_72400_f.func_71218_a(p_72356_1_.field_71093_bK); p_72356_1_.field_71093_bK = p_72356_2_; -@@ -455,7 +488,7 @@ - p_72356_1_.field_71135_a.func_147359_a(new S07PacketRespawn(p_72356_1_.field_71093_bK, p_72356_1_.field_70170_p.field_73013_u, p_72356_1_.field_70170_p.func_72912_H().func_76067_t(), p_72356_1_.field_71134_c.func_73081_b())); +@@ -490,7 +520,7 @@ + p_72356_1_.field_71135_a.func_147359_a(new S07PacketRespawn(p_72356_1_.field_71093_bK, p_72356_1_.field_70170_p.func_175659_aa(), p_72356_1_.field_70170_p.func_72912_H().func_76067_t(), p_72356_1_.field_71134_c.func_73081_b())); worldserver.func_72973_f(p_72356_1_); p_72356_1_.field_70128_L = false; - this.func_82448_a(p_72356_1_, j, worldserver, worldserver1); @@ -114,72 +97,57 @@ this.func_72375_a(p_72356_1_, worldserver); p_72356_1_.field_71135_a.func_147364_a(p_72356_1_.field_70165_t, p_72356_1_.field_70163_u, p_72356_1_.field_70161_v, p_72356_1_.field_70177_z, p_72356_1_.field_70125_A); p_72356_1_.field_71134_c.func_73080_a(worldserver1); -@@ -473,38 +506,47 @@ +@@ -508,13 +538,22 @@ public void func_82448_a(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) { - double d0 = p_82448_1_.field_70165_t; - double d1 = p_82448_1_.field_70161_v; -- double d2 = 8.0D; + transferEntityToWorld(p_82448_1_, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.func_85176_s()); + } + -+ public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, Teleporter teleporter) ++ @SuppressWarnings("unused") ++ public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) + { -+ WorldProvider pOld = p_82448_3_.field_73011_w; -+ WorldProvider pNew = p_82448_4_.field_73011_w; ++ net.minecraft.world.WorldProvider pOld = p_82448_3_.field_73011_w; ++ net.minecraft.world.WorldProvider pNew = p_82448_4_.field_73011_w; + double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); + double d0 = p_82448_1_.field_70165_t * moveFactor; + double d1 = p_82448_1_.field_70161_v * moveFactor; - double d3 = p_82448_1_.field_70165_t; - double d4 = p_82448_1_.field_70163_u; - double d5 = p_82448_1_.field_70161_v; + double d2 = 8.0D; float f = p_82448_1_.field_70177_z; p_82448_3_.field_72984_F.func_76320_a("moving"); - if (p_82448_1_.field_71093_bK == -1) -+ /* -+ if (par1Entity.dimension == -1) ++ if (false && p_82448_1_.field_71093_bK == -1) //Forge Kill it but dont comment out so we can rename it. { - d0 /= d2; - d1 /= d2; -- p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); -+ par1Entity.setLocationAndAngles(d0, par1Entity.posY, d1, par1Entity.rotationYaw, par1Entity.rotationPitch); - -- if (p_82448_1_.func_70089_S()) -+ if (par1Entity.isEntityAlive()) - { -- p_82448_3_.func_72866_a(p_82448_1_, false); -+ par3WorldServer.updateEntityWithOptionalForce(par1Entity, false); + d0 = MathHelper.func_151237_a(d0 / d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); + d1 = MathHelper.func_151237_a(d1 / d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); +@@ -525,7 +564,7 @@ + p_82448_3_.func_72866_a(p_82448_1_, false); } } - else if (p_82448_1_.field_71093_bK == 0) -+ else if (par1Entity.dimension == 0) ++ else if (false && p_82448_1_.field_71093_bK == 0) //Forge Kill it but dont comment out so we can rename it. { - d0 *= d2; - d1 *= d2; -- p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); -+ par1Entity.setLocationAndAngles(d0, par1Entity.posY, d1, par1Entity.rotationYaw, par1Entity.rotationPitch); - -- if (p_82448_1_.func_70089_S()) -+ if (par1Entity.isEntityAlive()) - { -- p_82448_3_.func_72866_a(p_82448_1_, false); -+ par3WorldServer.updateEntityWithOptionalForce(par1Entity, false); + d0 = MathHelper.func_151237_a(d0 * d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); + d1 = MathHelper.func_151237_a(d1 * d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); +@@ -536,7 +575,8 @@ + p_82448_3_.func_72866_a(p_82448_1_, false); } } - else -+ */ ++ + if (p_82448_1_.field_71093_bK == 1) { - ChunkCoordinates chunkcoordinates; + BlockPos blockpos; -@@ -539,7 +581,7 @@ +@@ -571,7 +611,7 @@ if (p_82448_1_.func_70089_S()) { p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); -- p_82448_4_.func_85176_s().func_77185_a(p_82448_1_, d3, d4, d5, f); -+ teleporter.func_77185_a(p_82448_1_, d3, d4, d5, f); +- p_82448_4_.func_85176_s().func_180266_a(p_82448_1_, f); ++ teleporter.func_180266_a(p_82448_1_, f); p_82448_4_.func_72838_d(p_82448_1_); p_82448_4_.func_72866_a(p_82448_1_, false); } diff --git a/patches/minecraft/net/minecraft/stats/StatList.java.patch b/patches/minecraft/net/minecraft/stats/StatList.java.patch index 206326821c..cadaf39983 100644 --- a/patches/minecraft/net/minecraft/stats/StatList.java.patch +++ b/patches/minecraft/net/minecraft/stats/StatList.java.patch @@ -1,38 +1,43 @@ --- ../src-base/minecraft/net/minecraft/stats/StatList.java +++ ../src-work/minecraft/net/minecraft/stats/StatList.java -@@ -94,7 +94,7 @@ +@@ -101,7 +101,7 @@ if (item != null) { - int i = Item.func_150891_b(item); + int i = Item.func_150891_b(item); //TODO: Hook FML's stat change event and re-assign these - field_75928_D[i] = (new StatCrafting("stat.craftItem." + i, new ChatComponentTranslation("stat.craftItem", new Object[] {(new ItemStack(item)).func_151000_E()}), item)).func_75971_g(); - } - } -@@ -112,7 +112,7 @@ + String s = func_180204_a(item); - if (Item.func_150898_a(block) != null) + if (s != null) +@@ -121,11 +121,11 @@ + while (iterator.hasNext()) + { + Block block = (Block)iterator.next(); +- Item item = Item.func_150898_a(block); ++ Item item = Item.func_150898_a(block); //TODO: Hook FML's stat change event and re-assign these + + if (item != null) { - int i = Block.func_149682_b(block); + int i = Block.func_149682_b(block); //TODO: Hook FML's stat change event and re-assign these + String s = func_180204_a(item); - if (block.func_149652_G()) - { -@@ -135,7 +135,7 @@ + if (s != null && block.func_149652_G()) +@@ -149,7 +149,7 @@ if (item != null) { - int i = Item.func_150891_b(item); + int i = Item.func_150891_b(item); //TODO: Hook FML's stat change event and re-assign these - field_75929_E[i] = (new StatCrafting("stat.useItem." + i, new ChatComponentTranslation("stat.useItem", new Object[] {(new ItemStack(item)).func_151000_E()}), item)).func_75971_g(); + String s = func_180204_a(item); - if (!(item instanceof ItemBlock)) -@@ -158,7 +158,7 @@ + if (s != null) +@@ -177,7 +177,7 @@ if (item != null) { - int i = Item.func_150891_b(item); + int i = Item.func_150891_b(item); //TODO: Hook FML's stat change event and re-assign these + String s = func_180204_a(item); - if (item.func_77645_m()) - { + if (s != null && item.func_77645_m()) diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index 036b33e31b..85b49af4b4 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -1,32 +1,12 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java -@@ -12,7 +12,10 @@ - import net.minecraft.crash.CrashReportCategory; - import net.minecraft.init.Blocks; - import net.minecraft.nbt.NBTTagCompound; -+import net.minecraft.network.NetworkManager; - import net.minecraft.network.Packet; -+import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -+import net.minecraft.util.AxisAlignedBB; - import net.minecraft.world.World; - - import org.apache.logging.log4j.Level; -@@ -278,4 +281,93 @@ - func_145826_a(TileEntityComparator.class, "Comparator"); +@@ -294,4 +294,92 @@ func_145826_a(TileEntityFlowerPot.class, "FlowerPot"); + func_145826_a(TileEntityBanner.class, "Banner"); } + + // -- BEGIN FORGE PATCHES -- + /** -+ * Determines if this TileEntity requires update calls. -+ * @return True if you want updateEntity() to be called, false if not -+ */ -+ public boolean canUpdate() -+ { -+ return true; -+ } -+ -+ /** + * Called when you receive a TileEntityData packet for the location this + * TileEntity is currently in. On the client, the NetworkManager will always + * be the remote server. On the server, it will be whomever is responsible for @@ -35,7 +15,7 @@ + * @param net The NetworkManager the packet originated from + * @param pkt The data packet + */ -+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) ++ public void onDataPacket(net.minecraft.network.NetworkManager net, net.minecraft.network.play.server.S35PacketUpdateTileEntity pkt) + { + } + @@ -51,29 +31,26 @@ + * Called from Chunk.setBlockIDWithMetadata, 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 oldID The old ID of the block + * @param newID The new ID of the block (May be the same) -+ * @param oldMeta The old metadata of the block -+ * @param newMeta The new metadata of the block (May be the same) -+ * @param world Current world -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position + * @return True to remove the old tile entity, false to keep it in tact {and create a new one if the new values specify to} + */ -+ public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z) ++ public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) + { -+ return !isVanilla || (oldBlock != newBlock); ++ return !isVanilla || (oldState != newSate); + } + + public boolean shouldRenderInPass(int pass) + { + return pass == 0; + } ++ + /** + * Sometimes default render bounding box: infinite in scope. Used to control rendering on {@link TileEntitySpecialRenderer}. + */ -+ public static final AxisAlignedBB INFINITE_EXTENT_AABB = AxisAlignedBB.func_72330_a(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); ++ public static final net.minecraft.util.AxisAlignedBB INFINITE_EXTENT_AABB = new net.minecraft.util.AxisAlignedBB(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); + /** + * Return an {@link AxisAlignedBB} that controls the visible scope of a {@link TileEntitySpecialRenderer} associated with this {@link TileEntity} + * Defaults to the collision bounding box {@link Block#getCollisionBoundingBoxFromPool(World, int, int, int)} associated with the block @@ -82,26 +59,37 @@ + * @return an appropriately size {@link AxisAlignedBB} for the {@link TileEntity} + */ + @SideOnly(Side.CLIENT) -+ public AxisAlignedBB getRenderBoundingBox() ++ public net.minecraft.util.AxisAlignedBB getRenderBoundingBox() + { -+ AxisAlignedBB bb = INFINITE_EXTENT_AABB; ++ net.minecraft.util.AxisAlignedBB bb = INFINITE_EXTENT_AABB; + Block type = func_145838_q(); + if (type == Blocks.field_150381_bn) + { -+ bb = AxisAlignedBB.func_72330_a(field_145851_c, field_145848_d, field_145849_e, field_145851_c + 1, field_145848_d + 1, field_145849_e + 1); ++ bb = new net.minecraft.util.AxisAlignedBB(func_174877_v(), func_174877_v().func_177982_a(1, 1, 1)); + } + else if (type == Blocks.field_150486_ae || type == Blocks.field_150447_bR) + { -+ bb = AxisAlignedBB.func_72330_a(field_145851_c - 1, field_145848_d, field_145849_e - 1, field_145851_c + 2, field_145848_d + 2, field_145849_e + 2); ++ bb = new net.minecraft.util.AxisAlignedBB(func_174877_v().func_177982_a(-1, 0, -1), func_174877_v().func_177982_a(2, 2, 2)); + } + else if (type != null && type != Blocks.field_150461_bJ) + { -+ AxisAlignedBB cbb = type.func_149668_a(field_145850_b, field_145851_c, field_145848_d, field_145849_e); -+ if (cbb != null) -+ { -+ bb = cbb; -+ } ++ net.minecraft.util.AxisAlignedBB cbb = type.func_180640_a(field_145850_b, func_174877_v(), field_145850_b.func_180495_p(func_174877_v())); ++ if (cbb != null) bb = cbb; + } + return bb; ++ } ++ ++ /** ++ * Checks if this tile entity knows how to render its 'breaking' overlay effect. ++ * If this returns true, The TileEntitySpecialRenderer will be called again with break progress set. ++ * @return True to re-render tile with breaking effect. ++ */ ++ public boolean canRenderBreaking() ++ { ++ Block block = this.func_145838_q(); ++ return (block instanceof net.minecraft.block.BlockChest || ++ block instanceof net.minecraft.block.BlockEnderChest || ++ block instanceof net.minecraft.block.BlockSign || ++ block instanceof net.minecraft.block.BlockSkull); + } } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch index 6b8861bc89..4796b71dc2 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch @@ -1,19 +1,20 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -@@ -110,7 +110,7 @@ +@@ -178,7 +178,7 @@ { - Block block = this.field_145850_b.func_147439_a(l, k, i1); + Block block = this.field_145850_b.func_180495_p(new BlockPos(l1, k1, j1)).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, l, k, i1, field_145851_c, field_145848_d, field_145849_e)) ++ if (!block.isBeaconBase(this.field_145850_b, new BlockPos(l1, k1, j1), func_174877_v())) { - flag = false; + flag1 = false; break; -@@ -357,6 +357,6 @@ +@@ -363,7 +363,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/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch index 6bd1efdd9b..95c8887557 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -1,15 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java -@@ -12,6 +12,8 @@ - import net.minecraft.nbt.NBTTagCompound; - import net.minecraft.nbt.NBTTagList; - import net.minecraft.potion.PotionHelper; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.brewing.PotionBrewedEvent; - - public class TileEntityBrewingStand extends TileEntity implements ISidedInventory - { -@@ -104,7 +106,7 @@ +@@ -118,7 +118,7 @@ for (int i = 0; i < 3; ++i) { @@ -18,7 +9,7 @@ { int j = this.field_145945_j[i].func_77960_j(); int k = this.func_145936_c(j, itemstack); -@@ -143,7 +145,7 @@ +@@ -157,7 +157,7 @@ for (int i = 0; i < 3; ++i) { @@ -27,7 +18,7 @@ { int j = this.field_145945_j[i].func_77960_j(); int k = this.func_145936_c(j, itemstack); -@@ -164,9 +166,9 @@ +@@ -178,9 +178,9 @@ } } @@ -39,15 +30,15 @@ } else { -@@ -177,6 +179,7 @@ +@@ -191,6 +191,7 @@ this.field_145945_j[3] = null; } } -+ MinecraftForge.EVENT_BUS.post(new PotionBrewedEvent(field_145945_j)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.brewing.PotionBrewedEvent(field_145945_j)); } } -@@ -292,7 +295,7 @@ +@@ -306,7 +307,7 @@ public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) { @@ -55,4 +46,4 @@ + return p_94041_1_ == 3 ? p_94041_2_.func_77973_b().func_150892_m(p_94041_2_) : p_94041_2_.func_77973_b() instanceof ItemPotion || p_94041_2_.func_77973_b() == Items.field_151069_bo; } - @SideOnly(Side.CLIENT) + public boolean[] func_174902_m() diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch index 3ff02a2b5a..7120557067 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java -@@ -219,8 +219,7 @@ +@@ -233,8 +233,7 @@ if (this.field_145957_n[1].field_77994_a == 0) { @@ -10,7 +10,7 @@ } } } -@@ -265,7 +264,11 @@ +@@ -285,7 +284,11 @@ else { ItemStack itemstack = FurnaceRecipes.func_77602_a().func_151395_a(this.field_145957_n[0]); @@ -23,7 +23,7 @@ } } -@@ -281,7 +284,7 @@ +@@ -301,7 +304,7 @@ } else if (this.field_145957_n[2].func_77973_b() == itemstack.func_77973_b()) { @@ -31,4 +31,4 @@ + this.field_145957_n[2].field_77994_a += itemstack.field_77994_a; // Forge BugFix: Results may have multiple items } - --this.field_145957_n[0].field_77994_a; + if (this.field_145957_n[0].func_77973_b() == Item.func_150898_a(Blocks.field_150360_v) && this.field_145957_n[0].func_77960_j() == 1 && this.field_145957_n[1] != null && this.field_145957_n[1].func_77973_b() == Items.field_151133_ar) diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch index 52c0c78d86..2ed4727795 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch @@ -1,39 +1,39 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java -@@ -518,17 +518,30 @@ +@@ -523,17 +523,30 @@ if (itemstack1 == null) { -- p_145899_0_.func_70299_a(p_145899_2_, p_145899_1_); -- p_145899_1_ = null; +- p_174916_0_.func_70299_a(p_174916_2_, p_174916_1_); +- p_174916_1_ = null; + //Forge: BUGFIX: Again, make things respect max stack sizes. -+ int max = Math.min(p_145899_1_.func_77976_d(), p_145899_0_.func_70297_j_()); -+ if (max >= p_145899_1_.field_77994_a) ++ int max = Math.min(p_174916_1_.func_77976_d(), p_174916_0_.func_70297_j_()); ++ if (max >= p_174916_1_.field_77994_a) + { -+ p_145899_0_.func_70299_a(p_145899_2_, p_145899_1_); -+ p_145899_1_ = null; ++ p_174916_0_.func_70299_a(p_174916_2_, p_174916_1_); ++ p_174916_1_ = null; + } + else + { -+ p_145899_0_.func_70299_a(p_145899_2_, p_145899_1_.func_77979_a(max)); ++ p_174916_0_.func_70299_a(p_174916_2_, p_174916_1_.func_77979_a(max)); + } flag = true; } - else if (func_145894_a(itemstack1, p_145899_1_)) + else if (func_145894_a(itemstack1, p_174916_1_)) { -- int k = p_145899_1_.func_77976_d() - itemstack1.field_77994_a; -- int l = Math.min(p_145899_1_.field_77994_a, k); -- p_145899_1_.field_77994_a -= l; -- itemstack1.field_77994_a += l; -- flag = l > 0; +- int j = p_174916_1_.func_77976_d() - itemstack1.field_77994_a; +- int k = Math.min(p_174916_1_.field_77994_a, j); +- p_174916_1_.field_77994_a -= k; +- itemstack1.field_77994_a += k; +- flag = k > 0; + //Forge: BUGFIX: Again, make things respect max stack sizes. -+ int max = Math.min(p_145899_1_.func_77976_d(), p_145899_0_.func_70297_j_()); ++ int max = Math.min(p_174916_1_.func_77976_d(), p_174916_0_.func_70297_j_()); + if (max > itemstack1.field_77994_a) + { -+ int l = Math.min(p_145899_1_.field_77994_a, max - itemstack1.field_77994_a); -+ p_145899_1_.field_77994_a -= l; -+ itemstack1.field_77994_a += l; -+ flag = l > 0; ++ int size = Math.min(p_174916_1_.field_77994_a, max - itemstack1.field_77994_a); ++ p_174916_1_.field_77994_a -= size; ++ itemstack1.field_77994_a += size; ++ flag = size > 0; + } } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch index 908a0d8cb9..0bf432e05c 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityNote.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityNote.java -@@ -35,7 +35,9 @@ +@@ -28,7 +28,9 @@ public void func_145877_a() { diff --git a/patches/minecraft/net/minecraft/util/EnumFacing.java.patch b/patches/minecraft/net/minecraft/util/EnumFacing.java.patch new file mode 100644 index 0000000000..f553f10e74 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/EnumFacing.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/util/EnumFacing.java ++++ ../src-work/minecraft/net/minecraft/util/EnumFacing.java +@@ -376,7 +376,7 @@ + } + } + +- public static enum Plane implements Predicate, Iterable { ++ public static enum Plane implements Predicate, Iterable { //Forge re-add generic because it just makes life easier. + HORIZONTAL, + VERTICAL; + diff --git a/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch b/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch index 183ba01662..80499add40 100644 --- a/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch +++ b/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/util/MovingObjectPosition.java +++ ../src-work/minecraft/net/minecraft/util/MovingObjectPosition.java -@@ -13,6 +13,12 @@ +@@ -11,6 +11,12 @@ public Entity field_72308_g; private static final String __OBFID = "CL_00000610"; @@ -10,6 +10,6 @@ + /** Used to add extra hit info */ + public Object hitInfo = null; + - public MovingObjectPosition(int p_i2303_1_, int p_i2303_2_, int p_i2303_3_, int p_i2303_4_, Vec3 p_i2303_5_) + public MovingObjectPosition(Vec3 p_i45551_1_, EnumFacing p_i45551_2_, BlockPos p_i45551_3_) { - this(p_i2303_1_, p_i2303_2_, p_i2303_3_, p_i2303_4_, p_i2303_5_, true); + this(MovingObjectPosition.MovingObjectType.BLOCK, p_i45551_1_, p_i45551_2_, p_i45551_3_); diff --git a/patches/minecraft/net/minecraft/util/Session.java.patch b/patches/minecraft/net/minecraft/util/Session.java.patch index 6f6c0e0899..5686360a89 100644 --- a/patches/minecraft/net/minecraft/util/Session.java.patch +++ b/patches/minecraft/net/minecraft/util/Session.java.patch @@ -15,8 +15,8 @@ + System.out.println("check your instllation and post a console log from the launcher"); + System.out.println("when asking for help!"); + System.out.println("========================================================="); -+ + } ++ this.field_74286_b = p_i1098_1_; this.field_148257_b = p_i1098_2_; this.field_148258_c = p_i1098_3_; diff --git a/patches/minecraft/net/minecraft/util/Vec3.java.patch b/patches/minecraft/net/minecraft/util/Vec3.java.patch index e29f252e57..0ad59ca10d 100644 --- a/patches/minecraft/net/minecraft/util/Vec3.java.patch +++ b/patches/minecraft/net/minecraft/util/Vec3.java.patch @@ -3,33 +3,25 @@ @@ -1,8 +1,5 @@ package net.minecraft.util; --import cpw.mods.fml.relauncher.Side; --import cpw.mods.fml.relauncher.SideOnly; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; - public class Vec3 { - public double field_72450_a; -@@ -45,7 +42,6 @@ - return this; + public final double field_72450_a; +@@ -32,7 +29,6 @@ + this.field_72449_c = p_i1108_5_; } - @SideOnly(Side.CLIENT) public Vec3 func_72444_a(Vec3 p_72444_1_) { - return func_72443_a(p_72444_1_.field_72450_a - this.field_72450_a, p_72444_1_.field_72448_b - this.field_72448_b, p_72444_1_.field_72449_c - this.field_72449_c); -@@ -62,7 +58,6 @@ + return new Vec3(p_72444_1_.field_72450_a - this.field_72450_a, p_72444_1_.field_72448_b - this.field_72448_b, p_72444_1_.field_72449_c - this.field_72449_c); +@@ -49,7 +45,6 @@ return this.field_72450_a * p_72430_1_.field_72450_a + this.field_72448_b * p_72430_1_.field_72448_b + this.field_72449_c * p_72430_1_.field_72449_c; } - @SideOnly(Side.CLIENT) public Vec3 func_72431_c(Vec3 p_72431_1_) { - return func_72443_a(this.field_72448_b * p_72431_1_.field_72449_c - this.field_72449_c * p_72431_1_.field_72448_b, this.field_72449_c * p_72431_1_.field_72450_a - this.field_72450_a * p_72431_1_.field_72449_c, this.field_72450_a * p_72431_1_.field_72448_b - this.field_72448_b * p_72431_1_.field_72450_a); -@@ -178,7 +173,6 @@ - this.func_72439_b(d0, d1, d2); - } - -- @SideOnly(Side.CLIENT) - public void func_72446_c(float p_72446_1_) - { - float f1 = MathHelper.func_76134_b(p_72446_1_); + return new Vec3(this.field_72448_b * p_72431_1_.field_72449_c - this.field_72449_c * p_72431_1_.field_72448_b, this.field_72449_c * p_72431_1_.field_72450_a - this.field_72450_a * p_72431_1_.field_72449_c, this.field_72450_a * p_72431_1_.field_72448_b - this.field_72448_b * p_72431_1_.field_72450_a); diff --git a/patches/minecraft/net/minecraft/util/WeightedRandom.java.patch b/patches/minecraft/net/minecraft/util/WeightedRandom.java.patch deleted file mode 100644 index afdf8c82fc..0000000000 --- a/patches/minecraft/net/minecraft/util/WeightedRandom.java.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/WeightedRandom.java -+++ ../src-work/minecraft/net/minecraft/util/WeightedRandom.java -@@ -27,10 +27,16 @@ - { - throw new IllegalArgumentException(); - } -- else -+ return getItem(p_76273_1_, p_76273_0_.nextInt(p_76273_2_)); -+ } -+ -+ //Forge: Added to allow custom random implementations, Modder is responsible for making sure the -+ //'weight' is under the totalWeight of the items. -+ public static WeightedRandom.Item getItem(Collection par1Collection, int weight) -+ { - { -- int j = p_76273_0_.nextInt(p_76273_2_); -- Iterator iterator = p_76273_1_.iterator(); -+ int j = weight; -+ Iterator iterator = par1Collection.iterator(); - WeightedRandom.Item item; - - do -@@ -75,11 +81,17 @@ - { - throw new IllegalArgumentException(); - } -- else -+ return getItem(p_76269_1_, p_76269_0_.nextInt(p_76269_2_)); -+ } -+ -+ //Forge: Added to allow custom random implementations, Modder is responsible for making sure the -+ //'weight' is under the totalWeight of the items. -+ public static WeightedRandom.Item getItem(WeightedRandom.Item[] par1ArrayOfWeightedRandomItem, int weight) -+ { - { -- int j = p_76269_0_.nextInt(p_76269_2_); -- WeightedRandom.Item[] aitem = p_76269_1_; -- int k = p_76269_1_.length; -+ int j = weight; -+ WeightedRandom.Item[] aitem = par1ArrayOfWeightedRandomItem; -+ int k = par1ArrayOfWeightedRandomItem.length; - - for (int l = 0; l < k; ++l) - { diff --git a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch index fc1bd1b912..12827e52b9 100644 --- a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch +++ b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch @@ -1,27 +1,18 @@ --- ../src-base/minecraft/net/minecraft/util/WeightedRandomChestContent.java +++ ../src-work/minecraft/net/minecraft/util/WeightedRandomChestContent.java -@@ -5,6 +5,7 @@ - import net.minecraft.item.Item; - import net.minecraft.item.ItemStack; - import net.minecraft.tileentity.TileEntityDispenser; -+import net.minecraftforge.common.ChestGenHooks; - - public class WeightedRandomChestContent extends WeightedRandom.Item - { -@@ -34,23 +35,12 @@ - for (int j = 0; j < p_76293_3_; ++j) +@@ -38,23 +38,12 @@ + for (int j = 0; j < p_177630_3_; ++j) { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.func_76274_a(p_76293_0_, p_76293_1_); -- int k = weightedrandomchestcontent.field_76295_d + p_76293_0_.nextInt(weightedrandomchestcontent.field_76296_e - weightedrandomchestcontent.field_76295_d + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(p_76293_0_, p_76293_2_); + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.func_76271_a(p_177630_0_, p_177630_1_); +- int k = weightedrandomchestcontent.field_76295_d + p_177630_0_.nextInt(weightedrandomchestcontent.field_76296_e - weightedrandomchestcontent.field_76295_d + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(p_177630_0_, p_177630_2_); - if (weightedrandomchestcontent.field_76297_b.func_77976_d() >= k) -+ for (ItemStack item : stacks) ++ for (ItemStack itemstack : stacks) { - ItemStack itemstack = weightedrandomchestcontent.field_76297_b.func_77946_l(); - itemstack.field_77994_a = k; -- p_76293_2_.func_70299_a(p_76293_0_.nextInt(p_76293_2_.func_70302_i_()), itemstack); -+ p_76293_2_.func_70299_a(p_76293_0_.nextInt(p_76293_2_.func_70302_i_()), item); + p_177630_2_.func_70299_a(p_177630_0_.nextInt(p_177630_2_.func_70302_i_()), itemstack); } - else - { @@ -29,25 +20,25 @@ - { - ItemStack itemstack1 = weightedrandomchestcontent.field_76297_b.func_77946_l(); - itemstack1.field_77994_a = 1; -- p_76293_2_.func_70299_a(p_76293_0_.nextInt(p_76293_2_.func_70302_i_()), itemstack1); +- p_177630_2_.func_70299_a(p_177630_0_.nextInt(p_177630_2_.func_70302_i_()), itemstack1); - } - } } } -@@ -60,22 +50,11 @@ +@@ -63,23 +52,12 @@ + for (int j = 0; j < p_177631_3_; ++j) { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.func_76274_a(p_150706_0_, p_150706_1_); - int k = weightedrandomchestcontent.field_76295_d + p_150706_0_.nextInt(weightedrandomchestcontent.field_76296_e - weightedrandomchestcontent.field_76295_d + 1); -- + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.func_76271_a(p_177631_0_, p_177631_1_); +- int k = weightedrandomchestcontent.field_76295_d + p_177631_0_.nextInt(weightedrandomchestcontent.field_76296_e - weightedrandomchestcontent.field_76295_d + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(p_177631_0_, p_177631_2_); + - if (weightedrandomchestcontent.field_76297_b.func_77976_d() >= k) -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(p_150706_0_, p_150706_2_); -+ for (ItemStack item : stacks) ++ for (ItemStack itemstack : stacks) { - ItemStack itemstack = weightedrandomchestcontent.field_76297_b.func_77946_l(); - itemstack.field_77994_a = k; -- p_150706_2_.func_70299_a(p_150706_0_.nextInt(p_150706_2_.func_70302_i_()), itemstack); -+ p_150706_2_.func_70299_a(p_150706_0_.nextInt(p_150706_2_.func_70302_i_()), item); + p_177631_2_.func_70299_a(p_177631_0_.nextInt(p_177631_2_.func_70302_i_()), itemstack); } - else - { @@ -55,15 +46,15 @@ - { - ItemStack itemstack1 = weightedrandomchestcontent.field_76297_b.func_77946_l(); - itemstack1.field_77994_a = 1; -- p_150706_2_.func_70299_a(p_150706_0_.nextInt(p_150706_2_.func_70302_i_()), itemstack1); +- p_177631_2_.func_70299_a(p_177631_0_.nextInt(p_177631_2_.func_70302_i_()), itemstack1); - } - } } } -@@ -100,4 +79,17 @@ - - return aweightedrandomchestcontent1; +@@ -89,4 +67,17 @@ + Collections.addAll(arraylist, p_177629_1_); + return arraylist; } + + // -- Forge hooks @@ -76,6 +67,6 @@ + */ + protected ItemStack[] generateChestContent(Random random, IInventory newInventory) + { -+ return ChestGenHooks.generateStacks(random, field_76297_b, field_76295_d, field_76296_e); ++ return net.minecraftforge.common.ChestGenHooks.generateStacks(random, field_76297_b, field_76295_d, field_76296_e); + } } diff --git a/patches/minecraft/net/minecraft/village/VillageCollection.java.patch b/patches/minecraft/net/minecraft/village/VillageCollection.java.patch deleted file mode 100644 index 8e1f09121e..0000000000 --- a/patches/minecraft/net/minecraft/village/VillageCollection.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/village/VillageCollection.java -+++ ../src-work/minecraft/net/minecraft/village/VillageCollection.java -@@ -147,7 +147,7 @@ - { - Village village = (Village)iterator.next(); - int j = (int)village.func_75577_a().func_71569_e(villagedoorinfo.field_75481_a, villagedoorinfo.field_75479_b, villagedoorinfo.field_75480_c); -- int k = 32 + village.func_75568_b(); -+ float k = 32f + village.func_75568_b(); //BugFix: Avoid int wrapping - - if (j > k * k) - { diff --git a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch index f934257653..1fd5bcd2f1 100644 --- a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch @@ -1,56 +1,61 @@ --- ../src-base/minecraft/net/minecraft/world/ChunkCache.java +++ ../src-work/minecraft/net/minecraft/world/ChunkCache.java -@@ -8,6 +8,7 @@ - import net.minecraft.tileentity.TileEntity; - import net.minecraft.world.biome.BiomeGenBase; - import net.minecraft.world.chunk.Chunk; -+import net.minecraftforge.common.util.ForgeDirection; - - public class ChunkCache implements IBlockAccess - { -@@ -91,6 +92,8 @@ +@@ -64,6 +64,8 @@ { - int l = (p_147438_1_ >> 4) - this.field_72818_a; - int i1 = (p_147438_3_ >> 4) - this.field_72816_b; -+ if (l < 0 || l >= field_72817_c.length || i1 < 0 || i1 >= field_72817_c[l].length) return null; -+ if (field_72817_c[l][i1] == null) return null; - return this.field_72817_c[l][i1].func_150806_e(p_147438_1_ & 15, p_147438_2_, p_147438_3_ & 15); + int i = (p_175625_1_.func_177958_n() >> 4) - this.field_72818_a; + int j = (p_175625_1_.func_177952_p() >> 4) - this.field_72816_b; ++ if (i < 0 || i >= field_72817_c.length || j < 0 || j >= field_72817_c[i].length) return null; ++ if (field_72817_c[i][j] == null) return null; + return this.field_72817_c[i][j].func_177424_a(p_175625_1_, Chunk.EnumCreateEntityType.IMMEDIATE); } -@@ -122,6 +125,8 @@ +@@ -87,6 +89,7 @@ { - int l = (p_72805_1_ >> 4) - this.field_72818_a; - int i1 = (p_72805_3_ >> 4) - this.field_72816_b; -+ if (l < 0 || l >= field_72817_c.length || i1 < 0 || i1 >= field_72817_c[l].length) return 0; -+ if (field_72817_c[l][i1] == null) return 0; - return this.field_72817_c[l][i1].func_76628_c(p_72805_1_ & 15, p_72805_2_, p_72805_3_ & 15); - } - } -@@ -137,10 +142,9 @@ - return this.field_72815_e.func_72807_a(p_72807_1_, p_72807_2_); - } + int i = (p_180495_1_.func_177958_n() >> 4) - this.field_72818_a; + int j = (p_180495_1_.func_177952_p() >> 4) - this.field_72816_b; ++ if (i < 0 || i >= field_72817_c.length || j < 0 || i >= field_72817_c[i].length) return Blocks.field_150350_a.func_176223_P(); -- @SideOnly(Side.CLIENT) - public boolean func_147437_c(int p_147437_1_, int p_147437_2_, int p_147437_3_) + if (i >= 0 && i < this.field_72817_c.length && j >= 0 && j < this.field_72817_c[i].length) + { +@@ -147,6 +150,8 @@ + { + 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 (i < 0 || i >= field_72817_c.length || j < 0 || j >= field_72817_c[i].length) return p_175629_1_.field_77198_c; ++ if (field_72817_c[i][j] == null) return p_175629_1_.field_77198_c; + return this.field_72817_c[i][j].func_177413_a(p_175629_1_, p_175629_2_); + } + } +@@ -158,7 +163,7 @@ + + public boolean func_175623_d(BlockPos p_175623_1_) { -- return this.func_147439_a(p_147437_1_, p_147437_2_, p_147437_3_).func_149688_o() == Material.field_151579_a; -+ return this.func_147439_a(p_147437_1_, p_147437_2_, p_147437_3_).isAir(this, p_147437_1_, p_147437_2_, p_147437_3_); +- return this.func_180495_p(p_175623_1_).func_177230_c().func_149688_o() == Material.field_151579_a; ++ return this.func_180495_p(p_175623_1_).func_177230_c().isAir(this, p_175623_1_); } @SideOnly(Side.CLIENT) -@@ -241,4 +245,15 @@ +@@ -168,6 +173,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 (i < 0 || i >= field_72817_c.length || j < 0 || i >= field_72817_c[i].length) return p_175628_1_.field_77198_c; + return this.field_72817_c[i][j].func_177413_a(p_175628_1_, p_175628_2_); + } + else +@@ -187,4 +193,15 @@ { - return 256; + return this.field_72815_e.func_175624_G(); } + + @Override -+ public boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _default) ++ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) + { -+ if (x < -30000000 || z < -30000000 || x >= 30000000 || z >= 30000000) -+ { -+ return _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 (x < 0 || x >= field_72817_c.length || z < 0 || x >= field_72817_c[x].length) return _default; + -+ return func_147439_a(x, y, z).isSideSolid(this, x, y, z, side); ++ return func_180495_p(pos).func_177230_c().isSideSolid(this, pos, side); + } } diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch index 1d9c989469..d3fa49fee6 100644 --- a/patches/minecraft/net/minecraft/world/Explosion.java.patch +++ b/patches/minecraft/net/minecraft/world/Explosion.java.patch @@ -1,21 +1,44 @@ --- ../src-base/minecraft/net/minecraft/world/Explosion.java +++ ../src-work/minecraft/net/minecraft/world/Explosion.java -@@ -86,7 +86,7 @@ +@@ -40,6 +40,7 @@ + private final List field_77281_g; + private final Map field_77288_k; + private static final String __OBFID = "CL_00000134"; ++ private final Vec3 position; - if (block.func_149688_o() != Material.field_151579_a) + @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_) +@@ -67,6 +68,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 Vec3(field_77284_b, field_77285_c, field_77282_d); + } + + public void func_77278_a() +@@ -103,7 +105,7 @@ + + if (iblockstate.func_177230_c().func_149688_o() != Material.field_151579_a) { -- float f3 = this.field_77283_e != null ? this.field_77283_e.func_145772_a(this, this.field_77287_j, j1, k1, l1, block) : block.func_149638_a(this.field_77283_e); -+ float f3 = this.field_77283_e != null ? this.field_77283_e.func_145772_a(this, this.field_77287_j, j1, k1, l1, block) : block.getExplosionResistance(this.field_77283_e, field_77287_j, j1, k1, l1, field_77284_b, field_77285_c, field_77282_d); - f1 -= (f3 + 0.3F) * f2; +- 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; } -@@ -211,8 +211,7 @@ - block.func_149690_a(this.field_77287_j, i, j, k, this.field_77287_j.func_72805_g(i, j, k), 1.0F / this.field_77280_f, 0); +@@ -223,8 +225,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_147465_d(i, j, k, Blocks.field_150350_a, 0, 3); -- block.func_149723_a(this.field_77287_j, i, j, k, this); -+ block.onBlockExploded(this.field_77287_j, i, j, k, this); +- 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); } } } +@@ -264,4 +265,6 @@ + { + return this.field_77281_g; + } ++ ++ public Vec3 getPosition(){ return this.position; } + } diff --git a/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch b/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch index 5dfdfa8c2a..e6b7d331dd 100644 --- a/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch +++ b/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch @@ -1,35 +1,17 @@ --- ../src-base/minecraft/net/minecraft/world/IBlockAccess.java +++ ../src-work/minecraft/net/minecraft/world/IBlockAccess.java -@@ -5,6 +5,7 @@ - import net.minecraft.block.Block; - import net.minecraft.tileentity.TileEntity; - import net.minecraft.world.biome.BiomeGenBase; -+import net.minecraftforge.common.util.ForgeDirection; - - public interface IBlockAccess - { -@@ -19,7 +20,6 @@ - - int func_72879_k(int p_72879_1_, int p_72879_2_, int p_72879_3_, int p_72879_4_); - -- @SideOnly(Side.CLIENT) - boolean func_147437_c(int p_147437_1_, int p_147437_2_, int p_147437_3_); +@@ -29,4 +29,14 @@ @SideOnly(Side.CLIENT) -@@ -30,4 +30,16 @@ - - @SideOnly(Side.CLIENT) - boolean func_72806_N(); + WorldType func_175624_G(); + + /** + * FORGE: isSideSolid, pulled up from {@link World} + * -+ * @param x X coord -+ * @param y Y coord -+ * @param z Z coord ++ * @param pos Position + * @param side Side + * @param _default default return value + * @return if the block is solid on the side + */ -+ boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _default); ++ boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default); } diff --git a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch index 6735b00a7d..af90a0e7e5 100644 --- a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch +++ b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch @@ -1,65 +1,60 @@ --- ../src-base/minecraft/net/minecraft/world/SpawnerAnimals.java +++ ../src-work/minecraft/net/minecraft/world/SpawnerAnimals.java -@@ -1,5 +1,7 @@ - package net.minecraft.world; - -+import java.util.ArrayList; -+import java.util.Collections; - import java.util.HashMap; - import java.util.Iterator; - import java.util.List; -@@ -17,6 +19,9 @@ +@@ -17,6 +17,10 @@ + import net.minecraft.util.WeightedRandom; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; - -+import cpw.mods.fml.common.eventhandler.Event.Result; ++import java.util.ArrayList; ++import java.util.Collections; ++import net.minecraftforge.fml.common.eventhandler.Event.Result; +import net.minecraftforge.event.ForgeEventFactory; -+ + public final class SpawnerAnimals { - private HashMap field_77193_b = new HashMap(); -@@ -78,9 +83,12 @@ - { - EnumCreatureType enumcreaturetype = aenumcreaturetype[k3]; +@@ -80,12 +84,15 @@ -- if ((!enumcreaturetype.func_75599_d() || p_77192_3_) && (enumcreaturetype.func_75599_d() || p_77192_2_) && (!enumcreaturetype.func_82705_e() || p_77192_4_) && p_77192_1_.func_72907_a(enumcreaturetype.func_75598_a()) <= enumcreaturetype.func_75601_b() * this.field_77193_b.size() / 256) -+ if ((!enumcreaturetype.func_75599_d() || p_77192_3_) && (enumcreaturetype.func_75599_d() || p_77192_2_) && (!enumcreaturetype.func_82705_e() || p_77192_4_) && p_77192_1_.countEntities(enumcreaturetype, true) <= enumcreaturetype.func_75601_b() * this.field_77193_b.size() / 256) + if ((!enumcreaturetype.func_75599_d() || p_77192_3_) && (enumcreaturetype.func_75599_d() || p_77192_2_) && (!enumcreaturetype.func_82705_e() || p_77192_4_)) { - Iterator iterator = this.field_77193_b.keySet().iterator(); -+ ArrayList tmp = new ArrayList(field_77193_b.keySet()); -+ Collections.shuffle(tmp); -+ iterator = tmp.iterator(); - label110: +- i1 = p_77192_1_.func_72907_a(enumcreaturetype.func_75598_a()); ++ i1 = p_77192_1_.countEntities(enumcreaturetype, true); + int i4 = enumcreaturetype.func_75601_b() * i / field_180268_a; - while (iterator.hasNext()) -@@ -158,13 +166,17 @@ + if (i1 <= i4) + { + Iterator iterator1 = this.field_77193_b.iterator(); ++ ArrayList tmp = new ArrayList(field_77193_b); ++ Collections.shuffle(tmp); ++ iterator1 = tmp.iterator(); + label115: - entityliving.func_70012_b((double)f, (double)f1, (double)f2, p_77192_1_.field_73012_v.nextFloat() * 360.0F, 0.0F); + while (iterator1.hasNext()) +@@ -153,8 +160,10 @@ -- if (entityliving.func_70601_bi()) -+ Result canSpawn = ForgeEventFactory.canEntitySpawn(entityliving, p_77192_1_, f, f1, f2); -+ if (canSpawn == Result.ALLOW || (canSpawn == Result.DEFAULT && entityliving.func_70601_bi())) - { - ++i2; + entityliving.func_70012_b((double)f, (double)l2, (double)f1, p_77192_1_.field_73012_v.nextFloat() * 360.0F, 0.0F); + +- if (entityliving.func_70601_bi() && entityliving.func_70058_J()) ++ Result canSpawn = ForgeEventFactory.canEntitySpawn(entityliving, p_77192_1_, f, l2, f1); ++ if (canSpawn == Result.ALLOW || (canSpawn == Result.DEFAULT && (entityliving.func_70601_bi() && entityliving.func_70058_J()))) + { ++ if (!ForgeEventFactory.doSpecialSpawn(entityliving, p_77192_1_, f1, l2, f1)) + ientitylivingdata = entityliving.func_180482_a(p_77192_1_.func_175649_E(new BlockPos(entityliving)), ientitylivingdata); + + if (entityliving.func_70058_J()) +@@ -163,7 +172,7 @@ p_77192_1_.func_72838_d(entityliving); -- ientitylivingdata = entityliving.func_110161_a(ientitylivingdata); -+ if (!ForgeEventFactory.doSpecialSpawn(entityliving, p_77192_1_, f, f1, f2)) -+ { -+ ientitylivingdata = entityliving.func_110161_a(ientitylivingdata); -+ } - -- if (i2 >= entityliving.func_70641_bl()) -+ if (j2 >= ForgeEventFactory.getMaxSpawnPackSize(entityliving)) - { - continue label110; - } -@@ -207,7 +219,8 @@ - else - { - Block block = p_77190_1_.func_147439_a(p_77190_2_, p_77190_3_ - 1, p_77190_4_); -- return block != Blocks.field_150357_h && !p_77190_1_.func_147439_a(p_77190_2_, p_77190_3_, p_77190_4_).func_149721_r() && !p_77190_1_.func_147439_a(p_77190_2_, p_77190_3_, p_77190_4_).func_149688_o().func_76224_d() && !p_77190_1_.func_147439_a(p_77190_2_, p_77190_3_ + 1, p_77190_4_).func_149721_r(); -+ boolean spawnBlock = block.canCreatureSpawn(p_77190_0_, p_77190_1_, p_77190_2_, p_77190_3_ - 1, p_77190_4_); -+ return spawnBlock && block != Blocks.field_150357_h && !p_77190_1_.func_147439_a(p_77190_2_, p_77190_3_, p_77190_4_).func_149721_r() && !p_77190_1_.func_147439_a(p_77190_2_, p_77190_3_, p_77190_4_).func_149688_o().func_76224_d() && !p_77190_1_.func_147439_a(p_77190_2_, p_77190_3_ + 1, p_77190_4_).func_149721_r(); - } - } + } +- if (i2 >= entityliving.func_70641_bl()) ++ if (i2 >= ForgeEventFactory.getMaxSpawnPackSize(entityliving)) + { + continue label115; + } +@@ -228,6 +237,8 @@ + { + Block block1 = p_180267_1_.func_180495_p(blockpos1).func_177230_c(); + boolean flag = block1 != Blocks.field_150357_h && block1 != Blocks.field_180401_cv; ++ BlockPos down = blockpos1.func_177977_b(); ++ flag |= p_180267_1_.func_180495_p(down).func_177230_c().canCreatureSpawn(p_180267_1_, down, p_180267_0_); + return flag && !block.func_149721_r() && !block.func_149688_o().func_76224_d() && !p_180267_1_.func_180495_p(p_180267_2_.func_177984_a()).func_177230_c().func_149721_r(); + } + } diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index e31a796047..11a8ec5edb 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -1,20 +1,17 @@ --- ../src-base/minecraft/net/minecraft/world/World.java +++ ../src-work/minecraft/net/minecraft/world/World.java -@@ -52,8 +52,35 @@ - import net.minecraft.world.storage.MapStorage; - import net.minecraft.world.storage.WorldInfo; +@@ -56,8 +56,30 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; -+import cpw.mods.fml.common.FMLLog; -+ ++import net.minecraftforge.fml.common.FMLLog; +import com.google.common.collect.ImmutableSetMultimap; -+ +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.common.ForgeChunkManager; +import net.minecraftforge.common.ForgeChunkManager.Ticket; +import net.minecraftforge.common.ForgeModContainer; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.common.WorldSpecificSaveHandler; +import net.minecraftforge.event.entity.EntityEvent; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; @@ -31,240 +28,176 @@ + */ + public static double MAX_ENTITY_RADIUS = 2.0D; + -+ public final MapStorage perWorldStorage; -+ - public boolean field_72999_e; - public List field_72996_f = new ArrayList(); - protected List field_72997_g = new ArrayList(); -@@ -94,9 +121,17 @@ - private boolean field_147481_N; + protected boolean field_72999_e; + public final List field_72996_f = Lists.newArrayList(); + protected final List field_72997_g = Lists.newArrayList(); +@@ -99,6 +121,10 @@ int[] field_72994_J; private static final String __OBFID = "CL_00000140"; + + public boolean restoringBlockSnapshots = false; + public boolean captureBlockSnapshots = false; + public ArrayList capturedBlockSnapshots = new ArrayList(); - - public BiomeGenBase func_72807_a(final int p_72807_1_, final int p_72807_2_) ++ + protected World(ISaveHandler p_i45749_1_, WorldInfo p_i45749_2_, WorldProvider p_i45749_3_, Profiler p_i45749_4_, boolean p_i45749_5_) { -+ return field_73011_w.getBiomeGenForCoords(p_72807_1_, p_72807_2_); -+ } -+ -+ public BiomeGenBase getBiomeGenForCoordsBody(final int p_72807_1_, final int p_72807_2_) -+ { - if (this.func_72899_e(p_72807_1_, 0, p_72807_2_)) - { - Chunk chunk = this.func_72938_d(p_72807_1_, p_72807_2_); -@@ -143,7 +178,13 @@ - this.field_72984_F = p_i45368_5_; - this.field_72986_A = new WorldInfo(p_i45368_4_, p_i45368_2_); - this.field_73011_w = p_i45368_3_; -- this.field_72988_C = new MapStorage(p_i45368_1_); + this.field_72990_M = this.field_73012_v.nextInt(12000); +@@ -111,6 +137,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() +@@ -120,13 +147,18 @@ + + public BiomeGenBase func_180494_b(final BlockPos p_180494_1_) + { +- if (this.func_175667_e(p_180494_1_)) ++ return this.field_73011_w.getBiomeGenForCoords(p_180494_1_); + } + -+ // Broken up so that the WorldClient gets the chance to set the mapstorage object before the dimension initializes -+ @SideOnly(Side.CLIENT) -+ protected void finishSetup() ++ public BiomeGenBase getBiomeGenForCoordsBody(final BlockPos pos) + { - VillageCollection villagecollection = (VillageCollection)this.field_72988_C.func_75742_a(VillageCollection.class, "villages"); - - if (villagecollection == null) -@@ -157,7 +198,10 @@ - this.field_72982_D.func_82566_a(this); - } - -- p_i45368_3_.func_76558_a(this); -+ // Guarantee the dimension ID was not reset by the provider -+ int providerDim = this.field_73011_w.field_76574_g; -+ this.field_73011_w.func_76558_a(this); -+ this.field_73011_w.field_76574_g = providerDim; - this.field_73020_y = this.func_72970_h(); - this.func_72966_v(); - this.func_72947_a(); -@@ -172,7 +216,7 @@ - this.field_72994_J = new int[32768]; - this.field_73019_z = p_i45369_1_; - this.field_72984_F = p_i45369_5_; -- this.field_72988_C = new MapStorage(p_i45369_1_); -+ this.field_72988_C = getMapStorage(p_i45369_1_); - this.field_72986_A = p_i45369_1_.func_75757_d(); - - if (p_i45369_4_ != null) -@@ -200,6 +244,15 @@ - this.field_73011_w.func_76558_a(this); - this.field_73020_y = this.func_72970_h(); - -+ if (this instanceof WorldServer) -+ { -+ this.perWorldStorage = new MapStorage(new WorldSpecificSaveHandler((WorldServer)this, p_i45369_1_)); -+ } -+ else -+ { -+ this.perWorldStorage = new MapStorage((ISaveHandler)null); -+ } -+ - if (!this.field_72986_A.func_76070_v()) ++ if (this.func_175667_e(pos)) { +- Chunk chunk = this.func_175726_f(p_180494_1_); ++ Chunk chunk = this.func_175726_f(pos); + try -@@ -225,12 +278,12 @@ - this.field_72986_A.func_76091_d(true); - } - -- VillageCollection villagecollection = (VillageCollection)this.field_72988_C.func_75742_a(VillageCollection.class, "villages"); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.func_75742_a(VillageCollection.class, "villages"); - - if (villagecollection == null) - { - this.field_72982_D = new VillageCollection(this); -- this.field_72988_C.func_75745_a("villages", this.field_72982_D); -+ this.perWorldStorage.func_75745_a("villages", this.field_72982_D); + { +- return chunk.func_177411_a(p_180494_1_, this.field_73011_w.func_177499_m()); ++ return chunk.func_177411_a(pos, this.field_73011_w.func_177499_m()); + } + catch (Throwable throwable) + { +@@ -137,7 +169,7 @@ + private static final String __OBFID = "CL_00000141"; + public String call() + { +- return CrashReportCategory.func_180522_a(p_180494_1_); ++ return CrashReportCategory.func_180522_a(pos); + } + }); + throw new ReportedException(crashreport); +@@ -145,7 +177,7 @@ } else { -@@ -242,6 +295,20 @@ - this.func_72947_a(); +- return this.field_73011_w.func_177499_m().func_180300_a(p_180494_1_, BiomeGenBase.field_76772_c); ++ return this.field_73011_w.func_177499_m().func_180300_a(pos, BiomeGenBase.field_76772_c); + } } -+ private static MapStorage s_mapStorage; -+ private static ISaveHandler s_savehandler; -+ //Provides a solution for different worlds getting different copies of the same data, potentially rewriting the data or causing race conditions/stale data -+ //Buildcraft has suffered from the issue this fixes. If you load the same data from two different worlds they can get two different copies of the same object, thus the last saved gets final say. -+ private MapStorage getMapStorage(ISaveHandler savehandler) -+ { -+ if (s_savehandler != savehandler || s_mapStorage == null) -+ { -+ s_mapStorage = new MapStorage(savehandler); -+ s_savehandler = savehandler; -+ } -+ return s_mapStorage; -+ } -+ - protected abstract IChunkProvider func_72970_h(); +@@ -186,7 +218,7 @@ - protected void func_72963_a(WorldSettings p_72963_1_) -@@ -295,7 +362,8 @@ - - public boolean func_147437_c(int p_147437_1_, int p_147437_2_, int p_147437_3_) + public boolean func_175623_d(BlockPos p_175623_1_) { -- return this.func_147439_a(p_147437_1_, p_147437_2_, p_147437_3_).func_149688_o() == Material.field_151579_a; -+ Block block = this.func_147439_a(p_147437_1_, p_147437_2_, p_147437_3_); -+ return block.isAir(this, p_147437_1_, p_147437_2_, p_147437_3_); +- return this.func_180495_p(p_175623_1_).func_177230_c().func_149688_o() == Material.field_151579_a; ++ return this.func_180495_p(p_175623_1_).func_177230_c().isAir(this, p_175623_1_); } - public boolean func_72899_e(int p_72899_1_, int p_72899_2_, int p_72899_3_) -@@ -367,33 +435,35 @@ + public boolean func_175667_e(BlockPos p_175667_1_) +@@ -286,6 +318,14 @@ + { + Chunk chunk = this.func_175726_f(p_180501_1_); + Block block = p_180501_2_.func_177230_c(); ++ ++ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; ++ if (this.captureBlockSnapshots && !this.field_72995_K) ++ { ++ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, p_180501_1_, p_180501_3_); ++ this.capturedBlockSnapshots.add(blockSnapshot); ++ } ++ + IBlockState iblockstate1 = chunk.func_177436_a(p_180501_1_, p_180501_2_); + + if (iblockstate1 == null) +@@ -294,6 +334,12 @@ + } + else { - Chunk chunk = this.func_72964_e(p_147465_1_ >> 4, p_147465_3_ >> 4); - Block block1 = null; -+ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; - - if ((p_147465_6_ & 1) != 0) - { - block1 = chunk.func_150810_a(p_147465_1_ & 15, p_147465_2_, p_147465_3_ & 15); - } - -+ if (this.captureBlockSnapshots && !this.field_72995_K) -+ { -+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, p_147465_1_, p_147465_2_, p_147465_3_, p_147465_6_); -+ this.capturedBlockSnapshots.add(blockSnapshot); -+ } -+ - boolean flag = chunk.func_150807_a(p_147465_1_ & 15, p_147465_2_, p_147465_3_ & 15, p_147465_4_, p_147465_5_); -+ -+ if (!flag && blockSnapshot != null) ++ if (blockSnapshot != null) + { + this.capturedBlockSnapshots.remove(blockSnapshot); + blockSnapshot = null; + } + - this.field_72984_F.func_76320_a("checkLight"); - this.func_147451_t(p_147465_1_, p_147465_2_, p_147465_3_); - this.field_72984_F.func_76319_b(); + Block block1 = iblockstate1.func_177230_c(); -- if (flag) -+ if (flag && blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates - { -- if ((p_147465_6_ & 2) != 0 && (!this.field_72995_K || (p_147465_6_ & 4) == 0) && chunk.func_150802_k()) -- { -- this.func_147471_g(p_147465_1_, p_147465_2_, p_147465_3_); -- } -- -- if (!this.field_72995_K && (p_147465_6_ & 1) != 0) -- { -- this.func_147444_c(p_147465_1_, p_147465_2_, p_147465_3_, block1); -- -- if (p_147465_4_.func_149740_M()) -- { -- this.func_147453_f(p_147465_1_, p_147465_2_, p_147465_3_, p_147465_4_); -- } -- } -+ // Modularize client and physic updates -+ this.markAndNotifyBlock(p_147465_1_, p_147465_2_, p_147465_3_, chunk, block1, p_147465_4_, p_147465_6_); + if (block.func_149717_k() != block1.func_149717_k() || block.func_149750_m() != block1.func_149750_m()) +@@ -303,22 +349,31 @@ + this.field_72984_F.func_76319_b(); } - return flag; -@@ -405,6 +475,25 @@ - } - } +- 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.func_175689_h(p_180501_1_); ++ this.markAndNotifyBlock(p_180501_1_, chunk, iblockstate1, p_180501_2_, p_180501_3_); // Modularize client and physic updates + } -+ // Split off from original setBlock(int p_147465_1_, int p_147465_2_, int p_147465_3_, Block p_147465_4_, int p_147465_5_, int p_147465_6_) method in order to directly send client and physic updates -+ public void markAndNotifyBlock(int x, int y, int z, Chunk chunk, Block oldBlock, Block newBlock, int flag) -+ { -+ if ((flag & 2) != 0 && (chunk == null || chunk.func_150802_k())) -+ { -+ this.func_147471_g(x, y, z); -+ } -+ -+ if (!this.field_72995_K && (flag & 1) != 0) -+ { -+ this.func_147444_c(x, y, z, oldBlock); -+ -+ if (newBlock.func_149740_M()) -+ { -+ this.func_147453_f(x, y, z, newBlock); +- if (!this.field_72995_K && (p_180501_3_ & 1) != 0) +- { +- this.func_175722_b(p_180501_1_, iblockstate1.func_177230_c()); ++ return true; + } + } + } + +- if (block.func_149740_M()) +- { +- this.func_175666_e(p_180501_1_, block); +- } +- } ++ // Split off from original setBlockState(BlockPos, IBlockState Block p_147465_4_, int) method in order to directly send client and physic updates ++ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState old, IBlockState new_, int flags) ++ { ++ if ((flags & 2) != 0 && (!this.field_72995_K || (flags & 4) == 0) && chunk.func_150802_k()) ++ { ++ this.func_175689_h(pos); ++ } + +- return true; ++ if (!this.field_72995_K && (flags & 1) != 0) ++ { ++ this.func_175722_b(pos, old.func_177230_c()); + - public int func_72805_g(int p_72805_1_, int p_72805_2_, int p_72805_3_) - { - if (p_72805_1_ >= -30000000 && p_72805_3_ >= -30000000 && p_72805_1_ < 30000000 && p_72805_3_ < 30000000) -@@ -927,7 +1016,7 @@ ++ if (new_.func_177230_c().func_149740_M()) ++ { ++ this.func_175666_e(pos, new_.func_177230_c()); + } + } + } +@@ -782,7 +837,7 @@ public boolean func_72935_r() { - return this.field_73008_k < 4; -+ return field_73011_w.isDaytime(); ++ return this.field_73011_w.isDaytime(); } public MovingObjectPosition func_72933_a(Vec3 p_72933_1_, Vec3 p_72933_2_) -@@ -1158,6 +1247,12 @@ +@@ -978,6 +1033,8 @@ public void func_72956_a(Entity p_72956_1_, String p_72956_2_, float p_72956_3_, float p_72956_4_) { -+ PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(p_72956_1_, p_72956_2_, p_72956_3_, p_72956_4_); -+ if (MinecraftForge.EVENT_BUS.post(event)) -+ { -+ return; -+ } -+ p_72956_2_ = event.name; ++ p_72956_2_ = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAt(p_72956_1_, p_72956_2_, p_72956_3_, p_72956_4_); ++ if (p_72956_2_ == null) return; for (int i = 0; i < this.field_73021_x.size(); ++i) { - ((IWorldAccess)this.field_73021_x.get(i)).func_72704_a(p_72956_2_, p_72956_1_.field_70165_t, p_72956_1_.field_70163_u - (double)p_72956_1_.field_70129_M, p_72956_1_.field_70161_v, p_72956_3_, p_72956_4_); -@@ -1166,6 +1261,12 @@ + ((IWorldAccess)this.field_73021_x.get(i)).func_72704_a(p_72956_2_, p_72956_1_.field_70165_t, p_72956_1_.field_70163_u, p_72956_1_.field_70161_v, p_72956_3_, p_72956_4_); +@@ -986,6 +1043,8 @@ public void func_85173_a(EntityPlayer p_85173_1_, String p_85173_2_, float p_85173_3_, float p_85173_4_) { -+ PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(p_85173_1_, p_85173_2_, p_85173_3_, p_85173_4_); -+ if (MinecraftForge.EVENT_BUS.post(event)) -+ { -+ return; -+ } -+ p_85173_2_ = event.name; ++ p_85173_2_ = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAt(p_85173_1_, p_85173_2_, p_85173_3_, p_85173_4_); ++ if (p_85173_2_ == null) return; for (int i = 0; i < this.field_73021_x.size(); ++i) { - ((IWorldAccess)this.field_73021_x.get(i)).func_85102_a(p_85173_1_, p_85173_2_, p_85173_1_.field_70165_t, p_85173_1_.field_70163_u - (double)p_85173_1_.field_70129_M, p_85173_1_.field_70161_v, p_85173_3_, p_85173_4_); -@@ -1206,6 +1307,9 @@ + ((IWorldAccess)this.field_73021_x.get(i)).func_85102_a(p_85173_1_, p_85173_2_, p_85173_1_.field_70165_t, p_85173_1_.field_70163_u, p_85173_1_.field_70161_v, p_85173_3_, p_85173_4_); +@@ -1037,6 +1096,9 @@ public boolean func_72838_d(Entity p_72838_1_) { @@ -274,15 +207,16 @@ 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; -@@ -1227,6 +1331,7 @@ - this.field_73010_i.add(entityplayer); +@@ -1059,6 +1121,8 @@ this.func_72854_c(); } -+ if (MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(p_72838_1_, this)) && !flag) return false; ++ 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_); -@@ -1398,6 +1503,20 @@ + this.func_72923_a(p_72838_1_); +@@ -1271,17 +1335,29 @@ public int func_72967_a(float p_72967_1_) { @@ -290,20 +224,19 @@ + f2 = 1.0F - f2; + return (int)(f2 * 11.0F); + } -+ ++ + /** + * 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 f1 = this.func_72826_c(p_72967_1_); float f2 = 1.0F - (MathHelper.func_76134_b(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F); - -@@ -1414,11 +1533,9 @@ + f2 = MathHelper.func_76131_a(f2, 0.0F, 1.0F); f2 = 1.0F - f2; f2 = (float)((double)f2 * (1.0D - (double)(this.func_72867_j(p_72967_1_) * 5.0F) / 16.0D)); f2 = (float)((double)f2 * (1.0D - (double)(this.func_72819_i(p_72967_1_) * 5.0F) / 16.0D)); @@ -316,24 +249,24 @@ public void func_72848_b(IWorldAccess p_72848_1_) { this.field_73021_x.remove(p_72848_1_); -@@ -1427,6 +1544,12 @@ +@@ -1290,6 +1366,12 @@ @SideOnly(Side.CLIENT) public float func_72971_b(float p_72971_1_) { -+ return field_73011_w.getSunBrightness(p_72971_1_); ++ return this.field_73011_w.getSunBrightness(p_72971_1_); + } -+ ++ + @SideOnly(Side.CLIENT) + public float getSunBrightnessBody(float p_72971_1_) + { float f1 = this.func_72826_c(p_72971_1_); float f2 = 1.0F - (MathHelper.func_76134_b(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.2F); - -@@ -1449,6 +1572,12 @@ + f2 = MathHelper.func_76131_a(f2, 0.0F, 1.0F); +@@ -1302,6 +1384,12 @@ @SideOnly(Side.CLIENT) public Vec3 func_72833_a(Entity p_72833_1_, float p_72833_2_) { -+ return field_73011_w.getSkyColor(p_72833_1_, p_72833_2_); ++ return this.field_73011_w.getSkyColor(p_72833_1_, p_72833_2_); + } + + @SideOnly(Side.CLIENT) @@ -341,35 +274,35 @@ + { float f1 = this.func_72826_c(p_72833_2_); float f2 = MathHelper.func_76134_b(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; - -@@ -1465,9 +1594,7 @@ - int i = MathHelper.func_76128_c(p_72833_1_.field_70165_t); + f2 = MathHelper.func_76131_a(f2, 0.0F, 1.0F); +@@ -1309,9 +1397,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); -- BiomeGenBase biomegenbase = this.func_72807_a(i, k); -- float f3 = biomegenbase.func_150564_a(i, j, k); + BlockPos blockpos = new BlockPos(i, j, k); +- BiomeGenBase biomegenbase = this.func_180494_b(blockpos); +- float f3 = biomegenbase.func_180626_a(blockpos); - int l = biomegenbase.func_76731_a(f3); -+ int l = ForgeHooksClient.getSkyBlendColour(this, i, j, k); ++ int l = net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(this, blockpos); float f4 = (float)(l >> 16 & 255) / 255.0F; float f5 = (float)(l >> 8 & 255) / 255.0F; float f6 = (float)(l & 255) / 255.0F; -@@ -1529,6 +1656,11 @@ +@@ -1373,6 +1459,11 @@ public float func_130001_d() { + return field_73011_w.getCurrentMoonPhaseFactor(); + } -+ ++ + public float getCurrentMoonPhaseFactorBody() + { return WorldProvider.field_111203_a[this.field_73011_w.func_76559_b(this.field_72986_A.func_76073_f())]; } -@@ -1541,6 +1673,12 @@ +@@ -1385,6 +1476,12 @@ @SideOnly(Side.CLIENT) public Vec3 func_72824_f(float p_72824_1_) { -+ return field_73011_w.drawClouds(p_72824_1_); ++ return this.field_73011_w.drawClouds(p_72824_1_); + } + + @SideOnly(Side.CLIENT) @@ -377,41 +310,33 @@ + { float f1 = this.func_72826_c(p_72824_1_); float f2 = MathHelper.func_76134_b(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; - -@@ -1602,6 +1740,8 @@ - public int func_72825_h(int p_72825_1_, int p_72825_2_) - { - Chunk chunk = this.func_72938_d(p_72825_1_, p_72825_2_); -+ int x = p_72825_1_; -+ int z = p_72825_2_; - int k = chunk.func_76625_h() + 15; - p_72825_1_ &= 15; - -@@ -1609,7 +1749,7 @@ + f2 = MathHelper.func_76131_a(f2, 0.0F, 1.0F); +@@ -1442,9 +1539,9 @@ + for (blockpos1 = new BlockPos(p_175672_1_.func_177958_n(), chunk.func_76625_h() + 16, p_175672_1_.func_177952_p()); blockpos1.func_177956_o() >= 0; blockpos1 = blockpos2) { - Block block = chunk.func_150810_a(p_72825_1_, k, p_72825_2_); + blockpos2 = blockpos1.func_177977_b(); +- Material material = chunk.func_177428_a(blockpos2).func_149688_o(); ++ Block block = chunk.func_177428_a(blockpos2); -- if (block.func_149688_o().func_76230_c() && block.func_149688_o() != Material.field_151584_j) -+ if (block.func_149688_o().func_76230_c() && block.func_149688_o() != Material.field_151584_j && !block.isFoliage(this, x, k, z)) +- if (material.func_76230_c() && material != Material.field_151584_j) ++ if (block.func_149688_o().func_76230_c() && block.isLeaves(this, blockpos2) && !block.isFoliage(this, blockpos2)) { - return k + 1; + break; } -@@ -1621,7 +1761,13 @@ +@@ -1456,6 +1553,12 @@ @SideOnly(Side.CLIENT) public float func_72880_h(float p_72880_1_) { -- float f1 = this.func_72826_c(p_72880_1_); -+ return field_73011_w.getStarBrightness(p_72880_1_); ++ return this.field_73011_w.getStarBrightness(p_72880_1_); + } + + @SideOnly(Side.CLIENT) -+ public float getStarBrightnessBody(float par1) ++ public float getStarBrightnessBody(float p_72880_1_) + { -+ float f1 = this.func_72826_c(par1); + float f1 = this.func_72826_c(p_72880_1_); float f2 = 1.0F - (MathHelper.func_76134_b(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.25F); - - if (f2 < 0.0F) -@@ -1675,7 +1821,15 @@ + f2 = MathHelper.func_76131_a(f2, 0.0F, 1.0F); +@@ -1500,7 +1603,15 @@ entity.func_85029_a(crashreportcategory); } @@ -428,12 +353,11 @@ } if (entity.field_70128_L) -@@ -1737,7 +1891,16 @@ +@@ -1562,7 +1673,16 @@ crashreport = CrashReport.func_85055_a(throwable1, "Ticking entity"); crashreportcategory = crashreport.func_85058_a("Entity being ticked"); entity.func_85029_a(crashreportcategory); - throw new ReportedException(crashreport); -+ + if (ForgeModContainer.removeErroringEntities) + { + FMLLog.severe(crashreport.func_71502_e()); @@ -443,37 +367,29 @@ + { + throw new ReportedException(crashreport); + } ++ } } -@@ -1780,7 +1943,16 @@ - crashreport = CrashReport.func_85055_a(throwable, "Ticking block entity"); - crashreportcategory = crashreport.func_85058_a("Block entity being ticked"); - tileentity.func_145828_a(crashreportcategory); -- throw new ReportedException(crashreport); -+ if (ForgeModContainer.removeErroringTileEntities) -+ { -+ FMLLog.severe(crashreport.func_71502_e()); -+ tileentity.func_145843_s(); -+ func_147468_f(tileentity.field_145851_c, tileentity.field_145848_d, tileentity.field_145849_e); -+ } -+ else -+ { -+ throw new ReportedException(crashreport); -+ } - } - } - -@@ -1794,7 +1966,7 @@ - - if (chunk != null) - { -- chunk.func_150805_f(tileentity.field_145851_c & 15, tileentity.field_145848_d, tileentity.field_145849_e & 15); -+ chunk.removeInvalidTileEntity(tileentity.field_145851_c & 15, tileentity.field_145848_d, tileentity.field_145849_e & 15); +@@ -1609,7 +1729,16 @@ + CrashReport crashreport1 = CrashReport.func_85055_a(throwable, "Ticking block entity"); + CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Block entity being ticked"); + tileentity.func_145828_a(crashreportcategory1); +- throw new ReportedException(crashreport1); ++ if (ForgeModContainer.removeErroringTileEntities) ++ { ++ FMLLog.severe(crashreport1.func_71502_e()); ++ tileentity.func_145843_s(); ++ this.func_175713_t(tileentity.func_174877_v()); ++ } ++ else ++ { ++ throw new ReportedException(crashreport1); ++ } } } } -@@ -1802,6 +1974,10 @@ +@@ -1628,6 +1757,10 @@ if (!this.field_147483_b.isEmpty()) { @@ -481,188 +397,125 @@ + { + ((TileEntity)tile).onChunkUnload(); + } + this.field_175730_i.removeAll(this.field_147483_b); this.field_147482_g.removeAll(this.field_147483_b); this.field_147483_b.clear(); - } -@@ -1822,18 +1998,18 @@ - { - this.field_147482_g.add(tileentity1); - } -- -+ } -+ else -+ { - if (this.func_72916_c(tileentity1.field_145851_c >> 4, tileentity1.field_145849_e >> 4)) - { - Chunk chunk1 = this.func_72964_e(tileentity1.field_145851_c >> 4, tileentity1.field_145849_e >> 4); +@@ -1668,7 +1801,8 @@ - if (chunk1 != null) - { -- chunk1.func_150812_a(tileentity1.field_145851_c & 15, tileentity1.field_145848_d, tileentity1.field_145849_e & 15, tileentity1); -+ chunk1.removeInvalidTileEntity(tileentity1.field_145851_c & 15, tileentity1.field_145848_d, tileentity1.field_145849_e & 15); - } - } -- -- this.func_147471_g(tileentity1.field_145851_c, tileentity1.field_145848_d, tileentity1.field_145849_e); - } - } - -@@ -1846,14 +2022,11 @@ - - public void func_147448_a(Collection p_147448_1_) + public boolean func_175700_a(TileEntity p_175700_1_) { -- if (this.field_147481_N) +- boolean flag = this.field_147482_g.add(p_175700_1_); + List dest = field_147481_N ? field_147484_a : field_147482_g; -+ for(TileEntity entity : (Collection)p_147448_1_) - { -- this.field_147484_a.addAll(p_147448_1_); -+ if(entity.canUpdate()) dest.add(entity); - } -- else -- { -- this.field_147482_g.addAll(p_147448_1_); -- } - } ++ boolean flag = dest.add(p_175700_1_); - public void func_72870_g(Entity p_72870_1_) -@@ -1865,10 +2038,19 @@ + if (flag && p_175700_1_ instanceof IUpdatePlayerListBox) + { +@@ -1710,9 +1844,12 @@ { int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t); int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v); - byte b0 = 32; + boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(i >> 4, j >> 4)); + byte b0 = isForced ? (byte)0 : 32; -+ boolean canUpdate = !p_72866_2_ || this.func_72904_c(i - b0, 0, j - b0, i + b0, 0, j + b0); ++ boolean canUpdate = !p_72866_2_ || this.func_175663_a(i - b0, 0, j - b0, i + b0, 0, j + b0, true); ++ if (!canUpdate) canUpdate = net.minecraftforge.event.ForgeEventFactory.canEntityUpdate(p_72866_1_); -- if (!p_72866_2_ || this.func_72904_c(i - b0, 0, j - b0, i + b0, 0, j + b0)) -+ if (!canUpdate) - { -+ EntityEvent.CanUpdate event = new EntityEvent.CanUpdate(p_72866_1_); -+ MinecraftForge.EVENT_BUS.post(event); -+ canUpdate = event.canUpdate; -+ } -+ +- if (!p_72866_2_ || this.func_175663_a(i - b0, 0, j - b0, i + b0, 0, j + b0, true)) + if (canUpdate) -+ { + { p_72866_1_.field_70142_S = p_72866_1_.field_70165_t; p_72866_1_.field_70137_T = p_72866_1_.field_70163_u; - p_72866_1_.field_70136_U = p_72866_1_.field_70161_v; -@@ -2086,6 +2268,10 @@ +@@ -1839,7 +1976,7 @@ + { + Block block = this.func_180495_p(new BlockPos(k1, l1, i2)).func_177230_c(); + +- if (block.func_149688_o() != Material.field_151579_a) ++ if (block.isAir(this, new BlockPos(k1, l1, i2))) + { + return true; + } +@@ -1901,6 +2038,10 @@ { return true; } -+ else ++ else if (block.isBurning(this, new BlockPos(k1, l1, i2))) + { -+ if (block.isBurning(this, k1, l1, i2)) return true; ++ return true; + } } } } -@@ -2378,13 +2564,15 @@ - - public void func_147455_a(int p_147455_1_, int p_147455_2_, int p_147455_3_, TileEntity p_147455_4_) - { -- if (p_147455_4_ != null && !p_147455_4_.func_145837_r()) -+ if (p_147455_4_ == null || p_147455_4_.func_145837_r()) - { -+ return; -+ } -+ -+ if (p_147455_4_.canUpdate()) -+ { - if (this.field_147481_N) - { -- p_147455_4_.field_145851_c = p_147455_1_; -- p_147455_4_.field_145848_d = p_147455_2_; -- p_147455_4_.field_145849_e = p_147455_3_; - Iterator iterator = this.field_147484_a.iterator(); - - while (iterator.hasNext()) -@@ -2403,40 +2591,22 @@ +@@ -2185,19 +2326,28 @@ else { - this.field_147482_g.add(p_147455_4_); -- Chunk chunk = this.func_72964_e(p_147455_1_ >> 4, p_147455_3_ >> 4); -- -- if (chunk != null) -- { -- chunk.func_150812_a(p_147455_1_ & 15, p_147455_2_, p_147455_3_ & 15, p_147455_4_); -- } + this.func_175700_a(p_175690_2_); +- this.func_175726_f(p_175690_1_).func_177426_a(p_175690_1_, p_175690_2_); ++ Chunk chunk = this.func_175726_f(p_175690_1_); //Forge add NPE protection ++ if (chunk != null) chunk.func_177426_a(p_175690_1_, p_175690_2_); } ++ this.func_175666_e(p_175690_1_, func_180495_p(p_175690_1_).func_177230_c()); //Notify neighbors of changes } -+ Chunk chunk = this.func_72964_e(p_147455_1_ >> 4, p_147455_3_ >> 4); -+ if (chunk != null) -+ { -+ chunk.func_150812_a(p_147455_1_ & 15, p_147455_2_, p_147455_3_ & 15, p_147455_4_); -+ } -+ //notify tile changes -+ func_147453_f(p_147455_1_, p_147455_2_, p_147455_3_, func_147439_a(p_147455_1_, p_147455_2_, p_147455_3_)); } - public void func_147475_p(int p_147475_1_, int p_147475_2_, int p_147475_3_) + public void func_175713_t(BlockPos p_175713_1_) { -- TileEntity tileentity = this.func_147438_o(p_147475_1_, p_147475_2_, p_147475_3_); -- -- if (tileentity != null && this.field_147481_N) -- { -- tileentity.func_145843_s(); -- this.field_147484_a.remove(tileentity); -- } -- else -- { -- if (tileentity != null) -- { -- this.field_147484_a.remove(tileentity); -- this.field_147482_g.remove(tileentity); -- } -- -- Chunk chunk = this.func_72964_e(p_147475_1_ >> 4, p_147475_3_ >> 4); -- -- if (chunk != null) -- { -- chunk.func_150805_f(p_147475_1_ & 15, p_147475_2_, p_147475_3_ & 15); -- } -- } -+ Chunk chunk = func_72964_e(p_147475_1_ >> 4, p_147475_3_ >> 4); -+ if (chunk != null) chunk.func_150805_f(p_147475_1_ & 15, p_147475_2_, p_147475_3_ & 15); -+ func_147453_f(p_147475_1_, p_147475_2_, p_147475_3_, func_147439_a(p_147475_1_, p_147475_2_, p_147475_3_)); ++ //Chunk chunk = this.getChunkFromBlockCoords(pos); ++ //if (chunk != null) chunk.removeTileEntity(pos); ++ //Forge ToDO: Are these patches needed anymore? ++ + TileEntity tileentity = this.func_175625_s(p_175713_1_); + + if (tileentity != null && this.field_147481_N) + { + tileentity.func_145843_s(); + this.field_147484_a.remove(tileentity); ++ if (!(tileentity instanceof IUpdatePlayerListBox)) //Forge: If they are not tickable they wont be removed in the update loop. ++ this.field_147482_g.remove(tileentity); ++ + } + else + { +@@ -2210,6 +2360,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_) -@@ -2453,8 +2623,7 @@ - public static boolean func_147466_a(IBlockAccess p_147466_0_, int p_147466_1_, int p_147466_2_, int p_147466_3_) +@@ -2228,7 +2379,7 @@ { - Block block = p_147466_0_.func_147439_a(p_147466_1_, p_147466_2_, p_147466_3_); -- int l = p_147466_0_.func_72805_g(p_147466_1_, p_147466_2_, p_147466_3_); -- return block.func_149688_o().func_76218_k() && block.func_149686_d() ? true : (block instanceof BlockStairs ? (l & 4) == 4 : (block instanceof BlockSlab ? (l & 8) == 8 : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? (l & 7) == 7 : false)))); -+ return block.isSideSolid(p_147466_0_, p_147466_1_, p_147466_2_, p_147466_3_, ForgeDirection.UP); + IBlockState iblockstate = p_175683_0_.func_180495_p(p_175683_1_); + Block block = iblockstate.func_177230_c(); +- return block.func_149688_o().func_76218_k() && block.func_149686_d() ? true : (block instanceof BlockStairs ? iblockstate.func_177229_b(BlockStairs.field_176308_b) == BlockStairs.EnumHalf.TOP : (block instanceof BlockSlab ? iblockstate.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? ((Integer)iblockstate.func_177229_b(BlockSnow.field_176315_a)).intValue() == 7 : false)))); ++ return block.isSideSolid(p_175683_0_, p_175683_1_, EnumFacing.UP); } - public boolean func_147445_c(int p_147445_1_, int p_147445_2_, int p_147445_3_, boolean p_147445_4_) -@@ -2466,7 +2635,7 @@ - if (chunk != null && !chunk.func_76621_g()) - { - Block block = this.func_147439_a(p_147445_1_, p_147445_2_, p_147445_3_); -- return block.func_149688_o().func_76218_k() && block.func_149686_d(); -+ return block.isNormalCube(this, p_147445_1_, p_147445_2_, p_147445_3_); - } + public boolean func_175677_d(BlockPos p_175677_1_, boolean p_175677_2_) +@@ -2248,7 +2399,7 @@ else { -@@ -2491,8 +2660,7 @@ + Block block = this.func_180495_p(p_175677_1_).func_177230_c(); +- return block.func_149688_o().func_76218_k() && block.func_149686_d(); ++ return block.isNormalCube(this, p_175677_1_); + } + } + } +@@ -2265,8 +2416,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_; -+ field_73011_w.setAllowedSpawnTypes(p_72891_1_, p_72891_2_); ++ this.field_73011_w.setAllowedSpawnTypes(p_72891_1_, p_72891_2_); } public void func_72835_b() -@@ -2502,6 +2670,11 @@ +@@ -2276,6 +2426,11 @@ - private void func_72947_a() + protected void func_72947_a() { -+ field_73011_w.calculateInitialWeather(); ++ this.field_73011_w.calculateInitialWeather(); + } + + public void calculateInitialWeatherBody() @@ -670,19 +523,19 @@ if (this.field_72986_A.func_76059_o()) { this.field_73004_o = 1.0F; -@@ -2515,6 +2688,11 @@ +@@ -2289,6 +2444,11 @@ protected void func_72979_l() { -+ field_73011_w.updateWeather(); ++ this.field_73011_w.updateWeather(); + } + + public void updateWeatherBody() + { - if (!this.field_73011_w.field_76576_e) + if (!this.field_73011_w.func_177495_o()) { if (!this.field_72995_K) -@@ -2599,6 +2777,7 @@ +@@ -2383,6 +2543,7 @@ { this.field_72993_I.clear(); this.field_72984_F.func_76320_a("buildList"); @@ -690,95 +543,105 @@ int i; EntityPlayer entityplayer; int j; -@@ -2693,6 +2872,11 @@ +@@ -2445,7 +2606,7 @@ + l += p_147467_1_; + i1 += p_147467_2_; - public boolean func_72834_c(int p_72834_1_, int p_72834_2_, int p_72834_3_, boolean p_72834_4_) +- if (block.func_149688_o() == Material.field_151579_a && this.func_175699_k(blockpos) <= this.field_73012_v.nextInt(8) && this.func_175642_b(EnumSkyBlock.SKY, blockpos) <= 0) ++ if (block.isAir(this, blockpos) && this.func_175699_k(blockpos) <= this.field_73012_v.nextInt(8) && this.func_175642_b(EnumSkyBlock.SKY, blockpos) <= 0) + { + EntityPlayer entityplayer = this.func_72977_a((double)l + 0.5D, (double)j1 + 0.5D, (double)i1 + 0.5D, 8.0D); + +@@ -2485,6 +2646,11 @@ + + public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_) { -+ return field_73011_w.canBlockFreeze(p_72834_1_, p_72834_2_, p_72834_3_, p_72834_4_); ++ return this.field_73011_w.canBlockFreeze(p_175670_1_, p_175670_2_); + } + -+ public boolean canBlockFreezeBody(int p_72834_1_, int p_72834_2_, int p_72834_3_, boolean p_72834_4_) ++ public boolean canBlockFreezeBody(BlockPos p_175670_1_, boolean p_175670_2_) + { - BiomeGenBase biomegenbase = this.func_72807_a(p_72834_1_, p_72834_3_); - float f = biomegenbase.func_150564_a(p_72834_1_, p_72834_2_, p_72834_3_); + BiomeGenBase biomegenbase = this.func_180494_b(p_175670_1_); + float f = biomegenbase.func_180626_a(p_175670_1_); -@@ -2748,6 +2932,11 @@ +@@ -2526,6 +2692,11 @@ - public boolean func_147478_e(int p_147478_1_, int p_147478_2_, int p_147478_3_, boolean p_147478_4_) + public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_) { -+ return field_73011_w.canSnowAt(p_147478_1_, p_147478_2_, p_147478_3_, p_147478_4_); ++ return this.field_73011_w.canSnowAt(p_175708_1_, p_175708_2_); + } + -+ public boolean canSnowAtBody(int p_147478_1_, int p_147478_2_, int p_147478_3_, boolean p_147478_4_) ++ public boolean canSnowAtBody(BlockPos p_175708_1_, boolean p_175708_2_) + { - BiomeGenBase biomegenbase = this.func_72807_a(p_147478_1_, p_147478_3_); - float f = biomegenbase.func_150564_a(p_147478_1_, p_147478_2_, p_147478_3_); + BiomeGenBase biomegenbase = this.func_180494_b(p_175708_1_); + float f = biomegenbase.func_180626_a(p_175708_1_); -@@ -2797,10 +2986,11 @@ +@@ -2543,7 +2714,7 @@ + { + Block block = this.func_180495_p(p_175708_1_).func_177230_c(); + +- if (block.func_149688_o() == Material.field_151579_a && Blocks.field_150431_aC.func_176196_c(this, p_175708_1_)) ++ if (block.isAir(this, p_175708_1_) && Blocks.field_150431_aC.func_176196_c(this, p_175708_1_)) + { + return true; + } +@@ -2575,10 +2746,11 @@ else { - Block block = this.func_147439_a(p_98179_1_, p_98179_2_, p_98179_3_); -- int l = p_98179_4_ == EnumSkyBlock.Sky ? 0 : block.func_149750_m(); -- int i1 = block.func_149717_k(); -+ int blockLight = block.getLightValue(this, p_98179_1_, p_98179_2_, p_98179_3_); -+ int l = p_98179_4_ == EnumSkyBlock.Sky ? 0 : blockLight; -+ int i1 = block.getLightOpacity(this, p_98179_1_, p_98179_2_, p_98179_3_); + Block block = this.func_180495_p(p_175638_1_).func_177230_c(); +- int i = p_175638_2_ == EnumSkyBlock.SKY ? 0 : block.func_149750_m(); +- int j = block.func_149717_k(); ++ int blockLight = block.getLightValue(this, p_175638_1_); ++ int i = p_175638_2_ == EnumSkyBlock.SKY ? 0 : blockLight; ++ int j = block.getLightOpacity(this, p_175638_1_); -- if (i1 >= 15 && block.func_149750_m() > 0) -+ if (i1 >= 15 && blockLight > 0) +- if (j >= 15 && block.func_149750_m() > 0) ++ if (j >= 15 && blockLight > 0) { - i1 = 1; + j = 1; } -@@ -2900,7 +3090,7 @@ - int j4 = i2 + Facing.field_71586_b[i4]; - int k4 = j2 + Facing.field_71587_c[i4]; - int l4 = k2 + Facing.field_71585_d[i4]; -- int i5 = Math.max(1, this.func_147439_a(j4, k4, l4).func_149717_k()); -+ int i5 = Math.max(1, this.func_147439_a(j4, k4, l4).getLightOpacity(this, j4, k4, l4)); - i3 = this.func_72972_b(p_147463_1_, j4, k4, l4); - - if (i3 == l2 - i5 && i1 < this.field_72994_J.length) -@@ -2998,10 +3188,10 @@ - public List func_94576_a(Entity p_94576_1_, AxisAlignedBB p_94576_2_, IEntitySelector p_94576_3_) +@@ -2792,10 +2964,10 @@ + public List func_175674_a(Entity p_175674_1_, AxisAlignedBB p_175674_2_, Predicate p_175674_3_) { - ArrayList arraylist = new ArrayList(); -- int i = MathHelper.func_76128_c((p_94576_2_.field_72340_a - 2.0D) / 16.0D); -- int j = MathHelper.func_76128_c((p_94576_2_.field_72336_d + 2.0D) / 16.0D); -- int k = MathHelper.func_76128_c((p_94576_2_.field_72339_c - 2.0D) / 16.0D); -- int l = MathHelper.func_76128_c((p_94576_2_.field_72334_f + 2.0D) / 16.0D); -+ int i = MathHelper.func_76128_c((p_94576_2_.field_72340_a - MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.func_76128_c((p_94576_2_.field_72336_d + MAX_ENTITY_RADIUS) / 16.0D); -+ int k = MathHelper.func_76128_c((p_94576_2_.field_72339_c - MAX_ENTITY_RADIUS) / 16.0D); -+ int l = MathHelper.func_76128_c((p_94576_2_.field_72334_f + MAX_ENTITY_RADIUS) / 16.0D); + ArrayList arraylist = 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) { -@@ -3024,10 +3214,10 @@ +@@ -2854,10 +3026,10 @@ - public List func_82733_a(Class p_82733_1_, AxisAlignedBB p_82733_2_, IEntitySelector p_82733_3_) + public List func_175647_a(Class p_175647_1_, AxisAlignedBB p_175647_2_, Predicate p_175647_3_) { -- int i = MathHelper.func_76128_c((p_82733_2_.field_72340_a - 2.0D) / 16.0D); -- int j = MathHelper.func_76128_c((p_82733_2_.field_72336_d + 2.0D) / 16.0D); -- int k = MathHelper.func_76128_c((p_82733_2_.field_72339_c - 2.0D) / 16.0D); -- int l = MathHelper.func_76128_c((p_82733_2_.field_72334_f + 2.0D) / 16.0D); -+ int i = MathHelper.func_76128_c((p_82733_2_.field_72340_a - MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.func_76128_c((p_82733_2_.field_72336_d + MAX_ENTITY_RADIUS) / 16.0D); -+ int k = MathHelper.func_76128_c((p_82733_2_.field_72339_c - MAX_ENTITY_RADIUS) / 16.0D); -+ int l = MathHelper.func_76128_c((p_82733_2_.field_72334_f + MAX_ENTITY_RADIUS) / 16.0D); - ArrayList arraylist = new ArrayList(); +- int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - 2.0D) / 16.0D); +- int j = MathHelper.func_76128_c((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_76128_c((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_76128_c((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_76128_c((p_175647_2_.field_72334_f + MAX_ENTITY_RADIUS) / 16.0D); + ArrayList arraylist = Lists.newArrayList(); for (int i1 = i; i1 <= j; ++i1) -@@ -3104,11 +3294,14 @@ +@@ -2938,13 +3110,16 @@ - public void func_72868_a(List p_72868_1_) + public void func_175650_b(Collection p_175650_1_) { -- this.field_72996_f.addAll(p_72868_1_); -- - for (int i = 0; i < p_72868_1_.size(); ++i) +- this.field_72996_f.addAll(p_175650_1_); + Iterator iterator = p_175650_1_.iterator(); + + while (iterator.hasNext()) { -- this.func_72923_a((Entity)p_72868_1_.get(i)); -+ Entity entity = (Entity)p_72868_1_.get(i); -+ if (!MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(entity, this))) + Entity entity = (Entity)iterator.next(); +- this.func_72923_a(entity); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity, this))) + { + field_72996_f.add(entity); + this.func_72923_a(entity); @@ -786,109 +649,110 @@ } } -@@ -3121,7 +3314,7 @@ +@@ -2957,7 +3132,9 @@ { - Block block1 = this.func_147439_a(p_147472_2_, p_147472_3_, p_147472_4_); - AxisAlignedBB axisalignedbb = p_147472_5_ ? null : p_147472_1_.func_149668_a(this, p_147472_2_, p_147472_3_, p_147472_4_); -- return axisalignedbb != null && !this.func_72917_a(axisalignedbb, p_147472_7_) ? false : (block1.func_149688_o() == Material.field_151594_q && p_147472_1_ == Blocks.field_150467_bQ ? true : block1.func_149688_o().func_76222_j() && p_147472_1_.func_149705_a(this, p_147472_2_, p_147472_3_, p_147472_4_, p_147472_6_, p_147472_8_)); -+ return axisalignedbb != null && !this.func_72917_a(axisalignedbb, p_147472_7_) ? false : (block1.func_149688_o() == Material.field_151594_q && p_147472_1_ == Blocks.field_150467_bQ ? true : block1.isReplaceable(this, p_147472_2_, p_147472_3_, p_147472_4_) && p_147472_1_.func_149705_a(this, p_147472_2_, p_147472_3_, p_147472_4_, p_147472_6_, p_147472_8_)); + Block block1 = this.func_180495_p(p_175716_2_).func_177230_c(); + AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.func_180640_a(this, p_175716_2_, p_175716_1_.func_176223_P()); +- return axisalignedbb != null && !this.func_72917_a(axisalignedbb, p_175716_5_) ? false : (block1.func_149688_o() == Material.field_151594_q && p_175716_1_ == Blocks.field_150467_bQ ? true : block1.func_149688_o().func_76222_j() && p_175716_1_.func_176193_a(this, p_175716_2_, p_175716_4_, p_175716_6_)); ++ if (axisalignedbb != null && !this.func_72917_a(axisalignedbb, p_175716_5_)) return false; ++ if (block1.func_149688_o() == Material.field_151594_q && p_175716_1_ == Blocks.field_150467_bQ) return true; ++ return block1.func_176200_f(this, p_175716_2_) && p_175716_1_.func_176193_a(this, p_175716_2_, p_175716_4_, p_175716_6_); } - public PathEntity func_72865_a(Entity p_72865_1_, Entity p_72865_2_, float p_72865_3_, boolean p_72865_4_, boolean p_72865_5_, boolean p_72865_6_, boolean p_72865_7_) -@@ -3226,7 +3419,8 @@ - - public int func_72878_l(int p_72878_1_, int p_72878_2_, int p_72878_3_, int p_72878_4_) + public int func_175627_a(BlockPos p_175627_1_, EnumFacing p_175627_2_) +@@ -3032,7 +3209,7 @@ { -- return this.func_147439_a(p_72878_1_, p_72878_2_, p_72878_3_).func_149721_r() ? this.func_94577_B(p_72878_1_, p_72878_2_, p_72878_3_) : this.func_147439_a(p_72878_1_, p_72878_2_, p_72878_3_).func_149709_b(this, p_72878_1_, p_72878_2_, p_72878_3_, p_72878_4_); -+ Block block = this.func_147439_a(p_72878_1_, p_72878_2_, p_72878_3_); -+ return block.shouldCheckWeakPower(this, p_72878_1_, p_72878_2_, p_72878_3_, p_72878_4_) ? this.func_94577_B(p_72878_1_, p_72878_2_, p_72878_3_) : block.func_149709_b(this, p_72878_1_, p_72878_2_, p_72878_3_, p_72878_4_); + IBlockState iblockstate = this.func_180495_p(p_175651_1_); + Block block = iblockstate.func_177230_c(); +- return block.func_149721_r() ? this.func_175676_y(p_175651_1_) : block.func_180656_a(this, p_175651_1_, iblockstate, p_175651_2_); ++ return block.shouldCheckWeakPower(this, p_175651_1_, p_175651_2_) ? this.func_175676_y(p_175651_1_) : block.func_180656_a(this, p_175651_1_, iblockstate, p_175651_2_); } - public boolean func_72864_z(int p_72864_1_, int p_72864_2_, int p_72864_3_) -@@ -3374,7 +3568,7 @@ + public boolean func_175640_z(BlockPos p_175640_1_) +@@ -3160,7 +3337,7 @@ public long func_72905_C() { - return this.field_72986_A.func_76063_b(); -+ return field_73011_w.getSeed(); ++ return this.field_73011_w.getSeed(); } public long func_82737_E() -@@ -3384,22 +3578,22 @@ +@@ -3170,17 +3347,17 @@ public long func_72820_D() { - return this.field_72986_A.func_76073_f(); -+ return field_73011_w.getWorldTime(); ++ 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_); -+ field_73011_w.setWorldTime(p_72877_1_); ++ this.field_73011_w.setWorldTime(p_72877_1_); } - public ChunkCoordinates func_72861_E() + public BlockPos func_175694_M() { -- return new ChunkCoordinates(this.field_72986_A.func_76079_c(), this.field_72986_A.func_76075_d(), this.field_72986_A.func_76074_e()); -+ return field_73011_w.getSpawnPoint(); - } +- 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(); - public void func_72950_A(int p_72950_1_, int p_72950_2_, int p_72950_3_) + if (!this.func_175723_af().func_177746_a(blockpos)) + { +@@ -3192,7 +3369,7 @@ + + public void func_175652_B(BlockPos p_175652_1_) { -- this.field_72986_A.func_76081_a(p_72950_1_, p_72950_2_, p_72950_3_); -+ field_73011_w.setSpawnPoint(p_72950_1_, p_72950_2_, p_72950_3_); +- this.field_72986_A.func_176143_a(p_175652_1_); ++ this.field_73011_w.setSpawnPoint(p_175652_1_); } @SideOnly(Side.CLIENT) -@@ -3419,12 +3613,20 @@ +@@ -3212,12 +3389,18 @@ if (!this.field_72996_f.contains(p_72897_1_)) { -- this.field_72996_f.add(p_72897_1_); -+ if (!MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(p_72897_1_, this))) -+ { -+ this.field_72996_f.add(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_72962_a(EntityPlayer p_72962_1_, int p_72962_2_, int p_72962_3_, int p_72962_4_) + public boolean func_175660_a(EntityPlayer p_175660_1_, BlockPos p_175660_2_) { -+ return field_73011_w.canMineBlock(p_72962_1_, p_72962_2_, p_72962_3_, p_72962_4_); ++ return this.field_73011_w.canMineBlock(p_175660_1_, p_175660_2_); + } + -+ public boolean canMineBlockBody(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) ++ public boolean canMineBlockBody(EntityPlayer p_175660_1_, BlockPos p_175660_2_) + { return true; } -@@ -3514,8 +3716,7 @@ +@@ -3307,8 +3490,7 @@ - public boolean func_72958_C(int p_72958_1_, int p_72958_2_, int p_72958_3_) + public boolean func_180502_D(BlockPos p_180502_1_) { -- BiomeGenBase biomegenbase = this.func_72807_a(p_72958_1_, p_72958_3_); +- BiomeGenBase biomegenbase = this.func_180494_b(p_180502_1_); - return biomegenbase.func_76736_e(); -+ return field_73011_w.isBlockHighHumidity(p_72958_1_, p_72958_2_, p_72958_3_); ++ return this.field_73011_w.isBlockHighHumidity(p_180502_1_); } - public void func_72823_a(String p_72823_1_, WorldSavedData p_72823_2_) -@@ -3569,12 +3770,12 @@ + public MapStorage func_175693_T() +@@ -3367,12 +3549,12 @@ public int func_72800_K() { - return 256; -+ return field_73011_w.getHeight(); ++ return this.field_73011_w.getHeight(); } public int func_72940_L() { -- return this.field_73011_w.field_76576_e ? 128 : 256; -+ return field_73011_w.getActualHeight(); +- 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_) -@@ -3598,7 +3799,7 @@ +@@ -3429,7 +3611,7 @@ @SideOnly(Side.CLIENT) public double func_72919_O() { @@ -896,106 +760,81 @@ + return field_73011_w.getHorizon(); } - public CrashReportCategory func_72914_a(CrashReport p_72914_1_) -@@ -3663,25 +3864,24 @@ + public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_) +@@ -3461,29 +3643,21 @@ - public void func_147453_f(int p_147453_1_, int p_147453_2_, int p_147453_3_, Block p_147453_4_) + public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) { -- for (int l = 0; l < 4; ++l) -+ for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) +- Iterator iterator = EnumFacing.Plane.HORIZONTAL.iterator(); +- +- while (iterator.hasNext()) ++ for (EnumFacing enumfacing : EnumFacing.values()) { -- int i1 = p_147453_1_ + Direction.field_71583_a[l]; -- int j1 = p_147453_3_ + Direction.field_71581_b[l]; -- Block block1 = this.func_147439_a(i1, p_147453_2_, j1); -+ int i1 = p_147453_1_ + dir.offsetX; -+ int y = p_147453_2_ + dir.offsetY; -+ int j1 = p_147453_3_ + dir.offsetZ; -+ Block block1 = this.func_147439_a(i1, y, j1); +- EnumFacing enumfacing = (EnumFacing)iterator.next(); + BlockPos blockpos1 = p_175666_1_.func_177972_a(enumfacing); -- if (Blocks.field_150441_bU.func_149907_e(block1)) -+ block1.onNeighborChange(this, i1, y, j1, p_147453_1_, p_147453_2_, p_147453_3_); -+ if (block1.isNormalCube(this, i1, p_147453_2_, j1)) + if (this.func_175667_e(blockpos1)) { -- block1.func_149695_a(this, i1, p_147453_2_, j1, p_147453_4_); -- } -- else if (block1.func_149721_r()) -- { -- i1 += Direction.field_71583_a[l]; -- j1 += Direction.field_71581_b[l]; -- Block block2 = this.func_147439_a(i1, p_147453_2_, j1); -+ i1 += dir.offsetX; -+ y += dir.offsetY; -+ j1 += dir.offsetZ; -+ Block block2 = this.func_147439_a(i1, y, j1); - -- if (Blocks.field_150441_bU.func_149907_e(block2)) -+ if (block2.getWeakChanges(this, i1, y, j1)) + IBlockState iblockstate = this.func_180495_p(blockpos1); +- +- if (Blocks.field_150441_bU.func_149907_e(iblockstate.func_177230_c())) ++ iblockstate.func_177230_c().onNeighborChange(this, blockpos1, p_175666_1_); ++ if (iblockstate.func_177230_c().isNormalCube(this, blockpos1)) { -- block2.func_149695_a(this, i1, p_147453_2_, j1, p_147453_4_); -+ block2.onNeighborChange(this, i1, y, j1, p_147453_1_, p_147453_2_, p_147453_3_); +- iblockstate.func_177230_c().func_176204_a(this, blockpos1, iblockstate, p_175666_2_); +- } +- else if (iblockstate.func_177230_c().func_149721_r()) +- { +- blockpos1 = blockpos1.func_177972_a(enumfacing); +- iblockstate = this.func_180495_p(blockpos1); +- +- if (Blocks.field_150441_bU.func_149907_e(iblockstate.func_177230_c())) ++ BlockPos posOther = blockpos1.func_177972_a(enumfacing); ++ Block other = func_180495_p(posOther).func_177230_c(); ++ if (other.getWeakChanges(this, posOther)) + { +- iblockstate.func_177230_c().func_176204_a(this, blockpos1, iblockstate, p_175666_2_); ++ other.onNeighborChange(this, posOther, p_175666_1_); + } } } - } -@@ -3722,4 +3922,110 @@ - iworldaccess.func_147584_b(); - } +@@ -3553,4 +3727,82 @@ + short short1 = 128; + return k >= -short1 && k <= short1 && l >= -short1 && l <= short1; } + + + /* ======================================== FORGE START =====================================*/ + /** -+ * Adds a single TileEntity to the world. -+ * @param entity The TileEntity to be added. -+ */ -+ public void addTileEntity(TileEntity entity) -+ { -+ List dest = field_147481_N ? field_147484_a : field_147482_g; -+ if(entity.canUpdate()) -+ { -+ dest.add(entity); -+ } -+ } -+ -+ /** + * Determine if the given block is considered solid on the + * specified side. Used by placement logic. + * -+ * @param x Block X Position -+ * @param y Block Y Position -+ * @param z Block Z Position ++ * @param pos Block Position + * @param side The Side in question + * @return True if the side is solid -+ */ -+ public boolean isSideSolid(int x, int y, int z, ForgeDirection side) ++ */ ++ public boolean isSideSolid(BlockPos pos, EnumFacing side) + { -+ return isSideSolid(x, y, z, side, false); ++ return isSideSolid(pos, side, false); + } + + /** + * Determine if the given block is considered solid on the + * specified side. Used by placement logic. + * -+ * @param x Block X Position -+ * @param y Block Y Position -+ * @param z Block Z Position ++ * @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(int x, int y, int z, ForgeDirection side, boolean _default) ++ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) + { -+ if (x < -30000000 || z < -30000000 || x >= 30000000 || z >= 30000000) -+ { -+ return _default; -+ } ++ if (!this.func_175701_a(pos)) return _default; + -+ Chunk chunk = this.field_73020_y.func_73154_d(x >> 4, z >> 4); -+ if (chunk == null || chunk.func_76621_g()) -+ { -+ return _default; -+ } -+ return func_147439_a(x, y, z).isSideSolid(this, x, y, z, side); ++ Chunk chunk = func_175726_f(pos); ++ if (chunk == null || chunk.func_76621_g()) return _default; ++ return func_180495_p(pos).func_177230_c().isSideSolid(this, pos, side); + } + + /** @@ -1011,24 +850,13 @@ + /** + * Readded as it was removed, very useful helper function + * -+ * @param x X position -+ * @param y Y Position -+ * @param z Z Position ++ * @param pos Block position + * @return The blocks light opacity + */ -+ public int getBlockLightOpacity(int x, int y, int z) ++ public int getBlockLightOpacity(BlockPos pos) + { -+ if (x < -30000000 || z < -30000000 || x >= 30000000 || z >= 30000000) -+ { -+ return 0; -+ } -+ -+ if (y < 0 || y >= 256) -+ { -+ return 0; -+ } -+ -+ return func_72964_e(x >> 4, z >> 4).func_150808_b(x & 15, y, z & 15); ++ if (!this.func_175701_a(pos)) return 0; ++ return func_175726_f(pos).func_177437_b(pos); + } + + /** @@ -1045,5 +873,11 @@ + } + } + return count; ++ } ++ ++ protected MapStorage perWorldStorage; //Moved to a getter to simulate final without being final so we can load in subclasses. ++ public MapStorage getPerWorldStorage() ++ { ++ return perWorldStorage; + } } diff --git a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch index 047326f7c5..83c9c82f7c 100644 --- a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -1,37 +1,11 @@ --- ../src-base/minecraft/net/minecraft/world/WorldProvider.java +++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java -@@ -2,17 +2,25 @@ - - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import net.minecraft.entity.Entity; -+import net.minecraft.entity.player.EntityPlayer; -+import net.minecraft.entity.player.EntityPlayerMP; - import net.minecraft.init.Blocks; - import net.minecraft.util.ChunkCoordinates; - import net.minecraft.util.MathHelper; - import net.minecraft.util.Vec3; -+import net.minecraft.world.WorldSettings.GameType; - import net.minecraft.world.biome.BiomeGenBase; - import net.minecraft.world.biome.WorldChunkManager; - import net.minecraft.world.biome.WorldChunkManagerHell; -+import net.minecraft.world.chunk.Chunk; - import net.minecraft.world.chunk.IChunkProvider; - import net.minecraft.world.gen.ChunkProviderFlat; - import net.minecraft.world.gen.ChunkProviderGenerate; - import net.minecraft.world.gen.FlatGeneratorInfo; -+import net.minecraft.world.storage.WorldInfo; -+import net.minecraftforge.client.IRenderHandler; -+import net.minecraftforge.common.DimensionManager; - - public abstract class WorldProvider - { -@@ -149,13 +157,13 @@ +@@ -141,13 +141,13 @@ public static WorldProvider func_76570_a(int p_76570_0_) { - return (WorldProvider)(p_76570_0_ == -1 ? new WorldProviderHell() : (p_76570_0_ == 0 ? new WorldProviderSurface() : (p_76570_0_ == 1 ? new WorldProviderEnd() : null))); -+ return DimensionManager.createProviderFor(p_76570_0_); ++ return net.minecraftforge.common.DimensionManager.createProviderFor(p_76570_0_); } @SideOnly(Side.CLIENT) @@ -42,20 +16,20 @@ } @SideOnly(Side.CLIENT) -@@ -193,4 +201,320 @@ +@@ -211,4 +211,319 @@ + { + return new WorldBorder(); } - - public abstract String func_80007_l(); + + /*======================================= Forge Start =========================================*/ -+ private IRenderHandler skyRenderer = null; -+ private IRenderHandler cloudRenderer = null; -+ private IRenderHandler weatherRenderer = null; -+ ++ private net.minecraftforge.client.IRenderHandler skyRenderer = null; ++ private net.minecraftforge.client.IRenderHandler cloudRenderer = null; ++ private net.minecraftforge.client.IRenderHandler weatherRenderer = null; ++ + /** + * Sets the providers current dimension ID, used in default getSaveFolder() + * Added to allow default providers to be registered for multiple dimensions. -+ * ++ * + * @param dim Dimension ID + */ + public void setDimension(int dim) @@ -105,7 +79,7 @@ + else if (this instanceof WorldProviderHell) + { + return "Leaving the Nether"; -+ } ++ } + return null; + } + @@ -125,66 +99,66 @@ + } + + @SideOnly(Side.CLIENT) -+ public IRenderHandler getSkyRenderer() ++ public net.minecraftforge.client.IRenderHandler getSkyRenderer() + { + return this.skyRenderer; + } + + @SideOnly(Side.CLIENT) -+ public void setSkyRenderer(IRenderHandler skyRenderer) ++ public void setSkyRenderer(net.minecraftforge.client.IRenderHandler skyRenderer) + { + this.skyRenderer = skyRenderer; + } + + @SideOnly(Side.CLIENT) -+ public IRenderHandler getCloudRenderer() ++ public net.minecraftforge.client.IRenderHandler getCloudRenderer() + { + return cloudRenderer; + } + + @SideOnly(Side.CLIENT) -+ public void setCloudRenderer(IRenderHandler renderer) ++ public void setCloudRenderer(net.minecraftforge.client.IRenderHandler renderer) + { + cloudRenderer = renderer; + } + + @SideOnly(Side.CLIENT) -+ public IRenderHandler getWeatherRenderer() ++ public net.minecraftforge.client.IRenderHandler getWeatherRenderer() + { + return weatherRenderer; + } + + @SideOnly(Side.CLIENT) -+ public void setWeatherRenderer(IRenderHandler renderer) ++ public void setWeatherRenderer(net.minecraftforge.client.IRenderHandler renderer) + { + weatherRenderer = renderer; + } + -+ public ChunkCoordinates getRandomizedSpawnPoint() ++ public BlockPos getRandomizedSpawnPoint() + { -+ ChunkCoordinates chunkcoordinates = new ChunkCoordinates(this.field_76579_a.func_72861_E()); ++ BlockPos ret = this.field_76579_a.func_175694_M(); + -+ boolean isAdventure = field_76579_a.func_72912_H().func_76077_q() == GameType.ADVENTURE; ++ boolean isAdventure = field_76579_a.func_72912_H().func_76077_q() == WorldSettings.GameType.ADVENTURE; + int spawnFuzz = field_76577_b.getSpawnFuzz(); ++ int border = MathHelper.func_76128_c(field_76579_a.func_175723_af().func_177729_b(ret.func_177958_n(), ret.func_177952_p())); ++ if (border < spawnFuzz) spawnFuzz = border; ++ if (spawnFuzz < 1) spawnFuzz = 1; + int spawnFuzzHalf = spawnFuzz / 2; + -+ if (!field_76576_e && !isAdventure) ++ if (!func_177495_o() && !isAdventure) + { -+ chunkcoordinates.field_71574_a += this.field_76579_a.field_73012_v.nextInt(spawnFuzz) - spawnFuzzHalf; -+ chunkcoordinates.field_71573_c += this.field_76579_a.field_73012_v.nextInt(spawnFuzz) - spawnFuzzHalf; -+ chunkcoordinates.field_71572_b = this.field_76579_a.func_72825_h(chunkcoordinates.field_71574_a, chunkcoordinates.field_71573_c); ++ ret = field_76579_a.func_175672_r(ret.func_177982_a(field_76579_a.field_73012_v.nextInt(spawnFuzzHalf) - spawnFuzz, 0, field_76579_a.field_73012_v.nextInt(spawnFuzzHalf) - spawnFuzz)); + } + -+ return chunkcoordinates; ++ return ret; + } -+ + /** -+ * Determine if the cusor on the map should 'spin' when rendered, like it does for the player in the nether. -+ * ++ * 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 y Y Position -+ * @param z Z Postion ++ * @param z Z Position + * @return True to 'spin' the cursor + */ + public boolean shouldMapSpin(String entity, double x, double y, double z) @@ -194,40 +168,40 @@ + + /** + * Determines the dimension the player will be respawned in, typically this brings them back to the overworld. -+ * ++ * + * @param player The player that is respawning + * @return The dimension to respawn the player in + */ -+ public int getRespawnDimension(EntityPlayerMP player) ++ public int getRespawnDimension(net.minecraft.entity.player.EntityPlayerMP player) + { + return 0; + } + + /*======================================= Start Moved From World =========================================*/ + -+ public BiomeGenBase getBiomeGenForCoords(int x, int z) ++ public BiomeGenBase getBiomeGenForCoords(BlockPos pos) + { -+ return field_76579_a.getBiomeGenForCoordsBody(x, z); ++ return field_76579_a.getBiomeGenForCoordsBody(pos); + } + + public boolean isDaytime() + { -+ return field_76579_a.field_73008_k < 4; ++ 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. @@ -239,7 +213,7 @@ + } + + @SideOnly(Side.CLIENT) -+ public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) ++ public Vec3 getSkyColor(net.minecraft.entity.Entity cameraEntity, float partialTicks) + { + return field_76579_a.getSkyColorBody(cameraEntity, partialTicks); + } @@ -258,7 +232,7 @@ + { + return field_76579_a.getSunBrightnessBody(par1); + } -+ ++ + /** + * Gets the Star Brightness for rendering sky. + * */ @@ -284,16 +258,15 @@ + field_76579_a.updateWeatherBody(); + } + -+ public boolean canBlockFreeze(int x, int y, int z, boolean byWater) ++ public boolean canBlockFreeze(BlockPos pos, boolean byWater) + { -+ return field_76579_a.canBlockFreezeBody(x, y, z, byWater); ++ return field_76579_a.canBlockFreezeBody(pos, byWater); + } + -+ public boolean canSnowAt(int x, int y, int z, boolean checkLight) ++ public boolean canSnowAt(BlockPos pos, boolean checkLight) + { -+ return field_76579_a.canSnowAtBody(x, y, z, checkLight); ++ return field_76579_a.canSnowAtBody(pos, checkLight); + } -+ + public void setWorldTime(long time) + { + field_76579_a.field_72986_A.func_76068_b(time); @@ -309,25 +282,25 @@ + return field_76579_a.field_72986_A.func_76073_f(); + } + -+ public ChunkCoordinates getSpawnPoint() ++ public BlockPos getSpawnPoint() + { -+ WorldInfo info = field_76579_a.field_72986_A; -+ return new ChunkCoordinates(info.func_76079_c(), info.func_76075_d(), info.func_76074_e()); ++ 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(int x, int y, int z) ++ public void setSpawnPoint(BlockPos pos) + { -+ field_76579_a.field_72986_A.func_76081_a(x, y, z); ++ field_76579_a.field_72986_A.func_176143_a(pos); + } + -+ public boolean canMineBlock(EntityPlayer player, int x, int y, int z) ++ public boolean canMineBlock(net.minecraft.entity.player.EntityPlayer player, BlockPos pos) + { -+ return field_76579_a.canMineBlockBody(player, x, y, z); ++ return field_76579_a.canMineBlockBody(player, pos); + } + -+ public boolean isBlockHighHumidity(int x, int y, int z) ++ public boolean isBlockHighHumidity(BlockPos pos) + { -+ return field_76579_a.func_72807_a(x, z).func_76736_e(); ++ return field_76579_a.func_180494_b(pos).func_76736_e(); + } + + public int getHeight() @@ -353,12 +326,12 @@ + field_76579_a.field_72986_A.func_76069_a(false); + } + -+ public boolean canDoLightning(Chunk chunk) ++ public boolean canDoLightning(net.minecraft.world.chunk.Chunk chunk) + { + return true; + } + -+ public boolean canDoRainSnowIce(Chunk chunk) ++ public boolean canDoRainSnowIce(net.minecraft.world.chunk.Chunk chunk) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch index 7d03e5cab7..3bc017dd5b 100644 --- a/patches/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServer.java.patch @@ -1,60 +1,56 @@ --- ../src-base/minecraft/net/minecraft/world/WorldServer.java +++ ../src-work/minecraft/net/minecraft/world/WorldServer.java -@@ -3,6 +3,7 @@ - import com.google.common.collect.Lists; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+import java.io.File; - import java.util.ArrayList; - import java.util.HashSet; - import java.util.Iterator; -@@ -50,11 +51,19 @@ - import net.minecraft.world.biome.WorldChunkManager; - import net.minecraft.world.chunk.Chunk; - import net.minecraft.world.chunk.IChunkProvider; -+import net.minecraft.world.chunk.storage.AnvilChunkLoader; - import net.minecraft.world.chunk.storage.ExtendedBlockStorage; - import net.minecraft.world.chunk.storage.IChunkLoader; - import net.minecraft.world.gen.ChunkProviderServer; - import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; - import net.minecraft.world.storage.ISaveHandler; -+import net.minecraftforge.common.ChestGenHooks; -+import static net.minecraftforge.common.ChestGenHooks.BONUS_CHEST; -+import net.minecraftforge.common.DimensionManager; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.ForgeEventFactory; -+import net.minecraftforge.event.world.WorldEvent; -+ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -@@ -79,6 +88,10 @@ - private IntHashMap field_73066_T; +@@ -94,30 +94,46 @@ + private List field_94579_S = Lists.newArrayList(); private static final String __OBFID = "CL_00001437"; + /** Stores the recently processed (lighting) chunks */ -+ protected Set doneChunks = new HashSet(); ++ protected Set doneChunks = new java.util.HashSet(); + public List customTeleporters = new ArrayList(); ++ private static boolean initChest = false; ++ public static void fillChestHook() ++ { ++ if (!initChest) ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.BONUS_CHEST, field_73069_S, 10, 10); ++ initChest = true; ++ } + - public WorldServer(MinecraftServer p_i45284_1_, ISaveHandler p_i45284_2_, String p_i45284_3_, int p_i45284_4_, WorldSettings p_i45284_5_, Profiler p_i45284_6_) + public WorldServer(MinecraftServer p_i45921_1_, ISaveHandler p_i45921_2_, WorldInfo p_i45921_3_, int p_i45921_4_, Profiler p_i45921_5_) { - super(p_i45284_2_, p_i45284_3_, p_i45284_5_, WorldProvider.func_76570_a(p_i45284_4_), p_i45284_6_); -@@ -111,8 +124,12 @@ - this.field_72988_C.func_75745_a("scoreboard", scoreboardsavedata); - } - -- scoreboardsavedata.func_96499_a(this.field_96442_D); -+ if (!(this instanceof WorldServerMulti)) //Forge: We fix the global mapStorage, which causes us to share scoreboards early. So don't associate the save data with the temporary scoreboard -+ { -+ scoreboardsavedata.func_96499_a(this.field_96442_D); -+ } - ((ServerScoreboard)this.field_96442_D).func_96547_a(scoreboardsavedata); -+ DimensionManager.setWorld(p_i45284_4_, this); + super(p_i45921_2_, p_i45921_3_, WorldProvider.func_76570_a(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 PlayerManager(this); ++ // Guarantee the dimension ID was not reset by the provider ++ int providerDim = this.field_73011_w.field_76574_g; + this.field_73011_w.func_76558_a(this); ++ this.field_73011_w.field_76574_g = 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); } - public void func_72835_b() -@@ -171,6 +188,10 @@ - this.field_72983_E.func_75528_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 + { +@@ -210,6 +226,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) @@ -64,15 +60,15 @@ this.field_72984_F.func_76319_b(); this.func_147488_Z(); } -@@ -178,6 +199,7 @@ - public BiomeGenBase.SpawnListEntry func_73057_a(EnumCreatureType p_73057_1_, int p_73057_2_, int p_73057_3_, int p_73057_4_) +@@ -217,6 +237,7 @@ + public BiomeGenBase.SpawnListEntry func_175734_a(EnumCreatureType p_175734_1_, BlockPos p_175734_2_) { - List list = this.func_72863_F().func_73155_a(p_73057_1_, p_73057_2_, p_73057_3_, p_73057_4_); -+ list = ForgeEventFactory.getPotentialSpawns(this, p_73057_1_, p_73057_2_, p_73057_3_, p_73057_4_, list); + 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() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.func_76271_a(this.field_73012_v, list) : null; } -@@ -218,10 +240,7 @@ +@@ -274,10 +295,7 @@ private void func_73051_P() { @@ -80,39 +76,39 @@ - this.field_72986_A.func_76084_b(false); - this.field_72986_A.func_76090_f(0); - this.field_72986_A.func_76069_a(false); -+ field_73011_w.resetRainAndThunder(); ++ this.field_73011_w.resetRainAndThunder(); } public boolean func_73056_e() -@@ -301,7 +320,7 @@ - int k1; - int l1; +@@ -367,7 +385,7 @@ + int i1; + BlockPos blockpos; -- if (this.field_73012_v.nextInt(100000) == 0 && this.func_72896_J() && this.func_72911_I()) -+ if (field_73011_w.canDoLightning(chunk) && this.field_73012_v.nextInt(100000) == 0 && this.func_72896_J() && this.func_72911_I()) +- if (this.field_73012_v.nextInt(100000) == 0 && this.func_72896_J() && this.func_72911_I()) ++ if (this.field_73011_w.canDoLightning(chunk) && this.field_73012_v.nextInt(100000) == 0 && this.func_72896_J() && this.func_72911_I()) + { + this.field_73005_l = this.field_73005_l * 3 + 1013904223; + i1 = this.field_73005_l >> 2; +@@ -381,7 +399,7 @@ + + 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; + i1 = this.field_73005_l >> 2; +@@ -483,6 +501,9 @@ + if (p_175654_2_.func_149698_L()) { - this.field_73005_l = this.field_73005_l * 3 + 1013904223; - i1 = this.field_73005_l >> 2; -@@ -317,7 +336,7 @@ + b0 = 8; ++ //Keeping here as a note for future when it may be restored. ++ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.field_180282_a.func_177958_n() >> 4, nextticklistentry.field_180282_a.func_177952_p() >> 4)); ++ b0 = (byte)(isForced ? 0 : 8); - this.field_72984_F.func_76318_c("iceandsnow"); - -- if (this.field_73012_v.nextInt(16) == 0) -+ if (field_73011_w.canDoRainSnowIce(chunk) && this.field_73012_v.nextInt(16) == 0) - { - this.field_73005_l = this.field_73005_l * 3 + 1013904223; - i1 = this.field_73005_l >> 2; -@@ -393,6 +412,9 @@ - public void func_147454_a(int p_147454_1_, int p_147454_2_, int p_147454_3_, Block p_147454_4_, int p_147454_5_, int p_147454_6_) - { - NextTickListEntry nextticklistentry = new NextTickListEntry(p_147454_1_, p_147454_2_, p_147454_3_, p_147454_4_); -+ //Keeping here as a note for future when it may be restored. -+ //boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4)); -+ //byte b0 = isForced ? 0 : 8; - byte b0 = 0; - - if (this.field_72999_e && p_147454_4_.func_149688_o() != Material.field_151579_a) -@@ -452,7 +474,7 @@ + if (this.func_175707_a(nextticklistentry.field_180282_a.func_177982_a(-b0, -b0, -b0), nextticklistentry.field_180282_a.func_177982_a(b0, b0, b0))) + { +@@ -535,7 +556,7 @@ public void func_72939_s() { @@ -121,97 +117,96 @@ { if (this.field_80004_Q++ >= 1200) { -@@ -512,6 +534,9 @@ - { - nextticklistentry = (NextTickListEntry)iterator.next(); - iterator.remove(); -+ //Keeping here as a note for future when it may be restored. -+ //boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4)); -+ //byte b0 = isForced ? 0 : 8; - byte b0 = 0; +@@ -601,6 +622,9 @@ + { + nextticklistentry = (NextTickListEntry)iterator.next(); + iterator.remove(); ++ //Keeping here as a note for future when it may be restored. ++ //boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4)); ++ //byte b0 = isForced ? 0 : 8; + byte b0 = 0; - if (this.func_72904_c(nextticklistentry.field_77183_a - b0, nextticklistentry.field_77181_b - b0, nextticklistentry.field_77182_c - b0, nextticklistentry.field_77183_a + b0, nextticklistentry.field_77181_b + b0, nextticklistentry.field_77182_c + b0)) -@@ -634,13 +659,26 @@ + if (this.func_175707_a(nextticklistentry.field_180282_a.func_177982_a(-b0, -b0, -b0), nextticklistentry.field_180282_a.func_177982_a(b0, b0, b0))) +@@ -729,14 +753,29 @@ { - ArrayList arraylist = new ArrayList(); + ArrayList arraylist = Lists.newArrayList(); - for (int k1 = 0; k1 < this.field_147482_g.size(); ++k1) -+ for(int x = (p_147486_1_ >> 4); x <= (p_147486_4_ >> 4); x++) ++ //Forge: Optomize this loop to only grab from the chunks it needs ++ for (int x = (p_147486_1_ >> 4); x <= (p_147486_4_ >> 4); x++) { - TileEntity tileentity = (TileEntity)this.field_147482_g.get(k1); +- BlockPos blockpos = tileentity.func_174877_v(); - -- if (tileentity.field_145851_c >= p_147486_1_ && tileentity.field_145848_d >= p_147486_2_ && tileentity.field_145849_e >= p_147486_3_ && tileentity.field_145851_c < p_147486_4_ && tileentity.field_145848_d < p_147486_5_ && tileentity.field_145849_e < p_147486_6_) -+ for(int z = (p_147486_3_ >> 4); z <= (p_147486_6_ >> 4); z++) +- if (blockpos.func_177958_n() >= p_147486_1_ && blockpos.func_177956_o() >= p_147486_2_ && blockpos.func_177952_p() >= p_147486_3_ && blockpos.func_177958_n() < p_147486_4_ && blockpos.func_177956_o() < p_147486_5_ && blockpos.func_177952_p() < p_147486_6_) ++ for (int z = (p_147486_3_ >> 4); z <= (p_147486_6_ >> 4); z++) { - arraylist.add(tileentity); -+ Chunk chunk = func_72964_e(x, z); ++ Chunk chunk = this.func_72964_e(x, z); + if (chunk != null) + { -+ for(Object obj : chunk.field_150816_i.values()) ++ for (Object obj : chunk.func_177434_r().values()) + { + TileEntity entity = (TileEntity)obj; + if (!entity.func_145837_r()) + { -+ if (entity.field_145851_c >= p_147486_1_ && entity.field_145848_d >= p_147486_2_ && entity.field_145849_e >= p_147486_3_ && -+ entity.field_145851_c <= p_147486_4_ && entity.field_145848_d <= p_147486_5_ && entity.field_145849_e <= p_147486_6_) ++ BlockPos pos = entity.func_174877_v(); ++ if (pos.func_177958_n() >= p_147486_1_ && pos.func_177956_o() >= p_147486_2_ && pos.func_177952_p() >= p_147486_3_ && ++ pos.func_177958_n() <= p_147486_4_ && pos.func_177956_o() <= p_147486_5_ && pos.func_177952_p() <= p_147486_6_) + { + arraylist.add(entity); + } ++ + } + } + } } } -@@ -649,9 +687,14 @@ +@@ -745,6 +784,10 @@ - public boolean func_72962_a(EntityPlayer p_72962_1_, int p_72962_2_, int p_72962_3_, int p_72962_4_) + public boolean func_175660_a(EntityPlayer p_175660_1_, BlockPos p_175660_2_) { -- return !this.field_73061_a.func_96290_a(this, p_72962_2_, p_72962_3_, p_72962_4_, p_72962_1_); -+ return super.func_72962_a(p_72962_1_, p_72962_2_, p_72962_3_, p_72962_4_); ++ 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_); } -+ public boolean canMineBlockBody(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) -+ { -+ return !this.field_73061_a.func_96290_a(this, par2, par3, par4, par1EntityPlayer); -+ } -+ - protected void func_72963_a(WorldSettings p_72963_1_) - { - if (this.field_73066_T == null) -@@ -726,7 +769,7 @@ +@@ -855,7 +898,7 @@ protected void func_73047_i() { - WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(field_73069_S, 10); -+ WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(ChestGenHooks.getItems(BONUS_CHEST, field_73012_v), ChestGenHooks.getCount(BONUS_CHEST, field_73012_v)); ++ WorldGeneratorBonusChest worldgeneratorbonuschest = net.minecraftforge.common.ForgeHooks.getBonusChest(field_73012_v); for (int i = 0; i < 10; ++i) { -@@ -763,6 +806,7 @@ +@@ -892,6 +935,7 @@ } this.field_73020_y.func_73151_a(p_73044_1_, p_73044_2_); -+ MinecraftForge.EVENT_BUS.post(new WorldEvent.Save(this)); - ArrayList arraylist = Lists.newArrayList(this.field_73059_b.func_152380_a()); - Iterator iterator = arraylist.iterator(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); + List list = this.field_73059_b.func_152380_a(); + Iterator iterator = list.iterator(); -@@ -791,6 +835,7 @@ - this.func_72906_B(); +@@ -929,6 +973,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_71203_ab().func_72378_q()); this.field_72988_C.func_75744_a(); + this.perWorldStorage.func_75744_a(); } public void func_72923_a(Entity p_72923_1_) -@@ -941,19 +986,23 @@ - this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.field_76574_g); +@@ -1074,19 +1119,23 @@ + this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.func_177502_q()); } -+ /*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. -+ */ ++ /* 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) @@ -232,13 +227,13 @@ } } -@@ -1002,6 +1051,11 @@ - } +@@ -1152,6 +1201,11 @@ + return this.field_73061_a.func_152345_ab(); } -+ public File getChunkSaveLocation() ++ public java.io.File getChunkSaveLocation() + { -+ return ((AnvilChunkLoader)field_73059_b.field_73247_e).field_75825_d; ++ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)field_73059_b.field_73247_e).field_75825_d; + } + static class ServerBlockEventList extends ArrayList diff --git a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch index 1248350f0f..65af8cdb3d 100644 --- a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/world/WorldServerMulti.java +++ ../src-work/minecraft/net/minecraft/world/WorldServerMulti.java -@@ -17,5 +17,8 @@ - this.field_72986_A = new DerivedWorldInfo(p_i45283_6_.func_72912_H()); +@@ -51,19 +51,22 @@ + }); } - protected void func_73042_a() throws MinecraftException {} @@ -9,4 +9,20 @@ + { + this.perWorldStorage.func_75744_a(); + } - } + + public World func_175643_b() + { + this.field_72988_C = this.field_175743_a.func_175693_T(); + this.field_96442_D = this.field_175743_a.func_96441_U(); + 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 + { diff --git a/patches/minecraft/net/minecraft/world/WorldType.java.patch b/patches/minecraft/net/minecraft/world/WorldType.java.patch index 76d0ee2ff6..06b28c0f3b 100644 --- a/patches/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldType.java.patch @@ -1,37 +1,29 @@ --- ../src-base/minecraft/net/minecraft/world/WorldType.java +++ ../src-work/minecraft/net/minecraft/world/WorldType.java -@@ -1,7 +1,11 @@ +@@ -1,5 +1,14 @@ package net.minecraft.world; +import java.util.Arrays; - import java.util.Random; - +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiCreateFlatWorld; +import net.minecraft.client.gui.GuiCreateWorld; - import net.minecraft.world.biome.BiomeGenBase; - import net.minecraft.world.biome.WorldChunkManager; - import net.minecraft.world.biome.WorldChunkManagerHell; -@@ -9,6 +13,10 @@ - import net.minecraft.world.gen.ChunkProviderFlat; - import net.minecraft.world.gen.ChunkProviderGenerate; - import net.minecraft.world.gen.FlatGeneratorInfo; ++import net.minecraft.client.gui.GuiCustomizeWorldScreen; +import net.minecraft.world.gen.layer.GenLayer; +import net.minecraft.world.gen.layer.GenLayerBiome; +import net.minecraft.world.gen.layer.GenLayerBiomeEdge; +import net.minecraft.world.gen.layer.GenLayerZoom; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; -@@ -35,6 +43,7 @@ +@@ -28,6 +37,7 @@ private WorldType(int p_i1960_1_, String p_i1960_2_, int p_i1960_3_) { -+ if (p_i1960_2_.length() > 16) throw new IllegalArgumentException("World type names must not be longer then 16: " + p_i1960_2_.length()); ++ if (p_i1960_2_.length() > 16 && field_180272_g != null) throw new IllegalArgumentException("World type names must not be longer then 16: " + p_i1960_2_); this.field_77133_f = p_i1960_2_; this.field_77134_g = p_i1960_3_; this.field_77140_h = true; -@@ -183,8 +192,92 @@ +@@ -159,8 +169,99 @@ return this == field_77138_c ? random.nextInt(4) != 1 : false; } @@ -73,20 +65,24 @@ + */ + public int getSpawnFuzz() + { -+ return net.minecraftforge.common.ForgeModContainer.defaultSpawnFuzz; ++ return Math.max(5, net.minecraft.server.MinecraftServer.func_71276_C().func_82357_ak() - 6); + } + + /** + * Called when the 'Customize' button is pressed on world creation GUI -+ * @param instance The minecraft instance ++ * @param mc The Minecraft instance + * @param guiCreateWorld the createworld GUI + */ + @SideOnly(Side.CLIENT) -+ public void onCustomizeButton(Minecraft instance, GuiCreateWorld guiCreateWorld) ++ public void onCustomizeButton(Minecraft mc, GuiCreateWorld guiCreateWorld) + { -+ if (this == field_77138_c) ++ if (this == WorldType.field_77138_c) + { -+ instance.func_147108_a(new GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.field_146334_a)); ++ mc.func_147108_a(new GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.field_146334_a)); ++ } ++ else if (this == WorldType.field_180271_f) ++ { ++ mc.func_147108_a(new GuiCustomizeWorldScreen(guiCreateWorld, guiCreateWorld.field_146334_a)); + } + } + @@ -96,7 +92,7 @@ + */ + public boolean isCustomizable() + { -+ return this == field_77138_c; ++ return this == field_77138_c || this == WorldType.field_180271_f; + } + + @@ -110,15 +106,18 @@ + } + + /** -+ * Creates the GenLayerBiome used for generating the 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 chunkProviderSettingsJson The JSON string to use when initializing ChunkProviderSettings.Factory + * @return A GenLayer that will return ints representing the Biomes to be generated, see GenLayerBiome + */ -+ public GenLayer getBiomeLayer(long worldSeed, GenLayer parentLayer) ++ public GenLayer getBiomeLayer(long worldSeed, GenLayer parentLayer, String chunkProviderSettingsJson) + { -+ GenLayer ret = new GenLayerBiome(200L, parentLayer, this); ++ GenLayer ret = new GenLayerBiome(200L, parentLayer, this, chunkProviderSettingsJson); + ret = GenLayerZoom.func_75915_a(1000L, ret, 2); + ret = new GenLayerBiomeEdge(1000L, ret); + return ret; diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch new file mode 100644 index 0000000000..bcd054cb7c --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeColorHelper.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeColorHelper.java +@@ -30,7 +30,7 @@ + private static final String __OBFID = "CL_00002146"; + public int func_180283_a(BiomeGenBase p_180283_1_, BlockPos p_180283_2_) + { +- return p_180283_1_.field_76759_H; ++ return p_180283_1_.getWaterColorMultiplier(); + } + }; + private static final String __OBFID = "CL_00002149"; diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch index b2535a3ccd..f1cbc07432 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeDecorator.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDecorator.java -@@ -19,6 +19,11 @@ +@@ -23,6 +23,11 @@ import net.minecraft.world.gen.feature.WorldGenWaterlily; import net.minecraft.world.gen.feature.WorldGenerator; @@ -12,238 +12,256 @@ public class BiomeDecorator { public World field_76815_a; -@@ -105,26 +110,30 @@ +@@ -125,26 +130,30 @@ protected void func_150513_a(BiomeGenBase p_150513_1_) { -+ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(field_76815_a, field_76813_b, field_76814_c, field_76811_d)); ++ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(field_76815_a, field_76813_b, field_180294_c)); this.func_76797_b(); int i; int j; int k; - for (i = 0; i < this.field_76805_H; ++i) -+ boolean doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_76814_c, field_76811_d, SAND); ++ boolean doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, SAND); + for (i = 0; doGen && i < this.field_76805_H; ++i) { - j = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - k = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; - this.field_76810_g.func_76484_a(this.field_76815_a, this.field_76813_b, j, this.field_76815_a.func_72825_h(j, k), k); + j = this.field_76813_b.nextInt(16) + 8; + k = this.field_76813_b.nextInt(16) + 8; + this.field_76810_g.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_76815_a.func_175672_r(this.field_180294_c.func_177982_a(j, 0, k))); } - for (i = 0; i < this.field_76806_I; ++i) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_76814_c, field_76811_d, CLAY); ++ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, CLAY); + for (i = 0; doGen && i < this.field_76806_I; ++i) { - j = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - k = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; - this.field_76809_f.func_76484_a(this.field_76815_a, this.field_76813_b, j, this.field_76815_a.func_72825_h(j, k), k); + j = this.field_76813_b.nextInt(16) + 8; + k = this.field_76813_b.nextInt(16) + 8; + this.field_76809_f.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_76815_a.func_175672_r(this.field_180294_c.func_177982_a(j, 0, k))); } - for (i = 0; i < this.field_76801_G; ++i) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_76814_c, field_76811_d, SAND_PASS2); ++ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, SAND_PASS2); + for (i = 0; doGen && i < this.field_76801_G; ++i) { - j = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - k = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; -@@ -141,7 +150,8 @@ + j = this.field_76813_b.nextInt(16) + 8; + k = this.field_76813_b.nextInt(16) + 8; +@@ -161,7 +170,8 @@ int l; - int i1; + BlockPos blockpos; - for (j = 0; j < i; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_76814_c, field_76811_d, TREE); ++ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, TREE); + for (j = 0; doGen && j < i; ++j) { - k = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - l = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; -@@ -155,18 +165,20 @@ + k = this.field_76813_b.nextInt(16) + 8; + l = this.field_76813_b.nextInt(16) + 8; +@@ -175,7 +185,8 @@ } } - for (j = 0; j < this.field_76807_J; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_76814_c, field_76811_d, BIG_SHROOM); ++ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, BIG_SHROOM); + for (j = 0; doGen && j < this.field_76807_J; ++j) { - k = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - l = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; - this.field_76826_u.func_76484_a(this.field_76815_a, this.field_76813_b, k, this.field_76815_a.func_72976_f(k, l), l); - } + k = this.field_76813_b.nextInt(16) + 8; + l = this.field_76813_b.nextInt(16) + 8; +@@ -184,11 +195,12 @@ + + int i1; - for (j = 0; j < this.field_76802_A; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_76814_c, field_76811_d, FLOWERS); ++ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, FLOWERS); + for (j = 0; doGen && j < this.field_76802_A; ++j) { - k = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - l = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; -- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_72976_f(k, l) + 32); -+ i1 = nextInt(this.field_76815_a.func_72976_f(k, l) + 32); - String s = p_150513_1_.func_150572_a(this.field_76813_b, k, i1, l); - BlockFlower blockflower = BlockFlower.func_149857_e(s); - -@@ -177,29 +189,32 @@ + k = this.field_76813_b.nextInt(16) + 8; + l = this.field_76813_b.nextInt(16) + 8; +- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() + 32); ++ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() + 32); + blockpos = this.field_180294_c.func_177982_a(k, i1, l); + BlockFlower.EnumFlowerType enumflowertype = p_150513_1_.func_180623_a(this.field_76813_b, blockpos); + BlockFlower blockflower = enumflowertype.func_176964_a().func_180346_a(); +@@ -200,29 +212,32 @@ } } - for (j = 0; j < this.field_76803_B; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_76814_c, field_76811_d, GRASS); ++ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, GRASS); + for (j = 0; doGen && j < this.field_76803_B; ++j) { - k = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - l = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; -- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_72976_f(k, l) * 2); -+ i1 = nextInt(this.field_76815_a.func_72976_f(k, l) * 2); - WorldGenerator worldgenerator = p_150513_1_.func_76730_b(this.field_76813_b); - worldgenerator.func_76484_a(this.field_76815_a, this.field_76813_b, k, i1, l); + k = this.field_76813_b.nextInt(16) + 8; + l = this.field_76813_b.nextInt(16) + 8; +- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); ++ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); + p_150513_1_.func_76730_b(this.field_76813_b).func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(k, i1, l)); } - for (j = 0; j < this.field_76804_C; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_76814_c, field_76811_d, DEAD_BUSH); ++ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, DEAD_BUSH); + for (j = 0; doGen && j < this.field_76804_C; ++j) { - k = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - l = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; -- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_72976_f(k, l) * 2); -+ i1 = nextInt(this.field_76815_a.func_72976_f(k, l) * 2); - (new WorldGenDeadBush(Blocks.field_150330_I)).func_76484_a(this.field_76815_a, this.field_76813_b, k, i1, l); + k = this.field_76813_b.nextInt(16) + 8; + l = this.field_76813_b.nextInt(16) + 8; +- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); ++ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); + (new WorldGenDeadBush()).func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(k, i1, l)); } -- for (j = 0; j < this.field_76833_y; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_76814_c, field_76811_d, LILYPAD); -+ for (j = 0; doGen && j < this.field_76833_y; ++j) - { - k = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - l = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; + j = 0; -- for (i1 = this.field_76813_b.nextInt(this.field_76815_a.func_72976_f(k, l) * 2); i1 > 0 && this.field_76815_a.func_147437_c(k, i1 - 1, l); --i1) -+ for (i1 = nextInt(this.field_76815_a.func_72976_f(k, l) * 2); i1 > 0 && this.field_76815_a.func_147437_c(k, i1 - 1, l); --i1) - { - ; +- while (j < this.field_76833_y) ++ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, LILYPAD); ++ while (doGen && j < this.field_76833_y) + { + k = this.field_76813_b.nextInt(16) + 8; + l = this.field_76813_b.nextInt(16) + 8; +- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); ++ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); + blockpos = this.field_180294_c.func_177982_a(k, i1, l); + + while (true) +@@ -244,7 +259,8 @@ } -@@ -207,7 +222,8 @@ - this.field_76834_x.func_76484_a(this.field_76815_a, this.field_76813_b, k, i1, l); } - for (j = 0; j < this.field_76798_D; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_76814_c, field_76811_d, SHROOM); ++ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, SHROOM); + for (j = 0; doGen && j < this.field_76798_D; ++j) { if (this.field_76813_b.nextInt(4) == 0) { -@@ -221,60 +237,64 @@ +@@ -258,57 +274,60 @@ { - k = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - l = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; -- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_72976_f(k, l) * 2); -+ i1 = nextInt(this.field_76815_a.func_72976_f(k, l) * 2); - this.field_76827_t.func_76484_a(this.field_76815_a, this.field_76813_b, k, i1, l); + k = this.field_76813_b.nextInt(16) + 8; + l = this.field_76813_b.nextInt(16) + 8; +- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); ++ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); + blockpos = this.field_180294_c.func_177982_a(k, i1, l); + this.field_76827_t.func_180709_b(this.field_76815_a, this.field_76813_b, blockpos); } } - if (this.field_76813_b.nextInt(4) == 0) + if (doGen && this.field_76813_b.nextInt(4) == 0) { - j = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - k = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; -- l = this.field_76813_b.nextInt(this.field_76815_a.func_72976_f(j, k) * 2); -+ l = nextInt(this.field_76815_a.func_72976_f(j, k) * 2); - this.field_76828_s.func_76484_a(this.field_76815_a, this.field_76813_b, j, l, k); + j = this.field_76813_b.nextInt(16) + 8; + k = this.field_76813_b.nextInt(16) + 8; +- l = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(j, 0, k)).func_177956_o() * 2); ++ l = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(j, 0, k)).func_177956_o() * 2); + this.field_76828_s.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(j, l, k)); } - if (this.field_76813_b.nextInt(8) == 0) + if (doGen && this.field_76813_b.nextInt(8) == 0) { - j = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - k = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; -- l = this.field_76813_b.nextInt(this.field_76815_a.func_72976_f(j, k) * 2); -+ l = nextInt(this.field_76815_a.func_72976_f(j, k) * 2); - this.field_76827_t.func_76484_a(this.field_76815_a, this.field_76813_b, j, l, k); + j = this.field_76813_b.nextInt(16) + 8; + k = this.field_76813_b.nextInt(16) + 8; +- l = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(j, 0, k)).func_177956_o() * 2); ++ l = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(j, 0, k)).func_177956_o() * 2); + this.field_76827_t.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(j, l, k)); } - for (j = 0; j < this.field_76799_E; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_76814_c, field_76811_d, REED); ++ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, REED); + for (j = 0; doGen && j < this.field_76799_E; ++j) { - k = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - l = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; -- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_72976_f(k, l) * 2); -+ i1 = nextInt(this.field_76815_a.func_72976_f(k, l) * 2); - this.field_76825_v.func_76484_a(this.field_76815_a, this.field_76813_b, k, i1, l); + k = this.field_76813_b.nextInt(16) + 8; + l = this.field_76813_b.nextInt(16) + 8; +- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); ++ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); + this.field_76825_v.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(k, i1, l)); } - for (j = 0; j < 10; ++j) + for (j = 0; doGen && j < 10; ++j) { - k = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - l = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; -- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_72976_f(k, l) * 2); -+ i1 = nextInt(this.field_76815_a.func_72976_f(k, l) * 2); - this.field_76825_v.func_76484_a(this.field_76815_a, this.field_76813_b, k, i1, l); + k = this.field_76813_b.nextInt(16) + 8; + l = this.field_76813_b.nextInt(16) + 8; +- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); ++ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); + this.field_76825_v.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(k, i1, l)); } - if (this.field_76813_b.nextInt(32) == 0) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_76814_c, field_76811_d, PUMPKIN); ++ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, PUMPKIN); + if (doGen && this.field_76813_b.nextInt(32) == 0) { - j = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - k = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; -- l = this.field_76813_b.nextInt(this.field_76815_a.func_72976_f(j, k) * 2); -+ l = nextInt(this.field_76815_a.func_72976_f(j, k) * 2); - (new WorldGenPumpkin()).func_76484_a(this.field_76815_a, this.field_76813_b, j, l, k); + j = this.field_76813_b.nextInt(16) + 8; + k = this.field_76813_b.nextInt(16) + 8; +- l = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(j, 0, k)).func_177956_o() * 2); ++ l = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(j, 0, k)).func_177956_o() * 2); + (new WorldGenPumpkin()).func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(j, l, k)); } - for (j = 0; j < this.field_76800_F; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_76814_c, field_76811_d, CACTUS); ++ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, CACTUS); + for (j = 0; doGen && j < this.field_76800_F; ++j) { - k = this.field_76814_c + this.field_76813_b.nextInt(16) + 8; - l = this.field_76811_d + this.field_76813_b.nextInt(16) + 8; -- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_72976_f(k, l) * 2); -+ i1 = nextInt(this.field_76815_a.func_72976_f(k, l) * 2); - this.field_76824_w.func_76484_a(this.field_76815_a, this.field_76813_b, k, i1, l); + k = this.field_76813_b.nextInt(16) + 8; + l = this.field_76813_b.nextInt(16) + 8; +- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); ++ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); + this.field_76824_w.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(k, i1, l)); } -- if (this.field_76808_K) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_76814_c, field_76811_d, LAKE); -+ if (doGen && this.field_76808_K) +@@ -316,18 +335,22 @@ { - for (j = 0; j < 50; ++j) + BlockPos blockpos1; + +- for (j = 0; j < 50; ++j) ++ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, LAKE_WATER); ++ for (j = 0; doGen && j < 50; ++j) { -@@ -292,6 +312,8 @@ - (new WorldGenLiquids(Blocks.field_150356_k)).func_76484_a(this.field_76815_a, this.field_76813_b, k, l, i1); + blockpos1 = this.field_180294_c.func_177982_a(this.field_76813_b.nextInt(16) + 8, this.field_76813_b.nextInt(this.field_76813_b.nextInt(248) + 8), this.field_76813_b.nextInt(16) + 8); + (new WorldGenLiquids(Blocks.field_150358_i)).func_180709_b(this.field_76815_a, this.field_76813_b, blockpos1); + } + +- for (j = 0; j < 20; ++j) ++ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, LAKE_LAVA); ++ for (j = 0; doGen && j < 20; ++j) + { + blockpos1 = this.field_180294_c.func_177982_a(this.field_76813_b.nextInt(16) + 8, this.field_76813_b.nextInt(this.field_76813_b.nextInt(this.field_76813_b.nextInt(240) + 8) + 8), this.field_76813_b.nextInt(16) + 8); + (new WorldGenLiquids(Blocks.field_150356_k)).func_180709_b(this.field_76815_a, this.field_76813_b, blockpos1); } } + -+ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(field_76815_a, field_76813_b, field_76814_c, field_76811_d)); ++ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(field_76815_a, field_76813_b, field_180294_c)); } protected void func_76795_a(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_) -@@ -318,13 +340,29 @@ +@@ -370,16 +393,35 @@ protected void func_76797_b() { -+ MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Pre(field_76815_a, field_76813_b, field_76814_c, field_76811_d)); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76823_i, field_76814_c, field_76811_d, DIRT)) - this.func_76795_a(20, this.field_76823_i, 0, 256); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76820_j, field_76814_c, field_76811_d, GRAVEL)) - this.func_76795_a(10, this.field_76820_j, 0, 256); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76821_k, field_76814_c, field_76811_d, COAL)) - this.func_76795_a(20, this.field_76821_k, 0, 128); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76818_l, field_76814_c, field_76811_d, IRON)) - this.func_76795_a(20, this.field_76818_l, 0, 64); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76819_m, field_76814_c, field_76811_d, GOLD)) - this.func_76795_a(2, this.field_76819_m, 0, 32); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76816_n, field_76814_c, field_76811_d, REDSTONE)) - this.func_76795_a(8, this.field_76816_n, 0, 16); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76817_o, field_76814_c, field_76811_d, DIAMOND)) - this.func_76795_a(1, this.field_76817_o, 0, 16); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76831_p, field_76814_c, field_76811_d, LAPIS)) - this.func_76793_b(1, this.field_76831_p, 16, 16); -+ MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(field_76815_a, field_76813_b, field_76814_c, field_76811_d)); ++ MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Pre(field_76815_a, field_76813_b, field_180294_c)); ++ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76823_i, field_180294_c, DIRT)) + this.func_76795_a(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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76820_j, field_180294_c, GRAVEL)) + this.func_76795_a(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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_180297_k, field_180294_c, DIORITE)) + this.func_76795_a(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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_180296_j, field_180294_c, GRANITE)) + this.func_76795_a(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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_180295_l, field_180294_c, ANDESITE)) + this.func_76795_a(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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76821_k, field_180294_c, COAL)) + this.func_76795_a(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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76818_l, field_180294_c, IRON)) + this.func_76795_a(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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76819_m, field_180294_c, GOLD)) + this.func_76795_a(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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_180299_p, field_180294_c, REDSTONE)) + this.func_76795_a(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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_180298_q, field_180294_c, DIAMOND)) + this.func_76795_a(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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76831_p, field_180294_c, LAPIS)) + this.func_76793_b(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); ++ MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(field_76815_a, field_76813_b, field_180294_c)); } + -+ private int nextInt(int i) { ++ private int nextInt(int i) { //Safety wrapper to prevent exceptions. + if (i <= 1) + return 0; + return this.field_76813_b.nextInt(i); -+ } ++ } } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch index a989915653..ab745af608 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenBase.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenBase.java -@@ -42,6 +42,9 @@ +@@ -50,6 +50,9 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -10,7 +10,7 @@ public abstract class BiomeGenBase { private static final Logger field_150586_aC = LogManager.getLogger(); -@@ -130,6 +133,10 @@ +@@ -139,6 +142,10 @@ public BiomeGenBase(int p_i1971_1_) { @@ -18,10 +18,10 @@ + } + public BiomeGenBase(int p_i1971_1_, boolean register) + { - this.field_76752_A = Blocks.field_150349_c; - this.field_150604_aj = 0; - this.field_76753_B = Blocks.field_150346_d; -@@ -148,6 +155,7 @@ + this.field_76752_A = Blocks.field_150349_c.func_176223_P(); + this.field_76753_B = Blocks.field_150346_d.func_176223_P(); + this.field_76754_C = 5169201; +@@ -156,6 +163,7 @@ this.field_76758_O = new WorldGenBigTree(false); this.field_76763_Q = new WorldGenSwamp(); this.field_76756_M = p_i1971_1_; @@ -29,7 +29,7 @@ field_76773_a[p_i1971_1_] = this; this.field_76760_I = this.func_76729_a(); this.field_76762_K.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); -@@ -163,11 +171,12 @@ +@@ -172,11 +180,12 @@ this.field_76761_J.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); this.field_76755_L.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); this.field_82914_M.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); @@ -43,30 +43,30 @@ } public BiomeGenBase func_76732_a(float p_76732_1_, float p_76732_2_) -@@ -335,7 +344,7 @@ +@@ -346,7 +355,7 @@ { - double d0 = (double)MathHelper.func_76131_a(this.func_150564_a(p_150558_1_, p_150558_2_, p_150558_3_), 0.0F, 1.0F); + 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)); } @SideOnly(Side.CLIENT) -@@ -343,7 +352,7 @@ +@@ -354,7 +363,7 @@ { - double d0 = (double)MathHelper.func_76131_a(this.func_150564_a(p_150571_1_, p_150571_2_, p_150571_3_), 0.0F, 1.0F); + 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 boolean func_150559_j() -@@ -490,6 +499,88 @@ +@@ -500,6 +509,84 @@ } } + /* ========================================= FORGE START ======================================*/ -+ protected List flowers = new ArrayList(); ++ protected List flowers = new java.util.ArrayList(); + + public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) + { @@ -79,7 +79,7 @@ + MinecraftForge.EVENT_BUS.post(event); + return event.newColor; + } -+ ++ + public int getModdedBiomeGrassColor(int original) + { + BiomeEvent.GetGrassColor event = new BiomeEvent.GetGrassColor(this, original); @@ -95,18 +95,16 @@ + } + + /** -+ * Weighted random holder class used to hold possible flowers ++ * 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 Block block; -+ public final int metadata; -+ public FlowerEntry(Block block, int meta, int weight) ++ public final net.minecraft.block.state.IBlockState state; ++ public FlowerEntry(net.minecraft.block.state.IBlockState state, int weight) + { + super(weight); -+ this.block = block; -+ this.metadata = meta; ++ this.state = state; + } + } + @@ -115,36 +113,34 @@ + */ + public void addDefaultFlowers() + { -+ this.flowers.add(new FlowerEntry(Blocks.field_150327_N, 0, 20)); -+ this.flowers.add(new FlowerEntry(Blocks.field_150328_O, 0, 10)); ++ 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), 20); + } + + /** Register a new plant to be planted when bonemeal is used on grass. -+ * @param block The block to place. -+ * @param metadata The metadata to set for the block when being placed. ++ * @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(Block block, int metadata, int weight) ++ public void addFlower(IBlockState state, int weight) + { -+ this.flowers.add(new FlowerEntry(block, metadata, weight)); ++ this.flowers.add(new FlowerEntry(state, weight)); + } + -+ public void plantFlower(World world, Random rand, int x, int y, int z) ++ public void plantFlower(World world, Random rand, BlockPos pos) + { -+ BiomeGenBase biome = world.func_72807_a(x, z); -+ String flowername = biome.func_150572_a(rand, x, y, z); -+ + FlowerEntry flower = (FlowerEntry)WeightedRandom.func_76271_a(rand, flowers); -+ if (flower == null || flower.block == null || !flower.block.func_149718_j(world, x, y, z)) ++ 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_147465_d(x, y, z, flower.block, flower.metadata, 3); ++ world.func_180501_a(pos, flower.state, 3); + } + -+ ++ + /* ========================================= FORGE END ======================================*/ + static diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch index 9645e31b1f..baadaaa768 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch @@ -1,26 +1,23 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenForest.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenForest.java -@@ -5,6 +5,7 @@ - import java.util.Random; - import net.minecraft.block.BlockFlower; - import net.minecraft.entity.passive.EntityWolf; -+import net.minecraft.init.Blocks; - import net.minecraft.util.MathHelper; - import net.minecraft.world.World; - import net.minecraft.world.gen.feature.WorldGenAbstractTree; -@@ -53,6 +54,15 @@ - { - this.field_76760_I.field_76832_z = -999; +@@ -220,4 +220,20 @@ + }; } -+ -+ if (this.field_150632_aF == 1) -+ { -+ this.flowers.clear(); -+ for (int x = 0; x < BlockFlower.field_149859_a.length; x++) -+ { -+ this.addFlower(Blocks.field_150328_O, x == 1 ? 0 : x, 10); -+ } -+ } } - - public BiomeGenBase func_150557_a(int p_150557_1_, boolean p_150557_2_) ++ ++ @Override ++ public void addDefaultFlowers() ++ { ++ if (field_150632_aF != 1) ++ { ++ super.addDefaultFlowers(); ++ return; ++ } ++ 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); ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch index 4930e6e2e5..951092d6d5 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java -@@ -55,7 +55,7 @@ - j1 = p_76728_2_.nextInt(28) + 4; - int k1 = p_76728_4_ + p_76728_2_.nextInt(16); +@@ -58,7 +58,7 @@ + int i1 = p_180624_2_.nextInt(16); + BlockPos blockpos1 = p_180624_3_.func_177982_a(k, l, i1); -- if (p_76728_1_.func_147439_a(i1, j1, k1) == Blocks.field_150348_b) -+ if (p_76728_1_.func_147439_a(i1, j1, k1).isReplaceableOreGen(p_76728_1_, i1, j1, k1, Blocks.field_150348_b)) +- if (p_180624_1_.func_180495_p(blockpos1).func_177230_c() == Blocks.field_150348_b) ++ if (p_180624_1_.func_180495_p(blockpos1).func_177230_c().isReplaceableOreGen(p_180624_1_, blockpos1, net.minecraft.block.state.pattern.BlockHelper.func_177642_a(Blocks.field_150348_b))) { - p_76728_1_.func_147465_d(i1, j1, k1, Blocks.field_150412_bA, 0, 2); + p_180624_1_.func_180501_a(blockpos1, Blocks.field_150412_bA.func_176223_P(), 2); } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch index 497dbcde6e..52cad76252 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch @@ -1,13 +1,13 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenJungle.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenJungle.java -@@ -59,7 +59,9 @@ - super.func_76728_a(p_76728_1_, p_76728_2_, p_76728_3_, p_76728_4_); - int k = p_76728_3_ + p_76728_2_.nextInt(16) + 8; - int l = p_76728_4_ + p_76728_2_.nextInt(16) + 8; -- int i1 = p_76728_2_.nextInt(p_76728_1_.func_72976_f(k, l) * 2); -+ int height = p_76728_1_.func_72976_f(k, l) * 2; //This was the original input for the nextInt below. But it could == 0, which crashes nextInt +@@ -61,7 +61,9 @@ + 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 i1 = p_76728_2_.nextInt(height); - (new WorldGenMelon()).func_76484_a(p_76728_1_, p_76728_2_, k, i1, l); ++ int k = p_180624_2_.nextInt(height); + (new WorldGenMelon()).func_180709_b(p_180624_1_, p_180624_2_, p_180624_3_.func_177982_a(i, k, j)); WorldGenVines worldgenvines = new WorldGenVines(); diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch index b56164747d..307fd62fc3 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch @@ -1,26 +1,22 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenPlains.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenPlains.java -@@ -3,6 +3,7 @@ - import java.util.Random; - import net.minecraft.block.BlockFlower; - import net.minecraft.entity.passive.EntityHorse; -+import net.minecraft.init.Blocks; - import net.minecraft.world.World; - - public class BiomeGenPlains extends BiomeGenBase -@@ -19,6 +20,15 @@ - this.field_76760_I.field_76832_z = -999; - this.field_76760_I.field_76802_A = 4; - this.field_76760_I.field_76803_B = 10; -+ this.flowers.clear(); -+ this.addFlower(Blocks.field_150328_O, 4, 3); -+ this.addFlower(Blocks.field_150328_O, 5, 3); -+ this.addFlower(Blocks.field_150328_O, 6, 3); -+ this.addFlower(Blocks.field_150328_O, 7, 3); -+ this.addFlower(Blocks.field_150328_O, 0, 20); -+ this.addFlower(Blocks.field_150328_O, 3, 20); -+ this.addFlower(Blocks.field_150328_O, 8, 20); -+ this.addFlower(Blocks.field_150327_N, 0, 30); +@@ -109,4 +109,19 @@ + biomegenplains.field_150609_ah = 14273354; + return biomegenplains; } - - public String func_150572_a(Random p_150572_1_, int p_150572_2_, int p_150572_3_, int p_150572_4_) ++ ++ @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); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch index 719c97a0eb..d3c19e2702 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch @@ -1,11 +1,13 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java -@@ -30,6 +30,8 @@ - this.field_76760_I.field_76803_B = 5; - this.field_76759_H = 14745518; - this.field_76761_J.add(new BiomeGenBase.SpawnListEntry(EntitySlime.class, 1, 1, 1)); -+ this.flowers.clear(); -+ this.addFlower(Blocks.field_150328_O, 1, 10); +@@ -86,4 +86,10 @@ + { + return 6975545; } - - public WorldGenAbstractTree func_150567_a(Random p_150567_1_) ++ ++ @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/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch b/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch index 474f786a27..c23cb8256a 100644 --- a/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch @@ -1,31 +1,23 @@ --- ../src-base/minecraft/net/minecraft/world/biome/WorldChunkManager.java +++ ../src-work/minecraft/net/minecraft/world/biome/WorldChunkManager.java -@@ -3,6 +3,7 @@ - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; - import java.util.ArrayList; -+import java.util.Arrays; - import java.util.List; - import java.util.Random; - import net.minecraft.crash.CrashReport; -@@ -13,9 +14,13 @@ - import net.minecraft.world.WorldType; - import net.minecraft.world.gen.layer.GenLayer; - import net.minecraft.world.gen.layer.IntCache; +@@ -14,8 +14,13 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.terraingen.WorldTypeEvent; +import static net.minecraft.world.biome.BiomeGenBase.*; - ++ public class WorldChunkManager { -+ public static ArrayList allowedBiomes = new ArrayList(Arrays.asList(field_76767_f, field_76772_c, field_76768_g, field_76784_u, field_76785_t, field_76782_w, field_76792_x)); ++ public static List allowedBiomes = Lists.newArrayList(field_76767_f, field_76772_c, field_76768_g, field_76784_u, field_76785_t, field_76782_w, field_76792_x); private GenLayer field_76944_d; private GenLayer field_76945_e; private BiomeCache field_76942_f; -@@ -26,19 +31,14 @@ - { +@@ -28,13 +33,7 @@ this.field_76942_f = new BiomeCache(this); - this.field_76943_g = new ArrayList(); + this.field_180301_f = ""; + this.field_76943_g = Lists.newArrayList(); - this.field_76943_g.add(BiomeGenBase.field_76767_f); - this.field_76943_g.add(BiomeGenBase.field_76772_c); - this.field_76943_g.add(BiomeGenBase.field_76768_g); @@ -36,15 +28,16 @@ + this.field_76943_g.addAll(allowedBiomes); } - public WorldChunkManager(long p_i1975_1_, WorldType p_i1975_3_) - { + public WorldChunkManager(long p_i45744_1_, WorldType p_i45744_3_, String p_i45744_4_) +@@ -42,6 +41,7 @@ this(); - GenLayer[] agenlayer = GenLayer.func_75901_a(p_i1975_1_, p_i1975_3_); -+ agenlayer = getModdedBiomeGenerators(p_i1975_3_, p_i1975_1_, agenlayer); + this.field_180301_f = p_i45744_4_; + GenLayer[] agenlayer = GenLayer.func_180781_a(p_i45744_1_, p_i45744_3_, p_i45744_4_); ++ agenlayer = getModdedBiomeGenerators(p_i45744_3_, p_i45744_1_, agenlayer); this.field_76944_d = agenlayer[0]; this.field_76945_e = agenlayer[1]; } -@@ -242,4 +242,11 @@ +@@ -250,4 +250,11 @@ { this.field_76942_f.func_76838_a(); } diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index 0b1700e5b0..7966f3cd37 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -1,17 +1,16 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java +++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java -@@ -29,6 +29,10 @@ - import net.minecraft.world.biome.BiomeGenBase; - import net.minecraft.world.biome.WorldChunkManager; - import net.minecraft.world.chunk.storage.ExtendedBlockStorage; +@@ -35,6 +35,9 @@ + import net.minecraft.world.gen.ChunkProviderDebug; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.EntityEvent; +import net.minecraftforge.event.world.ChunkEvent; -+ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -@@ -194,7 +198,7 @@ +@@ -174,7 +177,7 @@ { Block block = this.func_150810_a(j, l - 1, k); @@ -20,70 +19,61 @@ { --l; continue; -@@ -493,7 +497,9 @@ +@@ -469,12 +472,12 @@ - public int func_150808_b(int p_150808_1_, int p_150808_2_, int p_150808_3_) + public int func_177437_b(BlockPos p_177437_1_) { -- return this.func_150810_a(p_150808_1_, p_150808_2_, p_150808_3_).func_149717_k(); -+ int x = (field_76635_g << 4) + p_150808_1_; -+ int z = (field_76647_h << 4) + p_150808_3_; -+ return this.func_150810_a(p_150808_1_, p_150808_2_, p_150808_3_).getLightOpacity(field_76637_e, x, p_150808_2_, z); +- return this.func_177428_a(p_177437_1_).func_149717_k(); ++ return this.func_177428_a(p_177437_1_).getLightOpacity(field_76637_e, p_177437_1_); } - public Block func_150810_a(final int p_150810_1_, final int p_150810_2_, final int p_150810_3_) -@@ -579,20 +585,33 @@ - int l1 = this.field_76635_g * 16 + p_150807_1_; - int i2 = this.field_76647_h * 16 + p_150807_3_; + private int func_150808_b(int p_150808_1_, int p_150808_2_, int p_150808_3_) + { +- return this.func_150810_a(p_150808_1_, p_150808_2_, p_150808_3_).func_149717_k(); ++ return func_177437_b(new BlockPos((field_76635_g << 4) + p_150808_1_, p_150808_2_, (field_76647_h << 4) + p_150808_3_)); + } -+ int k2 = block1.getLightOpacity(this.field_76637_e, l1, p_150807_2_, i2); + private Block func_150810_a(int p_150810_1_, int p_150810_2_, int p_150810_3_) +@@ -653,16 +656,20 @@ + flag = j >= i1; + } + ++ int j1 = block.getLightOpacity(this.field_76637_e, p_177436_1_); + - if (!this.field_76637_e.field_72995_K) - { - block1.func_149725_f(this.field_76637_e, l1, p_150807_2_, i2, k1); - } + extendedblockstorage.func_177484_a(i, j & 15, k, p_177436_2_); - extendedblockstorage.func_150818_a(p_150807_1_, p_150807_2_ & 15, p_150807_3_, p_150807_4_); -+ extendedblockstorage.func_76654_b(p_150807_1_, p_150807_2_ & 15, p_150807_3_, p_150807_5_); // This line duplicates the one below, so breakBlock fires with valid worldstate - - if (!this.field_76637_e.field_72995_K) +- if (block1 != block) ++ //if (block1 != block) { - block1.func_149749_a(this.field_76637_e, l1, p_150807_2_, i2, block1, k1); -+ // After breakBlock a phantom TE might have been created with incorrect meta. This attempts to kill that phantom TE so the normal one can be create properly later -+ TileEntity te = this.getTileEntityUnsafe(p_150807_1_ & 0x0F, p_150807_2_, p_150807_3_ & 0x0F); -+ if (te != null && te.shouldRefresh(block1, func_150810_a(p_150807_1_ & 0x0F, p_150807_2_, p_150807_3_ & 0x0F), k1, func_76628_c(p_150807_1_ & 0x0F, p_150807_2_, p_150807_3_ & 0x0F), field_76637_e, l1, p_150807_2_, i2)) -+ { -+ this.func_150805_f(p_150807_1_ & 0x0F, p_150807_2_, p_150807_3_ & 0x0F); -+ } + if (!this.field_76637_e.field_72995_K) + { + block1.func_180663_b(this.field_76637_e, p_177436_1_, iblockstate1); + } +- else if (block1 instanceof ITileEntityProvider) ++ else if (block1.hasTileEntity(iblockstate1)) + { ++ TileEntity te = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); ++ if (te != null && te.shouldRefresh(this.field_76637_e, p_177436_1_, iblockstate1, p_177436_2_)) + this.field_76637_e.func_175713_t(p_177436_1_); + } } -- else if (block1 instanceof ITileEntityProvider && block1 != p_150807_4_) -+ else if (block1.hasTileEntity(k1)) - { -- this.field_76637_e.func_147475_p(l1, p_150807_2_, i2); -+ TileEntity te = this.getTileEntityUnsafe(p_150807_1_ & 0x0F, p_150807_2_, p_150807_3_ & 0x0F); -+ if (te != null && te.shouldRefresh(block1, p_150807_4_, k1, p_150807_5_, field_76637_e, l1, p_150807_2_, i2)) -+ { -+ this.field_76637_e.func_147475_p(l1, p_150807_2_, i2); -+ } - } - - if (extendedblockstorage.func_150819_a(p_150807_1_, p_150807_2_ & 15, p_150807_3_) != p_150807_4_) -@@ -609,8 +628,7 @@ +@@ -679,8 +686,7 @@ } else { -- int j2 = p_150807_4_.func_149717_k(); -- int k2 = block1.func_149717_k(); -+ int j2 = p_150807_4_.getLightOpacity(this.field_76637_e, l1, p_150807_2_, i2); +- int j1 = block.func_149717_k(); +- int k1 = block1.func_149717_k(); ++ int k1 = block.getLightOpacity(this.field_76637_e, p_177436_1_); - if (j2 > 0) + if (j1 > 0) { -@@ -632,34 +650,19 @@ +@@ -702,28 +708,18 @@ TileEntity tileentity; - if (block1 instanceof ITileEntityProvider) - { -- tileentity = this.func_150806_e(p_150807_1_, p_150807_2_, p_150807_3_); +- tileentity = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); - - if (tileentity != null) - { @@ -91,39 +81,24 @@ - } - } - - if (!this.field_76637_e.field_72995_K) + if (!this.field_76637_e.field_72995_K && block1 != block) { - p_150807_4_.func_149726_b(this.field_76637_e, l1, p_150807_2_, i2); + block.func_176213_c(this.field_76637_e, p_177436_1_, p_177436_2_); } -- if (p_150807_4_ instanceof ITileEntityProvider) -+ if (p_150807_4_.hasTileEntity(p_150807_5_)) +- if (block instanceof ITileEntityProvider) ++ if (block.hasTileEntity(p_177436_2_)) { - tileentity = this.func_150806_e(p_150807_1_, p_150807_2_, p_150807_3_); + tileentity = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); -- if (tileentity == null) -- { -- tileentity = ((ITileEntityProvider)p_150807_4_).func_149915_a(this.field_76637_e, p_150807_5_); -- this.field_76637_e.func_147455_a(l1, p_150807_2_, i2, tileentity); -- } -- - if (tileentity != null) + if (tileentity == null) { - tileentity.func_145836_u(); -+ tileentity.field_145847_g = p_150807_5_; +- tileentity = ((ITileEntityProvider)block).func_149915_a(this.field_76637_e, block.func_176201_c(p_177436_2_)); ++ tileentity = block.createTileEntity(this.field_76637_e, p_177436_2_); + this.field_76637_e.func_175690_a(p_177436_1_, tileentity); } - } -@@ -690,7 +693,7 @@ - this.field_76643_l = true; - extendedblockstorage.func_76654_b(p_76589_1_, p_76589_2_ & 15, p_76589_3_, p_76589_4_); - -- if (extendedblockstorage.func_150819_a(p_76589_1_, p_76589_2_ & 15, p_76589_3_) instanceof ITileEntityProvider) -+ if (extendedblockstorage.func_150819_a(p_76589_1_, p_76589_2_ & 15, p_76589_3_).hasTileEntity(p_76589_4_)) - { - TileEntity tileentity = this.func_150806_e(p_76589_1_, p_76589_2_, p_76589_3_); - -@@ -790,6 +793,7 @@ +@@ -826,6 +822,7 @@ k = this.field_76645_j.length - 1; } @@ -131,105 +106,102 @@ p_76612_1_.field_70175_ag = true; p_76612_1_.field_70176_ah = this.field_76635_g; p_76612_1_.field_70162_ai = k; -@@ -827,28 +831,27 @@ - ChunkPosition chunkposition = new ChunkPosition(p_150806_1_, p_150806_2_, p_150806_3_); - TileEntity tileentity = (TileEntity)this.field_150816_i.get(chunkposition); +@@ -864,13 +861,20 @@ + private TileEntity func_177422_i(BlockPos p_177422_1_) + { + Block block = this.func_177428_a(p_177422_1_); +- return !block.func_149716_u() ? null : ((ITileEntityProvider)block).func_149915_a(this.field_76637_e, this.func_177418_c(p_177422_1_)); ++ IBlockState state = block.func_176203_a(this.func_177418_c(p_177422_1_)); ++ return !block.hasTileEntity(state) ? null : block.createTileEntity(this.field_76637_e, state); + } + + public TileEntity func_177424_a(BlockPos p_177424_1_, Chunk.EnumCreateEntityType p_177424_2_) + { + TileEntity tileentity = (TileEntity)this.field_150816_i.get(p_177424_1_); + if (tileentity != null && tileentity.func_145837_r()) + { -+ field_150816_i.remove(chunkposition); ++ field_150816_i.remove(p_177424_1_); + tileentity = null; + } + if (tileentity == null) { - Block block = this.func_150810_a(p_150806_1_, p_150806_2_, p_150806_3_); -+ int meta = this.func_76628_c(p_150806_1_, p_150806_2_, p_150806_3_); - -- if (!block.func_149716_u()) -+ if (!block.hasTileEntity(meta)) - { - return null; + if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) +@@ -883,11 +887,6 @@ + this.field_177447_w.add(p_177424_1_); } - -- tileentity = ((ITileEntityProvider)block).func_149915_a(this.field_76637_e, this.func_76628_c(p_150806_1_, p_150806_2_, p_150806_3_)); -+ tileentity = block.createTileEntity(field_76637_e, meta); - this.field_76637_e.func_147455_a(this.field_76635_g * 16 + p_150806_1_, p_150806_2_, this.field_76647_h * 16 + p_150806_3_, tileentity); } - -- if (tileentity != null && tileentity.func_145837_r()) +- else if (tileentity.func_145837_r()) - { -- this.field_150816_i.remove(chunkposition); +- this.field_150816_i.remove(p_177424_1_); - return null; - } -- else -- { -- return tileentity; -- } -+ return tileentity; + + return tileentity; } +@@ -907,7 +906,7 @@ + p_177426_2_.func_145834_a(this.field_76637_e); + p_177426_2_.func_174878_a(p_177426_1_); - public void func_150813_a(TileEntity p_150813_1_) -@@ -860,7 +863,7 @@ - - if (this.field_76636_d) +- if (this.func_177428_a(p_177426_1_) instanceof ITileEntityProvider) ++ if (this.func_177428_a(p_177426_1_).hasTileEntity(func_177428_a(p_177426_1_).func_176203_a(this.func_177418_c(p_177426_1_)))) { -- this.field_76637_e.field_147482_g.add(p_150813_1_); -+ this.field_76637_e.addTileEntity(p_150813_1_); - } - } - -@@ -872,7 +875,8 @@ - p_150812_4_.field_145848_d = p_150812_2_; - p_150812_4_.field_145849_e = this.field_76647_h * 16 + p_150812_3_; - -- if (this.func_150810_a(p_150812_1_, p_150812_2_, p_150812_3_) instanceof ITileEntityProvider) -+ int metadata = func_76628_c(p_150812_1_, p_150812_2_, p_150812_3_); -+ if (this.func_150810_a(p_150812_1_, p_150812_2_, p_150812_3_).hasTileEntity(metadata)) - { - if (this.field_150816_i.containsKey(chunkposition)) + if (this.field_150816_i.containsKey(p_177426_1_)) { -@@ -916,6 +920,7 @@ +@@ -949,6 +948,7 @@ - this.field_76637_e.func_72868_a(this.field_76645_j[i]); + this.field_76637_e.func_175650_b(this.field_76645_j[i]); } + MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(this)); } public void func_76623_d() -@@ -933,6 +938,7 @@ +@@ -966,6 +966,7 @@ { - this.field_76637_e.func_72828_b(this.field_76645_j[i]); + this.field_76637_e.func_175681_c(this.field_76645_j[i]); } + MinecraftForge.EVENT_BUS.post(new ChunkEvent.Unload(this)); } public void func_76630_e() -@@ -942,8 +948,8 @@ +@@ -975,8 +976,8 @@ - public void func_76588_a(Entity p_76588_1_, AxisAlignedBB p_76588_2_, List p_76588_3_, IEntitySelector p_76588_4_) + public void func_177414_a(Entity p_177414_1_, AxisAlignedBB p_177414_2_, List p_177414_3_, Predicate p_177414_4_) { -- int i = MathHelper.func_76128_c((p_76588_2_.field_72338_b - 2.0D) / 16.0D); -- int j = MathHelper.func_76128_c((p_76588_2_.field_72337_e + 2.0D) / 16.0D); -+ int i = MathHelper.func_76128_c((p_76588_2_.field_72338_b - World.MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.func_76128_c((p_76588_2_.field_72337_e + World.MAX_ENTITY_RADIUS) / 16.0D); +- int i = MathHelper.func_76128_c((p_177414_2_.field_72338_b - 2.0D) / 16.0D); +- int j = MathHelper.func_76128_c((p_177414_2_.field_72337_e + 2.0D) / 16.0D); ++ int i = MathHelper.func_76128_c((p_177414_2_.field_72338_b - World.MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.func_76128_c((p_177414_2_.field_72337_e + World.MAX_ENTITY_RADIUS) / 16.0D); i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1); j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1); -@@ -979,8 +985,8 @@ +@@ -1012,8 +1013,8 @@ - public void func_76618_a(Class p_76618_1_, AxisAlignedBB p_76618_2_, List p_76618_3_, IEntitySelector p_76618_4_) + public void func_177430_a(Class p_177430_1_, AxisAlignedBB p_177430_2_, List p_177430_3_, Predicate p_177430_4_) { -- int i = MathHelper.func_76128_c((p_76618_2_.field_72338_b - 2.0D) / 16.0D); -- int j = MathHelper.func_76128_c((p_76618_2_.field_72337_e + 2.0D) / 16.0D); -+ int i = MathHelper.func_76128_c((p_76618_2_.field_72338_b - World.MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.func_76128_c((p_76618_2_.field_72337_e + World.MAX_ENTITY_RADIUS) / 16.0D); +- int i = MathHelper.func_76128_c((p_177430_2_.field_72338_b - 2.0D) / 16.0D); +- int j = MathHelper.func_76128_c((p_177430_2_.field_72337_e + 2.0D) / 16.0D); ++ int i = MathHelper.func_76128_c((p_177430_2_.field_72338_b - World.MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.func_76128_c((p_177430_2_.field_72337_e + World.MAX_ENTITY_RADIUS) / 16.0D); i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1); j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1); -@@ -1139,6 +1145,15 @@ +@@ -1179,8 +1180,10 @@ + while (!this.field_177447_w.isEmpty()) + { + BlockPos blockpos = (BlockPos)this.field_177447_w.poll(); ++ Block block = this.func_177428_a(blockpos); ++ IBlockState state = block.func_176203_a(this.func_177418_c(blockpos)); + +- if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.func_177428_a(blockpos).func_149716_u()) ++ if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && block.hasTileEntity(state)) + { + TileEntity tileentity = this.func_177422_i(blockpos); + this.field_76637_e.func_175690_a(blockpos, tileentity); +@@ -1242,6 +1245,15 @@ @SideOnly(Side.CLIENT) - public void func_76607_a(byte[] p_76607_1_, int p_76607_2_, int p_76607_3_, boolean p_76607_4_) + public void func_177439_a(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_) { + Iterator iterator = field_150816_i.values().iterator(); + while(iterator.hasNext()) @@ -240,83 +212,46 @@ + tileEntity.func_145838_q(); + } + - int k = 0; - boolean flag1 = !this.field_76637_e.field_73011_w.field_76576_e; - int l; -@@ -1241,13 +1256,27 @@ + int j = 0; + boolean flag1 = !this.field_76637_e.field_73011_w.func_177495_o(); + int k; +@@ -1311,13 +1323,18 @@ this.field_150814_l = true; this.field_76646_k = true; this.func_76590_a(); - Iterator iterator = this.field_150816_i.values().iterator(); -+ List invalidList = new ArrayList(); ++ List invalidList = new java.util.ArrayList(); + iterator = this.field_150816_i.values().iterator(); while (iterator.hasNext()) { TileEntity tileentity = (TileEntity)iterator.next(); -+ int x = tileentity.field_145851_c & 15; -+ int y = tileentity.field_145848_d; -+ int z = tileentity.field_145849_e & 15; -+ Block block = tileentity.func_145838_q(); -+ if (block != func_150810_a(x, y, z) || tileentity.field_145847_g != this.func_76628_c(x, y, z)) -+ { ++ if (tileentity.func_145838_q() != func_177428_a(tileentity.func_174877_v()) || tileentity.func_145832_p() != func_177418_c(tileentity.func_174877_v())) + invalidList.add(tileentity); -+ } tileentity.func_145836_u(); } + -+ for (TileEntity te : invalidList) -+ { -+ te.func_145843_s(); -+ } ++ for (TileEntity te : invalidList) te.func_145843_s(); } - public BiomeGenBase func_76591_a(int p_76591_1_, int p_76591_2_, WorldChunkManager p_76591_3_) -@@ -1450,4 +1479,48 @@ + public BiomeGenBase func_177411_a(BlockPos p_177411_1_, WorldChunkManager p_177411_2_) +@@ -1644,4 +1661,20 @@ - return true; + private static final String __OBFID = "CL_00002009"; } + + /** -+ * Retrieves the tile entity, WITHOUT creating it. -+ * Good for checking if it exists. -+ * -+ * @param x -+ * @param y -+ * @param z -+ * @return The tile entity at the specified location, if it exists and is valid. -+ */ -+ public TileEntity getTileEntityUnsafe(int x, int y, int z) -+ { -+ ChunkPosition chunkposition = new ChunkPosition(x, y, z); -+ TileEntity tileentity = (TileEntity)this.field_150816_i.get(chunkposition); -+ -+ if (tileentity != null && tileentity.func_145837_r()) -+ { -+ field_150816_i.remove(chunkposition); -+ tileentity = null; -+ } -+ -+ return tileentity; -+ } -+ -+ /** + * Removes the tile entity at the specified position, only if it's + * marked as invalid. -+ * -+ * @param x -+ * @param y -+ * @param z + */ -+ public void removeInvalidTileEntity(int x, int y, int z) ++ public void removeInvalidTileEntity(BlockPos pos) + { -+ ChunkPosition position = new ChunkPosition(x, y, z); + if (field_76636_d) + { -+ TileEntity entity = (TileEntity)field_150816_i.get(position); ++ TileEntity entity = (TileEntity)field_150816_i.get(pos); + if (entity != null && entity.func_145837_r()) + { -+ field_150816_i.remove(position); ++ field_150816_i.remove(pos); + } + } + } 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 a2e8f71ab1..44b0a56f6d 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch @@ -1,21 +1,21 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java -@@ -25,6 +25,8 @@ +@@ -26,6 +26,8 @@ import net.minecraft.world.chunk.NibbleArray; import net.minecraft.world.storage.IThreadedFileIO; import net.minecraft.world.storage.ThreadedFileIOBase; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.world.ChunkDataEvent; - - import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; -@@ -46,8 +48,46 @@ + import org.apache.logging.log4j.Logger; + +@@ -43,8 +45,45 @@ this.field_75825_d = p_i2003_1_; } -+ public boolean chunkExists(World world, int i, int j) ++ public boolean chunkExists(World world, int x, int z) + { -+ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); ++ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); + + synchronized (this.field_75827_c) + { @@ -33,9 +33,8 @@ + } + } + -+ return RegionFileCache.func_76550_a(this.field_75825_d, i, j).chunkExists(i & 31, j & 31); ++ return RegionFileCache.func_76550_a(this.field_75825_d, x, z).chunkExists(x & 31, z & 31); + } -+ public Chunk func_75815_a(World p_75815_1_, int p_75815_2_, int p_75815_3_) throws IOException { + Object[] data = this.loadChunk__Async(p_75815_1_, p_75815_2_, p_75815_3_); @@ -56,7 +55,7 @@ NBTTagCompound nbttagcompound = null; ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_75815_2_, p_75815_3_); Object object = this.field_75827_c; -@@ -56,11 +96,13 @@ +@@ -53,11 +92,13 @@ { if (this.field_75826_b.contains(chunkcoordintpair)) { @@ -73,7 +72,7 @@ break; } } -@@ -79,11 +121,24 @@ +@@ -76,11 +117,17 @@ nbttagcompound = CompressedStreamTools.func_74794_a(datainputstream); } @@ -84,14 +83,7 @@ protected Chunk func_75822_a(World p_75822_1_, int p_75822_2_, int p_75822_3_, NBTTagCompound p_75822_4_) { + Object[] data = this.checkedReadChunkFromNBT__Async(p_75822_1_, p_75822_2_, p_75822_3_, p_75822_4_); -+ -+ if (data != null) -+ { -+ Chunk chunk = (Chunk) data[0]; -+ return chunk; -+ } -+ -+ return null; ++ return data != null ? (Chunk)data[0] : null; + } + + protected Object[] checkedReadChunkFromNBT__Async(World p_75822_1_, int p_75822_2_, int p_75822_3_, NBTTagCompound p_75822_4_) @@ -99,10 +91,11 @@ if (!p_75822_4_.func_150297_b("Level", 10)) { field_151505_a.error("Chunk file at " + p_75822_2_ + "," + p_75822_3_ + " is missing level data, skipping"); -@@ -103,10 +158,30 @@ +@@ -100,10 +147,29 @@ field_151505_a.error("Chunk file at " + p_75822_2_ + "," + p_75822_3_ + " is in the wrong location; relocating. (Expected " + p_75822_2_ + ", " + p_75822_3_ + ", got " + chunk.field_76635_g + ", " + chunk.field_76647_h + ")"); p_75822_4_.func_74768_a("xPos", p_75822_2_); p_75822_4_.func_74768_a("zPos", p_75822_3_); ++ + // Have to move tile entities since we don't load them at this stage + NBTTagList tileEntities = p_75822_4_.func_74775_l("Level").func_150295_c("TileEntities", 10); + @@ -117,10 +110,9 @@ + tileEntity.func_74768_a("z", p_75822_3_ * 16 + z); + } + } -+ chunk = this.func_75823_a(p_75822_1_, p_75822_4_.func_74775_l("Level")); } - +- - return chunk; + Object[] data = new Object[2]; + data[0] = chunk; @@ -131,7 +123,7 @@ } } -@@ -120,6 +195,7 @@ +@@ -117,6 +183,7 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound.func_74782_a("Level", nbttagcompound1); this.func_75820_a(p_75816_2_, p_75816_1_, nbttagcompound1); @@ -139,7 +131,7 @@ this.func_75824_a(p_75816_2_.func_76632_l(), nbttagcompound); } catch (Exception exception) -@@ -373,6 +449,12 @@ +@@ -404,6 +471,12 @@ chunk.func_76616_a(p_75823_2_.func_74770_j("Biomes")); } @@ -152,12 +144,12 @@ NBTTagList nbttaglist1 = p_75823_2_.func_150295_c("Entities", 10); if (nbttaglist1 != null) -@@ -434,7 +516,7 @@ +@@ -475,8 +548,6 @@ + } } } - +- - return chunk; -+ // return chunk; } static class PendingChunk diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch index 623f8ca54f..af121db7f1 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/storage/RegionFile.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/RegionFile.java -@@ -104,6 +104,39 @@ +@@ -105,6 +105,39 @@ } } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch index 969358fdfc..c3e3d7a750 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch @@ -1,17 +1,16 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java -@@ -15,6 +15,10 @@ +@@ -15,6 +15,9 @@ import net.minecraft.world.chunk.Chunk; + import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.chunk.IChunkProvider; - +import net.minecraftforge.common.*; -+import cpw.mods.fml.common.eventhandler.Event.*; ++import net.minecraftforge.fml.common.eventhandler.Event.*; +import net.minecraftforge.event.terraingen.*; -+ + public class ChunkProviderEnd implements IChunkProvider { - private Random field_73204_i; -@@ -43,6 +47,14 @@ +@@ -43,6 +46,14 @@ this.field_73199_l = new NoiseGeneratorOctaves(this.field_73204_i, 8); this.field_73196_a = new NoiseGeneratorOctaves(this.field_73204_i, 10); this.field_73194_b = new NoiseGeneratorOctaves(this.field_73204_i, 16); @@ -25,40 +24,29 @@ + this.field_73194_b = (NoiseGeneratorOctaves)noiseGens[4]; } - public void func_147420_a(int p_147420_1_, int p_147420_2_, Block[] p_147420_3_, BiomeGenBase[] p_147420_4_) -@@ -113,8 +125,17 @@ + public void func_180520_a(int p_180520_1_, int p_180520_2_, ChunkPrimer p_180520_3_) +@@ -115,6 +126,9 @@ + + public void func_180519_a(ChunkPrimer p_180519_1_) + { ++ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, p_180519_1_, this.field_73200_m); ++ MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == Result.DENY) return; + for (int i = 0; i < 16; ++i) + { + for (int j = 0; j < 16; ++j) +@@ -164,8 +178,10 @@ } } -+ @Deprecated // Supply metadata to the below function. - public void func_147421_b(int p_147421_1_, int p_147421_2_, Block[] p_147421_3_, BiomeGenBase[] p_147421_4_) - { -+ replaceBiomeBlocks(p_147421_1_, p_147421_2_, p_147421_3_, p_147421_4_, new byte[p_147421_3_.length]); -+ } -+ public void replaceBiomeBlocks(int p_147421_1_, int p_147421_2_, Block[] p_147421_3_, BiomeGenBase[] p_147421_4_, byte[] meta) -+ { -+ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147421_1_, p_147421_2_, p_147421_3_, meta, p_147421_4_, this.field_73200_m); -+ MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == Result.DENY) return; -+ - for (int k = 0; k < 16; ++k) - { - for (int l = 0; l < 16; ++l) -@@ -177,10 +198,11 @@ ++ private int chunkX=0, chunkZ=0; + public Chunk func_73154_d(int p_73154_1_, int p_73154_2_) { ++ chunkX = p_73154_1_; chunkZ = p_73154_2_; this.field_73204_i.setSeed((long)p_73154_1_ * 341873128712L + (long)p_73154_2_ * 132897987541L); - Block[] ablock = new Block[32768]; -+ byte[] meta = new byte[ablock.length]; + ChunkPrimer chunkprimer = new ChunkPrimer(); this.field_73198_o = this.field_73200_m.func_72959_q().func_76933_b(this.field_73198_o, p_73154_1_ * 16, p_73154_2_ * 16, 16, 16); - this.func_147420_a(p_73154_1_, p_73154_2_, ablock, this.field_73198_o); -- this.func_147421_b(p_73154_1_, p_73154_2_, ablock, this.field_73198_o); -- Chunk chunk = new Chunk(this.field_73200_m, ablock, p_73154_1_, p_73154_2_); -+ this.replaceBiomeBlocks(p_73154_1_, p_73154_2_, ablock, this.field_73198_o, meta); -+ Chunk chunk = new Chunk(this.field_73200_m, ablock, meta, p_73154_1_, p_73154_2_); - byte[] abyte = chunk.func_76605_m(); - - for (int k = 0; k < abyte.length; ++k) -@@ -194,6 +216,10 @@ +@@ -185,6 +201,10 @@ private double[] func_73187_a(double[] p_73187_1_, int p_73187_2_, int p_73187_3_, int p_73187_4_, int p_73187_5_, int p_73187_6_, int p_73187_7_) { @@ -69,17 +57,15 @@ if (p_73187_1_ == null) { p_73187_1_ = new double[p_73187_5_ * p_73187_6_ * p_73187_7_]; -@@ -335,10 +361,16 @@ +@@ -275,8 +295,14 @@ public void func_73153_a(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { BlockFalling.field_149832_M = true; + + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, field_73200_m, field_73200_m.field_73012_v, p_73153_2_, p_73153_3_, false)); + - int k = p_73153_2_ * 16; - int l = p_73153_3_ * 16; - BiomeGenBase biomegenbase = this.field_73200_m.func_72807_a(k + 16, l + 16); - biomegenbase.func_76728_a(this.field_73200_m, this.field_73200_m.field_73012_v, k, l); + BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); + this.field_73200_m.func_180494_b(blockpos.func_177982_a(16, 0, 16)).func_180624_a(this.field_73200_m, this.field_73200_m.field_73012_v, blockpos); + + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, field_73200_m, field_73200_m.field_73012_v, p_73153_2_, p_73153_3_, false)); + diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch index fbc9345f0d..9ec15ca4ce 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch @@ -1,20 +1,19 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java -@@ -22,6 +22,12 @@ +@@ -24,6 +24,11 @@ import net.minecraft.world.gen.structure.MapGenStronghold; import net.minecraft.world.gen.structure.MapGenVillage; - + import net.minecraft.world.gen.structure.StructureOceanMonument; +import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.*; +import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*; +import net.minecraftforge.common.*; -+import cpw.mods.fml.common.eventhandler.Event.*; ++import net.minecraftforge.fml.common.eventhandler.Event.*; +import net.minecraftforge.event.terraingen.*; -+ + public class ChunkProviderGenerate implements IChunkProvider { - private Random field_73220_k; -@@ -52,6 +58,15 @@ - int[][] field_73219_j = new int[32][32]; +@@ -57,6 +62,15 @@ + double[] field_147426_g; private static final String __OBFID = "CL_00000396"; + { @@ -26,16 +25,16 @@ + field_73232_y = TerrainGen.getModdedMapGen(field_73232_y, RAVINE); + } + - public ChunkProviderGenerate(World p_i2006_1_, long p_i2006_2_, boolean p_i2006_4_) + public ChunkProviderGenerate(World p_i45636_1_, long p_i45636_2_, boolean p_i45636_4_, String p_i45636_5_) { - this.field_73230_p = p_i2006_1_; -@@ -76,6 +91,16 @@ - this.field_147433_r[j + 2 + (k + 2) * 5] = f; - } + this.field_177476_s = Blocks.field_150355_j; +@@ -96,6 +110,16 @@ + this.field_177477_r = ChunkProviderSettings.Factory.func_177865_a(p_i45636_5_).func_177864_b(); + this.field_177476_s = this.field_177477_r.field_177778_E ? Blocks.field_150353_l : Blocks.field_150355_j; } + + NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, field_73214_a, field_73212_b, field_73213_c}; -+ noiseGens = TerrainGen.getModdedNoiseGenerators(p_i2006_1_, this.field_73220_k, noiseGens); ++ noiseGens = TerrainGen.getModdedNoiseGenerators(p_i45636_1_, this.field_73220_k, noiseGens); + this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0]; + this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1]; + this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2]; @@ -45,74 +44,73 @@ + this.field_73213_c = (NoiseGeneratorOctaves)noiseGens[6]; } - public void func_147424_a(int p_147424_1_, int p_147424_2_, Block[] p_147424_3_) -@@ -157,6 +182,10 @@ + public void func_180518_a(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) +@@ -169,6 +193,10 @@ - public void func_147422_a(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_) + public void func_180517_a(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) { -+ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147422_1_, p_147422_2_, p_147422_3_, p_147422_4_, p_147422_5_, this.field_73230_p); ++ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.field_73230_p); + MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == Result.DENY) return; + double d0 = 0.03125D; - this.field_73227_s = this.field_147430_m.func_151599_a(this.field_73227_s, (double)(p_147422_1_ * 16), (double)(p_147422_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); + this.field_73227_s = this.field_147430_m.func_151599_a(this.field_73227_s, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); -@@ -345,6 +374,8 @@ - this.field_73220_k.setSeed((long)p_73153_2_ * i1 + (long)p_73153_3_ * j1 ^ this.field_73230_p.func_72905_C()); +@@ -375,6 +403,8 @@ boolean flag = false; + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag)); + - if (this.field_73229_q) + if (this.field_177477_r.field_177829_w && this.field_73229_q) { - this.field_73223_w.func_75051_a(this.field_73230_p, this.field_73220_k, p_73153_2_, p_73153_3_); -@@ -357,7 +388,8 @@ + this.field_73223_w.func_175794_a(this.field_73230_p, this.field_73220_k, chunkcoordintpair); +@@ -404,7 +434,8 @@ int l1; int i2; -- if (biomegenbase != BiomeGenBase.field_76769_d && biomegenbase != BiomeGenBase.field_76786_s && !flag && this.field_73220_k.nextInt(4) == 0) -+ if (biomegenbase != BiomeGenBase.field_76769_d && biomegenbase != BiomeGenBase.field_76786_s && !flag && this.field_73220_k.nextInt(4) == 0 +- if (biomegenbase != BiomeGenBase.field_76769_d && biomegenbase != BiomeGenBase.field_76786_s && this.field_177477_r.field_177781_A && !flag && this.field_73220_k.nextInt(this.field_177477_r.field_177782_B) == 0) ++ if (biomegenbase != BiomeGenBase.field_76769_d && biomegenbase != BiomeGenBase.field_76786_s && this.field_177477_r.field_177781_A && !flag && this.field_73220_k.nextInt(this.field_177477_r.field_177782_B) == 0 + && TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, LAKE)) { - k1 = k + this.field_73220_k.nextInt(16) + 8; + k1 = this.field_73220_k.nextInt(16) + 8; l1 = this.field_73220_k.nextInt(256); -@@ -365,7 +397,7 @@ - (new WorldGenLakes(Blocks.field_150355_j)).func_76484_a(this.field_73230_p, this.field_73220_k, k1, l1, i2); +@@ -412,7 +443,7 @@ + (new WorldGenLakes(Blocks.field_150355_j)).func_180709_b(this.field_73230_p, this.field_73220_k, blockpos.func_177982_a(k1, l1, i2)); } -- if (!flag && this.field_73220_k.nextInt(8) == 0) -+ if (TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, LAVA) && !flag && this.field_73220_k.nextInt(8) == 0) +- if (!flag && this.field_73220_k.nextInt(this.field_177477_r.field_177777_D / 10) == 0 && this.field_177477_r.field_177783_C) ++ if (TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, LAVA) && !flag && this.field_73220_k.nextInt(this.field_177477_r.field_177777_D / 10) == 0 && this.field_177477_r.field_177783_C) { - k1 = k + this.field_73220_k.nextInt(16) + 8; + k1 = this.field_73220_k.nextInt(16) + 8; l1 = this.field_73220_k.nextInt(this.field_73220_k.nextInt(248) + 8); -@@ -377,7 +409,8 @@ - } - } +@@ -426,7 +457,8 @@ -- for (k1 = 0; k1 < 8; ++k1) -+ boolean doGen = TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, DUNGEON); -+ for (k1 = 0; doGen && k1 < 8; ++k1) + if (this.field_177477_r.field_177837_s) { - l1 = k + this.field_73220_k.nextInt(16) + 8; - i2 = this.field_73220_k.nextInt(256); -@@ -386,11 +419,15 @@ +- for (k1 = 0; k1 < this.field_177477_r.field_177835_t; ++k1) ++ boolean doGen = TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, DUNGEON); ++ for (k1 = 0; doGen && k1 < this.field_177477_r.field_177835_t; ++k1) + { + l1 = this.field_73220_k.nextInt(16) + 8; + i2 = this.field_73220_k.nextInt(256); +@@ -436,10 +468,14 @@ } - biomegenbase.func_76728_a(this.field_73230_p, this.field_73220_k, k, l); + biomegenbase.func_180624_a(this.field_73230_p, this.field_73220_k, new BlockPos(k, 0, l)); + if (TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, ANIMALS)) + { SpawnerAnimals.func_77191_a(this.field_73230_p, biomegenbase, k + 8, l + 8, 16, 16, this.field_73220_k); + } - k += 8; - l += 8; + blockpos = blockpos.func_177982_a(8, 0, 8); - for (k1 = 0; k1 < 16; ++k1) -+ doGen = TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, ICE); ++ boolean doGen = TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, ICE); + for (k1 = 0; doGen && k1 < 16; ++k1) { for (l1 = 0; l1 < 16; ++l1) { -@@ -408,6 +445,8 @@ +@@ -458,6 +494,8 @@ } } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch index ad4cba80af..98670b6ba7 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch @@ -1,39 +1,49 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderHell.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderHell.java -@@ -21,6 +21,14 @@ +@@ -24,6 +24,13 @@ import net.minecraft.world.gen.feature.WorldGenMinable; + import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.structure.MapGenNetherBridge; - +import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*; +import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.*; +import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*; +import static net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.*; +import net.minecraftforge.common.*; -+import cpw.mods.fml.common.eventhandler.Event.*; ++import net.minecraftforge.fml.common.eventhandler.Event.*; +import net.minecraftforge.event.terraingen.*; -+ + public class ChunkProviderHell implements IChunkProvider { - private Random field_73181_i; -@@ -45,6 +53,11 @@ - double[] field_73180_h; - private static final String __OBFID = "CL_00000392"; - -+ { -+ field_73172_c = (MapGenNetherBridge) TerrainGen.getModdedMapGen(field_73172_c, NETHER_BRIDGE); -+ field_73182_t = TerrainGen.getModdedMapGen(field_73182_t, NETHER_CAVE); -+ } +@@ -65,18 +72,30 @@ + this.field_177472_y = new WorldGenHellLava(Blocks.field_150356_k, false); + this.field_177471_z = new GeneratorBushFeature(Blocks.field_150338_P); + this.field_177465_A = new GeneratorBushFeature(Blocks.field_150337_Q); +- this.field_73172_c = new MapGenNetherBridge(); +- this.field_73182_t = new MapGenCavesHell(); ++ this.field_73172_c = (MapGenNetherBridge) TerrainGen.getModdedMapGen(new MapGenNetherBridge(), NETHER_BRIDGE); ++ this.field_73182_t = TerrainGen.getModdedMapGen(new MapGenCavesHell(), NETHER_CAVE); + this.field_73175_o = p_i45637_1_; + this.field_177466_i = p_i45637_2_; + this.field_73181_i = new Random(p_i45637_3_); +- this.field_73178_j = new NoiseGeneratorOctaves(this.field_73181_i, 16); +- this.field_73179_k = new NoiseGeneratorOctaves(this.field_73181_i, 16); +- this.field_73176_l = new NoiseGeneratorOctaves(this.field_73181_i, 8); +- this.field_73177_m = new NoiseGeneratorOctaves(this.field_73181_i, 4); +- this.field_73174_n = new NoiseGeneratorOctaves(this.field_73181_i, 4); +- this.field_73173_a = new NoiseGeneratorOctaves(this.field_73181_i, 10); +- this.field_73171_b = new NoiseGeneratorOctaves(this.field_73181_i, 16); + - public ChunkProviderHell(World p_i2005_1_, long p_i2005_2_) - { - this.field_73175_o = p_i2005_1_; -@@ -56,6 +69,16 @@ - this.field_73174_n = new NoiseGeneratorOctaves(this.field_73181_i, 4); - this.field_73173_a = new NoiseGeneratorOctaves(this.field_73181_i, 10); - this.field_73171_b = new NoiseGeneratorOctaves(this.field_73181_i, 16); -+ -+ NoiseGenerator[] noiseGens = {field_73178_j, field_73179_k, field_73176_l, field_73177_m, field_73174_n, field_73173_a, field_73171_b}; -+ noiseGens = TerrainGen.getModdedNoiseGenerators(p_i2005_1_, this.field_73181_i, noiseGens); ++ NoiseGenerator[] noiseGens = ++ { ++ new NoiseGeneratorOctaves(this.field_73181_i, 16), ++ new NoiseGeneratorOctaves(this.field_73181_i, 16), ++ new NoiseGeneratorOctaves(this.field_73181_i, 8), ++ new NoiseGeneratorOctaves(this.field_73181_i, 4), ++ new NoiseGeneratorOctaves(this.field_73181_i, 4), ++ new NoiseGeneratorOctaves(this.field_73181_i, 10), ++ new NoiseGeneratorOctaves(this.field_73181_i, 16) ++ }; ++ noiseGens = TerrainGen.getModdedNoiseGenerators(p_i45637_1_, this.field_73181_i, noiseGens); + this.field_73178_j = (NoiseGeneratorOctaves)noiseGens[0]; + this.field_73179_k = (NoiseGeneratorOctaves)noiseGens[1]; + this.field_73176_l = (NoiseGeneratorOctaves)noiseGens[2]; @@ -43,43 +53,19 @@ + this.field_73171_b = (NoiseGeneratorOctaves)noiseGens[6]; } - public void func_147419_a(int p_147419_1_, int p_147419_2_, Block[] p_147419_3_) -@@ -132,8 +155,17 @@ - } - } + public void func_180515_a(int p_180515_1_, int p_180515_2_, ChunkPrimer p_180515_3_) +@@ -155,6 +174,10 @@ -+ @Deprecated //You should provide meatadata and biome data in the below method - public void func_147418_b(int p_147418_1_, int p_147418_2_, Block[] p_147418_3_) + public void func_180516_b(int p_180516_1_, int p_180516_2_, ChunkPrimer p_180516_3_) { -+ replaceBiomeBlocks(p_147418_1_, p_147418_2_, p_147418_3_, new byte[p_147418_3_.length], null); -+ } -+ public void replaceBiomeBlocks(int p_147418_1_, int p_147418_2_, Block[] p_147418_3_, byte[] meta, BiomeGenBase[] biomes) -+ { -+ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147418_1_, p_147418_2_, p_147418_3_, meta, biomes, this.field_73175_o); ++ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180516_1_, p_180516_2_, p_180516_3_, this.field_73175_o); + MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == Result.DENY) return; + byte b0 = 64; double d0 = 0.03125D; - this.field_73185_q = this.field_73177_m.func_76304_a(this.field_73185_q, p_147418_1_ * 16, p_147418_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); -@@ -234,12 +266,13 @@ - { - this.field_73181_i.setSeed((long)p_73154_1_ * 341873128712L + (long)p_73154_2_ * 132897987541L); - Block[] ablock = new Block[32768]; -+ byte[] meta = new byte[ablock.length]; -+ BiomeGenBase[] abiomegenbase = this.field_73175_o.func_72959_q().func_76933_b((BiomeGenBase[])null, p_73154_1_ * 16, p_73154_2_ * 16, 16, 16); //Forge Move up to allow for passing to replaceBiomeBlocks - this.func_147419_a(p_73154_1_, p_73154_2_, ablock); -- this.func_147418_b(p_73154_1_, p_73154_2_, ablock); -+ this.replaceBiomeBlocks(p_73154_1_, p_73154_2_, ablock, meta, abiomegenbase); - this.field_73182_t.func_151539_a(this, this.field_73175_o, p_73154_1_, p_73154_2_, ablock); - this.field_73172_c.func_151539_a(this, this.field_73175_o, p_73154_1_, p_73154_2_, ablock); -- Chunk chunk = new Chunk(this.field_73175_o, ablock, p_73154_1_, p_73154_2_); -- BiomeGenBase[] abiomegenbase = this.field_73175_o.func_72959_q().func_76933_b((BiomeGenBase[])null, p_73154_1_ * 16, p_73154_2_ * 16, 16, 16); -+ Chunk chunk = new Chunk(this.field_73175_o, ablock, meta, p_73154_1_, p_73154_2_); - byte[] abyte = chunk.func_76605_m(); - - for (int k = 0; k < abyte.length; ++k) -@@ -253,6 +286,10 @@ + this.field_73185_q = this.field_73177_m.func_76304_a(this.field_73185_q, p_180516_1_ * 16, p_180516_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); +@@ -272,6 +295,10 @@ private double[] func_73164_a(double[] p_73164_1_, int p_73164_2_, int p_73164_3_, int p_73164_4_, int p_73164_5_, int p_73164_6_, int p_73164_7_) { @@ -90,93 +76,70 @@ if (p_73164_1_ == null) { p_73164_1_ = new double[p_73164_5_ * p_73164_6_ * p_73164_7_]; -@@ -399,6 +436,9 @@ +@@ -365,47 +392,58 @@ public void func_73153_a(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { BlockFalling.field_149832_M = true; + + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false)); + - int k = p_73153_2_ * 16; - int l = p_73153_3_ * 16; - this.field_73172_c.func_75051_a(this.field_73175_o, this.field_73181_i, p_73153_2_, p_73153_3_); -@@ -407,7 +447,8 @@ - int k1; - int l1; + BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); + this.field_73172_c.func_175794_a(this.field_73175_o, this.field_73181_i, chunkcoordintpair); + int k; -- for (i1 = 0; i1 < 8; ++i1) +- for (k = 0; k < 8; ++k) + boolean doGen = TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, NETHER_LAVA); -+ for (i1 = 0; doGen && i1 < 8; ++i1) ++ for (k = 0; doGen && k < 8; ++k) { - j1 = k + this.field_73181_i.nextInt(16) + 8; - k1 = this.field_73181_i.nextInt(120) + 4; -@@ -418,7 +459,8 @@ - i1 = this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1) + 1; - int i2; + this.field_177472_y.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(120) + 4, this.field_73181_i.nextInt(16) + 8)); + } -- for (j1 = 0; j1 < i1; ++j1) +- for (k = 0; k < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1) + 1; ++k) + doGen = TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, FIRE); -+ for (j1 = 0; doGen && j1 < i1; ++j1) ++ for (k = 0; doGen && k < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1) + 1; ++k) { - k1 = k + this.field_73181_i.nextInt(16) + 8; - l1 = this.field_73181_i.nextInt(120) + 4; -@@ -428,7 +470,8 @@ + this.field_177470_t.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(120) + 4, this.field_73181_i.nextInt(16) + 8)); + } - i1 = this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1); - -- for (j1 = 0; j1 < i1; ++j1) +- for (k = 0; k < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1); ++k) + doGen = TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, GLOWSTONE); -+ for (j1 = 0; doGen && j1 < i1; ++j1) ++ for (k = 0; doGen && k < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1); ++k) { - k1 = k + this.field_73181_i.nextInt(16) + 8; - l1 = this.field_73181_i.nextInt(120) + 4; -@@ -436,7 +479,7 @@ - (new WorldGenGlowStone1()).func_76484_a(this.field_73175_o, this.field_73181_i, k1, l1, i2); + this.field_177469_u.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(120) + 4, this.field_73181_i.nextInt(16) + 8)); } -- for (j1 = 0; j1 < 10; ++j1) -+ for (j1 = 0; doGen && j1 < 10; ++j1) +- for (k = 0; k < 10; ++k) ++ for (k = 0; doGen && k < 10; ++k) { - k1 = k + this.field_73181_i.nextInt(16) + 8; - l1 = this.field_73181_i.nextInt(128); -@@ -444,7 +487,10 @@ - (new WorldGenGlowStone2()).func_76484_a(this.field_73175_o, this.field_73181_i, k1, l1, i2); + this.field_177468_v.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(128), this.field_73181_i.nextInt(16) + 8)); } -- if (this.field_73181_i.nextInt(1) == 0) -+ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(field_73175_o, field_73181_i, k, l)); +- if (this.field_73181_i.nextBoolean()) ++ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(field_73175_o, field_73181_i, blockpos)); + -+ doGen = TerrainGen.decorate(field_73175_o, field_73181_i, k, l, SHROOM); -+ if (doGen && this.field_73181_i.nextInt(1) == 0) ++ doGen = TerrainGen.decorate(field_73175_o, field_73181_i, blockpos, SHROOM); ++ if (doGen && this.field_73181_i.nextBoolean()) { - j1 = k + this.field_73181_i.nextInt(16) + 8; - k1 = this.field_73181_i.nextInt(128); -@@ -452,7 +498,7 @@ - (new WorldGenFlowers(Blocks.field_150338_P)).func_76484_a(this.field_73175_o, this.field_73181_i, j1, k1, l1); + this.field_177471_z.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(128), this.field_73181_i.nextInt(16) + 8)); } -- if (this.field_73181_i.nextInt(1) == 0) -+ if (doGen && this.field_73181_i.nextInt(1) == 0) +- if (this.field_73181_i.nextBoolean()) ++ if (doGen && this.field_73181_i.nextBoolean()) { - j1 = k + this.field_73181_i.nextInt(16) + 8; - k1 = this.field_73181_i.nextInt(128); -@@ -463,7 +509,8 @@ - WorldGenMinable worldgenminable = new WorldGenMinable(Blocks.field_150449_bY, 13, Blocks.field_150424_aL); - int j2; - -- for (k1 = 0; k1 < 16; ++k1) -+ doGen = TerrainGen.generateOre(field_73175_o, field_73181_i, worldgenminable, k, l, QUARTZ); -+ for (k1 = 0; doGen && k1 < 16; ++k1) - { - l1 = k + this.field_73181_i.nextInt(16); - i2 = this.field_73181_i.nextInt(108) + 10; -@@ -479,6 +526,9 @@ - (new WorldGenHellLava(Blocks.field_150356_k, true)).func_76484_a(this.field_73175_o, this.field_73181_i, l1, i2, j2); + this.field_177465_A.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(128), this.field_73181_i.nextInt(16) + 8)); } -+ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(field_73175_o, field_73181_i, k, l)); -+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false)); -+ - BlockFalling.field_149832_M = false; - } +- for (k = 0; k < 16; ++k) ++ doGen = TerrainGen.generateOre(field_73175_o, field_73181_i, field_177467_w, blockpos, QUARTZ); ++ for (k = 0; doGen && k < 16; ++k) + { + this.field_177467_w.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16), this.field_73181_i.nextInt(108) + 10, this.field_73181_i.nextInt(16))); + } +- for (k = 0; k < 16; ++k) ++ doGen = TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, NETHER_LAVA2); ++ for (k = 0; doGen && k < 16; ++k) + { + this.field_177473_x.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16), this.field_73181_i.nextInt(108) + 10, this.field_73181_i.nextInt(16))); + } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch index 270087a751..da67b0aed6 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch @@ -1,36 +1,34 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderServer.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderServer.java -@@ -24,7 +24,12 @@ - import net.minecraft.world.chunk.Chunk; - import net.minecraft.world.chunk.EmptyChunk; - import net.minecraft.world.chunk.IChunkProvider; -+import net.minecraft.world.chunk.storage.AnvilChunkLoader; +@@ -24,6 +24,10 @@ import net.minecraft.world.chunk.storage.IChunkLoader; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; ++import net.minecraft.world.chunk.storage.AnvilChunkLoader; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.ForgeChunkManager; +import net.minecraftforge.common.chunkio.ChunkIOExecutor; -+ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -39,6 +44,7 @@ + public class ChunkProviderServer implements IChunkProvider + { +@@ -36,6 +40,7 @@ public LongHashMap field_73244_f = new LongHashMap(); - public List field_73245_g = new ArrayList(); + public List field_73245_g = Lists.newArrayList(); public WorldServer field_73251_h; + private Set loadingChunks = com.google.common.collect.Sets.newHashSet(); private static final String __OBFID = "CL_00001436"; public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) -@@ -61,7 +67,7 @@ +@@ -58,7 +63,7 @@ public void func_73241_b(int p_73241_1_, int p_73241_2_) { - if (this.field_73251_h.field_73011_w.func_76567_e()) -+ if (this.field_73251_h.field_73011_w.func_76567_e() && DimensionManager.shouldLoadSpawn(this.field_73251_h.field_73011_w.field_76574_g)) ++ if (this.field_73251_h.field_73011_w.func_76567_e() && DimensionManager.shouldLoadSpawn(this.field_73251_h.field_73011_w.func_177502_q())) { - ChunkCoordinates chunkcoordinates = this.field_73251_h.func_72861_E(); - int k = p_73241_1_ * 16 + 8 - chunkcoordinates.field_71574_a; -@@ -92,13 +98,66 @@ + if (!this.field_73251_h.func_72916_c(p_73241_1_, p_73241_2_)) + { +@@ -84,12 +89,64 @@ public Chunk func_73158_c(int p_73158_1_, int p_73158_2_) { @@ -84,21 +82,18 @@ if (chunk == null) { -- chunk = this.func_73239_e(p_73158_1_, p_73158_2_); + boolean added = loadingChunks.add(k); + if (!added) + { -+ cpw.mods.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in dimension %d that is already being loaded. This will cause weird chunk breakages.", p_73158_1_, p_73158_2_, field_73251_h.field_73011_w.field_76574_g); ++ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in dimension %d that is already being loaded. This will cause weird chunk breakages.", p_73158_1_, p_73158_2_, field_73251_h.field_73011_w.func_177502_q()); + } + chunk = ForgeChunkManager.fetchDormantChunk(k, this.field_73251_h); ++ + if (chunk == null) -+ { -+ chunk = this.func_73239_e(p_73158_1_, p_73158_2_); -+ } + chunk = this.func_73239_e(p_73158_1_, p_73158_2_); if (chunk == null) - { -@@ -126,6 +185,7 @@ +@@ -118,6 +175,7 @@ this.field_73244_f.func_76163_a(k, chunk); this.field_73245_g.add(chunk); @@ -106,25 +101,28 @@ chunk.func_76631_c(); chunk.func_76624_a(this, this, p_73158_1_, p_73158_2_); } -@@ -265,6 +325,11 @@ +@@ -270,8 +328,13 @@ { if (!this.field_73251_h.field_73058_d) { +- for (int i = 0; i < 100; ++i) + for (ChunkCoordIntPair forced : this.field_73251_h.getPersistentChunks().keySet()) -+ { + { + this.field_73248_b.remove(ChunkCoordIntPair.func_77272_a(forced.field_77276_a, forced.field_77275_b)); + } + - for (int i = 0; i < 100; ++i) - { ++ for (int i = 0; i < 100; ++i) ++ { if (!this.field_73248_b.isEmpty()) -@@ -278,6 +343,11 @@ - this.func_73242_b(chunk); + { + Long olong = (Long)this.field_73248_b.iterator().next(); +@@ -284,6 +347,11 @@ this.func_73243_a(chunk); + this.field_73244_f.func_76159_d(olong.longValue()); this.field_73245_g.remove(chunk); + ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.func_77272_a(chunk.field_76635_g, chunk.field_76647_h), chunk); -+ if(field_73245_g.size() == 0 && ForgeChunkManager.getPersistentChunksFor(this.field_73251_h).size() == 0 && !DimensionManager.shouldLoadSpawn(this.field_73251_h.field_73011_w.field_76574_g)){ -+ DimensionManager.unloadWorld(this.field_73251_h.field_73011_w.field_76574_g); ++ if(field_73245_g.size() == 0 && ForgeChunkManager.getPersistentChunksFor(this.field_73251_h).size() == 0 && !DimensionManager.shouldLoadSpawn(this.field_73251_h.field_73011_w.func_177502_q())){ ++ DimensionManager.unloadWorld(this.field_73251_h.field_73011_w.func_177502_q()); + return field_73246_d.func_73156_b(); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch b/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch index 4f1f59fb21..741188f61d 100644 --- a/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch @@ -1,85 +1,91 @@ --- ../src-base/minecraft/net/minecraft/world/gen/MapGenCaves.java +++ ../src-work/minecraft/net/minecraft/world/gen/MapGenCaves.java -@@ -5,6 +5,7 @@ - import net.minecraft.init.Blocks; - import net.minecraft.util.MathHelper; - import net.minecraft.world.World; -+import net.minecraft.world.biome.BiomeGenBase; +@@ -2,6 +2,7 @@ - public class MapGenCaves extends MapGenBase - { -@@ -139,7 +140,7 @@ + import com.google.common.base.Objects; + import java.util.Random; ++import net.minecraft.block.Block; + import net.minecraft.block.BlockSand; + import net.minecraft.block.material.Material; + import net.minecraft.block.state.IBlockState; +@@ -141,7 +142,7 @@ { - Block block = p_151541_5_[j3]; + IBlockState iblockstate = p_180702_5_.func_177856_a(k2, i3, l2); -- if (block == Blocks.field_150358_i || block == Blocks.field_150355_j) -+ if (isOceanBlock(p_151541_5_, j3, k2, i3, l2, p_151541_3_, p_151541_4_)) +- if (iblockstate.func_177230_c() == Blocks.field_150358_i || iblockstate.func_177230_c() == Blocks.field_150355_j) ++ if (isOceanBlock(p_180702_5_, k2, i3, l2, p_180702_3_, p_180702_4_)) { flag3 = true; } -@@ -175,27 +176,11 @@ - { - Block block1 = p_151541_5_[k3]; +@@ -177,32 +178,11 @@ + IBlockState iblockstate1 = p_180702_5_.func_177856_a(k2, j3, j4); + IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.func_177856_a(k2, j3 + 1, j4), Blocks.field_150350_a.func_176223_P()); -- if (block1 == Blocks.field_150349_c) -+ if (isTopBlock(p_151541_5_, k3, k2, l3, j3, p_151541_3_, p_151541_4_)) +- if (iblockstate1.func_177230_c() == Blocks.field_150349_c || iblockstate1.func_177230_c() == Blocks.field_150391_bh) ++ if (isTopBlock(p_180702_5_, k2, j3, j4, p_180702_3_, p_180702_4_)) { flag1 = true; } - -- if (block1 == Blocks.field_150348_b || block1 == Blocks.field_150346_d || block1 == Blocks.field_150349_c) +- if (this.func_175793_a(iblockstate1, iblockstate2)) - { -- if (l3 < 10) +- if (j3 - 1 < 10) - { -- p_151541_5_[k3] = Blocks.field_150353_l; +- p_180702_5_.func_177855_a(k2, j3, j4, Blocks.field_150353_l.func_176223_P()); - } - else - { -- p_151541_5_[k3] = null; +- p_180702_5_.func_177855_a(k2, j3, j4, Blocks.field_150350_a.func_176223_P()); - -- if (flag1 && p_151541_5_[k3 - 1] == Blocks.field_150346_d) +- if (iblockstate2.func_177230_c() == Blocks.field_150354_m) - { -- p_151541_5_[k3 - 1] = this.field_75039_c.func_72807_a(k2 + p_151541_3_ * 16, j3 + p_151541_4_ * 16).field_76752_A; +- p_180702_5_.func_177855_a(k2, j3 + 1, j4, iblockstate2.func_177229_b(BlockSand.field_176504_a) == BlockSand.EnumType.RED_SAND ? Blocks.field_180395_cM.func_176223_P() : Blocks.field_150322_A.func_176223_P()); +- } +- +- if (flag1 && p_180702_5_.func_177856_a(k2, j3 - 1, j4).func_177230_c() == Blocks.field_150346_d) +- { +- p_180702_5_.func_177855_a(k2, j3 - 1, j4, this.field_75039_c.func_180494_b(new BlockPos(k2 + p_180702_3_ * 16, 0, j4 + p_180702_4_ * 16)).field_76752_A.func_177230_c().func_176223_P()); - } - } - } -+ digBlock(p_151541_5_, k3, k2, l3, j3, p_151541_3_, p_151541_4_, flag1); ++ digBlock(p_180702_5_, k2, j3, j4, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); } - - --k3; -@@ -251,4 +236,66 @@ + } + } +@@ -261,4 +241,71 @@ } } } + -+ protected boolean isOceanBlock(Block[] data, int index, int x, int y, int z, int chunkX, int chunkZ) ++ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) + { -+ return data[index] == Blocks.field_150358_i || data[index] == Blocks.field_150355_j; ++ net.minecraft.block.Block block = data.func_177856_a(x, y, z).func_177230_c(); ++ return block== Blocks.field_150358_i || block == Blocks.field_150355_j; + } + + //Exception biomes to make sure we generate like vanilla -+ private boolean isExceptionBiome(BiomeGenBase biome) ++ private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) + { -+ if (biome == BiomeGenBase.field_76789_p) return true; -+ if (biome == BiomeGenBase.field_76787_r) return true; -+ if (biome == BiomeGenBase.field_76769_d) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76787_r) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76769_d) return true; + return false; + } + + //Determine if the block at the specified location is the top block for the biome, we take into account + //Vanilla bugs to make sure that we generate the map the same way vanilla does. -+ private boolean isTopBlock(Block[] data, int index, int x, int y, int z, int chunkX, int chunkZ) ++ private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) + { -+ BiomeGenBase biome = field_75039_c.func_72807_a(x + chunkX * 16, z + chunkZ * 16); -+ return (isExceptionBiome(biome) ? data[index] == Blocks.field_150349_c : data[index] == biome.field_76752_A); ++ net.minecraft.world.biome.BiomeGenBase biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState state = data.func_177856_a(x, y, z); ++ return (isExceptionBiome(biome) ? state.func_177230_c() == Blocks.field_150349_c : state.func_177230_c() == biome.field_76752_A); + } + + /** + * Digs out the current block, default implementation removes stone, filler, and top block + * Sets the block to lava if y is less then 10, and air other wise. -+ * If setting to air, it also checks to see if we've broken the surface and if so ++ * If setting to air, it also checks to see if we've broken the surface and if so + * tries to make the floor the biome's top block -+ * ++ * + * @param data Block data array + * @param index Pre-calculated index into block data + * @param x local X position @@ -89,26 +95,30 @@ + * @param chunkZ Chunk Y position + * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface. + */ -+ protected void digBlock(Block[] data, int index, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) ++ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop, IBlockState state, IBlockState up) + { -+ BiomeGenBase biome = field_75039_c.func_72807_a(x + chunkX * 16, z + chunkZ * 16); -+ Block top = (isExceptionBiome(biome) ? Blocks.field_150349_c : biome.field_76752_A); -+ Block filler = (isExceptionBiome(biome) ? Blocks.field_150346_d : biome.field_76753_B); -+ Block block = data[index]; ++ net.minecraft.world.biome.BiomeGenBase biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState top = biome.field_76752_A; ++ IBlockState filler = biome.field_76753_B; + -+ if (block == Blocks.field_150348_b || block == filler || block == top) ++ if (this.func_175793_a(state, up) || state.func_177230_c() == top.func_177230_c() || state.func_177230_c() == filler.func_177230_c()) + { + if (y < 10) + { -+ data[index] = Blocks.field_150353_l; ++ data.func_177855_a(x, y, z, Blocks.field_150353_l.func_176223_P()); + } + else + { -+ data[index] = null; ++ data.func_177855_a(x, y, z, Blocks.field_150350_a.func_176223_P()); + -+ if (foundTop && data[index - 1] == filler) ++ if (up.func_177230_c() == Blocks.field_150354_m) + { -+ data[index - 1] = top; ++ data.func_177855_a(x, y + 1, z, up.func_177229_b(BlockSand.field_176504_a) == BlockSand.EnumType.RED_SAND ? Blocks.field_180395_cM.func_176223_P() : Blocks.field_150322_A.func_176223_P()); ++ } ++ ++ if (foundTop && data.func_177856_a(x, y - 1, z).func_177230_c() == filler.func_177230_c()) ++ { ++ data.func_177855_a(x, y - 1, z, top.func_177230_c().func_176223_P()); + } + } + } diff --git a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch index 95e70ae455..3e88554e16 100644 --- a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch @@ -1,85 +1,79 @@ --- ../src-base/minecraft/net/minecraft/world/gen/MapGenRavine.java +++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java -@@ -5,6 +5,7 @@ - import net.minecraft.init.Blocks; - import net.minecraft.util.MathHelper; - import net.minecraft.world.World; -+import net.minecraft.world.biome.BiomeGenBase; - - public class MapGenRavine extends MapGenBase - { -@@ -131,7 +132,7 @@ +@@ -130,7 +130,7 @@ { - Block block = p_151540_5_[j3]; + IBlockState iblockstate = p_180707_5_.func_177856_a(k2, i3, l2); -- if (block == Blocks.field_150358_i || block == Blocks.field_150355_j) -+ if (isOceanBlock(p_151540_5_, j3, k2, i3, l2, p_151540_3_, p_151540_4_)) +- if (iblockstate.func_177230_c() == Blocks.field_150358_i || iblockstate.func_177230_c() == Blocks.field_150355_j) ++ if (isOceanBlock(p_180707_5_, k2, i2, l2, p_180707_3_, p_180707_4_)) { flag2 = true; } -@@ -167,27 +168,12 @@ +@@ -165,27 +165,12 @@ { - Block block1 = p_151540_5_[k3]; + IBlockState iblockstate1 = p_180707_5_.func_177856_a(k2, j3, j4); -- if (block1 == Blocks.field_150349_c) -+ if (isTopBlock(p_151540_5_, k3, k2, l3, j3, p_151540_3_, p_151540_4_)) +- if (iblockstate1.func_177230_c() == Blocks.field_150349_c) ++ if (isTopBlock(p_180707_5_, k2, j3, j4, p_180707_3_, p_180707_4_)) { flag = true; } -- if (block1 == Blocks.field_150348_b || block1 == Blocks.field_150346_d || block1 == Blocks.field_150349_c) +- if (iblockstate1.func_177230_c() == Blocks.field_150348_b || iblockstate1.func_177230_c() == Blocks.field_150346_d || iblockstate1.func_177230_c() == Blocks.field_150349_c) - { -- if (l3 < 10) +- if (j3 - 1 < 10) - { -- p_151540_5_[k3] = Blocks.field_150356_k; +- p_180707_5_.func_177855_a(k2, j3, j4, Blocks.field_150356_k.func_176223_P()); - } - else - { -- p_151540_5_[k3] = null; +- p_180707_5_.func_177855_a(k2, j3, j4, Blocks.field_150350_a.func_176223_P()); - -- if (flag && p_151540_5_[k3 - 1] == Blocks.field_150346_d) +- if (flag && p_180707_5_.func_177856_a(k2, j3 - 1, j4).func_177230_c() == Blocks.field_150346_d) - { -- p_151540_5_[k3 - 1] = this.field_75039_c.func_72807_a(k2 + p_151540_3_ * 16, j3 + p_151540_4_ * 16).field_76752_A; +- p_180707_5_.func_177855_a(k2, j3 - 1, j4, this.field_75039_c.func_180494_b(new BlockPos(k2 + p_180707_3_ * 16, 0, j4 + p_180707_4_ * 16)).field_76752_A); - } - } - } -+ digBlock(p_151540_5_, k3, k2, l3, j3, p_151540_3_, p_151540_4_, flag); ++ digBlock(p_180707_5_, k2, j3, j4, p_180707_3_, p_180707_4_, flag); } - - --k3; -@@ -224,4 +210,66 @@ + } + } +@@ -220,4 +205,68 @@ } } } -+ -+ protected boolean isOceanBlock(Block[] data, int index, int x, int y, int z, int chunkX, int chunkZ) ++ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) + { -+ return data[index] == Blocks.field_150355_j || data[index] == Blocks.field_150358_i; ++ net.minecraft.block.Block block = data.func_177856_a(x, y, z).func_177230_c(); ++ return block== Blocks.field_150358_i || block == Blocks.field_150355_j; + } + + //Exception biomes to make sure we generate like vanilla -+ private boolean isExceptionBiome(BiomeGenBase biome) ++ private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) + { -+ if (biome == BiomeGenBase.field_76789_p) return true; -+ if (biome == BiomeGenBase.field_76787_r) return true; -+ if (biome == BiomeGenBase.field_76769_d) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76787_r) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76769_d) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76789_p) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76788_q) return true; + return false; + } + + //Determine if the block at the specified location is the top block for the biome, we take into account + //Vanilla bugs to make sure that we generate the map the same way vanilla does. -+ private boolean isTopBlock(Block[] data, int index, int x, int y, int z, int chunkX, int chunkZ) ++ private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) + { -+ BiomeGenBase biome = field_75039_c.func_72807_a(x + chunkX * 16, z + chunkZ * 16); -+ return (isExceptionBiome(biome) ? data[index] == Blocks.field_150349_c : data[index] == biome.field_76752_A); ++ net.minecraft.world.biome.BiomeGenBase biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState state = data.func_177856_a(x, y, z); ++ return (isExceptionBiome(biome) ? state.func_177230_c() == Blocks.field_150349_c : state.func_177230_c() == biome.field_76752_A); + } + + /** + * Digs out the current block, default implementation removes stone, filler, and top block + * Sets the block to lava if y is less then 10, and air other wise. -+ * If setting to air, it also checks to see if we've broken the surface and if so ++ * If setting to air, it also checks to see if we've broken the surface and if so + * tries to make the floor the biome's top block -+ * ++ * + * @param data Block data array + * @param index Pre-calculated index into block data + * @param x local X position @@ -89,26 +83,26 @@ + * @param chunkZ Chunk Y position + * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface. + */ -+ protected void digBlock(Block[] data, int index, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) ++ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) + { -+ BiomeGenBase biome = field_75039_c.func_72807_a(x + chunkX * 16, z + chunkZ * 16); -+ Block top = (isExceptionBiome(biome) ? Blocks.field_150349_c : biome.field_76752_A); -+ Block filler = (isExceptionBiome(biome) ? Blocks.field_150346_d : biome.field_76753_B); -+ Block block = data[index]; ++ net.minecraft.world.biome.BiomeGenBase biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState state = data.func_177856_a(x, y, z); ++ IBlockState top = isExceptionBiome(biome) ? Blocks.field_150349_c.func_176223_P() : biome.field_76752_A; ++ IBlockState filler = isExceptionBiome(biome) ? Blocks.field_150346_d.func_176223_P() : biome.field_76753_B; + -+ if (block == Blocks.field_150348_b || block == filler || block == top) ++ if (state.func_177230_c() == Blocks.field_150348_b || state.func_177230_c() == top.func_177230_c() || state.func_177230_c() == filler.func_177230_c()) + { + if (y < 10) + { -+ data[index] = Blocks.field_150356_k; ++ data.func_177855_a(x, y, z, Blocks.field_150353_l.func_176223_P()); + } + else + { -+ data[index] = null; ++ data.func_177855_a(x, y, z, Blocks.field_150350_a.func_176223_P()); + -+ if (foundTop && data[index - 1] == filler) ++ if (foundTop && data.func_177856_a(x, y - 1, z).func_177230_c() == filler.func_177230_c()) + { -+ data[index - 1] = top; ++ data.func_177855_a(x, y - 1, z, top.func_177230_c().func_176223_P()); + } + } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch index a95f248686..087efae91e 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch @@ -1,13 +1,13 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java -@@ -21,4 +21,10 @@ +@@ -30,4 +30,10 @@ + this.func_175903_a(p_175921_1_, p_175921_2_, Blocks.field_150346_d.func_176223_P()); + } } - - public void func_150524_b(World p_150524_1_, Random p_150524_2_, int p_150524_3_, int p_150524_4_, int p_150524_5_) {} + -+ protected boolean isReplaceable(World world, int x, int y, int z) ++ public boolean isReplaceable(World world, BlockPos pos) + { -+ Block block = world.func_147439_a(x, y, z); -+ return block.isAir(world, x, y, z) || block.isLeaves(world, x, y, z) || block.isWood(world, x, y, z) || func_150523_a(block); ++ net.minecraft.block.state.IBlockState state = world.func_180495_p(pos); ++ return state.func_177230_c().isAir(world, pos) || state.func_177230_c().isLeaves(world, pos) || state.func_177230_c().isWood(world, pos) || func_150523_a(state.func_177230_c()); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch index 8774e797b2..74b05fae48 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch @@ -1,29 +1,37 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java -@@ -56,7 +56,7 @@ +@@ -55,9 +55,10 @@ + { + if (k >= 0 && k < 256) { - Block block = p_76484_1_.func_147439_a(k1, j1, l1); +- Block block = p_180709_1_.func_180495_p(new BlockPos(l, k, i1)).func_177230_c(); ++ BlockPos pos = new BlockPos(l, k, i1); ++ net.minecraft.block.state.IBlockState state = p_180709_1_.func_180495_p(pos); - if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) -+ if (!block.isAir(p_76484_1_, k1, j1, l1) && !block.isLeaves(p_76484_1_, k1, j1, l1)) ++ if (!state.func_177230_c().isAir(p_180709_1_, pos) && !state.func_177230_c().isLeaves(p_180709_1_, pos)) { flag = false; } -@@ -183,7 +183,7 @@ - j2 = 0; - } - -- if ((j2 != 0 || p_76484_4_ >= p_76484_4_ + i1 - 1) && !p_76484_1_.func_147439_a(l2, k1, i2).func_149730_j()) -+ if ((j2 != 0 || p_76484_4_ >= p_76484_4_ + i1 - 1) && p_76484_1_.func_147439_a(l2, k1, i2).canBeReplacedByLeaves(p_76484_1_, l2, k1, i2)) +@@ -188,7 +189,7 @@ { - this.func_150516_a(p_76484_1_, l2, k1, i2, Block.func_149729_e(Block.func_149682_b(Blocks.field_150420_aW) + l), j2); - } -@@ -195,7 +195,7 @@ + BlockPos blockpos1 = new BlockPos(i2, l, j1); + +- if (!p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149730_j()) ++ if (p_180709_1_.func_180495_p(blockpos1).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos1)) + { + this.func_175905_a(p_180709_1_, blockpos1, Block.func_149729_e(Block.func_149682_b(Blocks.field_150420_aW) + i), k1); + } +@@ -199,9 +200,10 @@ + + for (l = 0; l < j; ++l) { - Block block2 = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ + k1, p_76484_5_); +- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(l)).func_177230_c(); ++ BlockPos upN = p_180709_3_.func_177981_b(l); ++ net.minecraft.block.state.IBlockState state = p_180709_1_.func_180495_p(upN); - if (!block2.func_149730_j()) -+ if (block2.canBeReplacedByLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_)) ++ if (state.func_177230_c().canBeReplacedByLeaves(p_180709_1_, upN)) { - this.func_150516_a(p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_, Block.func_149729_e(Block.func_149682_b(Blocks.field_150420_aW) + l), 10); + this.func_175905_a(p_180709_1_, p_180709_3_.func_177981_b(l), Block.func_149729_e(Block.func_149682_b(Blocks.field_150420_aW) + i), 10); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch index 765db1eaeb..4921fddefb 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch @@ -1,59 +1,52 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java -@@ -2,10 +2,12 @@ - - import java.util.Random; - import net.minecraft.block.Block; -+import net.minecraft.block.BlockSapling; - import net.minecraft.block.material.Material; - import net.minecraft.init.Blocks; - import net.minecraft.util.MathHelper; - import net.minecraft.world.World; -+import net.minecraftforge.common.util.ForgeDirection; - - public class WorldGenBigTree extends WorldGenAbstractTree - { -@@ -142,7 +144,7 @@ - aint1[b2] = aint[b2] + j1; - Block block1 = this.field_76506_c.func_147439_a(aint1[0], aint1[1], aint1[2]); - -- if (block1.func_149688_o() != Material.field_151579_a && block1.func_149688_o() != Material.field_151584_j) -+ if (!block1.isAir(field_76506_c, aint1[0], aint1[1], aint1[2]) && !block1.isLeaves(field_76506_c, aint1[0], aint1[1], aint1[2])) - { - ++j1; - } -@@ -374,7 +376,7 @@ - aint3[b3] = MathHelper.func_76128_c((double)p_76496_1_[b3] + (double)i * d1); - Block block = this.field_76506_c.func_147439_a(aint3[0], aint3[1], aint3[2]); - -- if (!this.func_150523_a(block)) -+ if (!this.isReplaceable(field_76506_c, aint3[0], aint3[1], aint3[2])) +@@ -107,9 +107,9 @@ + if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_180712_2_ * p_180712_2_)) { - break; + BlockPos blockpos1 = p_180712_1_.func_177982_a(j, 0, k); +- Material material = this.field_175946_l.func_180495_p(blockpos1).func_177230_c().func_149688_o(); ++ net.minecraft.block.state.IBlockState state = this.field_175946_l.func_180495_p(blockpos1); + +- if (material == Material.field_151579_a || material == Material.field_151584_j) ++ if (state.func_177230_c().isAir(this.field_175946_l, blockpos1) || state.func_177230_c().isLeaves(this.field_175946_l, blockpos1)) + { + this.func_175905_a(this.field_175946_l, blockpos1, p_180712_3_, 0); + } +@@ -268,7 +268,7 @@ + { + BlockPos blockpos3 = p_175936_1_.func_177963_a((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); + +- if (!this.func_150523_a(this.field_175946_l.func_180495_p(blockpos3).func_177230_c())) ++ if (!this.isReplaceable(field_175946_l, blockpos3)) + { + return j; } -@@ -390,7 +392,8 @@ - int[] aint1 = new int[] {this.field_76503_d[0], this.field_76503_d[1] + this.field_76504_e - 1, this.field_76503_d[2]}; - Block block = this.field_76506_c.func_147439_a(this.field_76503_d[0], this.field_76503_d[1] - 1, this.field_76503_d[2]); +@@ -296,6 +296,7 @@ + + if (!this.func_76497_e()) + { ++ this.field_175946_l = null; //Fix vanilla Mem leak, holds latest world + return false; + } + else +@@ -304,15 +305,18 @@ + this.func_175941_b(); + this.func_175942_c(); + this.func_175939_d(); ++ this.field_175946_l = null; //Fix vanilla Mem leak, holds latest world + return true; + } + } + + private boolean func_76497_e() + { +- Block block = this.field_175946_l.func_180495_p(this.field_175947_m.func_177977_b()).func_177230_c(); ++ BlockPos down = this.field_175947_m.func_177977_b(); ++ net.minecraft.block.state.IBlockState state = this.field_175946_l.func_180495_p(down); ++ boolean isSoil = state.func_177230_c().canSustainPlant(this.field_175946_l, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); - if (block != Blocks.field_150346_d && block != Blocks.field_150349_c && block != Blocks.field_150458_ak) -+ boolean isSoil = block.canSustainPlant(field_76506_c, field_76503_d[0], field_76503_d[1] - 1, field_76503_d[2], ForgeDirection.UP, (BlockSapling)Blocks.field_150345_g); + if (!isSoil) { return false; } -@@ -443,6 +446,7 @@ - - if (!this.func_76497_e()) - { -+ this.field_76506_c = null; //Fix vanilla Mem leak, holds latest world - return false; - } - else -@@ -451,6 +455,7 @@ - this.func_76498_b(); - this.func_76499_c(); - this.func_76494_d(); -+ this.field_76506_c = null; //Fix vanilla Mem leak, holds latest world - return true; - } - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch index 7858d6046e..2b819de6b8 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch @@ -1,69 +1,67 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java -@@ -2,10 +2,12 @@ - - import java.util.Random; - import net.minecraft.block.Block; -+import net.minecraft.block.BlockSapling; - import net.minecraft.block.material.Material; - import net.minecraft.init.Blocks; - import net.minecraft.util.Direction; - import net.minecraft.world.World; -+import net.minecraftforge.common.util.ForgeDirection; - - public class WorldGenCanopyTree extends WorldGenAbstractTree - { -@@ -48,7 +50,7 @@ +@@ -48,7 +48,7 @@ + { + if (j >= 0 && j < 256) { - Block block = p_76484_1_.func_147439_a(j1, i1, k1); - -- if (!this.func_150523_a(block)) -+ if (!this.isReplaceable(p_76484_1_, j1, i1, k1)) +- if (!this.func_150523_a(p_180709_1_.func_180495_p(new BlockPos(k, j, l)).func_177230_c())) ++ if (!this.isReplaceable(p_180709_1_, new BlockPos(k, j, l))) { flag = false; } -@@ -69,12 +71,13 @@ +@@ -67,14 +67,16 @@ + } + else { - Block block2 = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ - 1, p_76484_5_); +- Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); ++ BlockPos down = p_180709_3_.func_177977_b(); ++ net.minecraft.block.state.IBlockState state = p_180709_1_.func_180495_p(down); ++ boolean isSoil = state.func_177230_c().canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); -- if ((block2 == Blocks.field_150349_c || block2 == Blocks.field_150346_d) && p_76484_4_ < 256 - l - 1) -+ boolean isSoil = block2.canSustainPlant(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, ForgeDirection.UP, (BlockSapling)Blocks.field_150345_g); -+ if (isSoil && p_76484_4_ < 256 - l - 1) +- if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) { -- this.func_150515_a(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, Blocks.field_150346_d); -- this.func_150515_a(p_76484_1_, p_76484_3_ + 1, p_76484_4_ - 1, p_76484_5_, Blocks.field_150346_d); -- this.func_150515_a(p_76484_1_, p_76484_3_ + 1, p_76484_4_ - 1, p_76484_5_ + 1, Blocks.field_150346_d); -- this.func_150515_a(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_ + 1, Blocks.field_150346_d); -+ onPlantGrow(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, p_76484_3_, p_76484_4_, p_76484_5_); -+ onPlantGrow(p_76484_1_, p_76484_3_ + 1, p_76484_4_ - 1, p_76484_5_, p_76484_3_, p_76484_4_, p_76484_5_); -+ onPlantGrow(p_76484_1_, p_76484_3_ + 1, p_76484_4_ - 1, p_76484_5_ + 1, p_76484_3_, p_76484_4_, p_76484_5_); -+ onPlantGrow(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_ + 1, p_76484_3_, p_76484_4_, p_76484_5_); - int j3 = p_76484_2_.nextInt(4); - j1 = l - p_76484_2_.nextInt(4); - k1 = 2 - p_76484_2_.nextInt(3); -@@ -97,7 +100,7 @@ +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177982_a(1, -1, 0)); +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177982_a(1, -1, 1)); +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177982_a(0, -1, 1)); ++ this.onPlantGrow(p_180709_1_, p_180709_3_.func_177977_b(), p_180709_3_); ++ this.onPlantGrow(p_180709_1_, p_180709_3_.func_177982_a(1, -1, 0), p_180709_3_); ++ this.onPlantGrow(p_180709_1_, p_180709_3_.func_177982_a(1, -1, 1), p_180709_3_); ++ this.onPlantGrow(p_180709_1_, p_180709_3_.func_177982_a(0, -1, 1), p_180709_3_); + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.func_179518_a(p_180709_2_); + k = i - p_180709_2_.nextInt(4); + l = 2 - p_180709_2_.nextInt(3); +@@ -96,9 +98,9 @@ + } - Block block1 = p_76484_1_.func_147439_a(k3, k2, l1); + BlockPos blockpos1 = new BlockPos(i1, i2, j1); +- Material material = p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o(); ++ state = p_180709_1_.func_180495_p(blockpos1); -- if (block1.func_149688_o() == Material.field_151579_a || block1.func_149688_o() == Material.field_151584_j) -+ if (block1.isAir(p_76484_1_, k3, k2, l1) || block1.isLeaves(p_76484_1_, k3, k2, l1)) +- if (material == Material.field_151579_a || material == Material.field_151584_j) ++ if (state.func_177230_c().isAir(p_180709_1_, blockpos1) || state.func_177230_c().isLeaves(p_180709_1_, blockpos1)) { - this.func_150516_a(p_76484_1_, k3, k2, l1, Blocks.field_150363_s, 1); - this.func_150516_a(p_76484_1_, k3 + 1, k2, l1, Blocks.field_150363_s, 1); -@@ -203,9 +206,15 @@ + this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150363_s, BlockPlanks.EnumType.DARK_OAK.func_176839_a() - 4); + this.func_175905_a(p_180709_1_, blockpos1.func_177974_f(), Blocks.field_150363_s, BlockPlanks.EnumType.DARK_OAK.func_176839_a() - 4); +@@ -202,11 +204,18 @@ + + private void func_150526_a(World p_150526_1_, int p_150526_2_, int p_150526_3_, int p_150526_4_) { - Block block = p_150526_1_.func_147439_a(p_150526_2_, p_150526_3_, p_150526_4_); +- Block block = p_150526_1_.func_180495_p(new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_)).func_177230_c(); ++ BlockPos pos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); ++ net.minecraft.block.state.IBlockState state = p_150526_1_.func_180495_p(pos); - if (block.func_149688_o() == Material.field_151579_a) -+ if (block.isAir(p_150526_1_, p_150526_2_, p_150526_3_, p_150526_4_)) ++ if (state.func_177230_c().isAir(p_150526_1_, pos)) { - this.func_150516_a(p_150526_1_, p_150526_2_, p_150526_3_, p_150526_4_, Blocks.field_150361_u, 1); + this.func_175905_a(p_150526_1_, new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_), Blocks.field_150361_u, 1); } } + + //Just a helper macro -+ private void onPlantGrow(World world, int x, int y, int z, int sourceX, int sourceY, int sourceZ) ++ private void onPlantGrow(World world, BlockPos pos, BlockPos source) + { -+ world.func_147439_a(x, y, z).onPlantGrow(world, x, y, z, sourceX, sourceY, sourceZ); ++ world.func_180495_p(pos).func_177230_c().onPlantGrow(world, pos, source); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch index 012f19063e..fea2ba7275 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch @@ -1,20 +1,17 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java -@@ -19,10 +19,15 @@ +@@ -15,10 +15,12 @@ { Block block; -- while (((block = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_, p_76484_5_)).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_76484_4_ > 0) +- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 0) + do { -+ block = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_, p_76484_5_); -+ if (!(block.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_, p_76484_5_) || block.isAir(p_76484_1_, p_76484_3_, p_76484_4_, p_76484_5_))) -+ { -+ break; -+ } - --p_76484_4_; ++ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); ++ if (!block.isLeaves(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.func_177977_b(); - } -+ } while (p_76484_4_ > 0); ++ } while (p_180709_3_.func_177956_o() > 0); - for (int l = 0; l < 4; ++l) + for (int i = 0; i < 4; ++i) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch index 27ac8306a4..73774408ec 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch @@ -1,35 +1,40 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java -@@ -8,6 +8,9 @@ - import net.minecraft.tileentity.TileEntityMobSpawner; - import net.minecraft.util.WeightedRandomChestContent; +@@ -16,6 +16,9 @@ import net.minecraft.world.World; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +import net.minecraftforge.common.ChestGenHooks; +import net.minecraftforge.common.DungeonHooks; -+import static net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST;; ++import static net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST; public class WorldGenDungeons extends WorldGenerator { -@@ -123,12 +126,11 @@ +@@ -140,12 +143,11 @@ if (k2 == 1) { - p_76484_1_.func_147465_d(i2, p_76484_4_, j2, Blocks.field_150486_ae, 0, 2); -- WeightedRandomChestContent[] aweightedrandomchestcontent = WeightedRandomChestContent.func_92080_a(field_111189_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_76484_2_)}); - TileEntityChest tileentitychest = (TileEntityChest)p_76484_1_.func_147438_o(i2, p_76484_4_, j2); + p_180709_1_.func_180501_a(blockpos2, Blocks.field_150486_ae.func_176458_f(p_180709_1_, blockpos2, Blocks.field_150486_ae.func_176223_P()), 2); +- List list = WeightedRandomChestContent.func_177629_a(field_175917_c, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_180709_2_)}); + TileEntity tileentity1 = p_180709_1_.func_175625_s(blockpos2); - if (tileentitychest != null) + if (tileentity1 instanceof TileEntityChest) { -- WeightedRandomChestContent.func_76293_a(p_76484_2_, aweightedrandomchestcontent, tileentitychest, 8); -+ WeightedRandomChestContent.func_76293_a(p_76484_2_, ChestGenHooks.getItems(DUNGEON_CHEST, p_76484_2_), tileentitychest, ChestGenHooks.getCount(DUNGEON_CHEST, p_76484_2_)); +- WeightedRandomChestContent.func_177630_a(p_180709_2_, list, (TileEntityChest)tileentity1, 8); ++ WeightedRandomChestContent.func_177630_a(p_180709_2_, ChestGenHooks.getItems(DUNGEON_CHEST, p_180709_2_), (TileEntityChest)tileentity1, ChestGenHooks.getCount(DUNGEON_CHEST, p_180709_2_)); } - break label101; -@@ -167,7 +169,6 @@ + break label100; +@@ -184,6 +186,12 @@ private String func_76543_b(Random p_76543_1_) { -- int i = p_76543_1_.nextInt(4); -- return i == 0 ? "Skeleton" : (i == 1 ? "Zombie" : (i == 2 ? "Zombie" : (i == 3 ? "Spider" : ""))); +- return field_175916_b[p_76543_1_.nextInt(field_175916_b.length)]; + return DungeonHooks.getRandomDungeonMob(p_76543_1_); } ++ ++ static ++ { ++ ChestGenHooks.init(DUNGEON_CHEST, field_175917_c, 8, 8); ++ ChestGenHooks.addItem(DUNGEON_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); ++ } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch index ac5d841a49..a08072e11d 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch @@ -1,54 +1,50 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java -@@ -2,9 +2,11 @@ - - import java.util.Random; - import net.minecraft.block.Block; -+import net.minecraft.block.BlockSapling; - import net.minecraft.block.material.Material; - import net.minecraft.init.Blocks; - import net.minecraft.world.World; -+import net.minecraftforge.common.util.ForgeDirection; - - public class WorldGenForest extends WorldGenAbstractTree - { -@@ -55,7 +57,7 @@ +@@ -55,7 +55,7 @@ + { + if (j >= 0 && j < 256) { - Block block = p_76484_1_.func_147439_a(j1, i1, k1); - -- if (!this.func_150523_a(block)) -+ if (!this.isReplaceable(p_76484_1_, j1, i1, k1)) +- if (!this.func_150523_a(p_180709_1_.func_180495_p(new BlockPos(k, j, l)).func_177230_c())) ++ if (!this.isReplaceable(p_180709_1_, new BlockPos(k, j, l))) { flag = false; } -@@ -76,9 +78,10 @@ +@@ -74,11 +74,13 @@ + } + else { - Block block2 = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ - 1, p_76484_5_); +- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); ++ BlockPos down = p_180709_3_.func_177977_b(); ++ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); ++ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); -- if ((block2 == Blocks.field_150349_c || block2 == Blocks.field_150346_d || block2 == Blocks.field_150458_ak) && p_76484_4_ < 256 - l - 1) -+ boolean isSoil = block2.canSustainPlant(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, ForgeDirection.UP, (BlockSapling)Blocks.field_150345_g); -+ if (isSoil && p_76484_4_ < 256 - l - 1) +- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d || block1 == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) { -- this.func_150515_a(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, Blocks.field_150346_d); -+ block2.onPlantGrow(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, p_76484_3_, p_76484_4_, p_76484_5_); - int k2; +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); ++ block1.onPlantGrow(p_180709_1_, down, p_180709_3_); + int i2; - for (k2 = p_76484_4_ - 3 + l; k2 <= p_76484_4_ + l; ++k2) -@@ -98,7 +101,7 @@ - { - Block block1 = p_76484_1_.func_147439_a(l2, k2, i2); + for (i2 = p_180709_3_.func_177956_o() - 3 + i; i2 <= p_180709_3_.func_177956_o() + i; ++i2) +@@ -99,7 +101,7 @@ + BlockPos blockpos1 = new BlockPos(i1, i2, k1); + Block block = p_180709_1_.func_180495_p(blockpos1).func_177230_c(); -- if (block1.func_149688_o() == Material.field_151579_a || block1.func_149688_o() == Material.field_151584_j) -+ if (block1.isAir(p_76484_1_, l2, k2, i2) || block1.isLeaves(p_76484_1_, l2, k2, i2)) +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (block.isAir(p_180709_1_, blockpos1) || block.isLeaves(p_180709_1_, blockpos1)) { - this.func_150516_a(p_76484_1_, l2, k2, i2, Blocks.field_150362_t, 2); + this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150362_t, BlockPlanks.EnumType.BIRCH.func_176839_a()); } -@@ -111,7 +114,7 @@ - { - Block block3 = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ + k2, p_76484_5_); +@@ -110,9 +112,10 @@ -- if (block3.func_149688_o() == Material.field_151579_a || block3.func_149688_o() == Material.field_151584_j) -+ if (block3.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + k2, p_76484_5_) || block3.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + k2, p_76484_5_)) + for (i2 = 0; i2 < i; ++i2) + { +- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(i2)).func_177230_c(); ++ BlockPos upN = p_180709_3_.func_177981_b(i2); ++ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); + +- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j) ++ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN)) { - this.func_150516_a(p_76484_1_, p_76484_3_, p_76484_4_ + k2, p_76484_5_, Blocks.field_150364_r, 2); + this.func_175905_a(p_180709_1_, p_180709_3_.func_177981_b(i2), Blocks.field_150364_r, BlockPlanks.EnumType.BIRCH.func_176839_a()); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch index 14eb8efa06..553097c1bc 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch @@ -1,71 +1,66 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java -@@ -2,9 +2,11 @@ - - import java.util.Random; - import net.minecraft.block.Block; -+import net.minecraft.block.BlockSapling; - import net.minecraft.block.material.Material; - import net.minecraft.init.Blocks; - import net.minecraft.world.World; -+import net.minecraftforge.common.util.ForgeDirection; - - public abstract class WorldGenHugeTrees extends WorldGenAbstractTree - { -@@ -63,7 +65,7 @@ +@@ -59,7 +59,7 @@ + { + for (int l = -b0; l <= b0 && flag; ++l) + { +- if (p_175926_2_.func_177956_o() + j < 0 || p_175926_2_.func_177956_o() + j >= 256 || !this.func_150523_a(p_175926_1_.func_180495_p(p_175926_2_.func_177982_a(k, j, l)).func_177230_c())) ++ if (p_175926_2_.func_177956_o() + j < 0 || p_175926_2_.func_177956_o() + j >= 256 || !this.isReplaceable(p_175926_1_, p_175926_2_.func_177982_a(k, j, l))) { - Block block = p_150536_1_.func_147439_a(j1, i1, k1); - -- if (!this.func_150523_a(block)) -+ if (!this.isReplaceable(p_150536_1_, j1, i1, k1)) - { - flag = false; - } -@@ -88,12 +90,13 @@ + flag = false; + } +@@ -79,13 +79,14 @@ { - Block block = p_150532_1_.func_147439_a(p_150532_3_, p_150532_4_ - 1, p_150532_5_); + BlockPos blockpos1 = p_175927_1_.func_177977_b(); + Block block = p_175927_2_.func_180495_p(blockpos1).func_177230_c(); ++ boolean isSoil = block.canSustainPlant(p_175927_2_, blockpos1, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); -- if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d) && p_150532_4_ >= 2) -+ boolean isSoil = block.canSustainPlant(p_150532_1_, p_150532_3_, p_150532_4_ - 1, p_150532_5_, ForgeDirection.UP, (BlockSapling)Blocks.field_150345_g); -+ if (isSoil && p_150532_4_ >= 2) +- if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d) && p_175927_1_.func_177956_o() >= 2) ++ if (isSoil && p_175927_1_.func_177956_o() >= 2) { -- p_150532_1_.func_147465_d(p_150532_3_, p_150532_4_ - 1, p_150532_5_, Blocks.field_150346_d, 0, 2); -- p_150532_1_.func_147465_d(p_150532_3_ + 1, p_150532_4_ - 1, p_150532_5_, Blocks.field_150346_d, 0, 2); -- p_150532_1_.func_147465_d(p_150532_3_, p_150532_4_ - 1, p_150532_5_ + 1, Blocks.field_150346_d, 0, 2); -- p_150532_1_.func_147465_d(p_150532_3_ + 1, p_150532_4_ - 1, p_150532_5_ + 1, Blocks.field_150346_d, 0, 2); -+ onPlantGrow(p_150532_1_, p_150532_3_, p_150532_4_ - 1, p_150532_5_, p_150532_3_, p_150532_4_, p_150532_5_); -+ onPlantGrow(p_150532_1_, p_150532_3_ + 1, p_150532_4_ - 1, p_150532_5_, p_150532_3_, p_150532_4_, p_150532_5_); -+ onPlantGrow(p_150532_1_, p_150532_3_, p_150532_4_ - 1, p_150532_5_ + 1, p_150532_3_, p_150532_4_, p_150532_5_); -+ onPlantGrow(p_150532_1_, p_150532_3_ + 1, p_150532_4_ - 1, p_150532_5_ + 1, p_150532_3_, p_150532_4_, p_150532_5_); +- this.func_175921_a(p_175927_2_, blockpos1); +- this.func_175921_a(p_175927_2_, blockpos1.func_177974_f()); +- this.func_175921_a(p_175927_2_, blockpos1.func_177968_d()); +- this.func_175921_a(p_175927_2_, blockpos1.func_177968_d().func_177974_f()); ++ this.onPlantGrow(p_175927_2_, blockpos1, p_175927_1_); ++ this.onPlantGrow(p_175927_2_, blockpos1.func_177974_f(), p_175927_1_); ++ this.onPlantGrow(p_175927_2_, blockpos1.func_177968_d(), p_175927_1_); ++ this.onPlantGrow(p_175927_2_, blockpos1.func_177968_d().func_177974_f(), p_175927_1_); return true; } else -@@ -125,7 +128,7 @@ +@@ -113,9 +114,9 @@ + if (k * k + l * l <= j || i1 * i1 + j1 * j1 <= j || k * k + j1 * j1 <= j || i1 * i1 + l * l <= j) { - Block block = p_150535_1_.func_147439_a(j1, p_150535_3_, l1); + BlockPos blockpos1 = p_175925_2_.func_177982_a(k, 0, l); +- Material material = p_175925_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o(); ++ net.minecraft.block.state.IBlockState state = p_175925_1_.func_180495_p(blockpos1); -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (block.isAir(p_150535_1_, j1, p_150535_3_, l1) || block.isLeaves(p_150535_1_, j1, p_150535_3_, l1)) +- if (material == Material.field_151579_a || material == Material.field_151584_j) ++ if (state.func_177230_c().isAir(p_175925_1_, blockpos1) || state.func_177230_c().isLeaves(p_175925_1_, blockpos1)) { - this.func_150516_a(p_150535_1_, j1, p_150535_3_, l1, Blocks.field_150362_t, this.field_76521_c); + this.func_175905_a(p_175925_1_, blockpos1, Blocks.field_150362_t, this.field_76521_c); } -@@ -150,7 +153,7 @@ +@@ -135,9 +136,9 @@ + if (k * k + l * l <= j) { - Block block = p_150534_1_.func_147439_a(j1, p_150534_3_, l1); + BlockPos blockpos1 = p_175928_2_.func_177982_a(k, 0, l); +- Material material = p_175928_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o(); ++ Block block = p_175928_1_.func_180495_p(blockpos1).func_177230_c(); -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (block.isAir(p_150534_1_, j1, p_150534_3_, l1) || block.isLeaves(p_150534_1_, j1, p_150534_3_, l1)) +- if (material == Material.field_151579_a || material == Material.field_151584_j) ++ if (block.isAir(p_175928_1_, blockpos1) || block.isLeaves(p_175928_1_, blockpos1)) { - this.func_150516_a(p_150534_1_, j1, p_150534_3_, l1, Blocks.field_150362_t, this.field_76521_c); + this.func_175905_a(p_175928_1_, blockpos1, Blocks.field_150362_t, this.field_76521_c); } -@@ -158,4 +161,10 @@ +@@ -145,4 +146,10 @@ } } } + + //Just a helper macro -+ private void onPlantGrow(World world, int x, int y, int z, int sourceX, int sourceY, int sourceZ) ++ private void onPlantGrow(World world, BlockPos pos, BlockPos source) + { -+ world.func_147439_a(x, y, z).onPlantGrow(world, x, y, z, sourceX, sourceY, sourceZ); ++ world.func_180495_p(pos).func_177230_c().onPlantGrow(world, pos, source); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch index 603c443acc..449385cd2d 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch @@ -1,38 +1,62 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java -@@ -56,7 +56,7 @@ +@@ -57,7 +57,7 @@ { - Block block = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ + l2, p_76484_5_); + BlockPos blockpos1 = p_180709_3_.func_177981_b(i2); -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (block.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + l2, p_76484_5_) || block.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + l2, p_76484_5_)) +- if (this.func_175931_a(p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o())) ++ if (this.isAirLeaves(p_180709_1_, blockpos1)) { - this.func_150516_a(p_76484_1_, p_76484_3_, p_76484_4_ + l2, p_76484_5_, Blocks.field_150364_r, this.field_76520_b); + this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150364_r, this.field_76520_b); -@@ -78,7 +78,7 @@ +@@ -72,7 +72,7 @@ { - block = p_76484_1_.func_147439_a(p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_); + BlockPos blockpos2 = blockpos1.func_177974_f(); -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (block.isAir(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_) || block.isLeaves(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_)) +- if (this.func_175931_a(p_180709_1_.func_180495_p(blockpos2).func_177230_c().func_149688_o())) ++ if (this.isAirLeaves(p_180709_1_, blockpos2)) { - this.func_150516_a(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_, Blocks.field_150364_r, this.field_76520_b); + this.func_175905_a(p_180709_1_, blockpos2, Blocks.field_150364_r, this.field_76520_b); + +@@ -85,7 +85,7 @@ + + BlockPos blockpos3 = blockpos1.func_177968_d().func_177974_f(); + +- if (this.func_175931_a(p_180709_1_.func_180495_p(blockpos3).func_177230_c().func_149688_o())) ++ if (this.isAirLeaves(p_180709_1_, blockpos3)) + { + this.func_175905_a(p_180709_1_, blockpos3, Blocks.field_150364_r, this.field_76520_b); @@ -98,7 +98,7 @@ - block = p_76484_1_.func_147439_a(p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_ + 1); + BlockPos blockpos4 = blockpos1.func_177968_d(); -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (block.isAir(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_ + 1) || block.isLeaves(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_ + 1)) +- if (this.func_175931_a(p_180709_1_.func_180495_p(blockpos4).func_177230_c().func_149688_o())) ++ if (this.isAirLeaves(p_180709_1_, blockpos4)) { - this.func_150516_a(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + l2, p_76484_5_ + 1, Blocks.field_150364_r, this.field_76520_b); + this.func_175905_a(p_180709_1_, blockpos4, Blocks.field_150364_r, this.field_76520_b); -@@ -118,7 +118,7 @@ - - block = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ + l2, p_76484_5_ + 1); - -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (block.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + l2, p_76484_5_ + 1) || block.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + l2, p_76484_5_ + 1)) - { - this.func_150516_a(p_76484_1_, p_76484_3_, p_76484_4_ + l2, p_76484_5_ + 1, Blocks.field_150364_r, this.field_76520_b); +@@ -115,11 +115,6 @@ + } + } +- private boolean func_175931_a(Material p_175931_1_) +- { +- return p_175931_1_ == Material.field_151579_a || p_175931_1_ == Material.field_151584_j; +- } +- + private void func_175932_b(World p_175932_1_, Random p_175932_2_, BlockPos p_175932_3_, int p_175932_4_) + { + if (p_175932_2_.nextInt(3) > 0 && p_175932_1_.func_175623_d(p_175932_3_)) +@@ -137,4 +132,11 @@ + this.func_175925_a(p_175930_1_, p_175930_2_.func_177981_b(j), p_175930_3_ + 1 - j); + } + } ++ ++ //Helper macro ++ private boolean isAirLeaves(World world, BlockPos pos) ++ { ++ net.minecraft.block.Block block = world.func_180495_p(pos).func_177230_c(); ++ return block.isAir(world, pos) || block.isLeaves(world, pos); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch index 40006b97b0..865e78c882 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch @@ -1,65 +1,65 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java -@@ -2,10 +2,12 @@ +@@ -35,32 +35,24 @@ - import java.util.Random; - import net.minecraft.block.Block; -+import net.minecraft.block.BlockSapling; - import net.minecraft.block.material.Material; - import net.minecraft.init.Blocks; - import net.minecraft.util.MathHelper; - import net.minecraft.world.World; -+import net.minecraftforge.common.util.ForgeDirection; - - public class WorldGenMegaPineTree extends WorldGenHugeTrees - { -@@ -34,7 +36,7 @@ + for (int j = 0; j < i; ++j) { - Block block = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ + i1, p_76484_5_); - +- Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(j)).func_177230_c(); +- - if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (block.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + i1, p_76484_5_) || block.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + i1, p_76484_5_)) ++ if (this.isAirLeaves(p_180709_1_, p_180709_3_.func_177981_b(j))) { - this.func_150516_a(p_76484_1_, p_76484_3_, p_76484_4_ + i1, p_76484_5_, Blocks.field_150364_r, this.field_76520_b); + this.func_175905_a(p_180709_1_, p_180709_3_.func_177981_b(j), Blocks.field_150364_r, this.field_76520_b); } -@@ -43,21 +45,21 @@ + + if (j < i - 1) { - block = p_76484_1_.func_147439_a(p_76484_3_ + 1, p_76484_4_ + i1, p_76484_5_); - +- block = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(1, j, 0)).func_177230_c(); +- - if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (block.isAir(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + i1, p_76484_5_) || block.isLeaves(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + i1, p_76484_5_)) ++ if (this.isAirLeaves(p_180709_1_, p_180709_3_.func_177982_a(1, j, 0))) { - this.func_150516_a(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + i1, p_76484_5_, Blocks.field_150364_r, this.field_76520_b); + this.func_175905_a(p_180709_1_, p_180709_3_.func_177982_a(1, j, 0), Blocks.field_150364_r, this.field_76520_b); } - block = p_76484_1_.func_147439_a(p_76484_3_ + 1, p_76484_4_ + i1, p_76484_5_ + 1); - +- block = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(1, j, 1)).func_177230_c(); +- - if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (block.isAir(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + i1, p_76484_5_ + 1) || block.isLeaves(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + i1, p_76484_5_ + 1)) ++ if (this.isAirLeaves(p_180709_1_, p_180709_3_.func_177982_a(1, j, 1))) { - this.func_150516_a(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + i1, p_76484_5_ + 1, Blocks.field_150364_r, this.field_76520_b); + this.func_175905_a(p_180709_1_, p_180709_3_.func_177982_a(1, j, 1), Blocks.field_150364_r, this.field_76520_b); } - block = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ + i1, p_76484_5_ + 1); - +- block = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(0, j, 1)).func_177230_c(); +- - if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (block.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + i1, p_76484_5_ + 1) || block.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + i1, p_76484_5_ + 1)) ++ if (this.isAirLeaves(p_180709_1_, p_180709_3_.func_177982_a(0, j, 1))) { - this.func_150516_a(p_76484_1_, p_76484_3_, p_76484_4_ + i1, p_76484_5_ + 1, Blocks.field_150364_r, this.field_76520_b); + this.func_175905_a(p_180709_1_, p_180709_3_.func_177982_a(0, j, 1), Blocks.field_150364_r, this.field_76520_b); } -@@ -132,13 +134,13 @@ - { - Block block = p_150540_1_.func_147439_a(p_150540_2_, l, p_150540_4_); +@@ -126,16 +118,23 @@ + BlockPos blockpos1 = p_175934_2_.func_177981_b(i); + Block block = p_175934_1_.func_180495_p(blockpos1).func_177230_c(); - if (block == Blocks.field_150349_c || block == Blocks.field_150346_d) -+ if (block.canSustainPlant(p_150540_1_, p_150540_2_, l, p_150540_4_, ForgeDirection.UP, (BlockSapling)Blocks.field_150345_g)) ++ if (block.canSustainPlant(p_175934_1_, blockpos1, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g))) { - this.func_150516_a(p_150540_1_, p_150540_2_, l, p_150540_4_, Blocks.field_150346_d, 2); + this.func_175905_a(p_175934_1_, blockpos1, Blocks.field_150346_d, BlockDirt.DirtType.PODZOL.func_176925_a()); break; } -- if (block.func_149688_o() != Material.field_151579_a && l < p_150540_3_) -+ if (block.isAir(p_150540_1_, p_150540_2_, l, p_150540_4_) && l < p_150540_3_) +- if (block.func_149688_o() != Material.field_151579_a && i < 0) ++ if (!block.isAir(p_175934_1_, blockpos1) && i < 0) { break; } + } + } ++ ++ //Helper macro ++ private boolean isAirLeaves(World world, BlockPos pos) ++ { ++ net.minecraft.block.Block block = world.func_180495_p(pos).func_177230_c(); ++ return block.isAir(world, pos) || block.isLeaves(world, pos); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch index bac3c9bf88..b8dbd54466 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch @@ -1,35 +1,11 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java -@@ -12,6 +12,7 @@ - private int field_76541_b; - private Block field_150518_c; - private static final String __OBFID = "CL_00000426"; -+ private int mineableBlockMeta; - - public WorldGenMinable(Block p_i45459_1_, int p_i45459_2_) - { -@@ -25,6 +26,12 @@ - this.field_150518_c = p_i45460_3_; - } - -+ public WorldGenMinable(Block block, int meta, int number, Block target) -+ { -+ this(block, number, target); -+ this.mineableBlockMeta = meta; -+ } -+ - public boolean func_76484_a(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) - { - float f = p_76484_2_.nextFloat() * (float)Math.PI; -@@ -66,9 +73,9 @@ - { - double d14 = ((double)i3 + 0.5D - d8) / (d10 / 2.0D); - -- if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && p_76484_1_.func_147439_a(k2, l2, i3) == this.field_150518_c) -+ if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && p_76484_1_.func_147439_a(k2, l2, i3).isReplaceableOreGen(p_76484_1_, k2, l2, i3, field_150518_c)) +@@ -74,7 +74,7 @@ { -- p_76484_1_.func_147465_d(k2, l2, i3, this.field_150519_a, 0, 2); -+ p_76484_1_.func_147465_d(k2, l2, i3, this.field_150519_a, mineableBlockMeta, 2); - } - } - } + BlockPos blockpos1 = new BlockPos(l1, i2, j2); + +- if (this.field_175919_c.apply(p_180709_1_.func_180495_p(blockpos1))) ++ if (p_180709_1_.func_180495_p(blockpos1).func_177230_c().isReplaceableOreGen(p_180709_1_, blockpos1, this.field_175919_c)) + { + p_180709_1_.func_180501_a(blockpos1, this.field_175920_a, 2); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch index 34615fe111..48c841f3b7 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch @@ -1,64 +1,64 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java -@@ -2,10 +2,12 @@ - - import java.util.Random; - import net.minecraft.block.Block; -+import net.minecraft.block.BlockSapling; - import net.minecraft.block.material.Material; - import net.minecraft.init.Blocks; - import net.minecraft.util.Direction; - import net.minecraft.world.World; -+import net.minecraftforge.common.util.ForgeDirection; - - public class WorldGenSavannaTree extends WorldGenAbstractTree - { -@@ -48,7 +50,7 @@ +@@ -48,7 +48,7 @@ + { + if (j >= 0 && j < 256) { - Block block = p_76484_1_.func_147439_a(j1, i1, k1); - -- if (!this.func_150523_a(block)) -+ if (!this.isReplaceable(p_76484_1_, j1, i1, k1)) +- if (!this.func_150523_a(p_180709_1_.func_180495_p(new BlockPos(k, j, l)).func_177230_c())) ++ if (!this.isReplaceable(p_180709_1_, new BlockPos(k, j, l))) { flag = false; } -@@ -69,9 +71,10 @@ +@@ -67,11 +67,13 @@ + } + else { - Block block3 = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ - 1, p_76484_5_); +- Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); ++ BlockPos down = p_180709_3_.func_177977_b(); ++ Block block = p_180709_1_.func_180495_p(down).func_177230_c(); ++ boolean isSoil = block.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); -- if ((block3 == Blocks.field_150349_c || block3 == Blocks.field_150346_d) && p_76484_4_ < 256 - l - 1) -+ boolean isSoil = block3.canSustainPlant(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, ForgeDirection.UP, (BlockSapling)Blocks.field_150345_g); -+ if (isSoil && p_76484_4_ < 256 - l - 1) +- if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) { -- this.func_150515_a(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, Blocks.field_150346_d); -+ block3.onPlantGrow(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, p_76484_3_, p_76484_4_, p_76484_5_); - int j3 = p_76484_2_.nextInt(4); - j1 = l - p_76484_2_.nextInt(4) - 1; - k1 = 3 - p_76484_2_.nextInt(3); -@@ -94,7 +97,7 @@ +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); ++ block.onPlantGrow(p_180709_1_, down, p_180709_3_); + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.func_179518_a(p_180709_2_); + k = i - p_180709_2_.nextInt(4) - 1; + l = 3 - p_180709_2_.nextInt(3); +@@ -92,9 +94,9 @@ + } - Block block1 = p_76484_1_.func_147439_a(k3, k2, l1); + BlockPos blockpos1 = new BlockPos(i1, i2, j1); +- Material material = p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o(); ++ block = p_180709_1_.func_180495_p(blockpos1).func_177230_c(); -- if (block1.func_149688_o() == Material.field_151579_a || block1.func_149688_o() == Material.field_151584_j) -+ if (block1.isAir(p_76484_1_, k3, k2, l1) || block1.isLeaves(p_76484_1_, k3, k2, l1)) +- if (material == Material.field_151579_a || material == Material.field_151584_j) ++ if (block.isAir(p_180709_1_, blockpos1) || block.isLeaves(p_180709_1_, blockpos1)) { - this.func_150516_a(p_76484_1_, k3, k2, l1, Blocks.field_150363_s, 0); - i2 = k2; -@@ -146,7 +149,7 @@ - l1 += Direction.field_71581_b[j2]; - Block block2 = p_76484_1_.func_147439_a(k3, i3, l1); + this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150363_s, BlockPlanks.EnumType.ACACIA.func_176839_a() - 4); + k1 = i2; +@@ -148,9 +150,9 @@ + i1 += enumfacing1.func_82601_c(); + j1 += enumfacing1.func_82599_e(); + BlockPos blockpos2 = new BlockPos(i1, j2, j1); +- Material material1 = p_180709_1_.func_180495_p(blockpos2).func_177230_c().func_149688_o(); ++ block = p_180709_1_.func_180495_p(blockpos2).func_177230_c(); -- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j) -+ if (block2.isAir(p_76484_1_, k3, i3, l1) || block2.isLeaves(p_76484_1_, k3, i3, l1)) +- if (material1 == Material.field_151579_a || material1 == Material.field_151584_j) ++ if (block.isAir(p_180709_1_, blockpos2) || block.isLeaves(p_180709_1_, blockpos2)) { - this.func_150516_a(p_76484_1_, k3, i3, l1, Blocks.field_150363_s, 0); - i2 = i3; -@@ -197,7 +200,7 @@ - { - Block block = p_150525_1_.func_147439_a(p_150525_2_, p_150525_3_, p_150525_4_); + this.func_175905_a(p_180709_1_, blockpos2, Blocks.field_150363_s, BlockPlanks.EnumType.ACACIA.func_176839_a() - 4); + k1 = j2; +@@ -204,9 +206,9 @@ -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (block.isAir(p_150525_1_, p_150525_2_, p_150525_3_, p_150525_4_) || block.isLeaves(p_150525_1_, p_150525_2_, p_150525_3_, p_150525_4_)) + private void func_175924_b(World p_175924_1_, BlockPos p_175924_2_) + { +- Material material = p_175924_1_.func_180495_p(p_175924_2_).func_177230_c().func_149688_o(); ++ Block block = p_175924_1_.func_180495_p(p_175924_2_).func_177230_c(); + +- if (material == Material.field_151579_a || material == Material.field_151584_j) ++ if (block.isAir(p_175924_1_, p_175924_2_) || block.isLeaves(p_175924_1_, p_175924_2_)) { - this.func_150516_a(p_150525_1_, p_150525_2_, p_150525_3_, p_150525_4_, Blocks.field_150361_u, 0); + this.func_175905_a(p_175924_1_, p_175924_2_, Blocks.field_150361_u, 0); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch index 64775e92c9..355438a960 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch @@ -1,43 +1,31 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java -@@ -5,6 +5,8 @@ - import net.minecraft.block.material.Material; - import net.minecraft.init.Blocks; - import net.minecraft.world.World; -+import net.minecraftforge.common.IPlantable; -+import net.minecraftforge.common.util.ForgeDirection; - - public class WorldGenShrub extends WorldGenTrees - { -@@ -23,14 +25,19 @@ +@@ -24,14 +24,16 @@ { Block block; -- while (((block = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_, p_76484_5_)).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_76484_4_ > 0) +- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 0) + do { -+ block = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_, p_76484_5_); -+ if (!(block.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_, p_76484_5_) || block.isAir(p_76484_1_, p_76484_3_, p_76484_4_, p_76484_5_))) -+ { -+ break; -+ } - --p_76484_4_; ++ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); ++ if (!block.isAir(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.func_177977_b(); - } -+ } while (p_76484_4_ > 0); ++ } while (p_180709_3_.func_177956_o() > 0); - Block block1 = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_, p_76484_5_); + Block block1 = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); - if (block1 == Blocks.field_150346_d || block1 == Blocks.field_150349_c) -+ if (block1.canSustainPlant(p_76484_1_, p_76484_3_, p_76484_4_, p_76484_5_, ForgeDirection.UP, (IPlantable)Blocks.field_150345_g)) ++ if (block1.canSustainPlant(p_180709_1_, p_180709_3_, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g))) { - ++p_76484_4_; - this.func_150516_a(p_76484_1_, p_76484_3_, p_76484_4_, p_76484_5_, Blocks.field_150364_r, this.field_150527_b); -@@ -48,7 +55,7 @@ - { - int j2 = i2 - p_76484_5_; - -- if ((Math.abs(l1) != j1 || Math.abs(j2) != j1 || p_76484_2_.nextInt(2) != 0) && !p_76484_1_.func_147439_a(k1, l, i2).func_149730_j()) -+ if ((Math.abs(l1) != j1 || Math.abs(j2) != j1 || p_76484_2_.nextInt(2) != 0) && p_76484_1_.func_147439_a(k1, l, i2).canBeReplacedByLeaves(p_76484_1_, k1, l, i2)) + p_180709_3_ = p_180709_3_.func_177984_a(); + this.func_175905_a(p_180709_1_, p_180709_3_, Blocks.field_150364_r, this.field_150527_b); +@@ -53,7 +55,7 @@ { - this.func_150516_a(p_76484_1_, k1, l, i2, Blocks.field_150362_t, this.field_150528_a); - } + BlockPos blockpos1 = new BlockPos(l, i, j1); + +- if (!p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149730_j()) ++ if (!p_180709_1_.func_180495_p(blockpos1).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos1)) + { + this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150362_t, this.field_150528_a); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch index d336c151b6..5283aeb630 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch @@ -1,93 +1,98 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java -@@ -2,9 +2,11 @@ - - import java.util.Random; - import net.minecraft.block.Block; -+import net.minecraft.block.BlockSapling; - import net.minecraft.block.material.Material; - import net.minecraft.init.Blocks; - import net.minecraft.world.World; -+import net.minecraftforge.common.util.ForgeDirection; - - public class WorldGenSwamp extends WorldGenAbstractTree - { -@@ -53,7 +55,7 @@ +@@ -53,9 +53,10 @@ + { + if (j >= 0 && j < 256) { - Block block = p_76484_1_.func_147439_a(j1, i1, k1); +- Block block = p_180709_1_.func_180495_p(new BlockPos(k, j, l)).func_177230_c(); ++ BlockPos pos = new BlockPos(k, j, l); ++ Block block = p_180709_1_.func_180495_p(pos).func_177230_c(); - if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) -+ if (!(block.isAir(p_76484_1_, j1, i1, k1) || block.isLeaves(p_76484_1_, j1, i1, k1))) ++ if (!block.isAir(p_180709_1_, pos) && !block.isLeaves(p_180709_1_, pos)) { if (block != Blocks.field_150355_j && block != Blocks.field_150358_i) { -@@ -81,9 +83,10 @@ +@@ -81,11 +82,13 @@ + } + else { - Block block1 = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ - 1, p_76484_5_); +- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); ++ BlockPos down = p_180709_3_.func_177977_b(); ++ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); ++ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); -- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d) && p_76484_4_ < 256 - l - 1) -+ boolean isSoil = block1.canSustainPlant(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, ForgeDirection.UP, (BlockSapling)Blocks.field_150345_g); -+ if (isSoil && p_76484_4_ < 256 - l - 1) +- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) { -- this.func_150515_a(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, Blocks.field_150346_d); -+ block1.onPlantGrow(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, p_76484_3_, p_76484_4_, p_76484_5_); +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); ++ block1.onPlantGrow(p_180709_1_, down, p_180709_3_); + int i1; + BlockPos blockpos1; int l1; - int k2; - int l2; -@@ -101,7 +104,7 @@ - { - int j2 = i2 - p_76484_5_; - -- if ((Math.abs(l1) != k1 || Math.abs(j2) != k1 || p_76484_2_.nextInt(2) != 0 && j1 != 0) && !p_76484_1_.func_147439_a(l2, k2, i2).func_149730_j()) -+ if ((Math.abs(l1) != k1 || Math.abs(j2) != k1 || p_76484_2_.nextInt(2) != 0 && j1 != 0) && p_76484_1_.func_147439_a(l2, k2, i2).canBeReplacedByLeaves(p_76484_1_, l2, k2, i2)) +@@ -108,7 +111,7 @@ { - this.func_150515_a(p_76484_1_, l2, k2, i2, Blocks.field_150362_t); - } -@@ -113,7 +116,7 @@ + blockpos1 = new BlockPos(i2, l1, j1); + +- if (!p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149730_j()) ++ if (!p_180709_1_.func_180495_p(blockpos1).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos1)) + { + this.func_175906_a(p_180709_1_, blockpos1, Blocks.field_150362_t); + } +@@ -119,9 +122,10 @@ + + for (l1 = 0; l1 < i; ++l1) { - Block block2 = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ + k2, p_76484_5_); +- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(l1)).func_177230_c(); ++ BlockPos upN = p_180709_3_.func_177981_b(l1); ++ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); - if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j || block2 == Blocks.field_150358_i || block2 == Blocks.field_150355_j) -+ if (block2.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + k2, p_76484_5_) || block2.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + k2, p_76484_5_) || block2 == Blocks.field_150358_i || block2 == Blocks.field_150355_j) ++ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN) || block2 == Blocks.field_150358_i || block2 == Blocks.field_150355_j) { - this.func_150515_a(p_76484_1_, p_76484_3_, p_76484_4_ + k2, p_76484_5_, Blocks.field_150364_r); + this.func_175906_a(p_180709_1_, p_180709_3_.func_177981_b(l1), Blocks.field_150364_r); } -@@ -128,24 +131,24 @@ - { - for (l1 = p_76484_5_ - k1; l1 <= p_76484_5_ + k1; ++l1) +@@ -138,29 +142,29 @@ { -- if (p_76484_1_.func_147439_a(l2, k2, l1).func_149688_o() == Material.field_151584_j) -+ if (p_76484_1_.func_147439_a(l2, k2, l1).isLeaves(p_76484_1_, l2, k2, l1)) + BlockPos blockpos4 = new BlockPos(i2, l1, i1); + +- if (p_180709_1_.func_180495_p(blockpos4).func_177230_c().func_149688_o() == Material.field_151584_j) ++ if (p_180709_1_.func_180495_p(blockpos4).func_177230_c().isLeaves(p_180709_1_, blockpos4)) { -- if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(l2 - 1, k2, l1).func_149688_o() == Material.field_151579_a) -+ if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(l2 - 1, k2, l1).isAir(p_76484_1_, l2 - 1, k2, l1)) + BlockPos blockpos5 = blockpos4.func_177976_e(); + blockpos1 = blockpos4.func_177974_f(); + BlockPos blockpos2 = blockpos4.func_177978_c(); + BlockPos blockpos3 = blockpos4.func_177968_d(); + +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos5).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos5).func_177230_c().isAir(p_180709_1_, blockpos5)) { - this.func_76536_b(p_76484_1_, l2 - 1, k2, l1, 8); + this.func_175922_a(p_180709_1_, blockpos5, BlockVine.field_176275_S); } -- if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(l2 + 1, k2, l1).func_149688_o() == Material.field_151579_a) -+ if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(l2 + 1, k2, l1).isAir(p_76484_1_, l2 + 1, k2, l1)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().isAir(p_180709_1_, blockpos1)) { - this.func_76536_b(p_76484_1_, l2 + 1, k2, l1, 2); + this.func_175922_a(p_180709_1_, blockpos1, BlockVine.field_176271_T); } -- if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(l2, k2, l1 - 1).func_149688_o() == Material.field_151579_a) -+ if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(l2, k2, l1 - 1).isAir(p_76484_1_, l2, k2, l1 - 1)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().isAir(p_180709_1_, blockpos2)) { - this.func_76536_b(p_76484_1_, l2, k2, l1 - 1, 1); + this.func_175922_a(p_180709_1_, blockpos2, BlockVine.field_176272_Q); } -- if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(l2, k2, l1 + 1).func_149688_o() == Material.field_151579_a) -+ if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(l2, k2, l1 + 1).isAir(p_76484_1_, l2, k2, l1 + 1)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos3).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos3).func_177230_c().isAir(p_180709_1_, blockpos3)) { - this.func_76536_b(p_76484_1_, l2, k2, l1 + 1, 4); + this.func_175922_a(p_180709_1_, blockpos3, BlockVine.field_176276_R); } -@@ -177,7 +180,7 @@ +@@ -188,7 +192,7 @@ + this.func_175905_a(p_175922_1_, p_175922_2_, Blocks.field_150395_bd, p_175922_3_); + int j = 4; + +- for (p_175922_2_ = p_175922_2_.func_177977_b(); p_175922_1_.func_180495_p(p_175922_2_).func_177230_c().func_149688_o() == Material.field_151579_a && j > 0; --j) ++ for (p_175922_2_ = p_175922_2_.func_177977_b(); p_175922_1_.func_180495_p(p_175922_2_).func_177230_c().isAir(p_175922_1_, p_175922_2_) && j > 0; --j) { - --p_76536_3_; - -- if (p_76536_1_.func_147439_a(p_76536_2_, p_76536_3_, p_76536_4_).func_149688_o() != Material.field_151579_a || i1 <= 0) -+ if (!(p_76536_1_.func_147439_a(p_76536_2_, p_76536_3_, p_76536_4_).isAir(p_76536_1_, p_76536_2_, p_76536_3_, p_76536_4_)) || i1 <= 0) - { - return; - } + this.func_175905_a(p_175922_1_, p_175922_2_, Blocks.field_150395_bd, p_175922_3_); + p_175922_2_ = p_175922_2_.func_177977_b(); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch index df6c980133..17abddc875 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch @@ -1,54 +1,50 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java -@@ -2,9 +2,11 @@ - - import java.util.Random; - import net.minecraft.block.Block; -+import net.minecraft.block.BlockSapling; - import net.minecraft.block.material.Material; - import net.minecraft.init.Blocks; - import net.minecraft.world.World; -+import net.minecraftforge.common.util.ForgeDirection; - - public class WorldGenTaiga1 extends WorldGenAbstractTree - { -@@ -50,7 +52,7 @@ +@@ -50,7 +50,7 @@ + { + if (i1 >= 0 && i1 < 256) { - Block block = p_76484_1_.func_147439_a(i2, l1, j2); - -- if (!this.func_150523_a(block)) -+ if (!this.isReplaceable(p_76484_1_, i2, l1, j2)) +- if (!this.func_150523_a(p_180709_1_.func_180495_p(new BlockPos(j1, i1, k1)).func_177230_c())) ++ if (!this.isReplaceable(p_180709_1_, new BlockPos(j1, i1, k1))) { flag = false; } -@@ -71,9 +73,10 @@ +@@ -69,11 +69,13 @@ + } + else { - Block block1 = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ - 1, p_76484_5_); +- Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); ++ BlockPos down = p_180709_3_.func_177977_b(); ++ Block block = p_180709_1_.func_180495_p(down).func_177230_c(); ++ boolean isSoil = block.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); -- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d) && p_76484_4_ < 256 - l - 1) -+ boolean isSoil = block1.canSustainPlant(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, ForgeDirection.UP, (BlockSapling)Blocks.field_150345_g); -+ if (isSoil && p_76484_4_ < 256 - l - 1) +- if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) { -- this.func_150515_a(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, Blocks.field_150346_d); -+ block1.onPlantGrow(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, p_76484_3_, p_76484_4_, p_76484_5_); - i3 = 0; +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); ++ block.onPlantGrow(p_180709_1_, down, p_180709_3_); + k2 = 0; - for (i2 = p_76484_4_ + l; i2 >= p_76484_4_ + i1; --i2) -@@ -86,7 +89,7 @@ - { - int l2 = k2 - p_76484_5_; - -- if ((Math.abs(j3) != i3 || Math.abs(l2) != i3 || i3 <= 0) && !p_76484_1_.func_147439_a(j2, i2, k2).func_149730_j()) -+ if ((Math.abs(j3) != i3 || Math.abs(l2) != i3 || i3 <= 0) && p_76484_1_.func_147439_a(j2, i2, k2).canBeReplacedByLeaves(p_76484_1_, j2, i2, k2)) + for (j1 = p_180709_3_.func_177956_o() + i; j1 >= p_180709_3_.func_177956_o() + j; --j1) +@@ -90,7 +92,7 @@ { - this.func_150516_a(p_76484_1_, j2, i2, k2, Blocks.field_150362_t, 1); - } -@@ -107,7 +110,7 @@ - { - Block block2 = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ + i2, p_76484_5_); + BlockPos blockpos1 = new BlockPos(k1, j1, i2); -- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j) -+ if (block2.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + i2, p_76484_5_) || block2.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + i2, p_76484_5_)) +- if (!p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149730_j()) ++ if (!p_180709_1_.func_180495_p(blockpos1).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos1)) + { + this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150362_t, BlockPlanks.EnumType.SPRUCE.func_176839_a()); + } +@@ -110,9 +112,10 @@ + + for (j1 = 0; j1 < i - 1; ++j1) + { +- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(j1)).func_177230_c(); ++ BlockPos upN = p_180709_3_.func_177981_b(j1); ++ Block block1 = p_180709_1_.func_180495_p(upN).func_177230_c(); + +- if (block1.func_149688_o() == Material.field_151579_a || block1.func_149688_o() == Material.field_151584_j) ++ if (block1.isAir(p_180709_1_, upN) || block1.isLeaves(p_180709_1_, upN)) { - this.func_150516_a(p_76484_1_, p_76484_3_, p_76484_4_ + i2, p_76484_5_, Blocks.field_150364_r, 1); + this.func_175905_a(p_180709_1_, p_180709_3_.func_177981_b(j1), Blocks.field_150364_r, BlockPlanks.EnumType.SPRUCE.func_176839_a()); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch index ae8da1c844..2515e86dd2 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch @@ -1,54 +1,54 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java -@@ -2,9 +2,11 @@ - - import java.util.Random; - import net.minecraft.block.Block; -+import net.minecraft.block.BlockSapling; - import net.minecraft.block.material.Material; - import net.minecraft.init.Blocks; - import net.minecraft.world.World; -+import net.minecraftforge.common.util.ForgeDirection; - - public class WorldGenTaiga2 extends WorldGenAbstractTree - { -@@ -49,7 +51,7 @@ +@@ -49,9 +49,10 @@ + { + if (i1 >= 0 && i1 < 256) { - Block block = p_76484_1_.func_147439_a(i2, l1, j2); +- Block block = p_180709_1_.func_180495_p(new BlockPos(j1, i1, k1)).func_177230_c(); ++ BlockPos off = new BlockPos(j1, i1, k1); ++ Block block = p_180709_1_.func_180495_p(off).func_177230_c(); - if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) -+ if (!block.isAir(p_76484_1_, i2, l1, j2) && !block.isLeaves(p_76484_1_, i2, l1, j2)) ++ if (!block.isAir(p_180709_1_, off) && !block.isLeaves(p_180709_1_, off)) { flag = false; } -@@ -70,9 +72,10 @@ +@@ -70,11 +71,13 @@ + } + else { - Block block1 = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ - 1, p_76484_5_); +- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); ++ BlockPos down = p_180709_3_.func_177977_b(); ++ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); ++ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); -- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d || block1 == Blocks.field_150458_ak) && p_76484_4_ < 256 - l - 1) -+ boolean isSoil = block1.canSustainPlant(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, ForgeDirection.UP, (BlockSapling)Blocks.field_150345_g); -+ if (isSoil && p_76484_4_ < 256 - l - 1) +- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d || block1 == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) { -- this.func_150515_a(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, Blocks.field_150346_d); -+ block1.onPlantGrow(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, p_76484_3_, p_76484_4_, p_76484_5_); - l3 = p_76484_2_.nextInt(2); - i2 = 1; +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); ++ block1.onPlantGrow(p_180709_1_, down, p_180709_3_); + i3 = p_180709_2_.nextInt(2); + j1 = 1; byte b0 = 0; -@@ -91,7 +94,7 @@ - { - int k3 = j3 - p_76484_5_; - -- if ((Math.abs(i3) != l3 || Math.abs(k3) != l3 || l3 <= 0) && !p_76484_1_.func_147439_a(l2, k2, j3).func_149730_j()) -+ if ((Math.abs(i3) != l3 || Math.abs(k3) != l3 || l3 <= 0) && p_76484_1_.func_147439_a(l2, k2, j3).canBeReplacedByLeaves(p_76484_1_, l2, k2, j3)) +@@ -97,7 +100,7 @@ { - this.func_150516_a(p_76484_1_, l2, k2, j3, Blocks.field_150362_t, 1); - } -@@ -121,7 +124,7 @@ + BlockPos blockpos1 = new BlockPos(i2, l1, k2); + +- if (!p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149730_j()) ++ if (!p_180709_1_.func_180495_p(blockpos1).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos1)) + { + this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150362_t, BlockPlanks.EnumType.SPRUCE.func_176839_a()); + } +@@ -126,9 +129,10 @@ + + for (l1 = 0; l1 < i - j3; ++l1) { - Block block2 = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ + k2, p_76484_5_); +- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(l1)).func_177230_c(); ++ BlockPos upN = p_180709_3_.func_177981_b(l1); ++ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); - if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j) -+ if (block2.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + k2, p_76484_5_) || block2.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + k2, p_76484_5_)) ++ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN)) { - this.func_150516_a(p_76484_1_, p_76484_3_, p_76484_4_ + k2, p_76484_5_, Blocks.field_150364_r, 1); + this.func_175905_a(p_180709_1_, p_180709_3_.func_177981_b(l1), Blocks.field_150364_r, BlockPlanks.EnumType.SPRUCE.func_176839_a()); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch index 18be24a731..b8fe9ec781 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch @@ -1,20 +1,17 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java -@@ -21,10 +21,15 @@ +@@ -23,10 +23,12 @@ { Block block; -- while (((block = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_, p_76484_5_)).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_76484_4_ > 0) +- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 0) + do { -+ block = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_, p_76484_5_); -+ if (!(block.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_, p_76484_5_) || block.isAir(p_76484_1_, p_76484_3_, p_76484_4_, p_76484_5_))) -+ { -+ break; -+ } - --p_76484_4_; ++ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); ++ if (!block.isAir(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.func_177977_b(); - } -+ } while (p_76484_4_ > 0); ++ } while (p_180709_3_.func_177956_o() > 0); - for (int l = 0; l < 128; ++l) + for (int i = 0; i < 128; ++i) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch index cc5724767e..37d7c07ab6 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch @@ -1,94 +1,94 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java -@@ -2,10 +2,12 @@ - - import java.util.Random; - import net.minecraft.block.Block; -+import net.minecraft.block.BlockSapling; - import net.minecraft.block.material.Material; - import net.minecraft.init.Blocks; - import net.minecraft.util.Direction; - import net.minecraft.world.World; -+import net.minecraftforge.common.util.ForgeDirection; - - public class WorldGenTrees extends WorldGenAbstractTree - { -@@ -62,7 +64,7 @@ +@@ -61,7 +61,7 @@ + { + if (j >= 0 && j < 256) { - block = p_76484_1_.func_147439_a(j1, i1, k1); - -- if (!this.func_150523_a(block)) -+ if (!this.isReplaceable(p_76484_1_, j1, i1, k1)) +- if (!this.func_150523_a(p_180709_1_.func_180495_p(new BlockPos(k, j, l)).func_177230_c())) ++ if (!this.isReplaceable(p_180709_1_, new BlockPos(k, j, l))) { flag = false; } -@@ -83,9 +85,10 @@ +@@ -80,11 +80,13 @@ + } + else { - Block block2 = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ - 1, p_76484_5_); +- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); ++ BlockPos down = p_180709_3_.func_177977_b(); ++ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); ++ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); -- if ((block2 == Blocks.field_150349_c || block2 == Blocks.field_150346_d || block2 == Blocks.field_150458_ak) && p_76484_4_ < 256 - l - 1) -+ boolean isSoil = block2.canSustainPlant(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, ForgeDirection.UP, (BlockSapling)Blocks.field_150345_g); -+ if (isSoil && p_76484_4_ < 256 - l - 1) +- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d || block1 == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) { -- this.func_150515_a(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, Blocks.field_150346_d); -+ block2.onPlantGrow(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, p_76484_3_, p_76484_4_, p_76484_5_); +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); ++ block1.onPlantGrow(p_180709_1_, down, p_180709_3_); b0 = 3; byte b1 = 0; - int l1; -@@ -110,7 +113,7 @@ - { - Block block1 = p_76484_1_.func_147439_a(i2, k1, k2); + int i1; +@@ -111,7 +113,7 @@ + blockpos1 = new BlockPos(k1, l, i2); + Block block = p_180709_1_.func_180495_p(blockpos1).func_177230_c(); -- if (block1.func_149688_o() == Material.field_151579_a || block1.func_149688_o() == Material.field_151584_j) -+ if (block1.isAir(p_76484_1_, i2, k1, k2) || block1.isLeaves(p_76484_1_, i2, k1, k2)) +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j || block.func_149688_o() == Material.field_151582_l) ++ if (block.isAir(p_180709_1_, blockpos1) || block.isLeaves(p_180709_1_, blockpos1) || block.func_149688_o() == Material.field_151582_l) { - this.func_150516_a(p_76484_1_, i2, k1, k2, Blocks.field_150362_t, this.field_76530_d); + this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150362_t, this.field_76530_d); } -@@ -123,7 +126,7 @@ +@@ -122,9 +124,10 @@ + + for (l = 0; l < i; ++l) { - block = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_ + k1, p_76484_5_); +- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(l)).func_177230_c(); ++ BlockPos upN = p_180709_3_.func_177981_b(l); ++ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (block.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_) || block.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_)) +- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j || block2.func_149688_o() == Material.field_151582_l) ++ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN) || block2.func_149688_o() == Material.field_151582_l) { - this.func_150516_a(p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_, Blocks.field_150364_r, this.field_76532_c); + this.func_175905_a(p_180709_1_, p_180709_3_.func_177981_b(l), Blocks.field_150364_r, this.field_76532_c); -@@ -163,24 +166,24 @@ - { - for (j2 = p_76484_5_ - l1; j2 <= p_76484_5_ + l1; ++j2) +@@ -166,29 +169,29 @@ { -- if (p_76484_1_.func_147439_a(i2, k1, j2).func_149688_o() == Material.field_151584_j) -+ if (p_76484_1_.func_147439_a(i2, k1, j2).isLeaves(p_76484_1_, i2, k1, j2)) + BlockPos blockpos3 = new BlockPos(k1, l, l1); + +- if (p_180709_1_.func_180495_p(blockpos3).func_177230_c().func_149688_o() == Material.field_151584_j) ++ if (p_180709_1_.func_180495_p(blockpos3).func_177230_c().isLeaves(p_180709_1_, blockpos3)) { -- if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(i2 - 1, k1, j2).func_149688_o() == Material.field_151579_a) -+ if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(i2 - 1, k1, j2).isAir(p_76484_1_, i2 - 1, k1, j2)) + BlockPos blockpos4 = blockpos3.func_177976_e(); + blockpos1 = blockpos3.func_177974_f(); + BlockPos blockpos5 = blockpos3.func_177978_c(); + BlockPos blockpos2 = blockpos3.func_177968_d(); + +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos4).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos4).func_177230_c().isAir(p_180709_1_, blockpos4)) { - this.func_76529_b(p_76484_1_, i2 - 1, k1, j2, 8); + this.func_175923_a(p_180709_1_, blockpos4, BlockVine.field_176275_S); } -- if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(i2 + 1, k1, j2).func_149688_o() == Material.field_151579_a) -+ if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(i2 + 1, k1, j2).isAir(p_76484_1_, i2 + 1, k1, j2)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().isAir(p_180709_1_, blockpos1)) { - this.func_76529_b(p_76484_1_, i2 + 1, k1, j2, 2); + this.func_175923_a(p_180709_1_, blockpos1, BlockVine.field_176271_T); } -- if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(i2, k1, j2 - 1).func_149688_o() == Material.field_151579_a) -+ if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(i2, k1, j2 - 1).isAir(p_76484_1_, i2, k1, j2 - 1)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos5).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos5).func_177230_c().isAir(p_180709_1_, blockpos5)) { - this.func_76529_b(p_76484_1_, i2, k1, j2 - 1, 1); + this.func_175923_a(p_180709_1_, blockpos5, BlockVine.field_176272_Q); } -- if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(i2, k1, j2 + 1).func_149688_o() == Material.field_151579_a) -+ if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.func_147439_a(i2, k1, j2 + 1).isAir(p_76484_1_, i2, k1, j2 + 1)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().isAir(p_180709_1_, blockpos2)) { - this.func_76529_b(p_76484_1_, i2, k1, j2 + 1, 4); + this.func_175923_a(p_180709_1_, blockpos2, BlockVine.field_176276_R); } -@@ -228,7 +231,7 @@ +@@ -233,7 +236,7 @@ + this.func_175905_a(p_175923_1_, p_175923_2_, Blocks.field_150395_bd, p_175923_3_); + int j = 4; + +- for (p_175923_2_ = p_175923_2_.func_177977_b(); p_175923_1_.func_180495_p(p_175923_2_).func_177230_c().func_149688_o() == Material.field_151579_a && j > 0; --j) ++ for (p_175923_2_ = p_175923_2_.func_177977_b(); p_175923_1_.func_180495_p(p_175923_2_).func_177230_c().isAir(p_175923_1_, p_175923_2_) && j > 0; --j) { - --p_76529_3_; - -- if (p_76529_1_.func_147439_a(p_76529_2_, p_76529_3_, p_76529_4_).func_149688_o() != Material.field_151579_a || i1 <= 0) -+ if (!p_76529_1_.func_147439_a(p_76529_2_, p_76529_3_, p_76529_4_).isAir(p_76529_1_, p_76529_2_, p_76529_3_, p_76529_4_) || i1 <= 0) - { - return; - } + this.func_175905_a(p_175923_1_, p_175923_2_, Blocks.field_150395_bd, p_175923_3_); + p_175923_2_ = p_175923_2_.func_177977_b(); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch index 1e5182e1a7..fa45af1d88 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch @@ -1,18 +1,17 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java -@@ -24,10 +24,12 @@ +@@ -27,10 +27,12 @@ { Block block; -- while (((block = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_, p_76484_5_)).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_76484_4_ > 1) +- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 1) + do { -- --p_76484_4_; ++ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); ++ if (!block.isAir(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.func_177977_b(); - } -+ block = p_76484_1_.func_147439_a(p_76484_3_, p_76484_4_, p_76484_5_); -+ if (!block.isAir(p_76484_1_, p_76484_3_, p_76484_4_, p_76484_5_) && !block.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_, p_76484_5_)) break; -+ p_76484_4_--; -+ } while (p_76484_4_ > 1); ++ } while (p_180709_3_.func_177956_o() > 0); - if (p_76484_4_ < 1) + if (p_180709_3_.func_177956_o() < 1) { diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch index 061709c969..1fe3bb9aad 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayer.java +++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayer.java -@@ -7,6 +7,9 @@ - import net.minecraft.world.WorldType; +@@ -8,6 +8,9 @@ import net.minecraft.world.biome.BiomeGenBase; + import net.minecraft.world.gen.ChunkProviderSettings; +import net.minecraftforge.common.*; +import net.minecraftforge.event.terraingen.*; @@ -10,27 +10,22 @@ public abstract class GenLayer { private long field_75907_b; -@@ -48,17 +51,12 @@ - { - b0 = 4; +@@ -53,11 +56,11 @@ + j = 6; } -+ b0 = getModdedBiomeSize(p_75901_2_, b0); ++ j = getModdedBiomeSize(p_180781_2_, j); ++ GenLayer genlayer = GenLayerZoom.func_75915_a(1000L, genlayer2, 0); GenLayerRiverInit genlayerriverinit = new GenLayerRiverInit(100L, genlayer); -- Object object = new GenLayerBiome(200L, genlayer2, p_75901_2_); -+ Object object = p_75901_2_.getBiomeLayer(p_75901_0_, genlayer2); - -- if (!flag) -- { -- GenLayer genlayer3 = GenLayerZoom.func_75915_a(1000L, (GenLayer)object, 2); -- object = new GenLayerBiomeEdge(1000L, genlayer3); -- } -- +- GenLayerBiome genlayerbiome = new GenLayerBiome(200L, genlayer2, p_180781_2_, p_180781_3_); +- GenLayer genlayer3 = GenLayerZoom.func_75915_a(1000L, genlayerbiome, 2); +- GenLayerBiomeEdge genlayerbiomeedge = new GenLayerBiomeEdge(1000L, genlayer3); ++ GenLayer genlayerbiomeedge = p_180781_2_.getBiomeLayer(p_180781_0_, genlayer2, p_180781_3_); GenLayer genlayer1 = GenLayerZoom.func_75915_a(1000L, genlayerriverinit, 2); - GenLayerHills genlayerhills = new GenLayerHills(1000L, (GenLayer)object, genlayer1); + GenLayerHills genlayerhills = new GenLayerHills(1000L, genlayerbiomeedge, genlayer1); genlayer = GenLayerZoom.func_75915_a(1000L, genlayerriverinit, 2); -@@ -192,7 +190,7 @@ +@@ -194,7 +197,7 @@ protected static boolean func_151618_b(int p_151618_0_) { @@ -39,7 +34,7 @@ } protected int func_151619_a(int ... p_151619_1_) -@@ -204,4 +202,27 @@ +@@ -206,4 +209,27 @@ { return p_151617_2_ == p_151617_3_ && p_151617_3_ == p_151617_4_ ? p_151617_2_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_3_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_3_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_2_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_4_ && p_151617_2_ != p_151617_3_ ? p_151617_1_ : (p_151617_2_ == p_151617_3_ && p_151617_1_ != p_151617_4_ ? p_151617_2_ : (p_151617_2_ == p_151617_4_ && p_151617_1_ != p_151617_3_ ? p_151617_2_ : (p_151617_3_ == p_151617_4_ && p_151617_1_ != p_151617_2_ ? p_151617_3_ : this.func_151619_a(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_})))))))))); } @@ -59,7 +54,7 @@ + return j; + } + -+ public static byte getModdedBiomeSize(WorldType worldType, byte original) ++ public static int getModdedBiomeSize(WorldType worldType, int original) + { + WorldTypeEvent.BiomeSize event = new WorldTypeEvent.BiomeSize(worldType, original); + MinecraftForge.TERRAIN_GEN_BUS.post(event); diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch index deae9ef080..e8a8a63503 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch @@ -1,16 +1,15 @@ --- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java +++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java -@@ -1,29 +1,52 @@ - package net.minecraft.world.gen.layer; - -+import java.util.ArrayList; -+import java.util.List; -+ -+import net.minecraft.util.WeightedRandom; +@@ -3,28 +3,49 @@ import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeGenBase; + import net.minecraft.world.gen.ChunkProviderSettings; ++import java.util.ArrayList; ++import java.util.List; ++import net.minecraft.util.WeightedRandom; +import net.minecraftforge.common.BiomeManager; +import net.minecraftforge.common.BiomeManager.BiomeEntry; ++import static net.minecraftforge.common.BiomeManager.BiomeType.*; public class GenLayerBiome extends GenLayer { @@ -19,93 +18,90 @@ - private BiomeGenBase[] field_151622_e; - private BiomeGenBase[] field_151620_f; + private List[] biomes = new ArrayList[BiomeManager.BiomeType.values().length]; -+ ++ + private final ChunkProviderSettings field_175973_g; private static final String __OBFID = "CL_00000555"; - public GenLayerBiome(long p_i2122_1_, GenLayer p_i2122_3_, WorldType p_i2122_4_) + public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_) { - super(p_i2122_1_); + super(p_i45560_1_); - this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.field_76769_d, BiomeGenBase.field_76769_d, BiomeGenBase.field_76769_d, BiomeGenBase.field_150588_X, BiomeGenBase.field_150588_X, BiomeGenBase.field_76772_c}; - this.field_151621_d = new BiomeGenBase[] {BiomeGenBase.field_76767_f, BiomeGenBase.field_150585_R, BiomeGenBase.field_76770_e, BiomeGenBase.field_76772_c, BiomeGenBase.field_150583_P, BiomeGenBase.field_76780_h}; - this.field_151622_e = new BiomeGenBase[] {BiomeGenBase.field_76767_f, BiomeGenBase.field_76770_e, BiomeGenBase.field_76768_g, BiomeGenBase.field_76772_c}; - this.field_151620_f = new BiomeGenBase[] {BiomeGenBase.field_76774_n, BiomeGenBase.field_76774_n, BiomeGenBase.field_76774_n, BiomeGenBase.field_150584_S}; -+ - this.field_75909_a = p_i2122_3_; -- -+ + this.field_75909_a = p_i45560_3_; + + for (BiomeManager.BiomeType type : BiomeManager.BiomeType.values()) + { + com.google.common.collect.ImmutableList biomesToAdd = BiomeManager.getBiomes(type); + int idx = type.ordinal(); -+ ++ + if (biomes[idx] == null) biomes[idx] = new ArrayList(); + if (biomesToAdd != null) biomes[idx].addAll(biomesToAdd); + } -+ -+ int desertIdx = BiomeManager.BiomeType.DESERT.ordinal(); -+ - if (p_i2122_4_ == WorldType.field_77136_e) ++ ++ int desertIdx = DESERT.ordinal(); ++ ++ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76769_d, 30)); ++ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_150588_X, 20)); ++ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76772_c, 10)); ++ + if (p_i45560_4_ == WorldType.field_77136_e) { - this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.field_76769_d, BiomeGenBase.field_76767_f, BiomeGenBase.field_76770_e, BiomeGenBase.field_76780_h, BiomeGenBase.field_76772_c, BiomeGenBase.field_76768_g}; ++ biomes[desertIdx].clear(); + biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76769_d, 10)); + biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76767_f, 10)); + biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76770_e, 10)); + biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76780_h, 10)); + biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76772_c, 10)); + biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76768_g, 10)); + this.field_175973_g = null; } -+ else -+ { -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76769_d, 30)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_150588_X, 20)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76772_c, 10)); -+ } - } - - public int[] func_75904_a(int p_75904_1_, int p_75904_2_, int p_75904_3_, int p_75904_4_) -@@ -63,7 +86,7 @@ + else if (p_i45560_4_ == WorldType.field_180271_f) +@@ -78,7 +99,7 @@ } else { - aint1[j1 + i1 * p_75904_3_] = this.field_151623_c[this.func_75902_a(this.field_151623_c.length)].field_76756_M; -+ aint1[j1 + i1 * p_75904_3_] = getWeightedBiomeEntry(BiomeManager.BiomeType.DESERT).biome.field_76756_M; ++ aint1[j1 + i1 * p_75904_3_] = getWeightedBiomeEntry(DESERT).biome.field_76756_M; } } else if (k1 == 2) -@@ -74,7 +97,7 @@ +@@ -89,7 +110,7 @@ } else { - aint1[j1 + i1 * p_75904_3_] = this.field_151621_d[this.func_75902_a(this.field_151621_d.length)].field_76756_M; -+ aint1[j1 + i1 * p_75904_3_] = getWeightedBiomeEntry(BiomeManager.BiomeType.WARM).biome.field_76756_M; ++ aint1[j1 + i1 * p_75904_3_] = getWeightedBiomeEntry(WARM).biome.field_76756_M; } } else if (k1 == 3) -@@ -85,12 +108,12 @@ +@@ -100,12 +121,12 @@ } else { - aint1[j1 + i1 * p_75904_3_] = this.field_151622_e[this.func_75902_a(this.field_151622_e.length)].field_76756_M; -+ aint1[j1 + i1 * p_75904_3_] = getWeightedBiomeEntry(BiomeManager.BiomeType.COOL).biome.field_76756_M; ++ aint1[j1 + i1 * p_75904_3_] = getWeightedBiomeEntry(COOL).biome.field_76756_M; } } else if (k1 == 4) { - aint1[j1 + i1 * p_75904_3_] = this.field_151620_f[this.func_75902_a(this.field_151620_f.length)].field_76756_M; -+ aint1[j1 + i1 * p_75904_3_] = getWeightedBiomeEntry(BiomeManager.BiomeType.ICY).biome.field_76756_M; ++ aint1[j1 + i1 * p_75904_3_] = getWeightedBiomeEntry(ICY).biome.field_76756_M; } else { -@@ -101,4 +124,12 @@ +@@ -116,4 +137,12 @@ return aint1; } -+ ++ + protected BiomeEntry getWeightedBiomeEntry(BiomeManager.BiomeType type) + { + List biomeList = biomes[type.ordinal()]; + int totalWeight = WeightedRandom.func_76272_a(biomeList); + int weight = BiomeManager.isTypeListModded(type)?func_75902_a(totalWeight):func_75902_a(totalWeight / 10) * 10; -+ return (BiomeEntry)WeightedRandom.getItem(biomeList, weight); ++ return (BiomeEntry)WeightedRandom.func_180166_a(biomeList, weight); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch index 48b80d6219..f300249a03 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch @@ -1,62 +1,94 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java -@@ -11,6 +11,9 @@ +@@ -17,11 +17,14 @@ + import net.minecraft.init.Blocks; + import net.minecraft.init.Items; + import net.minecraft.item.EnumDyeColor; ++import net.minecraft.item.ItemStack; + import net.minecraft.nbt.NBTTagCompound; + import net.minecraft.util.BlockPos; + import net.minecraft.util.EnumFacing; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; - +import net.minecraftforge.common.ChestGenHooks; +import static net.minecraftforge.common.ChestGenHooks.*; -+ + public class ComponentScatteredFeaturePieces { - private static final String __OBFID = "CL_00000473"; -@@ -252,7 +255,7 @@ +@@ -42,6 +45,12 @@ + + public DesertPyramid() {} + ++ static ++ { ++ ChestGenHooks.init(PYRAMID_DESERT_CHEST, field_74941_i, 2, 7); ++ ChestGenHooks.addItem(PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); ++ } ++ + public DesertPyramid(Random p_i2062_1_, int p_i2062_2_, int p_i2062_3_) + { + super(p_i2062_1_, p_i2062_2_, 64, p_i2062_3_, 21, 15, 21); +@@ -267,7 +276,7 @@ { - int i1 = Direction.field_71583_a[l] * 2; - int j1 = Direction.field_71581_b[l] * 2; -- this.field_74940_h[l] = this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 10 + i1, -11, 10 + j1, WeightedRandomChestContent.func_92080_a(field_74941_i, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); -+ this.field_74940_h[l] = this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 10 + i1, -11, 10 + j1, ChestGenHooks.getItems(PYRAMID_DESERT_CHEST, p_74875_2_), ChestGenHooks.getCount(PYRAMID_DESERT_CHEST, p_74875_2_)); + int k1 = enumfacing.func_82601_c() * 2; + int l1 = enumfacing.func_82599_e() * 2; +- this.field_74940_h[enumfacing.func_176736_b()] = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 10 + k1, -11, 10 + l1, WeightedRandomChestContent.func_177629_a(field_74941_i, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); ++ this.field_74940_h[enumfacing.func_176736_b()] = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 10 + k1, -11, 10 + l1, ChestGenHooks.getItems(PYRAMID_DESERT_CHEST, p_74875_2_), ChestGenHooks.getCount(PYRAMID_DESERT_CHEST, p_74875_2_)); } } -@@ -508,9 +511,12 @@ - this.func_151550_a(p_74875_1_, Blocks.field_150488_af, 0, 4, -3, 1, p_74875_3_); - this.func_151550_a(p_74875_1_, Blocks.field_150341_Y, 0, 3, -3, 1, p_74875_3_); +@@ -370,6 +379,13 @@ + private static ComponentScatteredFeaturePieces.JunglePyramid.Stones field_74942_n = new ComponentScatteredFeaturePieces.JunglePyramid.Stones((ComponentScatteredFeaturePieces.SwitchEnumFacing)null); + private static final String __OBFID = "CL_00000477"; + ++ static ++ { ++ ChestGenHooks.init(PYRAMID_JUNGLE_DISPENSER, field_175815_j, 2, 2); ++ ChestGenHooks.init(PYRAMID_JUNGLE_CHEST, field_175816_i, 2, 7); ++ ChestGenHooks.addItem(PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); ++ } ++ + public JunglePyramid() {} + + public JunglePyramid(Random p_i2064_1_, int p_i2064_2_, int p_i2064_3_) +@@ -525,9 +541,12 @@ + this.func_175811_a(p_74875_1_, Blocks.field_150488_af.func_176223_P(), 4, -3, 1, p_74875_3_); + this.func_175811_a(p_74875_1_, Blocks.field_150341_Y.func_176223_P(), 3, -3, 1, p_74875_3_); + ChestGenHooks dispenser = ChestGenHooks.getInfo(PYRAMID_JUNGLE_DISPENSER); + ChestGenHooks chest = ChestGenHooks.getInfo(PYRAMID_JUNGLE_CHEST); + if (!this.field_74945_j) { -- this.field_74945_j = this.func_74869_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, -2, 1, 2, field_74944_m, 2); -+ this.field_74945_j = this.func_74869_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, -2, 1, 2, dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); +- this.field_74945_j = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.func_176745_a(), field_175815_j, 2); ++ this.field_74945_j = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.func_176745_a(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); } - this.func_151550_a(p_74875_1_, Blocks.field_150395_bd, 15, 3, -2, 2, p_74875_3_); -@@ -527,7 +533,7 @@ + this.func_175811_a(p_74875_1_, Blocks.field_150395_bd.func_176203_a(15), 3, -2, 2, p_74875_3_); +@@ -544,7 +563,7 @@ if (!this.field_74946_k) { -- this.field_74946_k = this.func_74869_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -2, 3, 4, field_74944_m, 2); -+ this.field_74946_k = this.func_74869_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -2, 3, 4, dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); +- this.field_74946_k = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.func_176745_a(), field_175815_j, 2); ++ this.field_74946_k = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.func_176745_a(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); } - this.func_151550_a(p_74875_1_, Blocks.field_150395_bd, 15, 8, -1, 3, p_74875_3_); -@@ -535,7 +541,7 @@ + this.func_175811_a(p_74875_1_, Blocks.field_150395_bd.func_176203_a(15), 8, -1, 3, p_74875_3_); +@@ -552,7 +571,7 @@ if (!this.field_74947_h) { -- this.field_74947_h = this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 8, -3, 3, WeightedRandomChestContent.func_92080_a(field_74943_l, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); -+ this.field_74947_h = this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 8, -3, 3, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); +- this.field_74947_h = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 8, -3, 3, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); ++ this.field_74947_h = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 8, -3, 3, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); } - this.func_151550_a(p_74875_1_, Blocks.field_150341_Y, 0, 9, -3, 2, p_74875_3_); -@@ -568,7 +574,7 @@ + this.func_175811_a(p_74875_1_, Blocks.field_150341_Y.func_176223_P(), 9, -3, 2, p_74875_3_); +@@ -585,7 +604,7 @@ if (!this.field_74948_i) { -- this.field_74948_i = this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -3, 10, WeightedRandomChestContent.func_92080_a(field_74943_l, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); -+ this.field_74948_i = this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -3, 10, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); +- this.field_74948_i = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -3, 10, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); ++ this.field_74948_i = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -3, 10, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); } return true; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch index 943c9e5d83..2ac267ebb7 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch @@ -1,24 +1,16 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java -@@ -11,6 +11,7 @@ - import net.minecraft.world.ChunkPosition; - import net.minecraft.world.World; - import net.minecraft.world.biome.BiomeGenBase; -+import net.minecraftforge.common.BiomeManager; - - public class MapGenStronghold extends MapGenStructure - { -@@ -34,11 +35,18 @@ +@@ -35,11 +35,18 @@ { BiomeGenBase biomegenbase = abiomegenbase[j]; - if (biomegenbase != null && biomegenbase.field_76748_D > 0.0F) -+ if (biomegenbase != null && biomegenbase.field_76748_D > 0.0F && !BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) ++ if (biomegenbase != null && biomegenbase.field_76748_D > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) { this.field_151546_e.add(biomegenbase); } } -+ for (BiomeGenBase biome : BiomeManager.strongHoldBiomes) ++ for (BiomeGenBase biome : net.minecraftforge.common.BiomeManager.strongHoldBiomes) + { + if (!this.field_151546_e.contains(biome)) + { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch index a363382192..9aeab17028 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch @@ -1,17 +1,17 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java -@@ -239,12 +239,12 @@ +@@ -231,12 +231,12 @@ { if (this.field_143029_e == null) { - this.field_143029_e = (MapGenStructureData)p_143027_1_.func_72943_a(MapGenStructureData.class, this.func_143025_a()); -+ this.field_143029_e = (MapGenStructureData)p_143027_1_.perWorldStorage.func_75742_a(MapGenStructureData.class, this.func_143025_a()); ++ this.field_143029_e = (MapGenStructureData)p_143027_1_.getPerWorldStorage().func_75742_a(MapGenStructureData.class, this.func_143025_a()); if (this.field_143029_e == null) { this.field_143029_e = new MapGenStructureData(this.func_143025_a()); - p_143027_1_.func_72823_a(this.func_143025_a(), this.field_143029_e); -+ p_143027_1_.perWorldStorage.func_75745_a(this.func_143025_a(), this.field_143029_e); ++ p_143027_1_.getPerWorldStorage().func_75745_a(this.func_143025_a(), this.field_143029_e); } else { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch index 5ecfdf6229..8c525a6128 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureComponent.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureComponent.java -@@ -34,6 +34,10 @@ +@@ -35,6 +35,10 @@ public NBTTagCompound func_143010_b() { -+ if (MapGenStructureIO.func_143036_a(this) == null) // Friendlier error then the Null Stirng error below. ++ if (MapGenStructureIO.func_143036_a(this) == null) // Friendlier error then the Null String error below. + { + throw new RuntimeException("StructureComponent \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); + } diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch index 7bcc3c8c8e..00ba3940d1 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch @@ -1,30 +1,42 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java -@@ -16,6 +16,9 @@ +@@ -19,6 +19,8 @@ + import net.minecraft.util.EnumFacing; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; - +import net.minecraftforge.common.ChestGenHooks; +import static net.minecraftforge.common.ChestGenHooks.*; -+ + public class StructureMineshaftPieces { - public static final WeightedRandomChestContent[] field_78818_a = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.field_151042_j, 0, 1, 5, 10), new WeightedRandomChestContent(Items.field_151043_k, 0, 1, 3, 5), new WeightedRandomChestContent(Items.field_151137_ax, 0, 4, 9, 5), new WeightedRandomChestContent(Items.field_151100_aR, 4, 4, 9, 5), new WeightedRandomChestContent(Items.field_151045_i, 0, 1, 2, 3), new WeightedRandomChestContent(Items.field_151044_h, 0, 3, 8, 10), new WeightedRandomChestContent(Items.field_151025_P, 0, 1, 3, 15), new WeightedRandomChestContent(Items.field_151035_b, 0, 1, 1, 1), new WeightedRandomChestContent(Item.func_150898_a(Blocks.field_150448_aq), 0, 4, 8, 1), new WeightedRandomChestContent(Items.field_151081_bc, 0, 2, 4, 10), new WeightedRandomChestContent(Items.field_151080_bb, 0, 2, 4, 10), new WeightedRandomChestContent(Items.field_151141_av, 0, 1, 1, 3), new WeightedRandomChestContent(Items.field_151138_bX, 0, 1, 1, 1)}; -@@ -349,14 +352,15 @@ - this.func_151552_a(p_74875_1_, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k - 1, Blocks.field_150478_aa, 0); - this.func_151552_a(p_74875_1_, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k + 1, Blocks.field_150478_aa, 0); +@@ -33,6 +35,12 @@ + MapGenStructureIO.func_143031_a(StructureMineshaftPieces.Stairs.class, "MSStairs"); + } + ++ static ++ { ++ ChestGenHooks.init(MINESHAFT_CORRIDOR, field_175893_a, 8, 8); ++ ChestGenHooks.addItem(MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); ++ } ++ + private static StructureComponent func_175892_a(List p_175892_0_, Random p_175892_1_, int p_175892_2_, int p_175892_3_, int p_175892_4_, EnumFacing p_175892_5_, int p_175892_6_) + { + int i1 = p_175892_1_.nextInt(100); +@@ -354,14 +362,15 @@ + this.func_175809_a(p_74875_1_, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k - 1, Blocks.field_150478_aa.func_176203_a(EnumFacing.UP.func_176745_a())); + this.func_175809_a(p_74875_1_, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k + 1, Blocks.field_150478_aa.func_176203_a(EnumFacing.UP.func_176745_a())); + ChestGenHooks info = ChestGenHooks.getInfo(MINESHAFT_CORRIDOR); if (p_74875_2_.nextInt(100) == 0) { -- this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 2, 0, k - 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.field_78818_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); -+ this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 2, 0, k - 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 2, 0, k - 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 2, 0, k - 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); } if (p_74875_2_.nextInt(100) == 0) { -- this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 0, 0, k + 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.field_78818_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); -+ this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 0, 0, k + 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 0, 0, k + 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 0, 0, k + 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); } if (this.field_74956_b && !this.field_74957_c) diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch index b21aa36e81..ecd196fafd 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStart.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStart.java -@@ -62,6 +62,10 @@ +@@ -63,6 +63,10 @@ public NBTTagCompound func_143021_a(int p_143021_1_, int p_143021_2_) { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch index a8950b6223..a8d7f2e102 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch @@ -1,47 +1,84 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java -@@ -12,6 +12,9 @@ - import net.minecraft.world.ChunkPosition; +@@ -17,6 +17,8 @@ + import net.minecraft.util.EnumFacing; + import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; - +import net.minecraftforge.common.ChestGenHooks; +import static net.minecraftforge.common.ChestGenHooks.*; -+ + public class StructureStrongholdPieces { - private static final StructureStrongholdPieces.PieceWeight[] field_75205_b = new StructureStrongholdPieces.PieceWeight[] {new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.Straight.class, 40, 0), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.Prison.class, 5, 5), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.LeftTurn.class, 20, 0), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.RightTurn.class, 20, 0), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.RoomCrossing.class, 10, 6), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.StairsStraight.class, 5, 5), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.Stairs.class, 5, 5), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.Crossing.class, 5, 4), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.ChestCorridor.class, 5, 4), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.Library.class, 10, 2) -@@ -305,7 +308,7 @@ - if (p_74875_3_.func_78890_b(j, i, k)) - { - this.field_75002_c = true; -- this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, WeightedRandomChestContent.func_92080_a(field_75003_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(2)); -+ this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, ChestGenHooks.getItems(STRONGHOLD_CORRIDOR, p_74875_2_), ChestGenHooks.getCount(STRONGHOLD_CORRIDOR, p_74875_2_)); - } - } +@@ -248,6 +250,12 @@ -@@ -744,12 +747,14 @@ - this.func_151550_a(p_74875_1_, Blocks.field_150478_aa, 0, b1, 8, b2 + 1, p_74875_3_); - } + public ChestCorridor() {} -- this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 3, 5, WeightedRandomChestContent.func_92080_a(field_75007_b, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92112_a(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); -+ ChestGenHooks info = ChestGenHooks.getInfo(STRONGHOLD_LIBRARY); - -+ this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 3, 5, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); ++ static ++ { ++ ChestGenHooks.init(STRONGHOLD_CORRIDOR, field_75003_a, 2, 4); ++ ChestGenHooks.addItem(STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); ++ } + + public ChestCorridor(int p_i45582_1_, Random p_i45582_2_, StructureBoundingBox p_i45582_3_, EnumFacing p_i45582_4_) + { + super(p_i45582_1_); +@@ -304,7 +312,7 @@ + if (!this.field_75002_c && p_74875_3_.func_175898_b(new BlockPos(this.func_74865_a(3, 3), this.func_74862_a(2), this.func_74873_b(3, 3)))) + { + this.field_75002_c = true; +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, WeightedRandomChestContent.func_177629_a(field_75003_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(2)); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, ChestGenHooks.getItems(STRONGHOLD_CORRIDOR, p_74875_2_), ChestGenHooks.getCount(STRONGHOLD_CORRIDOR, p_74875_2_)); + } + + return true; +@@ -599,6 +607,12 @@ + private boolean field_75008_c; + private static final String __OBFID = "CL_00000491"; + ++ static ++ { ++ ChestGenHooks.init(STRONGHOLD_CORRIDOR, field_75007_b, 1, 5); ++ ChestGenHooks.addItem(STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 5, 2)); ++ } ++ + public Library() {} + + public Library(int p_i45578_1_, Random p_i45578_2_, StructureBoundingBox p_i45578_3_, EnumFacing p_i45578_4_) +@@ -742,12 +756,13 @@ + this.func_175811_a(p_74875_1_, Blocks.field_150478_aa.func_176223_P(), b1, 8, b2 + 1, p_74875_3_); + } + +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 3, 5, WeightedRandomChestContent.func_177629_a(field_75007_b, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92112_a(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); ++ ChestGenHooks info = ChestGenHooks.getInfo(STRONGHOLD_LIBRARY); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 3, 5, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); + if (this.field_75008_c) { - this.func_151550_a(p_74875_1_, Blocks.field_150350_a, 0, 12, 9, 1, p_74875_3_); -- this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 12, 8, 1, WeightedRandomChestContent.func_92080_a(field_75007_b, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92112_a(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); -+ this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 12, 8, 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); + this.func_175811_a(p_74875_1_, Blocks.field_150350_a.func_176223_P(), 12, 9, 1, p_74875_3_); +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 12, 8, 1, WeightedRandomChestContent.func_177629_a(field_75007_b, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92112_a(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 12, 8, 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); } return true; -@@ -1160,7 +1165,7 @@ - this.func_151550_a(p_74875_1_, Blocks.field_150468_ap, this.func_151555_a(Blocks.field_150468_ap, 4), 9, 1, 3, p_74875_3_); - this.func_151550_a(p_74875_1_, Blocks.field_150468_ap, this.func_151555_a(Blocks.field_150468_ap, 4), 9, 2, 3, p_74875_3_); - this.func_151550_a(p_74875_1_, Blocks.field_150468_ap, this.func_151555_a(Blocks.field_150468_ap, 4), 9, 3, 3, p_74875_3_); -- this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 4, 8, WeightedRandomChestContent.func_92080_a(field_75014_c, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 1 + p_74875_2_.nextInt(4)); -+ this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 4, 8, ChestGenHooks.getItems(STRONGHOLD_CROSSING, p_74875_2_), ChestGenHooks.getCount(STRONGHOLD_CROSSING, p_74875_2_)); +@@ -1024,6 +1039,12 @@ + protected int field_75013_b; + private static final String __OBFID = "CL_00000496"; + ++ static ++ { ++ ChestGenHooks.init(STRONGHOLD_CROSSING, field_75014_c, 1, 5); ++ ChestGenHooks.addItem(STRONGHOLD_CROSSING, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); ++ } ++ + public RoomCrossing() {} + + public RoomCrossing(int p_i45575_1_, Random p_i45575_2_, StructureBoundingBox p_i45575_3_, EnumFacing p_i45575_4_) +@@ -1159,7 +1180,7 @@ + this.func_175811_a(p_74875_1_, Blocks.field_150468_ap.func_176203_a(this.func_151555_a(Blocks.field_150468_ap, EnumFacing.WEST.func_176745_a())), 9, 1, 3, p_74875_3_); + this.func_175811_a(p_74875_1_, Blocks.field_150468_ap.func_176203_a(this.func_151555_a(Blocks.field_150468_ap, EnumFacing.WEST.func_176745_a())), 9, 2, 3, p_74875_3_); + this.func_175811_a(p_74875_1_, Blocks.field_150468_ap.func_176203_a(this.func_151555_a(Blocks.field_150468_ap, EnumFacing.WEST.func_176745_a())), 9, 3, 3, p_74875_3_); +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 4, 8, WeightedRandomChestContent.func_177629_a(field_75014_c, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 1 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 4, 8, ChestGenHooks.getItems(STRONGHOLD_CROSSING, p_74875_2_), ChestGenHooks.getCount(STRONGHOLD_CROSSING, p_74875_2_)); } return true; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch index 69179e6bf2..3015b35b62 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch @@ -1,18 +1,10 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java -@@ -4,7 +4,7 @@ - import java.util.Iterator; - import java.util.List; - import java.util.Random; -- -+import cpw.mods.fml.common.eventhandler.Event.Result; - import cpw.mods.fml.common.registry.VillagerRegistry; - import net.minecraft.block.Block; - import net.minecraft.block.material.Material; -@@ -18,6 +18,10 @@ +@@ -25,6 +25,11 @@ import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManager; ++import net.minecraftforge.fml.common.eventhandler.Event.Result; +import net.minecraftforge.common.ChestGenHooks; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.terraingen.BiomeEvent; @@ -20,32 +12,44 @@ public class StructureVillagePieces { -@@ -927,7 +931,7 @@ - if (p_74875_3_.func_78890_b(j, i, k)) - { - this.field_74917_c = true; -- this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 5, 1, 5, field_74918_a, 3 + p_74875_2_.nextInt(6)); -+ this.func_74879_a(p_74875_1_, p_74875_3_, p_74875_2_, 5, 1, 5, ChestGenHooks.getItems(VILLAGE_BLACKSMITH, p_74875_2_), ChestGenHooks.getCount(VILLAGE_BLACKSMITH, p_74875_2_)); - } +@@ -848,6 +853,11 @@ + + public House2() {} + ++ static ++ { ++ ChestGenHooks.init(VILLAGE_BLACKSMITH, field_74918_a, 3, 8); ++ } ++ + public House2(StructureVillagePieces.Start p_i45563_1_, int p_i45563_2_, Random p_i45563_3_, StructureBoundingBox p_i45563_4_, EnumFacing p_i45563_5_) + { + super(p_i45563_1_, p_i45563_2_); +@@ -926,7 +936,7 @@ + if (!this.field_74917_c && p_74875_3_.func_175898_b(new BlockPos(this.func_74865_a(5, 5), this.func_74862_a(1), this.func_74873_b(5, 5)))) + { + this.field_74917_c = true; +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 5, 1, 5, field_74918_a, 3 + p_74875_2_.nextInt(6)); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 5, 1, 5, ChestGenHooks.getItems(VILLAGE_BLACKSMITH, p_74875_2_), ChestGenHooks.getCount(VILLAGE_BLACKSMITH, p_74875_2_)); } -@@ -1424,6 +1428,7 @@ - public List field_74932_i = new ArrayList(); - public List field_74930_j = new ArrayList(); + int i; +@@ -1428,6 +1438,7 @@ + public List field_74932_i = Lists.newArrayList(); + public List field_74930_j = Lists.newArrayList(); private static final String __OBFID = "CL_00000527"; + public BiomeGenBase biome; public Start() {} -@@ -1435,6 +1440,7 @@ +@@ -1439,6 +1450,7 @@ this.field_74928_c = p_i2104_7_; - BiomeGenBase biomegenbase = p_i2104_1_.func_76935_a(p_i2104_4_, p_i2104_5_); + BiomeGenBase biomegenbase = p_i2104_1_.func_180300_a(new BlockPos(p_i2104_4_, 0, p_i2104_5_), BiomeGenBase.field_180279_ad); this.field_74927_b = biomegenbase == BiomeGenBase.field_76769_d || biomegenbase == BiomeGenBase.field_76786_s; + this.biome = biomegenbase; + this.func_175846_a(this.field_74927_b); } - public WorldChunkManager func_74925_d() -@@ -1495,6 +1501,7 @@ +@@ -1546,6 +1558,7 @@ private int field_74896_a; private boolean field_143014_b; private static final String __OBFID = "CL_00000531"; @@ -53,7 +57,7 @@ public Village() {} -@@ -1505,6 +1512,7 @@ +@@ -1556,6 +1569,7 @@ if (p_i2107_1_ != null) { this.field_143014_b = p_i2107_1_.field_74927_b; @@ -61,23 +65,13 @@ } } -@@ -1618,6 +1626,9 @@ +@@ -1679,6 +1693,9 @@ - protected Block func_151558_b(Block p_151558_1_, int p_151558_2_) + protected IBlockState func_175847_a(IBlockState p_175847_1_) { -+ BiomeEvent.GetVillageBlockID event = new BiomeEvent.GetVillageBlockID(startPiece == null ? null : startPiece.biome, p_151558_1_, p_151558_2_); ++ BiomeEvent.GetVillageBlockID event = new BiomeEvent.GetVillageBlockID(startPiece == null ? null : startPiece.biome, p_175847_1_); + MinecraftForge.TERRAIN_GEN_BUS.post(event); + if (event.getResult() == Result.DENY) return event.replacement; if (this.field_143014_b) { - if (p_151558_1_ == Blocks.field_150364_r || p_151558_1_ == Blocks.field_150363_s) -@@ -1656,6 +1667,9 @@ - - protected int func_151557_c(Block p_151557_1_, int p_151557_2_) - { -+ BiomeEvent.GetVillageBlockMeta event = new BiomeEvent.GetVillageBlockMeta(startPiece == null ? null : startPiece.biome, p_151557_1_, p_151557_2_); -+ MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ if (event.getResult() == Result.DENY) return event.replacement; - if (this.field_143014_b) - { - if (p_151557_1_ == Blocks.field_150364_r || p_151557_1_ == Blocks.field_150363_s) + if (p_175847_1_.func_177230_c() == Blocks.field_150364_r || p_175847_1_.func_177230_c() == Blocks.field_150363_s) diff --git a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch index 99d11668d7..5b5711080b 100644 --- a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/storage/MapData.java +++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java -@@ -156,7 +156,7 @@ +@@ -176,7 +176,7 @@ p_82567_8_ += p_82567_8_ < 0.0D ? -8.0D : 8.0D; b2 = (byte)((int)(p_82567_8_ * 16.0D / 360.0D)); diff --git a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch index a265ec02f7..b4ccff587c 100644 --- a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java +++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java -@@ -254,6 +254,7 @@ +@@ -251,6 +251,7 @@ } file1.renameTo(file2); @@ -8,7 +8,7 @@ } catch (Exception exception) { -@@ -284,6 +285,7 @@ +@@ -281,6 +282,7 @@ p_75752_1_.func_70020_e(nbttagcompound); } diff --git a/src/main/java/net/minecraftforge/classloading/FMLForgePlugin.java b/src/main/java/net/minecraftforge/classloading/FMLForgePlugin.java index 35e0cdf689..2a66eb4356 100644 --- a/src/main/java/net/minecraftforge/classloading/FMLForgePlugin.java +++ b/src/main/java/net/minecraftforge/classloading/FMLForgePlugin.java @@ -3,7 +3,7 @@ package net.minecraftforge.classloading; import java.io.File; import java.util.Map; -import cpw.mods.fml.relauncher.IFMLLoadingPlugin; +import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; public class FMLForgePlugin implements IFMLLoadingPlugin { diff --git a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java index 08bd913056..f808ebc1c7 100644 --- a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java +++ b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java @@ -12,17 +12,17 @@ import net.minecraft.command.WrongUsageException; import net.minecraft.util.ChatComponentTranslation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.CommandEvent; -import cpw.mods.fml.client.FMLClientHandler; +import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraft.util.EnumChatFormatting; import static net.minecraft.util.EnumChatFormatting.*; /** * The class that handles client-side chat commands. You should register any * commands that you want handled on the client with this command handler. - * + * * If there is a command with the same name registered both on the server and * client, the client takes precedence! - * + * */ public class ClientCommandHandler extends CommandHandler { @@ -114,7 +114,7 @@ public class ClientCommandHandler extends CommandHandler if (mc.currentScreen instanceof GuiChat) { @SuppressWarnings("unchecked") - List commands = getPossibleCommands(mc.thePlayer, leftOfCursor); + List commands = getTabCompletionOptions(mc.thePlayer, leftOfCursor, mc.thePlayer.getPosition()); if (commands != null && !commands.isEmpty()) { if (leftOfCursor.indexOf(' ') == -1) diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 48185202ce..93731d325f 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -1,70 +1,69 @@ package net.minecraftforge.client; +import static net.minecraftforge.common.ForgeVersion.Status.BETA; +import static net.minecraftforge.common.ForgeVersion.Status.BETA_OUTDATED; import java.util.Random; - import javax.imageio.ImageIO; - -import net.minecraftforge.client.event.MouseEvent; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBed; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; import net.minecraft.client.audio.ISound; import net.minecraft.client.audio.SoundEventAccessorComposite; import net.minecraft.client.audio.SoundManager; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiMainMenu; -import net.minecraftforge.client.event.FOVUpdateEvent; - -import org.lwjgl.LWJGLException; -import org.lwjgl.opengl.Display; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; -import org.lwjgl.opengl.PixelFormat; - -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.client.registry.RenderingRegistry; -import cpw.mods.fml.common.FMLLog; -import net.minecraft.client.Minecraft; -import net.minecraft.block.Block; -import net.minecraft.block.BlockLiquid; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.ChunkCache; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.resources.I18n; import net.minecraft.client.settings.GameSettings; -import net.minecraftforge.client.IItemRenderer.ItemRenderType; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.client.event.DrawBlockHighlightEvent; +import net.minecraftforge.client.event.EntityViewRenderEvent; +import net.minecraftforge.client.event.FOVUpdateEvent; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.client.event.MouseEvent; import net.minecraftforge.client.event.RenderHandEvent; -import net.minecraftforge.client.event.RenderWorldEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.client.event.TextureStitchEvent; -import net.minecraftforge.client.event.sound.PlaySoundEvent17; +import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.common.ForgeModContainer; import net.minecraftforge.common.ForgeVersion; import net.minecraftforge.common.ForgeVersion.Status; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.RenderBlockFluid; -import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*; -import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*; -import static net.minecraftforge.common.ForgeVersion.Status.*; +import net.minecraftforge.fml.client.FMLClientHandler; +import net.minecraftforge.fml.client.registry.RenderingRegistry; +import net.minecraftforge.fml.common.FMLLog; +import org.lwjgl.LWJGLException; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.PixelFormat; +//import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*; +//import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*; public class ForgeHooksClient { @@ -81,6 +80,8 @@ public class ForgeHooksClient return result != null ? result : _default; } + /* + * Removed, Modders let me know if this is needed anymore. public static boolean renderEntityItem(EntityItem entity, ItemStack item, float bobing, float rotation, Random random, TextureManager engine, RenderBlocks renderBlocks, int count) { IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY); @@ -147,9 +148,12 @@ public class ForgeHooksClient GL11.glScalef(0.5F, 0.5F, 0.5F); customRenderer.renderItem(ENTITY, item, renderBlocks, entity); } + return true; } + */ + /* public static boolean renderInventoryItem(RenderBlocks renderBlocks, TextureManager engine, ItemStack item, boolean inColor, float zLevel, float x, float y) { IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, INVENTORY); @@ -233,21 +237,18 @@ public class ForgeHooksClient GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } - } + }*/ //Optifine Helper Functions u.u, these are here specifically for Optifine //Note: When using Optfine, these methods are invoked using reflection, which //incurs a major performance penalty. - public static void orientBedCamera(Minecraft mc, EntityLivingBase entity) + public static void orientBedCamera(IBlockAccess world, BlockPos pos, IBlockState state, Entity entity) { - int x = MathHelper.floor_double(entity.posX); - int y = MathHelper.floor_double(entity.posY); - int z = MathHelper.floor_double(entity.posZ); - Block block = mc.theWorld.getBlock(x, y, z); + Block block = state.getBlock(); - if (block != null && block.isBed(mc.theWorld, x, y, z, entity)) + if (block != null && block.isBed(world, pos, entity)) { - GL11.glRotatef((float)(block.getBedDirection(mc.theWorld, x, y, z) * 90), 0.0F, 1.0F, 0.0F); + GL11.glRotatef((float)(block.getBedDirection(world, pos).getHorizontalIndex() * 90), 0.0F, 1.0F, 0.0F); } } @@ -275,31 +276,8 @@ public class ForgeHooksClient { MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map)); - FluidRegistry.WATER.setIcons(BlockLiquid.getLiquidIcon("water_still"), BlockLiquid.getLiquidIcon("water_flow")); - FluidRegistry.LAVA.setIcons(BlockLiquid.getLiquidIcon("lava_still"), BlockLiquid.getLiquidIcon("lava_flow")); - } - - /** - * This is added for Optifine's convenience. And to explode if a ModMaker is developing. - * @param texture - */ - public static void onTextureLoadPre(String texture) - { - if (Tessellator.renderingWorldRenderer) - { - FMLLog.warning("Warning: Texture %s not preloaded, will cause render glitches!", texture); - if (Tessellator.class.getPackage() != null) - { - if (Tessellator.class.getPackage().getName().startsWith("net.minecraft.")) - { - Minecraft mc = FMLClientHandler.instance().getClient(); - if (mc.ingameGUI != null) - { - mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("forge.texture.preload.warning", texture)); - } - } - } - } + //FluidRegistry.WATER.setIcons(BlockLiquid.getLiquidIcon("water_still"), BlockLiquid.getLiquidIcon("water_flow")); + //FluidRegistry.LAVA.setIcons(BlockLiquid.getLiquidIcon("lava_still"), BlockLiquid.getLiquidIcon("lava_flow")); } static int renderPass = -1; @@ -308,37 +286,10 @@ public class ForgeHooksClient renderPass = pass; } - public static ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int slotID, ModelBiped _default) + public static ModelBase getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int slotID, ModelBase _default) { - ModelBiped modelbiped = itemStack.getItem().getArmorModel(entityLiving, itemStack, slotID); - return modelbiped == null ? _default : modelbiped; - } - - static int stencilBits = 0; - public static void createDisplay() throws LWJGLException - { - ImageIO.setUseCache(false); //Disable on-disc stream cache should speed up texture pack reloading. - PixelFormat format = new PixelFormat().withDepthBits(24); - if (!Boolean.parseBoolean(System.getProperty("forge.forceDisplayStencil", "false"))) - { - //Creating the display with Stencil bits causes issues on some displays. - //According to ChickenBones, Mumfrey and Pig The only real use is in the FBO. - //So lets default to normal init to fix the issues yet add the bits to the FBO. - Display.create(format); - stencilBits = 0; - return; - } - try - { - //TODO: Figure out how to determine the max bits. - Display.create(format.withStencilBits(8)); - stencilBits = 8; - } - catch(LWJGLException e) - { - Display.create(format); - stencilBits = 0; - } + ModelBase modelbase = itemStack.getItem().getArmorModel(entityLiving, itemStack, slotID); + return modelbase == null ? _default : modelbase; } //This properly moves the domain, if provided, to the front of the string before concatenating @@ -367,7 +318,7 @@ public class ForgeHooksClient return MinecraftForge.EVENT_BUS.post(new MouseEvent()); } - public static float getOffsetFOV(EntityPlayerSP entity, float fov) + public static float getOffsetFOV(EntityPlayer entity, float fov) { FOVUpdateEvent fovUpdateEvent = new FOVUpdateEvent(entity, fov); MinecraftForge.EVENT_BUS.post(fovUpdateEvent); @@ -379,9 +330,9 @@ public class ForgeHooksClient private static boolean skyInit; private static int skyRGBMultiplier; - public static int getSkyBlendColour(World world, int playerX, int playerY, int playerZ) + public static int getSkyBlendColour(World world, BlockPos center) { - if (playerX == skyX && playerZ == skyZ && skyInit) + if (center.getX() == skyX && center.getZ() == skyZ && skyInit) { return skyRGBMultiplier; } @@ -404,8 +355,9 @@ public class ForgeHooksClient { for (int z = -distance; z <= distance; ++z) { - BiomeGenBase biome = world.getBiomeGenForCoords(playerX + x, playerZ + z); - int colour = biome.getSkyColorByTemp(biome.getFloatTemperature(playerX + x, playerY, playerZ + z)); + BlockPos pos = center.add(x, 0, z); + BiomeGenBase biome = world.getBiomeGenForCoords(pos); + int colour = biome.getSkyColorByTemp(biome.func_180626_a(pos)); r += (colour & 0xFF0000) >> 16; g += (colour & 0x00FF00) >> 8; b += colour & 0x0000FF; @@ -415,8 +367,8 @@ public class ForgeHooksClient int multiplier = (r / divider & 255) << 16 | (g / divider & 255) << 8 | b / divider & 255; - skyX = playerX; - skyZ = playerZ; + skyX = center.getX(); + skyZ = center.getY(); skyRGBMultiplier = multiplier; return skyRGBMultiplier; } @@ -425,8 +377,8 @@ public class ForgeHooksClient */ static { - FluidRegistry.renderIdFluid = RenderingRegistry.getNextAvailableRenderId(); - RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance); + //FluidRegistry.renderIdFluid = RenderingRegistry.getNextAvailableRenderId(); + //RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance); } public static void renderMainMenu(GuiMainMenu gui, FontRenderer font, int width, int height) @@ -461,13 +413,13 @@ public class ForgeHooksClient public static ISound playSound(SoundManager manager, ISound sound) { - SoundEventAccessorComposite accessor = manager.sndHandler.getSound(sound.getPositionedSoundLocation()); - PlaySoundEvent17 e = new PlaySoundEvent17(manager, sound, (accessor == null ? null : accessor.getSoundCategory())); + SoundEventAccessorComposite accessor = manager.sndHandler.getSound(sound.getSoundLocation()); + PlaySoundEvent e = new PlaySoundEvent(manager, sound, (accessor == null ? null : accessor.getSoundCategory())); MinecraftForge.EVENT_BUS.post(e); return e.result; } - static RenderBlocks worldRendererRB; + //static RenderBlocks worldRendererRB; static int worldRenderPass; public static int getWorldRenderPass() @@ -475,6 +427,26 @@ public class ForgeHooksClient return worldRenderPass; } + public static void drawScreen(GuiScreen screen, int mouseX, int mouseY, float partialTicks) + { + if (!MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Pre(screen, mouseX, mouseY, partialTicks))) + screen.drawScreen(mouseX, mouseY, partialTicks); + MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Post(screen, mouseX, mouseY, partialTicks)); + } + + public static float getFogDensity(EntityRenderer renderer, Entity entity, Block block, float partial, float density) + { + EntityViewRenderEvent.FogDensity event = new EntityViewRenderEvent.FogDensity(renderer, entity, block, partial, density); + if (MinecraftForge.EVENT_BUS.post(event)) return event.density; + return -1; + } + + public static void onFogRender(EntityRenderer renderer, Entity entity, Block block, float partial, int mode, float distance) + { + MinecraftForge.EVENT_BUS.post(new EntityViewRenderEvent.RenderFogEvent(renderer, entity, block, partial, mode, distance)); + } + + /* public static void setWorldRendererRB(RenderBlocks renderBlocks) { worldRendererRB = renderBlocks; @@ -497,4 +469,5 @@ public class ForgeHooksClient worldRenderPass = -1; } } + */ } diff --git a/src/main/java/net/minecraftforge/client/GuiIngameForge.java b/src/main/java/net/minecraftforge/client/GuiIngameForge.java index c95845e7fa..03735233e8 100644 --- a/src/main/java/net/minecraftforge/client/GuiIngameForge.java +++ b/src/main/java/net/minecraftforge/client/GuiIngameForge.java @@ -11,9 +11,10 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiIngame; -import net.minecraft.client.gui.GuiPlayerInfo; +import net.minecraft.client.gui.GuiOverlayDebug; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.resources.I18n; @@ -21,6 +22,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; @@ -29,7 +31,7 @@ import net.minecraft.potion.Potion; import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.Direction; +import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.FoodStats; import net.minecraft.util.MathHelper; @@ -45,7 +47,9 @@ import net.minecraftforge.common.MinecraftForge; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -import cpw.mods.fml.common.FMLCommonHandler; +import com.google.common.base.Strings; + +import net.minecraftforge.fml.common.FMLCommonHandler; public class GuiIngameForge extends GuiIngame { @@ -79,17 +83,19 @@ public class GuiIngameForge extends GuiIngame private FontRenderer fontrenderer = null; private RenderGameOverlayEvent eventParent; private static final String MC_VERSION = MinecraftForge.MC_VERSION; + private GuiOverlayDebugForge debugOverlay; public GuiIngameForge(Minecraft mc) { super(mc); + debugOverlay = new GuiOverlayDebugForge(mc); } @Override - public void renderGameOverlay(float partialTicks, boolean hasScreen, int mouseX, int mouseY) + public void func_175180_a(float partialTicks) { res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); - eventParent = new RenderGameOverlayEvent(partialTicks, res, mouseX, mouseY); + eventParent = new RenderGameOverlayEvent(partialTicks, res); int width = res.getScaledWidth(); int height = res.getScaledHeight(); renderHealthMount = mc.thePlayer.ridingEntity instanceof EntityLivingBase; @@ -101,45 +107,44 @@ public class GuiIngameForge extends GuiIngame if (pre(ALL)) return; - fontrenderer = mc.fontRenderer; + fontrenderer = mc.fontRendererObj; mc.entityRenderer.setupOverlayRendering(); - GL11.glEnable(GL11.GL_BLEND); + GlStateManager.enableBlend(); if (Minecraft.isFancyGraphicsEnabled()) { - renderVignette(mc.thePlayer.getBrightness(partialTicks), width, height); + func_180480_a(mc.thePlayer.getBrightness(partialTicks), res); } else { - OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); } - if (renderHelmet) renderHelmet(res, partialTicks, hasScreen, mouseX, mouseY); + if (renderHelmet) renderHelmet(res, partialTicks); if (renderPortal && !mc.thePlayer.isPotionActive(Potion.confusion)) { - renderPortal(width, height, partialTicks); + renderPortal(res, partialTicks); } - if (!mc.playerController.enableEverythingIsScrewedUpMode()) + if (renderHotbar) func_180479_a(res, partialTicks); + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + zLevel = -90.0F; + rand.setSeed((long)(updateCounter * 312871)); + + if (renderCrosshairs) renderCrosshairs(width, height); + if (renderBossHealth) renderBossHealth(); + + if (this.mc.playerController.shouldDrawHUD() && this.mc.func_175606_aa() instanceof EntityPlayer) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - zLevel = -90.0F; - rand.setSeed((long)(updateCounter * 312871)); - - if (renderCrosshairs) renderCrosshairs(width, height); - if (renderBossHealth) renderBossHealth(); - - if (this.mc.playerController.shouldDrawHUD()) - { - if (renderHealth) renderHealth(width, height); - if (renderArmor) renderArmor(width, height); - if (renderFood) renderFood(width, height); - if (renderHealthMount) renderHealthMount(width, height); - if (renderAir) renderAir(width, height); - } - if (renderHotbar) renderHotbar(width, height, partialTicks); + if (renderHealth) renderHealth(width, height); + if (renderArmor) renderArmor(width, height); + if (renderFood) renderFood(width, height); + if (renderHealthMount) renderHealthMount(width, height); + if (renderAir) renderAir(width, height); } + renderSleepFade(width, height); if (renderJumpBar) { @@ -150,28 +155,37 @@ public class GuiIngameForge extends GuiIngame renderExperience(width, height); } - renderSleepFade(width, height); - renderToolHightlight(width, height); + renderToolHightlight(res); renderHUDText(width, height); renderRecordOverlay(width, height, partialTicks); + renderTitle(width, height, partialTicks); - ScoreObjective objective = mc.theWorld.getScoreboard().func_96539_a(1); + + Scoreboard scoreboard = this.mc.theWorld.getScoreboard(); + ScoreObjective objective = null; + ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(mc.thePlayer.getName()); + if (scoreplayerteam != null) + { + int slot = scoreplayerteam.func_178775_l().func_175746_b(); + if (slot >= 0) objective = scoreboard.getObjectiveInDisplaySlot(3 + slot); + } + ScoreObjective scoreobjective1 = objective != null ? objective : scoreboard.getObjectiveInDisplaySlot(1); if (renderObjective && objective != null) { - this.func_96136_a(objective, height, width, fontrenderer); + this.func_180475_a(objective, res); } - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - GL11.glDisable(GL11.GL_ALPHA_TEST); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GlStateManager.disableAlpha(); renderChat(width, height); renderPlayerList(width, height); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_ALPHA_TEST); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableLighting(); + GlStateManager.enableAlpha(); post(ALL); } @@ -181,46 +195,19 @@ public class GuiIngameForge extends GuiIngame return res; } - protected void renderHotbar(int width, int height, float partialTicks) - { - if (pre(HOTBAR)) return; - mc.mcProfiler.startSection("actionBar"); - - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(WIDGITS); - - InventoryPlayer inv = mc.thePlayer.inventory; - drawTexturedModalRect(width / 2 - 91, height - 22, 0, 0, 182, 22); - drawTexturedModalRect(width / 2 - 91 - 1 + inv.currentItem * 20, height - 22 - 1, 0, 22, 24, 22); - - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - RenderHelper.enableGUIStandardItemLighting(); - - for (int i = 0; i < 9; ++i) - { - int x = width / 2 - 90 + i * 20 + 2; - int z = height - 16 - 3; - renderInventorySlot(i, x, z, partialTicks); - } - - RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - mc.mcProfiler.endSection(); - post(HOTBAR); - } - protected void renderCrosshairs(int width, int height) { if (pre(CROSSHAIRS)) return; - bind(Gui.icons); - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR, 1, 0); - drawTexturedModalRect(width / 2 - 7, height / 2 - 7, 0, 0, 16, 16); - OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - GL11.glDisable(GL11.GL_BLEND); + if (this.func_175183_b()) + { + bind(Gui.icons); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR, 1, 0); + GlStateManager.enableAlpha(); + drawTexturedModalRect(width / 2 - 7, height / 2 - 7, 0, 0, 16, 16); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GL11.glDisable(GL11.GL_BLEND); + } post(CROSSHAIRS); } @@ -228,15 +215,16 @@ public class GuiIngameForge extends GuiIngame protected void renderBossHealth() { if (pre(BOSSHEALTH)) return; + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); mc.mcProfiler.startSection("bossHealth"); - GL11.glEnable(GL11.GL_BLEND); + GlStateManager.enableBlend(); super.renderBossHealth(); - GL11.glDisable(GL11.GL_BLEND); + GlStateManager.disableBlend(); mc.mcProfiler.endSection(); post(BOSSHEALTH); } - private void renderHelmet(ScaledResolution res, float partialTicks, boolean hasScreen, int mouseX, int mouseY) + private void renderHelmet(ScaledResolution res, float partialTicks) { if (pre(HELMET)) return; @@ -246,11 +234,11 @@ public class GuiIngameForge extends GuiIngame { if (itemstack.getItem() == Item.getItemFromBlock(Blocks.pumpkin)) { - renderPumpkinBlur(res.getScaledWidth(), res.getScaledHeight()); + func_180476_e(res); } else { - itemstack.getItem().renderHelmetOverlay(itemstack, mc.thePlayer, res, partialTicks, hasScreen, mouseX, mouseY); + itemstack.getItem().renderHelmetOverlay(itemstack, mc.thePlayer, res, partialTicks); } } @@ -262,7 +250,7 @@ public class GuiIngameForge extends GuiIngame if (pre(ARMOR)) return; mc.mcProfiler.startSection("armor"); - GL11.glEnable(GL11.GL_BLEND); + GlStateManager.enableBlend(); int left = width / 2 - 91; int top = height - left_height; @@ -285,12 +273,12 @@ public class GuiIngameForge extends GuiIngame } left_height += 10; - GL11.glDisable(GL11.GL_BLEND); + GlStateManager.disableBlend(); mc.mcProfiler.endSection(); post(ARMOR); } - protected void renderPortal(int width, int height, float partialTicks) + protected void renderPortal(ScaledResolution res, float partialTicks) { if (pre(PORTAL)) return; @@ -298,23 +286,40 @@ public class GuiIngameForge extends GuiIngame if (f1 > 0.0F) { - func_130015_b(f1, width, height); + func_180474_b(f1, res); } post(PORTAL); } + protected void func_180479_a(ScaledResolution res, float partialTicks) + { + if (pre(HOTBAR)) return; + + if (mc.playerController.enableEverythingIsScrewedUpMode()) + { + this.field_175197_u.func_175264_a(res, partialTicks); + } + else + { + super.func_180479_a(res, partialTicks); + } + + post(HOTBAR); + } + protected void renderAir(int width, int height) { if (pre(AIR)) return; mc.mcProfiler.startSection("air"); - GL11.glEnable(GL11.GL_BLEND); + EntityPlayer player = (EntityPlayer)this.mc.func_175606_aa(); + GlStateManager.enableBlend(); int left = width / 2 + 91; int top = height - right_height; - if (mc.thePlayer.isInsideOfMaterial(Material.water)) + if (player.isInsideOfMaterial(Material.water)) { - int air = mc.thePlayer.getAir(); + int air = player.getAir(); int full = MathHelper.ceiling_double_int((double)(air - 2) * 10.0D / 300.0D); int partial = MathHelper.ceiling_double_int((double)air * 10.0D / 300.0D) - full; @@ -325,7 +330,7 @@ public class GuiIngameForge extends GuiIngame right_height += 10; } - GL11.glDisable(GL11.GL_BLEND); + GlStateManager.disableBlend(); mc.mcProfiler.endSection(); post(AIR); } @@ -335,20 +340,36 @@ public class GuiIngameForge extends GuiIngame bind(icons); if (pre(HEALTH)) return; mc.mcProfiler.startSection("health"); - GL11.glEnable(GL11.GL_BLEND); + GlStateManager.enableBlend(); - boolean highlight = mc.thePlayer.hurtResistantTime / 3 % 2 == 1; + EntityPlayer player = (EntityPlayer)this.mc.func_175606_aa(); + int health = MathHelper.ceiling_float_int(player.getHealth()); + boolean highlight = field_175191_F > (long)updateCounter && (field_175191_F - (long)updateCounter) / 3L %2L == 1L; - if (mc.thePlayer.hurtResistantTime < 10) + if (health < this.field_175194_C && player.hurtResistantTime > 0) { - highlight = false; + this.field_175190_E = Minecraft.getSystemTime(); + this.field_175191_F = (long)(this.updateCounter + 20); + } + else if (health > this.field_175194_C && player.hurtResistantTime > 0) + { + this.field_175190_E = Minecraft.getSystemTime(); + this.field_175191_F = (long)(this.updateCounter + 10); } - IAttributeInstance attrMaxHealth = this.mc.thePlayer.getEntityAttribute(SharedMonsterAttributes.maxHealth); - int health = MathHelper.ceiling_float_int(mc.thePlayer.getHealth()); - int healthLast = MathHelper.ceiling_float_int(mc.thePlayer.prevHealth); + if (Minecraft.getSystemTime() - this.field_175190_E > 1000L) + { + this.field_175194_C = health; + this.field_175189_D = health; + this.field_175190_E = Minecraft.getSystemTime(); + } + + this.field_175194_C = health; + int healthLast = this.field_175189_D; + + IAttributeInstance attrMaxHealth = player.getEntityAttribute(SharedMonsterAttributes.maxHealth); float healthMax = (float)attrMaxHealth.getAttributeValue(); - float absorb = this.mc.thePlayer.getAbsorptionAmount(); + float absorb = player.getAbsorptionAmount(); int healthRows = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F / 10.0F); int rowHeight = Math.max(10 - (healthRows - 2), 3); @@ -361,7 +382,7 @@ public class GuiIngameForge extends GuiIngame if (rowHeight != 10) left_height += 10 - rowHeight; int regen = -1; - if (mc.thePlayer.isPotionActive(Potion.regeneration)) + if (player.isPotionActive(Potion.regeneration)) { regen = updateCounter % 25; } @@ -369,8 +390,8 @@ public class GuiIngameForge extends GuiIngame final int TOP = 9 * (mc.theWorld.getWorldInfo().isHardcoreModeEnabled() ? 5 : 0); final int BACKGROUND = (highlight ? 25 : 16); int MARGIN = 16; - if (mc.thePlayer.isPotionActive(Potion.poison)) MARGIN += 36; - else if (mc.thePlayer.isPotionActive(Potion.wither)) MARGIN += 72; + if (player.isPotionActive(Potion.poison)) MARGIN += 36; + else if (player.isPotionActive(Potion.wither)) MARGIN += 72; float absorbRemaining = absorb; for (int i = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F) - 1; i >= 0; --i) @@ -410,7 +431,7 @@ public class GuiIngameForge extends GuiIngame } } - GL11.glDisable(GL11.GL_BLEND); + GlStateManager.disableBlend(); mc.mcProfiler.endSection(); post(HEALTH); } @@ -420,7 +441,8 @@ public class GuiIngameForge extends GuiIngame if (pre(FOOD)) return; mc.mcProfiler.startSection("food"); - GL11.glEnable(GL11.GL_BLEND); + EntityPlayer player = (EntityPlayer)this.mc.func_175606_aa(); + GlStateManager.enableBlend(); int left = width / 2 + 91; int top = height - right_height; right_height += 10; @@ -445,7 +467,7 @@ public class GuiIngameForge extends GuiIngame } if (unused) backgound = 1; //Probably should be a += 1 but vanilla never uses this - if (mc.thePlayer.getFoodStats().getSaturationLevel() <= 0.0F && updateCounter % (level * 3 + 1) == 0) + if (player.getFoodStats().getSaturationLevel() <= 0.0F && updateCounter % (level * 3 + 1) == 0) { y = top + (rand.nextInt(3) - 1); } @@ -465,7 +487,7 @@ public class GuiIngameForge extends GuiIngame else if (idx == level) drawTexturedModalRect(x, y, icon + 45, 27, 9, 9); } - GL11.glDisable(GL11.GL_BLEND); + GlStateManager.disableBlend(); mc.mcProfiler.endSection(); post(FOOD); } @@ -475,8 +497,8 @@ public class GuiIngameForge extends GuiIngame if (mc.thePlayer.getSleepTimer() > 0) { mc.mcProfiler.startSection("sleep"); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDisable(GL11.GL_ALPHA_TEST); + GlStateManager.disableDepth(); + GlStateManager.disableAlpha(); int sleepTime = mc.thePlayer.getSleepTimer(); float opacity = (float)sleepTime / 100.0F; @@ -487,8 +509,8 @@ public class GuiIngameForge extends GuiIngame int color = (int)(220.0F * opacity) << 24 | 1052704; drawRect(0, 0, width, height, color); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_DEPTH_TEST); + GlStateManager.enableAlpha(); + GlStateManager.enableDepth(); mc.mcProfiler.endSection(); } } @@ -497,8 +519,8 @@ public class GuiIngameForge extends GuiIngame { bind(icons); if (pre(EXPERIENCE)) return; - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glDisable(GL11.GL_BLEND); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableBlend(); if (mc.playerController.gameIsSurvivalOrAdventure()) { @@ -538,8 +560,8 @@ public class GuiIngameForge extends GuiIngame mc.mcProfiler.endSection(); } } - GL11.glEnable(GL11.GL_BLEND); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableBlend(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); post(EXPERIENCE); } @@ -549,7 +571,7 @@ public class GuiIngameForge extends GuiIngame bind(icons); if (pre(JUMPBAR)) return; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glDisable(GL11.GL_BLEND); + GlStateManager.disableBlend(); mc.mcProfiler.startSection("jumpBar"); float charge = mc.thePlayer.getHorseJumpPower(); @@ -565,152 +587,108 @@ public class GuiIngameForge extends GuiIngame this.drawTexturedModalRect(x, top, 0, 89, filled, 5); } - GL11.glEnable(GL11.GL_BLEND); + GlStateManager.enableBlend(); mc.mcProfiler.endSection(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); post(JUMPBAR); } - protected void renderToolHightlight(int width, int height) + protected void renderToolHightlight(ScaledResolution res) { - if (this.mc.gameSettings.heldItemTooltips) + if (this.mc.gameSettings.heldItemTooltips && !this.mc.playerController.enableEverythingIsScrewedUpMode()) { mc.mcProfiler.startSection("toolHighlight"); if (this.remainingHighlightTicks > 0 && this.highlightingItemStack != null) { String name = this.highlightingItemStack.getDisplayName(); + if (this.highlightingItemStack.hasDisplayName()) + name = EnumChatFormatting.ITALIC + name; int opacity = (int)((float)this.remainingHighlightTicks * 256.0F / 10.0F); if (opacity > 255) opacity = 255; if (opacity > 0) { - int y = height - 59; + int y = res.getScaledHeight() - 59; if (!mc.playerController.shouldDrawHUD()) y += 14; - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GlStateManager.pushMatrix(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); FontRenderer font = highlightingItemStack.getItem().getFontRenderer(highlightingItemStack); if (font != null) { - int x = (width - font.getStringWidth(name)) / 2; - font.drawStringWithShadow(name, x, y, WHITE | (opacity << 24)); + int x = (res.getScaledWidth() - font.getStringWidth(name)) / 2; + font.func_175063_a(name, x, y, WHITE | (opacity << 24)); } else { - int x = (width - fontrenderer.getStringWidth(name)) / 2; - fontrenderer.drawStringWithShadow(name, x, y, WHITE | (opacity << 24)); + int x = (res.getScaledWidth() - fontrenderer.getStringWidth(name)) / 2; + fontrenderer.func_175063_a(name, x, y, WHITE | (opacity << 24)); } - GL11.glDisable(GL11.GL_BLEND); - GL11.glPopMatrix(); + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); } } mc.mcProfiler.endSection(); } + else if (this.mc.thePlayer.func_175149_v()) + { + this.field_175197_u.func_175263_a(res); + } } protected void renderHUDText(int width, int height) { mc.mcProfiler.startSection("forgeHudText"); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - ArrayList left = new ArrayList(); - ArrayList right = new ArrayList(); + ArrayList listL = new ArrayList(); + ArrayList listR = new ArrayList(); if (mc.isDemo()) { long time = mc.theWorld.getTotalWorldTime(); if (time >= 120500L) { - right.add(I18n.format("demo.demoExpired")); + listR.add(I18n.format("demo.demoExpired")); } else { - right.add(I18n.format("demo.remainingTime", StringUtils.ticksToElapsedTime((int)(120500L - time)))); + listR.add(I18n.format("demo.remainingTime", StringUtils.ticksToElapsedTime((int)(120500L - time)))); } } - if (this.mc.gameSettings.showDebugInfo && !pre(DEBUG)) { - mc.mcProfiler.startSection("debug"); - GL11.glPushMatrix(); - left.add("Minecraft " + MC_VERSION + " (" + this.mc.debug + ")"); - left.add(mc.debugInfoRenders()); - left.add(mc.getEntityDebug()); - left.add(mc.debugInfoEntities()); - left.add(mc.getWorldProviderName()); - left.add(null); //Spacer - - long max = Runtime.getRuntime().maxMemory(); - long total = Runtime.getRuntime().totalMemory(); - long free = Runtime.getRuntime().freeMemory(); - long used = total - free; - - right.add("Used memory: " + used * 100L / max + "% (" + used / 1024L / 1024L + "MB) of " + max / 1024L / 1024L + "MB"); - right.add("Allocated memory: " + total * 100L / max + "% (" + total / 1024L / 1024L + "MB)"); - - int x = MathHelper.floor_double(mc.thePlayer.posX); - int y = MathHelper.floor_double(mc.thePlayer.posY); - int z = MathHelper.floor_double(mc.thePlayer.posZ); - float yaw = mc.thePlayer.rotationYaw; - int heading = MathHelper.floor_double((double)(mc.thePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; - - left.add(String.format("x: %.5f (%d) // c: %d (%d)", mc.thePlayer.posX, x, x >> 4, x & 15)); - left.add(String.format("y: %.3f (feet pos, %.3f eyes pos)", mc.thePlayer.boundingBox.minY, mc.thePlayer.posY)); - left.add(String.format("z: %.5f (%d) // c: %d (%d)", mc.thePlayer.posZ, z, z >> 4, z & 15)); - left.add(String.format("f: %d (%s) / %f", heading, Direction.directions[heading], MathHelper.wrapAngleTo180_float(yaw))); - - if (mc.theWorld != null && mc.theWorld.blockExists(x, y, z)) - { - Chunk chunk = this.mc.theWorld.getChunkFromBlockCoords(x, z); - left.add(String.format("lc: %d b: %s bl: %d sl: %d rl: %d", - chunk.getTopFilledSegment() + 15, - chunk.getBiomeGenForWorldCoords(x & 15, z & 15, mc.theWorld.getWorldChunkManager()).biomeName, - chunk.getSavedLightValue(EnumSkyBlock.Block, x & 15, y, z & 15), - chunk.getSavedLightValue(EnumSkyBlock.Sky, x & 15, y, z & 15), - chunk.getBlockLightValue(x & 15, y, z & 15, 0))); - } - else - { - left.add(null); - } - - left.add(String.format("ws: %.3f, fs: %.3f, g: %b, fl: %d", mc.thePlayer.capabilities.getWalkSpeed(), mc.thePlayer.capabilities.getFlySpeed(), mc.thePlayer.onGround, mc.theWorld.getHeightValue(x, z))); - if (mc.entityRenderer != null && mc.entityRenderer.isShaderActive()) - { - left.add(String.format("shader: %s", mc.entityRenderer.getShaderGroup().getShaderGroupName())); - } - - right.add(null); - for (String brand : FMLCommonHandler.instance().getBrandings(false)) - { - right.add(brand); - } - GL11.glPopMatrix(); - mc.mcProfiler.endSection(); + listL.addAll(debugOverlay.getLeft()); + listR.addAll(debugOverlay.getRight()); post(DEBUG); } - RenderGameOverlayEvent.Text event = new RenderGameOverlayEvent.Text(eventParent, left, right); + RenderGameOverlayEvent.Text event = new RenderGameOverlayEvent.Text(eventParent, listL, listR); if (!MinecraftForge.EVENT_BUS.post(event)) { - for (int x = 0; x < left.size(); x++) + int top = 2; + for (String msg : listL) { - String msg = left.get(x); + top += fontrenderer.FONT_HEIGHT; if (msg == null) continue; - fontrenderer.drawStringWithShadow(msg, 2, 2 + x * 10, WHITE); + drawRect(1, top - 1, 2 + fontrenderer.getStringWidth(msg) + 1, top - 1, -1873784752); + fontrenderer.drawString(msg, 2, top, 14737632); } - for (int x = 0; x < right.size(); x++) + top = 2; + for (String msg : listR) { - String msg = right.get(x); + top += fontrenderer.FONT_HEIGHT; if (msg == null) continue; int w = fontrenderer.getStringWidth(msg); - fontrenderer.drawStringWithShadow(msg, width - w - 10, 2 + x * 10, WHITE); + int left = width - 2 - w; + drawRect(left - 1, top - 1, left + w + 1, top - 1, -1873784752); + fontrenderer.drawString(msg, left, top, 14737632); } } @@ -729,20 +707,60 @@ public class GuiIngameForge extends GuiIngame if (opacity > 0) { - GL11.glPushMatrix(); - GL11.glTranslatef((float)(width / 2), (float)(height - 48), 0.0F); - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)(width / 2), (float)(height - 48), 0.0F); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); int color = (recordIsPlaying ? Color.HSBtoRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE); fontrenderer.drawString(recordPlaying, -fontrenderer.getStringWidth(recordPlaying) / 2, -4, color | (opacity << 24)); - GL11.glDisable(GL11.GL_BLEND); - GL11.glPopMatrix(); + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); } mc.mcProfiler.endSection(); } } + protected void renderTitle(int width, int height, float partialTicks) + { + if (field_175195_w > 0) + { + mc.mcProfiler.startSection("titleAndSubtitle"); + float age = (float)this.field_175195_w - partialTicks; + int opacity = 255; + + if (field_175195_w > field_175193_B + field_175192_A) + { + float f3 = (float)(field_175199_z + field_175192_A + field_175193_B) - age; + opacity = (int)(f3 * 255.0F / (float)field_175199_z); + } + if (field_175195_w <= field_175193_B) opacity = (int)(age * 255.0F / (float)this.field_175193_B); + + opacity = MathHelper.clamp_int(opacity, 0, 255); + + if (opacity > 8) + { + GlStateManager.pushMatrix(); + GlStateManager.translate((float)(width / 2), (float)(height / 2), 0.0F); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.pushMatrix(); + GlStateManager.scale(4.0F, 4.0F, 4.0F); + int l = opacity << 24 & -16777216; + this.func_175179_f().func_175065_a(this.field_175201_x, (float)(-this.func_175179_f().getStringWidth(this.field_175201_x) / 2), -10.0F, 16777215 | l, true); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.scale(2.0F, 2.0F, 2.0F); + this.func_175179_f().func_175065_a(this.field_175200_y, (float)(-this.func_175179_f().getStringWidth(this.field_175200_y) / 2), 5.0F, 16777215 | l, true); + GlStateManager.popMatrix(); + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); + } + + this.mc.mcProfiler.endSection(); + } + } + protected void renderChat(int width, int height) { mc.mcProfiler.startSection("chat"); @@ -750,98 +768,38 @@ public class GuiIngameForge extends GuiIngame RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(eventParent, 0, height - 48); if (MinecraftForge.EVENT_BUS.post(event)) return; - GL11.glPushMatrix(); - GL11.glTranslatef((float)event.posX, (float)event.posY, 0.0F); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)event.posX, (float)event.posY, 0.0F); persistantChatGUI.drawChat(updateCounter); - GL11.glPopMatrix(); + GlStateManager.popMatrix(); post(CHAT); mc.mcProfiler.endSection(); } - @SuppressWarnings("unchecked") protected void renderPlayerList(int width, int height) { - ScoreObjective scoreobjective = this.mc.theWorld.getScoreboard().func_96539_a(0); + ScoreObjective scoreobjective = this.mc.theWorld.getScoreboard().getObjectiveInDisplaySlot(0); NetHandlerPlayClient handler = mc.thePlayer.sendQueue; - if (mc.gameSettings.keyBindPlayerList.getIsKeyPressed() && (!mc.isIntegratedServerRunning() || handler.playerInfoList.size() > 1 || scoreobjective != null)) + if (mc.gameSettings.keyBindPlayerList.getIsKeyPressed() && (!mc.isIntegratedServerRunning() || handler.func_175106_d().size() > 1 || scoreobjective != null)) { + this.overlayPlayerList.func_175246_a(true); if (pre(PLAYER_LIST)) return; - this.mc.mcProfiler.startSection("playerList"); - List players = (List)handler.playerInfoList; - int maxPlayers = handler.currentServerMaxPlayers; - int rows = maxPlayers; - int columns = 1; - - for (columns = 1; rows > 20; rows = (maxPlayers + columns - 1) / columns) - { - columns++; - } - - int columnWidth = 300 / columns; - - if (columnWidth > 150) - { - columnWidth = 150; - } - - int left = (width - columns * columnWidth) / 2; - byte border = 10; - drawRect(left - 1, border - 1, left + columnWidth * columns, border + 9 * rows, Integer.MIN_VALUE); - - for (int i = 0; i < maxPlayers; i++) - { - int xPos = left + i % columns * columnWidth; - int yPos = border + i / columns * 9; - drawRect(xPos, yPos, xPos + columnWidth - 1, yPos + 8, 553648127); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glEnable(GL11.GL_ALPHA_TEST); - - if (i < players.size()) - { - GuiPlayerInfo player = (GuiPlayerInfo)players.get(i); - ScorePlayerTeam team = mc.theWorld.getScoreboard().getPlayersTeam(player.name); - String displayName = ScorePlayerTeam.formatPlayerName(team, player.name); - fontrenderer.drawStringWithShadow(displayName, xPos, yPos, 16777215); - - if (scoreobjective != null) - { - int endX = xPos + fontrenderer.getStringWidth(displayName) + 5; - int maxX = xPos + columnWidth - 12 - 5; - - if (maxX - endX > 5) - { - Score score = scoreobjective.getScoreboard().func_96529_a(player.name, scoreobjective); - String scoreDisplay = EnumChatFormatting.YELLOW + "" + score.getScorePoints(); - fontrenderer.drawStringWithShadow(scoreDisplay, maxX - fontrenderer.getStringWidth(scoreDisplay), yPos, 16777215); - } - } - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - mc.getTextureManager().bindTexture(Gui.icons); - int pingIndex = 4; - int ping = player.responseTime; - if (ping < 0) pingIndex = 5; - else if (ping < 150) pingIndex = 0; - else if (ping < 300) pingIndex = 1; - else if (ping < 600) pingIndex = 2; - else if (ping < 1000) pingIndex = 3; - - zLevel += 100.0F; - drawTexturedModalRect(xPos + columnWidth - 12, yPos, 0, 176 + pingIndex * 8, 10, 8); - zLevel -= 100.0F; - } - } + this.overlayPlayerList.func_175249_a(width, this.mc.theWorld.getScoreboard(), scoreobjective); post(PLAYER_LIST); } + else + { + this.overlayPlayerList.func_175246_a(false); + } } protected void renderHealthMount(int width, int height) { - Entity tmp = mc.thePlayer.ridingEntity; + EntityPlayer player = (EntityPlayer)mc.func_175606_aa(); + Entity tmp = player.ridingEntity; if (!(tmp instanceof EntityLivingBase)) return; bind(icons); @@ -852,7 +810,7 @@ public class GuiIngameForge extends GuiIngame int left_align = width / 2 + 91; mc.mcProfiler.endStartSection("mountHealth"); - GL11.glEnable(GL11.GL_BLEND); + GlStateManager.enableBlend(); EntityLivingBase mount = (EntityLivingBase)tmp; int health = (int)Math.ceil((double)mount.getHealth()); float healthMax = mount.getMaxHealth(); @@ -885,7 +843,7 @@ public class GuiIngameForge extends GuiIngame right_height += 10; } - GL11.glDisable(GL11.GL_BLEND); + GlStateManager.disableBlend(); post(HEALTHMOUNT); } @@ -902,4 +860,13 @@ public class GuiIngameForge extends GuiIngame { mc.getTextureManager().bindTexture(res); } + + private class GuiOverlayDebugForge extends GuiOverlayDebug + { + private GuiOverlayDebugForge(Minecraft mc){ super(mc); } + @Override protected void func_180798_a(){} + @Override protected void func_175239_b(ScaledResolution res){} + private List getLeft(){ return this.call(); } + private List getRight(){ return this.func_175238_c(); } + } } diff --git a/src/main/java/net/minecraftforge/client/IItemRenderer.java b/src/main/java/net/minecraftforge/client/IItemRenderer.java index e7cba638ab..b1f630b6e8 100644 --- a/src/main/java/net/minecraftforge/client/IItemRenderer.java +++ b/src/main/java/net/minecraftforge/client/IItemRenderer.java @@ -2,65 +2,68 @@ package net.minecraftforge.client; import net.minecraft.item.ItemStack; +@Deprecated //Unused, for now. Rendering emensely changed in 1.8, Is this even needed at all anymore? +//Modders should speak up if needed. public interface IItemRenderer { + @Deprecated public enum ItemRenderType { - /** + /** * Called to render an in-world item, e.g. one that has been thrown or * dropped. The appropriate OpenGL transformations and scaling have already * been applied, so Tessellator location (0,0,0) is the center of the * EntityItem. - * + * * Data parameters: * RenderBlocks render - The RenderBlocks instance * EntityItem entity - The in-world item to be rendered */ - ENTITY, - - /** + ENTITY, + + /** * Called to render an item currently held in-hand by a living entity. If * rendering as a 3D block, the item will be rotated to a 45-degree angle. * To render a 2D texture with some thickness (like default items), see * net.minecraft.src.ItemRenderer. In either case, rendering should be done * in local coordinates from (0,0,0)-(1,1,1). - * + * * Data parameters: * RenderBlocks render - The RenderBlocks instance * EntityLiving entity - The entity holding this item */ - EQUIPPED, - - /** + EQUIPPED, + + /** * Called to render an item currently held in-hand by a living entity in * first person. If rendering as a 3D block, the item will be rotated to a * 45-degree angle. To render a 2D texture with some thickness, see * net.minecraft.src.ItemRenderer. In either case, rendering should be done * in local coordinates from (0,0,0)-(1,1,1). - * + * * Data parameters: * RenderBlocks render - The RenderBlocks instance * EntityLiving entity - The entity holding this item */ - EQUIPPED_FIRST_PERSON, - - /** + EQUIPPED_FIRST_PERSON, + + /** * Called to render an item in a GUI inventory slot. If rendering as a 3D * block, the appropriate OpenGL translations and scaling have already been * applied, and the rendering should be done in local coordinates from * (0,0,0)-(1,1,1). If rendering as a 2D texture, the rendering should be in * GUI pixel coordinates from (0, 0, 0)-(16, 16, 0). - * + * * Data parameters: * RenderBlocks render - The RenderBlocks instance */ INVENTORY, - + /** - * The render type used for when a ItemMap is rendered in first person, - * All appropriate rotations have been applied, and the player's hands, + * The render type used for when a ItemMap is rendered in first person, + * All appropriate rotations have been applied, and the player's hands, * and the map BG are already rendered. - * + * * Data Parameters: * EntityPlayer player - The player holding the map * RenderEngine engine - The RenderEngine instance @@ -68,67 +71,71 @@ public interface IItemRenderer */ FIRST_PERSON_MAP } - + + @Deprecated public enum ItemRendererHelper { - /** + /** * Determines if a rotation effect should be used when rendering an * EntityItem, like most default blocks do. */ ENTITY_ROTATION, - - /** + + /** * Determines if an up-and-down bobbing effect should be used when * rendering an EntityItem, like most default items do. */ ENTITY_BOBBING, - /** + /** * Determines if the currently equipped item should be rendered as a 3D * block or as a 2D texture. */ EQUIPPED_BLOCK, - + /** - * Determines if the item should equate to a block that has + * Determines if the item should equate to a block that has * RenderBlocks.renderItemIn3d return true */ BLOCK_3D, - /** + /** * Determines if the item should be rendered in GUI inventory slots as a 3D * block or as a 2D texture. */ INVENTORY_BLOCK } - - /** + + /** * Checks if this renderer should handle a specific item's render type * @param item The item we are trying to render * @param type A render type to check if this renderer handles * @return true if this renderer should handle the given render type, * otherwise false */ + @Deprecated public boolean handleRenderType(ItemStack item, ItemRenderType type); - + /** * Checks if certain helper functionality should be executed for this renderer. * See ItemRendererHelper for more info - * + * * @param type The render type * @param item The ItemStack being rendered * @param helper The type of helper functionality to be ran * @return True to run the helper functionality, false to not. */ + @Deprecated public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper); - + /** - * Called to do the actual rendering, see ItemRenderType for details on when specific + * Called to do the actual rendering, see ItemRenderType for details on when specific * types are run, and what extra data is passed into the data parameter. - * + * * @param type The render type * @param item The ItemStack being rendered * @param data Extra Type specific data */ + @Deprecated public void renderItem(ItemRenderType type, ItemStack item, Object... data); } diff --git a/src/main/java/net/minecraftforge/client/IRenderHandler.java b/src/main/java/net/minecraftforge/client/IRenderHandler.java index 20c87df3df..4a0db183ca 100644 --- a/src/main/java/net/minecraftforge/client/IRenderHandler.java +++ b/src/main/java/net/minecraftforge/client/IRenderHandler.java @@ -1,7 +1,7 @@ package net.minecraftforge.client; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; diff --git a/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java b/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java index 3fe3905c41..2c31fefc05 100644 --- a/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java +++ b/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java @@ -46,21 +46,18 @@ public class MinecraftForgeClient return ForgeHooksClient.renderPass; } - public static int getStencilBits() - { - return ForgeHooksClient.stencilBits; - } - - - private static BitSet stencilBits = new BitSet(getStencilBits()); + private static BitSet stencilBits = new BitSet(8); static { - stencilBits.set(0,getStencilBits()); + stencilBits.set(0,8); } /** * Reserve a stencil bit for use in rendering * + * Note: you must check the Framebuffer you are working with to + * determine if stencil bits are enabled on it before use. + * * @return A bit or -1 if no further stencil bits are available */ public static int reserveStencilBit() @@ -80,7 +77,7 @@ public class MinecraftForgeClient */ public static void releaseStencilBit(int bit) { - if (bit >= 0 && bit < getStencilBits()) + if (bit >= 0 && bit < stencilBits.length()) { stencilBits.set(bit); } diff --git a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java index acb7c1d053..8f57af949f 100644 --- a/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ClientChatReceivedEvent.java @@ -1,15 +1,23 @@ package net.minecraftforge.client.event; import net.minecraft.util.IChatComponent; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; @Cancelable public class ClientChatReceivedEvent extends Event { public IChatComponent message; - public ClientChatReceivedEvent(IChatComponent message) + /** + * Introduced in 1.8: + * 0 : Standard Text Message + * 1 : 'System' message, displayed as standard text. + * 2 : 'Status' message, displayed above action bar, where song notifications are. + */ + public final byte type; + public ClientChatReceivedEvent(byte type, IChatComponent message) { + this.type = type; this.message = message; } } diff --git a/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java b/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java index a7ce569582..242fb3d541 100644 --- a/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java +++ b/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.client.event; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; diff --git a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java index 1121cdda9e..1979a1e03e 100644 --- a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java +++ b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java @@ -2,10 +2,11 @@ package net.minecraftforge.client.event; import net.minecraft.block.Block; import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; -import cpw.mods.fml.common.eventhandler.Event.Result; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event.Result; /** * Event that hooks into EntityRenderer, allowing any feature to customize visual attributes of @@ -14,11 +15,11 @@ import cpw.mods.fml.common.eventhandler.Event.Result; public abstract class EntityViewRenderEvent extends Event { public final EntityRenderer renderer; - public final EntityLivingBase entity; + public final Entity entity; public final Block block; public final double renderPartialTicks; - public EntityViewRenderEvent(EntityRenderer renderer, EntityLivingBase entity, Block block, double renderPartialTicks) + public EntityViewRenderEvent(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks) { this.renderer = renderer; this.entity = entity; @@ -35,13 +36,13 @@ public abstract class EntityViewRenderEvent extends Event { public float density; - public FogDensity(EntityRenderer renderer, EntityLivingBase entity, Block block, double renderPartialTicks, float density) + public FogDensity(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks, float density) { super(renderer, entity, block, renderPartialTicks); this.density = density; } } - + /** * Event that allows any feature to customize the rendering of fog. */ @@ -50,8 +51,8 @@ public abstract class EntityViewRenderEvent extends Event { public final int fogMode; public final float farPlaneDistance; - - public RenderFogEvent(EntityRenderer renderer, EntityLivingBase entity, Block block, double renderPartialTicks, int fogMode, float farPlaneDistance) + + public RenderFogEvent(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks, int fogMode, float farPlaneDistance) { super(renderer, entity, block, renderPartialTicks); this.fogMode = fogMode; @@ -69,7 +70,7 @@ public abstract class EntityViewRenderEvent extends Event public float green; public float blue; - public FogColors(EntityRenderer renderer, EntityLivingBase entity, Block block, double renderPartialTicks, float red, float green, float blue) + public FogColors(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks, float red, float green, float blue) { super(renderer, entity, block, renderPartialTicks); this.red = red; diff --git a/src/main/java/net/minecraftforge/client/event/FOVUpdateEvent.java b/src/main/java/net/minecraftforge/client/event/FOVUpdateEvent.java index 80501f5084..91863999ce 100644 --- a/src/main/java/net/minecraftforge/client/event/FOVUpdateEvent.java +++ b/src/main/java/net/minecraftforge/client/event/FOVUpdateEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.client.event; -import cpw.mods.fml.common.eventhandler.Event; -import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.fml.common.eventhandler.Event; /** * Author: MachineMuse (Claire Semple) @@ -9,11 +9,11 @@ import net.minecraft.client.entity.EntityPlayerSP; */ public class FOVUpdateEvent extends Event { - public final EntityPlayerSP entity; + public final EntityPlayer entity; public final float fov; public float newfov; - public FOVUpdateEvent(EntityPlayerSP entity, float fov) + public FOVUpdateEvent(EntityPlayer entity, float fov) { this.entity = entity; this.fov = fov; diff --git a/src/main/java/net/minecraftforge/client/event/GuiOpenEvent.java b/src/main/java/net/minecraftforge/client/event/GuiOpenEvent.java index 80345f2124..85e2d247a4 100644 --- a/src/main/java/net/minecraftforge/client/event/GuiOpenEvent.java +++ b/src/main/java/net/minecraftforge/client/event/GuiOpenEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.client.event; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.client.gui.GuiScreen; /** diff --git a/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java b/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java index fc7a78fb8d..07e0bd0512 100644 --- a/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java +++ b/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java @@ -5,10 +5,10 @@ import java.util.List; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; /** * Event classes for GuiScreen events. diff --git a/src/main/java/net/minecraftforge/client/event/MouseEvent.java b/src/main/java/net/minecraftforge/client/event/MouseEvent.java index 4cedc34e74..b4e5782bf9 100644 --- a/src/main/java/net/minecraftforge/client/event/MouseEvent.java +++ b/src/main/java/net/minecraftforge/client/event/MouseEvent.java @@ -2,8 +2,8 @@ package net.minecraftforge.client.event; import org.lwjgl.input.Mouse; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; /** * Author: MachineMuse (Claire Semple) diff --git a/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java b/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java index f0772a278e..1307074205 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java @@ -3,8 +3,8 @@ package net.minecraftforge.client.event; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; /** * Called when a block's texture is going to be overlaid on the player's HUD. Cancel this event to prevent the overlay. diff --git a/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java b/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java index a452ccdf43..0a7671a29e 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderGameOverlayEvent.java @@ -2,8 +2,8 @@ package net.minecraftforge.client.event; import java.util.ArrayList; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.client.gui.ScaledResolution; @@ -33,16 +33,12 @@ public class RenderGameOverlayEvent extends Event public final float partialTicks; public final ScaledResolution resolution; - public final int mouseX; - public final int mouseY; public final ElementType type; - public RenderGameOverlayEvent(float partialTicks, ScaledResolution resolution, int mouseX, int mouseY) + public RenderGameOverlayEvent(float partialTicks, ScaledResolution resolution) { this.partialTicks = partialTicks; this.resolution = resolution; - this.mouseX = mouseX; - this.mouseY = mouseY; this.type = null; } @@ -50,8 +46,6 @@ public class RenderGameOverlayEvent extends Event { this.partialTicks = parent.partialTicks; this.resolution = parent.resolution; - this.mouseX = parent.mouseX; - this.mouseY = parent.mouseY; this.type = type; } diff --git a/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java b/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java index 1691566087..0743f8db09 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderHandEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.client.event; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.client.renderer.RenderGlobal; @Cancelable diff --git a/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java b/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java index 16bffea832..f394ae5f46 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderItemInFrameEvent.java @@ -3,8 +3,8 @@ package net.minecraftforge.client.event; import net.minecraft.client.renderer.tileentity.RenderItemFrame; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; /** * This event is called when an item is rendered in an item frame. diff --git a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java index 7108688caa..10544ce4de 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.client.event; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.client.renderer.entity.RendererLivingEntity; import net.minecraft.entity.EntityLivingBase; diff --git a/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java b/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java index dd4885d352..5da1002e73 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderPlayerEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.client.event; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.client.renderer.entity.RenderPlayer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; diff --git a/src/main/java/net/minecraftforge/client/event/RenderWorldEvent.java b/src/main/java/net/minecraftforge/client/event/RenderWorldEvent.java index 5b353f35fa..1e3d1b026b 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderWorldEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderWorldEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.client.event; -import cpw.mods.fml.common.eventhandler.Event; -import net.minecraft.client.renderer.RenderBlocks; +import net.minecraftforge.fml.common.eventhandler.Event; +//import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.world.ChunkCache; @@ -9,14 +9,14 @@ public abstract class RenderWorldEvent extends Event { public final WorldRenderer renderer; public final ChunkCache chunkCache; - public final RenderBlocks renderBlocks; + //public final RenderBlocks renderBlocks; public final int pass; - public RenderWorldEvent(WorldRenderer renderer, ChunkCache chunkCache, RenderBlocks renderBlocks, int pass) + public RenderWorldEvent(WorldRenderer renderer, ChunkCache chunkCache, /*RenderBlocks renderBlocks,*/ int pass) { this.renderer = renderer; this.chunkCache = chunkCache; - this.renderBlocks = renderBlocks; + //this.renderBlocks = renderBlocks; this.pass = pass; } @@ -26,7 +26,7 @@ public abstract class RenderWorldEvent extends Event */ public static class Pre extends RenderWorldEvent { - public Pre(WorldRenderer renderer, ChunkCache chunkCache, RenderBlocks renderBlocks, int pass){ super(renderer, chunkCache, renderBlocks, pass); } + public Pre(WorldRenderer renderer, ChunkCache chunkCache, /*RenderBlocks renderBlocks,*/ int pass){ super(renderer, chunkCache, /*renderBlocks,*/ pass); } } /** @@ -34,6 +34,6 @@ public abstract class RenderWorldEvent extends Event */ public static class Post extends RenderWorldEvent { - public Post(WorldRenderer renderer, ChunkCache chunkCache, RenderBlocks renderBlocks, int pass){ super(renderer, chunkCache, renderBlocks, pass); } + public Post(WorldRenderer renderer, ChunkCache chunkCache, /*RenderBlocks renderBlocks,*/ int pass){ super(renderer, chunkCache, /*renderBlocks,*/ pass); } } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java b/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java index ae5d596f6a..0d92024e12 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderWorldLastEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.client.event; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.client.renderer.RenderGlobal; public class RenderWorldLastEvent extends Event diff --git a/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java b/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java index 6b602e38b5..21af9e192d 100644 --- a/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java +++ b/src/main/java/net/minecraftforge/client/event/TextureStitchEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.client.event; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.client.renderer.texture.TextureMap; diff --git a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java index 93bbf7eeb4..ca3af9d62f 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java @@ -1,25 +1,29 @@ package net.minecraftforge.client.event.sound; +import net.minecraft.client.audio.ISound; +import net.minecraft.client.audio.SoundCategory; import net.minecraft.client.audio.SoundManager; import net.minecraft.client.audio.SoundPoolEntry; /*** * Raised when the SoundManager tries to play a normal sound. - * + * * If you return null from this function it will prevent the sound from being played, * you can return a different entry if you want to change the sound being played. */ -@Deprecated // Switch with PlaySoundEvent17 in 1.8 -public class PlaySoundEvent extends SoundResultEvent +public class PlaySoundEvent extends SoundEvent { - public final float x; - public final float y; - public final float z; - public PlaySoundEvent(SoundManager manager, SoundPoolEntry source, String name, float x, float y, float z, float volume, float pitch) - { - super(manager, source, name, volume, pitch); - this.x = x; - this.y = y; - this.z = z; + public final String name; + public final ISound sound; + public final SoundCategory category; + public ISound result; + + public PlaySoundEvent(SoundManager manager, ISound sound, SoundCategory category) + { + super(manager); + this.sound = sound; + this.category = category; + this.name = sound.getSoundLocation().getResourcePath(); + this.result = sound; } } diff --git a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent17.java b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent17.java deleted file mode 100644 index 2a6d2b3d2f..0000000000 --- a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent17.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.minecraftforge.client.event.sound; - -import net.minecraft.client.audio.ISound; -import net.minecraft.client.audio.SoundCategory; -import net.minecraft.client.audio.SoundManager; -import net.minecraft.client.audio.SoundPoolEntry; - -/*** - * Raised when the SoundManager tries to play a normal sound. - * - * If you return null from this function it will prevent the sound from being played, - * you can return a different entry if you want to change the sound being played. - */ -//TODO: Replace PlaySoundEvent in 1.8 -public class PlaySoundEvent17 extends SoundEvent -{ - public final String name; - public final ISound sound; - public final SoundCategory category; - public ISound result; - - public PlaySoundEvent17(SoundManager manager, ISound sound, SoundCategory category) - { - super(manager); - this.sound = sound; - this.category = category; - this.name = sound.getPositionedSoundLocation().getResourcePath(); - this.result = sound; - } -} diff --git a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundSourceEvent.java b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundSourceEvent.java index 0bfeeec45d..af6e733acb 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundSourceEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundSourceEvent.java @@ -6,33 +6,8 @@ import net.minecraftforge.client.event.sound.SoundEvent.SoundSourceEvent; public class PlaySoundSourceEvent extends SoundSourceEvent { - @Deprecated - public final SoundManager manager; - @Deprecated - public final String name; - @Deprecated - public final float x; - @Deprecated - public final float y; - @Deprecated - public final float z; - - @Deprecated - public PlaySoundSourceEvent(SoundManager manager, String name, float x, float y, float z) - { - super(manager, null, null); - this.manager = manager; - this.name = name; - this.x = x; - this.y = y; - this.z = z; - } - public PlaySoundSourceEvent(SoundManager manager, ISound sound, String uuid) { super(manager, sound, uuid); - this.name = sound.getPositionedSoundLocation().getResourcePath(); - this.manager = manager; - this.x = this.y = this.z = 0; } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/event/sound/PlayStreamingSourceEvent.java b/src/main/java/net/minecraftforge/client/event/sound/PlayStreamingSourceEvent.java index a04bebeba7..f122bf35b2 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/PlayStreamingSourceEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/PlayStreamingSourceEvent.java @@ -6,33 +6,8 @@ import net.minecraftforge.client.event.sound.SoundEvent.SoundSourceEvent; public class PlayStreamingSourceEvent extends SoundSourceEvent { - @Deprecated - public final SoundManager manager; - @Deprecated - public final String name; - @Deprecated - public final float x; - @Deprecated - public final float y; - @Deprecated - public final float z; - - @Deprecated - public PlayStreamingSourceEvent(SoundManager manager, String name, float x, float y, float z) - { - super(manager, null, null); - this.manager = manager; - this.name = name; - this.x = x; - this.y = y; - this.z = z; - } - public PlayStreamingSourceEvent(SoundManager manager, ISound sound, String uuid) { super(manager, sound, uuid); - this.x = this.y = this.z = 0; - this.manager = null; - this.name = sound.getPositionedSoundLocation().getResourcePath(); } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java index b232d99804..c13d55b4b4 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/SoundEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.client.event.sound; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.client.audio.ISound; import net.minecraft.client.audio.SoundManager; import net.minecraft.client.audio.SoundPoolEntry; @@ -13,7 +13,7 @@ public class SoundEvent extends Event { this.manager = manager; } - + @Deprecated public static SoundPoolEntry getResult(SoundResultEvent event) { @@ -30,7 +30,7 @@ public class SoundEvent extends Event public SoundSourceEvent(SoundManager manager, ISound sound, String uuid) { super(manager); - this.name = sound.getPositionedSoundLocation().getResourcePath(); + this.name = sound.getSoundLocation().getResourcePath(); this.sound = sound; this.uuid = uuid; } diff --git a/src/main/java/net/minecraftforge/client/gui/ForgeGuiFactory.java b/src/main/java/net/minecraftforge/client/gui/ForgeGuiFactory.java index ceb658aadd..1f3e18616e 100644 --- a/src/main/java/net/minecraftforge/client/gui/ForgeGuiFactory.java +++ b/src/main/java/net/minecraftforge/client/gui/ForgeGuiFactory.java @@ -22,33 +22,33 @@ import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.ConfigElement; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; -import cpw.mods.fml.client.IModGuiFactory; -import cpw.mods.fml.client.IModGuiFactory.RuntimeOptionCategoryElement; -import cpw.mods.fml.client.IModGuiFactory.RuntimeOptionGuiHandler; -import cpw.mods.fml.client.config.ConfigGuiType; -import cpw.mods.fml.client.config.DummyConfigElement; -import cpw.mods.fml.client.config.DummyConfigElement.DummyCategoryElement; -import cpw.mods.fml.client.config.GuiButtonExt; -import cpw.mods.fml.client.config.GuiConfig; -import cpw.mods.fml.client.config.GuiConfigEntries; -import cpw.mods.fml.client.config.GuiConfigEntries.CategoryEntry; -import cpw.mods.fml.client.config.GuiConfigEntries.IConfigEntry; -import cpw.mods.fml.client.config.GuiConfigEntries.SelectValueEntry; -import cpw.mods.fml.client.config.GuiConfigEntries.BooleanEntry; -import cpw.mods.fml.client.config.HoverChecker; -import cpw.mods.fml.client.config.IConfigElement; -import cpw.mods.fml.client.config.GuiConfigEntries.ListEntryBase; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.ModContainer; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import net.minecraftforge.fml.client.IModGuiFactory; +import net.minecraftforge.fml.client.IModGuiFactory.RuntimeOptionCategoryElement; +import net.minecraftforge.fml.client.IModGuiFactory.RuntimeOptionGuiHandler; +import net.minecraftforge.fml.client.config.ConfigGuiType; +import net.minecraftforge.fml.client.config.DummyConfigElement; +import net.minecraftforge.fml.client.config.DummyConfigElement.DummyCategoryElement; +import net.minecraftforge.fml.client.config.GuiButtonExt; +import net.minecraftforge.fml.client.config.GuiConfig; +import net.minecraftforge.fml.client.config.GuiConfigEntries; +import net.minecraftforge.fml.client.config.GuiConfigEntries.CategoryEntry; +import net.minecraftforge.fml.client.config.GuiConfigEntries.IConfigEntry; +import net.minecraftforge.fml.client.config.GuiConfigEntries.SelectValueEntry; +import net.minecraftforge.fml.client.config.GuiConfigEntries.BooleanEntry; +import net.minecraftforge.fml.client.config.HoverChecker; +import net.minecraftforge.fml.client.config.IConfigElement; +import net.minecraftforge.fml.client.config.GuiConfigEntries.ListEntryBase; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModContainer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; /** * This is the base GuiConfig screen class that all the other Forge-specific config screens will be called from. * Since Forge has multiple config files I thought I would use that opportunity to show some of the ways * that the config GUI system can be extended to create custom config GUIs that have additional features * over the base functionality of just displaying Properties and ConfigCategories. - * + * * The concepts implemented here are: * - using custom IConfigEntry objects to define child-screens that have specific Properties listed * - using custom IConfigEntry objects to define a dummy property that can be used to generate new ConfigCategory objects @@ -58,25 +58,25 @@ import cpw.mods.fml.relauncher.SideOnly; * - overriding the IConfigEntry.enabled() method to control the enabled state of one list entry based on the value of another entry * - overriding the IConfigEntry.onGuiClosed() method to perform custom actions when the screen that owns the entry is closed (in this * case a new ConfigCategory is added to the Configuration object) - * + * * The config file structure looks like this: * forge.cfg (general settings all in one category) * forgeChunkLoading.cfg * - Forge (category) * - defaults (category) * - [optional mod override categories]... - * + * * The GUI structure is this: * Base Screen * - General Settings (from forge.cfg) - * - Chunk Loader Settings (from forgeChunkLoading.cfg) + * - Chunk Loader Settings (from forgeChunkLoading.cfg) * - Defaults (these elements are listed directly on this screen) * - Mod Overrides * - Add New Mod Override * - Mod1 * - Mod2 * - etc. - * + * * Other things to check out: * ForgeModContainer.syncConfig() * ForgeModContainer.onConfigChanged() @@ -87,23 +87,23 @@ public class ForgeGuiFactory implements IModGuiFactory { @Override public void initialize(Minecraft minecraftInstance) {} - + @Override public Class mainConfigGuiClass() { return ForgeConfigGui.class; } - + @Override public Set runtimeGuiCategories() { return null; } - + @Override public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { return null; } - - public static class ForgeConfigGui extends GuiConfig + + public static class ForgeConfigGui extends GuiConfig { public ForgeConfigGui(GuiScreen parentScreen) { super(parentScreen, getConfigElements(), "Forge", false, false, I18n.format("forge.configgui.forgeConfigTitle")); } - + private static List getConfigElements() { List list = new ArrayList(); @@ -111,9 +111,9 @@ public class ForgeGuiFactory implements IModGuiFactory list.add(new DummyCategoryElement("forgeChunkLoadingCfg", "forge.configgui.ctgy.forgeChunkLoadingConfig", ChunkLoaderEntry.class)); return list; } - + /** - * This custom list entry provides the General Settings entry on the Minecraft Forge Configuration screen. + * This custom list entry provides the General Settings entry on the Minecraft Forge Configuration screen. * It extends the base Category entry class and defines the IConfigElement objects that will be used to build the child screen. */ public static class GeneralEntry extends CategoryEntry @@ -122,20 +122,20 @@ public class ForgeGuiFactory implements IModGuiFactory { super(owningScreen, owningEntryList, prop); } - + @Override protected GuiScreen buildChildScreen() { // This GuiConfig object specifies the configID of the object and as such will force-save when it is closed. The parent // GuiConfig object's entryList will also be refreshed to reflect the changes. - return new GuiConfig(this.owningScreen, - (new ConfigElement(ForgeModContainer.getConfig().getCategory(Configuration.CATEGORY_GENERAL))).getChildElements(), - this.owningScreen.modID, Configuration.CATEGORY_GENERAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, + return new GuiConfig(this.owningScreen, + (new ConfigElement(ForgeModContainer.getConfig().getCategory(Configuration.CATEGORY_GENERAL))).getChildElements(), + this.owningScreen.modID, Configuration.CATEGORY_GENERAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, GuiConfig.getAbridgedConfigPath(ForgeModContainer.getConfig().toString())); } } - + /** * This custom list entry provides the Forge Chunk Manager Config entry on the Minecraft Forge Configuration screen. * It extends the base Category entry class and defines the IConfigElement objects that will be used to build the child screen. @@ -146,38 +146,38 @@ public class ForgeGuiFactory implements IModGuiFactory { super(owningScreen, owningEntryList, prop); } - + @Override protected GuiScreen buildChildScreen() { List list = new ArrayList(); - - list.add(new DummyCategoryElement("forgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingModConfig", + + list.add(new DummyCategoryElement("forgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingModConfig", ModOverridesEntry.class)); list.addAll((new ConfigElement(ForgeChunkManager.getDefaultsCategory())).getChildElements()); - + // This GuiConfig object specifies the configID of the object and as such will force-save when it is closed. The parent // GuiConfig object's propertyList will also be refreshed to reflect the changes. - return new GuiConfig(this.owningScreen, list, this.owningScreen.modID, "chunkLoader", - this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, + return new GuiConfig(this.owningScreen, list, this.owningScreen.modID, "chunkLoader", + this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, GuiConfig.getAbridgedConfigPath(ForgeChunkManager.getConfig().toString()), I18n.format("forge.configgui.ctgy.forgeChunkLoadingConfig")); } } - + /** * This custom list entry provides the Mod Overrides entry on the Forge Chunk Loading config screen. * It extends the base Category entry class and defines the IConfigElement objects that will be used to build the child screen. * In this case it adds the custom entry for adding a new mod override and lists the existing mod overrides. */ public static class ModOverridesEntry extends CategoryEntry - { + { public ModOverridesEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) { super(owningScreen, owningEntryList, prop); } - + /** * This method is called in the constructor and is used to set the childScreen field. */ @@ -185,21 +185,21 @@ public class ForgeGuiFactory implements IModGuiFactory protected GuiScreen buildChildScreen() { List list = new ArrayList(); - - list.add(new DummyCategoryElement("addForgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingAddModConfig", + + list.add(new DummyCategoryElement("addForgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingAddModConfig", AddModOverrideEntry.class)); for (ConfigCategory cc : ForgeChunkManager.getModCategories()) list.add(new ConfigElement(cc)); - + return new GuiConfig(this.owningScreen, list, this.owningScreen.modID, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, - this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.owningScreen.title, + this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.owningScreen.title, I18n.format("forge.configgui.ctgy.forgeChunkLoadingModConfig")); } - + /** * By overriding the enabled() method and checking the value of the "enabled" entry this entry is enabled/disabled based on the value of - * the other entry. + * the other entry. */ @Override public boolean enabled() @@ -211,10 +211,10 @@ public class ForgeGuiFactory implements IModGuiFactory return Boolean.valueOf(entry.getCurrentValue().toString()); } } - + return true; } - + /** * Check to see if the child screen's entry list has changed. */ @@ -228,7 +228,7 @@ public class ForgeGuiFactory implements IModGuiFactory } return false; } - + /** * Since adding a new entry to the child screen is what constitutes a change here, reset the child * screen listEntries to the saved list. @@ -242,12 +242,12 @@ public class ForgeGuiFactory implements IModGuiFactory for (IConfigEntry ice : child.entryList.listEntries) if (!child.initEntries.contains(ice) && ForgeChunkManager.getConfig().hasCategory(ice.getName())) ForgeChunkManager.getConfig().removeCategory(ForgeChunkManager.getConfig().getCategory(ice.getName())); - + child.entryList.listEntries = new ArrayList(child.initEntries); } } } - + /** * This custom list entry provides a button that will open to a screen that will allow a user to define a new mod override. */ @@ -257,29 +257,29 @@ public class ForgeGuiFactory implements IModGuiFactory { super(owningScreen, owningEntryList, prop); } - + @Override protected GuiScreen buildChildScreen() { List list = new ArrayList(); - + list.add(new DummyConfigElement("modID", "", ConfigGuiType.STRING, "forge.configgui.modID").setCustomListEntryClass(ModIDEntry.class)); - list.add(new ConfigElement(new Property("maximumTicketCount", "200", Property.Type.INTEGER, "forge.configgui.maximumTicketCount"))); - list.add(new ConfigElement(new Property("maximumChunksPerTicket", "25", Property.Type.INTEGER, "forge.configgui.maximumChunksPerTicket"))); - + list.add(new ConfigElement(new Property("maximumTicketCount", "200", Property.Type.INTEGER, "forge.configgui.maximumTicketCount"))); + list.add(new ConfigElement(new Property("maximumChunksPerTicket", "25", Property.Type.INTEGER, "forge.configgui.maximumChunksPerTicket"))); + return new GuiConfig(this.owningScreen, list, this.owningScreen.modID, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.owningScreen.title, I18n.format("forge.configgui.ctgy.forgeChunkLoadingAddModConfig")); } - + @Override public boolean isChanged() { return false; } } - + /** * This custom list entry provides a Mod ID selector. The control is a button that opens a list of values to select from. * This entry also overrides onGuiClosed() to run code to save the data to a new ConfigCategory when the user is done. @@ -287,26 +287,26 @@ public class ForgeGuiFactory implements IModGuiFactory public static class ModIDEntry extends SelectValueEntry { public ModIDEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) - { + { super(owningScreen, owningEntryList, prop, getSelectableValues()); if (this.selectableValues.size() == 0) this.btnValue.enabled = false; } - + private static Map getSelectableValues() { Map selectableValues = new TreeMap(); - + for (ModContainer mod : Loader.instance().getActiveModList()) // only add mods to the list that have a non-immutable ModContainer if (!mod.isImmutable() && mod.getMod() != null) selectableValues.put(mod.getModId(), mod.getName()); - + return selectableValues; } - + /** - * By overriding onGuiClosed() for this entry we can perform additional actions when the user is done such as saving + * By overriding onGuiClosed() for this entry we can perform additional actions when the user is done such as saving * a new ConfigCategory object to the Configuration object. */ @Override @@ -323,25 +323,25 @@ public class ForgeGuiFactory implements IModGuiFactory maxTickets = Integer.valueOf(ice.get().toString()); else if ("maximumChunksPerTicket".equals(ice.getName())) maxChunks = Integer.valueOf(ice.get().toString()); - + ForgeChunkManager.addConfigProperty(modObject, "maximumTicketCount", String.valueOf(maxTickets), Property.Type.INTEGER); ForgeChunkManager.addConfigProperty(modObject, "maximumChunksPerTicket", String.valueOf(maxChunks), Property.Type.INTEGER); - + if (this.owningScreen.parentScreen instanceof GuiConfig) { GuiConfig superParent = (GuiConfig) this.owningScreen.parentScreen; ConfigCategory modCtgy = ForgeChunkManager.getConfigFor(modObject); modCtgy.setPropertyOrder(ForgeChunkManager.MOD_PROP_ORDER); ConfigElement modConfig = new ConfigElement(modCtgy); - + boolean found = false; for (IConfigElement ice : superParent.configElements) if (ice.getName().equals(currentValue)) found = true; - + if (!found) superParent.configElements.add(modConfig); - + superParent.needsRefresh = true; superParent.initGui(); } diff --git a/src/main/java/net/minecraftforge/client/model/AdvancedModelLoader.java b/src/main/java/net/minecraftforge/client/model/AdvancedModelLoader.java deleted file mode 100644 index ff05d595da..0000000000 --- a/src/main/java/net/minecraftforge/client/model/AdvancedModelLoader.java +++ /dev/null @@ -1,79 +0,0 @@ -package net.minecraftforge.client.model; -// TODO: Move this package to net.minecraftforge.model in 1.8 - -import java.util.Collection; -import java.util.Map; - -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.obj.ObjModelLoader; -import net.minecraftforge.client.model.techne.TechneModelLoader; - -import com.google.common.collect.Maps; - -import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -/** - * Common interface for advanced model loading from files, based on file suffix - * Model support can be queried through the {@link #getSupportedSuffixes()} method. - * Instances can be created by calling {@link #loadModel(String)} with a class-loadable-path - * - * @author cpw - * - */ -@SideOnly(Side.CLIENT) -public class AdvancedModelLoader { - private static Map instances = Maps.newHashMap(); - - /** - * Register a new model handler - * @param modelHandler The model handler to register - */ - public static void registerModelHandler(IModelCustomLoader modelHandler) - { - for (String suffix : modelHandler.getSuffixes()) - { - instances.put(suffix, modelHandler); - } - } - - /** - * Load the model from the supplied classpath resolvable resource name - * @param resource The resource name - * @return A model - * @throws IllegalArgumentException if the resource name cannot be understood - * @throws ModelFormatException if the underlying model handler cannot parse the model format - */ - public static IModelCustom loadModel(ResourceLocation resource) throws IllegalArgumentException, ModelFormatException - { - String name = resource.getResourcePath(); - int i = name.lastIndexOf('.'); - if (i == -1) - { - FMLLog.severe("The resource name %s is not valid", resource); - throw new IllegalArgumentException("The resource name is not valid"); - } - String suffix = name.substring(i+1); - IModelCustomLoader loader = instances.get(suffix); - if (loader == null) - { - FMLLog.severe("The resource name %s is not supported", resource); - throw new IllegalArgumentException("The resource name is not supported"); - } - - return loader.loadInstance(resource); - } - - public static Collection getSupportedSuffixes() - { - return instances.keySet(); - } - - - static - { - registerModelHandler(new ObjModelLoader()); - registerModelHandler(new TechneModelLoader()); - } -} diff --git a/src/main/java/net/minecraftforge/client/model/IModelCustom.java b/src/main/java/net/minecraftforge/client/model/IModelCustom.java deleted file mode 100644 index 26463172f3..0000000000 --- a/src/main/java/net/minecraftforge/client/model/IModelCustom.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.minecraftforge.client.model; - -import static cpw.mods.fml.relauncher.Side.CLIENT; -import cpw.mods.fml.relauncher.SideOnly; - -public interface IModelCustom -{ - String getType(); - @SideOnly(CLIENT) - void renderAll(); - @SideOnly(CLIENT) - void renderOnly(String... groupNames); - @SideOnly(CLIENT) - void renderPart(String partName); - @SideOnly(CLIENT) - void renderAllExcept(String... excludedGroupNames); -} diff --git a/src/main/java/net/minecraftforge/client/model/IModelCustomLoader.java b/src/main/java/net/minecraftforge/client/model/IModelCustomLoader.java deleted file mode 100644 index 638498c820..0000000000 --- a/src/main/java/net/minecraftforge/client/model/IModelCustomLoader.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.minecraftforge.client.model; - -import net.minecraft.util.ResourceLocation; - -/** - * Instances of this class act as factories for their model type - * - * @author cpw - * - */ -public interface IModelCustomLoader { - /** - * Get the main type name for this loader - * @return the type name - */ - String getType(); - /** - * Get resource suffixes this model loader recognizes - * @return a list of suffixes - */ - String[] getSuffixes(); - /** - * Load a model instance from the supplied path - * @param resource The ResourceLocation of the model - * @return A model instance - * @throws ModelFormatException if the model format is not correct - */ - IModelCustom loadInstance(ResourceLocation resource) throws ModelFormatException; -} diff --git a/src/main/java/net/minecraftforge/client/model/ModelFormatException.java b/src/main/java/net/minecraftforge/client/model/ModelFormatException.java deleted file mode 100644 index 08ec9971d1..0000000000 --- a/src/main/java/net/minecraftforge/client/model/ModelFormatException.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.minecraftforge.client.model; - -/** - * Thrown if there is a problem parsing the model - * - * @author cpw - * - */ -public class ModelFormatException extends RuntimeException { - - private static final long serialVersionUID = 2023547503969671835L; - - public ModelFormatException() - { - super(); - } - - public ModelFormatException(String message, Throwable cause) - { - super(message, cause); - } - - public ModelFormatException(String message) - { - super(message); - } - - public ModelFormatException(Throwable cause) - { - super(cause); - } - -} diff --git a/src/main/java/net/minecraftforge/client/model/obj/Face.java b/src/main/java/net/minecraftforge/client/model/obj/Face.java deleted file mode 100644 index 8033deee05..0000000000 --- a/src/main/java/net/minecraftforge/client/model/obj/Face.java +++ /dev/null @@ -1,84 +0,0 @@ -package net.minecraftforge.client.model.obj; - -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.Vec3; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class Face -{ - public Vertex[] vertices; - public Vertex[] vertexNormals; - public Vertex faceNormal; - public TextureCoordinate[] textureCoordinates; - - @SideOnly(Side.CLIENT) - public void addFaceForRender(Tessellator tessellator) - { - addFaceForRender(tessellator, 0.0005F); - } - - @SideOnly(Side.CLIENT) - public void addFaceForRender(Tessellator tessellator, float textureOffset) - { - if (faceNormal == null) - { - faceNormal = this.calculateFaceNormal(); - } - - tessellator.setNormal(faceNormal.x, faceNormal.y, faceNormal.z); - - float averageU = 0F; - float averageV = 0F; - - if ((textureCoordinates != null) && (textureCoordinates.length > 0)) - { - for (int i = 0; i < textureCoordinates.length; ++i) - { - averageU += textureCoordinates[i].u; - averageV += textureCoordinates[i].v; - } - - averageU = averageU / textureCoordinates.length; - averageV = averageV / textureCoordinates.length; - } - - float offsetU, offsetV; - - for (int i = 0; i < vertices.length; ++i) - { - - if ((textureCoordinates != null) && (textureCoordinates.length > 0)) - { - offsetU = textureOffset; - offsetV = textureOffset; - - if (textureCoordinates[i].u > averageU) - { - offsetU = -offsetU; - } - if (textureCoordinates[i].v > averageV) - { - offsetV = -offsetV; - } - - tessellator.addVertexWithUV(vertices[i].x, vertices[i].y, vertices[i].z, textureCoordinates[i].u + offsetU, textureCoordinates[i].v + offsetV); - } - else - { - tessellator.addVertex(vertices[i].x, vertices[i].y, vertices[i].z); - } - } - } - - public Vertex calculateFaceNormal() - { - Vec3 v1 = Vec3.createVectorHelper(vertices[1].x - vertices[0].x, vertices[1].y - vertices[0].y, vertices[1].z - vertices[0].z); - Vec3 v2 = Vec3.createVectorHelper(vertices[2].x - vertices[0].x, vertices[2].y - vertices[0].y, vertices[2].z - vertices[0].z); - Vec3 normalVector = null; - - normalVector = v1.crossProduct(v2).normalize(); - - return new Vertex((float) normalVector.xCoord, (float) normalVector.yCoord, (float) normalVector.zCoord); - } -} diff --git a/src/main/java/net/minecraftforge/client/model/obj/GroupObject.java b/src/main/java/net/minecraftforge/client/model/obj/GroupObject.java deleted file mode 100644 index 60a7fe494a..0000000000 --- a/src/main/java/net/minecraftforge/client/model/obj/GroupObject.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.minecraftforge.client.model.obj; - -import java.util.ArrayList; - -import net.minecraft.client.renderer.Tessellator; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class GroupObject -{ - public String name; - public ArrayList faces = new ArrayList(); - public int glDrawingMode; - - public GroupObject() - { - this(""); - } - - public GroupObject(String name) - { - this(name, -1); - } - - public GroupObject(String name, int glDrawingMode) - { - this.name = name; - this.glDrawingMode = glDrawingMode; - } - - @SideOnly(Side.CLIENT) - public void render() - { - if (faces.size() > 0) - { - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawing(glDrawingMode); - render(tessellator); - tessellator.draw(); - } - } - - @SideOnly(Side.CLIENT) - public void render(Tessellator tessellator) - { - if (faces.size() > 0) - { - for (Face face : faces) - { - face.addFaceForRender(tessellator); - } - } - } -} diff --git a/src/main/java/net/minecraftforge/client/model/obj/ObjModelLoader.java b/src/main/java/net/minecraftforge/client/model/obj/ObjModelLoader.java deleted file mode 100644 index db101aa05e..0000000000 --- a/src/main/java/net/minecraftforge/client/model/obj/ObjModelLoader.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.minecraftforge.client.model.obj; - -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.IModelCustom; -import net.minecraftforge.client.model.IModelCustomLoader; -import net.minecraftforge.client.model.ModelFormatException; - -public class ObjModelLoader implements IModelCustomLoader -{ - - @Override - public String getType() - { - return "OBJ model"; - } - - private static final String[] types = { "obj" }; - @Override - public String[] getSuffixes() - { - return types; - } - - @Override - public IModelCustom loadInstance(ResourceLocation resource) throws ModelFormatException - { - return new WavefrontObject(resource); - } -} diff --git a/src/main/java/net/minecraftforge/client/model/obj/TextureCoordinate.java b/src/main/java/net/minecraftforge/client/model/obj/TextureCoordinate.java deleted file mode 100644 index 64d78d68cc..0000000000 --- a/src/main/java/net/minecraftforge/client/model/obj/TextureCoordinate.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minecraftforge.client.model.obj; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class TextureCoordinate -{ - public float u, v, w; - - public TextureCoordinate(float u, float v) - { - this(u, v, 0F); - } - - public TextureCoordinate(float u, float v, float w) - { - this.u = u; - this.v = v; - this.w = w; - } -} diff --git a/src/main/java/net/minecraftforge/client/model/obj/Vertex.java b/src/main/java/net/minecraftforge/client/model/obj/Vertex.java deleted file mode 100644 index d3fcb2bcff..0000000000 --- a/src/main/java/net/minecraftforge/client/model/obj/Vertex.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.minecraftforge.client.model.obj; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class Vertex -{ - public float x, y, z; - - public Vertex(float x, float y) - { - this(x, y, 0F); - } - - public Vertex(float x, float y, float z) - { - this.x = x; - this.y = y; - this.z = z; - } -} diff --git a/src/main/java/net/minecraftforge/client/model/obj/WavefrontObject.java b/src/main/java/net/minecraftforge/client/model/obj/WavefrontObject.java deleted file mode 100644 index 530fdfd9e0..0000000000 --- a/src/main/java/net/minecraftforge/client/model/obj/WavefrontObject.java +++ /dev/null @@ -1,660 +0,0 @@ -package net.minecraftforge.client.model.obj; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.resources.IResource; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.IModelCustom; -import net.minecraftforge.client.model.ModelFormatException; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -/** - * Wavefront Object importer - * Based heavily off of the specifications found at http://en.wikipedia.org/wiki/Wavefront_.obj_file - */ -public class WavefrontObject implements IModelCustom -{ - private static Pattern vertexPattern = Pattern.compile("(v( (\\-){0,1}\\d+\\.\\d+){3,4} *\\n)|(v( (\\-){0,1}\\d+\\.\\d+){3,4} *$)"); - private static Pattern vertexNormalPattern = Pattern.compile("(vn( (\\-){0,1}\\d+\\.\\d+){3,4} *\\n)|(vn( (\\-){0,1}\\d+\\.\\d+){3,4} *$)"); - private static Pattern textureCoordinatePattern = Pattern.compile("(vt( (\\-){0,1}\\d+\\.\\d+){2,3} *\\n)|(vt( (\\-){0,1}\\d+\\.\\d+){2,3} *$)"); - private static Pattern face_V_VT_VN_Pattern = Pattern.compile("(f( \\d+/\\d+/\\d+){3,4} *\\n)|(f( \\d+/\\d+/\\d+){3,4} *$)"); - private static Pattern face_V_VT_Pattern = Pattern.compile("(f( \\d+/\\d+){3,4} *\\n)|(f( \\d+/\\d+){3,4} *$)"); - private static Pattern face_V_VN_Pattern = Pattern.compile("(f( \\d+//\\d+){3,4} *\\n)|(f( \\d+//\\d+){3,4} *$)"); - private static Pattern face_V_Pattern = Pattern.compile("(f( \\d+){3,4} *\\n)|(f( \\d+){3,4} *$)"); - private static Pattern groupObjectPattern = Pattern.compile("([go]( [\\w\\d\\.]+) *\\n)|([go]( [\\w\\d\\.]+) *$)"); - - private static Matcher vertexMatcher, vertexNormalMatcher, textureCoordinateMatcher; - private static Matcher face_V_VT_VN_Matcher, face_V_VT_Matcher, face_V_VN_Matcher, face_V_Matcher; - private static Matcher groupObjectMatcher; - - public ArrayList vertices = new ArrayList(); - public ArrayList vertexNormals = new ArrayList(); - public ArrayList textureCoordinates = new ArrayList(); - public ArrayList groupObjects = new ArrayList(); - private GroupObject currentGroupObject; - private String fileName; - - public WavefrontObject(ResourceLocation resource) throws ModelFormatException - { - this.fileName = resource.toString(); - - try - { - IResource res = Minecraft.getMinecraft().getResourceManager().getResource(resource); - loadObjModel(res.getInputStream()); - } - catch (IOException e) - { - throw new ModelFormatException("IO Exception reading model format", e); - } - } - - public WavefrontObject(String filename, InputStream inputStream) throws ModelFormatException - { - this.fileName = filename; - loadObjModel(inputStream); - } - - private void loadObjModel(InputStream inputStream) throws ModelFormatException - { - BufferedReader reader = null; - - String currentLine = null; - int lineCount = 0; - - try - { - reader = new BufferedReader(new InputStreamReader(inputStream)); - - while ((currentLine = reader.readLine()) != null) - { - lineCount++; - currentLine = currentLine.replaceAll("\\s+", " ").trim(); - - if (currentLine.startsWith("#") || currentLine.length() == 0) - { - continue; - } - else if (currentLine.startsWith("v ")) - { - Vertex vertex = parseVertex(currentLine, lineCount); - if (vertex != null) - { - vertices.add(vertex); - } - } - else if (currentLine.startsWith("vn ")) - { - Vertex vertex = parseVertexNormal(currentLine, lineCount); - if (vertex != null) - { - vertexNormals.add(vertex); - } - } - else if (currentLine.startsWith("vt ")) - { - TextureCoordinate textureCoordinate = parseTextureCoordinate(currentLine, lineCount); - if (textureCoordinate != null) - { - textureCoordinates.add(textureCoordinate); - } - } - else if (currentLine.startsWith("f ")) - { - - if (currentGroupObject == null) - { - currentGroupObject = new GroupObject("Default"); - } - - Face face = parseFace(currentLine, lineCount); - - if (face != null) - { - currentGroupObject.faces.add(face); - } - } - else if (currentLine.startsWith("g ") | currentLine.startsWith("o ")) - { - GroupObject group = parseGroupObject(currentLine, lineCount); - - if (group != null) - { - if (currentGroupObject != null) - { - groupObjects.add(currentGroupObject); - } - } - - currentGroupObject = group; - } - } - - groupObjects.add(currentGroupObject); - } - catch (IOException e) - { - throw new ModelFormatException("IO Exception reading model format", e); - } - finally - { - try - { - reader.close(); - } - catch (IOException e) - { - // hush - } - - try - { - inputStream.close(); - } - catch (IOException e) - { - // hush - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public void renderAll() - { - Tessellator tessellator = Tessellator.instance; - - if (currentGroupObject != null) - { - tessellator.startDrawing(currentGroupObject.glDrawingMode); - } - else - { - tessellator.startDrawing(GL11.GL_TRIANGLES); - } - tessellateAll(tessellator); - - tessellator.draw(); - } - - @SideOnly(Side.CLIENT) - public void tessellateAll(Tessellator tessellator) - { - for (GroupObject groupObject : groupObjects) - { - groupObject.render(tessellator); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void renderOnly(String... groupNames) - { - for (GroupObject groupObject : groupObjects) - { - for (String groupName : groupNames) - { - if (groupName.equalsIgnoreCase(groupObject.name)) - { - groupObject.render(); - } - } - } - } - - @SideOnly(Side.CLIENT) - public void tessellateOnly(Tessellator tessellator, String... groupNames) { - for (GroupObject groupObject : groupObjects) - { - for (String groupName : groupNames) - { - if (groupName.equalsIgnoreCase(groupObject.name)) - { - groupObject.render(tessellator); - } - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public void renderPart(String partName) - { - for (GroupObject groupObject : groupObjects) - { - if (partName.equalsIgnoreCase(groupObject.name)) - { - groupObject.render(); - } - } - } - - @SideOnly(Side.CLIENT) - public void tessellatePart(Tessellator tessellator, String partName) { - for (GroupObject groupObject : groupObjects) - { - if (partName.equalsIgnoreCase(groupObject.name)) - { - groupObject.render(tessellator); - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public void renderAllExcept(String... excludedGroupNames) - { - for (GroupObject groupObject : groupObjects) - { - boolean skipPart=false; - for (String excludedGroupName : excludedGroupNames) - { - if (excludedGroupName.equalsIgnoreCase(groupObject.name)) - { - skipPart=true; - } - } - if(!skipPart) - { - groupObject.render(); - } - } - } - - @SideOnly(Side.CLIENT) - public void tessellateAllExcept(Tessellator tessellator, String... excludedGroupNames) - { - boolean exclude; - for (GroupObject groupObject : groupObjects) - { - exclude=false; - for (String excludedGroupName : excludedGroupNames) - { - if (excludedGroupName.equalsIgnoreCase(groupObject.name)) - { - exclude=true; - } - } - if(!exclude) - { - groupObject.render(tessellator); - } - } - } - - private Vertex parseVertex(String line, int lineCount) throws ModelFormatException - { - Vertex vertex = null; - - if (isValidVertexLine(line)) - { - line = line.substring(line.indexOf(" ") + 1); - String[] tokens = line.split(" "); - - try - { - if (tokens.length == 2) - { - return new Vertex(Float.parseFloat(tokens[0]), Float.parseFloat(tokens[1])); - } - else if (tokens.length == 3) - { - return new Vertex(Float.parseFloat(tokens[0]), Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2])); - } - } - catch (NumberFormatException e) - { - throw new ModelFormatException(String.format("Number formatting error at line %d",lineCount), e); - } - } - else - { - throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format"); - } - - return vertex; - } - - private Vertex parseVertexNormal(String line, int lineCount) throws ModelFormatException - { - Vertex vertexNormal = null; - - if (isValidVertexNormalLine(line)) - { - line = line.substring(line.indexOf(" ") + 1); - String[] tokens = line.split(" "); - - try - { - if (tokens.length == 3) - return new Vertex(Float.parseFloat(tokens[0]), Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2])); - } - catch (NumberFormatException e) - { - throw new ModelFormatException(String.format("Number formatting error at line %d",lineCount), e); - } - } - else - { - throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format"); - } - - return vertexNormal; - } - - private TextureCoordinate parseTextureCoordinate(String line, int lineCount) throws ModelFormatException - { - TextureCoordinate textureCoordinate = null; - - if (isValidTextureCoordinateLine(line)) - { - line = line.substring(line.indexOf(" ") + 1); - String[] tokens = line.split(" "); - - try - { - if (tokens.length == 2) - return new TextureCoordinate(Float.parseFloat(tokens[0]), 1 - Float.parseFloat(tokens[1])); - else if (tokens.length == 3) - return new TextureCoordinate(Float.parseFloat(tokens[0]), 1 - Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2])); - } - catch (NumberFormatException e) - { - throw new ModelFormatException(String.format("Number formatting error at line %d",lineCount), e); - } - } - else - { - throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format"); - } - - return textureCoordinate; - } - - private Face parseFace(String line, int lineCount) throws ModelFormatException - { - Face face = null; - - if (isValidFaceLine(line)) - { - face = new Face(); - - String trimmedLine = line.substring(line.indexOf(" ") + 1); - String[] tokens = trimmedLine.split(" "); - String[] subTokens = null; - - if (tokens.length == 3) - { - if (currentGroupObject.glDrawingMode == -1) - { - currentGroupObject.glDrawingMode = GL11.GL_TRIANGLES; - } - else if (currentGroupObject.glDrawingMode != GL11.GL_TRIANGLES) - { - throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Invalid number of points for face (expected 4, found " + tokens.length + ")"); - } - } - else if (tokens.length == 4) - { - if (currentGroupObject.glDrawingMode == -1) - { - currentGroupObject.glDrawingMode = GL11.GL_QUADS; - } - else if (currentGroupObject.glDrawingMode != GL11.GL_QUADS) - { - throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Invalid number of points for face (expected 3, found " + tokens.length + ")"); - } - } - - // f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 ... - if (isValidFace_V_VT_VN_Line(line)) - { - face.vertices = new Vertex[tokens.length]; - face.textureCoordinates = new TextureCoordinate[tokens.length]; - face.vertexNormals = new Vertex[tokens.length]; - - for (int i = 0; i < tokens.length; ++i) - { - subTokens = tokens[i].split("/"); - - face.vertices[i] = vertices.get(Integer.parseInt(subTokens[0]) - 1); - face.textureCoordinates[i] = textureCoordinates.get(Integer.parseInt(subTokens[1]) - 1); - face.vertexNormals[i] = vertexNormals.get(Integer.parseInt(subTokens[2]) - 1); - } - - face.faceNormal = face.calculateFaceNormal(); - } - // f v1/vt1 v2/vt2 v3/vt3 ... - else if (isValidFace_V_VT_Line(line)) - { - face.vertices = new Vertex[tokens.length]; - face.textureCoordinates = new TextureCoordinate[tokens.length]; - - for (int i = 0; i < tokens.length; ++i) - { - subTokens = tokens[i].split("/"); - - face.vertices[i] = vertices.get(Integer.parseInt(subTokens[0]) - 1); - face.textureCoordinates[i] = textureCoordinates.get(Integer.parseInt(subTokens[1]) - 1); - } - - face.faceNormal = face.calculateFaceNormal(); - } - // f v1//vn1 v2//vn2 v3//vn3 ... - else if (isValidFace_V_VN_Line(line)) - { - face.vertices = new Vertex[tokens.length]; - face.vertexNormals = new Vertex[tokens.length]; - - for (int i = 0; i < tokens.length; ++i) - { - subTokens = tokens[i].split("//"); - - face.vertices[i] = vertices.get(Integer.parseInt(subTokens[0]) - 1); - face.vertexNormals[i] = vertexNormals.get(Integer.parseInt(subTokens[1]) - 1); - } - - face.faceNormal = face.calculateFaceNormal(); - } - // f v1 v2 v3 ... - else if (isValidFace_V_Line(line)) - { - face.vertices = new Vertex[tokens.length]; - - for (int i = 0; i < tokens.length; ++i) - { - face.vertices[i] = vertices.get(Integer.parseInt(tokens[i]) - 1); - } - - face.faceNormal = face.calculateFaceNormal(); - } - else - { - throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format"); - } - } - else - { - throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format"); - } - - return face; - } - - private GroupObject parseGroupObject(String line, int lineCount) throws ModelFormatException - { - GroupObject group = null; - - if (isValidGroupObjectLine(line)) - { - String trimmedLine = line.substring(line.indexOf(" ") + 1); - - if (trimmedLine.length() > 0) - { - group = new GroupObject(trimmedLine); - } - } - else - { - throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format"); - } - - return group; - } - - /*** - * Verifies that the given line from the model file is a valid vertex - * @param line the line being validated - * @return true if the line is a valid vertex, false otherwise - */ - private static boolean isValidVertexLine(String line) - { - if (vertexMatcher != null) - { - vertexMatcher.reset(); - } - - vertexMatcher = vertexPattern.matcher(line); - return vertexMatcher.matches(); - } - - /*** - * Verifies that the given line from the model file is a valid vertex normal - * @param line the line being validated - * @return true if the line is a valid vertex normal, false otherwise - */ - private static boolean isValidVertexNormalLine(String line) - { - if (vertexNormalMatcher != null) - { - vertexNormalMatcher.reset(); - } - - vertexNormalMatcher = vertexNormalPattern.matcher(line); - return vertexNormalMatcher.matches(); - } - - /*** - * Verifies that the given line from the model file is a valid texture coordinate - * @param line the line being validated - * @return true if the line is a valid texture coordinate, false otherwise - */ - private static boolean isValidTextureCoordinateLine(String line) - { - if (textureCoordinateMatcher != null) - { - textureCoordinateMatcher.reset(); - } - - textureCoordinateMatcher = textureCoordinatePattern.matcher(line); - return textureCoordinateMatcher.matches(); - } - - /*** - * Verifies that the given line from the model file is a valid face that is described by vertices, texture coordinates, and vertex normals - * @param line the line being validated - * @return true if the line is a valid face that matches the format "f v1/vt1/vn1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise - */ - private static boolean isValidFace_V_VT_VN_Line(String line) - { - if (face_V_VT_VN_Matcher != null) - { - face_V_VT_VN_Matcher.reset(); - } - - face_V_VT_VN_Matcher = face_V_VT_VN_Pattern.matcher(line); - return face_V_VT_VN_Matcher.matches(); - } - - /*** - * Verifies that the given line from the model file is a valid face that is described by vertices and texture coordinates - * @param line the line being validated - * @return true if the line is a valid face that matches the format "f v1/vt1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise - */ - private static boolean isValidFace_V_VT_Line(String line) - { - if (face_V_VT_Matcher != null) - { - face_V_VT_Matcher.reset(); - } - - face_V_VT_Matcher = face_V_VT_Pattern.matcher(line); - return face_V_VT_Matcher.matches(); - } - - /*** - * Verifies that the given line from the model file is a valid face that is described by vertices and vertex normals - * @param line the line being validated - * @return true if the line is a valid face that matches the format "f v1//vn1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise - */ - private static boolean isValidFace_V_VN_Line(String line) - { - if (face_V_VN_Matcher != null) - { - face_V_VN_Matcher.reset(); - } - - face_V_VN_Matcher = face_V_VN_Pattern.matcher(line); - return face_V_VN_Matcher.matches(); - } - - /*** - * Verifies that the given line from the model file is a valid face that is described by only vertices - * @param line the line being validated - * @return true if the line is a valid face that matches the format "f v1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise - */ - private static boolean isValidFace_V_Line(String line) - { - if (face_V_Matcher != null) - { - face_V_Matcher.reset(); - } - - face_V_Matcher = face_V_Pattern.matcher(line); - return face_V_Matcher.matches(); - } - - /*** - * Verifies that the given line from the model file is a valid face of any of the possible face formats - * @param line the line being validated - * @return true if the line is a valid face that matches any of the valid face formats, false otherwise - */ - private static boolean isValidFaceLine(String line) - { - return isValidFace_V_VT_VN_Line(line) || isValidFace_V_VT_Line(line) || isValidFace_V_VN_Line(line) || isValidFace_V_Line(line); - } - - /*** - * Verifies that the given line from the model file is a valid group (or object) - * @param line the line being validated - * @return true if the line is a valid group (or object), false otherwise - */ - private static boolean isValidGroupObjectLine(String line) - { - if (groupObjectMatcher != null) - { - groupObjectMatcher.reset(); - } - - groupObjectMatcher = groupObjectPattern.matcher(line); - return groupObjectMatcher.matches(); - } - - @Override - public String getType() - { - return "obj"; - } -} diff --git a/src/main/java/net/minecraftforge/client/model/techne/TechneModel.java b/src/main/java/net/minecraftforge/client/model/techne/TechneModel.java deleted file mode 100644 index c4c227c6d6..0000000000 --- a/src/main/java/net/minecraftforge/client/model/techne/TechneModel.java +++ /dev/null @@ -1,365 +0,0 @@ -package net.minecraftforge.client.model.techne; - -import java.awt.Dimension; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Arrays; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipException; -import java.util.zip.ZipInputStream; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.w3c.dom.Document; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.Minecraft; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.client.resources.IResource; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.IModelCustom; -import net.minecraftforge.client.model.ModelFormatException; - -/** - * Techne model importer, based on iChun's Hats importer - */ -@SideOnly(Side.CLIENT) -public class TechneModel extends ModelBase implements IModelCustom { - public static final List cubeTypes = Arrays.asList( - "d9e621f7-957f-4b77-b1ae-20dcd0da7751", - "de81aa14-bd60-4228-8d8d-5238bcd3caaa" - ); - - private String fileName; - private Map zipContents = new HashMap(); - - private Map parts = new LinkedHashMap(); - private String texture = null; - private Dimension textureDims = null; - private int textureName; - private boolean textureNameSet = false; - - public TechneModel(ResourceLocation resource) throws ModelFormatException - { - this.fileName = resource.toString(); - - try - { - IResource res = Minecraft.getMinecraft().getResourceManager().getResource(resource); - loadTechneModel(res.getInputStream()); - } - catch (IOException e) - { - throw new ModelFormatException("IO Exception reading model format", e); - } - } - - private void loadTechneModel(InputStream stream) throws ModelFormatException - { - try - { - ZipInputStream zipInput = new ZipInputStream(stream); - - ZipEntry entry; - while ((entry = zipInput.getNextEntry()) != null) - { - byte[] data = new byte[(int) entry.getSize()]; - // For some reason, using read(byte[]) makes reading stall upon reaching a 0x1E byte - int i = 0; - while (zipInput.available() > 0 && i < data.length) - { - data[i++] = (byte)zipInput.read(); - } - zipContents.put(entry.getName(), data); - } - - byte[] modelXml = zipContents.get("model.xml"); - if (modelXml == null) - { - throw new ModelFormatException("Model " + fileName + " contains no model.xml file"); - } - - DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); - Document document = documentBuilder.parse(new ByteArrayInputStream(modelXml)); - - NodeList nodeListTechne = document.getElementsByTagName("Techne"); - if (nodeListTechne.getLength() < 1) - { - throw new ModelFormatException("Model " + fileName + " contains no Techne tag"); - } - - NodeList nodeListModel = document.getElementsByTagName("Model"); - if (nodeListModel.getLength() < 1) - { - throw new ModelFormatException("Model " + fileName + " contains no Model tag"); - } - - NamedNodeMap modelAttributes = nodeListModel.item(0).getAttributes(); - if (modelAttributes == null) - { - throw new ModelFormatException("Model " + fileName + " contains a Model tag with no attributes"); - } - - Node modelTexture = modelAttributes.getNamedItem("texture"); - if (modelTexture != null) - { - texture = modelTexture.getTextContent(); - } - - NodeList textureDim = document.getElementsByTagName("TextureSize"); - if (textureDim.getLength() > 0) - { - try - { - String[] tmp = textureDim.item(0).getTextContent().split(","); - if (tmp.length == 2) - { - this.textureDims = new Dimension(Integer.parseInt(tmp[0]), Integer.parseInt(tmp[1])); - } - } - catch (NumberFormatException e) - { - throw new ModelFormatException("Model " + fileName + " contains a TextureSize tag with invalid data"); - } - } - - NodeList shapes = document.getElementsByTagName("Shape"); - for (int i = 0; i < shapes.getLength(); i++) - { - Node shape = shapes.item(i); - NamedNodeMap shapeAttributes = shape.getAttributes(); - if (shapeAttributes == null) - { - throw new ModelFormatException("Shape #" + (i + 1) + " in " + fileName + " has no attributes"); - } - - Node name = shapeAttributes.getNamedItem("name"); - String shapeName = null; - if (name != null) - { - shapeName = name.getNodeValue(); - } - if (shapeName == null) - { - shapeName = "Shape #" + (i + 1); - } - - String shapeType = null; - Node type = shapeAttributes.getNamedItem("type"); - if (type != null) - { - shapeType = type.getNodeValue(); - } - if (shapeType != null && !cubeTypes.contains(shapeType)) - { - FMLLog.warning("Model shape [" + shapeName + "] in " + fileName + " is not a cube, ignoring"); - continue; - } - - try - { - boolean mirrored = false; - String[] offset = new String[3]; - String[] position = new String[3]; - String[] rotation = new String[3]; - String[] size = new String[3]; - String[] textureOffset = new String[2]; - - NodeList shapeChildren = shape.getChildNodes(); - for (int j = 0; j < shapeChildren.getLength(); j++) - { - Node shapeChild = shapeChildren.item(j); - - String shapeChildName = shapeChild.getNodeName(); - String shapeChildValue = shapeChild.getTextContent(); - if (shapeChildValue != null) - { - shapeChildValue = shapeChildValue.trim(); - - if (shapeChildName.equals("IsMirrored")) - { - mirrored = !shapeChildValue.equals("False"); - } - else if (shapeChildName.equals("Offset")) - { - offset = shapeChildValue.split(","); - } - else if (shapeChildName.equals("Position")) - { - position = shapeChildValue.split(","); - } - else if (shapeChildName.equals("Rotation")) - { - rotation = shapeChildValue.split(","); - } - else if (shapeChildName.equals("Size")) - { - size = shapeChildValue.split(","); - } - else if (shapeChildName.equals("TextureOffset")) - { - textureOffset = shapeChildValue.split(","); - } - } - } - - // That's what the ModelBase subclassing is needed for - ModelRenderer cube = new ModelRenderer(this, Integer.parseInt(textureOffset[0]), Integer.parseInt(textureOffset[1])); - cube.mirror = mirrored; - cube.addBox(Float.parseFloat(offset[0]), Float.parseFloat(offset[1]), Float.parseFloat(offset[2]), Integer.parseInt(size[0]), Integer.parseInt(size[1]), Integer.parseInt(size[2])); - cube.setRotationPoint(Float.parseFloat(position[0]), Float.parseFloat(position[1]) - 23.4F, Float.parseFloat(position[2])); - - cube.rotateAngleX = (float)Math.toRadians(Float.parseFloat(rotation[0])); - cube.rotateAngleY = (float)Math.toRadians(Float.parseFloat(rotation[1])); - cube.rotateAngleZ = (float)Math.toRadians(Float.parseFloat(rotation[2])); - - if (this.textureDims != null) - { - cube.setTextureSize((int)textureDims.getWidth(), (int)textureDims.getHeight()); - } - - parts.put(shapeName, cube); - } - catch (NumberFormatException e) - { - FMLLog.warning("Model shape [" + shapeName + "] in " + fileName + " contains malformed integers within its data, ignoring"); - e.printStackTrace(); - } - } - } - catch (ZipException e) - { - throw new ModelFormatException("Model " + fileName + " is not a valid zip file"); - } - catch (IOException e) - { - throw new ModelFormatException("Model " + fileName + " could not be read", e); - } - catch (ParserConfigurationException e) - { - // hush - } - catch (SAXException e) - { - throw new ModelFormatException("Model " + fileName + " contains invalid XML", e); - } - } - - private void bindTexture() - { - /* TODO: Update to 1.6 - if (texture != null) - { - if (!textureNameSet) - { - try - { - byte[] textureEntry = zipContents.get(texture); - if (textureEntry == null) - { - throw new ModelFormatException("Model " + fileName + " has no such texture " + texture); - } - - BufferedImage image = ImageIO.read(new ByteArrayInputStream(textureEntry)); - textureName = Minecraft.getMinecraft().renderEngine.allocateAndSetupTexture(image); - textureNameSet = true; - } - catch (ZipException e) - { - throw new ModelFormatException("Model " + fileName + " is not a valid zip file"); - } - catch (IOException e) - { - throw new ModelFormatException("Texture for model " + fileName + " could not be read", e); - } - } - - if (textureNameSet) - { - GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureName); - Minecraft.getMinecraft().renderEngine.resetBoundTexture(); - } - } - */ - } - - @Override - public String getType() - { - return "tcn"; - } - - @Override - public void renderAll() - { - bindTexture(); - - for (ModelRenderer part : parts.values()) - { - part.renderWithRotation(1.0F); - } - } - - @Override - public void renderPart(String partName) - { - ModelRenderer part = parts.get(partName); - if (part != null) - { - bindTexture(); - - part.renderWithRotation(1.0F); - } - } - - @Override - public void renderOnly(String... groupNames) - { - bindTexture(); - for (ModelRenderer part : parts.values()) - { - for (String groupName : groupNames) - { - if (groupName.equalsIgnoreCase(part.boxName)) - { - part.render(1.0f); - } - } - } - } - - @Override - public void renderAllExcept(String... excludedGroupNames) - { - for (ModelRenderer part : parts.values()) - { - boolean skipPart=false; - for (String excludedGroupName : excludedGroupNames) - { - if (excludedGroupName.equalsIgnoreCase(part.boxName)) - { - skipPart=true; - } - } - if(!skipPart) - { - part.render(1.0f); - } - } - } -} diff --git a/src/main/java/net/minecraftforge/client/model/techne/TechneModelLoader.java b/src/main/java/net/minecraftforge/client/model/techne/TechneModelLoader.java deleted file mode 100644 index 3b7007655d..0000000000 --- a/src/main/java/net/minecraftforge/client/model/techne/TechneModelLoader.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.minecraftforge.client.model.techne; - -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.IModelCustom; -import net.minecraftforge.client.model.IModelCustomLoader; -import net.minecraftforge.client.model.ModelFormatException; - -public class TechneModelLoader implements IModelCustomLoader { - - @Override - public String getType() - { - return "Techne model"; - } - - private static final String[] types = { "tcn" }; - @Override - public String[] getSuffixes() - { - return types; - } - - @Override - public IModelCustom loadInstance(ResourceLocation resource) throws ModelFormatException - { - return new TechneModel(resource); - } - -} diff --git a/src/main/java/net/minecraftforge/common/BiomeDictionary.java b/src/main/java/net/minecraftforge/common/BiomeDictionary.java index a820b24987..11f20fd5ae 100644 --- a/src/main/java/net/minecraftforge/common/BiomeDictionary.java +++ b/src/main/java/net/minecraftforge/common/BiomeDictionary.java @@ -2,7 +2,7 @@ package net.minecraftforge.common; import java.util.*; -import cpw.mods.fml.common.FMLLog; +import net.minecraftforge.fml.common.FMLLog; import net.minecraft.init.Blocks; import net.minecraft.world.biome.*; import net.minecraftforge.common.util.EnumHelper; @@ -329,9 +329,9 @@ public class BiomeDictionary } } } - else if(biome.heightVariation <= 0.3F && biome.heightVariation >= 0.0F) + else if(biome.maxHeight <= 0.3F && biome.maxHeight >= 0.0F) { - if(!biome.isHighHumidity() || biome.rootHeight >= 0.0F) + if(!biome.isHighHumidity() || biome.minHeight >= 0.0F) { BiomeDictionary.registerBiomeType(biome, PLAINS); } @@ -366,14 +366,14 @@ public class BiomeDictionary BiomeDictionary.registerBiomeType(biome, DENSE); } - if (biome.isHighHumidity() && biome.rootHeight < 0.0F && (biome.heightVariation <= 0.3F && biome.heightVariation >= 0.0F)) + if (biome.isHighHumidity() && biome.minHeight < 0.0F && (biome.maxHeight <= 0.3F && biome.maxHeight >= 0.0F)) { BiomeDictionary.registerBiomeType(biome, SWAMP); } - if (biome.rootHeight <= -0.5F) + if (biome.minHeight <= -0.5F) { - if (biome.heightVariation == 0.0F) + if (biome.maxHeight == 0.0F) { BiomeDictionary.registerBiomeType(biome, RIVER); } @@ -383,12 +383,12 @@ public class BiomeDictionary } } - if (biome.heightVariation >= 0.4F && biome.heightVariation < 1.5F) + if (biome.maxHeight >= 0.4F && biome.maxHeight < 1.5F) { BiomeDictionary.registerBiomeType(biome, HILLS); } - if (biome.heightVariation >= 1.5F) + if (biome.maxHeight >= 1.5F) { BiomeDictionary.registerBiomeType(biome, MOUNTAIN); } diff --git a/src/main/java/net/minecraftforge/common/BiomeManager.java b/src/main/java/net/minecraftforge/common/BiomeManager.java index 78240f1bfc..ee584e28b5 100644 --- a/src/main/java/net/minecraftforge/common/BiomeManager.java +++ b/src/main/java/net/minecraftforge/common/BiomeManager.java @@ -19,23 +19,11 @@ import net.minecraftforge.common.util.EnumHelper; public class BiomeManager { private static TrackedList[] biomes = setupBiomes(); - - /* - * These lists should no longer be accessed directly. Instead, use the appropriate add, remove and get methods within this class. - */ - @Deprecated - public static List desertBiomes = biomes[BiomeType.DESERT.ordinal()]; - @Deprecated - public static List warmBiomes = biomes[BiomeType.WARM.ordinal()]; - @Deprecated - public static List coolBiomes = biomes[BiomeType.COOL.ordinal()]; - @Deprecated - public static List icyBiomes = biomes[BiomeType.ICY.ordinal()]; - + private static boolean isModded = false; - + public static List oceanBiomes = new ArrayList(); - + public static ArrayList strongHoldBiomes = new ArrayList(); public static ArrayList strongHoldBiomesBlackList = new ArrayList(); @@ -45,19 +33,19 @@ public class BiomeManager oceanBiomes.add(BiomeGenBase.deepOcean); oceanBiomes.add(BiomeGenBase.frozenOcean); } - + private static TrackedList[] setupBiomes() { TrackedList[] currentBiomes = new TrackedList[BiomeType.values().length]; List list = new ArrayList(); - + list.add(new BiomeEntry(BiomeGenBase.forest, 10)); list.add(new BiomeEntry(BiomeGenBase.roofedForest, 10)); list.add(new BiomeEntry(BiomeGenBase.extremeHills, 10)); list.add(new BiomeEntry(BiomeGenBase.plains, 10)); list.add(new BiomeEntry(BiomeGenBase.birchForest, 10)); list.add(new BiomeEntry(BiomeGenBase.swampland, 10)); - + currentBiomes[BiomeType.WARM.ordinal()] = new TrackedList(list); list.clear(); @@ -65,7 +53,7 @@ public class BiomeManager list.add(new BiomeEntry(BiomeGenBase.extremeHills, 10)); list.add(new BiomeEntry(BiomeGenBase.taiga, 10)); list.add(new BiomeEntry(BiomeGenBase.plains, 10)); - + currentBiomes[BiomeType.COOL.ordinal()] = new TrackedList(list); list.clear(); @@ -74,9 +62,9 @@ public class BiomeManager currentBiomes[BiomeType.ICY.ordinal()] = new TrackedList(list); list.clear(); - + currentBiomes[BiomeType.DESERT.ordinal()] = new TrackedList(list); - + return currentBiomes; } @@ -133,67 +121,67 @@ public class BiomeManager WorldChunkManager.allowedBiomes.remove(biome); } } - + public static void addBiome(BiomeType type, BiomeEntry entry) { isModded = true; - + int idx = type.ordinal(); List list = idx > biomes.length ? null : biomes[idx]; if (list != null) list.add(entry); } - + public static void removeBiome(BiomeType type, BiomeEntry entry) { isModded = true; - + int idx = type.ordinal(); List list = idx > biomes.length ? null : biomes[idx]; - + if (list != null && list.contains(entry)) { list.remove(entry); } } - + public static ImmutableList getBiomes(BiomeType type) { int idx = type.ordinal(); List list = idx > biomes.length ? null : biomes[idx]; - + return list != null ? ImmutableList.copyOf(list) : null; } - + public static boolean isTypeListModded(BiomeType type) { int idx = type.ordinal(); TrackedList list = idx > biomes.length ? null : biomes[idx]; - + if (list != null) return list.isModded(); - + return false; } - + public static enum BiomeType { DESERT, WARM, COOL, ICY; - + public static BiomeType getType(String name) { name = name.toUpperCase(); - + for (BiomeType t : values()) { if (t.name().equals(name)) return t; } - + BiomeType ret = EnumHelper.addEnum(BiomeType.class, name, BiomeType.class); - + if (ret.ordinal() >= biomes.length) { biomes = Arrays.copyOf(biomes, ret.ordinal()); } - + return ret; } } @@ -201,89 +189,89 @@ public class BiomeManager public static class BiomeEntry extends WeightedRandom.Item { public final BiomeGenBase biome; - + public BiomeEntry(BiomeGenBase biome, int weight) { super(weight); - + this.biome = biome; } } - + private static class TrackedList extends ArrayList { private boolean isModded = false; - - public TrackedList(Collection c) + + public TrackedList(Collection c) { super(c); } - + @Override - public E set(int index, E element) + public E set(int index, E element) { isModded = true; return super.set(index, element); } - + @Override - public boolean add(E e) + public boolean add(E e) { isModded = true; return super.add(e); } - + @Override - public void add(int index, E element) + public void add(int index, E element) { isModded = true; super.add(index, element); } - + @Override - public E remove(int index) + public E remove(int index) { isModded = true; return super.remove(index); } @Override - public boolean remove(Object o) + public boolean remove(Object o) { isModded = true; return super.remove(o); } @Override - public void clear() + public void clear() { isModded = true; super.clear(); } @Override - public boolean addAll(Collection c) + public boolean addAll(Collection c) { isModded = true; return super.addAll(c); } @Override - public boolean addAll(int index, Collection c) + public boolean addAll(int index, Collection c) { isModded = true; return super.addAll(index, c); } @Override - public boolean removeAll(Collection c) + public boolean removeAll(Collection c) { isModded = true; return super.removeAll(c); } @Override - public boolean retainAll(Collection c) + public boolean retainAll(Collection c) { isModded = true; return super.retainAll(c); diff --git a/src/main/java/net/minecraftforge/common/ChestGenHooks.java b/src/main/java/net/minecraftforge/common/ChestGenHooks.java index c14fb106a1..b6747a2ead 100644 --- a/src/main/java/net/minecraftforge/common/ChestGenHooks.java +++ b/src/main/java/net/minecraftforge/common/ChestGenHooks.java @@ -1,7 +1,7 @@ package net.minecraftforge.common; import java.util.*; - +import com.google.common.collect.ImmutableList; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -47,27 +47,23 @@ public class ChestGenHooks } hasInit = true; + // This causes the classes static initializers to run + new WorldGenDungeons(); + new DesertPyramid(); + new JunglePyramid(); + new StructureMineshaftPieces(); + new StructureOceanMonument(); + new StructureStrongholdPieces.ChestCorridor(); + new StructureStrongholdPieces.Library(); + new StructureStrongholdPieces.RoomCrossing(); + new StructureVillagePieces.House2(); + WorldServer.fillChestHook(); + } - addInfo(MINESHAFT_CORRIDOR, StructureMineshaftPieces.mineshaftChestContents, 3, 7); - addInfo(PYRAMID_DESERT_CHEST, DesertPyramid.itemsToGenerateInTemple, 2, 7); - addInfo(PYRAMID_JUNGLE_CHEST, JunglePyramid.junglePyramidsChestContents, 2, 7); - addInfo(PYRAMID_JUNGLE_DISPENSER, JunglePyramid.junglePyramidsDispenserContents, 2, 2); - addInfo(STRONGHOLD_CORRIDOR, ChestCorridor.strongholdChestContents, 2, 4); - addInfo(STRONGHOLD_LIBRARY, Library.strongholdLibraryChestContents, 1, 5); - addInfo(STRONGHOLD_CROSSING, RoomCrossing.strongholdRoomCrossingChestContents, 1, 5); - addInfo(VILLAGE_BLACKSMITH, House2.villageBlacksmithChestContents, 3, 9); - addInfo(BONUS_CHEST, WorldServer.bonusChestContent, 10, 10); - addInfo(DUNGEON_CHEST, WorldGenDungeons.field_111189_a, 8, 8); - - ItemStack book = new ItemStack(Items.enchanted_book, 1, 0); - WeightedRandomChestContent tmp = new WeightedRandomChestContent(book, 1, 1, 1); - getInfo(MINESHAFT_CORRIDOR ).addItem(tmp); - getInfo(PYRAMID_DESERT_CHEST).addItem(tmp); - getInfo(PYRAMID_JUNGLE_CHEST).addItem(tmp); - getInfo(STRONGHOLD_CORRIDOR ).addItem(tmp); - getInfo(STRONGHOLD_LIBRARY ).addItem(new WeightedRandomChestContent(book, 1, 5, 2)); - getInfo(STRONGHOLD_CROSSING ).addItem(tmp); - getInfo(DUNGEON_CHEST ).addItem(tmp); + // INTERNAL DO NO USE + public static void init(String category, List items, int min, int max) + { + chestInfo.put(category, new ChestGenHooks(category, (List)items, min, max)); } static void addDungeonLoot(ChestGenHooks dungeon, ItemStack item, int weight, int min, int max) @@ -75,11 +71,6 @@ public class ChestGenHooks dungeon.addItem(new WeightedRandomChestContent(item, min, max, weight)); } - private static void addInfo(String category, WeightedRandomChestContent[] items, int min, int max) - { - chestInfo.put(category, new ChestGenHooks(category, items, min, max)); - } - /** * Retrieves, or creates the info class for the specified category. * @@ -134,7 +125,7 @@ public class ChestGenHooks } //shortcut functions, See the non-static versions below - public static WeightedRandomChestContent[] getItems(String category, Random rnd){ return getInfo(category).getItems(rnd); } + public static List getItems(String category, Random rnd){ return getInfo(category).getItems(rnd); } public static int getCount(String category, Random rand){ return getInfo(category).getCount(rand); } public static void addItem(String category, WeightedRandomChestContent item){ getInfo(category).addItem(item); } public static void removeItem(String category, ItemStack item){ getInfo(category).removeItem(item); } @@ -150,7 +141,7 @@ public class ChestGenHooks this.category = category; } - public ChestGenHooks(String category, WeightedRandomChestContent[] items, int min, int max) + public ChestGenHooks(String category, List items, int min, int max) { this(category); for (WeightedRandomChestContent item : items) @@ -195,7 +186,7 @@ public class ChestGenHooks * * @return The random objects */ - public WeightedRandomChestContent[] getItems(Random rnd) + public List getItems(Random rnd) { ArrayList ret = new ArrayList(); @@ -213,7 +204,7 @@ public class ChestGenHooks } } - return ret.toArray(new WeightedRandomChestContent[ret.size()]); + return ret; } /** @@ -236,8 +227,7 @@ public class ChestGenHooks */ public ItemStack getOneItem(Random rand) { - WeightedRandomChestContent[] items = getItems(rand); - WeightedRandomChestContent item = (WeightedRandomChestContent)WeightedRandom.getRandomItem(rand, items); + WeightedRandomChestContent item = (WeightedRandomChestContent)WeightedRandom.getRandomItem(rand, getItems(rand)); ItemStack[] stacks = ChestGenHooks.generateStacks(rand, item.theItemId, item.theMinimumChanceToGenerateItem, item.theMaximumChanceToGenerateItem); return (stacks.length > 0 ? stacks[0] : null); } diff --git a/src/main/java/net/minecraftforge/common/DimensionManager.java b/src/main/java/net/minecraftforge/common/DimensionManager.java index 35069ce4ec..861c871d8e 100644 --- a/src/main/java/net/minecraftforge/common/DimensionManager.java +++ b/src/main/java/net/minecraftforge/common/DimensionManager.java @@ -17,8 +17,8 @@ import com.google.common.collect.HashMultiset; import com.google.common.collect.Lists; import com.google.common.collect.MapMaker; import com.google.common.collect.Multiset; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.FMLLog; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.FMLLog; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.world.MinecraftException; @@ -242,7 +242,7 @@ public class DimensionManager ISaveHandler savehandler = overworld.getSaveHandler(); WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo()); - WorldServer world = (dim == 0 ? overworld : new WorldServerMulti(mcServer, savehandler, overworld.getWorldInfo().getWorldName(), dim, worldSettings, overworld, mcServer.theProfiler)); + WorldServer world = (dim == 0 ? overworld : new WorldServerMulti(mcServer, savehandler, dim, overworld, mcServer.theProfiler)); world.addWorldAccess(new WorldManager(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); if (!mcServer.isSinglePlayer()) @@ -250,7 +250,7 @@ public class DimensionManager world.getWorldInfo().setGameType(mcServer.getGameType()); } - mcServer.func_147139_a(mcServer.func_147135_j()); + mcServer.setDifficultyForAllWorlds(mcServer.getDifficulty()); } public static WorldServer getWorld(int id) @@ -425,4 +425,4 @@ public class DimensionManager return null; } } -} +} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/common/FishingHooks.java b/src/main/java/net/minecraftforge/common/FishingHooks.java index 0b3eed511e..bb0a30e831 100644 --- a/src/main/java/net/minecraftforge/common/FishingHooks.java +++ b/src/main/java/net/minecraftforge/common/FishingHooks.java @@ -43,19 +43,19 @@ public class FishingHooks if (chance < junkChance) { - return ((WeightedRandomFishable)WeightedRandom.getRandomItem(rand, junk)).func_150708_a(rand); + return ((WeightedRandomFishable)WeightedRandom.getRandomItem(rand, junk)).getItemStack(rand); } chance -= junkChance; if (chance < treasureChance) { - return ((WeightedRandomFishable)WeightedRandom.getRandomItem(rand, treasure)).func_150708_a(rand); + return ((WeightedRandomFishable)WeightedRandom.getRandomItem(rand, treasure)).getItemStack(rand); } chance -= treasureChance; // this is done in EntityFishHook.func_146033_f. more loot types expected? { - return ((WeightedRandomFishable)WeightedRandom.getRandomItem(rand, fish)).func_150708_a(rand); + return ((WeightedRandomFishable)WeightedRandom.getRandomItem(rand, fish)).getItemStack(rand); } } @@ -93,15 +93,15 @@ public class FishingHooks static { - fish.addAll(EntityFishHook.field_146036_f); - junk.addAll(EntityFishHook.field_146039_d); - treasure.addAll(EntityFishHook.field_146041_e); + fish.addAll(EntityFishHook.FISH); + junk.addAll(EntityFishHook.JUNK); + treasure.addAll(EntityFishHook.VALUABLES); } public static enum FishableCategory { - JUNK(StatList.field_151183_A), - TREASURE(StatList.field_151184_B), + JUNK(StatList.junkFishedStat), + TREASURE(StatList.treasureFishedStat), FISH(StatList.fishCaughtStat); public final StatBase stat; @@ -111,4 +111,4 @@ public class FishingHooks this.stat = stat; } } -} +} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java index 59fc7353e6..4fe166f877 100644 --- a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java +++ b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java @@ -8,14 +8,13 @@ package net.minecraftforge.common; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; - import org.apache.logging.log4j.Level; - import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.google.common.collect.ArrayListMultimap; @@ -33,16 +32,16 @@ import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import com.google.common.collect.SetMultimap; import com.google.common.collect.Sets; - -import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.ModContainer; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModContainer; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.server.MinecraftServer; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.entity.Entity; +import net.minecraft.util.ClassInheritanceMultiMap; import net.minecraft.util.MathHelper; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -895,7 +894,7 @@ public class ForgeChunkManager public static void putDormantChunk(long coords, Chunk chunk) { - Cache cache = dormantChunkCache.get(chunk.worldObj); + Cache cache = dormantChunkCache.get(chunk.getWorld()); if (cache != null) { cache.put(coords, chunk); @@ -913,11 +912,12 @@ public class ForgeChunkManager Chunk chunk = cache.getIfPresent(coords); if (chunk != null) { - for (List eList : (List[])chunk.entityLists) + for (ClassInheritanceMultiMap eList : chunk.getEntityLists()) { - for (Entity e: eList) + Iterator itr = (Iterator)eList.iterator(); + while (itr.hasNext()) { - e.resetEntityId(); + (itr.next()).resetEntityId(); } } } diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index ce11752564..b84a09594a 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -1,12 +1,23 @@ package net.minecraftforge.common; +import static net.minecraft.init.Blocks.diamond_block; +import static net.minecraft.init.Blocks.diamond_ore; +import static net.minecraft.init.Blocks.emerald_block; +import static net.minecraft.init.Blocks.emerald_ore; +import static net.minecraft.init.Blocks.gold_block; +import static net.minecraft.init.Blocks.gold_ore; +import static net.minecraft.init.Blocks.lit_redstone_ore; +import static net.minecraft.init.Blocks.redstone_ore; import java.util.ArrayList; import java.util.List; +import java.util.Random; import java.util.Set; - -import cpw.mods.fml.common.eventhandler.Event; -import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -16,6 +27,7 @@ import net.minecraft.init.Items; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerRepair; import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemAxe; @@ -25,6 +37,8 @@ import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S23PacketBlockChange; @@ -32,14 +46,20 @@ import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityNote; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition.MovingObjectType; import net.minecraft.util.WeightedRandom; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraft.world.WorldSettings; import net.minecraft.world.WorldSettings.GameType; +import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; +import net.minecraftforge.common.util.BlockSnapshot; import net.minecraftforge.event.AnvilUpdateEvent; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.event.ServerChatEvent; @@ -52,11 +72,15 @@ import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingFallEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; -import net.minecraftforge.event.entity.player.PlayerOpenContainerEvent; import net.minecraftforge.event.entity.player.AnvilRepairEvent; +import net.minecraftforge.event.entity.player.AttackEntityEvent; +import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; +import net.minecraftforge.event.entity.player.PlayerOpenContainerEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.NoteBlockEvent; -import static net.minecraft.init.Blocks.*; +import net.minecraftforge.fluids.IFluidBlock; +import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraftforge.fml.relauncher.ReflectionHelper; public class ForgeHooks { @@ -71,9 +95,9 @@ public class ForgeHooks } static final List seedList = new ArrayList(); - public static ItemStack getGrassSeed(World world) + public static ItemStack getGrassSeed(Random rand) { - SeedEntry entry = (SeedEntry)WeightedRandom.getRandomItem(world.rand, seedList); + SeedEntry entry = (SeedEntry)WeightedRandom.getRandomItem(rand, seedList); if (entry == null || entry.seed == null) { return null; @@ -84,7 +108,7 @@ public class ForgeHooks private static boolean toolInit = false; //static HashSet toolEffectiveness = new HashSet(); - public static boolean canHarvestBlock(Block block, EntityPlayer player, int metadata) + public static boolean canHarvestBlock(Block block, EntityPlayer player, IBlockAccess world, BlockPos pos) { if (block.getMaterial().isToolNotRequired()) { @@ -92,7 +116,9 @@ public class ForgeHooks } ItemStack stack = player.inventory.getCurrentItem(); - String tool = block.getHarvestTool(metadata); + IBlockState state = world.getBlockState(pos); + state = state.getBlock().getActualState(state, world, pos); + String tool = block.getHarvestTool(state); if (stack == null || tool == null) { return player.canHarvestBlock(block); @@ -104,40 +130,43 @@ public class ForgeHooks return player.canHarvestBlock(block); } - return toolLevel >= block.getHarvestLevel(metadata); + return toolLevel >= block.getHarvestLevel(state); } - public static boolean canToolHarvestBlock(Block block, int metadata, ItemStack stack) + public static boolean canToolHarvestBlock(IBlockAccess world, BlockPos pos, ItemStack stack) { - String tool = block.getHarvestTool(metadata); + IBlockState state = world.getBlockState(pos); + state = state.getBlock().getActualState(state, world, pos); + String tool = state.getBlock().getHarvestTool(state); if (stack == null || tool == null) return false; - return stack.getItem().getHarvestLevel(stack, tool) >= block.getHarvestLevel(metadata); + return stack.getItem().getHarvestLevel(stack, tool) >= state.getBlock().getHarvestLevel(state); } - public static float blockStrength(Block block, EntityPlayer player, World world, int x, int y, int z) + public static float blockStrength(IBlockState state, EntityPlayer player, World world, BlockPos pos) { - int metadata = world.getBlockMetadata(x, y, z); - float hardness = block.getBlockHardness(world, x, y, z); + float hardness = state.getBlock().getBlockHardness(world, pos); if (hardness < 0.0F) { return 0.0F; } - if (!canHarvestBlock(block, player, metadata)) + if (!canHarvestBlock(state.getBlock(), player, world, pos)) { - return player.getBreakSpeed(block, true, metadata, x, y, z) / hardness / 100F; + return player.getBreakSpeed(state, pos) / hardness / 100F; } else { - return player.getBreakSpeed(block, false, metadata, x, y, z) / hardness / 30F; + return player.getBreakSpeed(state, pos) / hardness / 30F; } } - public static boolean isToolEffective(ItemStack stack, Block block, int metadata) + public static boolean isToolEffective(IBlockAccess world, BlockPos pos, ItemStack stack) { + IBlockState state = world.getBlockState(pos); + state = state.getBlock().getActualState(state, world, pos); for (String type : stack.getItem().getToolClasses(stack)) { - if (block.isToolEffective(type, metadata)) + if (state.getBlock().isToolEffective(type, state)) return true; } return false; @@ -211,20 +240,21 @@ public class ForgeHooks { ItemStack result = null; boolean isCreative = player.capabilities.isCreativeMode; + TileEntity te = null; if (target.typeOfHit == MovingObjectType.BLOCK) { - int x = target.blockX; - int y = target.blockY; - int z = target.blockZ; - Block block = world.getBlock(x, y, z); + IBlockState state = world.getBlockState(target.func_178782_a()); - if (block.isAir(world, x, y, z)) + if (state.getBlock().isAir(world, target.func_178782_a())) { return false; } - result = block.getPickBlock(target, world, x, y, z, player); + if (isCreative && GuiScreen.isCtrlKeyDown()) + te = world.getTileEntity(target.func_178782_a()); + + result = state.getBlock().getPickBlock(target, world, target.func_178782_a()); } else { @@ -241,6 +271,20 @@ public class ForgeHooks return false; } + if (te != null) + { + NBTTagCompound nbt = new NBTTagCompound(); + te.writeToNBT(nbt); + result.setTagInfo("BlockEntityTag", nbt); + + NBTTagCompound display = new NBTTagCompound(); + result.setTagInfo("display", display); + + NBTTagList lore = new NBTTagList(); + display.setTag("Lore", lore); + lore.appendTag(new NBTTagString("(+NBT)")); + } + for (int x = 0; x < 9; x++) { ItemStack stack = player.inventory.getStackInSlot(x); @@ -296,26 +340,28 @@ public class ForgeHooks return MinecraftForge.EVENT_BUS.post(new LivingDeathEvent(entity, src)); } - public static boolean onLivingDrops(EntityLivingBase entity, DamageSource source, ArrayList drops, int lootingLevel, boolean recentlyHit, int specialDropValue) + public static boolean onLivingDrops(EntityLivingBase entity, DamageSource source, ArrayList drops, int lootingLevel, boolean recentlyHit) { - return MinecraftForge.EVENT_BUS.post(new LivingDropsEvent(entity, source, drops, lootingLevel, recentlyHit, specialDropValue)); + return MinecraftForge.EVENT_BUS.post(new LivingDropsEvent(entity, source, drops, lootingLevel, recentlyHit)); } - public static float onLivingFall(EntityLivingBase entity, float distance) + public static float[] onLivingFall(EntityLivingBase entity, float distance, float damageMultiplier) { - LivingFallEvent event = new LivingFallEvent(entity, distance); - return (MinecraftForge.EVENT_BUS.post(event) ? 0.0f : event.distance); + LivingFallEvent event = new LivingFallEvent(entity, distance, damageMultiplier); + return (MinecraftForge.EVENT_BUS.post(event) ? null : new float[]{event.distance, event.damageMultiplier}); } - public static boolean isLivingOnLadder(Block block, World world, int x, int y, int z, EntityLivingBase entity) + public static boolean isLivingOnLadder(Block block, World world, BlockPos pos, EntityLivingBase entity) { + boolean isSpectator = (entity instanceof EntityPlayer && ((EntityPlayer)entity).func_175149_v()); + if (isSpectator) return false; if (!ForgeModContainer.fullBoundingBoxLadders) { - return block != null && block.isLadder(world, x, y, z, entity); + return block != null && block.isLadder(world, pos, entity) && isSpectator; } else { - AxisAlignedBB bb = entity.boundingBox; + AxisAlignedBB bb = entity.getEntityBoundingBox(); int mX = MathHelper.floor_double(bb.minX); int mY = MathHelper.floor_double(bb.minY); int mZ = MathHelper.floor_double(bb.minZ); @@ -325,8 +371,8 @@ public class ForgeHooks { for (int z2 = mZ; z2 < bb.maxZ; z2++) { - block = world.getBlock(x2, y2, z2); - if (block != null && block.isLadder(world, x2, y2, z2, entity)) + BlockPos tmp = new BlockPos(x2, y2, z2); + if (world.getBlockState(tmp).getBlock().isLadder(world, tmp, entity)) { return true; } @@ -364,9 +410,9 @@ public class ForgeHooks return event.entityItem; } - public static float getEnchantPower(World world, int x, int y, int z) + public static float getEnchantPower(World world, BlockPos pos) { - return world.getBlock(x, y, z).getEnchantPowerBonus(world, x, y, z); + return world.getBlockState(pos).getBlock().getEnchantPowerBonus(world, pos); } public static ChatComponentTranslation onServerChatEvent(NetHandlerPlayServer net, String raw, ChatComponentTranslation comp) @@ -386,32 +432,37 @@ public class ForgeHooks return event.getResult() == Event.Result.DEFAULT ? event.canInteractWith : event.getResult() == Event.Result.ALLOW ? true : false; } - public static BlockEvent.BreakEvent onBlockBreakEvent(World world, GameType gameType, EntityPlayerMP entityPlayer, int x, int y, int z) + public static int onBlockBreakEvent(World world, GameType gameType, EntityPlayerMP entityPlayer, BlockPos pos) { // Logic from tryHarvestBlock for pre-canceling the event boolean preCancelEvent = false; - if (gameType.isAdventure() && !entityPlayer.isCurrentToolAdventureModeExempt(x, y, z)) - { + if (gameType.isCreative() && entityPlayer.getHeldItem() != null && entityPlayer.getHeldItem().getItem() instanceof ItemSword) preCancelEvent = true; - } - else if (gameType.isCreative() && entityPlayer.getHeldItem() != null && entityPlayer.getHeldItem().getItem() instanceof ItemSword) + + if (gameType.isAdventure()) { - preCancelEvent = true; + if (gameType == WorldSettings.GameType.SPECTATOR) + preCancelEvent = true; + + if (!entityPlayer.func_175142_cm()) + { + ItemStack itemstack = entityPlayer.getCurrentEquippedItem(); + if (itemstack == null || !itemstack.canDestroy(world.getBlockState(pos).getBlock())) + preCancelEvent = true; + } } // Tell client the block is gone immediately then process events - if (world.getTileEntity(x, y, z) == null) + if (world.getTileEntity(pos) == null) { - S23PacketBlockChange packet = new S23PacketBlockChange(x, y, z, world); - packet.field_148883_d = Blocks.air; - packet.field_148884_e = 0; + S23PacketBlockChange packet = new S23PacketBlockChange(world, pos); + packet.field_148883_d = Blocks.air.getDefaultState(); entityPlayer.playerNetServerHandler.sendPacket(packet); } // Post the block break event - Block block = world.getBlock(x, y, z); - int blockMetadata = world.getBlockMetadata(x, y, z); - BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(x, y, z, world, block, blockMetadata, entityPlayer); + IBlockState state = world.getBlockState(pos); + BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, pos, state, entityPlayer); event.setCanceled(preCancelEvent); MinecraftForge.EVENT_BUS.post(event); @@ -419,10 +470,10 @@ public class ForgeHooks if (event.isCanceled()) { // Let the client know the block still exists - entityPlayer.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world)); + entityPlayer.playerNetServerHandler.sendPacket(new S23PacketBlockChange(world, pos)); // Update any tile entity data for this block - TileEntity tileentity = world.getTileEntity(x, y, z); + TileEntity tileentity = world.getTileEntity(pos); if (tileentity != null) { Packet pkt = tileentity.getDescriptionPacket(); @@ -432,10 +483,10 @@ public class ForgeHooks } } } - return event; + return event.isCanceled() ? -1 : event.getExpToDrop(); } - public static boolean onPlaceItemIntoWorld(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) + public static boolean onPlaceItemIntoWorld(ItemStack itemstack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { // handle all placement events here int meta = itemstack.getItemDamage(); @@ -451,7 +502,7 @@ public class ForgeHooks world.captureBlockSnapshots = true; } - boolean flag = itemstack.getItem().onItemUse(itemstack, player, world, x, y, z, side, hitX, hitY, hitZ); + boolean flag = itemstack.getItem().onItemUse(itemstack, player, world, pos, side, hitX, hitY, hitZ); world.captureBlockSnapshots = false; if (flag) @@ -465,7 +516,7 @@ public class ForgeHooks newNBT = (NBTTagCompound)itemstack.getTagCompound().copy(); } net.minecraftforge.event.world.BlockEvent.PlaceEvent placeEvent = null; - List blockSnapshots = (List) world.capturedBlockSnapshots.clone(); + List blockSnapshots = (List)world.capturedBlockSnapshots.clone(); world.capturedBlockSnapshots.clear(); // make sure to set pre-placement item data for event @@ -477,11 +528,11 @@ public class ForgeHooks } if (blockSnapshots.size() > 1) { - placeEvent = ForgeEventFactory.onPlayerMultiBlockPlace(player, blockSnapshots, net.minecraftforge.common.util.ForgeDirection.getOrientation(side)); + placeEvent = ForgeEventFactory.onPlayerMultiBlockPlace(player, blockSnapshots, side); } else if (blockSnapshots.size() == 1) { - placeEvent = ForgeEventFactory.onPlayerBlockPlace(player, blockSnapshots.get(0), net.minecraftforge.common.util.ForgeDirection.getOrientation(side)); + placeEvent = ForgeEventFactory.onPlayerBlockPlace(player, blockSnapshots.get(0), side); } if (placeEvent != null && (placeEvent.isCanceled())) @@ -505,21 +556,17 @@ public class ForgeHooks itemstack.setTagCompound(newNBT); } - for (net.minecraftforge.common.util.BlockSnapshot blocksnapshot : blockSnapshots) + for (BlockSnapshot snap : blockSnapshots) { - int blockX = blocksnapshot.x; - int blockY = blocksnapshot.y; - int blockZ = blocksnapshot.z; - int metadata = world.getBlockMetadata(blockX, blockY, blockZ); - int updateFlag = blocksnapshot.flag; - Block oldBlock = blocksnapshot.replacedBlock; - Block newBlock = world.getBlock(blockX, blockY, blockZ); - if (newBlock != null && !(newBlock.hasTileEntity(metadata))) // Containers get placed automatically + int updateFlag = snap.flag; + IBlockState oldBlock = snap.replacedBlock; + IBlockState newBlock = world.getBlockState(snap.pos); + if (newBlock != null && !(newBlock.getBlock().hasTileEntity(newBlock))) // Containers get placed automatically { - newBlock.onBlockAdded(world, blockX, blockY, blockZ); + newBlock.getBlock().onBlockAdded(world, snap.pos, newBlock); } - world.markAndNotifyBlock(blockX, blockY, blockZ, null, oldBlock, newBlock, updateFlag); + world.markAndNotifyBlock(snap.pos, null, oldBlock, newBlock, updateFlag); } player.addStat(StatList.objectUseStats[Item.getIdFromItem(itemstack.getItem())], 1); } @@ -537,7 +584,7 @@ public class ForgeHooks outputSlot.setInventorySlotContents(0, e.output); container.maximumCost = e.cost; - container.stackSizeToBeUsedInRepair = e.materialCost; + container.materialCost = e.materialCost; return false; } @@ -550,7 +597,7 @@ public class ForgeHooks public static boolean onNoteChange(TileEntityNote te, byte old) { - NoteBlockEvent.Change e = new NoteBlockEvent.Change(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.getBlockMetadata(), old, te.note); + NoteBlockEvent.Change e = new NoteBlockEvent.Change(te.getWorld(), te.getPos(), te.getWorld().getBlockState(te.getPos()), old, te.note); if (MinecraftForge.EVENT_BUS.post(e)) { te.note = old; @@ -559,4 +606,90 @@ public class ForgeHooks te.note = (byte)e.getVanillaNoteId(); return true; } + + /** + * Default implementation of IRecipe.func_179532_b {getRemainingItems} because + * this is just copy pasted over a lot of recipes. + * + * Another use case for java 8 but sadly we can't use it! + * + * @param inv Crafting inventory + * @return Crafting inventory contents after the recipe. + */ + public static ItemStack[] defaultRecipeGetRemainingItems(InventoryCrafting inv) + { + ItemStack[] ret = new ItemStack[inv.getSizeInventory()]; + for (int i = 0; i < ret.length; i++) + { + ret[i] = getContainerItem(inv.getStackInSlot(i)); + } + return ret; + } + + private static ThreadLocal craftingPlayer = new ThreadLocal(); + public static void setCraftingPlayer(EntityPlayer player) + { + craftingPlayer.set(player); + } + public static EntityPlayer getCraftingPlayer() + { + return craftingPlayer.get(); + } + public static ItemStack getContainerItem(ItemStack stack) + { + if (stack == null) return null; + + if (stack.getItem().hasContainerItem(stack)) + { + stack = stack.getItem().getContainerItem(stack); + if (stack != null && stack.isItemStackDamageable() && stack.getMetadata() > stack.getMaxDamage()) + { + MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(craftingPlayer.get(), stack)); + return null; + } + return stack; + } + return null; + } + + public static WorldGeneratorBonusChest getBonusChest(Random rand) + { + return new WorldGeneratorBonusChest(ChestGenHooks.getItems(ChestGenHooks.BONUS_CHEST, rand), ChestGenHooks.getCount(ChestGenHooks.BONUS_CHEST, rand)); + } + + public static boolean isInsideOfMaterial(Material material, Entity entity, BlockPos pos) + { + IBlockState state = entity.worldObj.getBlockState(pos); + Block block = state.getBlock(); + double eyes = entity.posY + (double)entity.getEyeHeight(); + + double filled = 1.0f; //If it's not a liquid assume it's a solid block + if (block instanceof IFluidBlock) + { + filled = ((IFluidBlock)block).getFilledPercentage(entity.worldObj, pos); + } + else if (block instanceof BlockLiquid) + { + filled = BlockLiquid.getLiquidHeightPercent(block.getMetaFromState(state)); + } + + if (filled < 0) + { + filled *= -1; + //filled -= 0.11111111F; //Why this is needed.. not sure... + return eyes > (double)(pos.getY() + 1 + (1 - filled)); + } + else + { + return eyes < (double)(pos.getY() + 1 + filled); + } + } + + public static boolean onPlayerAttackTarget(EntityPlayer player, Entity target) + { + if (MinecraftForge.EVENT_BUS.post(new AttackEntityEvent(player, target))) return false; + ItemStack stack = player.getCurrentEquippedItem(); + if (stack != null && stack.getItem().onLeftClickEntity(stack, player, target)) return false; + return true; + } } diff --git a/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java b/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java index 1847fd9544..f1a0f243da 100644 --- a/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java +++ b/src/main/java/net/minecraftforge/common/ForgeInternalHandler.java @@ -1,8 +1,8 @@ package net.minecraftforge.common; -import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.common.eventhandler.EventPriority; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.Item; diff --git a/src/main/java/net/minecraftforge/common/ForgeModContainer.java b/src/main/java/net/minecraftforge/common/ForgeModContainer.java index 526aae297d..6ac7c6c15a 100644 --- a/src/main/java/net/minecraftforge/common/ForgeModContainer.java +++ b/src/main/java/net/minecraftforge/common/ForgeModContainer.java @@ -34,25 +34,25 @@ import com.google.common.collect.ImmutableList; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; -import cpw.mods.fml.client.FMLFileResourcePack; -import cpw.mods.fml.client.FMLFolderResourcePack; -import cpw.mods.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent; -import cpw.mods.fml.common.DummyModContainer; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.common.LoadController; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.ModMetadata; -import cpw.mods.fml.common.WorldAccessContainer; -import cpw.mods.fml.common.event.FMLConstructionEvent; -import cpw.mods.fml.common.event.FMLLoadCompleteEvent; -import cpw.mods.fml.common.event.FMLModIdMappingEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.event.FMLServerStartingEvent; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent; -import cpw.mods.fml.common.network.NetworkRegistry; +import net.minecraftforge.fml.client.FMLFileResourcePack; +import net.minecraftforge.fml.client.FMLFolderResourcePack; +import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent; +import net.minecraftforge.fml.common.DummyModContainer; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.LoadController; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModMetadata; +import net.minecraftforge.fml.common.WorldAccessContainer; +import net.minecraftforge.fml.common.event.FMLConstructionEvent; +import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent; +import net.minecraftforge.fml.common.event.FMLModIdMappingEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.PlayerEvent; +import net.minecraftforge.fml.common.network.NetworkRegistry; public class ForgeModContainer extends DummyModContainer implements WorldAccessContainer { @@ -190,9 +190,9 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC FMLLog.warning("Enabling removal of erroring Tile Entities - USE AT YOUR OWN RISK"); } - //prop = config.get(Configuration.CATEGORY_GENERAL, "disableStitchedFileSaving", true); - //prop.comment = "Set this to just disable the texture stitcher from writing the 'debug.stitched_{name}.png file to disc. Just a small performance tweak. Default: true"; - //disableStitchedFileSaving = prop.getBoolean(true); + prop = config.get(Configuration.CATEGORY_GENERAL, "disableStitchedFileSaving", true); + prop.comment = "Set this to just disable the texture stitcher from writing the '{name}_{mipmap}.png files to disc. Just a small performance tweak. Default: true"; + disableStitchedFileSaving = prop.getBoolean(true); prop = config.get(Configuration.CATEGORY_GENERAL, "fullBoundingBoxLadders", false); prop.comment = "Set this to true to check the entire entity's collision bounding box for ladders instead of just the block they are in. Causes noticable differences in mechanics so default is vanilla behavior. Default: false"; @@ -253,7 +253,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC } } } - + @SubscribeEvent public void playerLogin(PlayerEvent.PlayerLoggedInEvent event) { @@ -321,7 +321,6 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC @Subscribe public void mappingChanged(FMLModIdMappingEvent evt) { - Blocks.fire.rebuildFireInfo(); OreDictionary.rebakeMap(); } diff --git a/src/main/java/net/minecraftforge/common/ForgeVersion.java b/src/main/java/net/minecraftforge/common/ForgeVersion.java index 88ec7b55d4..122948c4bf 100644 --- a/src/main/java/net/minecraftforge/common/ForgeVersion.java +++ b/src/main/java/net/minecraftforge/common/ForgeVersion.java @@ -13,17 +13,17 @@ import java.util.Map; import com.google.common.io.ByteStreams; import com.google.gson.Gson; -import cpw.mods.fml.common.versioning.ArtifactVersion; -import cpw.mods.fml.common.versioning.DefaultArtifactVersion; +import net.minecraftforge.fml.common.versioning.ArtifactVersion; +import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; public class ForgeVersion { //This number is incremented every time we remove deprecated code/major API changes, never reset - public static final int majorVersion = 10; + public static final int majorVersion = 11; //This number is incremented every minecraft release, never reset - public static final int minorVersion = 13; + public static final int minorVersion = 14; //This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version - public static final int revisionVersion = 2; + public static final int revisionVersion = 0; //This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code. public static final int buildVersion = 0; diff --git a/src/main/java/net/minecraftforge/common/IPlantable.java b/src/main/java/net/minecraftforge/common/IPlantable.java index d316bf7dc7..a01630606b 100644 --- a/src/main/java/net/minecraftforge/common/IPlantable.java +++ b/src/main/java/net/minecraftforge/common/IPlantable.java @@ -1,11 +1,12 @@ package net.minecraftforge.common; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; import net.minecraft.world.IBlockAccess; public interface IPlantable { - public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z); - public Block getPlant(IBlockAccess world, int x, int y, int z); - public int getPlantMetadata(IBlockAccess world, int x, int y, int z); + public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos); + public IBlockState getPlant(IBlockAccess world, BlockPos pos); } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/common/IShearable.java b/src/main/java/net/minecraftforge/common/IShearable.java index a5717c57a1..6b31ca790d 100644 --- a/src/main/java/net/minecraftforge/common/IShearable.java +++ b/src/main/java/net/minecraftforge/common/IShearable.java @@ -1,8 +1,9 @@ package net.minecraftforge.common; import java.util.ArrayList; - +import java.util.List; import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; import net.minecraft.world.IBlockAccess; /** @@ -21,12 +22,10 @@ public interface IShearable * * @param item The itemstack that is being used, Possible to be null * @param world The current world - * @param x The X Position - * @param y The Y Position - * @param z The Z Position + * @param pos Block's position in world. * @return If this is shearable, and onSheared should be called. */ - public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z); + public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos); /** * Performs the shear function on this object. @@ -42,11 +41,9 @@ public interface IShearable * * @param item The itemstack that is being used, Possible to be null * @param world The current world - * @param x The X Position - * @param y The Y Position - * @param z The Z Position + * @param pos If this is a block, the block's position in world. * @param fortune The fortune level of the shears being used * @return A ArrayList containing all items from this shearing. Possible to be null. */ - public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune); + public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune); } diff --git a/src/main/java/net/minecraftforge/common/ISpecialArmor.java b/src/main/java/net/minecraftforge/common/ISpecialArmor.java index cb672d67be..acff2957da 100644 --- a/src/main/java/net/minecraftforge/common/ISpecialArmor.java +++ b/src/main/java/net/minecraftforge/common/ISpecialArmor.java @@ -64,7 +64,7 @@ public interface ISpecialArmor * @param slot The armor slot the item is in. */ public abstract void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot); - + public static class ArmorProperties implements Comparable { public int Priority = 0; @@ -90,7 +90,7 @@ public interface ISpecialArmor * @param damage The total damage being done * @return The left over damage that has not been absorbed by the armor */ - public static float ApplyArmor(EntityLivingBase entity, ItemStack[] inventory, DamageSource source, double damage) + public static float applyArmor(EntityLivingBase entity, ItemStack[] inventory, DamageSource source, double damage) { if (DEBUG) { diff --git a/src/main/java/net/minecraftforge/common/MinecraftForge.java b/src/main/java/net/minecraftforge/common/MinecraftForge.java index 1e2f0158a3..1393e10e54 100644 --- a/src/main/java/net/minecraftforge/common/MinecraftForge.java +++ b/src/main/java/net/minecraftforge/common/MinecraftForge.java @@ -1,8 +1,8 @@ package net.minecraftforge.common; -import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.eventhandler.EventBus; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.eventhandler.EventBus; import net.minecraft.crash.CrashReport; import net.minecraft.item.ItemStack; import net.minecraftforge.common.ForgeHooks.SeedEntry; diff --git a/src/main/java/net/minecraftforge/common/UsernameCache.java b/src/main/java/net/minecraftforge/common/UsernameCache.java index aac029be2a..68772c0fa3 100644 --- a/src/main/java/net/minecraftforge/common/UsernameCache.java +++ b/src/main/java/net/minecraftforge/common/UsernameCache.java @@ -23,7 +23,7 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonSyntaxException; -import cpw.mods.fml.relauncher.FMLInjectionData; +import net.minecraftforge.fml.relauncher.FMLInjectionData; /** * Caches player's last known usernames diff --git a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java index aaf2256c79..0dd9d6cc9d 100644 --- a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java +++ b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java @@ -23,8 +23,6 @@ public class WorldSpecificSaveHandler implements ISaveHandler { this.world = world; this.parent = parent; - dataDir = new File(world.getChunkSaveLocation(), "data"); - dataDir.mkdirs(); } @Override public WorldInfo loadWorldInfo() { return parent.loadWorldInfo(); } @@ -32,7 +30,7 @@ public class WorldSpecificSaveHandler implements ISaveHandler @Override public IChunkLoader getChunkLoader(WorldProvider var1) { return parent.getChunkLoader(var1); } @Override public void saveWorldInfoWithPlayer(WorldInfo var1, NBTTagCompound var2) { parent.saveWorldInfoWithPlayer(var1, var2); } @Override public void saveWorldInfo(WorldInfo var1){ parent.saveWorldInfo(var1); } - @Override public IPlayerFileData getSaveHandler() { return parent.getSaveHandler(); } + @Override public IPlayerFileData getPlayerNBTManager() { return parent.getPlayerNBTManager(); } @Override public void flush() { parent.flush(); } @Override public String getWorldDirectoryName() { return parent.getWorldDirectoryName(); } @Override public File getWorldDirectory() { return parent.getWorldDirectory(); } @@ -40,6 +38,11 @@ public class WorldSpecificSaveHandler implements ISaveHandler @Override public File getMapFileFromName(String name) { + if (dataDir == null) //Delayed down here do that world has time to be initalized first. + { + dataDir = new File(world.getChunkSaveLocation(), "data"); + dataDir.mkdirs(); + } return new File(dataDir, name + ".dat"); } diff --git a/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java b/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java index f4982c97b4..0ed52202fb 100644 --- a/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java +++ b/src/main/java/net/minecraftforge/common/chunkio/ChunkIOProvider.java @@ -40,13 +40,13 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider { diff --git a/src/main/java/net/minecraftforge/common/config/ConfigElement.java b/src/main/java/net/minecraftforge/common/config/ConfigElement.java index d35ee4411a..c3ddf14bea 100644 --- a/src/main/java/net/minecraftforge/common/config/ConfigElement.java +++ b/src/main/java/net/minecraftforge/common/config/ConfigElement.java @@ -11,41 +11,41 @@ import java.util.Iterator; import java.util.List; import java.util.regex.Pattern; -import cpw.mods.fml.client.config.ConfigGuiType; -import cpw.mods.fml.client.config.GuiConfigEntries.IConfigEntry; -import cpw.mods.fml.client.config.GuiEditArrayEntries.IArrayEntry; -import cpw.mods.fml.client.config.IConfigElement; +import net.minecraftforge.fml.client.config.ConfigGuiType; +import net.minecraftforge.fml.client.config.GuiConfigEntries.IConfigEntry; +import net.minecraftforge.fml.client.config.GuiEditArrayEntries.IArrayEntry; +import net.minecraftforge.fml.client.config.IConfigElement; /** * This class bridges the gap between the FML config GUI classes and the Forge Configuration classes. */ -public class ConfigElement implements IConfigElement +public class ConfigElement implements IConfigElement { private Property prop; private Property.Type type; private boolean isProperty; private ConfigCategory ctgy; private boolean categoriesFirst = true; - + public ConfigElement(ConfigCategory ctgy) { this.ctgy = ctgy; isProperty = false; } - + public ConfigElement(Property prop) { this.prop = prop; this.type = prop.getType(); this.isProperty = true; } - - public ConfigElement listCategoriesFirst(boolean categoriesFirst) + + public ConfigElement listCategoriesFirst(boolean categoriesFirst) { this.categoriesFirst = categoriesFirst; return this; } - + @Override public List getChildElements() { @@ -55,7 +55,7 @@ public class ConfigElement implements IConfigElement Iterator ccI = ctgy.getChildren().iterator(); Iterator pI = ctgy.getOrderedValues().iterator(); int index = 0; - + if (categoriesFirst) while (ccI.hasNext()) { @@ -63,14 +63,14 @@ public class ConfigElement implements IConfigElement if (temp.showInGui()) // don't bother adding elements that shouldn't show elements.add(temp); } - + while (pI.hasNext()) { - ConfigElement temp = getTypedElement(pI.next()); + ConfigElement temp = new ConfigElement(pI.next()); if (temp.showInGui()) elements.add(temp); } - + if (!categoriesFirst) while (ccI.hasNext()) { @@ -78,39 +78,24 @@ public class ConfigElement implements IConfigElement if (temp.showInGui()) elements.add(temp); } - + return elements; } return null; } - - public static ConfigElement getTypedElement(Property prop) - { - switch (getType(prop)) - { - case BOOLEAN: - return new ConfigElement(prop); - case DOUBLE: - return new ConfigElement(prop); - case INTEGER: - return new ConfigElement(prop); - default: - return new ConfigElement(prop); - } - } - + @Override public String getName() { return isProperty ? prop.getName() : ctgy.getName(); } - + @Override public boolean isProperty() { return isProperty; } - + @Override public Class getConfigEntryClass() { @@ -122,63 +107,63 @@ public class ConfigElement implements IConfigElement { return isProperty ? prop.getArrayEntryClass() : null; } - + @Override public String getQualifiedName() { return isProperty ? prop.getName() : ctgy.getQualifiedName(); } - + @Override public ConfigGuiType getType() { return isProperty ? getType(this.prop) : ConfigGuiType.CONFIG_CATEGORY; } - + public static ConfigGuiType getType(Property prop) { - return prop.getType() == Property.Type.BOOLEAN ? ConfigGuiType.BOOLEAN : prop.getType() == Property.Type.DOUBLE ? ConfigGuiType.DOUBLE : - prop.getType() == Property.Type.INTEGER ? ConfigGuiType.INTEGER : prop.getType() == Property.Type.COLOR ? ConfigGuiType.COLOR : + return prop.getType() == Property.Type.BOOLEAN ? ConfigGuiType.BOOLEAN : prop.getType() == Property.Type.DOUBLE ? ConfigGuiType.DOUBLE : + prop.getType() == Property.Type.INTEGER ? ConfigGuiType.INTEGER : prop.getType() == Property.Type.COLOR ? ConfigGuiType.COLOR : prop.getType() == Property.Type.MOD_ID ? ConfigGuiType.MOD_ID : ConfigGuiType.STRING; } - + @Override public boolean isList() { return isProperty && prop.isList(); } - + @Override public boolean isListLengthFixed() { return isProperty && prop.isListLengthFixed(); } - + @Override public int getMaxListLength() { return isProperty ? prop.getMaxListLength() : -1; } - + @Override public String getComment() { return isProperty ? prop.comment : ctgy.getComment(); } - + @Override public boolean isDefault() { return !isProperty || prop.isDefault(); } - + @Override public void setToDefault() { if (isProperty) prop.setToDefault(); } - + @Override public boolean requiresWorldRestart() { @@ -196,25 +181,25 @@ public class ConfigElement implements IConfigElement { return isProperty ? prop.requiresMcRestart() : ctgy.requiresMcRestart(); } - + @Override public String[] getValidValues() { return isProperty ? prop.getValidValues() : null; } - + @Override public String getLanguageKey() { return isProperty ? prop.getLanguageKey() : ctgy.getLanguagekey(); } - + @Override public Object getDefault() { - return isProperty ? (T) prop.getDefault() : null; + return isProperty ? prop.getDefault() : null; } - + @Override public Object[] getDefaults() { @@ -247,7 +232,7 @@ public class ConfigElement implements IConfigElement } return null; } - + @Override public Pattern getValidationPattern() { @@ -257,7 +242,7 @@ public class ConfigElement implements IConfigElement @Override public Object get() { - return isProperty ? (T) prop.getString() : null; + return isProperty ? prop.getString() : null; } @Override @@ -294,7 +279,7 @@ public class ConfigElement implements IConfigElement } @Override - public void set(T value) + public void set(Object value) { if (isProperty) { @@ -310,7 +295,7 @@ public class ConfigElement implements IConfigElement } @Override - public void set(T[] aVal) + public void set(Object[] aVal) { if (isProperty) { @@ -346,14 +331,14 @@ public class ConfigElement implements IConfigElement } @Override - public T getMinValue() + public Object getMinValue() { - return isProperty ? (T) prop.getMinValue() : null; + return isProperty ? prop.getMinValue() : null; } @Override - public T getMaxValue() + public Object getMaxValue() { - return isProperty ? (T) prop.getMaxValue() : null; + return isProperty ? prop.getMaxValue() : null; } } diff --git a/src/main/java/net/minecraftforge/common/config/Configuration.java b/src/main/java/net/minecraftforge/common/config/Configuration.java index 6e031385b3..3fd9bcad74 100644 --- a/src/main/java/net/minecraftforge/common/config/Configuration.java +++ b/src/main/java/net/minecraftforge/common/config/Configuration.java @@ -36,10 +36,10 @@ import java.util.regex.Pattern; import com.google.common.base.CharMatcher; import com.google.common.collect.ImmutableSet; -import cpw.mods.fml.client.config.GuiConfigEntries.IConfigEntry; -import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.relauncher.FMLInjectionData; +import net.minecraftforge.fml.client.config.GuiConfigEntries.IConfigEntry; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.relauncher.FMLInjectionData; /** * This class offers advanced configurations capabilities, allowing to provide diff --git a/src/main/java/net/minecraftforge/common/config/Property.java b/src/main/java/net/minecraftforge/common/config/Property.java index 3b86237c87..094ad0c49a 100644 --- a/src/main/java/net/minecraftforge/common/config/Property.java +++ b/src/main/java/net/minecraftforge/common/config/Property.java @@ -9,8 +9,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.regex.Pattern; -import cpw.mods.fml.client.config.GuiConfigEntries.IConfigEntry; -import cpw.mods.fml.client.config.GuiEditArrayEntries.IArrayEntry; +import net.minecraftforge.fml.client.config.GuiConfigEntries.IConfigEntry; +import net.minecraftforge.fml.client.config.GuiEditArrayEntries.IArrayEntry; public class Property { diff --git a/src/main/java/net/minecraftforge/common/network/DimensionMessageHandler.java b/src/main/java/net/minecraftforge/common/network/DimensionMessageHandler.java index 7922109856..010f6ee9d6 100644 --- a/src/main/java/net/minecraftforge/common/network/DimensionMessageHandler.java +++ b/src/main/java/net/minecraftforge/common/network/DimensionMessageHandler.java @@ -5,7 +5,7 @@ import io.netty.channel.SimpleChannelInboundHandler; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.network.ForgeMessage.DimensionRegisterMessage; import org.apache.logging.log4j.Level; -import cpw.mods.fml.common.FMLLog; +import net.minecraftforge.fml.common.FMLLog; public class DimensionMessageHandler extends SimpleChannelInboundHandler{ @Override diff --git a/src/main/java/net/minecraftforge/common/network/FluidIdRegistryMessageHandler.java b/src/main/java/net/minecraftforge/common/network/FluidIdRegistryMessageHandler.java index 032ff758e3..975462a305 100644 --- a/src/main/java/net/minecraftforge/common/network/FluidIdRegistryMessageHandler.java +++ b/src/main/java/net/minecraftforge/common/network/FluidIdRegistryMessageHandler.java @@ -4,7 +4,7 @@ import net.minecraftforge.fluids.FluidRegistry; import org.apache.logging.log4j.Level; -import cpw.mods.fml.common.FMLLog; +import net.minecraftforge.fml.common.FMLLog; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; diff --git a/src/main/java/net/minecraftforge/common/network/ForgeMessage.java b/src/main/java/net/minecraftforge/common/network/ForgeMessage.java index 72f44d79e8..cbcf439f58 100644 --- a/src/main/java/net/minecraftforge/common/network/ForgeMessage.java +++ b/src/main/java/net/minecraftforge/common/network/ForgeMessage.java @@ -7,7 +7,7 @@ import net.minecraftforge.fluids.FluidRegistry; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; -import cpw.mods.fml.common.network.ByteBufUtils; +import net.minecraftforge.fml.common.network.ByteBufUtils; import io.netty.buffer.ByteBuf; public abstract class ForgeMessage { diff --git a/src/main/java/net/minecraftforge/common/network/ForgeNetworkHandler.java b/src/main/java/net/minecraftforge/common/network/ForgeNetworkHandler.java index 493532f8ae..9095c86fac 100644 --- a/src/main/java/net/minecraftforge/common/network/ForgeNetworkHandler.java +++ b/src/main/java/net/minecraftforge/common/network/ForgeNetworkHandler.java @@ -2,12 +2,12 @@ package net.minecraftforge.common.network; import java.util.EnumMap; import net.minecraftforge.common.ForgeModContainer; -import cpw.mods.fml.common.network.FMLEmbeddedChannel; -import cpw.mods.fml.common.network.FMLOutboundHandler; -import cpw.mods.fml.common.network.FMLOutboundHandler.OutboundTarget; -import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import net.minecraftforge.fml.common.network.FMLEmbeddedChannel; +import net.minecraftforge.fml.common.network.FMLOutboundHandler; +import net.minecraftforge.fml.common.network.FMLOutboundHandler.OutboundTarget; +import net.minecraftforge.fml.common.network.NetworkRegistry; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; public class ForgeNetworkHandler { diff --git a/src/main/java/net/minecraftforge/common/network/ForgeRuntimeCodec.java b/src/main/java/net/minecraftforge/common/network/ForgeRuntimeCodec.java index 3af75344e9..8121faecc3 100644 --- a/src/main/java/net/minecraftforge/common/network/ForgeRuntimeCodec.java +++ b/src/main/java/net/minecraftforge/common/network/ForgeRuntimeCodec.java @@ -2,7 +2,7 @@ package net.minecraftforge.common.network; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; -import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec; +import net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec; public class ForgeRuntimeCodec extends FMLIndexedMessageToMessageCodec { public ForgeRuntimeCodec() diff --git a/src/main/java/net/minecraftforge/common/network/ServerToClientConnectionEstablishedHandler.java b/src/main/java/net/minecraftforge/common/network/ServerToClientConnectionEstablishedHandler.java index d7bd3033f9..49bd775fa5 100644 --- a/src/main/java/net/minecraftforge/common/network/ServerToClientConnectionEstablishedHandler.java +++ b/src/main/java/net/minecraftforge/common/network/ServerToClientConnectionEstablishedHandler.java @@ -1,6 +1,6 @@ package net.minecraftforge.common.network; -import cpw.mods.fml.common.network.NetworkHandshakeEstablished; +import net.minecraftforge.fml.common.network.NetworkHandshakeEstablished; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; diff --git a/src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java b/src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java index 0029488a3f..f98bf8da53 100644 --- a/src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java +++ b/src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java @@ -12,7 +12,7 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; -import cpw.mods.fml.common.FMLLog; +import net.minecraftforge.fml.common.FMLLog; /** diff --git a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java index 91f76062e9..26977a24b8 100644 --- a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java +++ b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java @@ -4,12 +4,14 @@ package net.minecraftforge.common.util; import java.io.Serializable; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier; +import net.minecraftforge.fml.common.registry.GameRegistry; +import net.minecraftforge.fml.common.registry.GameRegistry.UniqueIdentifier; /** * Represents a captured snapshot of a block which will not change @@ -23,29 +25,25 @@ public class BlockSnapshot implements Serializable { private static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("forge.debugBlockSnapshot", "false")); - public final int x; - public final int y; - public final int z; + public final BlockPos pos; public final int dimId; - public transient Block replacedBlock; - public final int meta; + public transient IBlockState replacedBlock; public int flag; private final NBTTagCompound nbt; public transient World world; public final UniqueIdentifier blockIdentifier; + public final int meta; - public BlockSnapshot(World world, int x, int y, int z, Block block, int meta) + public BlockSnapshot(World world, BlockPos pos, IBlockState state) { this.world = world; - this.dimId = world.provider.dimensionId; - this.x = x; - this.y = y; - this.z = z; - this.replacedBlock = block; - this.blockIdentifier = GameRegistry.findUniqueIdentifierFor(block); - this.meta = meta; + this.dimId = world.provider.getDimensionId(); + this.pos = pos; + this.replacedBlock = state; + this.blockIdentifier = GameRegistry.findUniqueIdentifierFor(state.getBlock()); + this.meta = state.getBlock().getMetaFromState(state); this.flag = 3; - TileEntity te = world.getTileEntity(x, y, z); + TileEntity te = world.getTileEntity(pos); if (te != null) { nbt = new NBTTagCompound(); @@ -54,57 +52,53 @@ public class BlockSnapshot implements Serializable else nbt = null; if (DEBUG) { - System.out.printf("Created BlockSnapshot - [World: %s ][Location: %d,%d,%d ][Block: %s ][Meta: %d ]", world.getWorldInfo().getWorldName(), x, y, z, block, meta); + System.out.printf("Created BlockSnapshot - [World: %s ][Location: %d,%d,%d ][Block: %s ][Meta: %d ]", world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ(), blockIdentifier, meta); } } - public BlockSnapshot(World world, int x, int y, int z, Block block, int meta, NBTTagCompound nbt) + public BlockSnapshot(World world, BlockPos pos, IBlockState state, NBTTagCompound nbt) { this.world = world; - this.dimId = world.provider.dimensionId; - this.x = x; - this.y = y; - this.z = z; - this.replacedBlock = block; - this.blockIdentifier = GameRegistry.findUniqueIdentifierFor(block); - this.meta = meta; + this.dimId = world.provider.getDimensionId(); + this.pos = pos; + this.replacedBlock = state; + this.blockIdentifier = GameRegistry.findUniqueIdentifierFor(state.getBlock()); + this.meta = state.getBlock().getMetaFromState(state); this.flag = 3; this.nbt = nbt; if (DEBUG) { - System.out.printf("Created BlockSnapshot - [World: %s ][Location: %d,%d,%d ][Block: %s ][Meta: %d ]", world.getWorldInfo().getWorldName(), x, y, z, block, meta); + System.out.printf("Created BlockSnapshot - [World: %s ][Location: %d,%d,%d ][Block: %s ][Meta: %d ]", world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ(), blockIdentifier, meta); } } - public BlockSnapshot(World world, int x, int y, int z, Block block, int meta, int flag) + public BlockSnapshot(World world, BlockPos pos, IBlockState state, int flag) { - this(world, x, y, z, block, meta); + this(world, pos, state); this.flag = flag; } - + /** * Raw constructor designed for serialization usages. */ - public BlockSnapshot(int dimension, int x, int y, int z, String modid, String blockName, int meta, int flag, NBTTagCompound nbt) + public BlockSnapshot(int dimension, BlockPos pos, String modid, String blockName, int meta, int flag, NBTTagCompound nbt) { this.dimId = dimension; - this.x = x; - this.y = y; - this.z = z; - this.meta = meta; + this.pos = pos; this.flag = flag; this.blockIdentifier = new UniqueIdentifier(modid + ":" + blockName); + this.meta = meta; this.nbt = nbt; } - public static BlockSnapshot getBlockSnapshot(World world, int x, int y, int z) + public static BlockSnapshot getBlockSnapshot(World world, BlockPos pos) { - return new BlockSnapshot(world, x, y, z, world.getBlock(x, y, z), world.getBlockMetadata(x, y,z)); + return new BlockSnapshot(world, pos, world.getBlockState(pos)); } - public static BlockSnapshot getBlockSnapshot(World world, int x, int y, int z, int flag) + public static BlockSnapshot getBlockSnapshot(World world, BlockPos pos, int flag) { - return new BlockSnapshot(world, x, y, z, world.getBlock(x, y, z), world.getBlockMetadata(x, y,z), flag); + return new BlockSnapshot(world, pos, world.getBlockState(pos), flag); } public static BlockSnapshot readFromNBT(NBTTagCompound tag) @@ -113,9 +107,7 @@ public class BlockSnapshot implements Serializable return new BlockSnapshot( tag.getInteger("dimension"), - tag.getInteger("posX"), - tag.getInteger("posY"), - tag.getInteger("posZ"), + new BlockPos(tag.getInteger("posX"), tag.getInteger("posY"), tag.getInteger("posZ")), tag.getString("blockMod"), tag.getString("blockName"), tag.getInteger("metadata"), @@ -123,25 +115,25 @@ public class BlockSnapshot implements Serializable nbt); } - public Block getCurrentBlock() + public IBlockState getCurrentBlock() { - return world.getBlock(x, y, z); + return world.getBlockState(pos); } - public World getWorld() + public World getWorld() { - if (this.world == null) + if (this.world == null) { this.world = DimensionManager.getWorld(dimId); } return this.world; } - public Block getReplacedBlock() + public IBlockState getReplacedBlock() { - if (this.replacedBlock == null) + if (this.replacedBlock == null) { - this.replacedBlock = GameRegistry.findBlock(this.blockIdentifier.modId, this.blockIdentifier.name); + this.replacedBlock = GameRegistry.findBlock(this.blockIdentifier.modId, this.blockIdentifier.name).getStateFromMeta(meta); } return this.replacedBlock; } @@ -153,69 +145,38 @@ public class BlockSnapshot implements Serializable else return null; } - public boolean restore() + public boolean restore() { return restore(false); } - public boolean restore(boolean force) + public boolean restore(boolean force) { return restore(force, true); } - public boolean restore(boolean force, boolean applyPhysics) + public boolean restore(boolean force, boolean applyPhysics) { - if (getCurrentBlock() != getReplacedBlock() || world.getBlockMetadata(x & 15, y, z & 15) != meta) + IBlockState current = getCurrentBlock(); + IBlockState replaced = getReplacedBlock(); + if (current.getBlock() != replaced.getBlock() || current.getBlock().getMetaFromState(current) != replaced.getBlock().getMetaFromState(replaced)) { if (force) { - world.setBlock(x, y, z, getReplacedBlock(), meta, applyPhysics ? 3 : 2); + world.setBlockState(pos, replaced, applyPhysics ? 3 : 2); } - else - { - return false; - } - } - - world.setBlockMetadataWithNotify(x, y, z, meta, applyPhysics ? 3 : 2); - world.markBlockForUpdate(x, y, z); - TileEntity te = null; - if (nbt != null) - { - te = world.getTileEntity(x, y, z); - if (te != null) - { - te.readFromNBT(nbt); - } - } - - if (DEBUG) - { - System.out.printf("Restored BlockSnapshot with data [World: %s ][Location: %d,%d,%d ][Meta: %d ][Block: %s ][TileEntity: %s ][force: %s ][applyPhysics: %s]", world.getWorldInfo().getWorldName(), x, y, z, meta, getReplacedBlock(), te, force, applyPhysics); - } - return true; - } - - public boolean restoreToLocation(World world, int x, int y, int z, boolean force, boolean applyPhysics) - { - if (getCurrentBlock() != getReplacedBlock() || world.getBlockMetadata(x & 15, y, z & 15) != meta) - { - if (force) - { - world.setBlock(x, y, z, getReplacedBlock(), meta, applyPhysics ? 3 : 2); - } else { return false; } } - world.setBlockMetadataWithNotify(x, y, z, meta, applyPhysics ? 3 : 2); - world.markBlockForUpdate(x, y, z); + world.setBlockState(pos, replaced, applyPhysics ? 3 : 2); + world.markBlockForUpdate(pos); TileEntity te = null; if (nbt != null) { - te = world.getTileEntity(x, y, z); + te = world.getTileEntity(pos); if (te != null) { te.readFromNBT(nbt); @@ -224,7 +185,42 @@ public class BlockSnapshot implements Serializable if (DEBUG) { - System.out.printf("Restored BlockSnapshot with data [World: %s ][Location: %d,%d,%d ][Meta: %d ][Block: %s ][TileEntity: %s ][force: %s ][applyPhysics: %s]", world.getWorldInfo().getWorldName(), x, y, z, meta, getReplacedBlock(), te, force, applyPhysics); + System.out.printf("Restored BlockSnapshot with data [World: %s ][Location: %d,%d,%d ][Meta: %d ][Block: %s ][TileEntity: %s ][force: %s ][applyPhysics: %s]", world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ(), replaced.getBlock().getMetaFromState(replaced), replaced.getBlock().delegate.name(), te, force, applyPhysics); + } + return true; + } + + public boolean restoreToLocation(World world, BlockPos pos, boolean force, boolean applyPhysics) + { + IBlockState current = getCurrentBlock(); + IBlockState replaced = getReplacedBlock(); + if (current.getBlock() != replaced.getBlock() || current.getBlock().getMetaFromState(current) != replaced.getBlock().getMetaFromState(replaced)) + { + if (force) + { + world.setBlockState(pos, replaced, applyPhysics ? 3 : 2); + } + else + { + return false; + } + } + + world.setBlockState(pos, replaced, applyPhysics ? 3 : 2); + world.markBlockForUpdate(pos); + TileEntity te = null; + if (nbt != null) + { + te = world.getTileEntity(pos); + if (te != null) + { + te.readFromNBT(nbt); + } + } + + if (DEBUG) + { + System.out.printf("Restored BlockSnapshot with data [World: %s ][Location: %d,%d,%d ][Meta: %d ][Block: %s ][TileEntity: %s ][force: %s ][applyPhysics: %s]", world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ(), replaced.getBlock().getMetaFromState(replaced), replaced.getBlock().delegate.name(), te, force, applyPhysics); } return true; } @@ -233,9 +229,9 @@ public class BlockSnapshot implements Serializable { compound.setString("blockMod", blockIdentifier.modId); compound.setString("blockName", blockIdentifier.name); - compound.setInteger("posX", x); - compound.setInteger("posY", y); - compound.setInteger("posZ", z); + compound.setInteger("posX", pos.getX()); + compound.setInteger("posY", pos.getY()); + compound.setInteger("posZ", pos.getZ()); compound.setInteger("flag", flag); compound.setInteger("dimension", dimId); compound.setInteger("metadata", meta); @@ -249,7 +245,7 @@ public class BlockSnapshot implements Serializable } @Override - public boolean equals(Object obj) + public boolean equals(Object obj) { if (obj == null) { @@ -260,15 +256,7 @@ public class BlockSnapshot implements Serializable return false; } final BlockSnapshot other = (BlockSnapshot) obj; - if (this.x != other.x) - { - return false; - } - if (this.y != other.y) - { - return false; - } - if (this.z != other.z) + if (!this.pos.equals(other.pos)) { return false; } @@ -299,9 +287,9 @@ public class BlockSnapshot implements Serializable public int hashCode() { int hash = 7; - hash = 73 * hash + this.x; - hash = 73 * hash + this.y; - hash = 73 * hash + this.z; + hash = 73 * hash + this.pos.getX(); + hash = 73 * hash + this.pos.getY(); + hash = 73 * hash + this.pos.getZ(); hash = 73 * hash + this.meta; hash = 73 * hash + this.dimId; hash = 73 * hash + (this.nbt != null ? this.nbt.hashCode() : 0); diff --git a/src/main/java/net/minecraftforge/common/util/EnumHelper.java b/src/main/java/net/minecraftforge/common/util/EnumHelper.java index 5f0ec8a028..f6586dcede 100644 --- a/src/main/java/net/minecraftforge/common/util/EnumHelper.java +++ b/src/main/java/net/minecraftforge/common/util/EnumHelper.java @@ -3,11 +3,10 @@ package net.minecraftforge.common.util; import java.lang.reflect.*; import java.util.*; -import cpw.mods.fml.common.FMLLog; +import net.minecraftforge.fml.common.FMLLog; import net.minecraft.block.BlockPressurePlate.Sensitivity; import net.minecraft.block.material.Material; import net.minecraft.enchantment.EnumEnchantmentType; -import net.minecraft.entity.Entity.EnumEntitySize; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.item.EntityPainting.EnumArt; @@ -42,7 +41,6 @@ public class EnumHelper {EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class, boolean.class}, {Door.class}, {EnumEnchantmentType.class}, - {EnumEntitySize.class}, {Sensitivity.class}, {MovingObjectType.class}, {EnumSkyBlock.class, int.class}, @@ -80,10 +78,6 @@ public class EnumHelper { return addEnum(EnumEnchantmentType.class, name); } - public static EnumEntitySize addEntitySize(String name) - { - return addEnum(EnumEntitySize.class, name); - } public static Sensitivity addSensitivity(String name) { return addEnum(Sensitivity.class, name); diff --git a/src/main/java/net/minecraftforge/common/util/FakePlayer.java b/src/main/java/net/minecraftforge/common/util/FakePlayer.java index 8d956201e4..3471a2a70a 100644 --- a/src/main/java/net/minecraftforge/common/util/FakePlayer.java +++ b/src/main/java/net/minecraftforge/common/util/FakePlayer.java @@ -2,19 +2,19 @@ package net.minecraftforge.common.util; import com.mojang.authlib.GameProfile; -import cpw.mods.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.play.client.C15PacketClientSettings; import net.minecraft.server.management.ItemInWorldManager; import net.minecraft.stats.StatBase; -import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.DamageSource; import net.minecraft.util.IChatComponent; +import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraft.world.WorldServer; -//Preliminary, simple Fake Player class +//Preliminary, simple Fake Player class public class FakePlayer extends EntityPlayerMP { public FakePlayer(WorldServer world, GameProfile name) @@ -22,19 +22,15 @@ public class FakePlayer extends EntityPlayerMP super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new ItemInWorldManager(world)); } + @Override public Vec3 getPositionVector(){ return new Vec3(0, 0, 0); } @Override public boolean canCommandSenderUseCommand(int i, String s){ return false; } - @Override public ChunkCoordinates getPlayerCoordinates() - { - return new ChunkCoordinates(0,0,0); - } - @Override public void addChatComponentMessage(IChatComponent chatmessagecomponent){} @Override public void addStat(StatBase par1StatBase, int par2){} @Override public void openGui(Object mod, int modGuiId, World world, int x, int y, int z){} - @Override public boolean isEntityInvulnerable(){ return true; } + @Override public boolean func_180431_b(DamageSource source){ return true; } @Override public boolean canAttackPlayer(EntityPlayer player){ return false; } @Override public void onDeath(DamageSource source){ return; } @Override public void onUpdate(){ return; } @Override public void travelToDimension(int dim){ return; } - @Override public void func_147100_a(C15PacketClientSettings pkt){ return; } + @Override public void handleClientSettings(C15PacketClientSettings pkt){ return; } } diff --git a/src/main/java/net/minecraftforge/common/util/ForgeDirection.java b/src/main/java/net/minecraftforge/common/util/ForgeDirection.java deleted file mode 100644 index 274c7169be..0000000000 --- a/src/main/java/net/minecraftforge/common/util/ForgeDirection.java +++ /dev/null @@ -1,71 +0,0 @@ -package net.minecraftforge.common.util; - -public enum ForgeDirection -{ - /** -Y */ - DOWN(0, -1, 0), - - /** +Y */ - UP(0, 1, 0), - - /** -Z */ - NORTH(0, 0, -1), - - /** +Z */ - SOUTH(0, 0, 1), - - /** -X */ - WEST(-1, 0, 0), - - /** +X */ - EAST(1, 0, 0), - - /** - * Used only by getOrientation, for invalid inputs - */ - UNKNOWN(0, 0, 0); - - public final int offsetX; - public final int offsetY; - public final int offsetZ; - public final int flag; - public static final ForgeDirection[] VALID_DIRECTIONS = {DOWN, UP, NORTH, SOUTH, WEST, EAST}; - public static final int[] OPPOSITES = {1, 0, 3, 2, 5, 4, 6}; - // Left hand rule rotation matrix for all possible axes of rotation - public static final int[][] ROTATION_MATRIX = { - {0, 1, 4, 5, 3, 2, 6}, - {0, 1, 5, 4, 2, 3, 6}, - {5, 4, 2, 3, 0, 1, 6}, - {4, 5, 2, 3, 1, 0, 6}, - {2, 3, 1, 0, 4, 5, 6}, - {3, 2, 0, 1, 4, 5, 6}, - {0, 1, 2, 3, 4, 5, 6}, - }; - - private ForgeDirection(int x, int y, int z) - { - offsetX = x; - offsetY = y; - offsetZ = z; - flag = 1 << ordinal(); - } - - public static ForgeDirection getOrientation(int id) - { - if (id >= 0 && id < VALID_DIRECTIONS.length) - { - return VALID_DIRECTIONS[id]; - } - return UNKNOWN; - } - - public ForgeDirection getOpposite() - { - return getOrientation(OPPOSITES[ordinal()]); - } - - public ForgeDirection getRotation(ForgeDirection axis) - { - return getOrientation(ROTATION_MATRIX[axis.ordinal()][ordinal()]); - } -} diff --git a/src/main/java/net/minecraftforge/common/util/RotationHelper.java b/src/main/java/net/minecraftforge/common/util/RotationHelper.java deleted file mode 100644 index 8f5d92e71d..0000000000 --- a/src/main/java/net/minecraftforge/common/util/RotationHelper.java +++ /dev/null @@ -1,439 +0,0 @@ -package net.minecraftforge.common.util; - -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockAnvil; -import net.minecraft.block.BlockBed; -import net.minecraft.block.BlockButton; -import net.minecraft.block.BlockChest; -import net.minecraft.block.BlockCocoa; -import net.minecraft.block.BlockDispenser; -import net.minecraft.block.BlockDoor; -import net.minecraft.block.BlockEndPortalFrame; -import net.minecraft.block.BlockEnderChest; -import net.minecraft.block.BlockFenceGate; -import net.minecraft.block.BlockFurnace; -import net.minecraft.block.BlockHopper; -import net.minecraft.block.BlockHugeMushroom; -import net.minecraft.block.BlockLadder; -import net.minecraft.block.BlockLever; -import net.minecraft.block.BlockLog; -import net.minecraft.block.BlockPistonBase; -import net.minecraft.block.BlockPistonExtension; -import net.minecraft.block.BlockPumpkin; -import net.minecraft.block.BlockRail; -import net.minecraft.block.BlockRailDetector; -import net.minecraft.block.BlockRailPowered; -import net.minecraft.block.BlockRedstoneComparator; -import net.minecraft.block.BlockRedstoneRepeater; -import net.minecraft.block.BlockSkull; -import net.minecraft.block.BlockStairs; -import net.minecraft.block.BlockTorch; -import net.minecraft.block.BlockTrapDoor; -import net.minecraft.block.BlockTripWireHook; -import net.minecraft.block.BlockVine; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; - -import java.util.HashMap; -import java.util.Map; - -import static net.minecraftforge.common.util.ForgeDirection.*; - -/** - * This class is a helper function for vanilla blocks, and should not be called by Modders. - * Refer to block.rotateBlock and block.getValidRotations instead. - * - */ -public class RotationHelper { - /** - * Some blocks have the same rotation. - * The first of these blocks (sorted by itemID) should be listed as a type. - * Some of the types aren't actual blocks (helper types). - */ - private static enum BlockType { - LOG, - DISPENSER, - BED, - RAIL, - RAIL_POWERED, - RAIL_ASCENDING, - RAIL_CORNER, - TORCH, - STAIR, - CHEST, - SIGNPOST, - DOOR, - LEVER, - BUTTON, - REDSTONE_REPEATER, - TRAPDOOR, - MUSHROOM_CAP, - MUSHROOM_CAP_CORNER, - MUSHROOM_CAP_SIDE, - VINE, - SKULL, - ANVIL - } - - private static final ForgeDirection[] UP_DOWN_AXES = new ForgeDirection[] { UP, DOWN }; - private static final Map> MAPPINGS = new HashMap>(); - - public static ForgeDirection[] getValidVanillaBlockRotations(Block block) - { - return (block instanceof BlockBed || - block instanceof BlockPumpkin || - block instanceof BlockFenceGate || - block instanceof BlockEndPortalFrame || - block instanceof BlockTripWireHook || - block instanceof BlockCocoa || - block instanceof BlockRailPowered || - block instanceof BlockRailDetector || - block instanceof BlockStairs || - block instanceof BlockChest || - block instanceof BlockEnderChest || - block instanceof BlockFurnace || - block instanceof BlockLadder || - block == Blocks.wall_sign || - block == Blocks.standing_sign || - block instanceof BlockDoor || - block instanceof BlockRail || - block instanceof BlockButton || - block instanceof BlockRedstoneRepeater || - block instanceof BlockRedstoneComparator || - block instanceof BlockTrapDoor || - block instanceof BlockHugeMushroom || - block instanceof BlockVine || - block instanceof BlockSkull || - block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS; - } - - public static boolean rotateVanillaBlock(Block block, World worldObj, int x, int y, int z, ForgeDirection axis) - { - if (worldObj.isRemote) - { - return false; - } - - if (axis == UP || axis == DOWN) - { - if (block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame || block instanceof BlockTripWireHook || block instanceof BlockCocoa) - { - return rotateBlock(worldObj, x, y, z, axis, 0x3, BlockType.BED); - } - if (block instanceof BlockRail) - { - return rotateBlock(worldObj, x, y, z, axis, 0xF, BlockType.RAIL); - } - if (block instanceof BlockRailPowered || block instanceof BlockRailDetector) - { - return rotateBlock(worldObj, x, y, z, axis, 0x7, BlockType.RAIL_POWERED); - } - if (block instanceof BlockStairs) - { - return rotateBlock(worldObj, x, y, z, axis, 0x3, BlockType.STAIR); - } - if (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder || block == Blocks.wall_sign) - { - return rotateBlock(worldObj, x, y, z, axis, 0x7, BlockType.CHEST); - } - if (block == Blocks.standing_sign) - { - return rotateBlock(worldObj, x, y, z, axis, 0xF, BlockType.SIGNPOST); - } - if (block instanceof BlockDoor) - { - return rotateBlock(worldObj, x, y, z, axis, 0x3, BlockType.DOOR); - } - if (block instanceof BlockButton) - { - return rotateBlock(worldObj, x, y, z, axis, 0x7, BlockType.BUTTON); - } - if (block instanceof BlockRedstoneRepeater || block instanceof BlockRedstoneComparator) - { - return rotateBlock(worldObj, x, y, z, axis, 0x3, BlockType.REDSTONE_REPEATER); - } - if (block instanceof BlockTrapDoor) - { - return rotateBlock(worldObj, x, y, z, axis, 0x3, BlockType.TRAPDOOR); - } - if (block instanceof BlockHugeMushroom) - { - return rotateBlock(worldObj, x, y, z, axis, 0xF, BlockType.MUSHROOM_CAP); - } - if (block instanceof BlockVine) - { - return rotateBlock(worldObj, x, y, z, axis, 0xF, BlockType.VINE); - } - if (block instanceof BlockSkull) - { - return rotateBlock(worldObj, x, y, z, axis, 0x7, BlockType.SKULL); - } - if (block instanceof BlockAnvil) - { - return rotateBlock(worldObj, x, y, z, axis, 0x1, BlockType.ANVIL); - } - } - - if (block instanceof BlockLog) - { - return rotateBlock(worldObj, x, y, z, axis, 0xC, BlockType.LOG); - } - if (block instanceof BlockDispenser || block instanceof BlockPistonBase || block instanceof BlockPistonExtension || block instanceof BlockHopper) - { - return rotateBlock(worldObj, x, y, z, axis, 0x7, BlockType.DISPENSER); - } - if (block instanceof BlockTorch) - { - return rotateBlock(worldObj, x, y, z, axis, 0xF, BlockType.TORCH); - } - if (block instanceof BlockLever) - { - return rotateBlock(worldObj, x, y, z, axis, 0x7, BlockType.LEVER); - } - - return false; - } - - private static boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis, int mask, BlockType blockType) - { - int rotMeta = worldObj.getBlockMetadata(x, y, z); - if (blockType == BlockType.DOOR && (rotMeta & 0x8) == 0x8) - { - return false; - } - int masked = rotMeta & ~mask; - int meta = rotateMetadata(axis, blockType, rotMeta & mask); - if (meta == -1) - { - return false; - } - worldObj.setBlockMetadataWithNotify(x, y, z, meta & mask | masked, 3); - return true; - } - - private static int rotateMetadata(ForgeDirection axis, BlockType blockType, int meta) - { - if (blockType == BlockType.RAIL || blockType == BlockType.RAIL_POWERED) - { - if (meta == 0x0 || meta == 0x1) - { - return ~meta & 0x1; - } - if (meta >= 0x2 && meta <= 0x5) - { - blockType = BlockType.RAIL_ASCENDING; - } - if (meta >= 0x6 && meta <= 0x9 && blockType == BlockType.RAIL) - { - blockType = BlockType.RAIL_CORNER; - } - } - if (blockType == BlockType.SIGNPOST) - { - return (axis == UP) ? (meta + 0x4) % 0x10 : (meta + 0xC) % 0x10; - } - if (blockType == BlockType.LEVER && (axis == UP || axis == DOWN)) - { - switch (meta) - { - case 0x5: - return 0x6; - case 0x6: - return 0x5; - case 0x7: - return 0x0; - case 0x0: - return 0x7; - } - } - if (blockType == BlockType.MUSHROOM_CAP) - { - if (meta % 0x2 == 0) - { - blockType = BlockType.MUSHROOM_CAP_SIDE; - } - else - { - blockType = BlockType.MUSHROOM_CAP_CORNER; - } - } - if (blockType == BlockType.VINE) - { - return ((meta << 1) | ((meta & 0x8) >> 3)); - } - - ForgeDirection orientation = metadataToDirection(blockType, meta); - ForgeDirection rotated = orientation.getRotation(axis); - return directionToMetadata(blockType, rotated); - } - - private static ForgeDirection metadataToDirection(BlockType blockType, int meta) - { - if (blockType == BlockType.LEVER) - { - if (meta == 0x6) - { - meta = 0x5; - } - else if (meta == 0x0) - { - meta = 0x7; - } - } - - if (MAPPINGS.containsKey(blockType)) - { - BiMap biMap = MAPPINGS.get(blockType); - if (biMap.containsKey(meta)) - { - return biMap.get(meta); - } - } - - if (blockType == BlockType.TORCH) - { - return ForgeDirection.getOrientation(6 - meta); - } - if (blockType == BlockType.STAIR) - { - return ForgeDirection.getOrientation(5 - meta); - } - if (blockType == BlockType.CHEST || blockType == BlockType.DISPENSER || blockType == BlockType.SKULL) - { - return ForgeDirection.getOrientation(meta); - } - if (blockType == BlockType.BUTTON) - { - return ForgeDirection.getOrientation(6 - meta); - } - if (blockType == BlockType.TRAPDOOR) - { - return ForgeDirection.getOrientation(meta + 2).getOpposite(); - } - - return ForgeDirection.UNKNOWN; - } - - private static int directionToMetadata(BlockType blockType, ForgeDirection direction) - { - if ((blockType == BlockType.LOG || blockType == BlockType.ANVIL) && (direction.offsetX + direction.offsetY + direction.offsetZ) < 0) - { - direction = direction.getOpposite(); - } - - if (MAPPINGS.containsKey(blockType)) - { - BiMap biMap = MAPPINGS.get(blockType).inverse(); - if (biMap.containsKey(direction)) - { - return biMap.get(direction); - } - } - - if (blockType == BlockType.TORCH) - { - if (direction.ordinal() >= 1) - { - return 6 - direction.ordinal(); - } - } - if (blockType == BlockType.STAIR) - { - return 5 - direction.ordinal(); - } - if (blockType == BlockType.CHEST || blockType == BlockType.DISPENSER || blockType == BlockType.SKULL) - { - return direction.ordinal(); - } - if (blockType == BlockType.BUTTON) - { - if (direction.ordinal() >= 2) - { - return 6 - direction.ordinal(); - } - } - if (blockType == BlockType.TRAPDOOR) - { - return direction.getOpposite().ordinal() - 2; - } - - return -1; - } - - static - { - BiMap biMap; - - biMap = HashBiMap.create(3); - biMap.put(0x0, UP); - biMap.put(0x4, EAST); - biMap.put(0x8, SOUTH); - MAPPINGS.put(BlockType.LOG, biMap); - - biMap = HashBiMap.create(4); - biMap.put(0x0, SOUTH); - biMap.put(0x1, WEST); - biMap.put(0x2, NORTH); - biMap.put(0x3, EAST); - MAPPINGS.put(BlockType.BED, biMap); - - biMap = HashBiMap.create(4); - biMap.put(0x2, EAST); - biMap.put(0x3, WEST); - biMap.put(0x4, NORTH); - biMap.put(0x5, SOUTH); - MAPPINGS.put(BlockType.RAIL_ASCENDING, biMap); - - biMap = HashBiMap.create(4); - biMap.put(0x6, WEST); - biMap.put(0x7, NORTH); - biMap.put(0x8, EAST); - biMap.put(0x9, SOUTH); - MAPPINGS.put(BlockType.RAIL_CORNER, biMap); - - biMap = HashBiMap.create(6); - biMap.put(0x1, EAST); - biMap.put(0x2, WEST); - biMap.put(0x3, SOUTH); - biMap.put(0x4, NORTH); - biMap.put(0x5, UP); - biMap.put(0x7, DOWN); - MAPPINGS.put(BlockType.LEVER, biMap); - - biMap = HashBiMap.create(4); - biMap.put(0x0, WEST); - biMap.put(0x1, NORTH); - biMap.put(0x2, EAST); - biMap.put(0x3, SOUTH); - MAPPINGS.put(BlockType.DOOR, biMap); - - biMap = HashBiMap.create(4); - biMap.put(0x0, NORTH); - biMap.put(0x1, EAST); - biMap.put(0x2, SOUTH); - biMap.put(0x3, WEST); - MAPPINGS.put(BlockType.REDSTONE_REPEATER, biMap); - - biMap = HashBiMap.create(4); - biMap.put(0x1, EAST); - biMap.put(0x3, SOUTH); - biMap.put(0x7, NORTH); - biMap.put(0x9, WEST); - MAPPINGS.put(BlockType.MUSHROOM_CAP_CORNER, biMap); - - biMap = HashBiMap.create(4); - biMap.put(0x2, NORTH); - biMap.put(0x4, WEST); - biMap.put(0x6, EAST); - biMap.put(0x8, SOUTH); - MAPPINGS.put(BlockType.MUSHROOM_CAP_SIDE, biMap); - - biMap = HashBiMap.create(2); - biMap.put(0x0, SOUTH); - biMap.put(0x1, EAST); - MAPPINGS.put(BlockType.ANVIL, biMap); - } -} diff --git a/src/main/java/net/minecraftforge/event/AnvilUpdateEvent.java b/src/main/java/net/minecraftforge/event/AnvilUpdateEvent.java index 7100cd9f23..585c5a715d 100644 --- a/src/main/java/net/minecraftforge/event/AnvilUpdateEvent.java +++ b/src/main/java/net/minecraftforge/event/AnvilUpdateEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.event; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.item.ItemStack; /** diff --git a/src/main/java/net/minecraftforge/event/CommandEvent.java b/src/main/java/net/minecraftforge/event/CommandEvent.java index daaab6a02e..5c316b5148 100644 --- a/src/main/java/net/minecraftforge/event/CommandEvent.java +++ b/src/main/java/net/minecraftforge/event/CommandEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.event; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index aec4cd9a0f..30d5654cfe 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -2,60 +2,81 @@ package net.minecraftforge.event; import java.io.File; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; -import cpw.mods.fml.common.ObfuscationReflectionHelper; -import cpw.mods.fml.common.eventhandler.Event.Result; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Blocks; +import net.minecraft.entity.player.EntityPlayer.EnumStatus; import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.storage.IPlayerFileData; import net.minecraft.world.storage.SaveHandler; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.IExtendedEntityProperties; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.BlockSnapshot; -import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.event.entity.EntityEvent; import net.minecraftforge.event.entity.EntityStruckByLightningEvent; +import net.minecraftforge.event.entity.PlaySoundAtEntityEvent; +import net.minecraftforge.event.entity.item.ItemExpireEvent; import net.minecraftforge.event.entity.living.LivingPackSizeEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent.AllowDespawn; import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent; +import net.minecraftforge.event.entity.player.BonemealEvent; +import net.minecraftforge.event.entity.player.EntityInteractEvent; +import net.minecraftforge.event.entity.player.EntityItemPickupEvent; +import net.minecraftforge.event.entity.player.FillBucketEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; +import net.minecraftforge.event.entity.player.PlayerDropsEvent; import net.minecraftforge.event.entity.player.PlayerEvent; +import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; +import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; import net.minecraftforge.event.entity.player.PlayerUseItemEvent; +import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; +import net.minecraftforge.event.entity.player.UseHoeEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.BlockEvent.MultiPlaceEvent; import net.minecraftforge.event.world.BlockEvent.PlaceEvent; import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.ObfuscationReflectionHelper; +import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event.Result; public class ForgeEventFactory { - public static MultiPlaceEvent onPlayerMultiBlockPlace(EntityPlayer player, List blockSnapshots, ForgeDirection direction) + public static MultiPlaceEvent onPlayerMultiBlockPlace(EntityPlayer player, List blockSnapshots, EnumFacing direction) { - Block placedAgainst = blockSnapshots.get(0).world.getBlock(blockSnapshots.get(0).x + direction.getOpposite().offsetX, blockSnapshots.get(0).y + direction.getOpposite().offsetY, blockSnapshots.get(0).z + direction.getOpposite().offsetZ); - + BlockSnapshot snap = blockSnapshots.get(0); + IBlockState placedAgainst = snap.world.getBlockState(snap.pos.offset(direction.getOpposite())); MultiPlaceEvent event = new MultiPlaceEvent(blockSnapshots, placedAgainst, player); MinecraftForge.EVENT_BUS.post(event); return event; } - public static PlaceEvent onPlayerBlockPlace(EntityPlayer player, BlockSnapshot blockSnapshot, ForgeDirection direction) + public static PlaceEvent onPlayerBlockPlace(EntityPlayer player, BlockSnapshot blockSnapshot, EnumFacing direction) { - Block placedAgainst = blockSnapshot.world.getBlock(blockSnapshot.x + direction.getOpposite().offsetX, blockSnapshot.y + direction.getOpposite().offsetY, blockSnapshot.z + direction.getOpposite().offsetZ); - + IBlockState placedAgainst = blockSnapshot.world.getBlockState(blockSnapshot.pos.offset(direction.getOpposite())); PlaceEvent event = new PlaceEvent(blockSnapshot, placedAgainst, player); MinecraftForge.EVENT_BUS.post(event); return event; @@ -68,26 +89,15 @@ public class ForgeEventFactory return event.success; } - @Deprecated // Location version below - public static float getBreakSpeed(EntityPlayer player, Block block, int metadata, float original) + public static float getBreakSpeed(EntityPlayer player, IBlockState state, float original, BlockPos pos) { - return getBreakSpeed(player, block, metadata, original, 0, -1, 0); - } - - public static float getBreakSpeed(EntityPlayer player, Block block, int metadata, float original, int x, int y, int z) - { - PlayerEvent.BreakSpeed event = new PlayerEvent.BreakSpeed(player, block, metadata, original, x, y, z); + PlayerEvent.BreakSpeed event = new PlayerEvent.BreakSpeed(player, state, original, pos); return (MinecraftForge.EVENT_BUS.post(event) ? -1 : event.newSpeed); } - @Deprecated - public static PlayerInteractEvent onPlayerInteract(EntityPlayer player, Action action, int x, int y, int z, int face) + public static PlayerInteractEvent onPlayerInteract(EntityPlayer player, Action action, World world, BlockPos pos, EnumFacing face) { - return onPlayerInteract(player, action, x, y, z, face, null); - } - public static PlayerInteractEvent onPlayerInteract(EntityPlayer player, Action action, int x, int y, int z, int face, World world) - { - PlayerInteractEvent event = new PlayerInteractEvent(player, action, x, y, z, face, world); + PlayerInteractEvent event = new PlayerInteractEvent(player, action, pos, face, world); MinecraftForge.EVENT_BUS.post(event); return event; } @@ -116,9 +126,9 @@ public class ForgeEventFactory return event.getResult(); } - public static List getPotentialSpawns(WorldServer world, EnumCreatureType type, int x, int y, int z, List oldList) + public static List getPotentialSpawns(WorldServer world, EnumCreatureType type, BlockPos pos, List oldList) { - WorldEvent.PotentialSpawns event = new WorldEvent.PotentialSpawns(world, type, x, y, z, oldList); + WorldEvent.PotentialSpawns event = new WorldEvent.PotentialSpawns(world, type, pos, oldList); if (MinecraftForge.EVENT_BUS.post(event)) { return null; @@ -140,9 +150,9 @@ public class ForgeEventFactory return event.displayname; } - public static float fireBlockHarvesting(ArrayList drops, World world, Block block, int x, int y, int z, int meta, int fortune, float dropChance, boolean silkTouch, EntityPlayer player) + public static float fireBlockHarvesting(List drops, World world, BlockPos pos, IBlockState state, int fortune, float dropChance, boolean silkTouch, EntityPlayer player) { - BlockEvent.HarvestDropsEvent event = new BlockEvent.HarvestDropsEvent(x, y, z, world, block, meta, fortune, dropChance, drops, player, silkTouch); + BlockEvent.HarvestDropsEvent event = new BlockEvent.HarvestDropsEvent(world, pos, state, fortune, dropChance, drops, player, silkTouch); MinecraftForge.EVENT_BUS.post(event); return event.dropChance; } @@ -216,4 +226,138 @@ public class ForgeEventFactory File dir = ObfuscationReflectionHelper.getPrivateValue(SaveHandler.class, sh, "playersDirectory", "field_"+"75771_c"); MinecraftForge.EVENT_BUS.post(new PlayerEvent.LoadFromFile(player, dir, uuidString)); } + + public static IChatComponent onClientChat(byte type, IChatComponent message) + { + ClientChatReceivedEvent event = new ClientChatReceivedEvent(type, message); + return MinecraftForge.EVENT_BUS.post(event) ? null : event.message; + } + + public static int onHoeUse(ItemStack stack, EntityPlayer player, World worldIn, BlockPos pos) + { + UseHoeEvent event = new UseHoeEvent(player, stack, worldIn, pos); + if (MinecraftForge.EVENT_BUS.post(event)) return -1; + if (event.getResult() == Result.ALLOW) + { + stack.damageItem(1, player); + return 1; + } + return 0; + } + + public static int onApplyBonemeal(EntityPlayer player, World world, BlockPos pos, IBlockState state, ItemStack stack) + { + BonemealEvent event = new BonemealEvent(player, world, pos, state); + if (MinecraftForge.EVENT_BUS.post(event)) return -1; + if (event.getResult() == Result.ALLOW) + { + if (!world.isRemote) + stack.stackSize--; + return 1; + } + return 0; + } + + public static ItemStack onBucketUse(EntityPlayer player, World world, ItemStack stack, MovingObjectPosition target) + { + FillBucketEvent event = new FillBucketEvent(player, stack, world, target); + if (MinecraftForge.EVENT_BUS.post(event)) return stack; + + if (event.getResult() == Result.ALLOW) + { + if (player.capabilities.isCreativeMode) + return stack; + + if (--stack.stackSize <= 0) + return event.result; + + if (!player.inventory.addItemStackToInventory(event.result)) + player.dropPlayerItemWithRandomChoice(event.result, false); + + return stack; + } + return null; + } + + public static boolean canEntityUpdate(Entity entity) + { + EntityEvent.CanUpdate event = new EntityEvent.CanUpdate(entity); + MinecraftForge.EVENT_BUS.post(event); + return event.canUpdate; + } + + public static String onPlaySoundAt(Entity entity, String name, float volume, float pitch) + { + PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, volume, pitch); + MinecraftForge.EVENT_BUS.post(event); + return event.name; + } + + public static HashMap onEntityConstructing(Entity entity, World world) + { + HashMap ret = new HashMap(); + + MinecraftForge.EVENT_BUS.post(new EntityEvent.EntityConstructing(entity)); + + for (IExtendedEntityProperties props : ret.values()) + { + props.init(entity, world); + } + + return ret; + } + + public static int onItemExpire(EntityItem entity, ItemStack item) + { + if (item == null) return -1; + ItemExpireEvent event = new ItemExpireEvent(entity, (item.getItem() == null ? 6000 : item.getItem().getEntityLifespan(item, entity.worldObj))); + if (!MinecraftForge.EVENT_BUS.post(event)) return -1; + return event.extraLife; + } + + public static int onItemPickup(EntityItem entityItem, EntityPlayer entityIn, ItemStack itemstack) + { + Event event = new EntityItemPickupEvent(entityIn, entityItem); + if (MinecraftForge.EVENT_BUS.post(event)) return -1; + return event.getResult() == Result.ALLOW ? 1 : 0; + } + + public static void onPlayerDrops(EntityPlayer player, DamageSource cause, List capturedDrops, boolean recentlyHit) + { + PlayerDropsEvent event = new PlayerDropsEvent(player, cause, capturedDrops, recentlyHit); + if (!MinecraftForge.EVENT_BUS.post(event)) + { + for (EntityItem item : capturedDrops) + { + player.joinEntityItemWithWorld(item); + } + } + } + + public static boolean canInteractWith(EntityPlayer player, Entity entity) + { + return MinecraftForge.EVENT_BUS.post(new EntityInteractEvent(player, entity)); + } + + public static EnumStatus onPlayerSleepInBed(EntityPlayer player, BlockPos pos) + { + PlayerSleepInBedEvent event = new PlayerSleepInBedEvent(player, pos); + MinecraftForge.EVENT_BUS.post(event); + return event.result; + } + + public static void onPlayerWakeup(EntityPlayer player) + { + MinecraftForge.EVENT_BUS.post(new PlayerWakeUpEvent(player)); + } + + public static void onPlayerFall(EntityPlayer player, float distance, float multiplier) + { + MinecraftForge.EVENT_BUS.post(new PlayerFlyableFallEvent(player, distance, multiplier)); + } + + public static void onPlayerClone(EntityPlayer player, EntityPlayer oldPlayer, boolean wasDeath) + { + MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerEvent.Clone(player, oldPlayer, wasDeath)); + } } diff --git a/src/main/java/net/minecraftforge/event/ServerChatEvent.java b/src/main/java/net/minecraftforge/event/ServerChatEvent.java index e1a112dfab..b1ec651e1e 100644 --- a/src/main/java/net/minecraftforge/event/ServerChatEvent.java +++ b/src/main/java/net/minecraftforge/event/ServerChatEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.event; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.ChatComponentTranslation; diff --git a/src/main/java/net/minecraftforge/event/brewing/PotionBrewedEvent.java b/src/main/java/net/minecraftforge/event/brewing/PotionBrewedEvent.java index 4af282589e..7fe80e6669 100644 --- a/src/main/java/net/minecraftforge/event/brewing/PotionBrewedEvent.java +++ b/src/main/java/net/minecraftforge/event/brewing/PotionBrewedEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.brewing; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.item.ItemStack; /** diff --git a/src/main/java/net/minecraftforge/event/entity/EntityEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityEvent.java index 740821b1ea..76c0415818 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.entity.Entity; /** diff --git a/src/main/java/net/minecraftforge/event/entity/EntityJoinWorldEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityJoinWorldEvent.java index cab6a57a05..9882373b17 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityJoinWorldEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityJoinWorldEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.Entity; import net.minecraft.world.World; diff --git a/src/main/java/net/minecraftforge/event/entity/EntityStruckByLightningEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityStruckByLightningEvent.java index c8b412b8ed..b9fdd3f02a 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityStruckByLightningEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityStruckByLightningEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.Entity; import net.minecraft.entity.effect.EntityLightningBolt; diff --git a/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java b/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java index a7408eed14..fbd9f571fe 100644 --- a/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/PlaySoundAtEntityEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.Entity; /** diff --git a/src/main/java/net/minecraftforge/event/entity/item/ItemExpireEvent.java b/src/main/java/net/minecraftforge/event/entity/item/ItemExpireEvent.java index affe2510c3..db7b79db10 100644 --- a/src/main/java/net/minecraftforge/event/entity/item/ItemExpireEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/item/ItemExpireEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.item; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.item.EntityItem; /** diff --git a/src/main/java/net/minecraftforge/event/entity/item/ItemTossEvent.java b/src/main/java/net/minecraftforge/event/entity/item/ItemTossEvent.java index f61cd54779..c167ce8d0b 100644 --- a/src/main/java/net/minecraftforge/event/entity/item/ItemTossEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/item/ItemTossEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.item; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/net/minecraftforge/event/entity/living/EnderTeleportEvent.java b/src/main/java/net/minecraftforge/event/entity/living/EnderTeleportEvent.java index 10e342f1e2..d03b071a44 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/EnderTeleportEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/EnderTeleportEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.living; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.EntityLivingBase; /** diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingAttackEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingAttackEvent.java index 9221ceb6c0..5e4ae66a27 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingAttackEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingAttackEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.living; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.util.DamageSource; import net.minecraft.entity.EntityLivingBase; diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingDeathEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingDeathEvent.java index a7f58658fa..307434232a 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingDeathEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingDeathEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.living; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.util.DamageSource; import net.minecraft.entity.EntityLivingBase; diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingDropsEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingDropsEvent.java index b72ecc1ad2..787e51192b 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingDropsEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingDropsEvent.java @@ -1,15 +1,15 @@ package net.minecraftforge.event.entity.living; -import java.util.ArrayList; +import java.util.List; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.util.DamageSource; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.EntityLivingBase; /** * LivingDropsEvent is fired when an Entity's death causes dropped items to appear.
- * This event is fired whenever an Entity dies and drops items in + * This event is fired whenever an Entity dies and drops items in * EntityLivingBase#onDeath(DamageSource).
*
* This event is fired via the {@link ForgeHooks#onLivingDrops(EntityLivingBase, DamageSource, ArrayList, int, boolean, int)}.
@@ -18,7 +18,6 @@ import net.minecraft.entity.EntityLivingBase; * {@link #drops} contains the ArrayList of EntityItems that will be dropped.
* {@link #lootingLevel} contains the amount of loot that will be dropped.
* {@link #recentlyHit} determines whether the Entity doing the drop has recently been damaged.
- * {@link #specialDropValue} contains the special drop value for this even.
*
* This event is {@link Cancelable}.
* If this event is canceled, the Entity does not drop anything.
@@ -31,18 +30,16 @@ import net.minecraft.entity.EntityLivingBase; public class LivingDropsEvent extends LivingEvent { public final DamageSource source; - public final ArrayList drops; + public final List drops; public final int lootingLevel; public final boolean recentlyHit; - public final int specialDropValue; - - public LivingDropsEvent(EntityLivingBase entity, DamageSource source, ArrayList drops, int lootingLevel, boolean recentlyHit, int specialDropValue) + + public LivingDropsEvent(EntityLivingBase entity, DamageSource source, List drops, int lootingLevel, boolean recentlyHit) { super(entity); this.source = source; this.drops = drops; this.lootingLevel = lootingLevel; this.recentlyHit = recentlyHit; - this.specialDropValue = specialDropValue; } } diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingEvent.java index 086c841a1c..b0002ce22e 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.living; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.EntityLivingBase; import net.minecraftforge.event.entity.EntityEvent; diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingFallEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingFallEvent.java index 4364720acd..322325292b 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingFallEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingFallEvent.java @@ -1,11 +1,11 @@ package net.minecraftforge.event.entity.living; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.EntityLivingBase; /** * LivingFallEvent is fired when an Entity is set to be falling.
- * This event is fired whenever an Entity is set to fall in + * This event is fired whenever an Entity is set to fall in * EntityLivingBase#fall(float).
*
* This event is fired via the {@link ForgeHooks#onLivingFall(EntityLivingBase, float)}.
@@ -23,9 +23,11 @@ import net.minecraft.entity.EntityLivingBase; public class LivingFallEvent extends LivingEvent { public float distance; - public LivingFallEvent(EntityLivingBase entity, float distance) + public float damageMultiplier; + public LivingFallEvent(EntityLivingBase entity, float distance, float damageMultiplier) { super(entity); this.distance = distance; + this.damageMultiplier = damageMultiplier; } } diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingHurtEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingHurtEvent.java index 8fffe682af..4bdea7c8a4 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingHurtEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingHurtEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.living; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.util.DamageSource; import net.minecraft.entity.EntityLivingBase; diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingPackSizeEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingPackSizeEvent.java index af962c8d9a..cd196a87ce 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingPackSizeEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingPackSizeEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.living; -import cpw.mods.fml.common.eventhandler.Event.HasResult; +import net.minecraftforge.fml.common.eventhandler.Event.HasResult; import net.minecraft.entity.EntityLiving; @HasResult diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingSpawnEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingSpawnEvent.java index 56c9c3656f..2979e4341b 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingSpawnEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingSpawnEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.event.entity.living; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event.HasResult; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event.HasResult; import net.minecraft.entity.EntityLiving; import net.minecraft.world.World; diff --git a/src/main/java/net/minecraftforge/event/entity/living/ZombieEvent.java b/src/main/java/net/minecraftforge/event/entity/living/ZombieEvent.java index 7dffe1df3c..07002ddd25 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/ZombieEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/ZombieEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.living; -import cpw.mods.fml.common.eventhandler.Event.HasResult; +import net.minecraftforge.fml.common.eventhandler.Event.HasResult; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.world.World; diff --git a/src/main/java/net/minecraftforge/event/entity/minecart/MinecartInteractEvent.java b/src/main/java/net/minecraftforge/event/entity/minecart/MinecartInteractEvent.java index d03ebc31a5..ea56b9964a 100644 --- a/src/main/java/net/minecraftforge/event/entity/minecart/MinecartInteractEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/minecart/MinecartInteractEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.minecart; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.item.EntityMinecart; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/net/minecraftforge/event/entity/minecart/MinecartUpdateEvent.java b/src/main/java/net/minecraftforge/event/entity/minecart/MinecartUpdateEvent.java index 1ecef40e10..23d247f1b1 100644 --- a/src/main/java/net/minecraftforge/event/entity/minecart/MinecartUpdateEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/minecart/MinecartUpdateEvent.java @@ -1,15 +1,14 @@ package net.minecraftforge.event.entity.minecart; import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.util.BlockPos; /** * MinecartUpdateEvent is fired when a minecart is updated.
* This event is fired whenever a minecart is updated in * EntityMinecart#onUpdate().
*
- * {@link #x} contains the x-coordinate of the minecart Entity.
- * {@link #y} contains the y-coordinate of the minecart Entity.
- * {@link #z} contains the z-coordinate of the minecart Entity.
+ * {@link #pos} contains the coordinate of the track the entity is on {if applicable}.
*
* This event is not {@link Cancelable}.
*
@@ -19,15 +18,11 @@ import net.minecraft.entity.item.EntityMinecart; **/ public class MinecartUpdateEvent extends MinecartEvent { - public final float x; - public final float y; - public final float z; + public final BlockPos pos; - public MinecartUpdateEvent(EntityMinecart minecart, float x, float y, float z) + public MinecartUpdateEvent(EntityMinecart minecart, BlockPos pos) { super(minecart); - this.x = x; - this.y = y; - this.z = z; + this.pos = pos; } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/AchievementEvent.java b/src/main/java/net/minecraftforge/event/entity/player/AchievementEvent.java index a1de0fd99d..22a0d82715 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/AchievementEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/AchievementEvent.java @@ -2,8 +2,8 @@ package net.minecraftforge.event.entity.player; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.stats.Achievement; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; /** * When the player receives an achievement. If canceled the player will not receive anything. diff --git a/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java b/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java index 427452bdb4..9d3e4e9b25 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/ArrowLooseEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.player; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; diff --git a/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java b/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java index 5f01cb31d4..1ff04fa732 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/ArrowNockEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.player; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; diff --git a/src/main/java/net/minecraftforge/event/entity/player/AttackEntityEvent.java b/src/main/java/net/minecraftforge/event/entity/player/AttackEntityEvent.java index ff4ac7c0b0..f053ed9b41 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/AttackEntityEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/AttackEntityEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.player; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java b/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java index d599e1c9d1..8424fb6b71 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java @@ -1,9 +1,11 @@ package net.minecraftforge.event.entity.player; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; @Cancelable @@ -13,26 +15,22 @@ public class BonemealEvent extends PlayerEvent /** * This event is called when a player attempts to use Bonemeal on a block. * It can be canceled to completely prevent any further processing. - * - * You can also set the result to ALLOW to mark the event as processed + * + * You can also set the result to ALLOW to mark the event as processed * and use up a bonemeal from the stack but do no further processing. - * + * * setResult(ALLOW) is the same as the old setHandeled() */ public final World world; - public final Block block; - public final int x; - public final int y; - public final int z; - - public BonemealEvent(EntityPlayer player, World world, Block block, int x, int y, int z) + public final BlockPos pos; + public final IBlockState block; + + public BonemealEvent(EntityPlayer player, World world, BlockPos pos, IBlockState block) { super(player); this.world = world; + this.pos = pos; this.block = block; - this.x = x; - this.y = y; - this.z = z; } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/EntityInteractEvent.java b/src/main/java/net/minecraftforge/event/entity/player/EntityInteractEvent.java index d1635a33c4..0a4bcf42d9 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/EntityInteractEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/EntityInteractEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.event.entity.player; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event.HasResult; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event.HasResult; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/net/minecraftforge/event/entity/player/EntityItemPickupEvent.java b/src/main/java/net/minecraftforge/event/entity/player/EntityItemPickupEvent.java index 9ce4254c54..b22f7d56ca 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/EntityItemPickupEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/EntityItemPickupEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.event.entity.player; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java b/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java index 50dc459021..5e1f71ab5c 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/FillBucketEvent.java @@ -1,7 +1,7 @@ package net.minecraftforge.event.entity.player; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java index 3477d36cb3..e8d7a20c12 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerDestroyItemEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.player; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerDropsEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerDropsEvent.java index 6181b70d40..d3f5246806 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerDropsEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerDropsEvent.java @@ -1,8 +1,8 @@ package net.minecraftforge.event.entity.player; -import java.util.ArrayList; +import java.util.List; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.item.EntityItem; @@ -23,17 +23,17 @@ public class PlayerDropsEvent extends LivingDropsEvent /** * Creates a new event containing all the items that will drop into the * world when a player dies. - * @param entity The dying player. + * @param entity The dying player. * @param source The source of the damage which is killing the player. * @param drops List of all drops entering the world. */ - public PlayerDropsEvent(EntityPlayer entity, DamageSource source, ArrayList drops, boolean recentlyHit) + public PlayerDropsEvent(EntityPlayer entity, DamageSource source, List drops, boolean recentlyHit) { - super(entity, source, drops, - (source.getEntity() instanceof EntityPlayer) ? + super(entity, source, drops, + (source.getEntity() instanceof EntityPlayer) ? EnchantmentHelper.getLootingModifier(((EntityPlayer)source.getEntity())) : 0, - recentlyHit, 0); - + recentlyHit); + this.entityPlayer = entity; } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java index e282fb5b79..50b3857834 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java @@ -1,16 +1,17 @@ package net.minecraftforge.event.entity.player; import java.io.File; - -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; import net.minecraftforge.event.entity.living.LivingEvent; /** * PlayerEvent is fired whenever an event involving Living entities occurs.
- * If a method utilizes this {@link Event} as its parameter, the method will + * 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#EVENT_BUS}. @@ -23,7 +24,7 @@ public class PlayerEvent extends LivingEvent super(player); entityPlayer = player; } - + /** * HarvestCheck is fired when a player attempts to harvest a block.
* This event is fired whenever a player attempts to harvest a block in @@ -58,15 +59,12 @@ public class PlayerEvent extends LivingEvent * This event is fired whenever a player attempts to harvest a block in * EntityPlayer#canHarvestBlock(Block).
*
- * This event is fired via the {@link ForgeEventFactory#getBreakSpeed(EntityPlayer, Block, int, float, int, int, int)}.
+ * This event is fired via the {@link ForgeEventFactory#getBreakSpeed(EntityPlayer, IBlockState, float, BlockPos)}.
*
- * {@link #block} contains the block being broken.
- * {@link #metadata} contains the metadata of the block being broken.
+ * {@link #state} contains the block being broken.
* {@link #originalSpeed} contains the original speed at which the player broke the block.
* {@link #newSpeed} contains the newSpeed at which the player will break the block.
- * {@link #x} contains the x-coordinate at which this event is occurring.
- * {@link #y} contains the y-coordinate at which this event is occurring.
- * {@link #z} contains the z-coordinate at which this event is occurring.
+ * {@link #pos} contains the coordinates at which this event is occurring. Y value -1 means location is unknown.
*
* This event is {@link Cancelable}.
* If it is canceled, the player is unable to break the block.
@@ -78,30 +76,18 @@ public class PlayerEvent extends LivingEvent @Cancelable public static class BreakSpeed extends PlayerEvent { - public final Block block; - public final int metadata; + public final IBlockState state; public final float originalSpeed; public float newSpeed = 0.0f; - public final int x; - public final int y; // -1 notes unknown location - public final int z; + public final BlockPos pos; // Y position of -1 notes unknown location - @Deprecated - public BreakSpeed(EntityPlayer player, Block block, int metadata, float original) - { - this(player, block, metadata, original, 0, -1, 0); - } - - public BreakSpeed(EntityPlayer player, Block block, int metadata, float original, int x, int y, int z) + public BreakSpeed(EntityPlayer player, IBlockState state, float original, BlockPos pos) { super(player); - this.block = block; - this.metadata = metadata; + this.state = state; this.originalSpeed = original; this.newSpeed = original; - this.x = x; - this.y = y; - this.z = z; + this.pos = pos; } } @@ -156,37 +142,37 @@ public class PlayerEvent extends LivingEvent this.wasDeath = wasDeath; } } - + /** * Fired when an Entity is started to be "tracked" by this player (the player receives updates about this entity, e.g. motion). * */ public static class StartTracking extends PlayerEvent { - + /** * The Entity now being tracked. */ public final Entity target; - + public StartTracking(EntityPlayer player, Entity target) { super(player); this.target = target; } - + } - + /** * Fired when an Entity is stopped to be "tracked" by this player (the player no longer receives updates about this entity, e.g. motion). * */ public static class StopTracking extends PlayerEvent { - + /** * The Entity no longer being tracked. */ public final Entity target; - + public StopTracking(EntityPlayer player, Entity target) { super(player); diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerFlyableFallEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerFlyableFallEvent.java index 8436175a18..931e84d888 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerFlyableFallEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerFlyableFallEvent.java @@ -9,13 +9,13 @@ import net.minecraft.entity.player.EntityPlayer; */ public class PlayerFlyableFallEvent extends PlayerEvent { - public float distance; + public float multipler; - public PlayerFlyableFallEvent(EntityPlayer player, float f) + public PlayerFlyableFallEvent(EntityPlayer player, float distance, float multiplier) { super(player); - this.distance = f; + this.distance = distance; + this.multipler = multiplier; } - } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java index 1a369c2d26..9b79d880cd 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java @@ -1,10 +1,12 @@ package net.minecraftforge.event.entity.player; -import static cpw.mods.fml.common.eventhandler.Event.Result.DEFAULT; -import static cpw.mods.fml.common.eventhandler.Event.Result.DENY; +import static net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT; +import static net.minecraftforge.fml.common.eventhandler.Event.Result.DENY; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; import net.minecraft.world.World; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; /** * PlayerInteractEvent is fired when a player interacts in some way. @@ -15,13 +17,11 @@ import cpw.mods.fml.common.eventhandler.Cancelable; * ItemInWorldManager#activateBlockOrUseItem(EntityPlayer, World, ItemStack, int, int, int, int, float, float, float), * ItemInWorldManager#onBlockClicked(int, int, int, int).
*
- * This event is fired via the {@link ForgeEventFactory#onPlayerInteract(EntityPlayer, Action, int, int, int, int)}. + * This event is fired via the {@link ForgeEventFactory#onPlayerInteract(EntityPlayer, Action, BlockPos, EnumFacing)}. *
* {@link #action} contains the Action the player performed durin this interaction.
- * {@link #x} contains the x-coordinate of where this event occurred.
- * {@link #y} contains the y-coordinate of where this event occurred.
- * {@link #z} contains the z-coordinate of where this event occurred.
- * {@link #face} contains the face of the block that was interacted with.
+ * {@link #pos} contains the coordinate of where this event occurred.
+ * {@link #face} contains the face of the block that was interacted with. May be null if unknown.
* {@link #world} contains the world in which this event is occurring.
*
* This event is {@link Cancelable}.
@@ -40,35 +40,25 @@ public class PlayerInteractEvent extends PlayerEvent RIGHT_CLICK_BLOCK, LEFT_CLICK_BLOCK } - + public final Action action; - public final int x; - public final int y; - public final int z; - public final int face; public final World world; - + public final BlockPos pos; + public final EnumFacing face; // Can be null if unknown + public Result useBlock = DEFAULT; public Result useItem = DEFAULT; - @Deprecated - public PlayerInteractEvent(EntityPlayer player, Action action, int x, int y, int z, int face) - { - this(player, action, x, y, z, face, player.worldObj); - } - - public PlayerInteractEvent(EntityPlayer player, Action action, int x, int y, int z, int face, World world) + public PlayerInteractEvent(EntityPlayer player, Action action, BlockPos pos, EnumFacing face, World world) { super(player); this.action = action; - this.x = x; - this.y = y; - this.z = z; + this.pos = pos; this.face = face; - if (face == -1) useBlock = DENY; + if (face == null) useBlock = DENY; this.world = world; } - + @Override public void setCanceled(boolean cancel) { diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerOpenContainerEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerOpenContainerEvent.java index dde290ea5e..52358ace7c 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerOpenContainerEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerOpenContainerEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.player; -import cpw.mods.fml.common.eventhandler.Event.HasResult; +import net.minecraftforge.fml.common.eventhandler.Event.HasResult; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; @@ -13,12 +13,12 @@ public class PlayerOpenContainerEvent extends PlayerEvent /** * This event is fired when a player attempts to view a container during * player tick. - * + * * setResult ALLOW to allow the container to stay open * setResult DENY to force close the container (denying access) - * - * DEFAULT is vanilla behaviour - * + * + * DEFAULT is vanilla behavior + * */ public PlayerOpenContainerEvent(EntityPlayer player, Container openContainer) diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerPickupXpEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerPickupXpEvent.java index 9b27a80cf7..fedb6c038e 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerPickupXpEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerPickupXpEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.player; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java index 59b29d797d..0d256b6ac3 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java @@ -2,12 +2,13 @@ package net.minecraftforge.event.entity.player; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer.EnumStatus; +import net.minecraft.util.BlockPos; /** * PlayerSleepInBedEvent is fired when a player sleeps in a bed. *
* This event is fired whenever a player sleeps in a bed in - * EntityPlayer#sleepInBedAt(int, int, int).
+ * EntityPlayer#sleepInBedAt(BlockPos).
*
* {@link #result} contains whether the player is able to sleep.
*
@@ -20,16 +21,12 @@ import net.minecraft.entity.player.EntityPlayer.EnumStatus; public class PlayerSleepInBedEvent extends PlayerEvent { public EnumStatus result = null; - public final int x; - public final int y; - public final int z; + public final BlockPos pos; - public PlayerSleepInBedEvent(EntityPlayer player, int x, int y, int z) + public PlayerSleepInBedEvent(EntityPlayer player, BlockPos pos) { super(player); - this.x = x; - this.y = y; - this.z = z; + this.pos = pos; } } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerUseItemEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerUseItemEvent.java index ff91c6f94a..2387de5d7f 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerUseItemEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerUseItemEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.entity.player; -import cpw.mods.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; diff --git a/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java b/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java index 2d93d21933..bc9f50f053 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/UseHoeEvent.java @@ -1,38 +1,35 @@ package net.minecraftforge.event.entity.player; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; @Cancelable @Event.HasResult public class UseHoeEvent extends PlayerEvent { /** - * This event is fired when a player attempts to use a Hoe on a block, it + * This event is fired when a player attempts to use a Hoe on a block, it * can be canceled to completely prevent any further processing. - * - * You can also set the result to ALLOW to mark the event as processed + * + * You can also set the result to ALLOW to mark the event as processed * and damage the hoe. - * + * * setResult(ALLOW) is the same as the old setHandeled(); */ public final ItemStack current; public final World world; - public final int x; - public final int y; - public final int z; - - public UseHoeEvent(EntityPlayer player, ItemStack current, World world, int x, int y, int z) + public final BlockPos pos; + + public UseHoeEvent(EntityPlayer player, ItemStack current, World world, BlockPos pos) { super(player); this.current = current; this.world = world; - this.x = x; - this.y = y; - this.z = z; + this.pos = pos; } } diff --git a/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java b/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java index 8dbd86ee1d..55c4a1675d 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java @@ -1,14 +1,15 @@ package net.minecraftforge.event.terraingen; -import cpw.mods.fml.common.eventhandler.Event; -import cpw.mods.fml.common.eventhandler.Event.HasResult; +import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event.HasResult; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenBase; /** * BiomeEvent is fired whenever an event involving biomes occurs.
- * If a method utilizes this {@link Event} as its parameter, the method will + * 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}. @@ -21,7 +22,7 @@ public class BiomeEvent extends Event { this.biome = biome; } - + /** * CreateDecorator is fired when a BiomeDecorator is created.
* This event is fired whenever a BiomeDecorator is created in @@ -40,7 +41,7 @@ public class BiomeEvent extends Event { public final BiomeDecorator originalBiomeDecorator; public BiomeDecorator newBiomeDecorator; - + public CreateDecorator(BiomeGenBase biome, BiomeDecorator original) { super(biome); @@ -51,7 +52,7 @@ public class BiomeEvent extends Event /** * BiomeColor is fired whenever an event involving biome colors occurs.
- * If a method utilizes this {@link Event} as its parameter, the method will + * 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}. @@ -60,7 +61,7 @@ public class BiomeEvent extends Event { public final int originalColor; public int newColor; - + public BiomeColor(BiomeGenBase biome, int original) { super(biome); @@ -68,51 +69,28 @@ public class BiomeEvent extends Event newColor = original; } } - + /** * 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 { - public final Block original; - public final int type; - public Block replacement; + public final IBlockState original; + public IBlockState replacement; - public GetVillageBlockID(BiomeGenBase biome, Block original, int type) + public GetVillageBlockID(BiomeGenBase biome, IBlockState original) { super(biome); this.original = original; - this.type = type; } } - - /** - * This event is fired when the village generator attempts to choose a block - * metadata based on the village's biome. - * - * You can set the result to DENY to prevent the default block metadata selection. - */ - @HasResult - public static class GetVillageBlockMeta extends BiomeEvent - { - public final Block original; - public final int type; - public int replacement; - public GetVillageBlockMeta(BiomeGenBase biome, Block original, int type) - { - super(biome); - this.original = original; - this.type = type; - } - } - /** - * This event is fired when a biome is queried for its grass color. + * This event is fired when a biome is queried for its grass color. */ public static class GetGrassColor extends BiomeColor { @@ -121,9 +99,9 @@ public class BiomeEvent extends Event super(biome, original); } } - + /** - * This event is fired when a biome is queried for its grass color. + * This event is fired when a biome is queried for its grass color. */ public static class GetFoliageColor extends BiomeColor { @@ -132,9 +110,9 @@ public class BiomeEvent extends Event super(biome, original); } } - + /** - * This event is fired when a biome is queried for its water color. + * This event is fired when a biome is queried for its water color. */ public static class GetWaterColor extends BiomeColor { diff --git a/src/main/java/net/minecraftforge/event/terraingen/ChunkProviderEvent.java b/src/main/java/net/minecraftforge/event/terraingen/ChunkProviderEvent.java index e71a0de866..1da93b7f3a 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/ChunkProviderEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/ChunkProviderEvent.java @@ -1,9 +1,10 @@ package net.minecraftforge.event.terraingen; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.chunk.IChunkProvider; public class ChunkProviderEvent extends Event @@ -25,33 +26,17 @@ public class ChunkProviderEvent extends Event @HasResult public static class ReplaceBiomeBlocks extends ChunkProviderEvent { - public final int chunkX; - public final int chunkZ; - public final Block[] blockArray; - public final byte[] metaArray; // CAN BE NULL - public final BiomeGenBase[] biomeArray; + public final int x; + public final int z; + public final ChunkPrimer primer; public final World world; // CAN BE NULL - @Deprecated // TODO: Remove in 1.8 - public ReplaceBiomeBlocks(IChunkProvider chunkProvider, int chunkX, int chunkZ, Block[] blockArray, BiomeGenBase[] biomeArray) - { - this(chunkProvider, chunkX, chunkZ, blockArray, new byte[256], biomeArray, null); - } - - @Deprecated // TODO: Remove in 1.8 - public ReplaceBiomeBlocks(IChunkProvider chunkProvider, int chunkX, int chunkZ, Block[] blockArray, byte[] metaArray, BiomeGenBase[] biomeArray) - { - this(chunkProvider, chunkZ, chunkZ, blockArray, metaArray, biomeArray, null); - } - - public ReplaceBiomeBlocks(IChunkProvider chunkProvider, int chunkX, int chunkZ, Block[] blockArray, byte[] metaArray, BiomeGenBase[] biomeArray, World world) + public ReplaceBiomeBlocks(IChunkProvider chunkProvider, int x, int z, ChunkPrimer primer, World world) { super(chunkProvider); - this.chunkX = chunkX; - this.chunkZ = chunkZ; - this.blockArray = blockArray; - this.biomeArray = biomeArray; - this.metaArray = metaArray; + this.x = x; + this.z = z; + this.primer = primer; this.world = world; } diff --git a/src/main/java/net/minecraftforge/event/terraingen/DecorateBiomeEvent.java b/src/main/java/net/minecraftforge/event/terraingen/DecorateBiomeEvent.java index ad8af5e528..1e6f0a1cf7 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/DecorateBiomeEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/DecorateBiomeEvent.java @@ -1,9 +1,9 @@ package net.minecraftforge.event.terraingen; import java.util.Random; - -import cpw.mods.fml.common.eventhandler.Event; -import cpw.mods.fml.common.eventhandler.Event.HasResult; +import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event.HasResult; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; /**DecorateBiomeEvent is fired when a BiomeDecorator is created. @@ -12,9 +12,8 @@ import net.minecraft.world.World; * DeferredBiomeDecorator#fireCreateEventAndReplace(BiomeGenBase).
*
* {@link #world} contains the world that is being decorated.
- * {@link #rand} contains an instane of Random to be used.
- * {@link #chunkX} contains the x-coordinate of the Chunk being decorated.
- * {@link #chunkZ} contains the z-coordinate of the Chunk being decorated.
+ * {@link #rand} contains an instance of Random to be used.
+ * {@link #pos} contains the coordinates of the Chunk being decorated.
*
* This event is not {@link Cancelable}. *
@@ -26,42 +25,40 @@ public class DecorateBiomeEvent extends Event { public final World world; public final Random rand; - public final int chunkX; - public final int chunkZ; - - public DecorateBiomeEvent(World world, Random rand, int worldX, int worldZ) + public final BlockPos pos; + + public DecorateBiomeEvent(World world, Random rand, BlockPos pos) { this.world = world; this.rand = rand; - this.chunkX = worldX; - this.chunkZ = worldZ; + this.pos = pos; } - + /** * 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, int worldX, int worldZ) + public Pre(World world, Random rand, BlockPos pos) { - super(world, rand, worldX, worldZ); + super(world, rand, pos); } } - + /** * 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, int worldX, int worldZ) + public Post(World world, Random rand, BlockPos pos) { - super(world, rand, worldX, worldZ); + super(world, rand, pos); } } /** * 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 @@ -69,13 +66,13 @@ public class DecorateBiomeEvent extends Event { /** Use CUSTOM to filter custom event types */ - public static enum EventType { BIG_SHROOM, CACTUS, CLAY, DEAD_BUSH, LILYPAD, FLOWERS, GRASS, LAKE, PUMPKIN, REED, SAND, SAND_PASS2, SHROOM, TREE, CUSTOM } - + public static enum EventType { BIG_SHROOM, CACTUS, CLAY, DEAD_BUSH, LILYPAD, FLOWERS, GRASS, LAKE_WATER, LAKE_LAVA, PUMPKIN, REED, SAND, SAND_PASS2, SHROOM, TREE, CUSTOM } + public final EventType type; - - public Decorate(World world, Random rand, int worldX, int worldZ, EventType type) + + public Decorate(World world, Random rand, BlockPos pos, EventType type) { - super(world, rand, worldX, worldZ); + super(world, rand, pos); this.type = type; } } diff --git a/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java b/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java index 9f6dfa0f07..9586b57c67 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java +++ b/src/main/java/net/minecraftforge/event/terraingen/DeferredBiomeDecorator.java @@ -1,7 +1,7 @@ package net.minecraftforge.event.terraingen; import java.util.Random; - +import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenBase; @@ -16,11 +16,11 @@ public class DeferredBiomeDecorator extends BiomeDecorator { } @Override - public void decorateChunk(World par1World, Random par2Random, BiomeGenBase biome, int par3, int par4) + public void func_180292_a(World par1World, Random par2Random, BiomeGenBase biome, BlockPos pos) { fireCreateEventAndReplace(biome); // On first call to decorate, we fire and substitute ourselves, if we haven't already done so - biome.theBiomeDecorator.decorateChunk(par1World, par2Random, biome, par3, par4); + biome.theBiomeDecorator.func_180292_a(par1World, par2Random, biome, pos); } public void fireCreateEventAndReplace(BiomeGenBase biome) { @@ -38,7 +38,7 @@ public class DeferredBiomeDecorator extends BiomeDecorator { wrapped.sandPerChunk2 = sandPerChunk2; wrapped.treesPerChunk = treesPerChunk; wrapped.waterlilyPerChunk = waterlilyPerChunk; - + BiomeEvent.CreateDecorator event = new BiomeEvent.CreateDecorator(biome, wrapped); MinecraftForge.TERRAIN_GEN_BUS.post(event); biome.theBiomeDecorator = event.newBiomeDecorator; diff --git a/src/main/java/net/minecraftforge/event/terraingen/InitMapGenEvent.java b/src/main/java/net/minecraftforge/event/terraingen/InitMapGenEvent.java index 61fa5344a2..c08f7c1b75 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/InitMapGenEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/InitMapGenEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.terraingen; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.world.gen.MapGenBase; public class InitMapGenEvent extends Event diff --git a/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java b/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java index 004e4ab2c1..c45a98e7e7 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java @@ -1,21 +1,20 @@ package net.minecraftforge.event.terraingen; import java.util.Random; - -import cpw.mods.fml.common.eventhandler.Event; -import cpw.mods.fml.common.eventhandler.Event.HasResult; +import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event.HasResult; +import net.minecraft.util.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 Event} as its parameter, the method will + * If a method utilizes this {@link 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 #worldX} contains the x-coordinate of the block position currently being populated with ores.
- * {@link #worldZ} contains the z-coordinate of the block position currently being populated with ores.
+ * {@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}.
**/ @@ -23,20 +22,18 @@ public class OreGenEvent extends Event { public final World world; public final Random rand; - public final int worldX; - public final int worldZ; - - public OreGenEvent(World world, Random rand, int worldX, int worldZ) + public final BlockPos pos; + + public OreGenEvent(World world, Random rand, BlockPos pos) { this.world = world; this.rand = rand; - this.worldX = worldX; - this.worldZ = worldZ; + this.pos = pos; } - + /** * OreGenEvent.Pre is fired just before a chunk is populated with ores.
- * This event is fired just before ore generation in + * This event is fired just before ore generation in * BiomeDecorator#generateOres().
*
* This event is not {@link Cancelable}.
@@ -47,15 +44,15 @@ public class OreGenEvent extends Event **/ public static class Pre extends OreGenEvent { - public Pre(World world, Random rand, int worldX, int worldZ) + public Pre(World world, Random rand, BlockPos pos) { - super(world, rand, worldX, worldZ); + 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 + * This event is fired just after ore generation in * BiomeDecorator#generateOres().
*
* This event is not {@link Cancelable}.
@@ -63,18 +60,18 @@ public class OreGenEvent extends Event * 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, int worldX, int worldZ) + public Post(World world, Random rand, BlockPos pos) { - super(world, rand, worldX, worldZ); + 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 + * This event is fired just after ore generation in * BiomeDecorator#generateOres().
*
* {@link #type} contains the enum value for the Ore attempting to be generated.
@@ -86,18 +83,18 @@ public class OreGenEvent extends Event * This result determines whether the ore is allowed to be generated.
*
* This event is fired on the {@link MinecraftForge#ORE_GEN_BUS}.
- **/ + **/ @HasResult public static class GenerateMinable extends OreGenEvent { - public static enum EventType { COAL, DIAMOND, DIRT, GOLD, GRAVEL, IRON, LAPIS, REDSTONE, QUARTZ, CUSTOM } - + public static enum EventType { COAL, DIAMOND, DIRT, GOLD, GRAVEL, IRON, LAPIS, REDSTONE, QUARTZ, DIORITE, GRANITE, ANDESITE, CUSTOM } + public final EventType type; public final WorldGenerator generator; - - public GenerateMinable(World world, Random rand, WorldGenerator generator, int worldX, int worldZ, EventType type) + + public GenerateMinable(World world, Random rand, WorldGenerator generator, BlockPos pos, EventType type) { - super(world, rand, worldX, worldZ); + super(world, rand, pos); this.generator = generator; this.type = type; } diff --git a/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java b/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java index 4e55722618..cfc77547f5 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/PopulateChunkEvent.java @@ -2,8 +2,8 @@ package net.minecraftforge.event.terraingen; import java.util.Random; -import cpw.mods.fml.common.eventhandler.Event; -import cpw.mods.fml.common.eventhandler.Event.HasResult; +import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event.HasResult; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; @@ -27,7 +27,7 @@ public class PopulateChunkEvent extends ChunkProviderEvent public final int chunkX; public final int chunkZ; public final boolean hasVillageGenerated; - + public PopulateChunkEvent(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) { super(chunkProvider); @@ -37,12 +37,12 @@ public class PopulateChunkEvent extends ChunkProviderEvent this.chunkZ = chunkZ; this.hasVillageGenerated = hasVillageGenerated; } - + /** * PopulateChunkEvent.Pre is fired just before a chunk is populated a terrain feature.
- * This event is fired just before terrain feature generation in + * This event is fired just before terrain feature generation in * ChunkProviderEnd#populate(IChunkProvider, int, int), - * ChunkProviderGenerate#populate(IChunkProvider, int, int), + * ChunkProviderGenerate#populate(IChunkProvider, int, int), * and ChunkProviderHell#populate(IChunkProvider, int, int).
*
* This event is not {@link Cancelable}.
@@ -58,12 +58,12 @@ public class PopulateChunkEvent extends ChunkProviderEvent super(chunkProvider, 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 + * This event is fired just after terrain feature generation in * ChunkProviderEnd#populate(IChunkProvider, int, int), - * ChunkProviderGenerate#populate(IChunkProvider, int, int), + * ChunkProviderGenerate#populate(IChunkProvider, int, int), * and ChunkProviderHell#populate(IChunkProvider, int, int).
*
* This event is not {@link Cancelable}.
@@ -79,7 +79,7 @@ public class PopulateChunkEvent extends ChunkProviderEvent 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 @@ -101,8 +101,8 @@ public class PopulateChunkEvent extends ChunkProviderEvent { /** Use CUSTOM to filter custom event types */ - public static enum EventType { DUNGEON, FIRE, GLOWSTONE, ICE, LAKE, LAVA, NETHER_LAVA, ANIMALS, CUSTOM } - + public static enum EventType { DUNGEON, FIRE, GLOWSTONE, ICE, LAKE, LAVA, NETHER_LAVA, NETHER_LAVA2, ANIMALS, CUSTOM } + public final EventType type; public Populate(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated, EventType type) diff --git a/src/main/java/net/minecraftforge/event/terraingen/SaplingGrowTreeEvent.java b/src/main/java/net/minecraftforge/event/terraingen/SaplingGrowTreeEvent.java index a11a650e38..5e95749354 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/SaplingGrowTreeEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/SaplingGrowTreeEvent.java @@ -1,19 +1,17 @@ package net.minecraftforge.event.terraingen; import java.util.Random; - -import cpw.mods.fml.common.eventhandler.Event.HasResult; +import net.minecraftforge.fml.common.eventhandler.Event.HasResult; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraftforge.event.world.WorldEvent; /** - * SaplingGrowTreeEvent is fired when a spling grows into a tree.
+ * SaplingGrowTreeEvent is fired when a sapling grows into a tree.
* This event is fired during sapling growth in - * BlockSapling#func_149878_d(World, int, int, int, Random).
+ * BlockSapling#func_149878_d(World, BlockPos, Random).
*
- * {@link #x} contains the x-coordinate of the growing sapling.
- * {@link #y} contains the y-coordinate of the growing sapling.
- * {@link #z} contains the z-coordinate of the growing sapling.
+ * {@link #pos} contains the coordinates of the growing sapling.
* {@link #rand} contains an instance of Random for use.
*
* This event is not {@link Cancelable}.
@@ -26,17 +24,13 @@ import net.minecraftforge.event.world.WorldEvent; @HasResult public class SaplingGrowTreeEvent extends WorldEvent { - public final int x; - public final int y; - public final int z; + public final BlockPos pos; public final Random rand; - - public SaplingGrowTreeEvent(World world, Random rand, int x, int y, int z) + + public SaplingGrowTreeEvent(World world, Random rand, BlockPos pos) { super(world); this.rand = rand; - this.x = x; - this.y = y; - this.z = z; + this.pos = pos; } } diff --git a/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java b/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java index a1f23a72da..881cc63a70 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java +++ b/src/main/java/net/minecraftforge/event/terraingen/TerrainGen.java @@ -1,9 +1,8 @@ package net.minecraftforge.event.terraingen; import java.util.Random; - -import cpw.mods.fml.common.eventhandler.Event.*; - +import net.minecraftforge.fml.common.eventhandler.Event.*; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.MapGenBase; @@ -29,31 +28,31 @@ public abstract class TerrainGen MinecraftForge.TERRAIN_GEN_BUS.post(event); return event.newGen; } - + public static boolean populate(IChunkProvider 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; } - - public static boolean decorate(World world, Random rand, int chunkX, int chunkZ, Decorate.EventType type) + + public static boolean decorate(World world, Random rand, BlockPos pos, Decorate.EventType type) { - Decorate event = new Decorate(world, rand, chunkX, chunkZ, type); + Decorate event = new Decorate(world, rand, pos, type); MinecraftForge.TERRAIN_GEN_BUS.post(event); return event.getResult() != Result.DENY; } - - public static boolean generateOre(World world, Random rand, WorldGenerator generator, int worldX, int worldZ, GenerateMinable.EventType type) + + public static boolean generateOre(World world, Random rand, WorldGenerator generator, BlockPos pos, GenerateMinable.EventType type) { - GenerateMinable event = new GenerateMinable(world, rand, generator, worldX, worldZ, 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(World world, Random rand, int x, int y, int z) + + public static boolean saplingGrowTree(World world, Random rand, BlockPos pos) { - SaplingGrowTreeEvent event = new SaplingGrowTreeEvent(world, rand, x, y, z); + 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 index 6badfc2032..463f644cb6 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/WorldTypeEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/WorldTypeEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.terraingen; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.WorldType; @@ -39,10 +39,10 @@ public class WorldTypeEvent extends Event **/ public static class BiomeSize extends WorldTypeEvent { - public final byte originalSize; - public byte newSize; - - public BiomeSize(WorldType worldType, byte original) + public final int originalSize; + public int newSize; + + public BiomeSize(WorldType worldType, int original) { super(worldType); originalSize = original; @@ -52,7 +52,7 @@ public class WorldTypeEvent extends Event /** * InitBiomeGens is fired when vanilla Minecraft attempts to initialize the biome generators.
- * This event is fired just during biome generator initialization in + * This event is fired just during biome generator initialization in * WorldChunkManager#WorldChunkManager(long, WorldType).
*
* {@link #seed} the seed of the world.
@@ -71,7 +71,7 @@ public class WorldTypeEvent extends Event public final long seed; public final GenLayer[] originalBiomeGens; public GenLayer[] newBiomeGens; - + public InitBiomeGens(WorldType worldType, long seed, GenLayer[] original) { super(worldType); diff --git a/src/main/java/net/minecraftforge/event/world/BlockEvent.java b/src/main/java/net/minecraftforge/event/world/BlockEvent.java index 5033edfdf0..4315a28c06 100644 --- a/src/main/java/net/minecraftforge/event/world/BlockEvent.java +++ b/src/main/java/net/minecraftforge/event/world/BlockEvent.java @@ -3,59 +3,56 @@ package net.minecraftforge.event.world; import java.util.ArrayList; import java.util.List; -import com.google.common.collect.ImmutableList; - -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.util.BlockSnapshot; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; -public class BlockEvent extends Event { +import com.google.common.collect.ImmutableList; + +public class BlockEvent extends Event +{ private static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("forge.debugBlockEvent", "false")); - public final int x; - public final int y; - public final int z; public final World world; - public final Block block; - public final int blockMetadata; - public BlockEvent(int x, int y, int z, World world, Block block, int blockMetadata) + public final BlockPos pos; + public final IBlockState state; + public BlockEvent(World world, BlockPos pos, IBlockState state) { - this.x = x; - this.y = y; - this.z = z; + this.pos = pos; this.world = world; - this.block = block; - this.blockMetadata = blockMetadata; + this.state = state; } - + /** * Fired when a block is about to drop it's harvested items. The {@link #drops} array can be amended, as can the {@link #dropChance}. * Note well: the {@link #harvester} player field is null in a variety of scenarios. Code expecting null. - * - * The {@link #dropChance} is used to determine which items in this array will actually drop, compared to a random number. If you wish, you + * + * The {@link #dropChance} is used to determine which items in this array will actually drop, compared to a random number. If you wish, you * can pre-filter yourself, and set {@link #dropChance} to 1.0f to always drop the contents of the {@link #drops} array. - * + * * {@link #isSilkTouching} is set if this is considered a silk touch harvesting operation, vs a normal harvesting operation. Act accordingly. - * + * * @author cpw */ - public static class HarvestDropsEvent extends BlockEvent { + public static class HarvestDropsEvent extends BlockEvent + { public final int fortuneLevel; - public final ArrayList drops; + public final List drops; public final boolean isSilkTouching; public float dropChance; // Change to e.g. 1.0f, if you manipulate the list and want to guarantee it always drops public final EntityPlayer harvester; // May be null for non-player harvesting such as explosions or machines - public HarvestDropsEvent(int x, int y, int z, World world, Block block, int blockMetadata, int fortuneLevel, float dropChance, ArrayList drops, EntityPlayer harvester, boolean isSilkTouching) + public HarvestDropsEvent(World world, BlockPos pos, IBlockState state, int fortuneLevel, float dropChance, List drops, EntityPlayer harvester, boolean isSilkTouching) { - super(x, y, z, world, block, blockMetadata); + super(world, pos, state); this.fortuneLevel = fortuneLevel; this.dropChance = dropChance; this.drops = drops; @@ -63,33 +60,32 @@ public class BlockEvent extends Event { this.harvester = harvester; } } - + /** * Event that is fired when an Block is about to be broken by a player * Canceling this event will prevent the Block from being broken. */ @Cancelable - public static class BreakEvent extends BlockEvent + public static class BreakEvent extends BlockEvent { /** Reference to the Player who broke the block. If no player is available, use a EntityFakePlayer */ private final EntityPlayer player; private int exp; - public BreakEvent(int x, int y, int z, World world, Block block, int blockMetadata, EntityPlayer player) + public BreakEvent(World world, BlockPos pos, IBlockState state, EntityPlayer player) { - super(x, y, z, world, block, blockMetadata); + super(world, pos, state); this.player = player; - if (block == null || !ForgeHooks.canHarvestBlock(block, player, blockMetadata) || // Handle empty block or player unable to break block scenario - block.canSilkHarvest(world, player, x, y, z, blockMetadata) && EnchantmentHelper.getSilkTouchModifier(player)) // If the block is being silk harvested, the exp dropped is 0 + if (state == null || !ForgeHooks.canHarvestBlock(state.getBlock(), player, world, pos) || // Handle empty block or player unable to break block scenario + (state.getBlock().canSilkHarvest(world, pos, world.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player))) // If the block is being silk harvested, the exp dropped is 0 { this.exp = 0; } else { - int meta = block.getDamageValue(world, x, y, z); int bonusLevel = EnchantmentHelper.getFortuneModifier(player); - this.exp = block.getExpDrop(world, meta, bonusLevel); + this.exp = state.getBlock().getExpDrop(world, pos, bonusLevel); } } @@ -97,7 +93,7 @@ public class BlockEvent extends Event { { return player; } - + /** * Get the experience dropped by the block after the event has processed * @@ -125,16 +121,17 @@ public class BlockEvent extends Event { * If a Block Place event is cancelled, the block will not be placed. */ @Cancelable - public static class PlaceEvent extends BlockEvent { - + public static class PlaceEvent extends BlockEvent + { public final EntityPlayer player; public final ItemStack itemInHand; public final BlockSnapshot blockSnapshot; - public final Block placedBlock; - public final Block placedAgainst; + public final IBlockState placedBlock; + public final IBlockState placedAgainst; - public PlaceEvent(BlockSnapshot blockSnapshot, Block placedAgainst, EntityPlayer player) { - super(blockSnapshot.x, blockSnapshot.y, blockSnapshot.z, blockSnapshot.world, blockSnapshot.getCurrentBlock(), blockSnapshot.meta); + public PlaceEvent(BlockSnapshot blockSnapshot, IBlockState placedAgainst, EntityPlayer player) + { + super(blockSnapshot.world, blockSnapshot.pos, blockSnapshot.getCurrentBlock()); this.player = player; this.itemInHand = player.getCurrentEquippedItem(); this.blockSnapshot = blockSnapshot; @@ -150,15 +147,17 @@ public class BlockEvent extends Event { /** * Fired when a single block placement action of a player triggers the * creation of multiple blocks(e.g. placing a bed block). The block returned - * by {@link #block} and its related methods is the block where + * by {@link #state} and its related methods is the block where * the placed block would exist if the placement only affected a single * block. */ @Cancelable - public static class MultiPlaceEvent extends PlaceEvent { + public static class MultiPlaceEvent extends PlaceEvent + { private final List blockSnapshots; - public MultiPlaceEvent(List blockSnapshots, Block placedAgainst, EntityPlayer player) { + public MultiPlaceEvent(List blockSnapshots, IBlockState placedAgainst, EntityPlayer player) + { super(blockSnapshots.get(0), placedAgainst, player); this.blockSnapshots = ImmutableList.copyOf(blockSnapshots); if (DEBUG) @@ -173,7 +172,8 @@ public class BlockEvent extends Event { * * @return immutable list of replaced BlockSnapshots */ - public List getReplacedBlockSnapshots() { + public List getReplacedBlockSnapshots() + { return blockSnapshots; } } diff --git a/src/main/java/net/minecraftforge/event/world/ChunkEvent.java b/src/main/java/net/minecraftforge/event/world/ChunkEvent.java index 1309eba6f8..e58516f92d 100644 --- a/src/main/java/net/minecraftforge/event/world/ChunkEvent.java +++ b/src/main/java/net/minecraftforge/event/world/ChunkEvent.java @@ -14,18 +14,18 @@ import net.minecraft.world.chunk.Chunk; public class ChunkEvent extends WorldEvent { private final Chunk chunk; - + public ChunkEvent(Chunk chunk) { - super(chunk.worldObj); + super(chunk.getWorld()); this.chunk = chunk; } - + public Chunk getChunk() { return chunk; } - + /** * ChunkEvent.Load is fired when vanilla Minecraft attempts to load a Chunk into the world.
* This event is fired during chunk loading in
@@ -45,7 +45,7 @@ public class ChunkEvent extends WorldEvent super(chunk); } } - + /** * ChunkEvent.Unload is fired when vanilla Minecraft attempts to unload a Chunk from the world.
* This event is fired during chunk unloading in
diff --git a/src/main/java/net/minecraftforge/event/world/ChunkWatchEvent.java b/src/main/java/net/minecraftforge/event/world/ChunkWatchEvent.java index 438493b9ef..e94c57cc32 100644 --- a/src/main/java/net/minecraftforge/event/world/ChunkWatchEvent.java +++ b/src/main/java/net/minecraftforge/event/world/ChunkWatchEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.event.world; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.entity.player.EntityPlayerMP; diff --git a/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java b/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java index 6916ca0b1f..e9e3894e84 100644 --- a/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java +++ b/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java @@ -3,11 +3,13 @@ package net.minecraftforge.event.world; import com.google.common.base.Preconditions; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraftforge.event.world.BlockEvent; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; /** * Base class for Noteblock Events @@ -17,12 +19,12 @@ public class NoteBlockEvent extends BlockEvent { private int noteId; - NoteBlockEvent(World world, int x, int y, int z, int meta, int note) + NoteBlockEvent(World world, BlockPos pos, IBlockState state, int note) { - super(x, y, z, world, Blocks.noteblock, meta); + super(world, pos, state); this.noteId = note; } - + /** * Get the Note the Noteblock is tuned to * @return the Note @@ -33,7 +35,7 @@ public class NoteBlockEvent extends BlockEvent } /** - * Get the Octave of the note this Noteblock is tuned to + * Get the Octave of the note this Noteblock is tuned to * @return the Octave */ public Octave getOctave() @@ -52,7 +54,7 @@ public class NoteBlockEvent extends BlockEvent /** * Set Note and Octave for this event.
- * If octave is Octave.HIGH, note may only be Note.F_SHARP + * If octave is Octave.HIGH, note may only be Note.F_SHARP * @param note the Note * @param octave the Octave */ @@ -71,13 +73,13 @@ public class NoteBlockEvent extends BlockEvent { public Instrument instrument; - public Play(World world, int x, int y, int z, int meta, int note, int instrument) + public Play(World world, BlockPos pos, IBlockState state, int note, int instrument) { - super(world, x, y, z, meta, note); + super(world, pos, state, note); this.instrument = Instrument.fromId(instrument); } } - + /** * Fired when a Noteblock is changed. You can adjust the note it will change to via {@link #setNote(Note, Octave)}. * Canceling this event will not change the note and also stop the Noteblock from playing it's note. @@ -87,15 +89,15 @@ public class NoteBlockEvent extends BlockEvent { public final Note oldNote; public final Octave oldOctave; - - public Change(World world, int x, int y, int z, int meta, int oldNote, int newNote) + + public Change(World world, BlockPos pos, IBlockState state, int oldNote, int newNote) { - super(world, x, y, z, meta, newNote); + super(world, pos, state, newNote); this.oldNote = Note.fromId(oldNote); this.oldOctave = Octave.fromId(oldNote); - } + } } - + /** * Describes the types of musical Instruments that can be played by a Noteblock. * The Instrument being played can be overridden with {@link NoteBlockEvent.Play#setInstrument(Instrument)} @@ -107,19 +109,19 @@ public class NoteBlockEvent extends BlockEvent SNARE, CLICKS, BASSGUITAR; - + // cache to avoid creating a new array every time private static final Instrument[] values = values(); - + static Instrument fromId(int id) { return id < 0 || id > 4 ? PIANO : values[id]; } } - + /** * Information about the pitch of a Noteblock note. - * For altered notes such as G-Sharp / A-Flat the Sharp variant is used here. + * For altered notes such as G-Sharp / A-Flat the Sharp variant is used here. * */ public static enum Note @@ -136,15 +138,15 @@ public class NoteBlockEvent extends BlockEvent D_SHARP, E, F; - + private static final Note[] values = values(); - + static Note fromId(int id) { return values[id % 12]; - } + } } - + /** * Describes the Octave of a Note being played by a Noteblock. * Together with {@link Note} it fully describes the note. @@ -155,7 +157,7 @@ public class NoteBlockEvent extends BlockEvent LOW, MID, HIGH; // only valid for F_SHARP - + static Octave fromId(int id) { return id < 12 ? LOW : id == 24 ? HIGH : MID; diff --git a/src/main/java/net/minecraftforge/event/world/WorldEvent.java b/src/main/java/net/minecraftforge/event/world/WorldEvent.java index 3a420338a3..eaffe5ab60 100644 --- a/src/main/java/net/minecraftforge/event/world/WorldEvent.java +++ b/src/main/java/net/minecraftforge/event/world/WorldEvent.java @@ -2,16 +2,16 @@ package net.minecraftforge.event.world; import java.util.ArrayList; import java.util.List; - import net.minecraft.entity.EnumCreatureType; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; /** * WorldEvent is fired when an event involving the world occurs.
- * If a method utilizes this {@link Event} as its parameter, the method will + * If a method utilizes this {@link Event} as its parameter, the method will * receive every child event of this class.
*
* {@link #world} contains the World this event is occuring in.
@@ -31,8 +31,8 @@ public class WorldEvent extends Event * WorldEvent.Load is fired when Minecraft loads a world.
* This event is fired when a world is loaded in * WorldClient#WorldClient(NetHandlerPlayClient, WorldSettings, int, EnumDifficulty, Profiler), - * MinecraftServer#loadAllWorlds(String, String, long, WorldType, String), - * DimensionManager#initDimension(int), + * MinecraftServer#loadAllWorlds(String, String, long, WorldType, String), + * DimensionManager#initDimension(int), * and ForgeInternalHandler#onDimensionLoad(Load).
*
* This event is not {@link Cancelable}.
@@ -49,10 +49,10 @@ public class WorldEvent extends Event /** * WorldEvent.Unload is fired when Minecraft unloads a world.
* This event is fired when a world is unloaded in - * Minecraft#loadWorld(WorldClient, String), - * MinecraftServer#deleteWorldAndStopServer(), - * MinecraftServer#stopServer(), - * DimensionManager#unloadWorlds(Hashtable), + * Minecraft#loadWorld(WorldClient, String), + * MinecraftServer#deleteWorldAndStopServer(), + * MinecraftServer#stopServer(), + * DimensionManager#unloadWorlds(Hashtable), * ForgeInternalHandler#onDimensionUnload(Unload).
*
* This event is not {@link Cancelable}.
@@ -69,7 +69,7 @@ public class WorldEvent extends Event /** * WorldEvent.Save is fired when Minecraft saves a world.
* This event is fired when a world is saved in - * WorldServer#saveAllChunks(boolean, IProgressUpdate), + * WorldServer#saveAllChunks(boolean, IProgressUpdate), * ForgeInternalHandler#onDimensionSave(Save).
*
* This event is not {@link Cancelable}.
@@ -91,17 +91,13 @@ public class WorldEvent extends Event public static class PotentialSpawns extends WorldEvent { public final EnumCreatureType type; - public final int x; - public final int y; - public final int z; + public final BlockPos pos; public final List list; - public PotentialSpawns(World world, EnumCreatureType type, int x, int y, int z, List oldList) + public PotentialSpawns(World world, EnumCreatureType type, BlockPos pos, List oldList) { super(world); - this.x = x; - this.y = y; - this.z = z; + this.pos = pos; this.type = type; if (oldList != null) { diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java index 014fec0411..a03c99c24b 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java @@ -8,13 +8,22 @@ import com.google.common.collect.Maps; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; /** * This is a base implementation for Fluid blocks. @@ -30,7 +39,43 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock static { - defaultDisplacements.put(Blocks.wooden_door, false); + defaultDisplacements.put(Blocks.oak_door, false); + defaultDisplacements.put(Blocks.spruce_door, false); + defaultDisplacements.put(Blocks.birch_door, false); + defaultDisplacements.put(Blocks.jungle_door, false); + defaultDisplacements.put(Blocks.acacia_door, false); + defaultDisplacements.put(Blocks.dark_oak_door, false); + defaultDisplacements.put(Blocks.trapdoor, false); + defaultDisplacements.put(Blocks.iron_trapdoor, false); + defaultDisplacements.put(Blocks.oak_fence, false); + defaultDisplacements.put(Blocks.spruce_fence, false); + defaultDisplacements.put(Blocks.birch_fence, false); + defaultDisplacements.put(Blocks.jungle_fence, false); + defaultDisplacements.put(Blocks.dark_oak_fence, false); + defaultDisplacements.put(Blocks.acacia_fence, false); + defaultDisplacements.put(Blocks.nether_brick_fence, false); + defaultDisplacements.put(Blocks.oak_fence_gate, false); + defaultDisplacements.put(Blocks.spruce_fence_gate, false); + defaultDisplacements.put(Blocks.birch_fence_gate, false); + defaultDisplacements.put(Blocks.jungle_fence_gate, false); + defaultDisplacements.put(Blocks.dark_oak_fence_gate, false); + defaultDisplacements.put(Blocks.acacia_fence_gate, false); + defaultDisplacements.put(Blocks.wooden_pressure_plate, false); + defaultDisplacements.put(Blocks.stone_pressure_plate, false); + defaultDisplacements.put(Blocks.light_weighted_pressure_plate, false); + defaultDisplacements.put(Blocks.heavy_weighted_pressure_plate, false); + defaultDisplacements.put(Blocks.ladder, false); + defaultDisplacements.put(Blocks.iron_bars, false); + defaultDisplacements.put(Blocks.glass_pane, false); + defaultDisplacements.put(Blocks.stained_glass_pane, false); + defaultDisplacements.put(Blocks.portal, false); + defaultDisplacements.put(Blocks.end_portal, false); + defaultDisplacements.put(Blocks.cobblestone_wall, false); + defaultDisplacements.put(Blocks.barrier, false); + defaultDisplacements.put(Blocks.standing_banner, false); + defaultDisplacements.put(Blocks.wall_banner, false); + defaultDisplacements.put(Blocks.cake, false); + defaultDisplacements.put(Blocks.iron_door, false); defaultDisplacements.put(Blocks.standing_sign, false); defaultDisplacements.put(Blocks.wall_sign, false); @@ -38,6 +83,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock } protected Map displacements = Maps.newHashMap(); + public static final PropertyInteger LEVEL = PropertyInteger.create("level", 0, 15); protected int quantaPerBlock = 8; protected float quantaPerBlockFloat = 8F; protected int density = 1; @@ -45,7 +91,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock protected int temperature = 295; protected int tickRate = 20; - protected int renderPass = 1; + protected EnumWorldBlockLayer renderLayer = EnumWorldBlockLayer.TRANSLUCENT; protected int maxScaledLight = 0; protected final String fluidName; @@ -66,8 +112,20 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock fluid.setBlock(this); displacements.putAll(defaultDisplacements); + this.setDefaultState(blockState.getBaseState().withProperty(LEVEL, 0)); } + @Override + protected BlockState createBlockState() + { + return new BlockState(this, LEVEL); + } + + @Override + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(LEVEL)).intValue(); + } public BlockFluidBase setQuantaPerBlock(int quantaPerBlock) { if (quantaPerBlock > 16 || quantaPerBlock < 1) quantaPerBlock = 8; @@ -97,9 +155,9 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return this; } - public BlockFluidBase setRenderPass(int renderPass) + public BlockFluidBase setRenderLayer(EnumWorldBlockLayer renderLayer) { - this.renderPass = renderPass; + this.renderLayer = renderLayer; return this; } @@ -110,13 +168,13 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock } /** - * Returns true if the block at (x, y, z) is displaceable. Does not displace the block. + * Returns true if the block at (pos) is displaceable. Does not displace the block. */ - public boolean canDisplace(IBlockAccess world, int x, int y, int z) + public boolean canDisplace(IBlockAccess world, BlockPos pos) { - if (world.getBlock(x, y, z).isAir(world, x, y, z)) return true; + if (world.isAirBlock(pos)) return true; - Block block = world.getBlock(x, y, z); + Block block = world.getBlockState(pos).getBlock(); if (block == this) { @@ -134,12 +192,12 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return false; } - int density = getDensity(world, x, y, z); - if (density == Integer.MAX_VALUE) + int density = getDensity(world, pos); + if (density == Integer.MAX_VALUE) { return true; } - + if (this.density > density) { return true; @@ -151,16 +209,17 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock } /** - * Attempt to displace the block at (x, y, z), return true if it was displaced. + * Attempt to displace the block at (pos), return true if it was displaced. */ - public boolean displaceIfPossible(World world, int x, int y, int z) + public boolean displaceIfPossible(World world, BlockPos pos) { - if (world.getBlock(x, y, z).isAir(world, x, y, z)) + if (world.isAirBlock(pos)) { return true; } - Block block = world.getBlock(x, y, z); + IBlockState state = world.getBlockState(pos); + Block block = state.getBlock(); if (block == this) { return false; @@ -170,7 +229,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { if (displacements.get(block)) { - block.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); + block.dropBlockAsItem(world, pos, state, 0); return true; } return false; @@ -182,13 +241,13 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return false; } - int density = getDensity(world, x, y, z); - if (density == Integer.MAX_VALUE) + int density = getDensity(world, pos); + if (density == Integer.MAX_VALUE) { - block.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); + block.dropBlockAsItem(world, pos, state, 0); return true; } - + if (this.density > density) { return true; @@ -199,47 +258,47 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock } } - public abstract int getQuantaValue(IBlockAccess world, int x, int y, int z); + public abstract int getQuantaValue(IBlockAccess world, BlockPos pos); @Override - public abstract boolean canCollideCheck(int meta, boolean fullHit); + public abstract boolean canCollideCheck(IBlockState state, boolean fullHit); public abstract int getMaxRenderHeightMeta(); /* BLOCK FUNCTIONS */ @Override - public void onBlockAdded(World world, int x, int y, int z) + public void onBlockAdded(World world, BlockPos pos, IBlockState state) { - world.scheduleBlockUpdate(x, y, z, this, tickRate); + world.scheduleUpdate(pos, this, tickRate); } @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block block) + public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock) { - world.scheduleBlockUpdate(x, y, z, this, tickRate); + world.scheduleUpdate(pos, this, tickRate); } // Used to prevent updates on chunk generation @Override - public boolean func_149698_L() + public boolean requiresUpdates() { return false; } @Override - public boolean getBlocksMovement(IBlockAccess world, int x, int y, int z) + public boolean isPassable(IBlockAccess world, BlockPos pos) { return true; } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) + public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state) { return null; } @Override - public Item getItemDropped(int par1, Random par2Random, int par3) + public Item getItemDropped(IBlockState state, Random rand, int fortune) { return null; } @@ -257,23 +316,24 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock } @Override - public void velocityToAddToEntity(World world, int x, int y, int z, Entity entity, Vec3 vec) + public Vec3 modifyAcceleration(World world, BlockPos pos, Entity entity, Vec3 vec) { - if (densityDir > 0) return; - Vec3 vec_flow = this.getFlowVector(world, x, y, z); - vec.xCoord += vec_flow.xCoord * (quantaPerBlock * 4); - vec.yCoord += vec_flow.yCoord * (quantaPerBlock * 4); - vec.zCoord += vec_flow.zCoord * (quantaPerBlock * 4); + if (densityDir > 0) return vec; + Vec3 vec_flow = this.getFlowVector(world, pos); + return vec.addVector( + vec_flow.xCoord * (quantaPerBlock * 4), + vec_flow.yCoord * (quantaPerBlock * 4), + vec_flow.zCoord * (quantaPerBlock * 4)); } @Override - public int getLightValue(IBlockAccess world, int x, int y, int z) + public int getLightValue(IBlockAccess world, BlockPos pos) { if (maxScaledLight == 0) { - return super.getLightValue(world, x, y, z); + return super.getLightValue(world, pos); } - int data = world.getBlockMetadata(x, y, z); + int data = ((Integer)world.getBlockState(pos).getValue(LEVEL)).intValue(); return (int) (data / quantaPerBlockFloat * maxScaledLight); } @@ -290,26 +350,26 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock } @Override - public boolean renderAsNormalBlock() + public boolean isFullCube() { return false; } /* Never used...? @Override - public float getBlockBrightness(World world, int x, int y, int z) + public float getBlockBrightness(World world, BlockPos pos) { - float lightThis = world.getLightBrightness(x, y, z); + float lightThis = world.getLightBrightness(pos); float lightUp = world.getLightBrightness(x, y + 1, z); return lightThis > lightUp ? lightThis : lightUp; } */ @Override - public int getMixedBrightnessForBlock(IBlockAccess world, int x, int y, int z) + public int getMixedBrightnessForBlock(IBlockAccess world, BlockPos pos) { - int lightThis = world.getLightBrightnessForSkyBlocks(x, y, z, 0); - int lightUp = world.getLightBrightnessForSkyBlocks(x, y + 1, z, 0); + int lightThis = world.getCombinedLight(pos, 0); + int lightUp = world.getCombinedLight(pos.offsetUp(), 0); int lightThisBase = lightThis & 255; int lightUpBase = lightUp & 255; int lightThisExt = lightThis >> 16 & 255; @@ -319,36 +379,37 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock } @Override - public int getRenderBlockPass() + @SideOnly(Side.CLIENT) + public EnumWorldBlockLayer getBlockLayer() { - return renderPass; + return this.renderLayer; } @Override - public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) + public boolean shouldSideBeRendered(IBlockAccess world, BlockPos pos, EnumFacing side) { - Block block = world.getBlock(x, y, z); + Block block = world.getBlockState(pos).getBlock(); if (block != this) { return !block.isOpaqueCube(); } - return block.getMaterial() == this.getMaterial() ? false : super.shouldSideBeRendered(world, x, y, z, side); + return block.getMaterial() == this.getMaterial() ? false : super.shouldSideBeRendered(world, pos, side); } /* FLUID FUNCTIONS */ - public static final int getDensity(IBlockAccess world, int x, int y, int z) + public static final int getDensity(IBlockAccess world, BlockPos pos) { - Block block = world.getBlock(x, y, z); + Block block = world.getBlockState(pos).getBlock(); if (!(block instanceof BlockFluidBase)) { return Integer.MAX_VALUE; } return ((BlockFluidBase)block).density; } - - public static final int getTemperature(IBlockAccess world, int x, int y, int z) + + public static final int getTemperature(IBlockAccess world, BlockPos pos) { - Block block = world.getBlock(x, y, z); + Block block = world.getBlockState(pos).getBlock(); if (!(block instanceof BlockFluidBase)) { return Integer.MAX_VALUE; @@ -356,20 +417,20 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return ((BlockFluidBase)block).temperature; } - public static double getFlowDirection(IBlockAccess world, int x, int y, int z) + public static double getFlowDirection(IBlockAccess world, BlockPos pos) { - Block block = world.getBlock(x, y, z); + Block block = world.getBlockState(pos).getBlock(); if (!block.getMaterial().isLiquid()) { return -1000.0; } - Vec3 vec = ((BlockFluidBase) block).getFlowVector(world, x, y, z); + Vec3 vec = ((BlockFluidBase) block).getFlowVector(world, pos); return vec.xCoord == 0.0D && vec.zCoord == 0.0D ? -1000.0D : Math.atan2(vec.zCoord, vec.xCoord) - Math.PI / 2D; } - public final int getQuantaValueBelow(IBlockAccess world, int x, int y, int z, int belowThis) + public final int getQuantaValueBelow(IBlockAccess world, BlockPos pos, int belowThis) { - int quantaRemaining = getQuantaValue(world, x, y, z); + int quantaRemaining = getQuantaValue(world, pos); if (quantaRemaining >= belowThis) { return -1; @@ -377,9 +438,9 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return quantaRemaining; } - public final int getQuantaValueAbove(IBlockAccess world, int x, int y, int z, int aboveThis) + public final int getQuantaValueAbove(IBlockAccess world, BlockPos pos, int aboveThis) { - int quantaRemaining = getQuantaValue(world, x, y, z); + int quantaRemaining = getQuantaValue(world, pos); if (quantaRemaining <= aboveThis) { return -1; @@ -387,21 +448,21 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return quantaRemaining; } - public final float getQuantaPercentage(IBlockAccess world, int x, int y, int z) + public final float getQuantaPercentage(IBlockAccess world, BlockPos pos) { - int quantaRemaining = getQuantaValue(world, x, y, z); + int quantaRemaining = getQuantaValue(world, pos); return quantaRemaining / quantaPerBlockFloat; } - public Vec3 getFlowVector(IBlockAccess world, int x, int y, int z) + public Vec3 getFlowVector(IBlockAccess world, BlockPos pos) { - Vec3 vec = Vec3.createVectorHelper(0.0D, 0.0D, 0.0D); - int decay = quantaPerBlock - getQuantaValue(world, x, y, z); + Vec3 vec = new Vec3(0.0D, 0.0D, 0.0D); + int decay = quantaPerBlock - getQuantaValue(world, pos); for (int side = 0; side < 4; ++side) { - int x2 = x; - int z2 = z; + int x2 = pos.getX(); + int z2 = pos.getZ(); switch (side) { @@ -411,37 +472,38 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock case 3: ++z2; break; } - int otherDecay = quantaPerBlock - getQuantaValue(world, x2, y, z2); + BlockPos pos2 = new BlockPos(x2, pos.getY(), z2); + int otherDecay = quantaPerBlock - getQuantaValue(world, pos2); if (otherDecay >= quantaPerBlock) { - if (!world.getBlock(x2, y, z2).getMaterial().blocksMovement()) + if (!world.getBlockState(pos2).getBlock().getMaterial().blocksMovement()) { - otherDecay = quantaPerBlock - getQuantaValue(world, x2, y - 1, z2); + otherDecay = quantaPerBlock - getQuantaValue(world, pos2.offsetDown()); if (otherDecay >= 0) { int power = otherDecay - (decay - quantaPerBlock); - vec = vec.addVector((x2 - x) * power, (y - y) * power, (z2 - z) * power); + vec = vec.addVector((pos2.getX() - pos.getX()) * power, 0, (pos2.getZ() - pos.getZ()) * power); } } } else if (otherDecay >= 0) { int power = otherDecay - decay; - vec = vec.addVector((x2 - x) * power, (y - y) * power, (z2 - z) * power); + vec = vec.addVector((pos2.getX() - pos.getX()) * power, 0, (pos2.getZ() - pos.getZ()) * power); } } - if (world.getBlock(x, y + 1, z) == this) + if (world.getBlockState(pos.offsetUp()).getBlock() == this) { boolean flag = - isBlockSolid(world, x, y, z - 1, 2) || - isBlockSolid(world, x, y, z + 1, 3) || - isBlockSolid(world, x - 1, y, z, 4) || - isBlockSolid(world, x + 1, y, z, 5) || - isBlockSolid(world, x, y + 1, z - 1, 2) || - isBlockSolid(world, x, y + 1, z + 1, 3) || - isBlockSolid(world, x - 1, y + 1, z, 4) || - isBlockSolid(world, x + 1, y + 1, z, 5); + isBlockSolid(world, pos.add( 0, 0, -1), EnumFacing.NORTH) || + isBlockSolid(world, pos.add( 0, 0, 1), EnumFacing.SOUTH) || + isBlockSolid(world, pos.add(-1, 0, 0), EnumFacing.WEST) || + isBlockSolid(world, pos.add( 1, 0, 0), EnumFacing.EAST) || + isBlockSolid(world, pos.add( 0, 1, -1), EnumFacing.NORTH) || + isBlockSolid(world, pos.add( 0, 1, 1), EnumFacing.SOUTH) || + isBlockSolid(world, pos.add(-1, 1, 0), EnumFacing.WEST) || + isBlockSolid(world, pos.add( 1, 1, 0), EnumFacing.EAST); if (flag) { @@ -460,11 +522,11 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock } @Override - public float getFilledPercentage(World world, int x, int y, int z) + public float getFilledPercentage(World world, BlockPos pos) { - int quantaRemaining = getQuantaValue(world, x, y, z) + 1; + int quantaRemaining = getQuantaValue(world, pos) + 1; float remaining = quantaRemaining / quantaPerBlockFloat; if (remaining > 1) remaining = 1.0f; return remaining * (density > 0 ? 1 : -1); } -} +} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java b/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java index bd40e42e2c..f3837eeed5 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java @@ -4,7 +4,9 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -41,26 +43,27 @@ public class BlockFluidClassic extends BlockFluidBase } @Override - public int getQuantaValue(IBlockAccess world, int x, int y, int z) + public int getQuantaValue(IBlockAccess world, BlockPos pos) { - if (world.getBlock(x, y, z) == Blocks.air) + IBlockState state = world.getBlockState(pos); + if (state.getBlock() == Blocks.air) { return 0; } - if (world.getBlock(x, y, z) != this) + if (state.getBlock() != this) { return -1; } - int quantaRemaining = quantaPerBlock - world.getBlockMetadata(x, y, z); + int quantaRemaining = quantaPerBlock - ((Integer)state.getValue(LEVEL)).intValue(); return quantaRemaining; } @Override - public boolean canCollideCheck(int meta, boolean fullHit) + public boolean canCollideCheck(IBlockState state, boolean fullHit) { - return fullHit && meta == 0; + return fullHit && ((Integer)state.getValue(LEVEL)).intValue() == 0; } @Override @@ -70,42 +73,40 @@ public class BlockFluidClassic extends BlockFluidBase } @Override - public int getLightValue(IBlockAccess world, int x, int y, int z) + public int getLightValue(IBlockAccess world, BlockPos pos) { if (maxScaledLight == 0) { - return super.getLightValue(world, x, y, z); + return super.getLightValue(world, pos); } - int data = quantaPerBlock - world.getBlockMetadata(x, y, z) - 1; + int data = quantaPerBlock - ((Integer)world.getBlockState(pos).getValue(LEVEL)).intValue() - 1; return (int) (data / quantaPerBlockFloat * maxScaledLight); } @Override - public void updateTick(World world, int x, int y, int z, Random rand) + public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { - int quantaRemaining = quantaPerBlock - world.getBlockMetadata(x, y, z); + int quantaRemaining = quantaPerBlock - ((Integer)state.getValue(LEVEL)).intValue(); int expQuanta = -101; // check adjacent block levels if non-source if (quantaRemaining < quantaPerBlock) { - int y2 = y - densityDir; - - if (world.getBlock(x, y2, z ) == this || - world.getBlock(x - 1, y2, z ) == this || - world.getBlock(x + 1, y2, z ) == this || - world.getBlock(x, y2, z - 1) == this || - world.getBlock(x, y2, z + 1) == this) + if (world.getBlockState(pos.add( 0, -densityDir, 0)).getBlock() == this || + world.getBlockState(pos.add(-1, -densityDir, 0)).getBlock() == this || + world.getBlockState(pos.add( 1, -densityDir, 0)).getBlock() == this || + world.getBlockState(pos.add( 0, -densityDir, -1)).getBlock() == this || + world.getBlockState(pos.add( 0, -densityDir, 1)).getBlock() == this) { expQuanta = quantaPerBlock - 1; } else { int maxQuanta = -100; - maxQuanta = getLargerQuanta(world, x - 1, y, z, maxQuanta); - maxQuanta = getLargerQuanta(world, x + 1, y, z, maxQuanta); - maxQuanta = getLargerQuanta(world, x, y, z - 1, maxQuanta); - maxQuanta = getLargerQuanta(world, x, y, z + 1, maxQuanta); + maxQuanta = getLargerQuanta(world, pos.add(-1, 0, 0), maxQuanta); + maxQuanta = getLargerQuanta(world, pos.add( 1, 0, 0), maxQuanta); + maxQuanta = getLargerQuanta(world, pos.add( 0, 0, -1), maxQuanta); + maxQuanta = getLargerQuanta(world, pos.add( 0, 0, 1), maxQuanta); expQuanta = maxQuanta - 1; } @@ -117,26 +118,26 @@ public class BlockFluidClassic extends BlockFluidBase if (expQuanta <= 0) { - world.setBlock(x, y, z, Blocks.air); + world.setBlockToAir(pos); } else { - world.setBlockMetadataWithNotify(x, y, z, quantaPerBlock - expQuanta, 3); - world.scheduleBlockUpdate(x, y, z, this, tickRate); - world.notifyBlocksOfNeighborChange(x, y, z, this); + world.setBlockState(pos, state.withProperty(LEVEL, quantaPerBlock - expQuanta), 2); + world.scheduleUpdate(pos, this, tickRate); + world.notifyNeighborsOfStateChange(pos, this); } } } // This is a "source" block, set meta to zero, and send a server only update else if (quantaRemaining >= quantaPerBlock) { - world.setBlockMetadataWithNotify(x, y, z, 0, 2); + world.setBlockState(pos, this.getDefaultState(), 2); } // Flow vertically if possible - if (canDisplace(world, x, y + densityDir, z)) + if (canDisplace(world, pos.offsetUp(densityDir))) { - flowIntoBlock(world, x, y + densityDir, z, 1); + flowIntoBlock(world, pos.offsetUp(densityDir), 1); return; } @@ -147,62 +148,60 @@ public class BlockFluidClassic extends BlockFluidBase return; } - if (isSourceBlock(world, x, y, z) || !isFlowingVertically(world, x, y, z)) + if (isSourceBlock(world, pos) || !isFlowingVertically(world, pos)) { - if (world.getBlock(x, y - densityDir, z) == this) + if (world.getBlockState(pos.offsetDown(densityDir)).getBlock() == this) { flowMeta = 1; } - boolean flowTo[] = getOptimalFlowDirections(world, x, y, z); + boolean flowTo[] = getOptimalFlowDirections(world, pos); - if (flowTo[0]) flowIntoBlock(world, x - 1, y, z, flowMeta); - if (flowTo[1]) flowIntoBlock(world, x + 1, y, z, flowMeta); - if (flowTo[2]) flowIntoBlock(world, x, y, z - 1, flowMeta); - if (flowTo[3]) flowIntoBlock(world, x, y, z + 1, flowMeta); + if (flowTo[0]) flowIntoBlock(world, pos.add(-1, 0, 0), flowMeta); + if (flowTo[1]) flowIntoBlock(world, pos.add( 1, 0, 0), flowMeta); + if (flowTo[2]) flowIntoBlock(world, pos.add( 0, 0, -1), flowMeta); + if (flowTo[3]) flowIntoBlock(world, pos.add( 0, 0, 1), flowMeta); } } - public boolean isFlowingVertically(IBlockAccess world, int x, int y, int z) + public boolean isFlowingVertically(IBlockAccess world, BlockPos pos) { - return world.getBlock(x, y + densityDir, z) == this || - (world.getBlock(x, y, z) == this && canFlowInto(world, x, y + densityDir, z)); + return world.getBlockState(pos.offsetUp(densityDir)).getBlock() == this || + (world.getBlockState(pos).getBlock() == this && canFlowInto(world, pos.offsetUp(densityDir))); } - public boolean isSourceBlock(IBlockAccess world, int x, int y, int z) + public boolean isSourceBlock(IBlockAccess world, BlockPos pos) { - return world.getBlock(x, y, z) == this && world.getBlockMetadata(x, y, z) == 0; + return world.getBlockState(pos) == this && ((Integer)world.getBlockState(pos).getValue(LEVEL)).intValue() == 0; } - protected boolean[] getOptimalFlowDirections(World world, int x, int y, int z) + protected boolean[] getOptimalFlowDirections(World world, BlockPos pos) { for (int side = 0; side < 4; side++) { flowCost[side] = 1000; - int x2 = x; - int y2 = y; - int z2 = z; + BlockPos pos2 = pos; switch (side) { - case 0: --x2; break; - case 1: ++x2; break; - case 2: --z2; break; - case 3: ++z2; break; + case 0: pos2 = pos2.add(-1, 0, 0); break; + case 1: pos2 = pos2.add( 1, 0, 0); break; + case 2: pos2 = pos2.add( 0, 0, -1); break; + case 3: pos2 = pos2.add( 0, 0, 1); break; } - if (!canFlowInto(world, x2, y2, z2) || isSourceBlock(world, x2, y2, z2)) + if (!canFlowInto(world, pos2) || isSourceBlock(world, pos2)) { continue; } - if (canFlowInto(world, x2, y2 + densityDir, z2)) + if (canFlowInto(world, pos2.add(0, densityDir, 0))) { flowCost[side] = 0; } else { - flowCost[side] = calculateFlowCost(world, x2, y2, z2, 1, side); + flowCost[side] = calculateFlowCost(world, pos2, 1, side); } } @@ -221,7 +220,7 @@ public class BlockFluidClassic extends BlockFluidBase return isOptimalFlowDirection; } - protected int calculateFlowCost(World world, int x, int y, int z, int recurseDepth, int side) + protected int calculateFlowCost(World world, BlockPos pos, int recurseDepth, int side) { int cost = 1000; for (int adjSide = 0; adjSide < 4; adjSide++) @@ -234,24 +233,22 @@ public class BlockFluidClassic extends BlockFluidBase continue; } - int x2 = x; - int y2 = y; - int z2 = z; + BlockPos pos2 = pos; switch (adjSide) { - case 0: --x2; break; - case 1: ++x2; break; - case 2: --z2; break; - case 3: ++z2; break; + case 0: pos2 = pos2.add(-1, 0, 0); break; + case 1: pos2 = pos2.add( 1, 0, 0); break; + case 2: pos2 = pos2.add( 0, 0, -1); break; + case 3: pos2 = pos2.add( 0, 0, 1); break; } - if (!canFlowInto(world, x2, y2, z2) || isSourceBlock(world, x2, y2, z2)) + if (!canFlowInto(world, pos2) || isSourceBlock(world, pos2)) { continue; } - if (canFlowInto(world, x2, y2 + densityDir, z2)) + if (canFlowInto(world, pos2.add(0, densityDir, 0))) { return recurseDepth; } @@ -261,7 +258,7 @@ public class BlockFluidClassic extends BlockFluidBase continue; } - int min = calculateFlowCost(world, x2, y2, z2, recurseDepth + 1, adjSide); + int min = calculateFlowCost(world, pos2, recurseDepth + 1, adjSide); if (min < cost) { cost = min; @@ -270,20 +267,20 @@ public class BlockFluidClassic extends BlockFluidBase return cost; } - protected void flowIntoBlock(World world, int x, int y, int z, int meta) + protected void flowIntoBlock(World world, BlockPos pos, int meta) { if (meta < 0) return; - if (displaceIfPossible(world, x, y, z)) + if (displaceIfPossible(world, pos)) { - world.setBlock(x, y, z, this, meta, 3); + world.setBlockState(pos, world.getBlockState(pos).withProperty(LEVEL, meta), 3); } } - protected boolean canFlowInto(IBlockAccess world, int x, int y, int z) + protected boolean canFlowInto(IBlockAccess world, BlockPos pos) { - if (world.getBlock(x, y, z).isAir(world, x, y, z)) return true; + if (world.isAirBlock(pos)) return true; - Block block = world.getBlock(x, y, z); + Block block = world.getBlockState(pos).getBlock(); if (block == this) { return true; @@ -303,12 +300,12 @@ public class BlockFluidClassic extends BlockFluidBase return false; } - int density = getDensity(world, x, y, z); - if (density == Integer.MAX_VALUE) + int density = getDensity(world, pos); + if (density == Integer.MAX_VALUE) { return true; } - + if (this.density > density) { return true; @@ -319,9 +316,9 @@ public class BlockFluidClassic extends BlockFluidBase } } - protected int getLargerQuanta(IBlockAccess world, int x, int y, int z, int compare) + protected int getLargerQuanta(IBlockAccess world, BlockPos pos, int compare) { - int quantaRemaining = getQuantaValue(world, x, y, z); + int quantaRemaining = getQuantaValue(world, pos); if (quantaRemaining <= 0) { return compare; @@ -331,24 +328,24 @@ public class BlockFluidClassic extends BlockFluidBase /* IFluidBlock */ @Override - public FluidStack drain(World world, int x, int y, int z, boolean doDrain) + public FluidStack drain(World world, BlockPos pos, boolean doDrain) { - if (!isSourceBlock(world, x, y, z)) + if (!isSourceBlock(world, pos)) { return null; } if (doDrain) { - world.setBlock(x, y, z, Blocks.air); + world.setBlockToAir(pos); } return stack.copy(); } @Override - public boolean canDrain(World world, int x, int y, int z) + public boolean canDrain(World world, BlockPos pos) { - return isSourceBlock(world, x, y, z); + return isSourceBlock(world, pos); } -} +} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java b/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java index 52a76a887a..83c2f1a570 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java @@ -4,18 +4,20 @@ package net.minecraftforge.fluids; import java.util.Random; import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; /** * This is a cellular-automata based finite fluid block implementation. - * + * * It is highly recommended that you use/extend this class for finite fluid blocks. - * + * * @author OvermindDL1, KingLemming - * + * */ public class BlockFluidFinite extends BlockFluidBase { @@ -25,26 +27,25 @@ public class BlockFluidFinite extends BlockFluidBase } @Override - public int getQuantaValue(IBlockAccess world, int x, int y, int z) + public int getQuantaValue(IBlockAccess world, BlockPos pos) { - if (world.getBlock(x, y, z).isAir(world, x, y, z)) + IBlockState state = world.getBlockState(pos); + if (state.getBlock().isAir(world, pos)) { return 0; } - if (world.getBlock(x, y, z) != this) + if (state.getBlock() != this) { return -1; } - - int quantaRemaining = world.getBlockMetadata(x, y, z) + 1; - return quantaRemaining; + return ((Integer)state.getValue(LEVEL)) + 1; } @Override - public boolean canCollideCheck(int meta, boolean fullHit) + public boolean canCollideCheck(IBlockState state, boolean fullHit) { - return fullHit && meta == quantaPerBlock - 1; + return fullHit && ((Integer)state.getValue(LEVEL)) == quantaPerBlock - 1; } @Override @@ -54,14 +55,14 @@ public class BlockFluidFinite extends BlockFluidBase } @Override - public void updateTick(World world, int x, int y, int z, Random rand) + public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { boolean changed = false; - int quantaRemaining = world.getBlockMetadata(x, y, z) + 1; + int quantaRemaining = ((Integer)state.getValue(LEVEL)) + 1; // Flow vertically if possible int prevRemaining = quantaRemaining; - quantaRemaining = tryToFlowVerticallyInto(world, x, y, z, quantaRemaining); + quantaRemaining = tryToFlowVerticallyInto(world, pos, quantaRemaining); if (quantaRemaining < 1) { @@ -72,7 +73,7 @@ public class BlockFluidFinite extends BlockFluidBase changed = true; if (quantaRemaining == 1) { - world.setBlockMetadataWithNotify(x, y, z, quantaRemaining - 1, 2); + world.setBlockState(pos, state.withProperty(LEVEL, quantaRemaining - 1), 2); return; } } @@ -83,192 +84,110 @@ public class BlockFluidFinite extends BlockFluidBase // Flow out if possible int lowerthan = quantaRemaining - 1; - if (displaceIfPossible(world, x, y, z - 1)) world.setBlock(x, y, z - 1, Blocks.air); - if (displaceIfPossible(world, x, y, z + 1)) world.setBlock(x, y, z + 1, Blocks.air); - if (displaceIfPossible(world, x - 1, y, z )) world.setBlock(x - 1, y, z, Blocks.air); - if (displaceIfPossible(world, x + 1, y, z )) world.setBlock(x + 1, y, z, Blocks.air); - int north = getQuantaValueBelow(world, x, y, z - 1, lowerthan); - int south = getQuantaValueBelow(world, x, y, z + 1, lowerthan); - int west = getQuantaValueBelow(world, x - 1, y, z, lowerthan); - int east = getQuantaValueBelow(world, x + 1, y, z, lowerthan); int total = quantaRemaining; int count = 1; - if (north >= 0) + for (EnumFacing side : EnumFacing.Plane.HORIZONTAL) { - count++; - total += north; - } + BlockPos off = pos.offset(side); + if (displaceIfPossible(world, off)) + world.setBlockToAir(off); - if (south >= 0) - { - count++; - total += south; - } - - if (west >= 0) - { - count++; - total += west; - } - - if (east >= 0) - { - ++count; - total += east; + int quanta = getQuantaValueBelow(world, off, lowerthan); + if (quanta >= 0) + { + count++; + total += quanta; + } } if (count == 1) { if (changed) { - world.setBlockMetadataWithNotify(x, y, z, quantaRemaining - 1, 2); + world.setBlockState(pos, state.withProperty(LEVEL, quantaRemaining - 1), 2); } return; } int each = total / count; int rem = total % count; - if (north >= 0) + + for (EnumFacing side : EnumFacing.Plane.HORIZONTAL) { - int newnorth = each; - if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) + BlockPos off = pos.offset(side); + int quanta = getQuantaValueBelow(world, off, lowerthan); + if (quanta >= 0) { - ++newnorth; - --rem; - } + int newquanta = each; + if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) + { + ++newquanta; + --rem; + } - if (newnorth != north) - { - if (newnorth == 0) + if (newquanta != quanta) { - world.setBlock(x, y, z - 1, Blocks.air); + if (newquanta == 0) + { + world.setBlockToAir(off); + } + else + { + world.setBlockState(off, getDefaultState().withProperty(LEVEL, newquanta - 1), 2); + } + world.scheduleUpdate(off, this, tickRate); } - else - { - world.setBlock(x, y, z - 1, this, newnorth - 1, 2); - } - world.scheduleBlockUpdate(x, y, z - 1, this, tickRate); + --count; } - --count; - } - - if (south >= 0) - { - int newsouth = each; - if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) - { - ++newsouth; - --rem; - } - - if (newsouth != south) - { - if (newsouth == 0) - { - world.setBlock(x, y, z + 1, Blocks.air); - } - else - { - world.setBlock(x, y, z + 1, this, newsouth - 1, 2); - } - world.scheduleBlockUpdate(x, y, z + 1, this, tickRate); - } - --count; - } - - if (west >= 0) - { - int newwest = each; - if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) - { - ++newwest; - --rem; - } - if (newwest != west) - { - if (newwest == 0) - { - world.setBlock(x - 1, y, z, Blocks.air); - } - else - { - world.setBlock(x - 1, y, z, this, newwest - 1, 2); - } - world.scheduleBlockUpdate(x - 1, y, z, this, tickRate); - } - --count; - } - - if (east >= 0) - { - int neweast = each; - if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) - { - ++neweast; - --rem; - } - - if (neweast != east) - { - if (neweast == 0) - { - world.setBlock(x + 1, y, z, Blocks.air); - } - else - { - world.setBlock(x + 1, y, z, this, neweast - 1, 2); - } - world.scheduleBlockUpdate(x + 1, y, z, this, tickRate); - } - --count; } if (rem > 0) { ++each; } - world.setBlockMetadataWithNotify(x, y, z, each - 1, 2); + world.setBlockState(pos, state.withProperty(LEVEL, each - 1), 2); } - public int tryToFlowVerticallyInto(World world, int x, int y, int z, int amtToInput) + public int tryToFlowVerticallyInto(World world, BlockPos pos, int amtToInput) { - int otherY = y + densityDir; - if (otherY < 0 || otherY >= world.getHeight()) + IBlockState myState = world.getBlockState(pos); + BlockPos other = pos.add(0, densityDir, 0); + if (other.getY() < 0 || other.getY() >= world.getHeight()) { - world.setBlock(x, y, z, Blocks.air); + world.setBlockToAir(pos); return 0; } - int amt = getQuantaValueBelow(world, x, otherY, z, quantaPerBlock); + int amt = getQuantaValueBelow(world, other, quantaPerBlock); if (amt >= 0) { amt += amtToInput; if (amt > quantaPerBlock) { - world.setBlock(x, otherY, z, this, quantaPerBlock - 1, 3); - world.scheduleBlockUpdate(x, otherY, z, this, tickRate); + world.setBlockState(other, myState.withProperty(LEVEL, quantaPerBlock - 1), 3); + world.scheduleUpdate(other, this, tickRate); return amt - quantaPerBlock; } else if (amt > 0) { - world.setBlock(x, otherY, z, this, amt - 1, 3); - world.scheduleBlockUpdate(x, otherY, z, this, tickRate); - world.setBlock(x, y, z, Blocks.air); + world.setBlockState(other, myState.withProperty(LEVEL, amt - 1), 3); + world.scheduleUpdate(other, this, tickRate); + world.setBlockToAir(pos); return 0; } return amtToInput; } else { - int density_other = getDensity(world, x, otherY, z); + int density_other = getDensity(world, other); if (density_other == Integer.MAX_VALUE) { - if (displaceIfPossible(world, x, otherY, z)) + if (displaceIfPossible(world, other)) { - world.setBlock(x, otherY, z, this, amtToInput - 1, 3); - world.scheduleBlockUpdate(x, otherY, z, this, tickRate); - world.setBlock(x, y, z, Blocks.air); + world.setBlockState(other, myState.withProperty(LEVEL, amtToInput - 1), 3); + world.scheduleUpdate(other, this, tickRate); + world.setBlockToAir(pos); return 0; } else @@ -281,12 +200,11 @@ public class BlockFluidFinite extends BlockFluidBase { if (density_other < density) // then swap { - BlockFluidBase block = (BlockFluidBase)world.getBlock(x, otherY, z); - int otherData = world.getBlockMetadata(x, otherY, z); - world.setBlock(x, otherY, z, this, amtToInput - 1, 3); - world.setBlock(x, y, z, block, otherData, 3); - world.scheduleBlockUpdate(x, otherY, z, this, tickRate); - world.scheduleBlockUpdate(x, y, z, block, block.tickRate(world)); + IBlockState state = world.getBlockState(other); + world.setBlockState(other, myState.withProperty(LEVEL, amtToInput - 1), 3); + world.setBlockState(pos, state, 3); + world.scheduleUpdate(other, this, tickRate); + world.scheduleUpdate(pos, state.getBlock(), state.getBlock().tickRate(world)); return 0; } } @@ -294,12 +212,11 @@ public class BlockFluidFinite extends BlockFluidBase { if (density_other > density) { - BlockFluidBase block = (BlockFluidBase)world.getBlock(x, otherY, z); - int otherData = world.getBlockMetadata(x, otherY, z); - world.setBlock(x, otherY, z, this, amtToInput - 1, 3); - world.setBlock(x, y, z, block, otherData, 3); - world.scheduleBlockUpdate(x, otherY, z, this, tickRate); - world.scheduleBlockUpdate(x, y, z, block, block.tickRate(world)); + IBlockState state = world.getBlockState(other); + world.setBlockState(other, myState.withProperty(LEVEL, amtToInput - 1), 3); + world.setBlockState(other, state, 3); + world.scheduleUpdate(other, this, tickRate); + world.scheduleUpdate(other, state.getBlock(), state.getBlock().tickRate(world)); return 0; } } @@ -309,20 +226,20 @@ public class BlockFluidFinite extends BlockFluidBase /* IFluidBlock */ @Override - public FluidStack drain(World world, int x, int y, int z, boolean doDrain) + public FluidStack drain(World world, BlockPos pos, boolean doDrain) { if (doDrain) { - world.setBlock(x, y, z, Blocks.air); + world.setBlockToAir(pos); } - + return new FluidStack(getFluid(), - MathHelper.floor_float(getQuantaPercentage(world, x, y, z) * FluidContainerRegistry.BUCKET_VOLUME)); + MathHelper.floor_float(getQuantaPercentage(world, pos) * FluidContainerRegistry.BUCKET_VOLUME)); } @Override - public boolean canDrain(World world, int x, int y, int z) + public boolean canDrain(World world, BlockPos pos) { return true; } -} +} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/fluids/Fluid.java b/src/main/java/net/minecraftforge/fluids/Fluid.java index 8ef8b9b59d..e627a809d0 100644 --- a/src/main/java/net/minecraftforge/fluids/Fluid.java +++ b/src/main/java/net/minecraftforge/fluids/Fluid.java @@ -6,12 +6,12 @@ import java.util.Map; import com.google.common.collect.Maps; import net.minecraft.block.Block; -import net.minecraft.util.IIcon; +import net.minecraft.util.BlockPos; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.ForgeModContainer; -import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.common.LoaderException; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.LoaderException; import net.minecraft.item.EnumRarity; /** @@ -41,8 +41,8 @@ public class Fluid protected String unlocalizedName; /** The Icons for this fluid. */ - protected IIcon stillIcon; - protected IIcon flowingIcon; + //protected IIcon stillIcon; + //protected IIcon flowingIcon; /** * The light level emitted by this fluid. @@ -62,7 +62,7 @@ public class Fluid /** * Temperature of the fluid - completely arbitrary; higher temperature indicates that the fluid is * hotter than air. - * + * * Default value is approximately the real-life room temperature of water in degrees Kelvin. */ protected int temperature = 295; @@ -89,7 +89,7 @@ public class Fluid * * Used primarily in tool tips. */ - protected EnumRarity rarity = EnumRarity.common; + protected EnumRarity rarity = EnumRarity.COMMON; /** * If there is a Block implementation of the Fluid, the Block is linked here. @@ -194,7 +194,7 @@ public class Fluid { return getLocalizedName(); } - + /** * Use the FluidStack sensitive version above */ @@ -254,7 +254,7 @@ public class Fluid { return this.isGaseous; } - + public EnumRarity getRarity() { return rarity; @@ -265,6 +265,7 @@ public class Fluid return 0xFFFFFF; } + /* public final Fluid setStillIcon(IIcon stillIcon) { this.stillIcon = stillIcon; @@ -298,6 +299,7 @@ public class Fluid { return this.flowingIcon; } + */ /* Stack-based Accessors */ public int getLuminosity(FluidStack stack){ return getLuminosity(); } @@ -307,16 +309,16 @@ public class Fluid public boolean isGaseous(FluidStack stack){ return isGaseous(); } public EnumRarity getRarity(FluidStack stack){ return getRarity(); } public int getColor(FluidStack stack){ return getColor(); } - public IIcon getIcon(FluidStack stack){ return getIcon(); } + //public IIcon getIcon(FluidStack stack){ return getIcon(); } /* World-based Accessors */ - public int getLuminosity(World world, int x, int y, int z){ return getLuminosity(); } - public int getDensity(World world, int x, int y, int z){ return getDensity(); } - public int getTemperature(World world, int x, int y, int z){ return getTemperature(); } - public int getViscosity(World world, int x, int y, int z){ return getViscosity(); } - public boolean isGaseous(World world, int x, int y, int z){ return isGaseous(); } - public EnumRarity getRarity(World world, int x, int y, int z){ return getRarity(); } - public int getColor(World world, int x, int y, int z){ return getColor(); } - public IIcon getIcon(World world, int x, int y, int z){ return getIcon(); } + public int getLuminosity(World world, BlockPos pos){ return getLuminosity(); } + public int getDensity(World world, BlockPos pos){ return getDensity(); } + public int getTemperature(World world, BlockPos pos){ return getTemperature(); } + public int getViscosity(World world, BlockPos pos){ return getViscosity(); } + public boolean isGaseous(World world, BlockPos pos){ return isGaseous(); } + public EnumRarity getRarity(World world, BlockPos pos){ return getRarity(); } + public int getColor(World world, BlockPos pos){ return getColor(); } + //public IIcon getIcon(World world, BlockPos pos){ return getIcon(); } private static Map legacyNames = Maps.newHashMap(); static String convertLegacyName(String fluidName) diff --git a/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java index 043267c186..6e55d84215 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java @@ -11,7 +11,7 @@ import java.util.Set; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; diff --git a/src/main/java/net/minecraftforge/fluids/FluidEvent.java b/src/main/java/net/minecraftforge/fluids/FluidEvent.java index 5229cf2d93..9c4a2124ff 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidEvent.java +++ b/src/main/java/net/minecraftforge/fluids/FluidEvent.java @@ -1,66 +1,49 @@ package net.minecraftforge.fluids; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.Event; public class FluidEvent extends Event { public final FluidStack fluid; - public final int x; - public final int y; - public final int z; public final World world; + public final BlockPos pos; - public FluidEvent(FluidStack fluid, World world, int x, int y, int z) + public FluidEvent(FluidStack fluid, World world, BlockPos pos) { this.fluid = fluid; this.world = world; - this.x = x; - this.y = y; - this.z = z; + this.pos = pos; } /** * Mods should fire this event when they move fluids around. - * - * @author cpw - * + * */ public static class FluidMotionEvent extends FluidEvent { - public FluidMotionEvent(FluidStack fluid, World world, int x, int y, int z) + public FluidMotionEvent(FluidStack fluid, World world, BlockPos pos) { - super(fluid, world, x, y, z); + super(fluid, world, pos); } } /** * Mods should fire this event when a fluid is {@link IFluidTank#fill(FluidStack, boolean)} * their tank implementation. {@link FluidTank} does. - * - * @author cpw - * + * */ public static class FluidFillingEvent extends FluidEvent { public final IFluidTank tank; public final int amount; - /** - * @deprecated Will be removed in 1.8 - * - */ - @Deprecated - public FluidFillingEvent(FluidStack fluid, World world, int x, int y, int z, IFluidTank tank) + public FluidFillingEvent(FluidStack fluid, World world, BlockPos pos, IFluidTank tank, int amount) { - this(fluid, world, x, y, z, tank, -1); - } - - public FluidFillingEvent(FluidStack fluid, World world, int x, int y, int z, IFluidTank tank, int amount) - { - super(fluid, world, x, y, z); + super(fluid, world, pos); this.tank = tank; this.amount = amount; } @@ -69,28 +52,16 @@ public class FluidEvent extends Event /** * Mods should fire this event when a fluid is {@link IFluidTank#drain(int, boolean)} from their * tank. - * - * @author cpw - * + * */ public static class FluidDrainingEvent extends FluidEvent { public final IFluidTank tank; public final int amount; - /** - * @deprecated Will be removed in 1.8 - * - */ - @Deprecated - public FluidDrainingEvent(FluidStack fluid, World world, int x, int y, int z, IFluidTank tank) + public FluidDrainingEvent(FluidStack fluid, World world, BlockPos pos, IFluidTank tank, int amount) { - this(fluid, world, x, y, z, tank, -1); - } - - public FluidDrainingEvent(FluidStack fluid, World world, int x, int y, int z, IFluidTank tank, int amount) - { - super(fluid, world, x, y, z); + super(fluid, world, pos); this.amount = amount; this.tank = tank; } @@ -99,21 +70,19 @@ public class FluidEvent extends Event /** * Mods should fire this event when a fluid "spills", for example, if a block containing fluid * is broken. - * - * @author cpw - * + * */ public static class FluidSpilledEvent extends FluidEvent { - public FluidSpilledEvent(FluidStack fluid, World world, int x, int y, int z) + public FluidSpilledEvent(FluidStack fluid, World world, BlockPos pos) { - super(fluid, world, x, y, z); + super(fluid, world, pos); } } /** * A handy shortcut for firing the various fluid events. - * + * * @param event */ public static final void fireEvent(FluidEvent event) diff --git a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java index 4fb50d12f2..9ec57ca2b9 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java @@ -13,7 +13,7 @@ import com.google.common.collect.HashBiMap; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event; /** * Handles Fluid registrations. Fluids MUST be registered in order to function. diff --git a/src/main/java/net/minecraftforge/fluids/FluidTank.java b/src/main/java/net/minecraftforge/fluids/FluidTank.java index d6e5a5a8d3..8b689cdfb6 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidTank.java +++ b/src/main/java/net/minecraftforge/fluids/FluidTank.java @@ -6,9 +6,9 @@ import net.minecraft.tileentity.TileEntity; /** * Reference implementation of {@link IFluidTank}. Use/extend this or implement your own. - * + * * @author King Lemming, cpw (LiquidTank) - * + * */ public class FluidTank implements IFluidTank { @@ -127,7 +127,7 @@ public class FluidTank implements IFluidTank if (tile != null) { - FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluid, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this, fluid.amount)); + FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluid, tile.getWorld(), tile.getPos(), this, fluid.amount)); } return fluid.amount; } @@ -150,7 +150,7 @@ public class FluidTank implements IFluidTank if (tile != null) { - FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluid, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this, filled)); + FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluid, tile.getWorld(), tile.getPos(), this, filled)); } return filled; } @@ -180,9 +180,9 @@ public class FluidTank implements IFluidTank if (tile != null) { - FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluid, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this, drained)); + FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluid, tile.getWorld(), tile.getPos(), this, drained)); } } return stack; } -} +} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/fluids/IFluidBlock.java b/src/main/java/net/minecraftforge/fluids/IFluidBlock.java index 3f5bec69d1..da78c9fb80 100644 --- a/src/main/java/net/minecraftforge/fluids/IFluidBlock.java +++ b/src/main/java/net/minecraftforge/fluids/IFluidBlock.java @@ -1,14 +1,15 @@ package net.minecraftforge.fluids; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; /** * Implement this interface on Block classes which represent world-placeable Fluids. - * + * * NOTE: Using/extending the reference implementations {@link BlockFluidBase} is encouraged. - * + * * @author King Lemming - * + * */ public interface IFluidBlock { @@ -19,33 +20,33 @@ public interface IFluidBlock /** * Attempt to drain the block. This method should be called by devices such as pumps. - * + * * NOTE: The block is intended to handle its own state changes. - * + * * @param doDrain * If false, the drain will only be simulated. * @return */ - FluidStack drain(World world, int x, int y, int z, boolean doDrain); + FluidStack drain(World world, BlockPos pos, boolean doDrain); /** * Check to see if a block can be drained. This method should be called by devices such as * pumps. - * + * * @param doDrain * If false, the drain will only be simulated. * @return */ - boolean canDrain(World world, int x, int y, int z); + boolean canDrain(World world, BlockPos pos); /** * Returns the amount of a single block is filled. Value between 0 and 1. * 1 meaning the entire 1x1x1 cube is full, 0 meaning completely empty. - * - * If the return value is negative. It will be treated as filling the block + * + * If the return value is negative. It will be treated as filling the block * from the top down instead of bottom up. - * + * * @return */ - float getFilledPercentage(World world, int x, int y, int z); -} + float getFilledPercentage(World world, BlockPos pos); +} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/fluids/IFluidHandler.java b/src/main/java/net/minecraftforge/fluids/IFluidHandler.java index 9070423a51..27880f4a97 100644 --- a/src/main/java/net/minecraftforge/fluids/IFluidHandler.java +++ b/src/main/java/net/minecraftforge/fluids/IFluidHandler.java @@ -1,21 +1,21 @@ package net.minecraftforge.fluids; -import net.minecraftforge.common.util.ForgeDirection; +import net.minecraft.util.EnumFacing; /** * Implement this interface on TileEntities which should handle fluids, generally storing them in * one or more internal {@link IFluidTank} objects. - * + * * A reference implementation is provided {@link TileFluidHandler}. - * + * * @author King Lemming - * + * */ public interface IFluidHandler { /** * Fills fluid into internal tanks, distribution is left entirely to the IFluidHandler. - * + * * @param from * Orientation the Fluid is pumped in from. * @param resource @@ -24,11 +24,11 @@ public interface IFluidHandler * If false, fill will only be simulated. * @return Amount of resource that was (or would have been, if simulated) filled. */ - int fill(ForgeDirection from, FluidStack resource, boolean doFill); + int fill(EnumFacing from, FluidStack resource, boolean doFill); /** * Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler. - * + * * @param from * Orientation the Fluid is drained to. * @param resource @@ -38,13 +38,13 @@ public interface IFluidHandler * @return FluidStack representing the Fluid and amount that was (or would have been, if * simulated) drained. */ - FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain); + FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain); /** * Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler. - * + * * This method is not Fluid-sensitive. - * + * * @param from * Orientation the fluid is drained to. * @param maxDrain @@ -54,29 +54,29 @@ public interface IFluidHandler * @return FluidStack representing the Fluid and amount that was (or would have been, if * simulated) drained. */ - FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain); + FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain); /** * Returns true if the given fluid can be inserted into the given direction. - * + * * More formally, this should return true if fluid is able to enter from the given direction. */ - boolean canFill(ForgeDirection from, Fluid fluid); + boolean canFill(EnumFacing from, Fluid fluid); /** * Returns true if the given fluid can be extracted from the given direction. - * + * * More formally, this should return true if fluid is able to leave from the given direction. */ - boolean canDrain(ForgeDirection from, Fluid fluid); + boolean canDrain(EnumFacing from, Fluid fluid); /** * Returns an array of objects which represent the internal tanks. These objects cannot be used * to manipulate the internal tanks. See {@link FluidTankInfo}. - * + * * @param from * Orientation determining which tanks should be queried. * @return Info for the relevant internal tanks. */ - FluidTankInfo[] getTankInfo(ForgeDirection from); + FluidTankInfo[] getTankInfo(EnumFacing from); } diff --git a/src/main/java/net/minecraftforge/fluids/ItemFluidContainer.java b/src/main/java/net/minecraftforge/fluids/ItemFluidContainer.java index 2041047c3a..85e4699412 100644 --- a/src/main/java/net/minecraftforge/fluids/ItemFluidContainer.java +++ b/src/main/java/net/minecraftforge/fluids/ItemFluidContainer.java @@ -6,9 +6,9 @@ import net.minecraft.nbt.NBTTagCompound; /** * Reference implementation of {@link IFluidContainerItem}. Use/extend this or implement your own. - * + * * @author King Lemming - * + * */ public class ItemFluidContainer extends Item implements IFluidContainerItem { @@ -35,11 +35,11 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem @Override public FluidStack getFluid(ItemStack container) { - if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid")) + if (!container.hasTagCompound() || !container.getTagCompound().hasKey("Fluid")) { return null; } - return FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("Fluid")); + return FluidStack.loadFluidStackFromNBT(container.getTagCompound().getCompoundTag("Fluid")); } @Override @@ -58,12 +58,12 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem if (!doFill) { - if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid")) + if (!container.hasTagCompound() || !container.getTagCompound().hasKey("Fluid")) { return Math.min(capacity, resource.amount); } - FluidStack stack = FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("Fluid")); + FluidStack stack = FluidStack.loadFluidStackFromNBT(container.getTagCompound().getCompoundTag("Fluid")); if (stack == null) { @@ -78,27 +78,27 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem return Math.min(capacity - stack.amount, resource.amount); } - if (container.stackTagCompound == null) + if (!container.hasTagCompound()) { - container.stackTagCompound = new NBTTagCompound(); + container.setTagCompound(new NBTTagCompound()); } - if (!container.stackTagCompound.hasKey("Fluid")) + if (!container.getTagCompound().hasKey("Fluid")) { NBTTagCompound fluidTag = resource.writeToNBT(new NBTTagCompound()); if (capacity < resource.amount) { fluidTag.setInteger("Amount", capacity); - container.stackTagCompound.setTag("Fluid", fluidTag); + container.getTagCompound().setTag("Fluid", fluidTag); return capacity; } - container.stackTagCompound.setTag("Fluid", fluidTag); + container.getTagCompound().setTag("Fluid", fluidTag); return resource.amount; } - NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("Fluid"); + NBTTagCompound fluidTag = container.getTagCompound().getCompoundTag("Fluid"); FluidStack stack = FluidStack.loadFluidStackFromNBT(fluidTag); if (!stack.isFluidEqual(resource)) @@ -117,19 +117,19 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem stack.amount = capacity; } - container.stackTagCompound.setTag("Fluid", stack.writeToNBT(fluidTag)); + container.getTagCompound().setTag("Fluid", stack.writeToNBT(fluidTag)); return filled; } @Override public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) { - if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid")) + if (!container.hasTagCompound() || !container.getTagCompound().hasKey("Fluid")) { return null; } - FluidStack stack = FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("Fluid")); + FluidStack stack = FluidStack.loadFluidStackFromNBT(container.getTagCompound().getCompoundTag("Fluid")); if (stack == null) { return null; @@ -141,18 +141,18 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem { if (currentAmount == stack.amount) { - container.stackTagCompound.removeTag("Fluid"); + container.getTagCompound().removeTag("Fluid"); - if (container.stackTagCompound.hasNoTags()) + if (container.getTagCompound().hasNoTags()) { - container.stackTagCompound = null; + container.setTagCompound(null); } return stack; } - NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("Fluid"); + NBTTagCompound fluidTag = container.getTagCompound().getCompoundTag("Fluid"); fluidTag.setInteger("Amount", currentAmount - stack.amount); - container.stackTagCompound.setTag("Fluid", fluidTag); + container.getTagCompound().setTag("Fluid", fluidTag); } return stack; } diff --git a/src/main/java/net/minecraftforge/fluids/RenderBlockFluid.java b/src/main/java/net/minecraftforge/fluids/RenderBlockFluid.java index 3fb858c04d..6719a878e6 100644 --- a/src/main/java/net/minecraftforge/fluids/RenderBlockFluid.java +++ b/src/main/java/net/minecraftforge/fluids/RenderBlockFluid.java @@ -1,5 +1,7 @@ package net.minecraftforge.fluids; +//TODO: Get some test liquids and test this out -.- +/* import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderBlocks; @@ -8,14 +10,14 @@ import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler; /** * Default renderer for Forge fluid blocks. - * + * * @author King Lemming - * - */ + * + * / public class RenderBlockFluid implements ISimpleBlockRenderingHandler { public static RenderBlockFluid instance = new RenderBlockFluid(); @@ -30,7 +32,7 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { float total = 0; int count = 0; - + float end = 0; for (int i = 0; i < flow.length; i++) @@ -46,10 +48,10 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler count++; } } - + if (end == 0) end = total / count; - + return end; } @@ -71,7 +73,7 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler return !world.getBlock(x, y, z).getMaterial().isSolid() && world.getBlock(x, y - block.densityDir, z) == block ? 1 : block.getQuantaPercentage(world, x, y, z) * 0.875F; } - /* ISimpleBlockRenderingHandler */ + /* ISimpleBlockRenderingHandler * / @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer){} @@ -98,9 +100,9 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler boolean[] renderSides = new boolean[] { - block.shouldSideBeRendered(world, x, y, z - 1, 2), + block.shouldSideBeRendered(world, x, y, z - 1, 2), block.shouldSideBeRendered(world, x, y, z + 1, 3), - block.shouldSideBeRendered(world, x - 1, y, z, 4), + block.shouldSideBeRendered(world, x - 1, y, z, 4), block.shouldSideBeRendered(world, x + 1, y, z, 5) }; @@ -334,4 +336,5 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler if (icon != null) return icon; return ((TextureMap)Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno"); } -} \ No newline at end of file +} +*/ \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/fluids/TileFluidHandler.java b/src/main/java/net/minecraftforge/fluids/TileFluidHandler.java index 5388666569..a48f2ee954 100644 --- a/src/main/java/net/minecraftforge/fluids/TileFluidHandler.java +++ b/src/main/java/net/minecraftforge/fluids/TileFluidHandler.java @@ -3,13 +3,13 @@ package net.minecraftforge.fluids; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; +import net.minecraft.util.EnumFacing; /** * Reference Tile Entity implementation of {@link IFluidHandler}. Use/extend this or write your own. - * + * * @author King Lemming - * + * */ public class TileFluidHandler extends TileEntity implements IFluidHandler { @@ -31,13 +31,13 @@ public class TileFluidHandler extends TileEntity implements IFluidHandler /* IFluidHandler */ @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) + public int fill(EnumFacing from, FluidStack resource, boolean doFill) { return tank.fill(resource, doFill); } @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) + public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) { if (resource == null || !resource.isFluidEqual(tank.getFluid())) { @@ -47,25 +47,25 @@ public class TileFluidHandler extends TileEntity implements IFluidHandler } @Override - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) + public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) { return tank.drain(maxDrain, doDrain); } @Override - public boolean canFill(ForgeDirection from, Fluid fluid) + public boolean canFill(EnumFacing from, Fluid fluid) { return true; } @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) + public boolean canDrain(EnumFacing from, Fluid fluid) { return true; } @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) + public FluidTankInfo[] getTankInfo(EnumFacing from) { return new FluidTankInfo[] { tank.getInfo() }; } diff --git a/src/main/java/net/minecraftforge/oredict/OreDictionary.java b/src/main/java/net/minecraftforge/oredict/OreDictionary.java index 1330bad670..4eb189f3fb 100644 --- a/src/main/java/net/minecraftforge/oredict/OreDictionary.java +++ b/src/main/java/net/minecraftforge/oredict/OreDictionary.java @@ -27,8 +27,8 @@ import net.minecraftforge.common.MinecraftForge; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.eventhandler.Event; public class OreDictionary { @@ -430,12 +430,6 @@ public class OreDictionary public static void registerOre(String name, Item ore){ registerOre(name, new ItemStack(ore)); } public static void registerOre(String name, Block ore){ registerOre(name, new ItemStack(ore)); } public static void registerOre(String name, ItemStack ore){ registerOreImpl(name, ore); } - @Deprecated //Use named, not ID in 1.8+ - public static void registerOre(int id, Item ore){ registerOre(id, new ItemStack(ore)); } - @Deprecated //Use named, not ID in 1.8+ - public static void registerOre(int id, Block ore){ registerOre(id, new ItemStack(ore)); } - @Deprecated //Use named, not ID in 1.8+ - public static void registerOre(int id, ItemStack ore){ registerOreImpl(getOreName(id), ore); } /** * Registers a ore item into the dictionary. diff --git a/src/main/java/net/minecraftforge/oredict/RecipeSorter.java b/src/main/java/net/minecraftforge/oredict/RecipeSorter.java index cf8f1f16e0..74018e0c4b 100644 --- a/src/main/java/net/minecraftforge/oredict/RecipeSorter.java +++ b/src/main/java/net/minecraftforge/oredict/RecipeSorter.java @@ -11,9 +11,9 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.common.toposort.TopologicalSort; -import cpw.mods.fml.common.toposort.TopologicalSort.DirectedGraph; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.toposort.TopologicalSort; +import net.minecraftforge.fml.common.toposort.TopologicalSort.DirectedGraph; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.RecipeBookCloning; diff --git a/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java b/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java index 1451122cae..587a19e6ed 100644 --- a/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java +++ b/src/main/java/net/minecraftforge/oredict/ShapedOreRecipe.java @@ -5,7 +5,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; - import net.minecraft.block.Block; import net.minecraft.item.crafting.IRecipe; import net.minecraft.inventory.InventoryCrafting; @@ -13,6 +12,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeHooks; public class ShapedOreRecipe implements IRecipe { @@ -255,4 +255,10 @@ public class ShapedOreRecipe implements IRecipe { return this.input; } + + @Override + public ItemStack[] func_179532_b(InventoryCrafting inv) //getRecipeLeftovers + { + return ForgeHooks.defaultRecipeGetRemainingItems(inv); + } } diff --git a/src/main/java/net/minecraftforge/oredict/ShapelessOreRecipe.java b/src/main/java/net/minecraftforge/oredict/ShapelessOreRecipe.java index c7a0111a4d..f80547f29e 100644 --- a/src/main/java/net/minecraftforge/oredict/ShapelessOreRecipe.java +++ b/src/main/java/net/minecraftforge/oredict/ShapelessOreRecipe.java @@ -5,7 +5,6 @@ import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.item.crafting.IRecipe; import net.minecraft.inventory.InventoryCrafting; @@ -13,6 +12,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeHooks; public class ShapelessOreRecipe implements IRecipe { @@ -146,4 +146,10 @@ public class ShapelessOreRecipe implements IRecipe { return this.input; } + + @Override + public ItemStack[] func_179532_b(InventoryCrafting inv) //getRecipeLeftovers + { + return ForgeHooks.defaultRecipeGetRemainingItems(inv); + } } diff --git a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java index 01b7260fbe..4d0a9fbc53 100644 --- a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java @@ -2,7 +2,9 @@ package net.minecraftforge.server.command; import java.lang.ref.WeakReference; import java.text.DecimalFormat; + import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; import net.minecraft.server.MinecraftServer; @@ -38,7 +40,7 @@ public class ForgeCommand extends CommandBase { return 2; } @Override - public void processCommand(ICommandSender sender, String[] args) + public void processCommand(ICommandSender sender, String[] args) throws CommandException { if (args.length == 0) { @@ -66,14 +68,14 @@ public class ForgeCommand extends CommandBase { } } - private void handleTracking(ICommandSender sender, String[] args) + private void handleTracking(ICommandSender sender, String[] args) throws CommandException { if (args.length != 3) { throw new WrongUsageException("commands.forge.usage.tracking"); } String type = args[1]; - int duration = parseIntBounded(sender, args[2], 1, 60); + int duration = parseInt(args[2], 1, 60); if ("te".equals(type)) { @@ -97,13 +99,13 @@ public class ForgeCommand extends CommandBase { } - private void displayTPS(ICommandSender sender, String[] args) + private void displayTPS(ICommandSender sender, String[] args) throws CommandException { int dim = 0; boolean summary = true; if (args.length > 1) { - dim = parseInt(sender, args[1]); + dim = parseInt(args[1]); summary = false; } if (summary) diff --git a/src/main/java/net/minecraftforge/transformers/ForgeAccessTransformer.java b/src/main/java/net/minecraftforge/transformers/ForgeAccessTransformer.java index 810d950069..57610e9d4c 100644 --- a/src/main/java/net/minecraftforge/transformers/ForgeAccessTransformer.java +++ b/src/main/java/net/minecraftforge/transformers/ForgeAccessTransformer.java @@ -2,7 +2,7 @@ package net.minecraftforge.transformers; import java.io.IOException; -import cpw.mods.fml.common.asm.transformers.AccessTransformer; +import net.minecraftforge.fml.common.asm.transformers.AccessTransformer; public class ForgeAccessTransformer extends AccessTransformer { diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 2601f3355e..c2381c6b46 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -10,10 +10,20 @@ net/minecraft/world/World.getSunBrightnessFactor(F)F=|p_72967_1_ net/minecraft/world/World.getSunBrightnessBody(F)F=|p_72971_1_ net/minecraft/world/World.getSkyColorBody(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/util/Vec3;=|p_72833_1_,p_72833_2_ net/minecraft/world/World.drawCloudsBody(F)Lnet/minecraft/util/Vec3;=|p_72824_1_ -net/minecraft/world/World.canBlockFreezeBody(IIIZ)Z=|p_72834_1_,p_72834_2_,p_72834_3_,p_72834_4_ +net/minecraft/world/World.getStarBrightnessBody(F)F=|p_72880_1_ +net/minecraft/world/World.canBlockFreezeBody(Lnet/minecraft/util/BlockPos;Z)Z=|p_175670_1_,p_175670_2_, +net/minecraft/world/World.canSnowAtBody(Lnet/minecraft/util/BlockPos;Z)Z=|p_175708_1_,p_175708_2_ +net/minecraft/world/World.canMineBlockBody(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/util/BlockPos;)Z=|p_175660_1_,p_175660_2_ +net/minecraft/world/WorldServer.canMineBlockBody(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/util/BlockPos;)Z=|p_175660_1_,p_175660_2_ net/minecraft/world/biome/BiomeGenBase.(IZ)V=|p_i1971_1_,register net/minecraft/world/chunk/storage/AnvilChunkLoader.loadChunk__Async(Lnet/minecraft/world/World;II)[Ljava/lang/Object;=|p_75815_1_,p_75815_2_,p_75815_3_ net/minecraft/world/chunk/storage/AnvilChunkLoader.checkedReadChunkFromNBT__Async(Lnet/minecraft/world/World;IILnet/minecraft/nbt/NBTTagCompound;)[Ljava/lang/Object;=|p_75822_1_,p_75822_2_,p_75822_3_,p_75822_4_ net/minecraft/world/chunk/storage/AnvilChunkLoader.loadEntities(Lnet/minecraft/world/World;Lnet/minecraft/nbt/NBTTagCompound;Lnet/minecraft/world/chunk/Chunk;)V=|p_75823_1_,p_75823_2_,chunk net/minecraft/world/gen/ChunkProviderServer.loadChunk(II;Ljava/lang/Runnable;)Lnet/minecraft/world/chunk/Chunk;=|p_73158_1,p_73158_2,runnable net/minecraft/world/gen/ChunkProviderServer.originalLoadChunk(II)Lnet/minecraft/world/chunk/Chunk;=|p_73158_1_,p_73158_2_ + +net/minecraft/block/BlockFire.tryCatchFire(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;ILjava/util/Random;ILnet/minecraft/util/EnumFacing;)V=|p_176536_1_,p_176536_2_,p_176536_3_,p_176536_4_,p_176536_5_,face +net/minecraft/block/BlockSkull.getDrops(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/BlockPos;Lnet/minecraft/block/state/IBlockState;I)Ljava/util/List;=|p_180663_1_,p_180663_2_,p_180663_3_,fortune +net/minecraft/item/ItemDye.applyBonemeal(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;Lnet/minecraft/entity/player/EntityPlayer;)Z=|p_179234_0_,p_179234_1_,p_179234_2_,player +net/minecraft/server/management/ItemInWorldManager.removeBlock(Lnet/minecraft/util/BlockPos;Z)Z=|p_180235_1_,canHarvest +net/minecraft/client/gui/GuiScreen.drawHoveringText(Ljava/util/List;IILnet/minecraft/client/gui/FontRenderer;)V=|p_146283_1_,p_146283_2_,p_146283_3_,font \ No newline at end of file diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index 06028ee62b..49efb17632 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -1,11 +1,4 @@ #Main Forge Access Transformer configuration file -# Tessellator -#public-f bfq.a #FD:Tessellator/field_78398_a #instance -#public bfq.u #FD:Tessellator/field_78409_u #drawMode -#public bfq.v #FD:Tessellator/field_78408_v #xOffset -#public bfq.w #FD:Tessellator/field_78407_w #yOffset -#public bfq.x #FD:Tessellator/field_78417_x #zOffset -#public bfq.z #FD:Tessellator/field_78415_z #isDrawing # EntityFishHook public net.minecraft.entity.projectile.EntityFishHook field_146041_e public net.minecraft.entity.projectile.EntityFishHook field_146036_f @@ -14,21 +7,10 @@ public net.minecraft.entity.projectile.EntityFishHook field_146039_d public net.minecraft.item.ItemPickaxe (Lnet.minecraft.item.Item$ToolMaterial;) public net.minecraft.item.ItemAxe (Lnet.minecraft.item.Item$ToolMaterial;) public net.minecraft.item.ItemSpade (Lnet.minecraft.item.Item$ToolMaterial;) -# ItemTool -#public xj.a #FD:ItemTool/field_77864_a #efficiencyOnProperMaterial -#public xj.d #FD:ItemTool/field_77865_bY #damageVsEntity # EntityEnderman #public tg.br #FD:EntityEnderman/field_70827_d #carriableBlocks -# RenderGlobal -#public bfl.k #FD:RenderGlobal/field_72769_h #theWorld -#public bfl.l #FD:RenderGlobal/field_72770_i #renderEngine -#public bfl.t #FD:RenderGlobal/field_72777_q #mc -#public bfl.u #FD:RenderGlobal/field_72776_r #globalRenderBlocks -#public bfl.H #FD:RenderGlobal/field_72738_E #damagedBlocks # SoundManager public net.minecraft.client.audio.SoundManager field_148622_c #sndHandler -# EntityMinecart -#protected st.* #FD:EntityMinecart/* # All private -> protected # Block public net.minecraft.block.Block (Lnet/minecraft/src/Material;)V public net.minecraft.block.Block func_149658_d(Ljava/lang/String;)Lnet.minecraft.block.Block; #setIconName @@ -40,55 +22,29 @@ public net.minecraft.block.Block func_149715_a(F)Lnet.minecraft.block.Block; #se public net.minecraft.block.Block func_149722_s()Lnet.minecraft.block.Block; #setBlockUnbreakable public net.minecraft.block.Block func_149675_a(Z)Lnet.minecraft.block.Block; #setTickRandomly public net.minecraft.block.Block func_149676_a(FFFFFF)V #setBlockBounds -public net.minecraft.block.Block func_149657_c(Lnet/minecraft/world/World;IIII)V # dropXpOnBlockBreak -# NetServerHandler -#public ka.f #FD:NetServerHandler/field_72572_g #playerInAirTime -# TileEntity -#public asp.k #FD:TileEntity/field_70331_k #worldObj -# BlockLeavesBase -#public arh.d #FD:BlockLeavesBase/field_72131_c #graphicsLevel +public net.minecraft.block.Block func_180637_b(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;I)V # dropXpOnBlockBreak +# BlockFire +public net.minecraft.block.BlockFire func_176532_c(Lnet/minecraft/block/Block;)I # getFireSpreadSpeed +public net.minecraft.block.BlockFire func_176534_d(Lnet/minecraft/block/Block;)I # getFireSpreadSpeed # Item public net.minecraft.item.Item func_77656_e(I)Lnet.minecraft.item.Item; #setMaxDamage public-f net.minecraft.item.Item func_77650_f(Lnet.minecraft.item.ItemStack;)Lnet.minecraft.util.IIcon; #getIcon is Final for unknown reason public net.minecraft.item.Item func_77627_a(Z)Lnet.minecraft.item.Item; #setHasSubtypes public net.minecraft.item.Item func_77631_c(Ljava.lang.String;)Lnet.minecraft.item.Item; #setPotionEffect public net.minecraft.item.Item func_111206_d(Ljava.lang.String;)Lnet.minecraft.item.Item; #setTextureName -# RailLogic -#public amz #CL:BlockBaseRailLogic -#public amz.a()I #MD:BlockBaseRailLogic/func_94505_a #getNAdjacentTiles # EntityPlayer public net.minecraft.entity.player.EntityPlayer func_71012_a(Lnet/minecraft/entity/item/EntityItem;)V #joinEntityItemWithWorld -public net.minecraft.client.entity.EntityClientPlayerMP func_71012_a(Lnet/minecraft/entity/item/EntityItem;)V #joinEntityItemWithWorld +public net.minecraft.client.entity.EntityPlayerSP func_71012_a(Lnet/minecraft/entity/item/EntityItem;)V #joinEntityItemWithWorld public net.minecraft.entity.player.EntityPlayer func_71053_j()V #closeScreen #public uf.b #FD:EntityPlayer/field_71076_b #sleepTimer # World Gen Chests Related public net.minecraft.util.WeightedRandomChestContent * -public net.minecraft.world.WorldServer field_73069_S -public net.minecraft.world.gen.structure.StructureMineshaftPieces field_78818_a -public net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces$DesertPyramid field_74941_i -public net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces$JunglePyramid field_74943_l -public net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces$JunglePyramid field_74944_m -public net.minecraft.world.gen.structure.StructureStrongholdPieces$ChestCorridor field_75003_a -public net.minecraft.world.gen.structure.StructureStrongholdPieces$Library field_75007_b -public net.minecraft.world.gen.structure.StructureStrongholdPieces$RoomCrossing field_75014_c -public net.minecraft.world.gen.structure.StructureVillagePieces$House2 field_74918_a -public net.minecraft.world.gen.feature.WorldGenDungeons field_111189_a # Save Location public net.minecraft.world.chunk.storage.AnvilChunkLoader field_75825_d # chunkSaveLocation public net.minecraft.world.gen.ChunkProviderServer field_73247_e # currentChunkLoader -# PlayerManager -#public jp.a(IIZ)Ljq; #MD:PlayerManager/func_72690_a #getOrCreateChunkWatcher -# PlayerInstance -#public jq #CL:PlayerInstance # World public-f net.minecraft.world.World field_72982_D #villageCollectionObj #public abw.G #FD:World/field_72993_I #activeChunkSet -# EntityLiving -#public og.b #FD:EntityLiving/field_70728_aV #experienceValue -#public og.d #FD:EntityLiving/field_70715_bh #targetTasks -# GuiFlatPresets -#public avz.a(Ljava/lang/String;ILacq;Ljava/util/List;[Lagd;)V #MD:GuiFlatPresets/func_82294_a -#public avz.a(Ljava/lang/String;ILacq;[Lagd;)V #MD:GuiFlatPresets/func_82297_a # BiomeGenBase public net.minecraft.world.biome.BiomeGenBase *() #Everything protected->public public net.minecraft.world.biome.BiomeGenForest *() @@ -108,23 +64,12 @@ public+f net.minecraft.item.crafting.ShapedRecipes field_77576_b #recipeWidth public+f net.minecraft.item.crafting.ShapedRecipes field_77577_c #recipeHeight # ShapelessRecipes public net.minecraft.item.crafting.ShapelessRecipes field_77579_b #recipeItems -# GuiContainer -#protected awy.a(Lwe;)V #MD:GuiContainer/func_74192_a #drawSlotInventory -# ContainerPlayer -#protected vv.h #FD:ContainerPlayer/field_82862_h #player # ContainerRepair public net.minecraft.inventory.ContainerRepair field_82856_l #ContainerRepair/stackSizeToBeUsedInRepair -# BlockButton -#protected anf.n(Labw;III)V #MD:BlockButton/func_82535_o #checkActivation -#protected-f anf.a #FD:BlockButton/field_82537_a #sensible # BiomeDecorator public net.minecraft.world.biome.BiomeDecorator * # CreativeTabs public-f net.minecraft.creativetab.CreativeTabs field_78032_a # creativeTabArray non-final -# Packet -#public ey.a(IZZLjava/lang/Class;)V #MD:Packet/func_73285_a #addIdClassMapping -# SaveHandler -#public alq.b()Ljava/io/File; #MD:SaveHandler/func_75765_b # World stuff public net.minecraft.world.World field_73003_n #prevRainingStrength public net.minecraft.world.World field_73004_o #rainingStrength @@ -136,29 +81,11 @@ public net.minecraft.world.WorldServer func_72923_a(Lnet/minecraft/entity/Entity public net.minecraft.world.WorldServer func_72847_b(Lnet/minecraft/entity/Entity;)V #onEntityRemoved public net.minecraft.client.multiplayer.WorldClient func_72923_a(Lnet/minecraft/entity/Entity;)V #onEntityAdded public net.minecraft.client.multiplayer.WorldClient func_72847_b(Lnet/minecraft/entity/Entity;)V #onEntityRemoved -# WorldServer -#public js.N #FD:WorldServer/field_73068_P #allPlayersSleeping -# TextureMap -#public bik.g #FD:TextureMap/field_94255_a -#public bik.h #FD:TextureMap/field_94254_c -# Potion -#public ni.b(II)Lni; #MD:Potion/func_76399_b #setIconIndex -# PotionHelper -#public zp.m #FD:PotionHelper/field_77927_l #potionRequirements -#public zp.n #FD:PotionHelper/field_77928_m #potionAmplifiers -# PotionEffect -#public nj.b #FD:PotionEffect/field_76460_b #duration -# BlockFluid -#protected apc.a #FD:BlockFluid/field_94425_a #theIcon # GuiIngame protected net.minecraft.client.gui.GuiIngame * protected net.minecraft.client.gui.GuiIngame *() # ItemStack default net.minecraft.item.ItemStack field_77991_e -# GuiSlot -#protected awg.b(IIII)V #MD:GuiSlot/func_77206_b #overlayBackground -# EntityPlayer -#public uf.bu #FD:EntityPlayer/field_71092_bJ #username # MapGenStructureIO public net.minecraft.world.gen.structure.MapGenStructureIO func_143034_b(Ljava/lang/Class;Ljava/lang/String;)V # registerStart public net.minecraft.world.gen.structure.MapGenStructureIO func_143031_a(Ljava/lang/Class;Ljava/lang/String;)V # registerPiece @@ -189,3 +116,5 @@ public net.minecraft.world.gen.ChunkProviderServer field_73246_d # currentChunkP public net.minecraft.world.gen.ChunkProviderServer field_73244_f # loadedChunkHashMap public net.minecraft.world.gen.ChunkProviderServer field_73245_g # loadedChunks public net.minecraft.world.gen.ChunkProviderServer field_73251_h # worldObj +# RenderEntityItem +protected net.minecraft.client.renderer.entity.RenderEntityItem func_177078_a(Lnet/minecraft/item/ItemStack;)I # getMiniItemCount diff --git a/src/test/java/net/minecraftforge/test/EnumHelperTest.java b/src/test/java/net/minecraftforge/test/EnumHelperTest.java index ed891f734a..992b8fdcb4 100644 --- a/src/test/java/net/minecraftforge/test/EnumHelperTest.java +++ b/src/test/java/net/minecraftforge/test/EnumHelperTest.java @@ -12,7 +12,7 @@ import net.minecraftforge.common.util.EnumHelper; import org.junit.Assert; import org.junit.Test; -import cpw.mods.fml.relauncher.ReflectionHelper; +import net.minecraftforge.fml.relauncher.ReflectionHelper; public class EnumHelperTest {