Fix flower pots not droping the items that are inside them.

This commit is contained in:
Lex Manos 2014-06-23 22:06:52 -07:00
parent 256d865db6
commit 7ba54ffd48
3 changed files with 38 additions and 9 deletions

View file

@ -199,7 +199,7 @@
} }
protected ItemStack func_149644_j(int p_149644_1_) protected ItemStack func_149644_j(int p_149644_1_)
@@ -1114,6 +1153,1091 @@ @@ -1114,6 +1153,1099 @@
return null; return null;
} }
@ -374,8 +374,16 @@
+ * @param x X Position + * @param x X Position
+ * @param y Y position + * @param y Y position
+ * @param z Z position + * @param z Z position
+ * @param willHarvest True if Block.harvestBlock will be called after this, if the return in true.
+ * Can be useful to delay the destruction of tile entities till after harvestBlock
+ * @return True if the block is actually destroyed. + * @return True if the block is actually destroyed.
+ */ + */
+ public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
+ {
+ return removedByPlayer(world, player, x, y, z);
+ }
+
+ @Deprecated
+ public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) + public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z)
+ { + {
+ return world.func_147468_f(x, y, z); + return world.func_147468_f(x, y, z);

View file

@ -22,11 +22,12 @@
super.func_149749_a(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); super.func_149749_a(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
} }
@@ -231,4 +225,14 @@ @@ -231,4 +225,28 @@
return new TileEntityFlowerPot(Item.func_150898_a((Block)object), b0); return new TileEntityFlowerPot(Item.func_150898_a((Block)object), b0);
} }
+ +
+ /*============================FORGE START=====================================*/
+ @Override + @Override
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) + public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
+ { + {
@ -36,4 +37,17 @@
+ ret.add(new ItemStack(te.func_145965_a(), 1, te.func_145966_b())); + ret.add(new ItemStack(te.func_145965_a(), 1, te.func_145966_b()));
+ return ret; + return ret;
+ } + }
+ @Override
+ public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
+ {
+ if (willHarvest) return true; //If it will harvest, delay deletion of the block until after getDrops
+ return super.removedByPlayer(world, player, x, y, z, willHarvest);
+ }
+ @Override
+ public void func_149636_a(World world, EntityPlayer player, int x, int y, int z, int meta)
+ {
+ super.func_149636_a(world, player, x, y, z, meta);
+ world.func_147468_f(x, y, z);
+ }
+ /*===========================FORGE END==========================================*/
} }

View file

@ -89,16 +89,23 @@
{ {
float f = block.func_149737_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_73082_1_, p_73082_2_, p_73082_3_) * (float)(l + 1); float f = block.func_149737_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_73082_1_, p_73082_2_, p_73082_3_) * (float)(l + 1);
@@ -205,7 +240,7 @@ @@ -202,10 +237,14 @@
private boolean func_73079_d(int p_73079_1_, int p_73079_2_, int p_73079_3_)
{
+ return removeBlock(p_73079_1_, p_73079_2_, p_73079_3_, false);
+ }
+ private boolean removeBlock(int p_73079_1_, int p_73079_2_, int p_73079_3_, boolean canHarvest)
+ {
Block block = this.field_73092_a.func_147439_a(p_73079_1_, p_73079_2_, p_73079_3_); Block block = this.field_73092_a.func_147439_a(p_73079_1_, p_73079_2_, p_73079_3_);
int l = this.field_73092_a.func_72805_g(p_73079_1_, p_73079_2_, p_73079_3_); int l = this.field_73092_a.func_72805_g(p_73079_1_, p_73079_2_, p_73079_3_);
block.func_149681_a(this.field_73092_a, p_73079_1_, p_73079_2_, p_73079_3_, l, this.field_73090_b); block.func_149681_a(this.field_73092_a, p_73079_1_, p_73079_2_, p_73079_3_, l, this.field_73090_b);
- boolean flag = this.field_73092_a.func_147468_f(p_73079_1_, p_73079_2_, p_73079_3_); - boolean flag = this.field_73092_a.func_147468_f(p_73079_1_, p_73079_2_, p_73079_3_);
+ boolean flag = block.removedByPlayer(field_73092_a, field_73090_b, p_73079_1_, p_73079_2_, p_73079_3_); + boolean flag = block.removedByPlayer(field_73092_a, field_73090_b, p_73079_1_, p_73079_2_, p_73079_3_, canHarvest);
if (flag) if (flag)
{ {
@@ -217,29 +252,32 @@ @@ -217,29 +256,32 @@
public boolean func_73084_b(int p_73084_1_, int p_73084_2_, int p_73084_3_) public boolean func_73084_b(int p_73084_1_, int p_73084_2_, int p_73084_3_)
{ {
@ -138,11 +145,11 @@
if (itemstack != null) if (itemstack != null)
{ {
@@ -251,12 +289,18 @@ @@ -251,12 +293,18 @@
} }
} }
+ flag = this.func_73079_d(p_73084_1_, p_73084_2_, p_73084_3_); + flag = this.removeBlock(p_73084_1_, p_73084_2_, p_73084_3_, flag1);
if (flag && flag1) if (flag && flag1)
{ {
block.func_149636_a(this.field_73092_a, this.field_73090_b, p_73084_1_, p_73084_2_, p_73084_3_, l); block.func_149636_a(this.field_73092_a, this.field_73090_b, p_73084_1_, p_73084_2_, p_73084_3_, l);
@ -157,7 +164,7 @@
return flag; return flag;
} }
} }
@@ -288,6 +332,7 @@ @@ -288,6 +336,7 @@
if (itemstack1.field_77994_a == 0) if (itemstack1.field_77994_a == 0)
{ {
p_73085_1_.field_71071_by.field_70462_a[p_73085_1_.field_71071_by.field_70461_c] = null; p_73085_1_.field_71071_by.field_70462_a[p_73085_1_.field_71071_by.field_70461_c] = null;
@ -165,7 +172,7 @@
} }
if (!p_73085_1_.func_71039_bw()) if (!p_73085_1_.func_71039_bw())
@@ -301,31 +346,70 @@ @@ -301,31 +350,70 @@
public boolean func_73078_a(EntityPlayer p_73078_1_, World p_73078_2_, ItemStack p_73078_3_, int p_73078_4_, int p_73078_5_, int p_73078_6_, int p_73078_7_, float p_73078_8_, float p_73078_9_, float p_73078_10_) public boolean func_73078_a(EntityPlayer p_73078_1_, World p_73078_2_, ItemStack p_73078_3_, int p_73078_4_, int p_73078_5_, int p_73078_6_, int p_73078_7_, float p_73078_8_, float p_73078_9_, float p_73078_10_)
{ {