How to add structures screen

This commit is contained in:
ForestOfLight
2025-04-13 01:50:15 -07:00
Unverified
parent 79b22e5fd7
commit 77994b26dd
5 changed files with 22 additions and 5 deletions
+5
View File
@@ -2,6 +2,7 @@ import { forceShow } from '../utils';
import { structureCollection } from './StructureCollection';
import { MenuFormBuilder } from './MenuFormBuilder';
import { InstanceEditForm } from './InstanceEditForm';
import { world } from '@minecraft/server';
export class MenuForm {
constructor(player, { jumpToInstance = true } = {}) {
@@ -36,6 +37,10 @@ export class MenuForm {
try {
return forceShow(this.player, MenuFormBuilder.buildAllInstanceName()).then((response) => {
if (response.canceled) return;
if (response.selection === structureCollection.getInstanceNames().length + 1) {
MenuFormBuilder.buildHowToAddNewStructures().show(this.player);
return;
}
const selectedInstanceName = structureCollection.getInstanceNames()[response.selection];
return selectedInstanceName || this.createNewInstance();
});