Skip to content

Commit

Permalink
feat(anchors): moreeeee
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Jan 12, 2025
1 parent 8b777f8 commit 6b1559b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_build=8
loader_version=0.16.10

# Mod Properties
mod_version=1.14.2
mod_version=1.14.3
maven_group=net.mcbrawls
mod_id=blueprint

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,31 @@ data class PlacedBlueprint(
return pointRegion.pointPosition
}

/**
* Gets all anchors of a given id.
*/
fun getAnchors(id: String): List<Anchor> {
return blueprint.anchors
.filter { it.first == id }
.map { it.second }
}

/**
* Gets a given anchor offset for this placed blueprint.
*/
fun getAnchorOffset(anchor: Anchor): Anchor {
return Anchor(anchor.position.add(offset), anchor.rotation, anchor.data)
}

/**
* Gets an anchor position from an anchor id assumed to be unique.
* @return the placed offset position of the given anchor
*/
fun getUniqueAnchorPos(id: String): Vec3d {
val anchor = getAnchors(id).firstOrNull() ?: throw IllegalArgumentException("Anchor not found: $id")
return getAnchorOffset(anchor).position
}

/**
* Performs an action for every position in this placed blueprint.
*/
Expand Down

0 comments on commit 6b1559b

Please sign in to comment.