Skip to content

Commit

Permalink
fix: Ice Fill Solver doesn't account for 2 chests
Browse files Browse the repository at this point in the history
  • Loading branch information
My-Name-Is-Jeff committed Aug 9, 2024
1 parent cbff917 commit db6a084
Showing 1 changed file with 34 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,31 +59,45 @@ object IceFillSolver {
val pos = te.pos
if (world.getBlockState(pos.down()).block == Blocks.stone) {
for (direction in EnumFacing.HORIZONTALS) {
if (world.getBlockState(pos.offset(direction)).block == Blocks.cobblestone && world.getBlockState(
pos.offset(direction.opposite, 2)
).block == Blocks.iron_bars && world.getBlockState(
fun checkChestTorches(dir: EnumFacing): Boolean {
return world.getBlockState(
pos.offset(
direction.rotateY(),
2
dir,
1
)
).block == Blocks.torch && world.getBlockState(
pos.offset(
direction.rotateYCCW(),
2
dir.opposite,
3
)
).block == Blocks.torch && world.getBlockState(
pos.offset(direction.opposite).down(2)
).block == Blocks.stone_brick_stairs
) {
puzzles = Triple(
IceFillPuzzle(world, 70, pos, direction),
IceFillPuzzle(world, 71, pos, direction),
IceFillPuzzle(world, 72, pos, direction)
)
println(
"Ice fill chest is at $pos and is facing $direction"
)
break@findChest
).block == Blocks.torch
}

if (world.getBlockState(pos.offset(direction)).block == Blocks.cobblestone && world.getBlockState(
pos.offset(direction.opposite, 2)
).block == Blocks.iron_bars) {

val offsetDir: EnumFacing? = if (checkChestTorches(direction.rotateY())) {
direction.rotateYCCW()
} else if (checkChestTorches(direction.rotateYCCW())) {
direction.rotateY()
} else continue

if (world.getBlockState(
pos.offset(direction.opposite)
.offset(offsetDir)
.down(2)
).block == Blocks.stone_brick_stairs) {
puzzles = Triple(
IceFillPuzzle(world, 70, pos, direction),
IceFillPuzzle(world, 71, pos, direction),
IceFillPuzzle(world, 72, pos, direction)
)
println(
"An Ice Fill chest is at $pos and is facing $direction. Offset direction is $offsetDir."
)
break@findChest
}
}
}
}
Expand Down

0 comments on commit db6a084

Please sign in to comment.