Skip to content

Feature: Auto Portal Builder#272

Open
beanbag44 wants to merge 4 commits into1.21.11from
feature/auto-portal-builder
Open

Feature: Auto Portal Builder#272
beanbag44 wants to merge 4 commits into1.21.11from
feature/auto-portal-builder

Conversation

@beanbag44
Copy link
Member

Automatically places, lights, and walks into a nether portal using the given configuration.

Once the module is enabled, you can bind the previewPlace setting which once pressed shows you a preview of where the portal will be placed. Once released, the module will place the portal and do other actions if configured for such.

…y offset after ground locking, fix ground locking logic
Comment on lines +81 to +101
buildTask?.cancel()
val posStateMap =
obiPositions.associateWith {
TargetState.Block(Blocks.OBSIDIAN)
} + portalPositions.associateWith {
TargetState.Air
}
//ToDo: implement non placement interactions like flint and steel in the build sim, in turn, simulating portal lighting too.
// + portalPositions.associateWith {
// TargetState.Block(Blocks.NETHER_PORTAL)
// }
buildTask = posStateMap
.build()
.thenOrNull {
if (light) LightTask(currAnchorPos.up(), walkIn)
else null
}
.finally {
buildTask = null
}
.run()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to extra this logic into a method

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how so? Having it here makes it clear and concise what it does. Putting it in another function just makes it more confusing when navigating how the module works

}
private val corners by setting("Corners", false).group(Group.General)
private val light by setting("Light", true, "Attempts to automatically light the portal after building").group(Group.General)
private val walkIn by setting("Walk In", true, "Automatically paths into the portal with baritone") { light }.group(Group.General)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why hide when light is off?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because theres not much point walking into the portal when its not lit. Helps keep the setting bloat down by assuming what most people would want

private val sidewaysOffset by setting("Sideways Offset", 0, -5..5).group(Group.General)
private val yOffset by setting("Y Offset", 0, -5..5).group(Group.General)
private val lockToGround by setting("Lock To Ground", true).group(Group.General)
private val allowUpwardShift by setting("Allow Upward Shift", true).group(Group.General)
Copy link
Contributor

@IceTank IceTank Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing setting description on allowUpwardShift

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didnt bother adding it because lockToGround implies that its locking down to the ground. allowUpwardShift would imply youre letting it rize to the top of some blocks.

}
.forEach { posAndBox ->
box(posAndBox.second, outlineConfig) {
colors(obiColor.setAlpha(0.3), obiColor)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to be able to change the alpha value of the render

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was trying to keep down on the setting bloat and wasnt sure if i should add this. Seems very niche and i doubt people would bother changing it most the time but ig i can

Comment on lines +187 to +188
Direction.UP,
Direction.DOWN -> Direction.EAST
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

playerHorizontal is always one of the 4 horizontal directions never UP or DOWN. So this when is redundant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would need to make a separate check to handle up and down

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true

var scanPos = baseAnchorPos
if (blockState(scanPos).isNotEmpty) {
if (allowUpwardShift) {
while (blockState(scanPos).isNotEmpty && scanPos.y < 320) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 320 specifically? Max build height is 319, and I am pretty sure you won't be able to build a portal if the lowest block is already at build height. Maybe just fail if the y level is to heigh?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i based the y levels off where it would be technically possible to place the base blocks of the portal with a support. I chose 320 because i need a way to see if the upward shift was successful, and as 319 could be a valid placement, there would be no way to know if it failed or not.

scanPos = scanPos.up()
}
}
if (!allowUpwardShift || scanPos.y >= 320) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above comment

}
swapPacket()
if (walkIn) {
BaritoneManager.setGoalAndPath(GoalXZ(pos.x, pos.z))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be a GoalBlock. Preferably a

Suggested change
BaritoneManager.setGoalAndPath(GoalXZ(pos.x, pos.z))
BaritoneManager.setGoalAndPath(GoalComposite(GoalBlock(...), GoalBlock(...)))

so baritone walks into either portal block.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yeah. I tried goal block but i assumed at the time it only walked near that position. Turns out i was telling it to walk into the anchor pos obsidian

…n statement, and use GoalBlock instead of XZ goal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants