|
1 | 1 | package github.kasuminova.mmce.common.block.appeng; |
2 | 2 |
|
3 | 3 | import appeng.api.implementations.items.IMemoryCard; |
| 4 | +import appeng.api.util.AEPartLocation; |
| 5 | +import appeng.core.sync.GuiBridge; |
| 6 | +import appeng.items.tools.quartz.ToolQuartzCuttingKnife; |
| 7 | +import appeng.util.Platform; |
4 | 8 | import github.kasuminova.mmce.common.tile.MEPatternProvider; |
5 | 9 | import hellfirepvp.modularmachinery.ModularMachinery; |
6 | 10 | import hellfirepvp.modularmachinery.common.CommonProxy; |
|
16 | 20 | import net.minecraft.util.math.BlockPos; |
17 | 21 | import net.minecraft.util.text.TextComponentTranslation; |
18 | 22 | import net.minecraft.world.World; |
| 23 | +import net.minecraftforge.event.ForgeEventFactory; |
19 | 24 |
|
20 | 25 | import javax.annotation.Nonnull; |
21 | 26 | import javax.annotation.Nullable; |
@@ -44,6 +49,20 @@ public boolean onBlockActivated( |
44 | 49 | return true; |
45 | 50 | } |
46 | 51 | } |
| 52 | + |
| 53 | + if (heldItem.getItem() instanceof ToolQuartzCuttingKnife) { |
| 54 | + if (ForgeEventFactory.onItemUseStart(player, heldItem, 1) <= 0) { |
| 55 | + return false; |
| 56 | + } |
| 57 | + |
| 58 | + TileEntity te = worldIn.getTileEntity(pos); |
| 59 | + |
| 60 | + if (te instanceof MEPatternProvider) { |
| 61 | + Platform.openGUI(player, te, AEPartLocation.fromFacing(facing), GuiBridge.GUI_RENAMER); |
| 62 | + return true; |
| 63 | + } |
| 64 | + return false; |
| 65 | + } |
47 | 66 | } |
48 | 67 | TileEntity te = worldIn.getTileEntity(pos); |
49 | 68 | if (te instanceof MEPatternProvider) { |
|
0 commit comments