From 46a9ba178f676c65c432de751d2fd020564014ba Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 11 Dec 2011 21:55:35 +0000 Subject: [PATCH] Fixed seeds/wheat not dropping from Crops/TallGrass. All future Forge code should use proper annotations when Overriding. --- .../net/minecraft/src/BlockCrops.java.patch | 29 ++++++++--------- .../minecraft/src/BlockTallGrass.java.patch | 21 ++++++++----- .../net/minecraft/src/BlockCrops.java.patch | 31 ++++++++++--------- .../minecraft/src/BlockTallGrass.java.patch | 21 ++++++++----- 4 files changed, 60 insertions(+), 42 deletions(-) diff --git a/forge/patches/minecraft/net/minecraft/src/BlockCrops.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockCrops.java.patch index b1110702c..4c7af8d45 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockCrops.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockCrops.java.patch @@ -8,7 +8,7 @@ // Referenced classes of package net.minecraft.src: // BlockFlower, Block, World, EntityItem, -@@ -108,28 +109,16 @@ +@@ -108,28 +109,22 @@ return 6; } @@ -16,22 +16,22 @@ - { - super.dropBlockAsItemWithChance(world, i, j, k, l, f, 0); - if(world.multiplayerWorld) -- { -- return; -+ public ArrayList getBlockDropped(World world, -+ int i, int j, int k, int md) { ++ @Override ++ public ArrayList getBlockDropped(World world, int i, int j, int k, int md, int fortune) { + ArrayList tr = new ArrayList(); -+ if (md == 7) tr.add(new ItemStack(Item.wheat)); -+ -+ for(int n = 0; n < 3; n++) { -+ if (world.rand.nextInt(15) <= md) -+ tr.add(new ItemStack(Item.seeds)); ++ if (md == 7) + { +- return; ++ tr.add(new ItemStack(Item.wheat)); } - int j1 = 3 + i1; - for(int k1 = 0; k1 < j1; k1++) -- { ++ ++ for(int n = 0; n < 3; n++) + { - if(world.rand.nextInt(15) <= l) -- { ++ if (world.rand.nextInt(15) <= md) + { - float f1 = 0.7F; - float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F; - float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F; @@ -39,8 +39,9 @@ - EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.seeds)); - entityitem.delayBeforeCanPickup = 10; - world.entityJoinedWorld(entityitem); -- } -- } ++ tr.add(new ItemStack(Item.seeds)); + } + } - + return tr; } diff --git a/forge/patches/minecraft/net/minecraft/src/BlockTallGrass.java.patch b/forge/patches/minecraft/net/minecraft/src/BlockTallGrass.java.patch index 4a8a12f6a..e660dd0df 100644 --- a/forge/patches/minecraft/net/minecraft/src/BlockTallGrass.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/BlockTallGrass.java.patch @@ -11,7 +11,7 @@ // Referenced classes of package net.minecraft.src: // BlockFlower, ColorizerGrass, ColorizerFoliage, IBlockAccess, -@@ -73,13 +76,17 @@ +@@ -73,13 +76,24 @@ public int idDropped(int i, Random random, int j) { @@ -25,13 +25,20 @@ + return -1; + } + -+ public ArrayList getBlockDropped(World world, -+ int i, int j, int k, int md) { -+ ArrayList tr=new ArrayList(); -+ if(world.rand.nextInt(8)!=0) ++ @Override ++ public ArrayList getBlockDropped(World world, int i, int j, int k, int md, int fortune) ++ { ++ ArrayList tr = new ArrayList(); ++ if(world.rand.nextInt(8) != 0) ++ { + return tr; -+ ItemStack ist=ForgeHooks.getGrassSeed(world); -+ if(ist!=null) tr.add(ist); ++ } ++ ++ ItemStack ist = ForgeHooks.getGrassSeed(world); ++ if (ist != null) ++ { ++ tr.add(ist); ++ } + return tr; } diff --git a/forge/patches/minecraft_server/net/minecraft/src/BlockCrops.java.patch b/forge/patches/minecraft_server/net/minecraft/src/BlockCrops.java.patch index 64ee6042a..91ca055c2 100644 --- a/forge/patches/minecraft_server/net/minecraft/src/BlockCrops.java.patch +++ b/forge/patches/minecraft_server/net/minecraft/src/BlockCrops.java.patch @@ -8,30 +8,32 @@ // Referenced classes of package net.minecraft.src: // BlockFlower, Block, World, EntityItem, -@@ -108,28 +109,16 @@ +@@ -108,28 +109,23 @@ return 6; } - public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1) -- { ++ @Override ++ public ArrayList getBlockDropped(World world, int i, int j, int k, int md, int fortune) + { - super.dropBlockAsItemWithChance(world, i, j, k, l, f, 0); - if(world.singleplayerWorld) -- { -- return; -+ public ArrayList getBlockDropped(World world, -+ int i, int j, int k, int md) { + ArrayList tr = new ArrayList(); -+ if (md == 7) tr.add(new ItemStack(Item.wheat)); ++ if (md == 7) ++ { ++ tr.add(new ItemStack(Item.wheat)); ++ } + -+ for(int n = 0; n < 3; n++) { -+ if (world.rand.nextInt(15) <= md) -+ tr.add(new ItemStack(Item.seeds)); - } ++ for(int n = 0; n < 3; n++) + { +- return; +- } - int j1 = 3 + i1; - for(int k1 = 0; k1 < j1; k1++) - { - if(world.rand.nextInt(15) <= l) -- { ++ if (world.rand.nextInt(15) <= md) + { - float f1 = 0.7F; - float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F; - float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F; @@ -39,8 +41,9 @@ - EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.seeds)); - entityitem.delayBeforeCanPickup = 10; - world.entityJoinedWorld(entityitem); -- } -- } ++ tr.add(new ItemStack(Item.seeds)); + } + } - + return tr; } diff --git a/forge/patches/minecraft_server/net/minecraft/src/BlockTallGrass.java.patch b/forge/patches/minecraft_server/net/minecraft/src/BlockTallGrass.java.patch index 5af36c4fd..362d5df5d 100644 --- a/forge/patches/minecraft_server/net/minecraft/src/BlockTallGrass.java.patch +++ b/forge/patches/minecraft_server/net/minecraft/src/BlockTallGrass.java.patch @@ -11,7 +11,7 @@ // Referenced classes of package net.minecraft.src: // BlockFlower, Item, World, EntityPlayer, -@@ -41,13 +44,17 @@ +@@ -41,13 +44,24 @@ public int idDropped(int i, Random random, int j) { @@ -24,13 +24,20 @@ - } + } + -+ public ArrayList getBlockDropped(World world, -+ int i, int j, int k, int md) { -+ ArrayList tr=new ArrayList(); -+ if(world.rand.nextInt(8)!=0) ++ @Override ++ public ArrayList getBlockDropped(World world, int i, int j, int k, int md, int fortune) ++ { ++ ArrayList tr = new ArrayList(); ++ if (world.rand.nextInt(8) != 0) ++ { + return tr; -+ ItemStack ist=ForgeHooks.getGrassSeed(world); -+ if(ist!=null) tr.add(ist); ++ } ++ ++ ItemStack ist = ForgeHooks.getGrassSeed(world); ++ if (ist != null) ++ { ++ tr.add(ist); ++ } + return tr; }