Use the new methods in EventBus (backport of #10028 to 1.20.6) (#10091)

Adds `fire()` and Result#isAllowed/isDenied/isDefault from EventBus
This commit is contained in:
Paint_Ninja authored and GitHub committed 2024-09-12 14:34:23 +01:00
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) {