|
4 | 4 | import gregtech.api.items.IDyeableItem; |
5 | 5 | import gregtech.api.items.gui.ItemUIFactory; |
6 | 6 | import gregtech.api.items.toolitem.behavior.IToolBehavior; |
| 7 | +import gregtech.api.metatileentity.MetaTileEntityHolder; |
7 | 8 | import gregtech.api.mui.GTGuiTextures; |
8 | 9 | import gregtech.api.mui.GTGuis; |
9 | 10 | import gregtech.api.unification.material.Material; |
|
12 | 13 | import gregtech.api.unification.material.properties.ToolProperty; |
13 | 14 | import gregtech.api.util.LocalizationUtils; |
14 | 15 | import gregtech.common.items.behaviors.ColorSprayBehaviour; |
| 16 | +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMaintenanceHatch; |
15 | 17 | import gregtech.core.network.packets.PacketToolbeltSelectionChange; |
16 | 18 |
|
17 | 19 | import net.minecraft.block.state.IBlockState; |
@@ -393,9 +395,15 @@ public void setSelectedTool(@Nullable Integer slot, ItemStack stack) { |
393 | 395 | @NotNull BlockPos pos, @NotNull EnumFacing side, float hitX, |
394 | 396 | float hitY, float hitZ, @NotNull EnumHand hand) { |
395 | 397 | EnumActionResult result = IDyeableItem.super.onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand); |
396 | | - if (result == EnumActionResult.PASS) |
| 398 | + if (result == EnumActionResult.PASS) { |
| 399 | + ToolStackHandler handler = getHandler(player.getHeldItem(hand)); |
| 400 | + if (handler.getSelectedSlot() == null && world.getTileEntity(pos) instanceof MetaTileEntityHolder holder && |
| 401 | + holder.getMetaTileEntity() instanceof MetaTileEntityMaintenanceHatch maintenance) { |
| 402 | + maintenance.fixMaintenanceProblems(player); |
| 403 | + return EnumActionResult.SUCCESS; |
| 404 | + } |
397 | 405 | return super.onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand); |
398 | | - else return result; |
| 406 | + } else return result; |
399 | 407 | } |
400 | 408 |
|
401 | 409 | @Override |
|
0 commit comments