diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 66c7ed8c85..f423fe608b 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -139,7 +139,19 @@ } } } -@@ -827,7 +851,7 @@ +@@ -643,6 +667,11 @@ + { + if (!p_149642_1_.field_72995_K && p_149642_1_.func_82736_K().func_82766_b("doTileDrops")) + { ++ if (captureDrops.get()) ++ { ++ capturedDrops.get().add(p_149642_5_); ++ 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; +@@ -827,7 +856,7 @@ public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { @@ -148,7 +160,7 @@ } 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_) -@@ -920,25 +944,35 @@ +@@ -920,25 +949,35 @@ p_149636_2_.func_71064_a(StatList.field_75934_C[func_149682_b(this)], 1); p_149636_2_.func_71020_j(0.025F); @@ -187,12 +199,13 @@ } protected ItemStack func_149644_j(int p_149644_1_) -@@ -1114,6 +1148,1065 @@ +@@ -1114,6 +1153,1091 @@ return null; } + /* ======================================== FORGE START =====================================*/ -+ private ThreadLocal harvesters = new ThreadLocal(); ++ //For ForgeInternal use Only! ++ protected ThreadLocal harvesters = new ThreadLocal(); + private ThreadLocal silk_check_meta = new ThreadLocal(); + /** + * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15 @@ -1248,6 +1261,31 @@ + if (harvestTool[metadata] == null) return false; + return harvestTool[metadata].equals(type); + } ++ ++ ++ // For Inernal use only to capture droped items inside getDrops ++ protected ThreadLocal captureDrops = new ThreadLocal() ++ { ++ @Override protected Boolean initialValue() { return false; } ++ }; ++ protected ThreadLocal> capturedDrops = new ThreadLocal>() ++ { ++ @Override protected List initialValue() { return new ArrayList(); } ++ }; ++ protected List captureDrops(boolean start) ++ { ++ if (start) ++ { ++ captureDrops.set(true); ++ capturedDrops.get().clear(); ++ return null; ++ } ++ else ++ { ++ captureDrops.set(false); ++ return capturedDrops.get(); ++ } ++ } + /* ========================================= FORGE END ======================================*/ + public static class SoundType diff --git a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch new file mode 100644 index 0000000000..5a46765620 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch @@ -0,0 +1,45 @@ +--- ../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; + import net.minecraft.world.World; ++import net.minecraftforge.common.IShearable; + +-public class BlockDeadBush extends BlockBush ++public class BlockDeadBush extends BlockBush implements IShearable + { + private static final String __OBFID = "CL_00000224"; + +@@ -33,14 +37,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_) + { +- 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(Blocks.field_150330_I, 1, p_149636_6_)); +- } +- else +- { + super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_); + } + } ++ ++ @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) ++ { ++ return new ArrayList(Arrays.asList(new ItemStack(Blocks.field_150330_I, 1, world.func_72805_g(x, y, z)))); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch index 49187fdb1e..0170e39fad 100644 --- a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch @@ -1,6 +1,25 @@ --- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java +++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java -@@ -81,6 +81,7 @@ +@@ -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; + +-public class BlockDoublePlant extends BlockBush implements IGrowable ++public class BlockDoublePlant extends BlockBush implements IGrowable, IShearable + { + public static final String[] field_149892_a = new String[] {"sunflower", "syringa", "grass", "fern", "rose", "paeonia"}; + @SideOnly(Side.CLIENT) +@@ -81,6 +83,7 @@ public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_) { @@ -8,3 +27,26 @@ 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_); } +@@ -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) ++ { ++ int metadata = world.func_72805_g(x, y, z); ++ int type = func_149890_d(metadata); ++ return func_149887_c(metadata) && (type == 3 || type == 4); ++ } ++ ++ @Override ++ public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, 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)); ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch new file mode 100644 index 0000000000..21d0a91422 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch @@ -0,0 +1,38 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.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.entity.player.EntityPlayer; +@@ -139,12 +140,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_) + { + 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_); +- TileEntityFlowerPot tileentityflowerpot = this.func_149929_e(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_); +- +- if (tileentityflowerpot != null && tileentityflowerpot.func_145965_a() != null) +- { +- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(tileentityflowerpot.func_145965_a(), 1, tileentityflowerpot.func_145966_b())); +- } + } + + 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_) +@@ -242,4 +237,14 @@ + + return new TileEntityFlowerPot(Item.func_150898_a((Block)object), b0); + } ++ ++ @Override ++ public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) ++ { ++ ArrayList ret = super.getDrops(world, x, y, z, metadata, fortune); ++ TileEntityFlowerPot te = this.func_149929_e(world, x, y, z); ++ if (te != null && te.func_145965_a() != null) ++ ret.add(new ItemStack(te.func_145965_a(), 1, te.func_145966_b())); ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockIce.java.patch b/patches/minecraft/net/minecraft/block/BlockIce.java.patch index 7ea2dab9c6..8f0df8ffac 100644 --- a/patches/minecraft/net/minecraft/block/BlockIce.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockIce.java.patch @@ -1,11 +1,50 @@ --- ../src-base/minecraft/net/minecraft/block/BlockIce.java +++ ../src-work/minecraft/net/minecraft/block/BlockIce.java -@@ -43,7 +43,7 @@ +@@ -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; +@@ -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_)) { ++ ArrayList items = new ArrayList(); ItemStack itemstack = this.func_149644_j(p_149636_6_); +- if (itemstack != null) +- { +- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, 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_); ++ for (ItemStack is : items) ++ this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, is); + } + else + { +@@ -61,7 +65,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); ++ harvesters.set(null); + Material material = p_149636_1_.func_147439_a(p_149636_3_, p_149636_4_ - 1, p_149636_5_).func_149688_o(); + + if (material.func_76230_c() || material.func_76224_d()) diff --git a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch index 657366d381..570196d986 100644 --- a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch @@ -45,7 +45,49 @@ { this.field_150128_a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2; } -@@ -281,13 +283,7 @@ +@@ -236,40 +238,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_) + { +- if (!p_149690_1_.field_72995_K) +- { +- int j1 = this.func_150123_b(p_149690_5_); +- +- if (p_149690_7_ > 0) +- { +- j1 -= 2 << p_149690_7_; +- +- if (j1 < 10) +- { +- j1 = 10; +- } +- } +- +- if (p_149690_1_.field_73012_v.nextInt(j1) == 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_))); +- } +- +- j1 = 200; +- +- if (p_149690_7_ > 0) +- { +- j1 -= 10 << p_149690_7_; +- +- if (j1 < 40) +- { +- j1 = 40; +- } +- } +- +- this.func_150124_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, j1); +- } ++ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, 1.0f, p_149690_7_); + } + + 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_) { @@ -59,7 +101,7 @@ super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_); } } -@@ -318,4 +314,38 @@ +@@ -318,4 +281,67 @@ } public abstract String[] func_150125_e(); @@ -96,5 +138,34 @@ + public boolean isLeaves(IBlockAccess world, int x, int y, int z) + { + 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); ++ ++ if (fortune > 0) ++ { ++ chance -= 2 << fortune; ++ 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))); ++ ++ chance = 200; ++ if (fortune > 0) ++ { ++ chance -= 10 << fortune; ++ if (chance < 40) chance = 40; ++ } ++ ++ this.captureDrops(true); ++ this.func_150124_c(world, x, y, z, metadata, chance); // Dammet mojang ++ ret.addAll(this.captureDrops(false)); ++ return ret; + } } diff --git a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch index 386cc420aa..52c7094e31 100644 --- a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch @@ -25,8 +25,11 @@ } 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_) -@@ -62,7 +64,9 @@ +@@ -60,9 +62,12 @@ + return 6; + } ++ @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_) { - if (!p_149690_1_.field_72995_K) @@ -36,7 +39,7 @@ { int j1 = 1; -@@ -109,4 +113,23 @@ +@@ -109,4 +114,23 @@ this.field_149883_a[i] = p_149651_1_.func_94245_a(this.func_149641_N() + "_stage_" + i); } } diff --git a/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch new file mode 100644 index 0000000000..97245a1500 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch @@ -0,0 +1,47 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java +@@ -2,11 +2,13 @@ + + 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_) + { +- if (!p_149690_1_.field_72995_K) +- { +- TileEntityPiston tileentitypiston = this.func_149963_e(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_); +- +- 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); +- } +- } ++ 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_); + } + + 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 @@ + { + this.field_149761_L = p_149651_1_.func_94245_a("piston_top_normal"); + } ++ ++ @Override ++ public ArrayList getDrops(World world, int x, int y, int z, int metadata, 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(); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch new file mode 100644 index 0000000000..7c89fb384b --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch @@ -0,0 +1,32 @@ +--- ../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_) + { + 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 (p_149690_5_ >= 7 && p_149690_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)); +- } +- } ++ @Override ++ public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) ++ { ++ ArrayList ret = super.getDrops(world, x, y, z, metadata, fortune); ++ if (metadata >= 7 && world.field_73012_v.nextInt(50) == 0) ++ ret.add(new ItemStack(Items.field_151170_bI)); ++ return ret; + } + + @SideOnly(Side.CLIENT)