ForgePatch/forge/patches/minecraft_server/net/minecraft/src/BlockTallGrass.java.patch

78 lines
2.4 KiB
Diff
Raw Normal View History

--- ../src_base/minecraft_server/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,8 +1,12 @@
package net.minecraft.src;
+import java.util.ArrayList;
2012-01-15 19:16:08 +00:00
import java.util.Random;
-public class BlockTallGrass extends BlockFlower
2012-01-15 19:16:08 +00:00
+import net.minecraft.src.forge.ForgeHooks;
+import net.minecraft.src.forge.IShearable;
2012-01-15 19:16:08 +00:00
+
+public class BlockTallGrass extends BlockFlower implements IShearable
2012-01-15 19:16:08 +00:00
{
protected BlockTallGrass(int i, int j)
{
@@ -33,15 +37,25 @@
public int idDropped(int i, Random random, int j)
{
2012-01-15 19:16:08 +00:00
- if (random.nextInt(8) == 0)
+ return -1;
+ }
+
+ @Override
2012-01-15 19:16:08 +00:00
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int md, int fortune)
+ {
2012-01-15 19:16:08 +00:00
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ if (world.rand.nextInt(8) != 0)
{
- return Item.seeds.shiftedIndex;
+ return ret;
}
- else
+
+ ItemStack item = ForgeHooks.getGrassSeed(world);
+ if (item != null)
{
- return -1;
+ ret.add(item);
}
- }
+ return ret;
+ }
2012-01-11 18:13:35 +00:00
public int quantityDroppedWithBonus(int i, Random random)
2012-01-15 19:16:08 +00:00
{
@@ -50,14 +64,20 @@
public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l)
{
- if (!world.isRemote && entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)
- {
- entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1);
- dropBlockAsItem_do(world, i, j, k, new ItemStack(Block.tallGrass, 1, l));
- }
- else
- {
- super.harvestBlock(world, entityplayer, i, j, k, l);
- }
+ super.harvestBlock(world, entityplayer, i, j, k, l);
+ }
+
+ @Override
+ public boolean isShearable(ItemStack item, World world, int X, int Y, int Z)
+ {
+ return true;
+ }
+
+ @Override
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int X, int Y, int Z, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ ret.add(new ItemStack(Block.tallGrass, 1, world.getBlockMetadata(X, Y, Z)));
+ return ret;
}
}