74 lines
3.4 KiB
Diff
74 lines
3.4 KiB
Diff
--- ../src-base/minecraft/net/minecraft/block/BlockCrops.java
|
|
+++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java
|
|
@@ -78,9 +78,10 @@
|
|
{
|
|
float f = func_180672_a(this, p_180650_1_, p_180650_2_);
|
|
|
|
- if (p_180650_4_.nextInt((int)(25.0F / f) + 1) == 0)
|
|
+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_4_.nextInt((int)(25.0F / f) + 1) == 0))
|
|
{
|
|
p_180650_1_.func_180501_a(p_180650_2_, this.func_185528_e(i + 1), 2);
|
|
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_1_.func_180495_p(p_180650_2_));
|
|
}
|
|
}
|
|
}
|
|
@@ -116,11 +117,11 @@
|
|
float f1 = 0.0F;
|
|
IBlockState iblockstate = p_180672_1_.func_180495_p(blockpos.func_177982_a(i, 0, j));
|
|
|
|
- if (iblockstate.func_177230_c() == Blocks.field_150458_ak)
|
|
+ if (iblockstate.func_177230_c().canSustainPlant(iblockstate, p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)p_180672_0_))
|
|
{
|
|
f1 = 1.0F;
|
|
|
|
- if (((Integer)iblockstate.func_177229_b(BlockFarmland.field_176531_a)).intValue() > 0)
|
|
+ if (iblockstate.func_177230_c().isFertile(p_180672_1_, blockpos.func_177982_a(i, 0, j)))
|
|
{
|
|
f1 = 3.0F;
|
|
}
|
|
@@ -161,7 +162,8 @@
|
|
|
|
public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_)
|
|
{
|
|
- return (p_180671_1_.func_175699_k(p_180671_2_) >= 8 || p_180671_1_.func_175678_i(p_180671_2_)) && this.func_185514_i(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()));
|
|
+ IBlockState soil = p_180671_1_.func_180495_p(p_180671_2_.func_177977_b());
|
|
+ return (p_180671_1_.func_175699_k(p_180671_2_) >= 8 || p_180671_1_.func_175678_i(p_180671_2_)) && soil.func_177230_c().canSustainPlant(soil, p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this);
|
|
}
|
|
|
|
protected Item func_149866_i()
|
|
@@ -174,11 +176,33 @@
|
|
return Items.field_151015_O;
|
|
}
|
|
|
|
+ @Override
|
|
+ public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
|
+ {
|
|
+ java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune);
|
|
+ int age = func_185527_x(state);
|
|
+ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random();
|
|
+
|
|
+ if (age >= func_185526_g())
|
|
+ {
|
|
+ int k = 3 + fortune;
|
|
+
|
|
+ for (int i = 0; i < 3 + fortune; ++i)
|
|
+ {
|
|
+ if (rand.nextInt(2 * func_185526_g()) <= age)
|
|
+ {
|
|
+ ret.add(new ItemStack(this.func_149866_i(), 1, 0));
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
|
|
{
|
|
super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, 0);
|
|
|
|
- if (!p_180653_1_.field_72995_K)
|
|
+ if (false && !p_180653_1_.field_72995_K) // Forge: NOP all this.
|
|
{
|
|
int i = this.func_185527_x(p_180653_3_);
|
|
|