Upstream: Fix RightClickBlock ALLOW not being implemented
This commit is contained in:
parent
3d9a57aa59
commit
2185b6f1bc
@ -265,7 +265,7 @@ public abstract class PlayerInteractionManagerMixin implements PlayerInteraction
|
|||||||
return ActionResultType.PASS;
|
return ActionResultType.PASS;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = ForgeHooks.onRightClickBlock(playerIn, handIn, blockpos, blockRaytraceResultIn.getFace());
|
net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = ForgeHooks.onRightClickBlock(playerIn, handIn, blockpos, blockRaytraceResultIn);
|
||||||
if (event.isCanceled()) return event.getCancellationResult();
|
if (event.isCanceled()) return event.getCancellationResult();
|
||||||
ItemUseContext itemusecontext = new ItemUseContext(playerIn, handIn, blockRaytraceResultIn);
|
ItemUseContext itemusecontext = new ItemUseContext(playerIn, handIn, blockRaytraceResultIn);
|
||||||
if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) {
|
if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) {
|
||||||
@ -275,14 +275,14 @@ public abstract class PlayerInteractionManagerMixin implements PlayerInteraction
|
|||||||
boolean flag = !playerIn.getHeldItemMainhand().isEmpty() || !playerIn.getHeldItemOffhand().isEmpty();
|
boolean flag = !playerIn.getHeldItemMainhand().isEmpty() || !playerIn.getHeldItemOffhand().isEmpty();
|
||||||
boolean flag1 = (playerIn.isSecondaryUseActive() && flag) && !(playerIn.getHeldItemMainhand().doesSneakBypassUse(worldIn, blockpos, playerIn) && playerIn.getHeldItemOffhand().doesSneakBypassUse(worldIn, blockpos, playerIn));
|
boolean flag1 = (playerIn.isSecondaryUseActive() && flag) && !(playerIn.getHeldItemMainhand().doesSneakBypassUse(worldIn, blockpos, playerIn) && playerIn.getHeldItemOffhand().doesSneakBypassUse(worldIn, blockpos, playerIn));
|
||||||
ItemStack itemstack = stackIn.copy();
|
ItemStack itemstack = stackIn.copy();
|
||||||
if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1) {
|
if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1)) {
|
||||||
resultType = blockstate.onBlockActivated(worldIn, playerIn, handIn, blockRaytraceResultIn);
|
resultType = blockstate.onBlockActivated(worldIn, playerIn, handIn, blockRaytraceResultIn);
|
||||||
if (resultType.isSuccessOrConsume()) {
|
if (resultType.isSuccessOrConsume()) {
|
||||||
CriteriaTriggers.RIGHT_CLICK_BLOCK_WITH_ITEM.test(playerIn, blockpos, itemstack);
|
CriteriaTriggers.RIGHT_CLICK_BLOCK_WITH_ITEM.test(playerIn, blockpos, itemstack);
|
||||||
return resultType;
|
return resultType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!stackIn.isEmpty() && resultType != ActionResultType.SUCCESS && !bridge$getInteractResult()) {
|
if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (!stackIn.isEmpty() && resultType != ActionResultType.SUCCESS && !bridge$getInteractResult())) {
|
||||||
if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) {
|
if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) {
|
||||||
return ActionResultType.PASS;
|
return ActionResultType.PASS;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user