|
3 | 3 | import com.github.franckyi.ibeeditor.client.ClientContext;
|
4 | 4 | import com.github.franckyi.ibeeditor.client.ClientUtil;
|
5 | 5 | import com.github.franckyi.ibeeditor.client.ModScreenHandler;
|
| 6 | +import com.github.franckyi.ibeeditor.client.context.BlockEditorContext; |
6 | 7 | import com.github.franckyi.ibeeditor.client.context.EntityEditorContext;
|
7 | 8 | import com.github.franckyi.ibeeditor.client.context.ItemEditorContext;
|
8 | 9 | import com.github.franckyi.ibeeditor.common.EditorType;
|
|
16 | 17 | import net.minecraft.network.protocol.game.ServerboundSetCreativeModeSlotPacket;
|
17 | 18 | import net.minecraft.world.Container;
|
18 | 19 | import net.minecraft.world.entity.player.Inventory;
|
19 |
| -import net.minecraft.world.item.CreativeModeTab; |
20 |
| -import net.minecraft.world.item.CreativeModeTabs; |
21 | 20 | import net.minecraft.world.phys.BlockHitResult;
|
22 | 21 | import net.minecraft.world.phys.EntityHitResult;
|
23 | 22 | import net.minecraft.world.phys.HitResult;
|
@@ -50,7 +49,11 @@ public static boolean requestBlockEditor(EditorType editorType) {
|
50 | 49 | if (ClientContext.isModInstalledOnServer()) {
|
51 | 50 | NetworkManager.sendToServer(NetworkManager.BLOCK_EDITOR_REQUEST, new BlockEditorPacket.Request(editorType, blockPos));
|
52 | 51 | } else {
|
53 |
| - ClientUtil.showMessage(ModTexts.Messages.errorServerModRequired(ModTexts.BLOCK)); |
| 52 | + var level = Minecraft.getInstance().level; |
| 53 | + var blockState = level.getBlockState(blockPos); |
| 54 | + var blockEntity = level.getBlockEntity(blockPos); |
| 55 | + var tag = blockEntity == null ? null : blockEntity.saveWithId(); |
| 56 | + ModScreenHandler.openEditor(editorType, new BlockEditorContext(blockState, tag, ModTexts.errorServerModRequired(ModTexts.BLOCK), null)); |
54 | 57 | }
|
55 | 58 | return true;
|
56 | 59 | }
|
|
0 commit comments