From 6418e9b95ef9352e36fa7320bfba865a4b73ad62 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Thu, 25 Aug 2022 21:08:15 -0400 Subject: [PATCH] Akashic libraries now have a range limit --- .../blocks/akashic/BlockAkashicFloodfiller.java | 17 ++++++++++------- .../resources/assets/hexcasting/lang/en_us.json | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicFloodfiller.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicFloodfiller.java index a5132a60..f7cb4bb9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicFloodfiller.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicFloodfiller.java @@ -37,10 +37,9 @@ public class BlockAkashicFloodfiller extends Block { return true; } - - public static @Nullable - BlockPos floodFillFor(BlockPos start, Level world, - TriPredicate isValid, TriPredicate isTarget) { + @Nullable + public static BlockPos floodFillFor(BlockPos start, Level world, + TriPredicate isValid, TriPredicate isTarget, int maxRange) { var seenBlocks = new HashSet(); var todo = new ArrayDeque(); todo.add(start); @@ -50,6 +49,10 @@ public class BlockAkashicFloodfiller extends Block { for (var dir : Direction.values()) { var neighbor = here.relative(dir); + + if (neighbor.distSqr(start) > maxRange * maxRange) + continue; + if (seenBlocks.add(neighbor)) { var bs = world.getBlockState(neighbor); if (isTarget.test(neighbor, bs, world)) { @@ -64,10 +67,10 @@ public class BlockAkashicFloodfiller extends Block { return null; } - public static @Nullable - BlockPos floodFillFor(BlockPos start, Level world, + @Nullable + public static BlockPos floodFillFor(BlockPos start, Level world, TriPredicate isTarget) { - return floodFillFor(start, world, BlockAkashicFloodfiller::canItBeFloodedThrough, isTarget); + return floodFillFor(start, world, BlockAkashicFloodfiller::canItBeFloodedThrough, isTarget, 32); } public static boolean canItBeFloodedThrough(BlockPos pos, BlockState state, Level world) { diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.json b/Common/src/main/resources/assets/hexcasting/lang/en_us.json index 1e6df8a4..39f518e1 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.json +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.json @@ -705,7 +705,7 @@ "hexcasting.entry.akashiclib": "Akashic Libraries", "hexcasting.page.akashiclib.1": "I KNOW SO MUCH it is ONLY RIGHT to have a place to store it all. Information can be stored in books but it is oh so so so so $(italic)slow/$ to write by hand and read by eye. I demand BETTER. And so I shall MAKE better.$(br2)... I am getting worse ... do not know if I have time to write everything bursting through my head before expiring.", - "hexcasting.page.akashiclib.2": "The library. Here. My plans.$(br2)Like how patterns are associated with actions, I can associate my own patterns with iotas in any way I choose. An $(l:greatwork/akashiclib)$(item)Akashic Record/$ controls the library, and each $(l:greatwork/akashiclib)$(item)Akashic Bookshelf/$ stores one pattern mapped to one iota. These must all be directly connected together, touching. An $(l:greatwork/akashiclib)$(item)Akashic Ligature/$ doesn't do anything but count as a connecting block, to extend the size of my library.", + "hexcasting.page.akashiclib.2": "The library. Here. My plans.$(br2)Like how patterns are associated with actions, I can associate my own patterns with iotas in any way I choose. An $(l:greatwork/akashiclib)$(item)Akashic Record/$ controls the library, and each $(l:greatwork/akashiclib)$(item)Akashic Bookshelf/$ stores one pattern mapped to one iota. These must all be directly connected together, touching, within 32 blocks. An $(l:greatwork/akashiclib)$(item)Akashic Ligature/$ doesn't do anything but count as a connecting block, to extend the size of my library.", "hexcasting.page.akashiclib.akashic_record": "Allocating and assigning patterns is simple but oh so boring. I have better things to do. I will need a mind well-used to its work for the extraction to stay sound.", "hexcasting.page.akashiclib.3": "Then to operate the library is simple, the patterns are routed through the librarian and it looks them up and returns the iota to you. Two actions do the work. $(l:patterns/akashic_patterns)Notes here/$.$(br2)Using an empty $(l:items/scroll)$(item)scroll/$ on a bookshelf copies the pattern there onto the $(l:items/scroll)$(item)scroll/$. Sneaking and using an empty hand clears the datum in the shelf.",