Form complete but not error handled
This commit is contained in:
@@ -18,7 +18,7 @@ extension.addRule(easyPlace);
|
||||
function onPlayerPlaceBlock(event) {
|
||||
const { player, block } = event;
|
||||
if (!player || !block || !hasActionItemInCorrectSlot(player)) return;
|
||||
const structureBlock = fetchStructureBlock(block.location);
|
||||
const structureBlock = structureCollection.fetchStructureBlock(block.dimension.id, block.location);
|
||||
if (!structureBlock)
|
||||
return;
|
||||
tryPlaceBlock(event, player, block, structureBlock);
|
||||
@@ -32,14 +32,6 @@ function hasActionItemInCorrectSlot(player) {
|
||||
return actionSlot.hasItem() && actionSlot.typeId === 'minecraft:paper' && actionSlot.nameTag === 'easyPlace';
|
||||
}
|
||||
|
||||
function fetchStructureBlock(location) {
|
||||
const locatedStructures = structureCollection.getStructuresAtLocation(location);
|
||||
if (locatedStructures.length === 0)
|
||||
return void 0;
|
||||
const structure = locatedStructures[0];
|
||||
return structure.getBlock(structure.toStructureCoords(location));
|
||||
}
|
||||
|
||||
function tryPlaceBlock(event, player, block, structureBlock) {
|
||||
if (isBannedBlock(player, structureBlock)) return;
|
||||
structureBlock = tryConvertBannedToValidBlock(structureBlock);
|
||||
|
||||
Reference in New Issue
Block a user