Fixed seeds/wheat not dropping from Crops/TallGrass.

All future Forge code should use proper annotations when Overriding.
This commit is contained in:
LexManos 2011-12-11 21:55:35 +00:00
parent 5c60c2246c
commit 46a9ba178f
4 changed files with 60 additions and 42 deletions

View file

@ -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<ItemStack> getBlockDropped(World world,
+ int i, int j, int k, int md) {
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int md, int fortune) {
+ ArrayList<ItemStack> tr = new ArrayList<ItemStack>();
+ 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;
}

View file

@ -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<ItemStack> getBlockDropped(World world,
+ int i, int j, int k, int md) {
+ ArrayList<ItemStack> tr=new ArrayList<ItemStack>();
+ if(world.rand.nextInt(8)!=0)
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int md, int fortune)
+ {
+ ArrayList<ItemStack> tr = new ArrayList<ItemStack>();
+ 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;
}

View file

@ -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<ItemStack> 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<ItemStack> getBlockDropped(World world,
+ int i, int j, int k, int md) {
+ ArrayList<ItemStack> tr = new ArrayList<ItemStack>();
+ 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;
}

View file

@ -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<ItemStack> getBlockDropped(World world,
+ int i, int j, int k, int md) {
+ ArrayList<ItemStack> tr=new ArrayList<ItemStack>();
+ if(world.rand.nextInt(8)!=0)
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int md, int fortune)
+ {
+ ArrayList<ItemStack> tr = new ArrayList<ItemStack>();
+ 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;
}