Avoid early return in CraftingScreenHandlerMixin
This commit is contained in:
parent
acfe5eade7
commit
382ea7ea11
1 changed files with 4 additions and 3 deletions
|
@ -21,9 +21,10 @@ public abstract class CraftingScreenHandlerMixin
|
||||||
|
|
||||||
@Inject(method = "canUse", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "canUse", at = @At("HEAD"), cancellable = true)
|
||||||
private void canUse(PlayerEntity player, CallbackInfoReturnable<Boolean> info) {
|
private void canUse(PlayerEntity player, CallbackInfoReturnable<Boolean> info) {
|
||||||
info.setReturnValue(context.run((world, pos) -> {
|
if (context.run((world, pos) -> {
|
||||||
return world.getBlockState(pos).getBlock() instanceof CraftingTableBlock;
|
return world.getBlockState(pos).getBlock() instanceof CraftingTableBlock;
|
||||||
}, true));
|
}, true)) {
|
||||||
info.cancel();
|
info.setReturnValue(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue