mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
Adds `fire()` and Result#isAllowed/isDenied/isDefault from EventBus
This commit is contained in:
1 parent
8006e4ff48
commit
ac10315810
11 files changed
+19
-21
No files matched your search
@@ -647,9 +647,8 @@ public final class ForgeHooks {
|
||||
}
|
||||
|
||||
public static boolean onCropsGrowPre(Level level, BlockPos pos, BlockState state, boolean def) {
|
||||
BlockEvent ev = new BlockEvent.CropGrowEvent.Pre(level,pos,state);
|
||||
MinecraftForge.EVENT_BUS.post(ev);
|
||||
return (ev.getResult() == Event.Result.ALLOW || (ev.getResult() == Event.Result.DEFAULT && def));
|
||||
var result = MinecraftForge.EVENT_BUS.fire(new BlockEvent.CropGrowEvent.Pre(level,pos,state)).getResult();
|
||||
return (result.isAllowed() || (def && result.isDefault()));
|
||||
}
|
||||
|
||||
public static void onCropsGrowPost(Level level, BlockPos pos, BlockState state) {
|
||||
|
||||
Reference in new issue
Block a user