mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-27 23:45:44 +00:00
Added events for crop growth (#3320)
This commit is contained in:
1 parent
42e0fbbb02
commit
998a78c3c1
9 files changed
+191
-14
No files matched your search
@@ -1163,4 +1163,16 @@ public class ForgeHooks
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new ThrowableImpactEvent(throwable, ray));
|
||||
}
|
||||
|
||||
public static boolean onCropsGrowPre(World worldIn, BlockPos pos, IBlockState state, boolean def)
|
||||
{
|
||||
BlockEvent ev = new BlockEvent.CropGrowEvent.Pre(worldIn,pos,state);
|
||||
MinecraftForge.EVENT_BUS.post(ev);
|
||||
return (ev.getResult() == Event.Result.ALLOW || (ev.getResult() == Event.Result.DEFAULT && def));
|
||||
}
|
||||
|
||||
public static void onCropsGrowPost(World worldIn, BlockPos pos, IBlockState state, IBlockState blockState)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new BlockEvent.CropGrowEvent.Post(worldIn, pos, state, worldIn.getBlockState(pos)));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user