@@ -59,31 +59,45 @@ object IceFillSolver {
5959 val pos = te.pos
6060 if (world.getBlockState(pos.down()).block == Blocks .stone) {
6161 for (direction in EnumFacing .HORIZONTALS ) {
62- if (world.getBlockState(pos.offset(direction)).block == Blocks .cobblestone && world.getBlockState(
63- pos.offset(direction.opposite, 2 )
64- ).block == Blocks .iron_bars && world.getBlockState(
62+ fun checkChestTorches (dir : EnumFacing ): Boolean {
63+ return world.getBlockState(
6564 pos.offset(
66- direction.rotateY() ,
67- 2
65+ dir ,
66+ 1
6867 )
6968 ).block == Blocks .torch && world.getBlockState(
7069 pos.offset(
71- direction.rotateYCCW() ,
72- 2
70+ dir.opposite ,
71+ 3
7372 )
74- ).block == Blocks .torch && world.getBlockState(
75- pos.offset(direction.opposite).down(2 )
76- ).block == Blocks .stone_brick_stairs
77- ) {
78- puzzles = Triple (
79- IceFillPuzzle (world, 70 , pos, direction),
80- IceFillPuzzle (world, 71 , pos, direction),
81- IceFillPuzzle (world, 72 , pos, direction)
82- )
83- println (
84- " Ice fill chest is at $pos and is facing $direction "
85- )
86- break @findChest
73+ ).block == Blocks .torch
74+ }
75+
76+ if (world.getBlockState(pos.offset(direction)).block == Blocks .cobblestone && world.getBlockState(
77+ pos.offset(direction.opposite, 2 )
78+ ).block == Blocks .iron_bars) {
79+
80+ val offsetDir: EnumFacing ? = if (checkChestTorches(direction.rotateY())) {
81+ direction.rotateYCCW()
82+ } else if (checkChestTorches(direction.rotateYCCW())) {
83+ direction.rotateY()
84+ } else continue
85+
86+ if (world.getBlockState(
87+ pos.offset(direction.opposite)
88+ .offset(offsetDir)
89+ .down(2 )
90+ ).block == Blocks .stone_brick_stairs) {
91+ puzzles = Triple (
92+ IceFillPuzzle (world, 70 , pos, direction),
93+ IceFillPuzzle (world, 71 , pos, direction),
94+ IceFillPuzzle (world, 72 , pos, direction)
95+ )
96+ println (
97+ " An Ice Fill chest is at $pos and is facing $direction . Offset direction is $offsetDir ."
98+ )
99+ break @findChest
100+ }
87101 }
88102 }
89103 }
0 commit comments