material grabber shows instance selection if the selected instance is missing
This commit is contained in:
@@ -40,6 +40,10 @@ class StructureCollection {
|
||||
return structure;
|
||||
}
|
||||
|
||||
has(instanceName) {
|
||||
return Boolean(this.structures[instanceName]);
|
||||
}
|
||||
|
||||
delete(instanceName) {
|
||||
const struct = this.get(instanceName);
|
||||
struct.delete();
|
||||
|
||||
@@ -55,12 +55,11 @@ function onPlayerInteract(event) {
|
||||
const player = event.player;
|
||||
const target = event.block || event.target;
|
||||
const focusedInstanceName = Builders.get(player.id).materialInstanceName;
|
||||
if (!focusedInstanceName) {
|
||||
if (!focusedInstanceName || !structureCollection.has(focusedInstanceName))
|
||||
openInstanceSelectionForm(player, event);
|
||||
} else {
|
||||
else
|
||||
tryGrabMaterials(player, target, focusedInstanceName, event);
|
||||
}
|
||||
}
|
||||
|
||||
function isActionItem(itemStack) {
|
||||
return itemStack?.typeId === 'construct:material_grabber';
|
||||
|
||||
Reference in New Issue
Block a user