Files
CatServer/patches/net/minecraft/block/BlockStem.java.patch
2018-07-20 01:14:44 +08:00

39 lines
1.9 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockStem.java
+++ ../src-work/minecraft/net/minecraft/block/BlockStem.java
@@ -2,6 +2,9 @@
import java.util.Random;
import javax.annotation.Nullable;
+
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
@@ -70,14 +73,14 @@
{
float f = BlockCrops.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 / (this == Blocks.PUMPKIN_STEM ? worldIn.spigotConfig.pumpkinModifier : worldIn.spigotConfig.melonModifier)) * (25.0F / f)) + 1) == 0)) //Spigot
{
int i = ((Integer)state.getValue(AGE)).intValue();
if (i < 7)
{
state = state.withProperty(AGE, Integer.valueOf(i + 1));
- worldIn.setBlockState(pos, state, 2);
+ CraftEventFactory.handleBlockGrowEvent(worldIn, pos.getX(), pos.getY(), pos.getZ(), this, getMetaFromState(state)); // CraftBukkit
}
else
{
@@ -95,7 +98,7 @@
if (worldIn.isAirBlock(pos) && (block.canSustainPlant(soil, worldIn, pos.down(), EnumFacing.UP, this) || block == Blocks.DIRT || block == Blocks.GRASS))
{
- worldIn.setBlockState(pos, this.crop.getDefaultState());
+ CraftEventFactory.handleBlockGrowEvent(worldIn, pos.getX(), pos.getY(), pos.getZ(), this.crop, 0); // CraftBukkit
}
}
net.minecraftforge.common.ForgeHooks.onCropsGrowPost(worldIn, pos, state, worldIn.getBlockState(pos));