|
44 | 44 | import net.minecraft.world.entity.LivingEntity; |
45 | 45 | import net.minecraft.world.entity.MobSpawnType; |
46 | 46 | import net.minecraft.world.entity.player.Player; |
| 47 | +import net.minecraft.world.item.BlockItem; |
47 | 48 | import net.minecraft.world.item.ItemStack; |
48 | 49 | import net.minecraft.world.level.BaseSpawner; |
49 | 50 | import net.minecraft.world.level.Explosion; |
@@ -280,9 +281,17 @@ public EventResult blockLeftClick(Player player, InteractionHand hand, BlockPos |
280 | 281 | public EventResult blockRightClick(Player player, InteractionHand hand, BlockPos pos, Direction face) { |
281 | 282 | // calling architectury stub method |
282 | 283 | //noinspection ConstantConditions |
283 | | - if (player instanceof ServerPlayer sp && ClaimedChunkManagerImpl.getInstance().shouldPreventInteraction(player, hand, pos, FTBChunksExpected.getBlockInteractProtection(), null)) { |
284 | | - FTBCUtils.forceHeldItemSync(sp, hand); |
285 | | - return EventResult.interruptFalse(); |
| 284 | + if (player instanceof ServerPlayer sp) { |
| 285 | + boolean blockItem = sp.getItemInHand(hand).getItem() instanceof BlockItem; |
| 286 | + ClaimedChunkManagerImpl mgr = ClaimedChunkManagerImpl.getInstance(); |
| 287 | + // not ideal since it also prevents right-clicking *any* blocks if holding a block item when block placement is prevented |
| 288 | + // but necessary - https://github.com/FTBTeam/FTB-Mods-Issues/issues/1752 |
| 289 | + if (mgr.shouldPreventInteraction(player, hand, pos, FTBChunksExpected.getBlockInteractProtection(), null) |
| 290 | + || blockItem && mgr.shouldPreventInteraction(player, hand, pos, FTBChunksExpected.getBlockPlaceProtection(), null)) |
| 291 | + { |
| 292 | + FTBCUtils.forceHeldItemSync(sp, hand); |
| 293 | + return EventResult.interruptFalse(); |
| 294 | + } |
286 | 295 | } |
287 | 296 |
|
288 | 297 | return EventResult.pass(); |
@@ -418,7 +427,7 @@ private void playerChangedDimension(ServerPlayer serverPlayer, ResourceKey<Level |
418 | 427 | } |
419 | 428 |
|
420 | 429 | @SuppressWarnings("UnreachableCode") |
421 | | - private void teamConfig(TeamCollectPropertiesEvent event) { |
| 430 | + private void teamConfig(TeamCollectPropertiesEvent event) { |
422 | 431 | event.add(FTBChunksProperties.ALLOW_EXPLOSIONS); |
423 | 432 | event.add(FTBChunksProperties.ALLOW_MOB_GRIEFING); |
424 | 433 | event.add(FTBChunksProperties.ALLOW_ALL_FAKE_PLAYERS); |
@@ -478,7 +487,7 @@ private void playerLeftParty(PlayerLeftPartyTeamEvent event) { |
478 | 487 | } |
479 | 488 |
|
480 | 489 | @SuppressWarnings("UnreachableCode") |
481 | | - private void transferClaims(ChunkTeamDataImpl transferFrom, ChunkTeamDataImpl transferTo, Collection<ClaimedChunkImpl> chunksToTransfer) { |
| 490 | + private void transferClaims(ChunkTeamDataImpl transferFrom, ChunkTeamDataImpl transferTo, Collection<ClaimedChunkImpl> chunksToTransfer) { |
482 | 491 | CommandSourceStack sourceStack = ClaimedChunkManagerImpl.getInstance().getMinecraftServer().createCommandSourceStack(); |
483 | 492 |
|
484 | 493 | String fromName = transferFrom.getTeam().getShortName(); |
|
0 commit comments