[Bleeding] Added getting and setting drops to all appropriate events. Fixes BUKKIT-397 and fixes BUKKIT-1252

- Allows drops in creative mode by adding items to the getDrops() list
- Contents of containers are not reported
- Contents of storage minecarts are not reported
This commit is contained in:
Celtic Minstrel
2012-03-05 14:21:43 -05:00
committed by EvilSeph
parent 8d62de7055
commit 5ba8928041
20 changed files with 344 additions and 60 deletions

View File

@@ -1,5 +1,6 @@
package net.minecraft.server;
import java.util.ArrayList; // CraftBukkit
import java.util.Random;
public class BlockLongGrass extends BlockFlower {
@@ -26,9 +27,25 @@ public class BlockLongGrass extends BlockFlower {
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
if (!world.isStatic && entityhuman.T() != null && entityhuman.T().id == Item.SHEARS.id) {
entityhuman.a(StatisticList.C[this.id], 1);
/* CraftBukkit start - moved this line into calculateDrops
this.a(world, i, j, k, new ItemStack(Block.LONG_GRASS, 1, l));
*/
this.doActualDrop(world, entityhuman, i, j, k, l);
// CraftBukkit end
} else {
super.a(world, entityhuman, i, j, k, l);
}
}
// CraftBukkit start - Calculate drops
public ArrayList<ItemStack> calculateDrops(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
if (!world.isStatic && entityhuman.T() != null && entityhuman.T().id == Item.SHEARS.id) {
super.dropList = new ArrayList<ItemStack>();
this.a(world, i, j, k, new ItemStack(Block.LONG_GRASS, 1, l));
return super.dropList;
} else {
return super.calculateDrops(world, entityhuman, i, j, k, l);
}
}
// CraftBukkit end
}