parent
16a5f7413f
commit
bf99715ee2
@ -291,7 +291,9 @@ public abstract class ServerPlayerGameModeMixin implements PlayerInteractionMana
|
||||
public InteractionResult useItemOn(ServerPlayer playerIn, Level worldIn, ItemStack stackIn, InteractionHand handIn, BlockHitResult blockRaytraceResultIn) {
|
||||
BlockPos blockpos = blockRaytraceResultIn.getBlockPos();
|
||||
BlockState blockstate = worldIn.getBlockState(blockpos);
|
||||
InteractionResult resultType = InteractionResult.PASS;
|
||||
// InteractionResult resultType = InteractionResult.PASS;
|
||||
{ // compatible with questadditions
|
||||
// these variables are not available inside next if block
|
||||
boolean cancelledBlock = false;
|
||||
if (this.gameModeForPlayer == GameType.SPECTATOR) {
|
||||
MenuProvider provider = blockstate.getMenuProvider(worldIn, blockpos);
|
||||
@ -317,8 +319,10 @@ public abstract class ServerPlayerGameModeMixin implements PlayerInteractionMana
|
||||
playerIn.connection.send(new ClientboundBlockUpdatePacket(level, blockpos.above()));
|
||||
}
|
||||
((ServerPlayerEntityBridge) playerIn).bridge$getBukkitEntity().updateInventory();
|
||||
resultType = ((bukkitEvent.useItemInHand() != Event.Result.ALLOW) ? InteractionResult.SUCCESS : InteractionResult.PASS);
|
||||
} else if (this.gameModeForPlayer == GameType.SPECTATOR) {
|
||||
return ((bukkitEvent.useItemInHand() != Event.Result.ALLOW) ? InteractionResult.SUCCESS : InteractionResult.PASS);
|
||||
}
|
||||
}
|
||||
if (this.gameModeForPlayer == GameType.SPECTATOR) {
|
||||
MenuProvider inamedcontainerprovider = blockstate.getMenuProvider(worldIn, blockpos);
|
||||
if (inamedcontainerprovider != null) {
|
||||
playerIn.openMenu(inamedcontainerprovider);
|
||||
@ -337,6 +341,7 @@ public abstract class ServerPlayerGameModeMixin implements PlayerInteractionMana
|
||||
boolean flag = !playerIn.getMainHandItem().isEmpty() || !playerIn.getOffhandItem().isEmpty();
|
||||
boolean flag1 = (playerIn.isSecondaryUseActive() && flag) && !(playerIn.getMainHandItem().doesSneakBypassUse(worldIn, blockpos, playerIn) && playerIn.getOffhandItem().doesSneakBypassUse(worldIn, blockpos, playerIn));
|
||||
ItemStack itemstack = stackIn.copy();
|
||||
InteractionResult resultType = InteractionResult.PASS;
|
||||
if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1)) {
|
||||
resultType = blockstate.use(worldIn, playerIn, handIn, blockRaytraceResultIn);
|
||||
if (resultType.consumesAction()) {
|
||||
@ -364,6 +369,5 @@ public abstract class ServerPlayerGameModeMixin implements PlayerInteractionMana
|
||||
return resultType;
|
||||
}
|
||||
}
|
||||
return resultType;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user