pack structures now get picked up automatically

This commit is contained in:
ForestOfLight
2026-05-07 16:22:44 -07:00
Unverified
parent c5eb454f20
commit 0401e4b591
2 changed files with 17 additions and 5 deletions
@@ -81,9 +81,21 @@ class StructureCollection {
} }
getWorldStructureIds() { getWorldStructureIds() {
return world.structureManager.getWorldStructureIds() const structureManager = world.structureManager;
const packIds = [...new Set(structureManager.getPackStructureIds()
.map(id => id.replace('mystructure:', '')))
];
const packIdSet = new Set(packIds);
let worldStructureIds = [];
try {
worldStructureIds = structureManager.getWorldStructureIds()
.filter(id => id.startsWith('mystructure:')) .filter(id => id.startsWith('mystructure:'))
.map(id => id.replace('mystructure:', '')); .map(id => id.replace('mystructure:', ''))
.filter(id => !packIdSet.has(id));
} catch (error) {
console.warn('Failed to fetch world structure IDs. They will be ignored. Error:', error);
}
return [...packIds, ...worldStructureIds];
} }
rename(instanceName, newName) { rename(instanceName, newName) {
+2 -2
View File
@@ -78,9 +78,9 @@ construct.mainmenu.selectstructure.other=Other
construct.mainmenu.selectstructure.other.prompt=Enter the Structure ID: construct.mainmenu.selectstructure.other.prompt=Enter the Structure ID:
construct.mainmenu.selectstructure.other.placeholder=example_structure ## The placeholder text in the textbox where the user enters the structure name. construct.mainmenu.selectstructure.other.placeholder=example_structure ## The placeholder text in the textbox where the user enters the structure name.
construct.mainmenu.howto.add.header=§aHow to Add Structures: construct.mainmenu.howto.add.header=§aHow to Add Structures:
construct.mainmenu.howto.add.structureblock=§7- Save a structure using a §fstructure block§7 or the §f/structure§7 command. construct.mainmenu.howto.add.structureblock=§7Save a structure using a §fstructure block§7 or the §f/structure§7 command. This structure will only be available in the world you saved it in.
construct.mainmenu.howto.add.or=§7§lOR§r construct.mainmenu.howto.add.or=§7§lOR§r
construct.mainmenu.howto.add.mcstructure=§7- Add a §f.mcstructure§7 file to this pack's §fstructures folder§7. When selecting your structure, select the §fOther§7 option and then use the filename (without '.mcstructure') as the §fStructure ID§7. After its first use, it will be added to the list of structures. construct.mainmenu.howto.add.mcstructure=§7To transfer structures §fbetween worlds§7: \n 1. Move Construct's behavior pack to your §fcom.mojang > development_behavior_packs§7. \n 2. Add a §f.mcstructure§7 file to the Construct behavior pack's §fstructures§7 folder. \n 3. Restart your world. \nYour structure should now be in the structures list. If it is not, select the §fOther§7 option and then use the filename (without '.mcstructure') as the §fStructure ID§7. After its first use, it will be added to the list of structures.
construct.mainmenu.howto.remove.header=§cHow to Remove Structures: construct.mainmenu.howto.remove.header=§cHow to Remove Structures:
construct.mainmenu.howto.remove.body=§7- Use the §f/structure delete§7 command to remove a structure from the world. construct.mainmenu.howto.remove.body=§7- Use the §f/structure delete§7 command to remove a structure from the world.