Files
CatServer/patches/net/minecraft/block/BlockCrops.java.patch

28 lines
1.3 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockCrops.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java
@@ -2,6 +2,9 @@
import java.util.Random;
import javax.annotation.Nullable;
+
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockStateContainer;
@@ -79,9 +82,12 @@
{
float f = getGrowthChance(this, worldIn, pos);
- if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, pos, state, rand.nextInt((int)(25.0F / f) + 1) == 0))
+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, pos, state, rand.nextInt((int)((100.0F / worldIn.spigotConfig.wheatModifier) * (25.0F / f)) + 1) == 0)) //Spigot
{
- worldIn.setBlockState(pos, this.withAge(i + 1), 2);
+ // CraftBukkit start
+ IBlockState data = this.withAge(i + 1);
+ CraftEventFactory.handleBlockGrowEvent(worldIn, pos.getX(), pos.getY(), pos.getZ(), this, getMetaFromState(data));
+ // CraftBukkit end
net.minecraftforge.common.ForgeHooks.onCropsGrowPost(worldIn, pos, state, worldIn.getBlockState(pos));
}
}