Compare commits

..

270 Commits

Author SHA1 Message Date
Astrash 6146c8db06 Fix coords 2024-11-02 09:23:25 +11:00
Astrash 4388003f35 WIP structure stage work 2024-11-02 09:16:35 +11:00
OakLoaf a385a43250 Moved registry unfreeze 2024-11-01 12:02:49 +00:00
OakLoaf 3cd6aead64 Changed biome registry casting 2024-11-01 12:02:32 +00:00
OakLoaf 4f33b11828 Fixed issue with RegistryFetcher 2024-11-01 12:02:09 +00:00
OakLoaf f5bbaa3c3a Corrected class proxy 2024-11-01 11:57:35 +00:00
Zoe Gidiere 4fd84a3f2d Fix paralithic relocating 2024-10-31 13:42:41 -06:00
Zoë Gidiere bed67c211d Merge pull request #478 from PolyhedralDev/dev/let-expression
Add let expression support
2024-10-30 18:51:05 +00:00
Astrash 2c8d3416ab Load parse options before registering metaconfig 2024-10-30 14:04:40 +11:00
Astrash 5e43f0afef Add support for Paralithic let expressions 2024-10-30 14:04:40 +11:00
Zoe Gidiere 02fdcee705 Fix fabric 2024-10-29 20:24:32 -06:00
Zoe Gidiere 4165224c51 Mark Cache Sampler Experimental 2024-10-29 16:04:55 -06:00
Zoe Gidiere 710bbc33c9 Refractor bukkit to v1_21_3 2024-10-29 15:53:48 -06:00
Zoë Gidiere 1929239015 Merge pull request #473 from PolyhedralDev/dev/biomes3
Some refractors and updates to platofrm biomes
2024-10-29 20:27:42 +00:00
Zoe Gidiere 3ca90808f0 Fix up 2024-10-29 14:23:45 -06:00
Zoe Gidiere 9d91440997 fixup 2024-10-29 14:14:25 -06:00
Zoe Gidiere f98062d417 Merge remote-tracking branch 'origin/dev/bukkit/biome-settings' into dev/biomes3 2024-10-29 13:53:08 -06:00
OakLoaf 8df3a4dd02 Added NMSAddon override for BukkitAddon 2024-10-29 19:38:59 +00:00
OakLoaf afd2c81b19 Made grass colour use default if none is defined 2024-10-29 18:31:37 +00:00
Zoë Gidiere 4432ae4867 Merge pull request #476 from AllayMC/dev/support-world-unload
feat: support world unloading
2024-10-28 18:18:23 +00:00
daoge_cmd 16c951838b feat: support world unloading 2024-10-28 17:39:25 +08:00
OakLoaf 8de4f1198a Started adding more biome settings to bukkit 2024-10-26 10:02:32 +01:00
Zoe Gidiere 144c932703 mixin tweak 2024-10-25 16:09:42 -06:00
Zoë Gidiere e56b8856fa Merge pull request #474 from AllayMC/allay
feat: add support for allay platform
2024-10-25 16:05:58 -06:00
Zoë Gidiere 04f6d18198 Merge pull request #470 from PolyhedralDev/dev/1.21.2
Dev/1.21.2
2024-10-25 14:09:16 -06:00
Zoe Gidiere 640645b96b fix version 2024-10-25 14:03:27 -06:00
Zoe Gidiere a70738eda5 Version updates 2024-10-25 13:58:33 -06:00
OakLoaf 62756d2784 Updated Bukkit to support 1.21.3 2024-10-25 19:36:18 +01:00
Zoe Gidiere 32f8907cb1 Merge branch 'ver/6.6.0' into dev/1.21.2 2024-10-25 12:28:03 -06:00
Astrash b75e9c152e Refactor palette addon 2024-10-18 19:29:48 +11:00
Astrash c190485dbe Use more appropriate names in probability collection loader 2024-10-18 17:50:41 +11:00
Astrash e756953828 Use singleton impl for map based probability collections 2024-10-18 17:49:07 +11:00
daoge 071f9d39af docs: fix a typo in README.md 2024-10-15 10:03:54 +08:00
daoge_cmd d2107fd258 fix: chunkGenerator should be overwritten after reloading 2024-10-14 22:37:09 +08:00
daoge_cmd df3e623530 feat: implement config pack reloading 2024-10-14 22:13:54 +08:00
daoge_cmd f0d03d4538 feat: fallback to FLAT generator if config pack name is missing 2024-10-14 21:34:23 +08:00
daoge_cmd 84fe8792d6 fix: fix entrance in plugin.json 2024-10-14 21:33:59 +08:00
daoge_cmd 67fc2ba4dc docs: remove useless TODOs 2024-10-14 21:21:54 +08:00
daoge_cmd 8d63c40e2f refactor: replace 'var' with explicit type 2024-10-14 21:13:00 +08:00
daoge_cmd b0bc37c34d refactor: remove version info in mapping files 2024-10-14 21:05:06 +08:00
daoge_cmd f2c5c15650 refactor: use com.dfsek as the new package name 2024-10-14 21:02:07 +08:00
daoge_cmd f5de88215c build: use fixed allay api version 2024-10-14 21:00:15 +08:00
daoge_cmd 8a6ad95947 refactor: delombok and move version info to Versions.kt 2024-10-14 20:55:11 +08:00
daoge_cmd cc14c716bf build: move repo declaration to DependencyConfig.kt 2024-10-14 20:36:40 +08:00
daoge_cmd ece5213a87 feat: use macro in plugin.json and update author list 2024-10-14 11:33:40 +08:00
daoge_cmd a01f700653 build: rollback github action file changes 2024-10-14 11:24:54 +08:00
daoge_cmd 0ca7171bae docs: add README.md to allay platform 2024-10-14 11:23:59 +08:00
daoge_cmd 6261f0849c feat: remove java version declaration in allay platform as all platforms are in java 21 now 2024-10-14 11:23:27 +08:00
daoge 4fc24f022f Merge branch 'PolyhedralDev:master' into allay 2024-10-14 11:07:34 +08:00
daoge_cmd 61ed302137 feat: adapting terra 6.5.1 (WIP) 2024-10-14 11:07:12 +08:00
Zoe Gidiere 053ec39b7b Merge branch 'master' into ver/6.6.0 2024-10-13 16:32:26 -06:00
Zoe Gidiere 0a952cff4c bump build number 2024-10-13 16:06:35 -06:00
Zoe Gidiere 12faae8fd5 Use reflection remapper for worldGenContext on bukkit
How this even worked before astounds me
2024-10-13 15:55:29 -06:00
daoge_cmd 1496f2c929 build: update jitpack repo link 2024-10-13 15:41:03 +08:00
Zoe Gidiere 40a938be19 Merge branch 'ver/6.6.0' into dev/biomes3 2024-10-12 15:44:19 -06:00
Zoe Gidiere 4be2390294 Small cache fix 2024-10-12 15:43:23 -06:00
Zoe Gidiere da16f65ea2 Merge branch 'ver/6.6.0' into dev/biomes3 2024-10-12 15:39:03 -06:00
Zoe Gidiere 65d026a130 Fix Cache Deadlock 2024-10-12 15:38:51 -06:00
Zoe Gidiere d45256b2f7 Another merge fixup 2024-10-12 14:52:11 -06:00
Zoe Gidiere 16d8e8f29d Fix up merge 2024-10-12 14:49:53 -06:00
Zoe Gidiere a58b2a5193 Merge remote-tracking branch 'origin/dev/biome2' into ver/6.6.0 2024-10-12 14:40:33 -06:00
Zoe Gidiere 1e5a1e20c2 Merge remote-tracking branch 'origin/master' into ver/6.6.0 2024-10-12 14:29:42 -06:00
Zoë Gidiere 592788450c Update CODEOWNERS 2024-10-12 13:45:55 -06:00
Zoë Gidiere 060cbfd0c4 Update CODEOWNERS 2024-10-12 13:44:02 -06:00
Zoe Gidiere b9c2f4e63b Update Licence year 2024-10-12 02:03:43 -06:00
Zoe Gidiere 87674aa0ba fix cellular sampler 2024-10-12 02:02:28 -06:00
Zoe Gidiere 40ccf80c7f Optimization when Terra Profiler is not running
Do not set Profiler SAFE Threadlocal var when profiler is not running but ensure it is set to false after the profiler stops to ensure consistent behavior
2024-10-12 00:58:08 -06:00
Zoe Gidiere 6946755e31 Minor Cellular opt 2024-10-12 00:56:37 -06:00
Zoë Gidiere 3b9962662e Merge pull request #471 from PolyhedralDev/dev/caching
Dev/caching
2024-10-12 00:22:43 -06:00
Zoe Gidiere 7ca61f82b2 Some API clean up 2024-10-12 00:22:18 -06:00
Zoe Gidiere 6851999926 Some refactoring 2024-10-11 19:45:12 -06:00
Zoe Gidiere 585967157d 1.21.2-pre3 2024-10-11 18:40:59 -06:00
Zoe Gidiere 305255511d More cache improvements 2024-10-11 18:27:37 -06:00
Zoe Gidiere 819be16d83 Merge branch 'dev/cli' into dev/caching 2024-10-11 16:40:26 -06:00
Zoe Gidiere 8a028b193a Add no save option 2024-10-11 16:35:26 -06:00
Zoe Gidiere d31679e6be remove stuff from example 2024-10-11 16:06:40 -06:00
Zoe Gidiere 9d328b12b3 More cache improvements 2024-10-11 16:06:23 -06:00
Zoe Gidiere a743e9c015 Merge branch 'dev/cli' into dev/caching 2024-10-11 15:16:20 -06:00
Zoe Gidiere 43d52e4bc1 CLI Improvements 2024-10-11 15:16:04 -06:00
Zoe Gidiere accc07fa07 Bump Version 2024-10-11 15:15:38 -06:00
Zoe Gidiere c1d3155ddd Cache Improvements 2024-10-11 15:15:10 -06:00
Zoe Gidiere 9a01a6c6a0 more WIP on cache 2024-10-11 00:20:46 -06:00
Zoe Gidiere 3033fbbf29 Fix a ton of fabric impl bugs 2024-10-10 16:49:40 -06:00
Zoe Gidiere c78a984a11 Update to pre2 2024-10-10 14:02:53 -06:00
Zoe Gidiere 1ae0d1f867 WIP Caching Hints and Caching Sampler 2024-10-09 23:36:12 -06:00
Zoe Gidiere be7e10c30c Fix runtime errors 2024-10-09 16:41:04 -06:00
Zoe Gidiere 2ccf8a8805 1.21.2-pre1 builds 2024-10-09 16:18:47 -06:00
Zoe Gidiere 197cb12be2 Update fabric versions to 1.21.2-pre1 2024-10-09 15:28:52 -06:00
Zoe Gidiere adb43dcaa8 Gradle update 2024-10-09 15:17:09 -06:00
Zoe Gidiere b03d128913 Addon dependency updates 2024-10-09 14:01:24 -06:00
Zoe Gidiere 725fa88466 Remap fabric 2024-10-09 14:01:12 -06:00
Zoe Gidiere 370b2e0122 Fix import 2024-10-09 13:01:54 -06:00
Zoe Gidiere 331075e54d Refractor name 2024-10-09 12:59:19 -06:00
Zoë Gidiere 973590f5fd Add parameter to turn off salting cellular lookup
another updated astrash commit
2024-10-09 12:42:24 -06:00
Astrash 1a5ab6b505 Add meta annotations 2024-10-09 12:42:13 -06:00
Astrash 14732328cd Add default 'from' values for linear map template 2024-10-09 12:41:55 -06:00
Zoë Gidiere 6c7974c302 Implement linear map normalizer
Updated astrash commit
2024-10-09 12:41:40 -06:00
Zoe Gidiere 1204b7a8c1 ArithmeticSampler Derivatives 2024-10-09 12:37:50 -06:00
Astrash fbe1c76e26 Forgot to include 4th derivative array index for 3D FBM 2024-10-09 21:50:08 +11:00
Astrash add7803e65 Simplify isDifferentiable static method impl 2024-10-09 20:56:37 +11:00
Astrash 4393a16b2f Use proper static isDifferentiable method 2024-10-09 20:56:11 +11:00
Astrash b4fa635455 Ensure throw with incorrect use of SimplexStyle derivatives
This should ensure that in the case an implementation fails to correctly
check isDifferentiable then performs a subsequent derivative based sample,
an error is thrown, rather than potentially missing a logic bug due to
noise of 0 and derivative of 0 being returned which could otherwise be
hard to narrow down.
2024-10-09 20:45:25 +11:00
Astrash 9f425c6159 Add support for derivatives in FBM 2024-10-09 20:39:45 +11:00
Astrash 158ffba2a5 Make FractalNoiseFunction impls support derivatives 2024-10-09 20:39:13 +11:00
Zoë Gidiere b7326c0ff6 Merge pull request #469 from PolyhedralDev/dev/fix-bukkit-spawner
fix spawners on bukkit
2024-09-24 23:27:44 -06:00
Zoe Gidiere f70a83aec3 fix spawners on bukkit 2024-09-24 23:26:49 -06:00
astrsh 589cf83c38 Flip comparison
As per request from @duplexsystem
2024-09-25 14:08:19 +10:00
Zoë Gidiere c374c2d5ef Merge pull request #467 from PolyhedralDev/ver/6.5.0
Ver/6.5.0
2024-09-24 09:41:58 -06:00
Zoe Gidiere 13782bb51e Remforamt 2024-09-24 09:11:43 -06:00
Zoe Gidiere 1aa3ef813c add default sampler to pseudoerosion 2024-09-24 09:05:33 -06:00
Zoe Gidiere 6cc53beecb Fix Sin/Cos 2024-09-23 23:14:35 -06:00
Zoe Gidiere 2c45ba91aa Fix up commit 2024-09-23 22:40:37 -06:00
Zoe Gidiere 6244ffca63 Revert "Sin/Cos Opts"
This reverts commit 1d05f95f74.
2024-09-23 22:38:45 -06:00
Zoe Gidiere 59d943b3ea Revert "Fix build"
This reverts commit 10d723372d.
2024-09-23 22:38:17 -06:00
Zoe Gidiere f605ee1937 Remove Final from psuedoerosion template 2024-09-23 22:35:01 -06:00
Zoe Gidiere f87b7c07d9 Reformat 2024-09-23 22:27:53 -06:00
Zoe Gidiere f1124aae6b Update platform mod file versions and authors 2024-09-23 21:18:47 -06:00
Zoe Gidiere 9c8298fe53 convert pseudoerosion to double 2024-09-23 21:09:19 -06:00
Zoe Gidiere d69b0dba90 reformat 2 2024-09-23 21:06:07 -06:00
Zoe Gidiere 42166d5239 bump version number 2024-09-23 20:59:02 -06:00
Zoe Gidiere d6772f51ea Reformat 2024-09-23 20:56:13 -06:00
Zoe Gidiere f469193909 Make seed affect pseudoerosion hasing 2024-09-23 20:51:00 -06:00
Zoe Gidiere 10d723372d Fix build 2024-09-23 20:45:47 -06:00
Zoe Gidiere 1d05f95f74 Sin/Cos Opts 2024-09-23 20:38:22 -06:00
Zoe Gidiere bd73427072 OpenSimplex 2 Derivative Impl 2024-09-23 20:29:41 -06:00
Zoe Gidiere 017b4608bc Fix build 2024-09-23 19:49:16 -06:00
Zoe Gidiere 5f340f8ffd slight open simplex 2s op\pt 2024-09-23 19:48:22 -06:00
Zoe Gidiere 5b35eb041b Remove temp DerivativeFractl nose 2024-09-23 19:43:56 -06:00
Zoe Gidiere 699d5d1d62 Derivable OpenSimplex2S Impl
baased on https://gist.github.com/KdotJPG/882f36b2ae5ae56a8fc91627ec1c87f4
2024-09-23 19:42:50 -06:00
Zoe Gidiere 07e3d0058d Refractor PseudoErosion 2024-09-23 16:46:48 -06:00
Zoe Gidiere b1ad820e1c Move pseudoerosion to NoiseFunction 2024-09-23 16:37:42 -06:00
Zoe Gidiere 3644ee7fca Implement DerivateNoiseFunction 2024-09-23 16:28:34 -06:00
Zoe Gidiere b14b355c6f Merge branch 'dev/fractal-gavoro-pseudoerosion' into ver/6.5.0 2024-09-21 17:22:47 -06:00
daoge_cmd 6042f1c036 build: update build.gradle.kts 2024-09-21 00:57:18 +08:00
daoge_cmd af2ac64cd4 feat: using the new safe getter api 2024-09-20 19:47:49 +08:00
Zoe Gidiere 06457bf3ce some fixes 2024-09-18 15:43:31 -06:00
Zoe Gidiere b63f5f4a8f Reformat 2024-09-18 12:43:41 -06:00
daoge_cmd 4bad8f702c docs: format javadoc 2024-09-18 13:02:16 +08:00
daoge_cmd 76f12e0cb8 build: prepare for merging 2024-09-18 12:59:30 +08:00
Zoë Gidiere 8cf766e77b Merge pull request #455 from pumken/seasoned-samplers-2
Add salted version of sampler functions in EXPRESSION samplers
2024-09-17 17:59:26 -06:00
Zoe Gidiere a23d624ab9 Merge branch 'dev/1.21.1' into ver/6.5.0 2024-09-17 17:41:25 -06:00
Zoe Gidiere 15a298304e working 1.21.1 2024-09-17 17:40:56 -06:00
Zoe Gidiere 664d1a3191 working 1.20.6 2024-09-17 16:34:30 -06:00
Zoë Gidiere 73047284c8 Merge pull request #461 from OakLoaf/dev/1.21/bukkit
Updated Bukkit to 1.21/1.21.1
2024-09-17 09:43:05 -06:00
daoge_cmd ce9fb53df4 build: disable useless modules 2024-09-17 22:28:04 +08:00
daoge 1f01b99d29 ci: should check allay branch 2024-09-17 20:40:24 +08:00
daoge 18a24562ec ci: upload jar 2024-09-17 20:39:49 +08:00
daoge 2f2d43e1b8 build: disable mixin platform 2024-09-17 20:00:42 +08:00
daoge 6c8a7da254 build: disable mixin platform 2024-09-17 19:59:43 +08:00
daoge ca4461ba2a build: disable bukkit platform 2024-09-17 19:56:45 +08:00
daoge c6df3c302b build: disable fabric platform 2024-09-17 19:56:03 +08:00
daoge 328ebf5aa9 build: disable cli platform 2024-09-17 19:55:20 +08:00
daoge 2c476a25d9 build: fix build for allay platform 2024-09-17 19:45:26 +08:00
daoge b432a4e01d build: use jdk21 for allay platform 2024-09-17 19:39:01 +08:00
daoge f73eadda76 ci: use jdk 21 2024-09-17 19:18:08 +08:00
daoge 1acdad5c6b ci: run github action when pushing 2024-09-17 19:01:41 +08:00
daoge 732a894945 ci: trigger github action 2024-09-17 18:59:53 +08:00
daoge_cmd bbf0915bc9 build: use org.allaymc.allay as the group id 2024-09-07 19:47:19 +08:00
daoge_cmd 5f70ecb943 feat: use jitpack 2024-09-04 23:55:24 +08:00
daoge_cmd 2e709dace6 feat: sync allay 2024-08-27 19:15:42 +08:00
OakLoaf 3bef7d8572 Resolved errors when tab completing 2024-08-26 12:34:08 +01:00
OakLoaf 08df5fc278 Added 1.21.1 support 2024-08-26 11:24:04 +01:00
daoge_cmd c97f25cb95 feat: support 1.21.20 and newer versions 2024-08-23 20:18:45 +08:00
daoge_cmd 28c689d16f feat: fetch allay's changes 2024-08-19 01:36:32 +08:00
daoge_cmd a34946cece feat: return air if block type not found 2024-08-18 19:39:23 +08:00
OakLoaf 922cd35e84 Updated Cloud dependency to v2 2024-08-16 11:07:03 +01:00
daoge_cmd 4acd0de6fa feat: fetch allay's changes 2024-07-24 20:30:24 +08:00
Oak 44d23573b3 Updated dependencies to Paper 1.21 snapshot 2024-07-20 20:17:25 +01:00
daoge_cmd 2443fff0a4 feat: fetch allay's changes 2024-07-17 01:32:01 +08:00
daoge_cmd cd767a648c feat: fetch allay's changes 2024-07-17 01:27:56 +08:00
Oak e7cc275340 Corrected issues with worldGenContext not correctly being set (Ref: https://stackoverflow.com/questions/56039341/get-declared-fields-of-java-lang-reflect-fields-in-jdk12/56043252#56043252) 2024-06-23 14:16:50 +01:00
Oak fddc9a52b9 Temporarily disabled commands whilst awaiting Cloud Framework update 2024-06-19 13:34:35 +01:00
Oak 0758e13bc7 Made patch version optional as not all Minecraft versions have a patch number 2024-06-19 13:33:55 +01:00
daoge_cmd d490324bfc feat: support waterlogged 2024-06-19 18:09:31 +08:00
daoge_cmd 5fa7007d45 fix: fix a typo 2024-06-19 17:19:17 +08:00
daoge_cmd 2d0e4a83b0 fix: OtherChunkAccessibleContext.get/setBlockState() should use level pos instead of chunk local pos 2024-06-19 01:05:37 +08:00
daoge_cmd e68f928e38 feat: use OtherChunkAccessibleContext directly 2024-06-18 14:59:42 +08:00
daoge_cmd 4a3678cea9 feat: update to 1.21 2024-06-18 03:41:17 +08:00
Oak d810cad8d0 Adjusted code for Spigot compatibility 2024-06-17 15:50:06 +01:00
Oak 4e7de501c0 Updated bukkit platform to 1.21 2024-06-16 19:21:34 +01:00
daoge_cmd 6ff0903d83 fix: fix an mistake 2024-06-17 01:21:14 +08:00
daoge_cmd 133df45968 feat: make it works! 2024-06-17 00:37:16 +08:00
daoge_cmd 1f937a2ae0 feat: fake entity 2024-06-16 15:55:28 +08:00
daoge_cmd d861d3e849 feat: more works 2024-06-16 15:48:18 +08:00
daoge_cmd 3d4aec4abb chores: improve imports 2024-06-16 15:03:19 +08:00
daoge_cmd 62e589870d feat: more works 2024-06-16 15:02:42 +08:00
daoge_cmd 2b125414c9 feat: more works 2024-06-16 06:01:38 +08:00
daoge_cmd 59d7632927 feat: add mapping files 2024-06-16 03:30:50 +08:00
daoge_cmd d81f886e8c feat: more works 2024-06-16 03:29:03 +08:00
daoge_cmd b29ba2db70 feat: more works 2024-06-16 01:33:46 +08:00
daoge_cmd 02a7363f01 feat: init work on allay 2024-06-16 00:07:52 +08:00
Oak 9e60db4b0d Updated MinecraftVersionInfo 2024-06-10 11:07:24 +01:00
Oak 4536767794 Updated to 1.20.6 2024-06-03 11:36:50 +01:00
Oak 3fa4b21247 Attempted to fix paper versions 2024-06-02 21:27:07 +01:00
Oak 17acde09a3 Updated Bukkit to 1.20.6 2024-05-31 12:11:07 +01:00
Zoe Gidiere dd272bce64 WIP 1.20.6 2024-05-01 17:04:34 -06:00
Gavin Tran c20b1eaf10 Apply code style fixes 2024-04-21 15:39:48 -04:00
Gavin Tran 72f761678a Add SaltedNoiseFunctions in sampler conversion 2024-04-21 14:54:45 -04:00
Gavin Tran 62317a2f3f Add SaltedNoiseFunctions 2024-04-21 14:48:46 -04:00
Astrash 823afd592b Reduce number of erosion impulses
A reduction of impulse evaluations from 5^2 to 3^2, original algorithm used exponential falloff function which required evaluating impulses from further away to avoid artifacts. I've changed it to a parabolic falloff function which is exactly 0 at the largest possible distance from a cell origin, meaning any cells further than that will not have an effect, preventing said artifacting from occurring. The parabolic function could be replaced with an exponential function (or any other similar easing function) as long as it has an x-intercept at maxCellDistSq. In addition, an option to control whether averaging impulses has been added as it has more of a visual impact with the aforementioned changes.
2024-04-20 15:55:59 +10:00
Astrash ff03b38b81 Derivative API documentation 2024-04-19 21:25:16 +10:00
Astrash 35246d65b9 Require implementing derivable check 2024-04-19 21:07:53 +10:00
Astrash 41652d29df Use proper check for derivative sampler validation 2024-04-19 21:05:52 +10:00
Astrash 142d364682 WIP fractal-gavoro-pseudoerosion 2024-04-19 20:55:14 +10:00
Zoë Gidiere 01e011a9ed UX tweaks to biome config 2024-03-28 14:47:12 -05:00
Zoë 94949c9120 Merge pull request #449 from Browsit/ver/6.5.0
Prevent exception with other world generators
2024-02-23 14:58:51 +00:00
Browsit c52ad56ccc Return null for empty generator IDs 2024-02-02 08:15:37 -05:00
Astrash f3476c5cc8 Add feature stage blending 2024-01-07 17:02:08 +11:00
Astrash 9c181f7ee1 Add ability to disable slant palettes globally 2024-01-06 09:13:02 +11:00
Astrash 271e7f3c69 Fix empty slant holders attempting to calculate slant
This occurs when the NoiseChunkGenerator3D#getSlant method is invoked at
a position where the biome has an empty slant holder, currently possible
when using the slant locator addon.

This is fixed by making slant calculation independent of SlantHolders.
Some minor refactoring has also been done as a result of this change.
2024-01-05 18:42:35 +11:00
Zoë 6681bdfbf2 Merge remote-tracking branch 'origin/master' into ver/6.5.0 2023-12-24 22:39:06 -06:00
dfsek ab60f14ff1 Merge pull request #444 from PolyhedralDev/dev/fix-lerp
6.4.3 - Fix lerp (urgent)
2023-12-24 02:15:54 -07:00
dfsek d8ba9e1016 bump version 2023-12-24 02:06:11 -07:00
dfsek 3622003a39 fix other lerp issues 2023-12-24 02:02:46 -07:00
dfsek 84cd96ecf7 fix BrownianMotionSampler lerp usage 2023-12-24 01:53:05 -07:00
Zoë 8afda7424c Merge branch 'master' into ver/6.5.0 2023-12-22 15:02:53 -06:00
Zoë da4ab8b71c Merge pull request #441 from PolyhedralDev/ver/6.4.2
Ver/6.4.2
2023-12-18 13:01:36 -07:00
Zoë Gidiere 3745c3e947 fix typos 2023-12-17 15:32:35 -07:00
Zoë Gidiere fd20837b55 fix error on startup 2023-12-17 15:29:18 -07:00
Zoë Gidiere 0091e5b785 spell check 2023-12-10 18:50:40 -07:00
Zoë Gidiere 41045ae8aa literally forgor the most important part 2023-12-10 18:47:12 -07:00
Zoë Gidiere 4a83f01c1f fix incase mods are used 2023-12-10 18:44:26 -07:00
Zoë Gidiere fc764a0fb3 fix issues with spawners and entity parsing 2023-12-10 18:40:43 -07:00
Zoë Gidiere 22c46f2f80 Pin OWConfig Version 2023-12-10 17:45:52 -07:00
Zoë Gidiere f408faaa80 reformat 2023-12-10 17:07:18 -07:00
Zoë Gidiere 0ad7ee4f9f fix CME 2023-12-10 16:57:27 -07:00
Zoë Gidiere 1e55074cfa Enforce NMS bindings 2023-12-10 15:46:00 -07:00
Zoë 2a92d76276 Merge pull request #437 from PolyhedralDev/dev/1.20.3
Dev/1.20.3
2023-12-09 15:13:11 -07:00
Zoë Gidiere 687ad5db59 Final dep update
confirmed working on paper and fabric
2023-12-09 15:00:46 -07:00
Zoë Gidiere f9c9789016 remove unused maven repo 2023-12-09 01:16:38 -07:00
Zoë Gidiere 3142c2a4f0 update paper to 1.20.4 2023-12-08 22:57:01 -07:00
Zoë Gidiere b5532b7679 Merge branch 'ver/6.4.2' into dev/1.20.3 2023-12-08 22:31:12 -07:00
Zoë Gidiere 8af299d09c fix path of vale ignore 2023-12-08 22:31:04 -07:00
Zoë Gidiere 5cf8a5061d Merge branch 'ver/6.4.2' into dev/1.20.3 2023-12-08 22:11:57 -07:00
Zoë Gidiere 017876475e Add Vale config to gitignore 2023-12-08 22:11:48 -07:00
Zoë Gidiere d88e4f1f9b fix stupid error
thank you caffeine mc peeps
2023-12-08 19:57:05 -07:00
Zoë Gidiere 17eac505a0 Merge branch 'ver/6.4.2' into dev/1.20.3 2023-12-07 11:29:31 -07:00
Zoë Gidiere 8043814138 pull up version range of fabric 2023-12-07 11:29:19 -07:00
Zoë Gidiere 554887ab54 build fabric against 1.20.4 2023-12-07 11:27:06 -07:00
Zoë Gidiere 2f46a01adc Merge remote-tracking branch 'origin/master' into ver/6.4.2 2023-12-07 00:34:00 -07:00
Zoë Gidiere a1db0574e9 Merge branch 'ver/6.4.2' into dev/1.20.3 2023-12-07 00:33:45 -07:00
Zoë fd6decc706 Merge pull request #439 from PolyhedralDev/dev/github-actions
Create gradle-build.yml
2023-12-06 23:11:33 -07:00
Zoë Gidiere 0ba0d472e6 seems arch loom auto uses vineflower now 2023-12-06 22:47:35 -07:00
Zoë Gidiere 11b03eb93d actually bump bukkit version 2023-12-06 22:27:26 -07:00
Zoë Gidiere 46ca45cb1d fix bukkit build 2023-12-06 22:25:53 -07:00
Zoë Gidiere 4e5b066b91 add bukkit grass workaround 2023-12-06 22:24:55 -07:00
Zoë Gidiere db8df9741f bukkit 1.20.3 2023-12-06 22:22:18 -07:00
Zoë Gidiere 80c52870f5 add additional spigot warning 2023-12-06 12:00:03 -07:00
Zoë Gidiere 5048bc8ede Remove folialib 2023-12-06 10:52:31 -07:00
Zoë Gidiere fc0d7374e4 remove old bukkit versions 2023-12-06 10:14:43 -07:00
Zoë Gidiere e4c3affb9f pull up version range 2023-12-05 20:11:00 -07:00
Zoë Gidiere e160cae3d8 reformat 2023-12-05 20:04:08 -07:00
Zoë Gidiere cb9aa4f167 fix permissions 2023-12-05 19:53:05 -07:00
Zoë Gidiere b612d1c7aa fix name 2023-12-05 19:52:50 -07:00
Zoë Gidiere e4df8dce1d proper gradle cache 2023-12-05 19:52:12 -07:00
Zoë Gidiere 601d174720 pin versions and remove dead lines 2023-12-05 19:44:00 -07:00
Zoë 3339d08e11 Create gradle-build.yml 2023-12-05 19:35:23 -07:00
Zoë Gidiere bc65015af0 update gradle 2023-12-05 18:53:19 -07:00
Zoë Gidiere 913637b0a5 update deps 2023-12-05 18:29:43 -07:00
Zoë Gidiere 86f2356cc8 Merge branch 'ver/6.4.2' into ver/6.5.0 2023-11-27 17:55:40 -07:00
Zoë 55d09818f7 Merge pull request #436 from PolyhedralDev/dev/flatten-biome-array
Dev/flatten biome array
2023-11-27 17:54:38 -07:00
Zoë Gidiere aecdcd578c initial 1.20.3
also disable forge. we're not publishing it anyway
2023-11-27 13:35:48 -07:00
Zoë Gidiere 382069b094 Bump Version to 6.4.2 2023-11-27 11:35:06 -07:00
Zoë Gidiere 734d4bfb94 reformat 2023-11-27 11:31:20 -07:00
Zoë Gidiere c82e015559 flatten array for pipeline biomes 2023-11-27 11:31:11 -07:00
Astrash ffb1198da2 Merge branch 'master' into ver/6.5.0 2023-11-25 12:33:51 +11:00
Astrash 2c211f0aa6 Merge branch 'master' into ver/6.5.0 2023-11-25 12:29:54 +11:00
Astrashh 3aef977384 Patch version 6.4.1 (#435)
* Bump version to 6.4.1

* fix fabric dev env

* Invert exposed ore logic (#433)

* Invert exposed ore logic

* Bump ore addon version

* Use logger in Gradle over println (#434)

* Log info instead of println in gradle scripts

* Missed buildSrc printlns

---------

Co-authored-by: Zoë <duplexsys@protonmail.com>
2023-11-25 01:02:45 +00:00
Zoë 6060ceae57 Merge pull request #432 from PolyhedralDev/dev/codeowners
update condeowners
2023-11-18 10:05:10 +00:00
Zoë Gidiere e499ddebd4 update condeowners 2023-11-17 13:34:56 -07:00
695 changed files with 9190 additions and 1852 deletions
+7 -12
View File
@@ -1,19 +1,14 @@
# Global owners, automatically request review when pull request is submitted
* @dfsek @solonovamax
* @dfsek @solonovamax @duplexsystem @astrsh @justaureus
# Platforms
## dfsek wrote the majority of the platform impls
/platforms/bukkit/ @dfsek
/platforms/fabric/ @dfsek
/platforms/forge/ @dfsek
/platforms/sponge/ @dfsek
## solonovamax is working on the region generator (unless duplexsystem takes it over)
/platforms/region/ @solonovamax
/platforms/ @dfsek @solonovamax @duplexsystem @justaureus
/platforms/bukkit @dfsek @solonovamax @duplexsystem @justaureus @OakLoaf
# Common
/common/ @dfsek @solonovamax
/common/ @dfsek @solonovamax @duplexsystem @astrsh
# Gradle Stuff
## Most gradle stuff was written by solonovamax
/buildSrc/ @solonovamax
*.gradle.kts @solonovamax
/buildSrc/ @dfsek @solonovamax @duplexsystem
*.gradle.kts @dfsek @solonovamax @duplexsystem
/gradle/ @dfsek @solonovamax @duplexsystem
+47
View File
@@ -0,0 +1,47 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
name: Gradle Build
on: [ pull_request ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up JDK 21
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
java-version: '21'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- uses: burrunan/gradle-cache-action@03c71a8ba93d670980695505f48f49daf43704a6
name: Build Terra
with:
# Specifies arguments for Gradle execution
# If arguments is missing or empty, then Gradle is not executed
arguments: build
# arguments can be multi-line for better readability
# arguments: |
# --no-paralell
# build
# -x test
# Gradle version to use for execution:
# wrapper (default), current, rc, nightly, release-nightly, or
# versions like 6.6 (see https://services.gradle.org/versions/all)
gradle-version: wrapper
# Properties are passed as -Pname=value
properties: |
kotlin.js.compiler=ir
kotlin.parallel.tasks.in.project=true
+2
View File
@@ -249,3 +249,5 @@ nbdist/
platforms/**/run/**
#Vale Config File
**/.vale.ini
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020-2023 Polyhedral Development
Copyright (c) 2020-2024 Polyhedral Development
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+5 -4
View File
@@ -1,8 +1,8 @@
preRelease(true)
versionProjects(":common:api", version("6.5.0"))
versionProjects(":common:implementation", version("6.5.0"))
versionProjects(":platforms", version("6.5.0"))
versionProjects(":common:api", version("6.6.0"))
versionProjects(":common:implementation", version("6.6.0"))
versionProjects(":platforms", version("6.6.0"))
allprojects {
@@ -15,6 +15,7 @@ allprojects {
tasks.withType<JavaCompile>().configureEach {
options.isFork = true
options.isIncremental = true
options.release.set(21)
}
tasks.withType<Test>().configureEach {
@@ -44,7 +45,7 @@ afterEvaluate {
}
project(":platforms:bukkit:common").configureDistribution()
forSubProjects(":common:addons") {
apply(plugin = "com.github.johnrengelman.shadow")
apply(plugin = "com.gradleup.shadow")
tasks.named("build") {
finalizedBy(tasks.named("shadowJar"))
+7 -7
View File
@@ -9,18 +9,18 @@ repositories {
maven("https://repo.codemc.org/repository/maven-public") {
name = "CodeMC"
}
maven("https://papermc.io/repo/repository/maven-public/") {
maven("https://repo.papermc.io/repository/maven-public/") {
name = "PaperMC"
}
}
dependencies {
//TODO Allow pulling from Versions.kt
implementation("com.github.johnrengelman", "shadow", "8.1.1")
implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "1.5.6")
implementation("com.gradleup.shadow", "shadow-gradle-plugin", "8.3.1")
implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "1.7.2")
implementation("org.ow2.asm", "asm", "9.5")
implementation("org.ow2.asm", "asm-tree", "9.5")
implementation("com.dfsek.tectonic", "common", "4.2.0")
implementation("org.yaml", "snakeyaml", "2.2")
implementation("org.ow2.asm", "asm", "9.7")
implementation("org.ow2.asm", "asm-tree", "9.7")
implementation("com.dfsek.tectonic", "common", "4.2.1")
implementation("org.yaml", "snakeyaml", "2.3")
}
+2 -2
View File
@@ -18,7 +18,7 @@ fun Project.addonDir(dir: File, task: Task) {
matchingAddons(dir) {
it.name.startsWith("Terra-") // Assume everything that starts with Terra- is a core addon.
}.forEach {
println("Deleting old addon: " + it.absolutePath)
logger.info("Deleting old addon: " + it.absolutePath)
it.delete()
}
forSubProjects(":common:addons") {
@@ -29,7 +29,7 @@ fun Project.addonDir(dir: File, task: Task) {
val base = "${jar.archiveBaseName.get()}-${version}"
println("Copying addon ${jar.archiveFileName.get()} to ${target.absolutePath}. Base name: $base")
logger.info("Copying addon ${jar.archiveFileName.get()} to ${target.absolutePath}. Base name: $base")
jar.archiveFile.orNull?.asFile?.copyTo(target)
}
@@ -22,8 +22,8 @@ fun Project.configureCompilation() {
apply<TectonicDocPlugin>()
configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
tasks.withType<JavaCompile> {
+17 -8
View File
@@ -36,7 +36,7 @@ fun Project.configureDependencies() {
maven("https://repo.codemc.org/repository/maven-public") {
name = "CodeMC"
}
maven("https://papermc.io/repo/repository/maven-public/") {
maven("https://repo.papermc.io/repository/maven-public/") {
name = "PaperMC"
}
maven("https://files.minecraftforge.net/maven/") {
@@ -48,17 +48,26 @@ fun Project.configureDependencies() {
maven("https://jitpack.io") {
name = "JitPack"
}
maven("https://nexuslite.gcnt.net/repos/other/") {
name = "GCNT"
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") {
name = "Sonatype Snapshots"
}
maven("https://repo.opencollab.dev/maven-releases/") {
name = "OpenCollab Releases"
}
maven("https://repo.opencollab.dev/maven-snapshots/") {
name = "OpenCollab Snapshots"
}
maven("https://storehouse.okaeri.eu/repository/maven-public/") {
name = "Okaeri"
}
}
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.7.0")
compileOnly("org.jetbrains:annotations:23.0.0")
testImplementation("org.junit.jupiter", "junit-jupiter-api", Versions.Libraries.Internal.junit)
testImplementation("org.junit.jupiter", "junit-jupiter-engine", Versions.Libraries.Internal.junit)
compileOnly("org.jetbrains", "annotations", Versions.Libraries.Internal.jetBrainsAnnotations)
compileOnly("com.google.guava:guava:30.0-jre")
testImplementation("com.google.guava:guava:30.0-jre")
compileOnly("com.google.guava", "guava", Versions.Libraries.Internal.guava)
testImplementation("com.google.guava", "guava", Versions.Libraries.Internal.guava)
}
}
@@ -21,13 +21,14 @@ import kotlin.io.path.exists
fun Project.configureDistribution() {
apply(plugin = "com.github.johnrengelman.shadow")
apply(plugin = "com.gradleup.shadow")
val downloadDefaultPacks = tasks.create("downloadDefaultPacks") {
group = "terra"
doFirst {
file("${buildDir}/resources/main/packs/").deleteRecursively()
val defaultPackUrl = URL("https://github.com/PolyhedralDev/TerraOverworldConfig/releases/download/latest/default.zip")
val defaultPackUrl =
URL("https://github.com/PolyhedralDev/TerraOverworldConfig/releases/download/" + Versions.Terra.overworldConfig + "/default.zip")
downloadPack(defaultPackUrl, project)
}
}
@@ -53,7 +54,7 @@ fun Project.configureDistribution() {
forSubProjects(":common:addons") {
val jar = getJarTask()
println("Packaging addon ${jar.archiveFileName.get()} to $dest. size: ${jar.archiveFile.get().asFile.length() / 1024}KB")
logger.info("Packaging addon ${jar.archiveFileName.get()} to $dest. size: ${jar.archiveFile.get().asFile.length() / 1024}KB")
val boot = if (extra.has("bootstrap") && extra.get("bootstrap") as Boolean) "bootstrap/" else ""
val addonPath = fs.getPath("/addons/$boot${jar.archiveFileName.get()}")
@@ -132,7 +133,6 @@ fun Project.configureDistribution() {
version = project.version
relocate("org.apache.commons", "com.dfsek.terra.lib.commons")
relocate("org.objectweb.asm", "com.dfsek.terra.lib.asm")
relocate("com.dfsek.paralithic", "com.dfsek.terra.lib.paralithic")
relocate("org.json", "com.dfsek.terra.lib.json")
relocate("org.yaml", "com.dfsek.terra.lib.yaml")
+2 -2
View File
@@ -42,10 +42,10 @@ fun preRelease(preRelease: Boolean) {
fun Project.versionProjects(project: String, version: String) {
forSubProjects(project) {
this.version = version
println("Setting version of $path to $version")
logger.info("Setting version of $path to $version")
}
project(project).version = version
println("Setting version of $project to $version")
logger.info("Setting version of $project to $version")
}
fun Project.version(version: String): String {
+47 -34
View File
@@ -1,26 +1,35 @@
object Versions {
object Terra {
const val overworldConfig = "v1.3.4"
}
object Libraries {
const val tectonic = "4.2.1"
const val paralithic = "0.7.1"
const val paralithic = "0.8.1"
const val strata = "1.3.2"
const val cloud = "1.8.4"
const val cloud = "2.0.0"
const val slf4j = "2.0.9"
const val log4j_slf4j_impl = "2.20.0"
const val caffeine = "3.1.8"
const val slf4j = "2.0.16"
object Internal {
const val shadow = "8.1.1"
const val apacheText = "1.10.0"
const val apacheIO = "2.14.0"
const val guava = "32.1.3-jre"
const val asm = "9.5"
const val snakeYml = "2.2"
const val shadow = "8.3.3"
const val apacheText = "1.12.0"
const val apacheIO = "2.17.0"
const val guava = "33.3.1-jre"
const val asm = "9.7.1"
const val snakeYml = "2.3"
const val jetBrainsAnnotations = "26.0.1"
const val junit = "5.11.3"
const val nbt = "6.1"
}
}
object Fabric {
const val fabricAPI = "0.90.0+${Mod.minecraft}"
const val fabricAPI = "0.106.1+${Mod.minecraft}"
const val cloud = "2.0.0-beta.9"
}
//
// object Quilt {
@@ -29,32 +38,32 @@ object Versions {
// }
object Mod {
const val mixin = "0.12.5+mixin.0.8.5"
const val mixin = "0.15.3+mixin.0.8.7"
const val minecraft = "1.20.2"
const val yarn = "$minecraft+build.4"
const val fabricLoader = "0.14.23"
const val minecraft = "1.21.3"
const val yarn = "$minecraft+build.2"
const val fabricLoader = "0.16.7"
const val architecuryLoom = "1.3.357"
const val architecturyPlugin = "3.4.146"
const val loomVineflower = "1.11.0"
}
object Forge {
const val forge = "${Mod.minecraft}-48.0.13"
const val burningwave = "12.63.0"
const val architecuryLoom = "1.7.413"
const val architecturyPlugin = "3.4.159"
}
//
// object Forge {
// const val forge = "${Mod.minecraft}-48.0.13"
// const val burningwave = "12.63.0"
// }
object Bukkit {
const val paper = "1.18.2-R0.1-SNAPSHOT"
const val paperLib = "1.0.5"
const val foliaLib = "0.2.5"
const val minecraft = "1.20.2"
const val reflectionRemapper = "0.1.0-SNAPSHOT"
const val paperDevBundle = "1.20.2-R0.1-SNAPSHOT"
const val runPaper = "2.2.0"
const val paperWeight = "1.5.6"
const val minecraft = "1.21.3"
const val paperBuild = "$minecraft-R0.1-20241025.163321-1"
const val paper = paperBuild
const val paperLib = "1.0.8"
const val reflectionRemapper = "0.1.1"
const val paperDevBundle = paperBuild
const val runPaper = "2.3.1"
const val paperWeight = "1.7.2"
const val cloud = "2.0.0-beta.10"
}
//
@@ -65,7 +74,11 @@ object Versions {
// }
//
object CLI {
const val nbt = "6.1"
const val logback = "1.4.11"
const val logback = "1.5.8"
const val picocli = "4.7.6"
}
object Allay {
const val api = "0114e0b290"
}
}
@@ -82,7 +82,7 @@ abstract class GenerateDocsTask : DefaultTask() {
}
template.add(keyName.toString(), description.toString().ifBlank {
println("No description provided for field " + field.name + " in class " + name)
logger.info("No description provided for field " + field.name + " in class " + name)
"*No description provided.*"
})
}
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020-2023 Polyhedral Development
Copyright (c) 2020-2024 Polyhedral Development
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,9 +1,9 @@
package com.dfsek.terra.addons.biome.extrusion.api;
import java.util.Collection;
import com.dfsek.terra.api.world.biome.Biome;
import java.util.Collection;
public interface Extrusion {
Biome extrude(Biome original, int x, int y, int z, long seed);
@@ -1,5 +1,9 @@
package com.dfsek.terra.addons.biome.extrusion.extrusions;
import java.util.Collection;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import com.dfsek.terra.addons.biome.extrusion.api.Extrusion;
import com.dfsek.terra.addons.biome.extrusion.api.ReplaceableBiome;
import com.dfsek.terra.addons.biome.query.api.BiomeQueries;
@@ -8,10 +12,6 @@ import com.dfsek.terra.api.util.Range;
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
import com.dfsek.terra.api.world.biome.Biome;
import java.util.Collection;
import java.util.function.Predicate;
import java.util.stream.Collectors;
/**
* Sets biomes at locations based on a sampler.
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020-2023 Polyhedral Development
Copyright (c) 2020-2024 Polyhedral Development
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -7,13 +7,13 @@
package com.dfsek.terra.addons.biome.image.v2;
import java.util.Optional;
import com.dfsek.terra.addons.image.colorsampler.ColorSampler;
import com.dfsek.terra.addons.image.converter.ColorConverter;
import com.dfsek.terra.api.world.biome.Biome;
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
import java.util.Optional;
public class ImageBiomeProvider implements BiomeProvider {
private final int resolution;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020-2023 Polyhedral Development
Copyright (c) 2020-2024 Polyhedral Development
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020-2023 Polyhedral Development
Copyright (c) 2020-2024 Polyhedral Development
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,7 @@
package com.dfsek.terra.addons.biome.pipeline.v2;
import com.dfsek.terra.api.util.cache.SeededVector2Key;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache;
@@ -11,7 +13,6 @@ import java.util.stream.StreamSupport;
import com.dfsek.terra.addons.biome.pipeline.v2.api.BiomeChunk;
import com.dfsek.terra.addons.biome.pipeline.v2.api.Pipeline;
import com.dfsek.terra.addons.biome.pipeline.v2.api.SeededVector;
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
import com.dfsek.terra.api.noise.NoiseSampler;
@@ -23,7 +24,7 @@ import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
public class PipelineBiomeProvider implements BiomeProvider {
private final LoadingCache<SeededVector, BiomeChunk> biomeChunkCache;
private final LoadingCache<SeededVector2Key, BiomeChunk> biomeChunkCache;
private final int chunkSize;
private final int resolution;
private final NoiseSampler mutator;
@@ -90,7 +91,7 @@ public class PipelineBiomeProvider implements BiomeProvider {
int xInChunk = x - chunkWorldX;
int zInChunk = z - chunkWorldZ;
return biomeChunkCache.get(new SeededVector(seed, chunkWorldX, chunkWorldZ)).get(xInChunk, zInChunk).getBiome();
return biomeChunkCache.get(new SeededVector2Key(chunkWorldX, chunkWorldZ, seed)).get(xInChunk, zInChunk).getBiome();
}
@Override
@@ -1,10 +1,12 @@
package com.dfsek.terra.addons.biome.pipeline.v2.api;
import com.dfsek.terra.api.util.cache.SeededVector2Key;
import java.util.List;
public interface Pipeline {
BiomeChunk generateChunk(SeededVector worldCoordinates);
BiomeChunk generateChunk(SeededVector2Key worldCoordinates);
int getChunkSize();
@@ -1,19 +0,0 @@
package com.dfsek.terra.addons.biome.pipeline.v2.api;
public record SeededVector(long seed, int x, int z) {
@Override
public boolean equals(Object obj) {
if(obj instanceof SeededVector that) {
return this.z == that.z && this.x == that.x && this.seed == that.seed;
}
return false;
}
@Override
public int hashCode() {
int code = x;
code = 31 * code + z;
return 31 * code + ((int) (seed ^ (seed >>> 32)));
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -29,7 +29,7 @@ public class BiomePipelineTemplate implements ObjectTemplate<BiomeProvider> {
@Default
@Description("""
The resolution at which to sample biomes.
Larger values are quadratically faster, but produce lower quality results.
For example, a value of 3 would sample every 3 blocks.""")
protected @Meta int resolution = 1;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -4,32 +4,33 @@ import java.util.List;
import com.dfsek.terra.addons.biome.pipeline.v2.api.BiomeChunk;
import com.dfsek.terra.addons.biome.pipeline.v2.api.Expander;
import com.dfsek.terra.addons.biome.pipeline.v2.api.SeededVector;
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
import com.dfsek.terra.api.util.cache.SeededVector2Key;
public class BiomeChunkImpl implements BiomeChunk {
private final SeededVector worldOrigin;
private final SeededVector2Key worldOrigin;
private final int chunkOriginArrayIndex;
private final int worldCoordinateScale;
private PipelineBiome[][] biomes;
private final int size;
private PipelineBiome[] biomes;
public BiomeChunkImpl(SeededVector worldOrigin, PipelineImpl pipeline) {
public BiomeChunkImpl(SeededVector2Key worldOrigin, PipelineImpl pipeline) {
this.worldOrigin = worldOrigin;
this.chunkOriginArrayIndex = pipeline.getChunkOriginArrayIndex();
this.worldCoordinateScale = pipeline.getResolution();
int size = pipeline.getArraySize();
this.size = pipeline.getArraySize();
int expanderCount = pipeline.getExpanderCount();
int expansionsApplied = 0;
// Allocate working arrays
this.biomes = new PipelineBiome[size][size];
PipelineBiome[][] lookupArray = new PipelineBiome[size][size];
this.biomes = new PipelineBiome[size * size];
PipelineBiome[] lookupArray = new PipelineBiome[size * size];
// A second lookup array is required such that stage application doesn't affect lookups, otherwise application may cascade
// Construct working grid
@@ -43,7 +44,7 @@ public class BiomeChunkImpl implements BiomeChunk {
for(int gridZ = 0; gridZ < gridSize; gridZ++) {
int xIndex = gridOrigin + gridX * gridInterval;
int zIndex = gridOrigin + gridZ * gridInterval;
biomes[xIndex][zIndex] = pipeline.getSource().get(worldOrigin.seed(), xIndexToWorldCoordinate(xIndex),
biomes[(xIndex * size) + zIndex] = pipeline.getSource().get(worldOrigin.seed, xIndexToWorldCoordinate(xIndex),
zIndexToWorldCoordinate(zIndex));
}
}
@@ -65,7 +66,7 @@ public class BiomeChunkImpl implements BiomeChunk {
// Cycle arrays, the previously populated array is swapped to be used for lookups, and the result of the stage application
// overwrites the previous lookup array. This saves having to allocate a new array copy each time
PipelineBiome[][] tempArray = biomes;
PipelineBiome[] tempArray = biomes;
biomes = lookupArray;
lookupArray = tempArray;
@@ -74,7 +75,8 @@ public class BiomeChunkImpl implements BiomeChunk {
for(int gridX = 0; gridX < gridSize; gridX = gridX + 1) {
int xIndex = gridOrigin + gridX * gridInterval;
int zIndex = gridOrigin + gridZ * gridInterval;
biomes[xIndex][zIndex] = stage.apply(new ViewPoint(this, gridInterval, gridX, gridZ, xIndex, zIndex, lookupArray));
biomes[(xIndex * size) + zIndex] = stage.apply(
new ViewPoint(this, gridInterval, gridX, gridZ, xIndex, zIndex, lookupArray, size));
}
}
}
@@ -133,18 +135,18 @@ public class BiomeChunkImpl implements BiomeChunk {
public PipelineBiome get(int xInChunk, int zInChunk) {
int xIndex = xInChunk + chunkOriginArrayIndex;
int zIndex = zInChunk + chunkOriginArrayIndex;
return biomes[xIndex][zIndex];
return biomes[(xIndex * size) + zIndex];
}
private int xIndexToWorldCoordinate(int xIndex) {
return (worldOrigin.x() + xIndex - chunkOriginArrayIndex) * worldCoordinateScale;
return (worldOrigin.x + xIndex - chunkOriginArrayIndex) * worldCoordinateScale;
}
private int zIndexToWorldCoordinate(int zIndex) {
return (worldOrigin.z() + zIndex - chunkOriginArrayIndex) * worldCoordinateScale;
return (worldOrigin.z + zIndex - chunkOriginArrayIndex) * worldCoordinateScale;
}
private SeededVector getOrigin() {
private SeededVector2Key getOrigin() {
return worldOrigin;
}
@@ -159,10 +161,11 @@ public class BiomeChunkImpl implements BiomeChunk {
private final int gridZ;
private final int xIndex;
private final int zIndex;
private final PipelineBiome[][] lookupArray;
private final PipelineBiome[] lookupArray;
private final int size;
private ViewPoint(BiomeChunkImpl chunk, int gridInterval, int gridX, int gridZ, int xIndex, int zIndex,
PipelineBiome[][] lookupArray) {
PipelineBiome[] lookupArray, int size) {
this.chunk = chunk;
this.gridInterval = gridInterval;
this.gridX = gridX;
@@ -170,13 +173,14 @@ public class BiomeChunkImpl implements BiomeChunk {
this.xIndex = xIndex;
this.zIndex = zIndex;
this.lookupArray = lookupArray;
this.biome = lookupArray[xIndex][zIndex];
this.size = size;
this.biome = lookupArray[(this.xIndex * this.size) + this.zIndex];
}
public PipelineBiome getRelativeBiome(int x, int z) {
int lookupXIndex = this.xIndex + x * gridInterval;
int lookupZIndex = this.zIndex + z * gridInterval;
return lookupArray[lookupXIndex][lookupZIndex];
return lookupArray[(lookupXIndex * this.size) + lookupZIndex];
}
public PipelineBiome getBiome() {
@@ -212,7 +216,7 @@ public class BiomeChunkImpl implements BiomeChunk {
}
public long worldSeed() {
return chunk.getOrigin().seed();
return chunk.getOrigin().seed;
}
}
}
@@ -1,5 +1,7 @@
package com.dfsek.terra.addons.biome.pipeline.v2.pipeline;
import com.dfsek.terra.api.util.cache.SeededVector2Key;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -8,7 +10,6 @@ import java.util.List;
import com.dfsek.terra.addons.biome.pipeline.v2.api.BiomeChunk;
import com.dfsek.terra.addons.biome.pipeline.v2.api.Expander;
import com.dfsek.terra.addons.biome.pipeline.v2.api.Pipeline;
import com.dfsek.terra.addons.biome.pipeline.v2.api.SeededVector;
import com.dfsek.terra.addons.biome.pipeline.v2.api.Source;
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
@@ -55,7 +56,7 @@ public class PipelineImpl implements Pipeline {
}
@Override
public BiomeChunk generateChunk(SeededVector worldCoordinates) {
public BiomeChunk generateChunk(SeededVector2Key worldCoordinates) {
return new BiomeChunkImpl(worldCoordinates, this);
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020-2023 Polyhedral Development
Copyright (c) 2020-2024 Polyhedral Development
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -28,7 +28,7 @@ public class BiomePipelineTemplate extends BiomeProviderTemplate {
@Description("""
The initial size of biome chunks. This value must be at least 2.
<b>This is not the final size of biome chunks. Final chunks will be much larger</b>.
It is recommended to keep biome chunks' final size in the range of [50, 300]
to prevent performance issues. To calculate the size of biome chunks, simply
take initial-size and for each expand stage, multiply the running value by 2
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -22,7 +22,7 @@ public abstract class BiomeProviderTemplate implements ObjectTemplate<BiomeProvi
@Default
@Description("""
The resolution at which to sample biomes.
Larger values are quadratically faster, but produce lower quality results.
For example, a value of 3 would sample every 3 blocks.""")
protected @Meta int resolution = 1;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020-2023 Polyhedral Development
Copyright (c) 2020-2024 Polyhedral Development
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020-2023 Polyhedral Development
Copyright (c) 2020-2024 Polyhedral Development
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -13,6 +13,7 @@ import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
import com.dfsek.terra.addons.chunkgenerator.config.palette.BiomePaletteTemplate;
import com.dfsek.terra.addons.chunkgenerator.config.palette.slant.SlantLayerTemplate;
import com.dfsek.terra.addons.chunkgenerator.generation.NoiseChunkGenerator3D;
import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod;
import com.dfsek.terra.addons.chunkgenerator.palette.BiomePaletteInfo;
import com.dfsek.terra.addons.chunkgenerator.palette.slant.SlantHolder;
import com.dfsek.terra.addons.manifest.api.AddonInitializer;
@@ -45,8 +46,8 @@ public class NoiseChunkGenerator3DAddon implements AddonInitializer {
.priority(1000)
.then(event -> {
event.getPack().applyLoader(SlantHolder.CalculationMethod.class,
(type, o, loader, depthTracker) -> SlantHolder.CalculationMethod.valueOf((String) o));
event.getPack().applyLoader(SlantCalculationMethod.class,
(type, o, loader, depthTracker) -> SlantCalculationMethod.valueOf((String) o));
NoiseChunkGeneratorPackConfigTemplate config = event.loadTemplate(new NoiseChunkGeneratorPackConfigTemplate());
event.getPack().getContext().put(config);
@@ -57,7 +58,8 @@ public class NoiseChunkGenerator3DAddon implements AddonInitializer {
pack -> new NoiseChunkGenerator3D(pack, platform, config.getElevationBlend(),
config.getHorizontalRes(),
config.getVerticalRes(), noisePropertiesPropertyKey,
paletteInfoPropertyKey));
paletteInfoPropertyKey, config.getSlantCalculationMethod(),
config.isSlantPalettesEnabled()));
event.getPack()
.applyLoader(SlantHolder.Layer.class, SlantLayerTemplate::new);
})
@@ -4,7 +4,7 @@ import com.dfsek.tectonic.api.config.template.ConfigTemplate;
import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
import com.dfsek.terra.addons.chunkgenerator.palette.slant.SlantHolder;
import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod;
import com.dfsek.terra.api.config.meta.Meta;
import com.dfsek.terra.api.properties.Properties;
@@ -24,7 +24,11 @@ public class NoiseChunkGeneratorPackConfigTemplate implements ConfigTemplate, Pr
@Value("slant.calculation-method")
@Default
private SlantHolder.@Meta CalculationMethod slantCalculationMethod = SlantHolder.CalculationMethod.Derivative;
private @Meta SlantCalculationMethod slantCalculationMethod = SlantCalculationMethod.Derivative;
@Value("slant.disable-palettes")
@Default
private @Meta boolean disableSlantPalettes = false;
public int getElevationBlend() {
return elevationBlend;
@@ -38,7 +42,11 @@ public class NoiseChunkGeneratorPackConfigTemplate implements ConfigTemplate, Pr
return verticalRes;
}
public SlantHolder.CalculationMethod getSlantCalculationMethod() {
public SlantCalculationMethod getSlantCalculationMethod() {
return slantCalculationMethod;
}
public boolean isSlantPalettesEnabled() {
return !disableSlantPalettes;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -16,6 +16,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod;
import com.dfsek.terra.addons.chunkgenerator.palette.BiomePaletteInfo;
import com.dfsek.terra.addons.chunkgenerator.palette.PaletteHolder;
import com.dfsek.terra.addons.chunkgenerator.palette.slant.SlantHolder;
@@ -27,7 +28,7 @@ import com.dfsek.terra.api.world.chunk.generation.util.Palette;
public class BiomePaletteTemplate implements ObjectTemplate<BiomePaletteInfo> {
private final Platform platform;
private final SlantHolder.CalculationMethod slantCalculationMethod;
private final SlantCalculationMethod slantCalculationMethod;
@Value("slant")
@Default
@Description("The slant palettes to use in this biome.")
@@ -56,7 +57,7 @@ public class BiomePaletteTemplate implements ObjectTemplate<BiomePaletteInfo> {
@Default
private @Meta boolean updatePalette = false;
public BiomePaletteTemplate(Platform platform, SlantHolder.CalculationMethod slantCalculationMethod) {
public BiomePaletteTemplate(Platform platform, SlantCalculationMethod slantCalculationMethod) {
this.platform = platform;
this.slantCalculationMethod = slantCalculationMethod;
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -11,11 +11,12 @@ package com.dfsek.terra.addons.chunkgenerator.generation;
import org.jetbrains.annotations.NotNull;
import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
import com.dfsek.terra.addons.chunkgenerator.generation.math.PaletteUtil;
import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod;
import com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation.LazilyEvaluatedInterpolator;
import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.Sampler3D;
import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.SamplerProvider;
import com.dfsek.terra.addons.chunkgenerator.palette.BiomePaletteInfo;
import com.dfsek.terra.addons.chunkgenerator.palette.slant.SlantHolder;
import com.dfsek.terra.api.Platform;
import com.dfsek.terra.api.block.state.BlockState;
import com.dfsek.terra.api.config.ConfigPack;
@@ -42,16 +43,23 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
private final PropertyKey<BiomePaletteInfo> paletteInfoPropertyKey;
private final PropertyKey<BiomeNoiseProperties> noisePropertiesKey;
private final SlantCalculationMethod slantCalculationMethod;
private final boolean useSlantPalettes;
public NoiseChunkGenerator3D(ConfigPack pack, Platform platform, int elevationBlend, int carverHorizontalResolution,
int carverVerticalResolution,
PropertyKey<BiomeNoiseProperties> noisePropertiesKey,
PropertyKey<BiomePaletteInfo> paletteInfoPropertyKey) {
PropertyKey<BiomePaletteInfo> paletteInfoPropertyKey,
SlantCalculationMethod slantCalculationMethod, boolean useSlantPalettes) {
this.platform = platform;
this.air = platform.getWorldHandle().air();
this.carverHorizontalResolution = carverHorizontalResolution;
this.carverVerticalResolution = carverVerticalResolution;
this.paletteInfoPropertyKey = paletteInfoPropertyKey;
this.noisePropertiesKey = noisePropertiesKey;
this.slantCalculationMethod = slantCalculationMethod;
this.useSlantPalettes = useSlantPalettes;
int maxBlend = pack
.getBiomeProvider()
.stream()
@@ -63,6 +71,17 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
this.samplerCache = new SamplerProvider(platform, elevationBlend, noisePropertiesKey, maxBlend);
}
private Palette paletteAt(int x, int y, int z, Sampler3D sampler, BiomePaletteInfo paletteInfo, int depth) {
SlantHolder slantHolder = paletteInfo.slantHolder();
if(useSlantPalettes && slantHolder.isAboveDepth(depth)) {
double slant = slantCalculationMethod.slant(sampler, x, y, z);
if(slantHolder.isInSlantThreshold(slant)) {
return slantHolder.getPalette(slant).getPalette(y);
}
}
return paletteInfo.paletteHolder().getPalette(y);
}
@Override
@SuppressWarnings("try")
public void generateChunkData(@NotNull ProtoChunk chunk, @NotNull WorldProperties world,
@@ -103,8 +122,7 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
if(sampler.sample(x, y, z) > 0) {
if(carver.sample(x, y, z) <= 0) {
data = PaletteUtil
.getPalette(x, y, z, sampler, paletteInfo, paletteLevel)
data = paletteAt(x, y, z, sampler, paletteInfo, paletteLevel)
.get(paletteLevel, cx, y, cz, seed);
chunk.setBlock(x, y, z, data);
paletteLevel++;
@@ -135,7 +153,7 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
int fdX = Math.floorMod(x, 16);
int fdZ = Math.floorMod(z, 16);
Palette palette = PaletteUtil.getPalette(fdX, y, fdZ, sampler, paletteInfo, 0);
Palette palette = paletteAt(fdX, y, fdZ, sampler, paletteInfo, 0);
double noise = sampler.sample(fdX, y, fdZ);
if(noise > 0) {
int level = 0;
@@ -157,11 +175,8 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
public double getSlant(int x, int y, int z, WorldProperties world, BiomeProvider biomeProvider) {
int fdX = Math.floorMod(x, 16);
int fdZ = Math.floorMod(z, 16);
return biomeProvider.getBiome(x, y, z, world.getSeed())
.getContext()
.get(paletteInfoPropertyKey)
.slantHolder()
.calculateSlant(samplerCache.get(x, z, world, biomeProvider), fdX, y, fdZ);
Sampler3D sampler = samplerCache.get(x, z, world, biomeProvider);
return slantCalculationMethod.slant(sampler, fdX, y, fdZ);
}
public SamplerProvider samplerProvider() {
@@ -1,29 +0,0 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
*/
package com.dfsek.terra.addons.chunkgenerator.generation.math;
import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.Sampler3D;
import com.dfsek.terra.addons.chunkgenerator.palette.BiomePaletteInfo;
import com.dfsek.terra.addons.chunkgenerator.palette.slant.SlantHolder;
import com.dfsek.terra.api.world.chunk.generation.util.Palette;
public final class PaletteUtil {
public static Palette getPalette(int x, int y, int z, Sampler3D sampler, BiomePaletteInfo paletteInfo, int depth) {
SlantHolder slantHolder = paletteInfo.slantHolder();
if(slantHolder.isAboveDepth(depth)) {
double slant = slantHolder.calculateSlant(sampler, x, y, z);
if(slantHolder.isInSlantThreshold(slant)) {
return slantHolder.getPalette(slant).getPalette(y);
}
}
return paletteInfo.paletteHolder().getPalette(y);
}
}
@@ -0,0 +1,69 @@
package com.dfsek.terra.addons.chunkgenerator.generation.math;
import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.Sampler3D;
import com.dfsek.terra.api.util.vector.Vector3;
public enum SlantCalculationMethod {
DotProduct {
private static final Vector3 DOT_PRODUCT_DIRECTION = Vector3.of(0, 1, 0);
private static final Vector3[] DOT_PRODUCT_SAMPLE_POINTS = {
Vector3.of(0, 0, -DERIVATIVE_DIST),
Vector3.of(0, 0, DERIVATIVE_DIST),
Vector3.of(0, -DERIVATIVE_DIST, 0),
Vector3.of(0, DERIVATIVE_DIST, 0),
Vector3.of(-DERIVATIVE_DIST, 0, 0),
Vector3.of(DERIVATIVE_DIST, 0, 0)
};
@Override
public double slant(Sampler3D sampler, double x, double y, double z) {
Vector3.Mutable normalApproximation = Vector3.Mutable.of(0, 0, 0);
for(Vector3 point : DOT_PRODUCT_SAMPLE_POINTS) {
var scalar = -sampler.sample(x + point.getX(), y + point.getY(), z + point.getZ());
normalApproximation.add(point.mutable().multiply(scalar));
}
return DOT_PRODUCT_DIRECTION.dot(normalApproximation.normalize());
}
@Override
public boolean floorToThreshold() {
return false;
}
},
Derivative {
@Override
public double slant(Sampler3D sampler, double x, double y, double z) {
double baseSample = sampler.sample(x, y, z);
double xVal1 = (sampler.sample(x + DERIVATIVE_DIST, y, z) - baseSample) / DERIVATIVE_DIST;
double xVal2 = (sampler.sample(x - DERIVATIVE_DIST, y, z) - baseSample) / DERIVATIVE_DIST;
double zVal1 = (sampler.sample(x, y, z + DERIVATIVE_DIST) - baseSample) / DERIVATIVE_DIST;
double zVal2 = (sampler.sample(x, y, z - DERIVATIVE_DIST) - baseSample) / DERIVATIVE_DIST;
double yVal1 = (sampler.sample(x, y + DERIVATIVE_DIST, z) - baseSample) / DERIVATIVE_DIST;
double yVal2 = (sampler.sample(x, y - DERIVATIVE_DIST, z) - baseSample) / DERIVATIVE_DIST;
return Math.sqrt(
((xVal2 - xVal1) * (xVal2 - xVal1)) + ((zVal2 - zVal1) * (zVal2 - zVal1)) + ((yVal2 - yVal1) * (yVal2 - yVal1)));
}
@Override
public boolean floorToThreshold() {
return true;
}
};
private static final double DERIVATIVE_DIST = 0.55;
public abstract double slant(Sampler3D sampler, double x, double y, double z);
/*
* Controls whether palettes should be applied before or after their respective thresholds.
*
* If true, slant values will map to the palette of the next floor threshold, otherwise they
* will map to the ceiling.
*/
public abstract boolean floorToThreshold();
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Polyhedral Development
* Copyright (c) 2020-2024 Polyhedral Development
*
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in this module's root directory.
@@ -14,6 +14,7 @@ import java.util.TreeMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod;
import com.dfsek.terra.addons.chunkgenerator.palette.PaletteHolder;
@@ -21,7 +22,7 @@ public class MultipleSlantHolder extends SlantHolderImpl {
private final NavigableMap<Double, PaletteHolder> layers;
private final double slantThreshold;
MultipleSlantHolder(List<SlantHolder.Layer> slant, int slantDepth, CalculationMethod calculationMethod) {
MultipleSlantHolder(List<SlantHolder.Layer> slant, int slantDepth, SlantCalculationMethod calculationMethod) {
super(slantDepth, calculationMethod);
NavigableMap<Double, PaletteHolder> layers = new TreeMap<>(
slant.stream().collect(Collectors.toMap(SlantHolder.Layer::threshold, SlantHolder.Layer::palette)));
@@ -1,5 +1,6 @@
package com.dfsek.terra.addons.chunkgenerator.palette.slant;
import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod;
import com.dfsek.terra.addons.chunkgenerator.palette.PaletteHolder;
@@ -7,7 +8,7 @@ final class SingleSlantHolder extends SlantHolderImpl {
private final SlantHolder.Layer layer;
public SingleSlantHolder(SlantHolder.Layer layer, int slantDepth, CalculationMethod calculationMethod) {
public SingleSlantHolder(SlantHolder.Layer layer, int slantDepth, SlantCalculationMethod calculationMethod) {
super(slantDepth, calculationMethod);
this.layer = layer;
}
@@ -2,19 +2,13 @@ package com.dfsek.terra.addons.chunkgenerator.palette.slant;
import java.util.List;
import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.Sampler3D;
import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod;
import com.dfsek.terra.addons.chunkgenerator.palette.PaletteHolder;
import com.dfsek.terra.api.util.vector.Vector3;
public interface SlantHolder {
SlantHolder EMPTY = new SlantHolder() {
@Override
public double calculateSlant(Sampler3D sampler, double x, double y, double z) {
throw new UnsupportedOperationException("Empty holder should not calculate slant");
}
@Override
public boolean isAboveDepth(int depth) {
return false;
@@ -31,7 +25,7 @@ public interface SlantHolder {
}
};
static SlantHolder of(List<SlantHolder.Layer> layers, int slantDepth, CalculationMethod calculationMethod) {
static SlantHolder of(List<SlantHolder.Layer> layers, int slantDepth, SlantCalculationMethod calculationMethod) {
if(layers.isEmpty()) {
return EMPTY;
} else if(layers.size() == 1) {
@@ -40,8 +34,6 @@ public interface SlantHolder {
return new MultipleSlantHolder(layers, slantDepth, calculationMethod);
}
double calculateSlant(Sampler3D sampler, double x, double y, double z);
boolean isAboveDepth(int depth);
boolean isInSlantThreshold(double slant);
@@ -49,71 +41,6 @@ public interface SlantHolder {
PaletteHolder getPalette(double slant);
enum CalculationMethod {
DotProduct {
private static final Vector3 DOT_PRODUCT_DIRECTION = Vector3.of(0, 1, 0);
private static final Vector3[] DOT_PRODUCT_SAMPLE_POINTS = {
Vector3.of(0, 0, -DERIVATIVE_DIST),
Vector3.of(0, 0, DERIVATIVE_DIST),
Vector3.of(0, -DERIVATIVE_DIST, 0),
Vector3.of(0, DERIVATIVE_DIST, 0),
Vector3.of(-DERIVATIVE_DIST, 0, 0),
Vector3.of(DERIVATIVE_DIST, 0, 0)
};
@Override
public double slant(Sampler3D sampler, double x, double y, double z) {
Vector3.Mutable normalApproximation = Vector3.Mutable.of(0, 0, 0);
for(Vector3 point : DOT_PRODUCT_SAMPLE_POINTS) {
var scalar = -sampler.sample(x + point.getX(), y + point.getY(), z + point.getZ());
normalApproximation.add(point.mutable().multiply(scalar));
}
return DOT_PRODUCT_DIRECTION.dot(normalApproximation.normalize());
}
@Override
public boolean floorToThreshold() {
return false;
}
},
Derivative {
@Override
public double slant(Sampler3D sampler, double x, double y, double z) {
double baseSample = sampler.sample(x, y, z);
double xVal1 = (sampler.sample(x + DERIVATIVE_DIST, y, z) - baseSample) / DERIVATIVE_DIST;
double xVal2 = (sampler.sample(x - DERIVATIVE_DIST, y, z) - baseSample) / DERIVATIVE_DIST;
double zVal1 = (sampler.sample(x, y, z + DERIVATIVE_DIST) - baseSample) / DERIVATIVE_DIST;
double zVal2 = (sampler.sample(x, y, z - DERIVATIVE_DIST) - baseSample) / DERIVATIVE_DIST;
double yVal1 = (sampler.sample(x, y + DERIVATIVE_DIST, z) - baseSample) / DERIVATIVE_DIST;
double yVal2 = (sampler.sample(x, y - DERIVATIVE_DIST, z) - baseSample) / DERIVATIVE_DIST;
return Math.sqrt(
((xVal2 - xVal1) * (xVal2 - xVal1)) + ((zVal2 - zVal1) * (zVal2 - zVal1)) + ((yVal2 - yVal1) * (yVal2 - yVal1)));
}
@Override
public boolean floorToThreshold() {
return true;
}
};
private static final double DERIVATIVE_DIST = 0.55;
public abstract double slant(Sampler3D sampler, double x, double y, double z);
/*
* Controls whether palettes should be applied before or after their respective thresholds.
*
* If true, slant values will map to the palette of the next floor threshold, otherwise they
* will map to the ceiling.
*/
public abstract boolean floorToThreshold();
}
record Layer(PaletteHolder palette, double threshold) {
}
}
@@ -1,26 +1,19 @@
package com.dfsek.terra.addons.chunkgenerator.palette.slant;
import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.Sampler3D;
import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod;
public abstract class SlantHolderImpl implements SlantHolder {
protected final boolean floorToThreshold;
private final SlantHolder.CalculationMethod calculationMethod;
private final int slantDepth;
protected SlantHolderImpl(int slantDepth, CalculationMethod calculationMethod) {
protected SlantHolderImpl(int slantDepth, SlantCalculationMethod calculationMethod) {
this.floorToThreshold = calculationMethod.floorToThreshold();
this.calculationMethod = calculationMethod;
this.slantDepth = slantDepth;
}
protected abstract double getSlantThreshold();
@Override
public final double calculateSlant(Sampler3D sampler, double x, double y, double z) {
return calculationMethod.slant(sampler, x, y, z);
}
@Override
public final boolean isAboveDepth(int depth) {
return depth <= slantDepth;

Some files were not shown because too many files have changed in this diff Show More