Files
CatServer/patches/net/minecraft/block/BlockCocoa.java.patch
2018-07-19 21:40:40 +08:00

28 lines
1.3 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java
@@ -1,6 +1,9 @@
package net.minecraft.block;
import java.util.Random;
+
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyInteger;
@@ -47,9 +50,12 @@
{
int i = ((Integer)state.getValue(AGE)).intValue();
- if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, pos, state, rand.nextInt(5) == 0))
+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, pos, state, rand.nextInt(Math.max(1, (int) (100.0F / worldIn.spigotConfig.cocoaModifier) * 5)) == 0)) //Spigot
{
- worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(i + 1)), 2);
+ // CraftBukkit start
+ IBlockState data = state.withProperty(AGE, Integer.valueOf(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));
}
}