Compare commits

..

722 Commits

Author SHA1 Message Date
Ran e9fc666de5 Made forge actually run! Renamed com.seibel.lod.core to com.seibel.lod.coreapi 2023-05-01 19:27:51 +06:00
James Seibel 64a1120be2 Rename Sparse/Spotty Full data sources to High/LowDetailIncomplete
I liked the terms "sparse" and "spotty", however the difference between the two based on their names was not obvious, which made differentiating between the two difficult.
2023-04-23 15:30:01 -05:00
James Seibel be5d5ec404 refactoring and commenting 2023-04-23 14:57:08 -05:00
James Seibel 9ea5aba0ab rename SingleFullDataAccessor -> SingleColumnFullDataAccessor 2023-04-23 14:51:13 -05:00
James Seibel e1c0299368 refactor and document FullData sample methods 2023-04-23 14:50:38 -05:00
James Seibel 20dc5032ad Rename, refactor, and document FullData Accessors 2023-04-22 12:45:42 -05:00
James Seibel d8e5d588d9 Rename and refactor several FullData source/view files 2023-04-22 11:04:10 -05:00
James Seibel ecbadfb8c6 organize the fullData package 2023-04-22 09:19:49 -05:00
James Seibel 6103625911 Start adding WorldGenStep to full data sources 2023-04-22 08:43:20 -05:00
James Seibel f136fe9bde full data minor refactoring 2023-04-22 08:29:15 -05:00
James Seibel 3a4743b717 Replace all WorldGenStep Enums with the API version 2023-04-20 19:59:27 -05:00
James Seibel 553a125614 refactor and minor fixes for FullData 2023-04-20 19:46:19 -05:00
James Seibel eb5da6fa4d Fix RenderSection overlap and holes 2023-04-17 21:40:45 -05:00
James Seibel 158b7561bc update lodQuadTree calls 2023-04-15 16:38:40 -05:00
James Seibel 45a2e67341 separate isSectionEnabled and isSectionLoaded 2023-04-15 16:35:00 -05:00
James Seibel 6e67ce307e separate LodRenderSection load/enable methods 2023-04-15 16:33:16 -05:00
coolGi 7e3a5181d5 Merge remote-tracking branch 'origin/main' 2023-04-15 01:44:05 +09:30
coolGi b03ea39338 Deprecated getGameDirectory from IMinecraftClientWrapper. Use IMinecraftSharedWrapper.getInstallationDirectory() instead. 2023-04-15 01:36:53 +09:30
James Seibel 63e75fb508 Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons-core 2023-04-10 21:18:49 -05:00
James Seibel 3d413b072b minor ParsedColumnData refactor 2023-04-10 21:18:21 -05:00
coolGi e017d3d599 Disabled lodBias by default 2023-04-11 00:13:04 +09:30
James Seibel 5c9170d13b temporary world Gen Queue out of bounds fixes 2023-04-08 16:01:47 -05:00
James Seibel e48e7fbf7a minor refactoring 2023-04-08 15:59:32 -05:00
James Seibel 39778fe944 Fix LodQuadTree out of bounds error 2023-04-08 13:16:50 -05:00
James Seibel 85a0e75786 Refactor QuadTree DoSquaresOverlap() and add UnitTest 2023-04-08 11:01:35 -05:00
James Seibel df646bb87c minor LodQuadTree refactor 2023-04-08 10:27:31 -05:00
James Seibel b11d1c4b3e Improve QuadNode.getChildValueCount() 2023-04-08 10:21:03 -05:00
James Seibel b013d93908 fix world generator not being started corrected in DhClientServerLevel 2023-04-08 10:19:22 -05:00
James Seibel 4d9264321c Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons-core 2023-04-03 21:33:46 -05:00
James Seibel 5f84f01fb8 Fix world gen queue and rendering for new QuadTree Iterators 2023-04-03 21:33:42 -05:00
James Seibel 3d13f6f46f Fix and update QuadTree/Node iterators 2023-04-03 21:18:25 -05:00
James Seibel 90295b7dcf Fix QuadNode.getDirectChildNodeIterator() 2023-04-02 21:31:17 -05:00
James Seibel d2a0057919 Replace consumer based QuadTree iteration with Iterators
This drastically improves debugging, because lambda consumers cause the stack trace to become messy very quickly.
2023-04-02 19:39:47 -05:00
coolGi 146a2d38cb Reverted back to using swing for the base run jar 2023-03-31 19:47:32 +10:30
James Seibel 45b410806b refactor worldGenQueue removeOutOfRangeTasks 2023-03-30 19:28:24 -05:00
James Seibel afc045dd4c Fix holes when moving around the world 2023-03-30 07:26:25 -05:00
James Seibel 8856843830 minor refactoring 2023-03-29 07:09:41 -05:00
James Seibel afd18ef56c add a TODO for areChildRenderSectionsLoaded 2023-03-27 21:20:21 -05:00
James Seibel 4f496958fb add TODO comments 2023-03-27 21:12:25 -05:00
James Seibel 82fe7c099d refactoring quadTree/Node, RenderSection, and ColRenderSource 2023-03-27 21:11:09 -05:00
James Seibel 779d93700f temporary fix for missing LOD corners 2023-03-27 20:11:15 -05:00
coolGi 7d060d8b85 Fixed up some things to do with the Java screen 2023-03-26 17:31:53 +10:30
coolGi f4c1c9ebbf Moved OS getting utils to its own Platform enum. 2023-03-26 16:03:02 +10:30
coolGi cb88a48d78 Changed default config values and fixed up lang for Lod bias. 2023-03-26 12:53:11 +10:30
James Seibel 3ffd4e9ff6 rename QuadNode .forEachDirectChildNode() 2023-03-25 18:44:09 -05:00
James Seibel ba64241774 Fix render sections incorrectly disabling/enabling when moving 2023-03-25 18:43:49 -05:00
James Seibel 1b682580fd Merge the data structure in LodQuadTree and RenderBufferHandler
This prevents needing to sync both data structures, reducing the chance for things to go wrong
2023-03-25 16:18:22 -05:00
James Seibel 7b795af7b3 update the quadTree tests to support the dynamical detail tree 2023-03-25 11:45:04 -05:00
James Seibel eec8db6223 make the quad tree max detail level dynamic 2023-03-25 11:44:47 -05:00
James Seibel a465a8da9d Replace WorldGen and LodQuadTree with the new QuadTree<T>
There are some issues for the render tree, but the world gen tree appears to be working correctly
2023-03-25 09:25:13 -05:00
James Seibel 0b05ced5b9 Add QuadTree toString() and getChildCountAtPos() 2023-03-25 09:23:24 -05:00
James Seibel a985e1c542 Fix quadNode getChildByIndex inconsistent with DhSectionPos 2023-03-25 07:43:55 -05:00
James Seibel 8a32d7f84a Add the ability to limit how deep a quad tree can go 2023-03-23 21:04:27 -05:00
James Seibel d4b6ec74a8 Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons-core 2023-03-23 07:24:53 -05:00
James Seibel cda265b07f Add SquareIntersectTest 2023-03-23 07:24:49 -05:00
James Seibel 57fec0f805 Fix QuadTree adjacent position issues 2023-03-23 07:13:09 -05:00
coolGi 04b12a2715 New ui frame now shows 2023-03-23 19:25:19 +10:30
coolGi 63950edc96 Sava commit for the new Config UI 2023-03-23 18:08:36 +10:30
James Seibel 515ebb8c99 Fix QuadTree boundary issues and add tests 2023-03-20 20:12:27 -05:00
James Seibel 03acb159e0 separate a quadTree test 2023-03-20 19:55:12 -05:00
James Seibel 837f7d6b5f QuadTree refactoring and fixes 2023-03-20 19:52:13 -05:00
James Seibel ea8076db97 remove unused QuadTree code 2023-03-20 19:52:00 -05:00
James Seibel 38ff3b6942 QuadTree test refactoring 2023-03-20 19:50:45 -05:00
James Seibel 29b5cd9a50 Move SectionPos tests into their own file 2023-03-20 19:50:18 -05:00
James Seibel 4e0254154f Overhaul the QuadTree object
Previously the quad tree was closer to a 3D array than a traditional quadTree. This change brings it closer to a traditional quad tree.
2023-03-20 07:16:35 -05:00
James Seibel adf5d3eb14 fix LodQuadTree compiling and in-mobile functionality 2023-03-18 21:57:54 -05:00
James Seibel 3c4faf1cd0 incomplete LodQuadTree tick modification 2023-03-18 18:14:48 -05:00
James Seibel bf2ae21c21 Improve LodQuadTree assert messages 2023-03-18 09:53:45 -05:00
James Seibel 32e11062df Add a rough diagram to LodQuadTree 2023-03-18 09:50:59 -05:00
coolGi 7d2ab7f589 Updated logo svg so they can be defined in variables 2023-03-18 12:30:33 +10:30
coolGi aac99f1682 Fixed up more things to do with JavaFX, and added some extra stuff for the MinecraftScreen 2023-03-17 22:29:28 +10:30
coolGi 64bed83ddb Removed FlatLaf (which was used for theming) and replaced it with JavaFX 2023-03-17 19:45:18 +10:30
James Seibel 333dc4d0e0 add a message to a LodQuadTree assert 2023-03-16 07:55:30 -05:00
James Seibel d7338a7bb7 update world gen queue comments 2023-03-16 07:26:08 -05:00
James Seibel 0ddd68b6e6 Refactor worldGeneratorQueue thread and comments 2023-03-15 22:25:34 -05:00
James Seibel a9583a6227 Make world gen task queuing async 2023-03-14 22:12:06 -05:00
James Seibel 2020cae17a fix halfSize being the same for every detail level
This may not set the halfSize to the right value, but it is better than having a value of "10" for everything like before
2023-03-14 22:03:30 -05:00
James Seibel af3916b089 refactoring 2023-03-14 21:43:31 -05:00
James Seibel df0a5f5bd0 finish the world generatior 2023-03-14 07:30:42 -05:00
James Seibel 44e280e8b7 fix a class missing exception 2023-03-14 07:24:07 -05:00
James Seibel b6ef754d61 rename DhLodPos overlaps() -> overlapsExactly() 2023-03-12 18:50:58 -05:00
James Seibel 579302f643 start replacing WorldGenQueue's backend with a QuadTree
previously it was a list that grew too quickly for large distances
2023-03-12 18:45:51 -05:00
James Seibel cb23fddd53 add try catch to ServerApi 2023-03-12 17:53:07 -05:00
James Seibel 2f99de7900 remove unused imports 2023-03-12 17:51:46 -05:00
James Seibel 6056d7f7d1 refactoring 2023-03-11 21:10:42 -06:00
James Seibel 586c550c80 fix potential ColumnBox empty data point error 2023-03-11 21:10:09 -06:00
James Seibel 4b5bfe6799 Fix the QuadTree not updating when new LODs are generated 2023-03-11 12:02:22 -06:00
James Seibel 45cc0f38be fix incorrect commit for DhClientServerWorld 2023-03-11 12:01:54 -06:00
James Seibel 3c72765c9a refactoring 2023-03-11 12:00:08 -06:00
James Seibel ded7dde42a Fix generated data not saving 2023-03-11 11:00:37 -06:00
James Seibel 3510facd1e refactor fullDataMetaFile 2023-03-11 11:00:14 -06:00
James Seibel c5c298708f refactoring 2023-03-11 10:37:02 -06:00
James Seibel d687ec892a refactoring/renaming 2023-03-11 09:50:33 -06:00
James Seibel dbfde9f637 Fix files not saving 2023-03-10 22:49:11 -06:00
James Seibel f2be1bd034 rename Steps -> EGenerationStep 2023-03-10 22:00:26 -06:00
James Seibel dd8ee36487 replace OutputStream's with BufferedOutputStream for performance 2023-03-09 21:43:54 -06:00
James Seibel e5116e1ec9 Require Buffered Streams everywhere for performance 2023-03-09 21:02:48 -06:00
James Seibel ce472729d6 append Dh to unclosableStreams and refactor 2023-03-09 07:14:48 -06:00
James Seibel f691f016bc Fix file loaders not getting interrupted on level close 2023-03-07 20:39:07 -06:00
James Seibel 380f92e105 reformat fullDataMetaFile 2023-03-06 21:32:44 -06:00
James Seibel 7ab60df578 Fix QuadTree ringList removal assertion 2023-03-06 21:25:54 -06:00
James Seibel 03822f9e74 Add QuadTree.treeMaxDetailLevel 2023-03-06 20:58:40 -06:00
James Seibel b760a16416 Revert "Simplify Config auto complete"
This reverts commit 1a1d6370f9.
2023-03-06 20:50:17 -06:00
James Seibel e3567c923a Default vanillaOverdraw to "always" instead of "dynamic" 2023-03-06 20:39:57 -06:00
James Seibel 1a1d6370f9 Simplify Config auto complete
Make ConfigCategories private instead of public.
2023-03-06 20:39:42 -06:00
James Seibel a517e6997b refactor ColumnRenderBuffer 2023-03-06 20:30:59 -06:00
James Seibel b63c4b9e7e Remove deprecated ILodConfigWrapperSingleton, use Config instead 2023-03-06 07:44:49 -06:00
James Seibel 5bb14820b6 Add try-catch blocks to LodQuadTree and RenderBufferHandler
To prevent either system from out-right crashing if something goes wrong
2023-03-05 22:07:41 -06:00
James Seibel f09bfa7cfd Auto remove world gen tasks that are outside DH's render distance 2023-03-05 18:38:03 -06:00
James Seibel 825f424ae0 refactor GeneratedFullDateFileHandler 2023-03-05 18:29:21 -06:00
James Seibel 48ae72e0ce Refactor DhChunkPos and add isChunkPosBetween() 2023-03-05 18:28:42 -06:00
James Seibel 94de6380e8 refactor DhClientServerLevel 2023-03-05 18:28:23 -06:00
James Seibel 43de87be0d Limit QuadTree concurrently loading LodRenderSections 2023-03-04 21:15:50 -06:00
James Seibel 067730379f prepend "DH-" to all threads using ThreadUtil 2023-03-04 20:09:04 -06:00
James Seibel 32456c3110 Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons-core 2023-03-04 20:06:50 -06:00
James Seibel 12cbcd9159 Fix threadUtil relativepriority 2023-03-04 20:06:36 -06:00
James Seibel 04e25499ac refactor EventLoop 2023-03-04 20:06:17 -06:00
coolGi 3158620440 Quick fix up to distantGeneratorMode lang 2023-03-05 12:13:32 +10:30
coolGi c65e8c068c Notification in the config if there is going to be an update on close 2023-03-05 11:57:56 +10:30
James Seibel cc4ffaf415 Move threading from LodUtil to ThreadUtil 2023-03-04 14:37:31 -06:00
James Seibel 1a047e14b6 refactor LodRenderSection and LodQuadTree 2023-03-04 14:23:42 -06:00
James Seibel daf4d8b975 refactor MovableGridRingList 2023-03-04 14:20:57 -06:00
James Seibel d35befdf8e Make QuadTree load renderSections from lowest detailLevel to highest
IE start with near sections and move out
2023-03-04 11:49:25 -06:00
James Seibel 6c9c6c9e99 Refactor LodQuadTree 2023-03-04 11:48:25 -06:00
James Seibel 51e5408bb6 Refactor GLProxy 2023-03-04 10:10:19 -06:00
James Seibel b967d94ece refactor LodQuadTree tick methods 2023-03-04 09:58:46 -06:00
James Seibel 07d92f95cb comment out "Merging data from..." logs 2023-03-02 21:34:49 -06:00
James Seibel 075364b26a refactor ChunkToLodBuilder and improve its level changing logic 2023-03-02 21:17:32 -06:00
James Seibel b53c6d8c76 Fix changing dimensions preventing chunk updates 2023-03-02 21:01:43 -06:00
James Seibel 209ccdae76 Add ClientServerWorld level dim type assertion 2023-03-02 20:45:14 -06:00
James Seibel 6beac75c0f comment out "loading render source" log 2023-03-02 20:44:49 -06:00
James Seibel 3fbc2bdb1c Fix render cache folder not being used by ClientRenderState 2023-03-02 20:44:36 -06:00
James Seibel ab92a5ba42 minor reformatting 2023-03-02 07:45:36 -06:00
James Seibel 382b006210 Fix high CPU usage when not moving
Refreshing the render source isn't necessary since it will automatically be updated whenever a given chunk is updated. (and because we don't currently have a versioning system to prevent re-loading the same data)
2023-03-02 07:33:40 -06:00
James Seibel 022a288c97 comment out height_map vertical option
and minor refactoring/commenting
2023-03-01 07:46:37 -06:00
James Seibel 9f601ea6b3 Fix reading/writing files after leaving the world
May have issues in Client-only mode
2023-03-01 07:31:40 -06:00
James Seibel cc474caf33 refactor and comment 2023-02-28 21:43:08 -06:00
coolGi 70369fa468 Removed api build.gradle 2023-02-28 16:57:45 +10:30
James Seibel 42d3e38daa Fix gradle mystery compiler error
Specifically fixes core gradle being unable to access packages found in API
2023-02-27 20:38:40 -06:00
coolGi 1234e47f55 Removed build.gradle for core 2023-02-27 22:32:24 +10:30
coolGi c44c501cd8 Maybe fixed bug with gradle??? 2023-02-27 21:11:37 +10:30
James Seibel 9a27cc1e65 implement ClientApi.clientChunkSaveEvent() 2023-02-26 16:33:58 -06:00
James Seibel 381d3fe216 Move shared Dh(Server)ClientLevel code into AbstractDhClientLevel
This fixes DhServerClientLevel's crashing
2023-02-25 21:31:18 -06:00
James Seibel 2376baf936 prevent potential null pointers in ServerApi 2023-02-25 21:29:56 -06:00
James Seibel be0ce75ceb refactor and prevent a potential null pointer in DhClientWorld 2023-02-25 21:27:35 -06:00
James Seibel ea41fbc664 make DhClientServerLevel extends DhClientLevel 2023-02-25 17:17:27 -06:00
James Seibel 5579b1dc95 equalize DhClientLevel and DhClientServerLevel 2023-02-25 15:43:20 -06:00
James Seibel 8d5926fb2d Add very rough client World support 2023-02-25 15:29:40 -06:00
James Seibel 03752509e7 improve ClientApi logging 2023-02-25 15:28:38 -06:00
James Seibel e7d16b2109 refactor DhClientServerWorld 2023-02-25 15:27:31 -06:00
James Seibel 54252d10f5 minor refactor 2023-02-25 14:29:22 -06:00
James Seibel 19d8306094 move DhClientServerLevel.RenderState into its own file 2023-02-25 10:58:03 -06:00
James Seibel 373b354b20 Add additional shutdown logging 2023-02-25 10:57:27 -06:00
James Seibel b9edf2ef93 Hard shutdown the world generator, don't wait 2023-02-25 10:22:45 -06:00
James Seibel b4ffd65fbc remove deprecated getServerFolderName() 2023-02-25 09:02:42 -06:00
James Seibel eaee05df3f Change the default multiplayer save mode to "name_only"
This is done to prevent issues with Realms
2023-02-25 08:56:40 -06:00
coolGi 7403657d83 Removed classifier's as they are no longer needed in gradle 18 2023-02-24 19:08:53 +10:30
coolGi 2a7e5ef9c9 Suppressed unchecked warning 2023-02-24 18:00:48 +10:30
James Seibel e0cc271cf1 Fix world generator not closing 2023-02-23 20:19:15 -06:00
James Seibel 5174c71363 Downgrade to Java 8 2023-02-23 19:27:29 -06:00
James Seibel af9215c849 Fix exceptions when closing a world 2023-02-21 21:25:06 -06:00
James Seibel acd78a6067 update a comment in ColumnRenderSource 2023-02-21 19:59:48 -06:00
James Seibel 5c0aef32c1 Partially fix LODs disappearing when moving 2023-02-21 19:56:18 -06:00
James Seibel 924465a788 comment out a couple debug loggers 2023-02-19 17:16:39 -06:00
James Seibel cf34457d20 remove duplicate renameCorruptedFile() code 2023-02-19 12:30:14 -06:00
James Seibel 0615a2917c refactoring 2023-02-18 20:25:25 -06:00
James Seibel 4a3b4a1e23 Move FileUtil into the util package 2023-02-18 20:00:21 -06:00
James Seibel 553c348a0d enable atomic move in MetaDataContainerFile 2023-02-18 18:19:52 -06:00
James Seibel be036fe67a rename MetaData -> BaseMetaData and AbstractMDF -> AbstractMDContainerF
The difference between MetaData and AbstractMetaDataFile wasn't obvious, this should make it a bit more clear
2023-02-18 18:02:44 -06:00
James Seibel 070cdc13e2 rename package dataType -> dataObjects and re-arange children 2023-02-18 17:07:36 -06:00
James Seibel 6ac762d415 remove AbstractRenderSourceLoader
There was only one type of RenderSource so it didn't make sense to keep it
2023-02-18 16:46:17 -06:00
James Seibel 40db02cce3 rename RenderFileHandler -> RenderSourceFileHandler 2023-02-18 16:41:21 -06:00
James Seibel cabc1d1de9 Remove unused array from ColumnRenderSource 2023-02-18 16:20:11 -06:00
James Seibel 5e12edb251 Delete IColumnDataType and refactor ColumnRenderSource
ColumnRenderSource was the only object that inherited it
2023-02-18 16:17:11 -06:00
James Seibel 42623b4583 improve FullDataPointUtil and RenderDataPointUtil header comments 2023-02-18 13:48:30 -06:00
James Seibel 5dfd8d3738 Fix RenderDataPointUtil capitalization 2023-02-18 13:34:05 -06:00
James Seibel 031bde07dd rename ColumnFormatUtil -> RenderDatapointUtil and move to util package 2023-02-18 13:33:09 -06:00
James Seibel 3f91c479f4 rename FullDataPoint -> FullDataPointUtil and move to util package 2023-02-18 13:10:17 -06:00
James Seibel 5afbe961e7 rename ColumnFormat -> ColumnFormatUtil 2023-02-18 12:37:47 -06:00
James Seibel f8e3665e14 Remove unused methods from ColumnFormat 2023-02-18 12:36:54 -06:00
James Seibel 01ebf690f0 refactor ColumnFormat 2023-02-18 12:34:05 -06:00
James Seibel 6f743380dc add long to bitShiftUtil 2023-02-18 12:32:06 -06:00
James Seibel 73edce1580 IColumnDataView minor refactor 2023-02-18 12:01:23 -06:00
James Seibel 3dbc0ee5cd Remove IRenderSource
There was only ColumnRenderSource and several pieces of logic required there to only be ColumnRenderSource, so it didn't make sense to keep the interface.
2023-02-18 12:01:15 -06:00
James Seibel a35a797ce0 move buffer building objects into datatype.render.bufferbuilding 2023-02-18 11:33:09 -06:00
James Seibel 912a7687c3 refactor columnArrayView and interface 2023-02-18 11:25:09 -06:00
James Seibel 16c6dffdd6 Move files into Full and Render dataType packages 2023-02-18 09:53:16 -06:00
James Seibel 3b621ac497 rename/refactor FullDataSource loaders 2023-02-18 09:45:56 -06:00
James Seibel 271bdb9f12 Move Full data sources into their own package 2023-02-18 09:36:59 -06:00
James Seibel fbcf687ef9 rename ChunkSizedFullData -> ChunkSizedFullDataSource 2023-02-18 09:30:12 -06:00
James Seibel e4b5a7cb93 rename several FullData objects 2023-02-18 09:28:58 -06:00
James Seibel 0832555ec0 minor SparesFullDataSource refactoring 2023-02-18 09:28:49 -06:00
James Seibel 13d4c74367 remove unused args in LodRenderSection 2023-02-18 09:13:05 -06:00
James Seibel a97f9cf9b4 Comment out metaData versioning 2023-02-18 08:55:50 -06:00
James Seibel 1916ad49c4 Improve RenderMetaDataFile constructors 2023-02-18 08:55:28 -06:00
James Seibel b16ae15f94 Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons-core 2023-02-18 07:21:38 -06:00
coolGi e695c18871 Added ability to change vanilla's lod bias 2023-02-18 20:00:39 +10:30
James Seibel 3a1e9adab2 refactor render file and renderBufferHandler 2023-02-17 18:35:29 -06:00
James Seibel c95b0849e3 refactor RenderBufferHandler 2023-02-17 14:37:14 -06:00
James Seibel 0e9f7eb653 minor LodRenderer refactoring 2023-02-17 14:36:33 -06:00
James Seibel 95c59b775a improve RenderSection.reload() and implement isLoading() 2023-02-17 14:36:12 -06:00
James Seibel 4e6d69860b refactor RenderFile classes 2023-02-17 14:35:24 -06:00
James Seibel dc7ddfd527 refactoring 2023-02-17 14:29:23 -06:00
James Seibel 1675d01dfb implement ColumnRenderLoader isEmpty 2023-02-17 14:26:15 -06:00
James Seibel 1adeaad231 rename IDhLevel methods 2023-02-16 14:58:27 -06:00
James Seibel d6397d6444 Improve the casting around SharedApi.currentWorld 2023-02-16 11:30:11 -06:00
James Seibel 449aaf2d3a DhClientServer Level/World refactoring 2023-02-16 10:11:47 -06:00
James Seibel 97440d7a71 Server/Client/Shared Api refactoring 2023-02-16 10:11:27 -06:00
James Seibel d62e709c48 add a fixme comment 2023-02-16 09:53:06 -06:00
James Seibel a1123e89ce Improve Render File format and reading/writing 2023-02-16 09:46:47 -06:00
James Seibel bd9bfd7d0f refactoring 2023-02-16 09:23:20 -06:00
coolGi 49b345776f Merge remote-tracking branch 'origin/new_buildsystem' 2023-02-15 17:08:08 +10:30
James Seibel 7bc8b46ac0 Use the buffer builder thread config on startup
modified config values after start are ignored for now
2023-02-14 20:35:23 -06:00
James Seibel 7e2b5e65be reformatting and renaming 2023-02-14 20:34:28 -06:00
James Seibel c71ca6fd27 reformatting 2023-02-13 21:22:56 -06:00
James Seibel f76eb3c1b2 attempt to prevent an issue for full data with a lot of vertical slices 2023-02-13 21:22:45 -06:00
James Seibel 92a8e16375 refactoring 2023-02-13 21:02:06 -06:00
James Seibel 0cb46c9b57 rename objects from data -> fullData
Also rename SpottyDataSource to singleChunkDataSource
2023-02-13 20:43:55 -06:00
James Seibel 4697f942e2 up the version number from 1.7.0 -> 2.0.0 2023-02-13 20:26:48 -06:00
James Seibel 6ff1d92ce1 rename dataFile -> fullDataFile 2023-02-13 20:24:31 -06:00
James Seibel 228ba2b2e2 Improve corrupted Data File handling 2023-02-13 20:03:54 -06:00
James Seibel 5116cef99a file handling refactoring 2023-02-12 17:48:22 -06:00
coolGi 0c6e620406 Fabric now builds (and works outside the build environment) 2023-02-12 20:11:53 +10:30
James Seibel 41b9e1b404 Fix SparseDataSource array out of bounds exception when reading files 2023-02-11 21:04:36 -06:00
James Seibel 38dc13a34a refactor SparseDataSource read/write data methods 2023-02-11 21:02:37 -06:00
coolGi 5ec91475a4 Made API Jar name use mod_version instead of versionStr 2023-02-12 13:02:56 +10:30
James Seibel 6441f2aa6c Add vertical quality config listener and Api clearRenderCache 2023-02-09 20:24:53 -06:00
James Seibel 1b137eae50 Fix changing vertical quality not updating render data 2023-02-08 07:31:57 -06:00
James Seibel 6a2298dff9 Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons-core 2023-02-07 07:03:21 -06:00
coolGi 3efeea8987 Optimised the lod noise and added drop off for it 2023-02-07 19:33:46 +10:30
coolGi 0f5efa2036 Merge remote-tracking branch 'origin/main' 2023-02-07 18:44:14 +10:30
coolGi d67cb6b2a9 Fixed up some maths when checking weather a number is valid in the config 2023-02-07 18:34:52 +10:30
James Seibel c001943a5e DataMetaFile and RenderSection minor changes 2023-02-06 07:08:44 -06:00
James Seibel 19e618ea00 Add heightmap vertical quality 2023-02-05 16:38:00 -06:00
James Seibel a08cd3107f Fix generatorMode localizations 2023-02-05 16:37:34 -06:00
James Seibel 8cc9636fa7 update todo comment 2023-02-04 22:51:32 -06:00
James Seibel f44230df40 minor comment updating in LodQuadTree 2023-02-04 22:22:48 -06:00
James Seibel c94cf2a6ec Improve naming/documentation for LodRenderSource/Provider 2023-02-04 22:16:30 -06:00
James Seibel d5a8e1eb1b Refactor LodQuadTree 2023-02-04 22:01:47 -06:00
James Seibel e3caab440a refactor MovableGridRingList 2023-02-04 15:49:44 -06:00
James Seibel 1adf6e0582 reformat movableGridRingList 2023-02-04 15:05:16 -06:00
coolGi 7f5a533827 Updated the lang to the tooltip for noise intensity 2023-01-31 01:35:31 +10:30
coolGi ee8c698d77 Made it so shader auto updates when noise settings change 2023-01-28 20:52:09 +10:30
coolGi deaef0b88d Added support for multiple shaders to be loaded 2023-01-25 19:42:53 +10:30
coolGi 226fa90561 Added noise to the lod's 2023-01-24 18:13:04 +10:30
James Seibel 8b9a2f80b7 add comments to DhBlockPos and Pos2D 2023-01-22 19:56:35 -06:00
James Seibel 365371c5b9 Refactor WorldGenerationQueue 2023-01-22 19:56:24 -06:00
James Seibel e698df0b19 Rename DhLodPos getters to make them more specific 2023-01-22 17:23:44 -06:00
James Seibel fde9f6f129 rename AbstractWorldGenTaskTracker.isValid -> isMemoryAddressValid 2023-01-22 17:12:23 -06:00
James Seibel a249631d76 Rename world generator task objects 2023-01-22 17:09:10 -06:00
James Seibel 3359d6c619 refactor Pos2D 2023-01-21 13:24:13 -06:00
James Seibel ab1967b17f Fix WorldGen crash when closing world with incomplete tasks 2023-01-19 07:49:49 -06:00
James Seibel 3de68248de Fix the world generator running slowly
Thanks for finding the issue Leetom!
2023-01-18 07:52:16 -06:00
James Seibel e631785c9c refactor FullDataSource.neededForPos -> firstDataPosCanAffectSecond
Many thanks to Leetom for explaining the method
2023-01-18 07:40:07 -06:00
James Seibel 7f79f4d39d refactor GenDataFileHandler.onCreateDataFile() 2023-01-18 07:23:36 -06:00
James Seibel 29cf0ead7d refactor and rename selfSearch() -> getDataFilesForPosition() 2023-01-18 07:22:58 -06:00
James Seibel 597cd4629f rename DhSectionPos.sectionDetail -> sectionDetailLevel 2023-01-16 07:54:11 -06:00
James Seibel 59d5b475c5 Remove unused AtomicReference<WorldGenerationQueue> from GeneratedDataFileHandler 2023-01-15 17:19:19 -06:00
James Seibel 7bc6b673ea reformat DataFileHandler 2023-01-15 17:18:48 -06:00
James Seibel 2b930f3fd7 refactor Core world gen queuing 2023-01-15 16:57:42 -06:00
James Seibel 0b6b14177e Minor render object reformatting 2023-01-14 11:11:06 -06:00
James Seibel a27e9bac0c Move ColumnRenderSource file parsing into ColumnRenderLoader 2023-01-13 07:50:21 -06:00
James Seibel 7ea614f257 reformat render source files 2023-01-13 07:09:16 -06:00
James Seibel 723a5f8281 rename RenderBuffer -> AbstractRenderBuffer 2023-01-10 21:47:11 -06:00
James Seibel 98fde3de74 Update the Readme 2023-01-08 20:12:56 -06:00
James Seibel 9b7dfa81da Remove unused methods from EVerticalQuality and DetailDistanceUtil 2023-01-02 13:40:25 -06:00
James Seibel 1a761aad4c Delete the deprecated LevelPosUtil (use DhLodPos or DhSectionPos instead) 2023-01-02 11:18:10 -06:00
James Seibel 9e3f729c8f Replace LevelPosUtil.convert() with DhLodPos.convertToDetailLevel() 2023-01-02 11:13:31 -06:00
James Seibel 7311664acd comment MetaData 2022-12-25 21:45:46 -06:00
James Seibel b02a2d0008 rename MetaDataFile -> AbstractMetaDataFile 2022-12-25 21:42:27 -06:00
James Seibel e26ac63dff Refactor MetaData and MetaDataFile 2022-12-25 21:42:00 -06:00
James Seibel b96622f1cd refactor the AbstractSaveStructure classes 2022-12-17 16:22:21 -06:00
James Seibel 763476e648 Move level (subDim) matching into its own package 2022-12-17 09:48:06 -06:00
James Seibel c0c4cf8b56 Partially update LevelToFileMatcher (File reading incomplete) 2022-12-17 09:44:14 -06:00
James Seibel 575bd5b1e6 Minor refactors for LevelToFileMatcher and PlayerData 2022-12-11 21:32:33 -06:00
James Seibel 38a8c73311 Minor MetaFile reformatting 2022-12-11 17:28:07 -06:00
James Seibel c3c170d07a Add the generatorMode to IDhApiWorldGenerator.generate() 2022-12-10 22:08:16 -06:00
James Seibel 0ab0aeeec6 rename EDistanceGenerationMode -> EDhApiDistantGeneratorMode
This includes moving it into the API and renaming NONE -> PRE_EXISTING_ONLY
2022-12-10 22:07:54 -06:00
James Seibel bf698ad7b9 Make IDhApiEventInjector extend IDependencyInjector<IDhApiEvent>
Some methods were missing when using the API
2022-12-10 21:05:51 -06:00
James Seibel d792031c57 Use bound API World Generators 2022-12-10 11:17:50 -06:00
James Seibel eff161fb24 Remove IWorldGenerator (everything is handled in IDhApiWorldGen) 2022-12-10 09:34:19 -06:00
James Seibel 1489cb0bdb Rename IChunkGenerator -> IWorldGenerator 2022-12-08 21:36:03 -06:00
James Seibel 434abcf1ae Set up the world generator interface for use with the API 2022-12-08 21:32:19 -06:00
James Seibel 581515efc4 Add EDhApiDetailLevel as a reference on DH detail levels 2022-12-05 22:08:01 -06:00
James Seibel 79441b0bdd Remove LodUtil.CEILED_DIMENSION_MAX_RENDER_DISTANCE
Reasoning: The value isn't in use anywhere, we shouldn't be setting a max value anyway since people can get on dimension roofs anyway, and it would be better to allow per-dimension values instead
2022-12-05 22:07:28 -06:00
James Seibel 24260a057a Prep the IChunkGenerator/BatchGenerator for using the API 2022-12-03 19:45:44 -06:00
coolGi 6fd47f360c Fix to issue 446. (special characters in folder name causes crash) 2022-12-01 21:32:37 +10:30
James Seibel be28ed8319 Separate inner classes and refactor world generator code 2022-11-25 17:11:54 -06:00
James Seibel 007e993148 reformat chunk generator code 2022-11-25 15:58:53 -06:00
James Seibel eb0bb8a67d Add a few missing comments to DhLoggerBuilder 2022-11-25 15:57:41 -06:00
James Seibel 00c7f7adaf Minor WorldGeneratorInjector refactoring 2022-11-25 10:08:47 -06:00
James Seibel 0a806c1218 Minor refactoring and Event Test fixes 2022-11-25 09:51:59 -06:00
James Seibel d6a83c8b61 Fix event related null pointer issues 2022-11-24 23:09:00 -06:00
James Seibel 0647d212d6 Fix Event tests not failing correctly 2022-11-24 22:32:37 -06:00
James Seibel 840b02c2db reformat DependencyInjector and ApiEventInjector 2022-11-24 22:32:12 -06:00
James Seibel 2b1837e812 Move Optifine code out of ReflectionHandler and into AbstractOptifineAccessor 2022-11-24 19:09:52 -06:00
James Seibel 4a7af41397 Put delayed objects in DhApiMain into a Delayed class
also improve a few comments
2022-11-24 18:24:13 -06:00
James Seibel aad3a5d2a3 rename DhApiResult.errorMessage -> message 2022-11-24 18:11:16 -06:00
James Seibel 0f06fedb95 rename DhApiEventInjector -> ApiEventInjector
This renaming was because the injector isn't designed to be used from the API, only internally; and externally available objects all start with "DhApi"
2022-11-24 18:05:07 -06:00
James Seibel 6ca2da3f7f Add one time API events (IE setup events)
This allows users to bind to setup events after they've happened and still have the event fire. This is useful for setup since mod load order isn't defined.
2022-11-21 19:26:14 -06:00
James Seibel 1b5a10591b Add IDhApiWorldProxy 2022-11-20 20:39:52 -06:00
James Seibel a935c648e2 un-deprecate McClientWrapper.getWrappedClientWorld()
This was originally done due to splitting up the code into server and client, however this object is just for the client so it shouldn't be an issue.
2022-11-20 20:27:04 -06:00
James Seibel 2ce8692d84 Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons-core 2022-11-19 19:06:46 -06:00
James Seibel 0249894386 Add raycasting methods to IDhApiTerrainDataRepo 2022-11-19 18:59:55 -06:00
James Seibel c2d8e16bc0 remove API debug code from ClientApi 2022-11-19 17:03:31 -06:00
James Seibel e6c833a643 Add raycasting to DhApiTerrainDataRepo 2022-11-19 17:02:26 -06:00
James Seibel 1e235f0cd6 Add DhApiVec3i and DhApiRaycastResult objects 2022-11-19 17:02:04 -06:00
James Seibel d3e293db2c Improve the raycasting tests and fix a few directional issues 2022-11-19 17:01:29 -06:00
James Seibel 6eb97f654c Add RayCastUtil and unit tests 2022-11-19 10:20:14 -06:00
coolGi b64fdf214e Added the ChangelogScreen. New changelog screen done 2022-11-18 19:12:25 +10:30
coolGi 77519bde9d Updated updater screen (thanks a lot to Pankakes#0686) 2022-11-17 21:44:43 +10:30
James Seibel 103a03c90f partially functional raycasting 2022-11-16 22:35:56 -06:00
James Seibel d31013a680 Make the API TerrainRepo return all blocks in a given section instead of a single column 2022-11-14 21:40:40 -06:00
James Seibel d283922741 Minor refactoring 2022-11-14 21:39:38 -06:00
James Seibel 60af4429eb Add a couple missing parameters 2022-11-13 22:13:29 -06:00
James Seibel c67079c928 Rename FullDataPoint getDepth() -> getHeight() and getY() -> getBottomY() 2022-11-13 22:11:21 -06:00
James Seibel cd1c12be12 Implement DhApiTerrainDataPointRepo get methods 2022-11-13 21:49:26 -06:00
James Seibel 1099f5ec24 Add IDhApi Biome and BlockState Wrapper objects 2022-11-13 21:45:35 -06:00
James Seibel d723a1fa84 Add a optional payload to DhApiResult 2022-11-13 21:42:11 -06:00
James Seibel 0bd5730128 Add IDhLevel.getFileHandler() 2022-11-13 16:36:50 -06:00
James Seibel f11752da96 Refactor Dh Client/Server/ClientServer Level objects 2022-11-13 16:33:30 -06:00
James Seibel 51601e710a Add DhLodPos getSectionRelative and getSectionPos methods 2022-11-12 20:12:18 -06:00
James Seibel 3dfaed4409 Add a demo/debug method to DhApiTerrainDataRepo 2022-11-12 12:57:40 -06:00
James Seibel 571ecc5e9c minorly reformat IFullDataView 2022-11-12 12:35:37 -06:00
James Seibel c9947d0250 Remove LagSpikeCatcher from ClientApi 2022-11-12 12:35:03 -06:00
James Seibel 53813020d4 Add tryGet() and getMapping() to IDataSource objects 2022-11-12 12:00:22 -06:00
James Seibel 904288e6ec Refactor DataSources 2022-11-12 11:05:59 -06:00
James Seibel 244a1c273c refactor colorUtil 2022-11-10 07:48:48 -06:00
James Seibel 60112e9bce update a constructor comment 2022-11-10 07:48:31 -06:00
James Seibel 378c064629 Add DhBlockPos and DhChunkPos constructors to DhSectionPos 2022-11-10 07:47:59 -06:00
James Seibel 2429cbbb52 Add BitShiftUtil square() and pow() 2022-11-06 21:40:21 -06:00
James Seibel 8099925dc2 Refactor/comment DhSectionPos, DhLodPos, and DhLodUnit
Also add BitShiftUtil to hold bit shift operation aliases for easier reading
2022-11-06 21:25:37 -06:00
James Seibel ae7dd5ba7e minor formatting/comment updates 2022-11-06 16:59:00 -06:00
coolGi 4c2a2fffc1 Merge remote-tracking branch 'origin/main' 2022-11-04 17:35:52 +10:30
coolGi 87e40c0723 Added a lang auto formatter and a missing lang detector and fixed up the lang formatting and added missing options 2022-11-04 17:35:24 +10:30
Morippi 1965785ff6 small fix to cave culling 2022-11-03 18:59:08 +01:00
morippi 1caf6b03b4 I made some error with the commits 2022-11-03 17:51:21 +01:00
James Seibel f1ed837610 Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons-core 2022-10-31 22:16:16 -05:00
James Seibel cddf27be45 Rename DhWorld -> AbstractDhWorld and WorldEnv -> EWorldEnv 2022-10-31 20:28:58 -05:00
coolGi b9abfaa573 Resized the logo to be an aspect ratio of 2:1 and updated auto-updater's text 2022-10-30 18:35:45 +10:30
coolGi ed0b03a680 Updated readme to add/remove the libraries we use 2022-10-29 09:16:35 +00:00
coolGi 56f02af579 Finished the self updater 2022-10-28 10:07:46 +10:30
coolGi c091566a86 Added the self updater to forge and fixed standalone jar 2022-10-21 17:31:52 +10:30
coolGi 2e9d118ab9 Added the self updater to forge 2022-10-20 22:47:14 +10:30
James Seibel f85d25900b Merge remote-tracking branch 'refs/remotes/origin/main' 2022-10-05 22:39:11 -05:00
James Seibel 2ec7cc8c6d Refactor ColumnRenderSource 2022-10-05 22:21:10 -05:00
coolGi b1ff93bb91 Changed out the json library with something that we already have 2022-10-04 17:24:25 +10:30
James Seibel ce991cd912 Basic refactoring 2022-10-02 22:22:54 -05:00
James Seibel b8af1794a6 rename FullDataPointIdMap setAndGetId -> addIfNotPresentAndGetId 2022-10-02 21:42:02 -05:00
James Seibel 9fcced23e4 Refactor GLProxy and GLMessage 2022-10-01 23:32:30 -05:00
James Seibel 54e35f0907 Refactor GLProxy 2022-10-01 22:03:05 -05:00
TomTheFurry 8d8de8692b FINALLY fix the issue where some data isn't saved and etc 2022-10-01 15:02:23 +08:00
James Seibel b34778952a rename FullFormat -> FullDataPoint and IdBiomeBlockStateMap -> FullDataPointIdMap
Also refactor FullDataPointIdMap
2022-09-30 21:21:26 -05:00
James Seibel a082f2ae86 basic reformatting 2022-09-30 20:20:22 -05:00
James Seibel 8b1cb258b4 Add interface and abstract prefixes to a few datatype objects 2022-09-29 22:38:23 -05:00
James Seibel 58be4da5ca Auto format and move around a few comments 2022-09-29 22:15:15 -05:00
James Seibel 956f13c674 Add "Dh" prefix to DistantHorizons Worlds 2022-09-29 21:50:47 -05:00
James Seibel 1f6f03745a Add "Dh" prefix to DistantHorizons levels 2022-09-29 21:49:11 -05:00
coolGi 52b26c2046 Fixed up some listener stuff in the config 2022-09-25 12:24:41 +09:30
coolGi 825c72d572 Merge remote-tracking branch 'origin/main' 2022-09-19 19:07:13 +09:30
coolGi dd11b89bb9 Added a way of just running the config ui by itself so I can do quicker tests 2022-09-19 19:07:07 +09:30
TomTheFurry 905e73fd1c Continue improving stabilises of the system 2022-09-19 14:54:45 +08:00
TomTheFurry 4158573129 Add render source flag debug mode & fix sparse source to render source transform bug 2022-09-19 12:28:39 +08:00
TomTheFurry b4ea8854a8 Fix critical issue causing chunk to lod build extremely slow, and also partly fix sparse data source loading (where I used wrong array instead of loaded data array.) Also improve ChunkToLodBuilder building loops to support multithreaded building 2022-09-18 16:30:39 +08:00
coolGi 22628983a7 Merge remote-tracking branch 'origin/main' 2022-09-18 15:31:17 +09:30
coolGi afd88470d8 Added some api notes and moved JarMain to the jar folder 2022-09-18 15:31:07 +09:30
TomTheFurry 2e773279b7 Rework the Level data member organization and make world gen enable/disable based on settings 2022-09-18 13:58:02 +08:00
TomTheFurry f91629bf21 Make it build again 2022-09-18 12:55:26 +08:00
James Seibel 47645a6346 Add worldGen, Override, and DataRepo variables to DhApiMain 2022-09-16 23:57:55 -05:00
James Seibel 52ed3c8733 Rearrange API packages 2022-09-16 23:41:57 -05:00
James Seibel 6c249335c5 Move some API objects into the DhApiMain object 2022-09-16 23:24:25 -05:00
James Seibel d0f43a6760 re-add level event parameters 2022-09-16 22:55:21 -05:00
James Seibel 9adf2a75f8 Make Core Level Wrappers implement API wrappers 2022-09-16 22:55:03 -05:00
TomTheFurry fc5cb6796b Clean up transparency and buffer render orders. 2022-09-16 17:54:08 +08:00
James Seibel 690dd319cb Set up the API config 2022-09-15 20:31:41 -05:00
James Seibel 541fbbb36b Remove "config" from API config method names
IE getFogConfig()
The additional config was already implied.
2022-09-15 20:30:49 -05:00
James Seibel 14bd059a88 implement and modify API config interfaces 2022-09-15 19:33:25 -05:00
TomTheFurry 6fc31192c2 No longer saving empty files & rework isEmpty flag to be more stable & work on genQueue issue
Note: Known half fixed issue where in large render distance, the genQueue will block server thread for ages to build up gen request index.
2022-09-16 00:18:26 +08:00
James Seibel ec738aea22 Re-add api event tests 2022-09-13 21:56:03 -05:00
James Seibel 92a98aba96 Hook up the API events (some are missing parameter objects) 2022-09-13 21:44:00 -05:00
James Seibel f6a1901ef8 Move several Dependency Injectors into the API 2022-09-13 21:38:57 -05:00
James Seibel cceb2c38e4 Fix several API packages missing from "methods" 2022-09-13 20:00:54 -05:00
James Seibel 6e229b86b0 fix the semantic version number 2022-09-13 07:42:32 -05:00
TomTheFurry 4d09441399 Start trying to get chunk updating to work... 2022-09-13 12:17:37 +08:00
James Seibel c80a5b102d Move config enums into API and setup groundwork for config interfacing 2022-09-12 22:16:13 -05:00
James Seibel 4f1203b32c Flip API -> Core dependency to Core -> API
Very rough, a decent amount of the API isn't hooked up to anything.
2022-09-12 21:53:55 -05:00
TomTheFurry 1bfc6db8b4 Fixed some bugs when moving across dimensions 2022-09-13 00:09:29 +08:00
TomTheFurry 54d41bfc3f Rename 'io' package to 'file' 2022-09-12 23:39:58 +08:00
TomTheFurry 0914b825fe Move ParsedIp class into 'util.objects' 2022-09-12 22:48:58 +08:00
TomTheFurry 3f23ef960b Reorganize all the classes and move them around to make more sense and be easier to navigate. Also removed/unwrapped the 'a7' temp package. 2022-09-12 22:43:06 +08:00
TomTheFurry dfc75f2a65 Nuke no longer used files and fix bugs where I'm using the wrong class for doing data formats 2022-09-12 22:13:20 +08:00
James Seibel f2c19ef3a3 comment out failing unit test 2022-09-11 22:41:14 -05:00
James Seibel 14b855ada6 Fix incorrect API tests (and move them to the API sub-project) 2022-09-11 22:25:22 -05:00
James Seibel d21e334e15 move Client/Server API back into the Core sub-project 2022-09-10 20:02:50 -05:00
James Seibel ba701eb014 Fix the level API events 2022-09-10 17:10:48 -05:00
TomTheFurry 0a70ec9986 Fix region load bug & fix corrupt file load error handling & fix downsampling bug & fix sparse failing to save the promoted version 2022-09-11 00:12:22 +08:00
coolGi 050d88dd13 Made the config abstract (so it can be used by other mods using our api) 2022-09-09 23:12:20 +09:30
TomTheFurry 1b0c97ffca Fix adj sections rendering quad merge bug 2022-09-09 14:37:03 +08:00
TomTheFurry 1dadf056da Fix lighting 2022-09-09 14:16:57 +08:00
James Seibel e61da323d8 suppress a couple unchecked cast warnings 2022-09-08 21:42:21 -05:00
James Seibel 2328f44e3a Fix API injector tests 2022-09-08 21:31:36 -05:00
James Seibel b0b5007341 Fix API Event Injector tests 2022-09-08 21:04:54 -05:00
James Seibel 35b00165a2 Partially implement/uncomment worldGeneratorOverride 2022-09-08 20:51:49 -05:00
James Seibel 659c62d4b4 Move worldGen Api Enums into the API sub-project 2022-09-08 20:15:54 -05:00
TomTheFurry 0e001dd2d3 *Kinda* working now. Async the updateCache to io thread, and fix stream close issue 2022-09-08 22:31:24 +08:00
TomTheFurry 00a18352d8 Fixed various bugs & Add some info to be logged to F3 2022-09-08 21:18:22 +08:00
TomTheFurry a53bdc6abf Finish the previous merge issue 2022-09-08 17:41:31 +08:00
James Seibel cecd01b7d9 Merge 2022-09-07 07:47:18 -05:00
James Seibel 09ceab5c70 Comment out API/API test code so we can get everything compiling 2022-09-07 07:37:07 -05:00
James Seibel 53ded97714 Move Core API items into the api.external.coreImplement package 2022-09-06 22:22:27 -05:00
James Seibel 5a2366eb13 Move CoreDhApiRenderParam into a better package 2022-09-06 22:10:09 -05:00
James Seibel 5e775e4c88 move The ConfigWrapper to the API sub-project 2022-09-06 21:39:51 -05:00
James Seibel 75b23ee904 Move and update API Events to the API sub-project 2022-09-06 21:25:11 -05:00
James Seibel dbae5a3b05 Move DhApiEventRegister to API sub-project 2022-09-05 21:41:32 -05:00
James Seibel b5a05bfe21 Add CoreDhApiRenderParam and move DhApiRenderParam to the API Sub-project 2022-09-05 21:38:52 -05:00
James Seibel 71f55ef0e3 Add (core)Mat4f -> DhApiMat4f constructor 2022-09-05 21:38:05 -05:00
James Seibel f323eaf666 Remove DhApiMat4f from Mat4f 2022-09-05 21:12:00 -05:00
James Seibel 7ee113ddff Replace the override priority enum with an int 2022-09-05 21:11:29 -05:00
James Seibel f61d113493 Move config API Enums to the API sub-project 2022-09-05 19:28:57 -05:00
James Seibel eaadd6fc71 Move API Interfaces into the API sub-project 2022-09-05 19:18:33 -05:00
James Seibel 89a46ae5e1 Move misc API items into the API sub-project 2022-09-05 19:14:43 -05:00
James Seibel 7a00ba09a2 Move API tests to the API sub-project 2022-09-05 18:53:12 -05:00
James Seibel 9eefd53fdc Fix test compiling in API
TODO: why do we need manifold to compile the API when any test file is present?
2022-09-05 16:08:40 -05:00
James Seibel 17d2e61688 Start moving API files to the API sub-project 2022-09-05 11:46:13 -05:00
James Seibel e24aa32cce Make public loggers private 2022-09-05 11:37:00 -05:00
James Seibel b33f7bbabd add commonInterface sub-project 2022-09-05 11:27:16 -05:00
James Seibel 758b5b6db6 Remove apiInterface and coreShared sub-projects 2022-09-05 11:27:01 -05:00
James Seibel 1f8bd81958 Remove dependencies on ClientApi.LOGGER
each class should have it's own logger instead
2022-09-05 11:25:46 -05:00
TomTheFurry 950a1d34ea Overhaul how files and partially loaded sources are handled
Note: Currently it DOES render, it just... requires the ENTIRE area to be generated. This bug will be fixed... tomorrow. I hope. (It's like 11:35pm here so gimme a break!)
2022-09-05 23:36:51 +08:00
coolGi bcc65b8153 Fixed issue when setting a config value in the file to a different type breaks game. 2022-09-02 15:59:00 +09:30
coolGi a5ade02dec Fixed issue #390 (problems with BCLib fog) 2022-09-02 15:14:03 +09:30
coolGi 1aaae5c1da Started work on auto updater screen 2022-09-02 12:12:50 +09:30
coolGi cf62774a78 Added auto updater lang 2022-09-02 10:41:38 +09:30
James Seibel 2fdf2b9cfc rename coreApiCommon -> coreShared 2022-08-30 21:50:33 -05:00
James Seibel 55463f2377 add apiInterface and coreApiCommon subprojects
Currently they are just shells and they may be renamed later
2022-08-30 07:54:57 -05:00
James Seibel 43d53e71c9 rename/reorganize the "_Msic Files" folder 2022-08-30 07:46:40 -05:00
James Seibel 14d0e65c68 Move the api sub-project into core 2022-08-30 07:39:59 -05:00
James Seibel 9799b0a263 move core into a folder named "core"
This is so we can have multiple sub-projects in the core repo
2022-08-30 07:36:19 -05:00
Morippi 519a4c1452 Added configs for transparency (currently I'm faking the light for ocean floor) 2022-08-25 11:23:49 +02:00
Morippi 30959cfdd0 fixed water "walls" 2022-08-25 00:03:47 +02:00
Morippi 717c33078f Added section ordering (by position) + small fixes on transparency 2022-08-24 23:02:27 +02:00
Morippi 8b877a5f1a Divided transparent from opaque in the rendering (transparent are not rendering for some reason) 2022-08-24 21:54:56 +02:00
Morippi 427105189b small fixes + removed lodBox 2022-08-24 16:32:01 +02:00
Morippi 821feae1d5 Improved ocean floor adjCulling 2022-08-24 15:43:46 +02:00
Morippi 29c5d70171 enabled and fixed ocean floor (light not working correctly) 2022-08-24 15:15:21 +02:00
Morippi 5e91824c7d Disabled fake floor 2022-08-24 13:53:06 +02:00
Morippi 9575429296 Fixed transparency and added some boolean to disable it 2022-08-24 13:35:51 +02:00
Morippi 22f9d20aae another small fix (sorry) 2022-08-24 13:16:55 +02:00
Morippi 45ec219bb5 Small fix 2022-08-24 13:16:09 +02:00
Morippi ae0eb0fd91 Redoing everything on transparency, I hope I'm not breaking anything 2022-08-24 13:15:01 +02:00
James Seibel 3785426793 Add Server save API Event 2022-08-23 22:43:24 -05:00
James Seibel d1126afc44 Add DhWorld.GetAllLevels() and ILevel.GetLevelWrapper() 2022-08-23 22:43:08 -05:00
James Seibel f203679de4 Add Client/Server load/unload events
Add client level save event
stub out server level save event
2022-08-23 21:32:46 -05:00
James Seibel e2d90f6627 Remove module-info
We are going to use a separate (intellij?) module instead for the API
2022-08-23 21:18:38 -05:00
TomTheFurry 75ab228e46 Created SparseDataSource 2022-08-23 13:27:33 +08:00
James Seibel 0b7bd84af5 Implement DhApi Before/After render events 2022-08-21 22:40:34 -05:00
James Seibel 322ccee672 Add helper methods to Mat4f objects 2022-08-21 22:37:56 -05:00
James Seibel 9c669c2fe6 Move Render helper methods into RenderUtil
Also refactor said methods along with ClientApit
2022-08-21 22:37:09 -05:00
James Seibel c69b7d14bf Simplify ClientApi rendering method 2022-08-20 22:38:50 -05:00
James Seibel ae60c8e974 Move logToChat to IMcClientWrapper 2022-08-20 18:27:33 -05:00
James Seibel 5819d8c3f3 Auto-format 2022-08-20 18:25:36 -05:00
James Seibel a179fb9ff9 auto-format ClientApi 2022-08-20 18:14:01 -05:00
James Seibel c491a36b71 Re-add the "here be dragons" dev build message 2022-08-20 18:03:12 -05:00
TomTheFurry 78ccb8aaf2 Making multi-level works a bit better... Needs more changes to work well though... 2022-08-20 21:24:42 +08:00
TomTheFurry 90fe892291 Bypass critical issue with map() returned buffer holding the file open til GC. 2022-08-20 20:56:17 +08:00
TomTheFurry b80bfe813c Fix bugs in CQCPTree 2022-08-20 15:49:12 +08:00
TomTheFurry 0dafdc527a Continue fixing gen related issues 2022-08-18 19:46:35 +08:00
TomTheFurry 1cc00b7174 Did the generation stuff change 2022-08-18 18:29:04 +08:00
James Seibel 3995e07d91 Stub out a potential fix for #287 (optifine resolution) 2022-08-16 20:29:12 -05:00
coolGi 04220584b3 Added an onModify to the config 2022-08-16 17:10:34 +09:30
James Seibel b13203c62e Fix a few DhApiResult constructors 2022-08-15 22:24:26 -05:00
James Seibel 68ef9126ed Hook up DhApiWorldGeneratorOverrideRegister
set up Dependency Injectors for clearing their bound items.
add simplified constructors for DhApiResult
2022-08-15 22:21:08 -05:00
James Seibel c7a84831e9 Replace system.out in DhApiEventInjector 2022-08-15 21:56:10 -05:00
Ran 633ad1f490 Add module-info.java 2022-08-15 13:37:26 +00:00
TomTheFurry 1fc6487374 Start rework on the generationQueue system so that it hooks directly into base DataFileHandler instead of watching for PlaceHolder obj.
This also means a hyper complex concurrent customized quad tree implementation... So, great.
2022-08-14 23:42:41 +08:00
James Seibel d3732306a6 Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons-core 2022-08-13 17:39:05 -05:00
James Seibel 25d4b8ab3d Improve the curvature shader with code from stduhpf
Currently untested and the old code is still included
2022-08-13 17:38:48 -05:00
TomTheFurry e5f3e2e7b0 Start working on a new concurrent container... 2022-08-13 14:35:44 +08:00
TomTheFurry 43ec3a081d Make multi-level works again! 2022-08-10 20:47:10 +08:00
TomTheFurry 88ccc76045 First fix on light & impl render source direct write 2022-08-09 16:08:54 +08:00
TomTheFurry 6a49a100e7 Fixed multiple major RAM issues. Next one is the 100/s reload issue... 2022-08-08 23:00:30 +08:00
coolGi 6c8a7ef989 Merge remote-tracking branch 'origin/main' 2022-08-06 20:33:51 +09:30
coolGi 6aab2d287c Added an auto updater when game starts 2022-08-06 20:32:09 +09:30
TomTheFurry d58cd204cc Implemented untested FullDataType serialize & deserialize 2022-08-06 00:08:16 +08:00
coolGi be74011e5e Made jar use modrinth instead of gitlab 2022-08-05 21:53:44 +09:30
TomTheFurry f6e5bdbd2f Fixed block color & improve close 2022-08-04 20:03:43 +08:00
TomTheFurry 9a8145ff45 Fixed all the data view bugs 2022-08-04 19:07:32 +08:00
James Seibel 46bc17e9ac Add (commented out) module-info.java 2022-08-02 21:40:14 -05:00
TomTheFurry 6fe2b6f331 Something renders! And introduce mem leaks, missing texture color, and inverted lights! What a great set of features! 2022-07-30 16:06:54 +08:00
TomTheFurry 823da76896 Fix forge wrong proxies, fix generator shutdown, fix batch gen incorrect timeout, 2022-07-30 00:11:36 +08:00
morippi 2e833136f6 Added new merged (it's commented out, when build is working we can test it) 2022-07-28 14:54:29 +02:00
TomTheFurry f08e7974cd Fix up all file IO bugs, FullFormat bugs, FullToColumn bugs, & Tree assert issues 2022-07-28 19:33:47 +08:00
James Seibel 64ee49de03 Finish the WorldGenInjector tests 2022-07-27 21:58:27 -05:00
James Seibel c29289d602 Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons-core 2022-07-27 07:53:22 -05:00
James Seibel b9cd99cb6c Add basic unit tests for WorldGenInjector 2022-07-27 07:53:19 -05:00
TomTheFurry 6862f5667b Improve generationQueue and add more and better logging and fix double close on DhLevels 2022-07-27 14:49:03 +08:00
James Seibel 30aba99c27 Add WorldGeneratorInjector and start unit tests 2022-07-26 22:09:49 -05:00
James Seibel a49512f750 Add generic typing to OverrideInjector 2022-07-26 21:24:52 -05:00
TomTheFurry 89e2d10f24 Fixed 1 wrong logging 2022-07-26 23:36:49 +08:00
TomTheFurry 2abb117d2e remove ghost imports.... 2022-07-26 23:31:28 +08:00
TomTheFurry c110e268b8 Fixed IO bugs 2022-07-26 23:14:28 +08:00
TomTheFurry 78c6ae3b90 Hey Fixed more maths! 2022-07-26 22:20:26 +08:00
TomTheFurry 50810c7406 Fixed realllly wrong maths 2022-07-26 21:54:32 +08:00
TomTheFurry e903ec53f5 Continue fixing bugs... Lots of bugs. 2022-07-26 20:17:26 +08:00
TomTheFurry a4546c63e3 Fix bunches of bugs. Quad tree ticks! Gen call is fired! Chunk gen works! Next to fix: File updates 2022-07-26 17:06:50 +08:00
TomTheFurry 50c5d044f1 Trying and failing to find a bug. Gonna call it a night. 2022-07-26 01:04:01 +08:00
TomTheFurry 5947716a6a Resolving one by one many bugs lying around 2022-07-26 00:13:00 +08:00
coolGi 85fec37bed Removed some jank code 2022-07-25 23:11:01 +09:30
TomTheFurry 49769d0aac Fix stuff so fabric works and no crash. Sadly nothing renders though... 2022-07-25 21:23:36 +08:00
James Seibel d7b73f378e Fix ApiEnum test failures 2022-07-25 07:46:25 -05:00
TomTheFurry ff2763df9e Rework forge to new a1.7 structure. Minecraft runs and it builds. But crash on loading into world due to... weirdness 2022-07-25 19:44:11 +08:00
TomTheFurry 973be40324 Fix and port batch generator to new Generator API. Now if we just fix up forge, and there's no bugs (impossible), then there's enough implemented to finally have something shown! Yay! 2022-07-25 13:38:33 +08:00
TomTheFurry 5f486b6258 Work on world generator integration to a1.7 rework 2022-07-23 16:40:19 +08:00
James Seibel cdbee5e239 Add a missing test case and fix a typing issue with dependencyInjector 2022-07-21 21:25:17 -05:00
cola98765 b95f095721 why did I root the alpha? 2022-07-21 18:35:27 +02:00
TomTheFurry 5b1568e9a6 Fixing stuff towards successful builds. Now stuck on thinking how the world gen stuff should return and apply the gen chunk to data though... 2022-07-21 17:40:27 +08:00
James Seibel 109f2ea7a4 Finish OverrideInjector and add unit tests 2022-07-20 07:11:46 -05:00
James Seibel 0e73aa1820 More test refactoring 2022-07-20 07:00:11 -05:00
James Seibel c4a9a72118 More refactoring 2022-07-19 20:22:11 -05:00
James Seibel d5f7818252 Refactor/Clean Dependency tests before adding Override tests 2022-07-19 19:57:03 -05:00
James Seibel 3f89c485e1 Add OverrideInjector 2022-07-19 19:46:17 -05:00
James Seibel c11f63f606 DependencyInjector children fixes 2022-07-19 19:40:06 -05:00
coolGi 1c2a4a43d0 Merge remote-tracking branch 'origin/main' 2022-07-18 15:16:30 +09:30
coolGi adc51bab9a Added runnable and performance impact to the config 2022-07-18 15:16:22 +09:30
James Seibel dc466e61d1 Add DhApi Client/Server Save events (and fix other events) 2022-07-17 20:48:28 -05:00
James Seibel 02157d52f6 Add DhApi level load/unload objects 2022-07-17 20:40:31 -05:00
James Seibel 299a7c67f0 Rename DhApi event Parameter objects 2022-07-17 20:33:50 -05:00
James Seibel 484c95e26a Make event parameter objects internal classes 2022-07-17 20:29:29 -05:00
James Seibel 45f7ca2954 Add DhApi Before/After Init Event objects 2022-07-17 20:15:07 -05:00
James Seibel a7c3f9ec20 Add DhApi Before/After Render Event objects 2022-07-17 20:09:14 -05:00
James Seibel c7e4781a95 Add unit tests for the DependencyInjectors 2022-07-16 22:40:14 -05:00
James Seibel 9a8ed301cb Rename SingletonHandler -> SingletonInjector
This was done with all Dependency Injection objects because there was a name conflict with DhApi event handlers. (This new name is also more specific and makes sense for dependency injection).
2022-07-16 22:09:22 -05:00
James Seibel 8c0767523d Add DhApiEventHandler and hook up EventRegister
add supporting event interface objects
refactor api.implementaion.interfaces
2022-07-16 22:06:29 -05:00
James Seibel 88915ca92f Improve DependencyHandler for DhApiEventHandler support
Specifically dependencyHandler can now optionally store multiple implementations for each dependency interface.
2022-07-16 22:02:37 -05:00
James Seibel 207eded4b4 Improve anotherQuestion docker documentation 2022-07-16 20:48:14 -05:00
James Seibel c01fc2ed86 Remove DhApi worldGenerator unregister methods
Also fix capitalization for the register methods
2022-07-15 22:07:32 -05:00
James Seibel 3d19fec723 Revamp DependencyHandler
The dependency handlers are now singletons instead of static, this prevents almost all duplicate code as each handler can now extend the parent DependencyHandler.

Handlers no longer have to finish binding before being used, and they no longer have to call runDelayedSetup() before being used either. However dependencies that have circular references still need the runDelayedSetup() method to be called at somepoint; there will just be a warning if they are get() before that setup was done.
2022-07-15 21:58:48 -05:00
James Seibel 6b5c14cdd9 fix a typo 2022-07-15 07:17:12 -05:00
James Seibel 1bd3ce8809 Major API Package refactor 2022-07-14 22:15:07 -05:00
James Seibel e6937d010f Start setting up the DhApi world generator overriding 2022-07-14 21:54:06 -05:00
James Seibel 51de4da845 Minor cosmetic/warning changes/fixes 2022-07-14 21:44:46 -05:00
James Seibel b1c6ff9588 Improve DhApi event handling names and organization 2022-07-14 07:48:46 -05:00
James Seibel 889e983cc5 Continue setting up the DhApi Rendering events 2022-07-13 22:06:52 -05:00
James Seibel 4f6433ee0f Improve IDhApi Render events 2022-07-13 21:24:11 -05:00
James Seibel e04f1d9dd5 Start adding a event API system 2022-07-13 07:54:34 -05:00
James Seibel 9673150fa1 Rename and add DhApi to a few classes 2022-07-13 07:30:22 -05:00
James Seibel 32747baadf Create the outline for the TerrainDataApi methods and objects 2022-07-11 22:14:14 -05:00
James Seibel 6629ec9dc0 Set up the API packages for data and overriding
data - getting/setting terrain data
overriding - overriding DH systems
2022-07-11 21:31:33 -05:00
James Seibel 9a91b8f306 Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons-core 2022-07-11 20:56:37 -05:00
James Seibel 78fe3923e2 DhApi config refactoring 2022-07-11 20:56:34 -05:00
coolGi cca82fd67a Changed the design to the installer GUI 2022-07-11 16:06:29 +09:30
coolGi cd10fc013a Save commit 2022-07-10 23:34:05 +09:30
coolGi 7c6b4ef059 Merge remote-tracking branch 'origin/main' 2022-07-10 16:37:54 +09:30
coolGi 172a6d9239 Made version numbers more readable in jar 2022-07-10 16:37:42 +09:30
James Seibel ed312cb45e Add AnotherQuestion Docker setup instructions 2022-07-09 17:39:03 -05:00
coolGi d617d2b91d Added an auto installer (works with everything except when downloading from cursedforge cus it is being annoying) 2022-07-08 21:01:42 +09:30
James Seibel 027406ffca Fix a few misc DhApi's and comment World Gen DhApi 2022-07-05 21:49:35 -05:00
James Seibel 267da77a0a Update DhApi Threading comments 2022-07-05 21:35:18 -05:00
James Seibel e9c558eefe Improve/fix DhApi Multiplayer 2022-07-05 21:28:35 -05:00
James Seibel 9434275e51 Move some comments and improve DhApi Debugging 2022-07-05 21:23:42 -05:00
James Seibel cedffb03d8 Update the DhApi buffer comments and move one item
Geometry rebuild frequency is more of a graphic setting than a buffer setting.
2022-07-05 21:17:22 -05:00
James Seibel 2f9404e203 Improve the DhApi fog comments and add types 2022-07-05 21:12:32 -05:00
James Seibel f277121148 Add renderingEnabled to DhApi Graphics Config 2022-07-05 20:35:43 -05:00
James Seibel 5c6a511c42 Polish and fix DhApiGraphics
Add types to the generics
Add comments to the methods
Fix a incorrect type
2022-07-05 20:21:11 -05:00
James Seibel 890904cfe8 rename ERendererType -> ERendererMode
The enum didn't change what type of renderer was used, it just changed how the renderer was used (on/off/debug).
2022-07-04 23:01:23 -05:00
James Seibel c98ae392eb Clean up the headers for the API methods 2022-07-04 22:49:09 -05:00
James Seibel 6a6ab4bd78 add instructions to setup a docker runner 2022-07-04 22:09:18 -05:00
TomTheFurry ab7b97b29c Start nuking old files + work on FullData -> ColumnData logic 2022-07-04 00:18:00 +08:00
James Seibel 32fd3b6084 Add API Geometry Config 2022-07-02 22:42:17 -05:00
James Seibel e0947d3490 Add API Debug Config 2022-07-02 22:11:52 -05:00
James Seibel 0adf9b31cf Fix an incorrect API config generic type 2022-07-02 22:03:13 -05:00
James Seibel aabf087f55 Api threading config comments 2022-07-02 22:02:04 -05:00
James Seibel bff4797ab4 Add a missing graphic api method 2022-07-02 21:57:30 -05:00
James Seibel 6386cc5d88 Add Multiplayer config API 2022-07-02 21:52:09 -05:00
James Seibel d92b1f1032 Add World generator API config 2022-07-01 22:02:57 -05:00
James Seibel 1855e27d29 Rename and move EFogSettings -> FogSettings
It wasn't an enum so the prefix and package were wrong
2022-07-01 21:35:01 -05:00
James Seibel 957466b419 Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons-core 2022-07-01 21:21:56 -05:00
James Seibel 3f757e8c32 Add DhApiGraphics settings 2022-07-01 21:21:54 -05:00
TomTheFurry 932146eea8 Milestone!! Both fabric:runclient & fabric:runserver now works!!!!! (in 1.18.2 for now) 2022-07-01 18:17:07 +08:00
TomTheFurry 1c63dd5183 It now able to join level without error spams! 2022-07-01 17:05:52 +08:00
TomTheFurry bdc8384c49 It... builds? 2022-07-01 15:05:55 +08:00
James Seibel c77f8e254b Add more DhApiGraphic configs 2022-06-30 22:51:05 -05:00
James Seibel 9299e2d53f Add Fog Config API methods 2022-06-30 22:16:37 -05:00
James Seibel 00118ea885 Add GenericEnumConverter 2022-06-30 20:37:00 -05:00
James Seibel 50dc8efafc Add converters to DhApiConfig
This allows Core and Api to use different objects.
2022-06-30 07:55:20 -05:00
coolGi 2399583841 Added network stuff to standalone jar 2022-06-26 20:28:32 +09:30
TomTheFurry 82ef1581dd Finish up 99% of file & cache handling + creation + management + many things 2022-06-25 23:12:17 +08:00
coolGi 2bb78fcc88 Forgot to push this 2022-06-24 22:53:22 +09:30
coolGi a374d58907 Added more stuff for the standalone installer 2022-06-24 22:50:21 +09:30
TomTheFurry 13b820e17a If this serializer stuff works first try than I'm surprised 2022-06-23 22:46:25 +08:00
coolGi 30248dcaac Added svg logo and started work on the installer 2022-06-23 23:13:44 +09:30
TomTheFurry 66c9feda6e Missed that 2022-06-23 21:20:50 +08:00
TomTheFurry 7cda3251eb Continue on the full data stuff 2022-06-23 21:18:13 +08:00
TomTheFurry 0df4011a9a Full Data Source half done! 2022-06-23 18:30:33 +08:00
TomTheFurry bc194f8e6c Start working on Full Datatype 2022-06-23 16:37:28 +08:00
TomTheFurry 491f8bea4c Cleanup 2022-06-23 13:23:41 +08:00
TomTheFurry b780a975ee Finish up the level split of 3 type of levels: ClientOnly, ClientServer, and ServerOnly 2022-06-23 13:22:16 +08:00
TomTheFurry 74e58f5043 Finish up the level split of 3 type of levels: ClientOnly, ClientServer, and ServerOnly 2022-06-23 11:19:57 +08:00
TomTheFurry 04bc771c6d Continue refactoring, and starting to hook up all the loose pieces 2022-06-22 22:13:08 +08:00
TomTheFurry dc1c130fb9 2nd Refactor started. Split to 3 type world structure 2022-06-22 20:43:00 +08:00
TomTheFurry 976e36e80c Moved a7 package 2022-06-22 17:01:11 +08:00
coolGi 1d4c292e06 Made jar run without fabric api 2022-06-19 14:41:20 +09:30
James Seibel 602d2c4016 Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons-core 2022-06-16 19:57:41 -05:00
TomTheFurry fd58b10800 Merge branch 'FixTypos' into 'main'
Fix typos

See merge request jeseibel/distant-horizons-core!6
2022-06-16 13:28:59 +00:00
svr333 9ada9cc463 Fix typos 2022-06-16 13:51:37 +02:00
TomTheFurry 9ffc6e5a93 Continue chipping on it 2022-06-16 14:23:10 +08:00
TomTheFurry 742f8b53bb Continue work on the complex concurrent file system 2022-06-15 22:17:59 +08:00
unknown b2942f51e2 Work on async data system 2022-06-14 15:30:21 +08:00
James Seibel b13559b172 remove api version numbers and other renaming 2022-06-13 21:19:47 -05:00
coolGi 37384d8b8b Started work on 1.19 for main branch 2022-06-13 15:58:51 +09:30
coolGi fef487f698 Removed most cases of LodConfigWrapperSingleton 2022-06-11 22:27:15 +09:30
coolGi 33f999d139 Fixed a small bug fixing crash when config directory dosnt exist 2022-06-11 19:24:26 +09:30
James Seibel c880d80925 Extract a interface for DhApiConfig
DhApiConfig (and objects like it) should use interface wrapper combos so to prevent issues for implementing devs.
2022-06-09 21:32:19 -05:00
James Seibel 6a15705b51 Prepend "E" to all enums
Similar to how "I" is prepended to all interfaces.

Also Intellij appears to have removed some unneeded imports.
2022-06-09 21:07:08 -05:00
James Seibel fb83a2eaf9 Move several Api Enums back into Core 2022-06-09 20:59:33 -05:00
James Seibel 1743aad851 Add Api Enum Unit tests 2022-06-09 20:54:18 -05:00
James Seibel 6df38f9c7c Replace DhApiFogColorMode with FogColorMode 2022-06-09 20:52:33 -05:00
James Seibel 8c31236ccd Start adding API tests 2022-06-06 22:25:33 -05:00
coolGi 2410ad9f23 Why did this rename itself 2022-06-03 17:18:55 +09:30
coolGi cd721277e7 Merge branch 'tmp'
# Conflicts:
#	src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java
2022-06-03 17:16:25 +09:30
coolGi e497b5f9e8 Renamed Main to ForgeMain and added some config ui comment stuff 2022-06-03 17:13:28 +09:30
James Seibel 83fac52334 Revamp the API to use API objects and enums 2022-06-02 22:33:52 -05:00
TomTheFurry 4d2e68e4e5 Fix up multiple errors and init issues everywhere 2022-06-02 17:38:19 +08:00
TomTheFurry 145260bf6d Fixup some init order errors and work on able to enter world. 2022-06-02 13:54:15 +08:00
TomTheFurry d5e24ad2bb Rework fabric hooks to use more fabric api if possible
(Since, honestly, their hooks location is way better when it exists...)
2022-06-02 12:57:32 +08:00
TomTheFurry f4f186ff78 Working on actually hook up events to use new one 2022-06-01 22:55:57 +08:00
TomTheFurry 94b20a363d Hey, Core builds now! (No clue what would happen though) 2022-05-30 22:35:58 +08:00
James Seibel e862124c68 Make API setters return success booleans 2022-05-28 18:22:09 -05:00
James Seibel 8133620fcf Add a couple missing helper methods to the config 2022-05-26 20:28:28 -05:00
James Seibel 1182a0cac3 Rename ConfigEntry.useApiOverwrite ->allowApiOverride 2022-05-26 20:28:14 -05:00
coolGi2007 1809721665 Why dosnt F3Screen not have a .java at the end of its name? 2022-05-26 09:25:06 +00:00
coolGi e8f79f8bec Added some stuff for the f3 screen 2022-05-26 08:48:58 +00:00
coolGi 030fb3b667 Refactored some config stuff and removed annotations 2022-05-26 17:55:16 +09:30
TomTheFurry 1dd947e573 Quick merge fix 2022-05-26 12:45:37 +08:00
TomTheFurry f35cf673e1 Working on connecting the dots with a7 stuff 2022-05-26 12:40:29 +08:00
James Seibel 510df79f90 Move Config into the config package 2022-05-25 21:55:53 -05:00
TomTheFurry 83540cf2d5 Clean up some stuff 2022-05-26 10:33:24 +08:00
TomTheFurry a10e82651d First I think somewhat prob should work renderbuffer impl? 2022-05-25 22:44:47 +08:00
TomTheFurry 987dfbc87f Continue work on Saving the data.. 2022-05-23 20:20:27 +08:00
TomTheFurry b391252c03 Continue work on Saving the data. 2022-05-21 14:46:17 +08:00
TomTheFurry af82e4a6d4 Fix up QuadTree 2022-05-17 19:48:49 +08:00
TomTheFurry 37a8183176 Make everything use renamed ColumnDataPoint 2022-05-17 19:06:19 +08:00
TomTheFurry 3e5d27505c Finish up the ColumnDatatype and related copy and stuff 2022-05-17 18:52:50 +08:00
TomTheFurry e0280cc038 The very start of file management. 2022-05-15 14:38:50 +08:00
TomTheFurry ad1e3ef62a Fix some slight stuff 2022-05-14 14:21:23 +08:00
TomTheFurry 8e296f98d7 Complete the dynamic section data detail offset quad tree. (Untested) 2022-05-13 14:10:33 +08:00
Morippi 8e524a915c changed some names 2022-05-12 19:44:00 +02:00
TomTheFurry 3ea3df62e9 Start impl the dynamic section data detail offset 2022-05-12 19:08:28 +08:00
TomTheFurry cb85e396f0 Trash unneeded stuff 2022-05-12 18:21:18 +08:00
TomTheFurry a6165d56b6 Mark a thing so people switch over 2022-05-12 18:13:09 +08:00
TomTheFurry 4d352b012f Continue making the structure of data 2022-05-12 13:34:27 +08:00
James Seibel d7962fbb4e Add the prefix "DhApi" to the external api classes 2022-05-11 19:11:43 -05:00
Morippi 4a0a541fff changed a function name 2022-05-11 16:26:41 +02:00
Morippi 67e32d31ac fixed a small error 2022-05-11 15:28:06 +02:00
Morippi 57cd396920 Modified the update to work with new merge 2022-05-11 15:03:46 +02:00
Morippi 1336997ce0 Added merge data to RenderDataContainer 2022-05-11 14:55:23 +02:00
Morippi d99b6270a6 Merge remote-tracking branch 'origin/main' into main 2022-05-11 14:54:22 +02:00
Morippi 9caed982e3 Added merge data to RenderDataContainer 2022-05-11 14:54:13 +02:00
coolGi e13c331f0a Now a triangle in the config screen (until you resize the window, then it crashes) 2022-05-11 12:23:05 +00:00
TomTheFurry 3044a25adc Continue making the basic structure of data thing 2022-05-11 18:27:58 +08:00
TomTheFurry c797b5397b Hooked up the stuff with buffer thingy 2022-05-11 17:39:25 +08:00
TomTheFurry 0c52fe8364 Continue work on buffer managements 2022-05-11 17:19:32 +08:00
Morippi 786e00e88f small fixes 2022-05-11 09:52:20 +02:00
Morippi e8b964d8b7 Added Air lod container 2022-05-11 09:35:42 +02:00
Morippi 3f6a2d5195 Added Air lod container 2022-05-11 09:33:57 +02:00
Morippi c01f81b4ad Added new comment + improved merge 2022-05-10 22:30:13 +02:00
Morippi d8bb79c533 Added Comments to the quadTree Class 2022-05-10 21:50:42 +02:00
James Seibel 2e9d95d29c remove "border" from the overdraw tooltip 2022-05-09 20:38:18 -05:00
Morippi 5b4643a5ae Added ProtoSection class 2022-05-09 18:12:23 +02:00
Morippi 8e0566c4f1 Changed DhChunk 2022-05-09 18:03:21 +02:00
TomTheFurry a872547d72 Start to work on actual rendering side of things. 2022-05-09 16:23:40 +08:00
TomTheFurry ff181761c2 Complete v1 of the QuadTree stuff. Good sturcturing too I would say ;) 2022-05-09 14:47:13 +08:00
coolGi 909707214f Set up theming for standalone jar and moved shadow stuff to main gradle 2022-05-08 15:28:43 +09:30
coolGi 1ba3647b6b Changed my name to coolGi 2022-05-07 22:36:44 +09:30
coolGi 586786fd18 Moved everything out of LodConfigWrapper (pls dont use this) 2022-05-07 22:28:09 +09:30
TomTheFurry c4258ca96c Continue a7 dev focused on qTree 2022-05-07 16:58:38 +08:00
TomTheFurry 037e890d0d Make some more change, (and also lost my changes... rip) 2022-05-06 15:02:45 +08:00
Morippi 961c936f92 Started working on lodSection, LodQUadTree and DhChunk (not completed) 2022-05-04 23:18:34 +02:00
James Seibel f8292e8daa Set the api version to 0.0 (since it hasn't been released yet) 2022-05-03 21:27:55 -05:00
TomTheFurry 06281321d0 Add new a1.7 rebuild first step 2022-05-03 19:22:36 +08:00
TomTheFurry 09a9e98937 Renamed RegionPos to DHRegionPos as per the suggestion 2022-05-03 14:21:52 +08:00
TomTheFurry b4bad71813 Del ChunkPosWrapper & BlockPosWrapper, Create DHChunkPos & DHBlockPos, and also their related changes so it runs. 2022-05-03 14:06:26 +08:00
CodeF53 5ddf4f6ddf Typos 2022-05-01 10:34:41 -06:00
CodeF53 79224bdca3 Add a toggle for avoided blocks tint. Close #281
This is off by default

Additional comments in #tech-talk:
https://discord.com/channels/881614130614767666/902896965354930217/970351193928921139
2022-05-01 09:59:36 -06:00
TomTheFurry 10943e0d7d Added pre merge quads for more performance!!!! 2022-05-01 16:05:05 +08:00
TomTheFurry 031539bd31 Added dataView system so no longer need to copy arrays around 2022-05-01 14:19:51 +08:00
TomTheFurry be7a077367 Improved throwable logging for two custom logger 2022-05-01 13:14:29 +08:00
coolGi2007 e116b891a8 Some api stuff for config and updated readme to add json 2022-04-29 23:30:25 +09:30
coolGi2007 4310721640 New config finally done 2022-04-29 14:18:29 +09:30
coolGi2007 2888091b47 Merge remote-tracking branch 'origin/newConfig' into HEAD
# Conflicts:
#	src/main/java/com/seibel/lod/core/Config.java
#	src/main/java/com/seibel/lod/core/JarMain.java
#	src/main/java/com/seibel/lod/core/config/ConfigBase.java
#	src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java
#	src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java
#	src/main/java/com/seibel/lod/core/util/SingletonHandler.java
#	src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java
#	src/main/resources/assets/lod/lang/en_us.json
2022-04-29 10:52:19 +09:30
coolGi2007 600314e419 FINALLY! CLASSIC CONFIG GUI DONE 2022-04-28 14:17:27 +00:00
coolGi2007 768bd88982 (core didnt push) Fixed number values and got closer to completing the classic gui 2022-04-28 10:33:05 +00:00
James Seibel 7ee05282dd Remove invalid preprocessors from Core
Core can't use preprocessors
2022-04-27 21:56:00 -05:00
coolGi2007 417c3fcf8b Some api stuff for servers and stopped people setting invalid values trough file 2022-04-27 18:33:06 +09:30
James Seibel 76ac0ad3ff Add the first draft of the DH Api 2022-04-26 22:04:21 -05:00
James Seibel 170042620a use the dev preprocessor to display the dev build warning 2022-04-26 21:31:02 -05:00
coolGi2007 529777360b Add classic config GUI part 2/3 2022-04-25 15:02:18 +09:30
James Seibel f5d48ebcd3 Prep for the external DH API
All files previously in the "api" package have been moved to "api.internal"
2022-04-24 19:18:41 -05:00
James Seibel ad0eb208ea Replace the ApiShared Logger with class specific loggers
This should make the logs easier to understand.
2022-04-24 19:13:18 -05:00
James Seibel babc65217c minor refactors 2022-04-24 17:19:16 -05:00
James Seibel 5a79fac6b1 Update the licensing file
I forgot there was a file in Core
2022-04-24 16:46:57 -05:00
James Seibel bc0afd2bd5 Change the license from GPL to LGPL 2022-04-24 15:28:45 -05:00
coolGi2007 3fb4d631ac Even more abstraction to config stuff 2022-04-24 15:49:49 +10:00
James Seibel 83a2fa86d9 update the version number to 1.7.0a-dev
And re-enable the experimental build warning
2022-04-22 22:28:20 -05:00
coolGi2007 1f80084377 Fixed not running 2022-04-21 10:58:23 +10:00
coolGi2007 69e0cfe97a Commit part 1 of trying to make the gui work vanilla 2022-04-21 10:17:55 +10:00
sasanaps@hotmail.com 85f16e749a Commit to fix 1 thing 2022-04-20 20:20:58 +10:00
sasanaps@hotmail.com a3bbdc421f Just a commit to save the progress 2022-04-20 20:00:33 +10:00
coolGi2007 b431670255 Abstracted alot of stuff to do with the screen 2022-03-29 15:54:22 +10:30
coolGi2007 0b28257f2f Added a warning when you try to run the jar 2022-03-27 13:54:05 +10:30
coolGi2007 6f7b1ac223 Allowed use of hash map rather than using MultiOption 2022-03-26 20:07:12 +10:30
coolGi2007 db2636946e Added a way to put multiple options into 1 item and added some code for standalone jar 2022-03-25 17:26:26 +10:30
coolGi2007 2fa54347ea Renamed some stuff and updated core 2022-03-13 14:31:33 +10:30
TomTheFurry 538df6000c Fixup that one line. With comments 2022-03-08 17:04:16 +08:00
coolGi2007 509c9cb21c Getting ready for gui (SOMEONE, please fix core/config/file/ConfigFileHandling line 80) 2022-02-28 18:23:27 +10:30
coolGi2007 711658fe38 Finished file handling (all that is needed to fix it is to fix line 80 in core/config/file/ConfigFileHandling.java) 2022-02-26 04:48:43 +00:00
coolGi2007 ffa6bb5653 Sorry Ran, I accidentally somehow reloved your commit before 2022-02-24 11:56:16 +00:00
coolGi2007 44a16ef4fe Started more work on the new config system (file handling) 2022-02-24 06:47:12 +00:00
Ran 081958db59 Update src/main/java/com/seibel/lod/core/config/ConfigBase.java 2022-02-20 13:17:35 +00:00
coolGi2007 83ec6f4da2 Updated some stuff 2022-02-20 07:30:07 +00:00
coolGi2007 6ff797c1cc Updated core 2022-02-20 13:22:06 +10:30
coolGi2007 d04247094a Added some stuff to the new config init 2022-02-20 13:12:01 +10:30
462 changed files with 34551 additions and 16651 deletions
+7 -1
View File
@@ -17,5 +17,11 @@ It should be automatically included when pulling the full mod.
XZ for Java (data compression)\
https://tukaani.org/xz/java.html
Toml for Java (config handeling)\
Json & Toml for Java (config handling)\
https://github.com/TheElectronWill/night-config
SVG Salamander for SVG's\
https://github.com/blackears/svgSalamander
FlatLaf for theming (for development testing, may remove later)\
https://www.formdev.com/flatlaf/
@@ -0,0 +1,46 @@
The following is short tutorial to setup and register a gitlab runner in a docker container on windows.
Docker can be installed via a installer from their website and these instructions assume that has already been done.
longer tutorials can be found at the following links:
https://faun.pub/gitlab-runner-setup-run-in-docker-container-on-windows-44fee102d02e
https://datawookie.dev/blog/2021/03/install-gitlab-runner-with-docker/
1. install the gitlab runner
run the following command in powershell, changing the config file location if need be
Note: This will NOT work in git bash, only powershell
docker run -d --name gitlab-runner --restart always -v C:\DistantHorizonsWorkspace\Docker\config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest
2. to make sure the docker container was set up correctly run:
docker container list
it will display the docker containers that have been created
3. start and register the runner
run the following command in powershell. change the <ITEM>'s to whatever they should be for the runner you are creating.
docker run --rm -t -i -v C:\gitlab-runner\config:/etc/gitlab-runner gitlab/gitlab-runner register --non-interactive --executor "docker" --docker-image alpine:latest --url "https://gitlab.com/" --registration-token "<TOKEN>" --description "<DESCRIPTION THAT SHOWS UP ON GITLAB>" --run-untagged="true" --locked="false"
4. done
at this point the runner should be up and running, to confirm this go to your:
gitlab project -> settings (on the left menu bar) -> CI/CD -> Runners
and you should see the newly registered runner (the description should show up under the runner's auto generated ID)
Additional commands:
manual registering (shouldn't be needed)
docker exec -it gitlab-runner gitlab-runner register
list gitlab runner info
docker exec -it gitlab-runner gitlab-runner list
list all commands the runner can use
(replace "help" with whatever command you want to use)
docker exec -it gitlab-runner gitlab-runner help

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 101 KiB

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 113 KiB

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

+64
View File
@@ -0,0 +1,64 @@
<?xml version="1.0" standalone="yes"?>
<svg xmlns="http://www.w3.org/2000/svg" width="2040" height="2040">
<!-- Distant Horizons logo in svg format -->
<!-- Converted svg made by coolGi -->
<!-- Made by hand so there may be inaccuracies -->
<!--
Colors used
Blue: "fill:#465AA8"
Green: "fill:#5C7E3C"
Wierd green: "fill:#DCD7AA"
-->
<!-- Big Blue -->
<polygon points="1018.5,15 1434,255 1018.5,486 603,255" style="fill:#465AA8" />
<polygon points="1460,270 1875.5,509.5 1460,750 1045,509" style="fill:#465AA8" />
<polygon points="1889,531.5 1889,1012 1473,1252 1473,772" style="fill:#465AA8" />
<!-- Big Green -->
<polygon points="577,269 992,510 577,750 162,509.5" style="fill:#5C7E3C" />
<polygon points="149,532 564,772 564,1252 149,1012" style="fill:#5C7E3C" />
<polygon points="1889,1041 1889,1522 1474,1762 1473,1281" style="fill:#5C7E3C" />
<!-- Big Wierd Green -->
<polygon points="149,1042 564,1282 564,1762 149,1522" style="fill:#DCD7AA" />
<polygon points="590,1297 1006,1537 1006,2017 590,1777" style="fill:#DCD7AA" />
<polygon points="1031,1537 1447,1297 1447,1777 1031,2017" style="fill:#DCD7AA" />
<!-- Mid Blue -->
<polygon points="1239.5,652 1434,764.5 1239.5,877 1045,764.5" style="fill:#465AA8" />
<polygon points="1447,787 1447,1012 1252,1125 1252,899" style="fill:#465AA8" />
<!-- Mid Green -->
<polygon points="1018.5,525 1214,637 1018.5,749 824,637" style="fill:#5C7E3C" />
<polygon points="798,652 992,764.5 798,877 603,764.5" style="fill:#5C7E3C" />
<polygon points="590,787 785,899 785,1125 590,1012" style="fill:#5C7E3C" />
<polygon points="1447,1042 1447,1267 1252,1380 1252,1154" style="fill:#5C7E3C" />
<polygon points="1226,1170 1226,1395 1031,1507 1031,1282" style="fill:#5C7E3C" />
<!-- Mid Wierd Green -->
<polygon points="590,1042 785,1154 785,1379 590,1267" style="fill:#DCD7AA" />
<polygon points="811,1169 1006,1282 1006,1507 811,1395" style="fill:#DCD7AA" />
<!-- Out Small Blue -->
<polygon points="1018.5,779.5 1103,828 1018.5,877 934,828" style="fill:#465AA8" />
<polygon points="1129,843 1214,892 1129,941 1044,892" style="fill:#465AA8" />
<polygon points="1226,914 1226,1012 1142,1061 1142,963" style="fill:#465AA8" />
<polygon points="1226,1042 1226,1140 1142,1188 1142,1090" style="fill:#465AA8" />
<polygon points="1116,1105 1116,1203 1031,1252 1031,1154" style="fill:#465AA8" />
<!-- Out Small Green -->
<polygon points="908,843 993,892 908,941 823,892" style="fill:#5C7E3C" />
<polygon points="811,914 895,963 895,1061 811,1012" style="fill:#5C7E3C" />
<polygon points="921,1105 1006,1154 1006,1252 921,1203" style="fill:#5C7E3C" />
<!-- Out Small Wierd Green -->
<polygon points="811,1042 895,1090 895,1188 811,1140" style="fill:#DCD7AA" />
<!-- In Small Blue -->
<polygon points="1116,978 1116,1076 1031,1125 1031,1027" style="fill:#465AA8" />
<!-- In Small Green -->
<polygon points="1018.5,907 1103,956 1018.5,1004 934,956" style="fill:#5C7E3C" />
<polygon points="921,978 1006,1027 1006,1125 921,1076" style="fill:#5C7E3C" />
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

Before

Width:  |  Height:  |  Size: 191 KiB

After

Width:  |  Height:  |  Size: 191 KiB

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 172 KiB

Before

Width:  |  Height:  |  Size: 194 KiB

After

Width:  |  Height:  |  Size: 194 KiB

Before

Width:  |  Height:  |  Size: 174 KiB

After

Width:  |  Height:  |  Size: 174 KiB

@@ -0,0 +1,4 @@
FROM anapsix/alpine-java
MAINTAINER Ran
COPY anotherquestion-1.0-SNAPSHOT.jar /home/anotherquestion-1.0-SNAPSHOT.jar
CMD ["java","-jar","/home/anotherquestion-1.0-SNAPSHOT.jar"]
@@ -0,0 +1,93 @@
package com.seibel.lod.api;
import com.seibel.lod.api.interfaces.config.IDhApiConfig;
import com.seibel.lod.api.interfaces.override.IDhApiOverrideable;
import com.seibel.lod.api.interfaces.override.worldGenerator.IDhApiWorldGeneratorOverrideRegister;
import com.seibel.lod.api.interfaces.render.IDhApiRenderProxy;
import com.seibel.lod.api.interfaces.world.IDhApiWorldProxy;
import com.seibel.lod.api.methods.override.DhApiWorldGeneratorOverrideRegister;
import com.seibel.lod.coreapi.DependencyInjection.ApiEventInjector;
import com.seibel.lod.coreapi.DependencyInjection.OverrideInjector;
import com.seibel.lod.coreapi.ModInfo;
import com.seibel.lod.api.interfaces.data.IDhApiTerrainDataRepo;
import com.seibel.lod.api.interfaces.events.IDhApiEventInjector;
import com.seibel.lod.coreapi.interfaces.dependencyInjection.IOverrideInjector;
/**
* This is the masthead of the API, almost everything you could want to do
* can be achieved from here. <br>
* For example: you can access singletons which handle the config or event binding. <br><br>
*
* <strong>Q:</strong> Why should I use this class instead of just getting the API singleton I need? <br>
*
* <strong>A:</strong> This way there is a lower chance of your code breaking if we change something on our end.
* For example, if we realized there is a much better way of handling dependency injection we would keep the
* interface the same so your code doesn't have to change. Whereas if you were directly referencing
* the concrete object we replaced, there would be issues.
*
* @author James Seibel
* @version 2023-2-9
*/
public class DhApiMain
{
/**
* <strong>WARNING:</strong>
* All objects in this class will be null until after DH initializes for the first time. <br><br>
*
* Bind a custom {@link com.seibel.lod.api.methods.events.abstractEvents.DhApiAfterDhInitEvent DhApiAfterDhInitEvent}
* to {@link DhApiMain#events ApiCoreInjectors.events} in order to be notified when this class can
* be safely used.
*/
public static class Delayed
{
/** Used to interact with Distant Horizons' Configs. */
public static IDhApiConfig configs = null;
/**
* Used to interact with Distant Horizons' terrain data.
* Designed to be used in conjunction with {@link DhApiMain.Delayed#worldProxy}.
*/
public static IDhApiTerrainDataRepo terrainRepo = null;
/**
* Used to interact with Distant Horizons' currently loaded world.
* Designed to be used in conjunction with {@link DhApiMain.Delayed#terrainRepo}.
*/
public static IDhApiWorldProxy worldProxy = null;
/** Used to interact with Distant Horizons' rendering system. */
public static IDhApiRenderProxy renderProxy = null;
}
// always available //
/** Used to bind/unbind Distant Horizons Api events. */
public static final IDhApiEventInjector events = ApiEventInjector.INSTANCE;
/** Used to bind/unbind Distant Horizons Api events. */
public static final IDhApiWorldGeneratorOverrideRegister worldGenOverrides = DhApiWorldGeneratorOverrideRegister.INSTANCE;
/** Used to bind overrides to change Distant Horizons' core behavior. */
public static final IOverrideInjector<IDhApiOverrideable> overrides = OverrideInjector.INSTANCE;
/** This version should only be updated when breaking changes are introduced to the Distant Horizons API. */
public static int getApiMajorVersion() { return ModInfo.API_MAJOR_VERSION; }
/** This version should be updated whenever new methods are added to the Distant Horizons API. */
public static int getApiMinorVersion() { return ModInfo.API_MINOR_VERSION; }
/**
* Returns the mod's semantic version number in the format: Major.Minor.Patch
* with optional extensions "-a" for alpha, "-b" for beta, and -dev for unstable development builds. <br>
* Examples: "1.6.9-a", "1.7.0-a-dev", "2.1.0-b", "3.0.0", "3.1.4-dev"
*/
public static String getModVersion() { return ModInfo.VERSION; }
/** Returns true if the mod is a development version, false if it is a release version. */
public static boolean getIsDevVersion() { return ModInfo.IS_DEV_BUILD; }
/** Returns the network protocol version. */
public static int getNetworkProtocolVersion() { return ModInfo.PROTOCOL_VERSION; }
}
@@ -0,0 +1 @@
The external api package holds any code that interfaces between Distant Horizons and other mods or projects.
@@ -0,0 +1,52 @@
package com.seibel.lod.api.enums;
/**
* BLOCK - Detail Level: 0, width 1 block, <br>
* CHUNK - Detail Level: 4, width 16 block, <br>
* REGION - Detail Level: 9, width 512 block <br> <br>
*
* Detail levels in Distant Horizons represent how large a section (of either LODs or MC chunks)
* is, with the smallest being 0 (1 block wide). <br>
* The width of a detail level can be calculated by putting the detail level to the power of 2. <br>
* Example for the chunk detail level (4): 2^4 = 16 blocks wide <Br><br>
*
* This enum doesn't contain all valid detail levels, only those most likely to be needed.
* Detail levels 1,2,3, ... 255 are all technically valid detail levels
* (although anything beyond {@link EDhApiDetailLevel#REGION} may be difficult deal with).
*
* @author James Seibel
* @version 2022-12-5
*/
public enum EDhApiDetailLevel
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/**
* detail level: 0 <Br>
* width in Blocks: 1
*/
BLOCK(0, 1),
/**
* detail level: 4 <Br>
* width in Blocks: 16
*/
CHUNK(4, 16),
/**
* detail level: 9 <Br>
* width in Blocks: 512
*/
REGION(9, 512);
public final byte detailLevel;
public final byte widthInBlocks;
EDhApiDetailLevel(int detailLevel, int widthInBlocks)
{
this.detailLevel = (byte) detailLevel;
this.widthInBlocks = (byte) widthInBlocks;
}
}
@@ -1,33 +1,39 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.config;
package com.seibel.lod.api.enums.config;
/**
* heightmap <br>
* multi_lod <br>
*
* NONE, <br>
* NON_FULL, <br>
* NO_COLLISION, <br>
* BOTH, <br>
*
* @author Leonardo Amato
* @version 11-16-2021
* @version 2022-7-1
*/
public enum BlocksToAvoid
public enum EBlocksToAvoid
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
NONE(false, false),
NON_FULL(true, false),
@@ -39,7 +45,7 @@ public enum BlocksToAvoid
public final boolean nonFull;
public final boolean noCollision;
BlocksToAvoid(boolean nonFull, boolean noCollision)
EBlocksToAvoid(boolean nonFull, boolean noCollision)
{
this.nonFull = nonFull;
this.noCollision = noCollision;
@@ -1,35 +1,36 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.config;
package com.seibel.lod.api.enums.config;
/**
* CONSTANT <br>
* FREQUENT <br>
* NORMAL <br>
* RARE <br>
* <br>
* Determines how fast the buffers need to be regenerated
* RARE <br> <br>
*
* Determines how fast the buffers should be regenerated
*
* @author Leonardo Amato
* @version 9-25-2021
*/
public enum BufferRebuildTimes
public enum EBufferRebuildTimes
{
CONSTANT(0, 0, 0, 1),
@@ -44,7 +45,7 @@ public enum BufferRebuildTimes
public final int chunkChangeTimeout;
public final int playerMoveDistance;
BufferRebuildTimes(int playerMoveTimeout, int renderedChunkTimeout, int chunkChangeTimeout, int playerMoveDistance)
EBufferRebuildTimes(int playerMoveTimeout, int renderedChunkTimeout, int chunkChangeTimeout, int playerMoveDistance)
{
this.playerMoveTimeout = playerMoveTimeout;
this.renderedChunkTimeout = renderedChunkTimeout;
@@ -1,37 +1,41 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.config;
package com.seibel.lod.api.enums.config;
/**
* AUTO <br>
* Near_First <br>
* Far_First <br>
* <br>
* Far_First <br> <br>
*
* Determines which LODs should have priority when generating
* outside the normal view distance.
*
* @author Leonardo Amato
* @version 12-1-2021
*/
public enum GenerationPriority
public enum EGenerationPriority
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/** NEAR_FIRST when connected to servers and BALANCED when on single player */
AUTO,
@@ -1,38 +1,42 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.config;
package com.seibel.lod.api.enums.config;
/**
* Auto, BUFFER_STORAGE_MAPPING, Buffer_Storage, Sub_Data, Buffer_Mapping, Data
*
* AUTO, <br>
* BUFFER_STORAGE, <br>
* SUB_DATA, <br>
* BUFFER_MAPPING, <br>
* DATA <br>
*
* @author Leetom
* @author James Seibel
* @version 12-1-2021
* @version 2022-7-2
*/
public enum GpuUploadMethod
public enum EGpuUploadMethod
{
/** Picks the best option based on the GPU the user has. */
AUTO(false, false),
/*
*/
BUFFER_STORAGE_MAPPING(true, true),
// commented out since it isn't currently in use
//BUFFER_STORAGE_MAPPING(true, true),
/**
* Default for NVIDIA if OpenGL 4.5 is supported. <br>
@@ -60,9 +64,13 @@ public enum GpuUploadMethod
*/
DATA(false, false);
public final boolean useEarlyMapping;
public final boolean useBufferStorage;
GpuUploadMethod(boolean useEarlyMapping, boolean useBufferStorage) {
EGpuUploadMethod(boolean useEarlyMapping, boolean useBufferStorage)
{
this.useEarlyMapping = useEarlyMapping;
this.useBufferStorage = useBufferStorage;
}
@@ -1,37 +1,42 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.config;
package com.seibel.lod.api.enums.config;
/**
* Lowest <br>
* Low <br>
* Medium <br>
* High <br>
* <br>
* this indicates the base of the quadratic function we use for the quality drop off
* LOWEST <br>
* LOW <br>
* MEDIUM <br>
* HIGH <br> <br>
*
* this indicates the base of the quadratic function we use for the quality drop-off
*
* @author Leonardo Amato
* @version 9-29-2021
*/
public enum HorizontalQuality
public enum EHorizontalQuality
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/** 1.0 AKA Linear */
LOWEST(1.0f),
@@ -46,7 +51,7 @@ public enum HorizontalQuality
public final double quadraticBase;
HorizontalQuality(double distanceUnit)
EHorizontalQuality(double distanceUnit)
{
this.quadraticBase = distanceUnit;
}
@@ -1,41 +1,41 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.config;
package com.seibel.lod.api.enums.config;
import java.util.ArrayList;
import java.util.Collections;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.coreapi.util.MathUtil;
/**
* chunk <Br>
* half_chunk <Br>
* four_blocks <br>
* two_blocks <Br>
* block <br>
* BLOCK <Br>
* TWO_BLOCKS <Br>
* FOUR_BLOCKS <br>
* HALF_CHUNK <Br>
* CHUNK <br>
*
* @author James Seibel
* @author Leonardo Amato
* @version 9-25-2021
* @version 2022-7-5
*/
public enum HorizontalResolution
public enum EHorizontalResolution
{
/** render 256 LODs for each chunk */
BLOCK(16, 0),
@@ -85,12 +85,12 @@ public enum HorizontalResolution
* 2nd dimension: An array of all LodDetails that are less than or <br>
* equal to that detailLevel
*/
private static HorizontalResolution[][] lowerDetailArrays;
private static EHorizontalResolution[][] lowerDetailArrays;
HorizontalResolution(int newLengthCount, int newDetailLevel)
EHorizontalResolution(int newLengthCount, int newDetailLevel)
{
detailLevel = (byte) newDetailLevel;
dataPointLengthCount = newLengthCount;
@@ -129,20 +129,20 @@ public enum HorizontalResolution
* Returns an array of all LodDetails that have a detail level
* that is less than or equal to the given LodDetail
*/
public static HorizontalResolution[] getSelfAndLowerDetails(HorizontalResolution detail)
public static EHorizontalResolution[] getSelfAndLowerDetails(EHorizontalResolution detail)
{
if (lowerDetailArrays == null)
{
// run first time setup
lowerDetailArrays = new HorizontalResolution[HorizontalResolution.values().length][];
lowerDetailArrays = new EHorizontalResolution[EHorizontalResolution.values().length][];
// go through each LodDetail
for (HorizontalResolution currentDetail : HorizontalResolution.values())
for (EHorizontalResolution currentDetail : EHorizontalResolution.values())
{
ArrayList<HorizontalResolution> lowerDetails = new ArrayList<>();
ArrayList<EHorizontalResolution> lowerDetails = new ArrayList<>();
// find the details lower than currentDetail
for (HorizontalResolution compareDetail : HorizontalResolution.values())
for (EHorizontalResolution compareDetail : EHorizontalResolution.values())
{
if (currentDetail.detailLevel <= compareDetail.detailLevel)
{
@@ -154,7 +154,7 @@ public enum HorizontalResolution
Collections.sort(lowerDetails);
Collections.reverse(lowerDetails);
lowerDetailArrays[currentDetail.detailLevel] = lowerDetails.toArray(new HorizontalResolution[lowerDetails.size()]);
lowerDetailArrays[currentDetail.detailLevel] = lowerDetails.toArray(new EHorizontalResolution[lowerDetails.size()]);
}
}
@@ -162,11 +162,11 @@ public enum HorizontalResolution
}
/** Returns what detail level should be used at a given distance and maxDistance. */
public static HorizontalResolution getDetailForDistance(HorizontalResolution maxDetailLevel, int distance, int maxDistance)
public static EHorizontalResolution getDetailForDistance(EHorizontalResolution maxDetailLevel, int distance, int maxDistance)
{
HorizontalResolution[] lowerDetails = getSelfAndLowerDetails(maxDetailLevel);
EHorizontalResolution[] lowerDetails = getSelfAndLowerDetails(maxDetailLevel);
int distanceBetweenDetails = maxDistance / lowerDetails.length;
int index = LodUtil.clamp(0, distance / distanceBetweenDetails, lowerDetails.length - 1);
int index = MathUtil.clamp(0, distance / distanceBetweenDetails, lowerDetails.length - 1);
return lowerDetails[index];
@@ -1,23 +1,23 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.config;
package com.seibel.lod.api.enums.config;
/**
* Low <br>
@@ -29,7 +29,7 @@ package com.seibel.lod.core.enums.config;
* @author Leonardo Amato
* @version 9-25-2021
*/
public enum HorizontalScale
public enum EHorizontalScale
{
/** Lods are 2D with heightMap */
LOW(64),
@@ -42,7 +42,7 @@ public enum HorizontalScale
public final int distanceUnit;
HorizontalScale(int distanceUnit)
EHorizontalScale(int distanceUnit)
{
this.distanceUnit = distanceUnit;
}
@@ -0,0 +1,40 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.enums.config;
/**
* FAST, <br>
* FANCY,
*
* @author Leetom
* @version 2022-7-1
*/
public enum ELightGenerationMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/** Fake light values using a height map */
FAST,
/** Run the lighting engine though the chunk to generate proper light values */
FANCY
}
@@ -1,26 +1,27 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.config;
package com.seibel.lod.api.enums.config;
import org.apache.logging.log4j.Level;
public enum LoggerMode {
public enum ELoggerMode
{
DISABLED(Level.OFF, Level.OFF),
LOG_ALL_TO_FILE(Level.ALL, Level.OFF),
LOG_ERROR_TO_CHAT(Level.ALL, Level.ERROR),
@@ -37,7 +38,7 @@ public enum LoggerMode {
;
public final Level levelForFile;
public final Level levelForChat;
LoggerMode(Level levelForFile, Level levelForChat) {
ELoggerMode(Level levelForFile, Level levelForChat) {
this.levelForFile = levelForFile;
this.levelForChat = levelForChat;
}
@@ -1,38 +1,43 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2022 Tom Lee (TomTheFurry)
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.config;
package com.seibel.lod.api.enums.config;
/**
* AUTO <br>
* NAME_ONLY <br>
* NAME_IP <br>
* NAME_IP_PORT <br>
* <br>
* AUTO, <br>
* NAME_ONLY, <br>
* NAME_IP, <br>
* NAME_IP_PORT, <br> <br>
*
* Determines how the multiplayer folders should be named.
*
* @author James Seibel
* @version 3-7-2022
* @version 2022-7-1
*/
public enum ServerFolderNameMode
public enum EServerFolderNameMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/**
* NAME_IP for LAN connections <Br>
* NAME_IP_PORT for all others
@@ -44,25 +49,23 @@ public enum ServerFolderNameMode
/**
* {SERVER_NAME} IP {IP} <br>
* Minecraft Server IP 192.168.1.40
* Example: Minecraft Server IP 192.168.1.40
*/
NAME_IP,
/**
* {SERVER_NAME} IP {IP} <br>
* Minecraft Server IP 192.168.1.40:25565
/**
* {SERVER_NAME} IP {IP}:{PORT} <br>
* Example: Minecraft Server IP 192.168.1.40:25565
*/
NAME_IP_PORT,
/**
* {SERVER_NAME} IP {IP} <br>
* Minecraft Server IP 192.168.1.40:25565 GameVersion 1.16.5 <Br> <br>
* Example: Minecraft Server IP 192.168.1.40:25565 GameVersion 1.16.5 <Br> <br>
*
* Not normally recommended, since the game version can change if the
* server installs paper or some other jar. <br>
* This is just here to provide backwards compatibility.
*
* TODO add this to config desc
*/
NAME_IP_PORT_MC_VERSION;
@@ -1,23 +1,23 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.config;
package com.seibel.lod.api.enums.config;
/**
* NONE, GAME_SHADING
@@ -25,7 +25,7 @@ package com.seibel.lod.core.enums.config;
* @author James Seibel
* @version 7-25-2020
*/
public enum ShadingMode
public enum EShadingMode
{
/**
* LODs will have darker sides and bottoms to simulate
@@ -34,7 +34,7 @@ public enum ShadingMode
GAME_SHADING,
/**
* LODs will use ambient occlusion to mimic Minecarft's
* LODs will use ambient occlusion to mimic Minecraft's
* Fancy lighting.
*/
AMBIENT_OCCLUSION
@@ -1,40 +1,52 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.config;
package com.seibel.lod.api.enums.config;
/**
* None, Dynamic, Always
* NEVER, <br>
* DYNAMIC, <br>
* ALWAYS <br> <br>
*
* <p>
* This represents how far the LODs should overlap with
* the vanilla Minecraft terrain.
*
* @author James Seibel
* @version 10-11-2021
* @version 2022-6-30
*/
public enum VanillaOverdraw
public enum EVanillaOverdraw
{
/** Dont draw LODs where a minecraft chunk could be. Use Overdraw Offset to tweak the border thickness */
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/**
* Don't draw LODs where a minecraft chunk could be.
* Use Overdraw Offset to tweak the border thickness.
*/
NEVER,
/** Draw LODs over the farther minecraft chunks. Dynamically decides the border thickness */
/**
* Draw LODs over the farther minecraft chunks.
* Dynamically decides the border thickness
*/
DYNAMIC,
/** Draw LODs over all minecraft chunks. */
@@ -0,0 +1,88 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.enums.config;
/**
* heightmap <br>
* multi_lod <br>
*
* @author Leonardo Amato
* @version 2023-2-5
*/
public enum EVerticalQuality
{
// HEIGHT_MAP(new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }), // commented out for now since it causes issues with transparency, may be re-added if the transparency issue is fixed
LOW(new int[] { 4, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1 }),
MEDIUM(new int[] { 6, 4, 3, 2, 2, 1, 1, 1, 1, 1, 1 }),
HIGH(new int[] { 8, 6, 4, 2, 2, 2, 2, 1, 1, 1, 1 }),
ULTRA(new int[] { 16, 8, 4, 2, 2, 2, 2, 1, 1, 1, 1 });
public final int[] maxVerticalData;
EVerticalQuality(int[] maxVerticalData) { this.maxVerticalData = maxVerticalData; }
/** returns null if out of range */
public static EVerticalQuality previous(EVerticalQuality mode)
{
switch (mode)
{
case ULTRA:
return EVerticalQuality.HIGH;
case HIGH:
return EVerticalQuality.MEDIUM;
case MEDIUM:
return EVerticalQuality.LOW;
case LOW:
default:
return null;
}
}
/** returns null if out of range */
public static EVerticalQuality next(EVerticalQuality mode)
{
switch (mode)
{
case MEDIUM:
return EVerticalQuality.HIGH;
case LOW:
return EVerticalQuality.MEDIUM;
case HIGH:
return EVerticalQuality.ULTRA;
case ULTRA:
default:
return null;
}
}
public int calculateMaxVerticalData(byte dataDetail)
{
if (dataDetail >= this.maxVerticalData.length)
{
dataDetail = (byte) (this.maxVerticalData.length - 1);
}
return this.maxVerticalData[dataDetail];
}
}
@@ -0,0 +1,112 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.enums.rendering;
/**
* OFF, <br>
* SHOW_WIREFRAME, <br>
* SHOW_DETAIL, <br>
* SHOW_DETAIL_WIREFRAME, <br>
* SHOW_GENMODE, <br>
* SHOW_GENMODE_WIREFRAME, <br>
* SHOW_OVERLAPPING_QUADS, <br>
* SHOW_OVERLAPPING_QUADS_WIREFRAME, <br>
* SHOW_RENDER_SOURCE_FLAG, <br>
* SHOW_RENDER_SOURCE_FLAG_WIREFRAME, <br>
*
* @author Leetom
* @author James Seibel
* @version 2022-7-2
*/
public enum EDebugMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/** LODs are rendered normally */
OFF,
/** LOD draws in wireframe. */
SHOW_WIREFRAME,
/** LOD colors are based on their detail */
SHOW_DETAIL,
/** LOD colors are based on their detail, and draws in wireframe. */
SHOW_DETAIL_WIREFRAME,
/** LOD colors are based on their gen mode. */
SHOW_GENMODE,
/** LOD colors are based on their gen mode, and draws in wireframe. */
SHOW_GENMODE_WIREFRAME,
/** Only draw overlapping LOD quads. */
SHOW_OVERLAPPING_QUADS,
/** Only draw overlapping LOD quads, and draws in wireframe. */
SHOW_OVERLAPPING_QUADS_WIREFRAME,
/** LOD colors are based on renderSource flags. */
SHOW_RENDER_SOURCE_FLAG,
/** LOD colors are based on renderSource flags, and draws in wireframe. */
SHOW_RENDER_SOURCE_FLAG_WIREFRAME;
/** returns the next debug mode */
// Deprecated: use DebugMode.next() instead
@Deprecated
public EDebugMode getNext()
{
return next(this);
}
public static EDebugMode next(EDebugMode type) {
switch (type) {
case OFF: return SHOW_WIREFRAME;
case SHOW_WIREFRAME: return SHOW_DETAIL;
case SHOW_DETAIL: return SHOW_DETAIL_WIREFRAME;
case SHOW_DETAIL_WIREFRAME: return SHOW_GENMODE;
case SHOW_GENMODE: return SHOW_GENMODE_WIREFRAME;
case SHOW_GENMODE_WIREFRAME: return SHOW_OVERLAPPING_QUADS;
case SHOW_OVERLAPPING_QUADS: return SHOW_OVERLAPPING_QUADS_WIREFRAME;
case SHOW_OVERLAPPING_QUADS_WIREFRAME: return SHOW_RENDER_SOURCE_FLAG;
case SHOW_RENDER_SOURCE_FLAG: return SHOW_RENDER_SOURCE_FLAG_WIREFRAME;
default: return OFF;
}
}
public static EDebugMode previous(EDebugMode type) {
switch (type) {
case OFF: return SHOW_RENDER_SOURCE_FLAG_WIREFRAME;
case SHOW_RENDER_SOURCE_FLAG_WIREFRAME: return SHOW_RENDER_SOURCE_FLAG;
case SHOW_RENDER_SOURCE_FLAG: return SHOW_OVERLAPPING_QUADS_WIREFRAME;
case SHOW_OVERLAPPING_QUADS_WIREFRAME: return SHOW_OVERLAPPING_QUADS;
case SHOW_OVERLAPPING_QUADS: return SHOW_GENMODE_WIREFRAME;
case SHOW_GENMODE_WIREFRAME: return SHOW_GENMODE;
case SHOW_GENMODE: return SHOW_DETAIL_WIREFRAME;
case SHOW_DETAIL_WIREFRAME: return SHOW_DETAIL;
case SHOW_DETAIL: return SHOW_WIREFRAME;
default: return OFF;
}
}
}
@@ -1,42 +1,46 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.rendering;
package com.seibel.lod.api.enums.rendering;
/**
* USE_DEFAULT_FOG_COLOR, <br>
* USE_SKY_COLOR, <br>
*
* @author James Seibel
* @version 11-27-2021
* @version 2022-6-9
*/
public enum FogColorMode
public enum EFogColorMode
{
// Reminder:
// when adding items: up the API minor version
// when removing items: up the API major version
/** Fog uses Minecraft's fog color. */
USE_WORLD_FOG_COLOR,
/**
* Replicates the effect of the clear sky mod.
* Making the fog blend in with the sky better
* For it to look good you need one of the following mods:
* https://www.curseforge.com/minecraft/mc-mods/clear-skies
* https://www.curseforge.com/minecraft/mc-mods/clear-skies-forge-port
* For it to look good you need one of those mods
*/
USE_SKY_COLOR,
}
@@ -1,32 +1,36 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.rendering;
package com.seibel.lod.api.enums.rendering;
/**
* NEAR, FAR, or NEAR_AND_FAR.
*
* @author James Seibel
* @version 11-26-2021
* @version 2022-6-2
*/
public enum FogDistance
public enum EFogDistance
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
NEAR,
FAR,
NEAR_AND_FAR
@@ -1,23 +1,23 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.rendering;
package com.seibel.lod.api.enums.rendering;
/**
* USE_OPTIFINE_FOG_SETTING, <br>
@@ -25,16 +25,21 @@ package com.seibel.lod.core.enums.rendering;
* FOG_DISABLED <br>
*
* @author James Seibel
* @version 11-27-2021
* @version 2022-6-2
*/
public enum FogDrawMode
public enum EFogDrawMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/**
* Use whatever Fog setting optifine is using.
* If optifine isn't installed this defaults to ALWAYS_DRAW_FOG.
* If optifine isn't installed this defaults to FOG_ENABLED.
*/
USE_OPTIFINE_SETTING,
FOG_ENABLED,
FOG_DISABLED
FOG_DISABLED;
}
@@ -0,0 +1,22 @@
package com.seibel.lod.api.enums.rendering;
/**
* LINEAR, <br>
* EXPONENTIAL, <br>
* EXPONENTIAL_SQUARED <br>
*
* @author Leetom
* @version 2022-6-30
*/
public enum EFogFalloff
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
LINEAR,
EXPONENTIAL,
EXPONENTIAL_SQUARED,
// TEXTURE_BASED, // TODO: Impl this
}
@@ -1,23 +1,23 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.rendering;
package com.seibel.lod.api.enums.rendering;
/**
* Minecraft, Lod_Builder, None
@@ -25,7 +25,7 @@ package com.seibel.lod.core.enums.rendering;
* @author James Seibel
* @version 10-1-2021
*/
public enum GLProxyContext
public enum EGLProxyContext
{
/** Minecraft's render thread */
MINECRAFT,
@@ -1,40 +1,40 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.rendering;
package com.seibel.lod.api.enums.rendering;
/**
* basic <br>
* Ignore_Height <br>
* Addition <br>
* Max <br>
* Multiply <br>
* Inverse_Multiply <br>
* Limited_Addition <br>
* Multiply_Addition <br>
* Inverse_Multiply_Addition <br>
* Average <br>
* BASIC <br>
* IGNORE_HEIGHT <br>
* ADDITION <br>
* MAX <br>
* MULTIPLY <br>
* INVERSE_MULTIPLY <br>
* LIMITED_ADDITION <br>
* MULTIPLY_ADDITION <br>
* INVERSE_MULTIPLY_ADDITION <br>
* AVERAGE <br>
*
* @author Leetom
* @version 2022-4-14
*/
public enum HeightFogMixMode
public enum EHeightFogMixMode
{
BASIC,
IGNORE_HEIGHT,
@@ -1,26 +1,42 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.enums.rendering;
package com.seibel.lod.api.enums.rendering;
public enum HeightFogMode
/**
* ABOVE_CAMERA, <br>
* BELOW_CAMERA, <br>
* ABOVE_AND_BELOW_CAMERA, <br>
* ABOVE_SET_HEIGHT, <br>
* BELOW_SET_HEIGHT, <br>
* ABOVE_AND_BELOW_SET_HEIGHT, <br>
*
* @author Leetom
* @version 6-30-2022
*/
public enum EHeightFogMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
ABOVE_CAMERA(true, true, false),
BELOW_CAMERA(true, false, true),
ABOVE_AND_BELOW_CAMERA(true, true, true),
@@ -32,7 +48,7 @@ public enum HeightFogMode
public final boolean above;
public final boolean below;
HeightFogMode(boolean basedOnCamera, boolean above, boolean below)
EHeightFogMode(boolean basedOnCamera, boolean above, boolean below)
{
this.basedOnCamera = basedOnCamera;
this.above = above;
@@ -0,0 +1,63 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.enums.rendering;
/**
* Default
* Debug
* Disabled
*
* @version 2022-6-2
*/
public enum ERendererMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
DEFAULT,
DEBUG,
DISABLED;
/** Used by the config GUI to cycle through the available rendering options */
public static ERendererMode next(ERendererMode type)
{
switch (type)
{
case DEFAULT: return DEBUG;
case DEBUG: return DISABLED;
default: return DEFAULT;
}
}
/** Used by the config GUI to cycle through the available rendering options */
public static ERendererMode previous(ERendererMode type)
{
switch (type)
{
case DEFAULT: return DISABLED;
case DEBUG: return DEFAULT;
default: return DEBUG;
}
}
}
@@ -0,0 +1,55 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.enums.rendering;
/**
* OFF, <br>
* SHOW_WIREFRAME, <br>
* SHOW_DETAIL, <br>
* SHOW_DETAIL_WIREFRAME, <br>
* SHOW_GENMODE, <br>
* SHOW_GENMODE_WIREFRAME, <br>
* SHOW_OVERLAPPING_QUADS, <br>
* SHOW_OVERLAPPING_QUADS_WIREFRAME, <br>
*
* @author Leetom
* @author James Seibel
* @version 2022-7-2
*/
public enum ETransparency
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
DISABLED(false, false),
FAKE(true, true),
COMPLETE(true, false);
public final boolean tranparencyEnabled;
public final boolean fakeTransparencyEnabled;
ETransparency(boolean tranparencyEnabled, boolean fakeTransparencyEnabled)
{
this.tranparencyEnabled = tranparencyEnabled;
this.fakeTransparencyEnabled = fakeTransparencyEnabled;
}
}
@@ -0,0 +1,142 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.enums.worldGeneration;
/**
* PRE_EXISTING_ONLY <br>
* BIOME_ONLY <br>
* BIOME_ONLY_SIMULATE_HEIGHT <br>
* SURFACE <br>
* FEATURES <br>
* FULL <br><br>
*
* In order of fastest to slowest.
*
* @author James Seibel
* @author Leonardo Amato
* @version 2022-12-10
*/
public enum EDhApiDistantGeneratorMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/** Don't generate any new terrain, just generate LODs for already generated chunks. */
PRE_EXISTING_ONLY((byte) 1),
/**
* Only generate the biomes and use biome
* grass/foliage color, water color, or ice color
* to generate the color. <br>
* Doesn't generate height, everything is shown at sea level. <br>
* Multithreaded - Fastest (2-5 ms)
*/
BIOME_ONLY((byte) 2),
/**
* Same as BIOME_ONLY, except instead
* of always using sea level as the LOD height
* different biome types (mountain, ocean, forest, etc.)
* use predetermined heights to simulate having height data.
*/
BIOME_ONLY_SIMULATE_HEIGHT((byte) 3),
/**
* Generate the world surface,
* this does NOT include caves, trees,
* or structures. <br>
* Multithreaded - Faster (10-20 ms)
*/
SURFACE((byte) 4),
/**
* Generate including structures.
* NOTE: This may cause world generation bugs or instability,
* since some features can cause concurrentModification exceptions. <br>
* Multithreaded - Fast (15-20 ms)
*/
FEATURES((byte) 5),
/**
* Ask the server to generate/load each chunk.
* This is the most compatible, but causes server/simulation lag.
* This will also show player made structures if you
* are adding the mod on a pre-existing world. <br>
* Single-threaded - Slow (15-50 ms, with spikes up to 200 ms)
*/
FULL((byte) 6);
public static final EDhApiDistantGeneratorMode RENDERABLE = EDhApiDistantGeneratorMode.BIOME_ONLY;
/** The higher the number the more complete the generation is. */
public final byte complexity;
EDhApiDistantGeneratorMode(byte complexity) { this.complexity = complexity; }
/** returns null if out of range */
public static EDhApiDistantGeneratorMode previous(EDhApiDistantGeneratorMode mode)
{
switch (mode)
{
case FULL:
return EDhApiDistantGeneratorMode.FEATURES;
case FEATURES:
return EDhApiDistantGeneratorMode.SURFACE;
case SURFACE:
return EDhApiDistantGeneratorMode.BIOME_ONLY_SIMULATE_HEIGHT;
case BIOME_ONLY_SIMULATE_HEIGHT:
return EDhApiDistantGeneratorMode.BIOME_ONLY;
case BIOME_ONLY:
return EDhApiDistantGeneratorMode.PRE_EXISTING_ONLY;
case PRE_EXISTING_ONLY:
default:
return null;
}
}
/** returns null if out of range */
public static EDhApiDistantGeneratorMode next(EDhApiDistantGeneratorMode mode)
{
switch (mode)
{
case FEATURES:
return EDhApiDistantGeneratorMode.FULL;
case SURFACE:
return EDhApiDistantGeneratorMode.FEATURES;
case BIOME_ONLY_SIMULATE_HEIGHT:
return EDhApiDistantGeneratorMode.SURFACE;
case BIOME_ONLY:
return EDhApiDistantGeneratorMode.BIOME_ONLY_SIMULATE_HEIGHT;
case PRE_EXISTING_ONLY:
return EDhApiDistantGeneratorMode.BIOME_ONLY;
case FULL:
default:
return null;
}
}
}
@@ -0,0 +1,16 @@
package com.seibel.lod.api.enums.worldGeneration;
/**
* SERVER_LEVEL, <br>
* CLIENT_LEVEL, <br>
* UNKNOWN <br>
*
* @author James Seibel
* @version 2022-7-13
*/
public enum EDhApiLevelType
{
SERVER_LEVEL,
CLIENT_LEVEL,
UNKNOWN
}
@@ -0,0 +1,31 @@
package com.seibel.lod.api.enums.worldGeneration;
/**
* MULTI_THREADED, <br>
* SINGLE_THREADED, <br>
* SERVER_THREAD, <br>
*
* @author James Seibel
* @version 7-14-2022
*/
public enum EDhApiWorldGenThreadMode
{
/**
* This world generator can be run on an unlimited number
* of concurrent threads.
*/
MULTI_THREADED,
/**
* This world generator can only be run on one thread at
* a time, however that thread can run concurrently
* to Minecraft's server thread.
*/
SINGLE_THREADED,
/**
* This world generator can only be run on Minecraft's
* server thread.
*/
SERVER_THREAD,
}
@@ -0,0 +1,52 @@
package com.seibel.lod.api.enums.worldGeneration;
/**
* EMPTY, <br>
* STRUCTURE_START, <br>
* STRUCTURE_REFERENCE, <br>
* BIOMES, <br>
* NOISE, <br>
* SURFACE, <br>
* CARVERS, <br>
* LIQUID_CARVERS, <br>
* FEATURES, <br>
* LIGHT, <br>
*
* @author James Seibel
* @version 2023-4-20
*/
public enum EDhApiWorldGenerationStep
{
EMPTY(0),
STRUCTURE_START(1),
STRUCTURE_REFERENCE(2),
BIOMES(3),
NOISE(4),
SURFACE(5),
CARVERS(6),
LIQUID_CARVERS(7),
FEATURES(8),
LIGHT(9);
/** used when serializing this enum. */
public final byte value;
EDhApiWorldGenerationStep(int value) { this.value = (byte) value; }
/** @return null if the value doesn't correspond to a {@link EDhApiWorldGenerationStep}. */
public static EDhApiWorldGenerationStep fromValue(int value)
{
for (EDhApiWorldGenerationStep genStep : EDhApiWorldGenerationStep.values())
{
if (genStep.value == value)
{
return genStep;
}
}
return null;
}
}
@@ -0,0 +1,26 @@
package com.seibel.lod.api.interfaces;
/**
* The Distant Horizons' API objects can't cover
* every potential use case. Sometimes developers just need
* the base Minecraft Objects.
*
* @author James Seibel
* @version 2022-9-16
*/
public interface IDhApiUnsafeWrapper
{
/**
* Returns the Minecraft object this wrapper contains. <br>
* <strong>Warning</strong>: This object will be Minecraft
* version dependent and may change without notice. <br> <br>
*
* In order to cast this object to something usable, you may want
* to use <code>obj.getClass()</code> when in your IDE
* in order to determine what object this method returns for
* the specific version of Minecraft you are developing for.
*/
Object getWrappedMcObject_UNSAFE();
}
@@ -0,0 +1,31 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.interfaces.block;
import com.seibel.lod.api.interfaces.IDhApiUnsafeWrapper;
/**
* @author James Seibel
* @version 3-5-2022
*/
public interface IDhApiBiomeWrapper extends IDhApiUnsafeWrapper
{
String getName();
}
@@ -0,0 +1,15 @@
package com.seibel.lod.api.interfaces.block;
import com.seibel.lod.api.interfaces.IDhApiUnsafeWrapper;
/**
* A Minecraft version independent way of handling Blocks.
*
* @author James Seibel
* @version 2022-11-12
*/
public interface IDhApiBlockStateWrapper extends IDhApiUnsafeWrapper
{
boolean isAir();
}
@@ -0,0 +1,25 @@
package com.seibel.lod.api.interfaces.config;
import com.seibel.lod.api.interfaces.config.both.IDhApiWorldGenerationConfig;
import com.seibel.lod.api.interfaces.config.client.IDhApiBuffersConfig;
import com.seibel.lod.api.interfaces.config.client.IDhApiGraphicsConfig;
import com.seibel.lod.api.interfaces.config.client.IDhApiMultiplayerConfig;
import com.seibel.lod.api.interfaces.config.client.IDhApiThreadingConfig;
/**
* This interfaces holds all of the config groups
* the API has access to for easy access to all config values.
*
* @author James Seibel
* @version 9-15-2022
*/
public interface IDhApiConfig
{
IDhApiWorldGenerationConfig getWorldGeneratorConfig();
IDhApiBuffersConfig getBufferConfig();
IDhApiGraphicsConfig getGraphicsConfig();
IDhApiMultiplayerConfig getMultiplayerConfig();
IDhApiThreadingConfig getThreadingConfig();
}
@@ -0,0 +1,15 @@
package com.seibel.lod.api.interfaces.config;
import com.seibel.lod.coreapi.interfaces.dependencyInjection.IBindable;
/**
* This interface is just used to organize API config groups so
* they can be more easily handled together.
*
* @author James Seibel
* @version 9-15-2022
*/
public interface IDhApiConfigGroup extends IBindable
{
}
@@ -0,0 +1,51 @@
package com.seibel.lod.api.interfaces.config;
/**
* An interface for Distant Horizon's Config.
*
* @param <T> The data type of this config.
*
* @author James Seibel
* @version 2022-9-15
*/
public interface IDhApiConfigValue<T>
{
/**
* Returns the active value for this config. <br>
* Returns the True value if either the config cannot be overridden by
* the API or if it hasn't been set by the API.
*/
public T getValue();
/**
* Returns the value held by this config. <br>
* This is the value stored in the config file.
*/
public T getTrueValue();
/**
* Returns the value of the config if it was set by the API.
* Returns null if the config wasn't set by the API.
*/
public T getApiValue();
/**
* Sets the config's value. <br>
* If the newValue is set to null then the config
* will revert to using the True Value.<br>
* If the config cannot be set via the API this method will return false.
*
* @return true if the value was set, false otherwise.
*/
public boolean setValue(T newValue);
/** Returns true if this config can be set via the API, false otherwise. */
public boolean getCanBeOverrodeByApi();
/** Returns the default value for this config. */
public T getDefaultValue();
/** Returns the max value for this config, null if there is no max. */
public T getMaxValue();
/** Returns the min value for this config, null if there is no min. */
public T getMinValue();
}
@@ -0,0 +1,77 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.interfaces.config.both;
import com.seibel.lod.api.enums.config.EBlocksToAvoid;
import com.seibel.lod.api.enums.worldGeneration.EDhApiDistantGeneratorMode;
import com.seibel.lod.api.enums.config.EGenerationPriority;
import com.seibel.lod.api.interfaces.config.IDhApiConfigValue;
import com.seibel.lod.api.enums.config.ELightGenerationMode;
import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup;
/**
* Distant Horizons' world generation configuration. <br><br>
*
* Note: Fake chunks are NOT saved in Minecraft's vanilla save system.
*
* @author James Seibel
* @version 2022-9-15
*/
public interface IDhApiWorldGenerationConfig extends IDhApiConfigGroup
{
/**
* Defines whether fake chunks will be generated
* outside Minecraft's vanilla render distance.
*/
IDhApiConfigValue<Boolean> getEnableDistantWorldGeneration();
/** Defines to what level fake chunks will be generated. */
IDhApiConfigValue<EDhApiDistantGeneratorMode> getDistantGeneratorMode();
/** Defines how generated fake chunks will be lit. */
IDhApiConfigValue<ELightGenerationMode> getLightingMode();
/** Defines the order in which fake chunks will be generated. */
IDhApiConfigValue<EGenerationPriority> getGenerationPriority();
/**
* Defines what blocks will be ignored when generating LODs. <br><br>
*
* TODO if this isn't deprecated before 1.7 it should probably be moved to the graphics tab
* @deprecated this method won't be needed once we transition to an ID based save system <br>
* (vs the color based system we have currently)
*/
@Deprecated
IDhApiConfigValue<EBlocksToAvoid> getBlocksToAvoid();
/**
* Defines if the color of avoided blocks will color the block below them. <Br>
* (IE: if flowers are avoided should they color the grass below them?)
*
* TODO if this isn't deprecated before 1.7 it should probably be moved to the graphics tab
* @deprecated this method won't be needed once we transition to an ID based save system <br>
* (vs the color based system we have currently)
*/
@Deprecated
IDhApiConfigValue<Boolean> getTintWithAvoidedBlocks();
}
@@ -0,0 +1,47 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.interfaces.config.client;
import com.seibel.lod.api.enums.config.EGpuUploadMethod;
import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup;
import com.seibel.lod.api.interfaces.config.IDhApiConfigValue;
/**
* Distant Horizons' OpenGL buffer configuration.
*
* @author James Seibel
* @version 2022-9-15
*/
public interface IDhApiBuffersConfig extends IDhApiConfigGroup
{
/** Defines how geometry data is uploaded to the GPU. */
IDhApiConfigValue<EGpuUploadMethod> getGpuUploadMethod();
/**
* Defines how long we should wait after uploading one
* Megabyte of geometry data to the GPU before uploading
* the next Megabyte of data. <br>
* This can be set to a non-zero number to reduce stuttering caused by
* uploading buffers to the GPU.
*/
IDhApiConfigValue<Integer> getBufferUploadTimeoutPerMegabyteInMilliseconds();
}
@@ -0,0 +1,41 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.interfaces.config.client;
import com.seibel.lod.api.enums.rendering.EDebugMode;
import com.seibel.lod.api.interfaces.config.IDhApiConfigValue;
import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup;
/**
* Distant Horizons' debug configuration.
*
* @author James Seibel
* @version 2022-9-15
*/
public interface IDhApiDebuggingConfig extends IDhApiConfigGroup
{
/** Can be used to debug the standard fake chunk rendering. */
IDhApiConfigValue<EDebugMode> getDebugRenderMode();
/** If enabled debug keybindings can be used. */
IDhApiConfigValue<Boolean> getEnableDebugKeybindings();
}
@@ -0,0 +1,138 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.interfaces.config.client;
import com.seibel.lod.api.enums.config.*;
import com.seibel.lod.api.enums.rendering.ERendererMode;
import com.seibel.lod.api.interfaces.config.IDhApiConfigValue;
import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup;
/**
* Distant Horizons' graphics/rendering configuration.
*
* @author James Seibel
* @version 2022-9-15
*/
public interface IDhApiGraphicsConfig extends IDhApiConfigGroup
{
//========================//
// basic graphic settings //
//========================//
/** The distance is the radius measured in chunks. */
IDhApiConfigValue<Integer> getChunkRenderDistance();
/**
* Simplified version of {@link IDhApiGraphicsConfig#getRenderingMode()}
* that only enables/disables the fake chunk rendering. <br><br>
*
* Changing this config also changes {@link IDhApiGraphicsConfig#getRenderingMode()}'s value.
*/
IDhApiConfigValue<Boolean> getRenderingEnabled();
/**
* Can be used to enable/disable fake chunk rendering or enable the debug renderer. <br><br>
*
* The debug renderer is used to confirm rendering is working at and will draw
* a single multicolor rhombus on the screen in skybox space (AKA behind MC's rendering). <br><br>
*
* Changing this config also changes {@link IDhApiGraphicsConfig#getRenderingEnabled()}'s value.
*/
IDhApiConfigValue<ERendererMode> getRenderingMode();
//==================//
// graphic settings //
//==================//
/** Defines how detailed fake chunks are in the horizontal direction */
IDhApiConfigValue<EHorizontalResolution> getMaxDetailLevel();
/** Defines how detailed fake chunks are in the vertical direction */
IDhApiConfigValue<EVerticalQuality> getVerticalQuality();
/** Modifies the quadratic function fake chunks use for horizontal quality drop-off. */
IDhApiConfigValue<EHorizontalQuality> getHorizontalQualityDropoff();
/**
* The same as vanilla Minecraft's biome blending. <br><br>
*
* 0 = blending of 1x1 aka off <br>
* 1 = blending of 3x3 <br>
* 2 = blending of 5x5 <br>
* ... <br>
*/
IDhApiConfigValue<Integer> getBiomeBlending();
//===========================//
// advanced graphic settings //
//===========================//
/** If directional culling is disabled fake chunks will be rendered behind the camera. */
IDhApiConfigValue<Boolean> getDisableDirectionalCulling();
/** Determines how fake chunks are rendered in comparison to vanilla MC's chunks. */
IDhApiConfigValue<EVanillaOverdraw> getVanillaOverdraw();
/** Modifies how far the vanilla overdraw is rendered in chunks. */
IDhApiConfigValue<Integer> getVanillaOverdrawOffset();
/**
* If enabled the near clip plane is extended to reduce
* overdraw and improve Z-fighting at extreme render distances. <br>
* Disabling this reduces holes in the world due to the near clip plane
* being too close to the camera and the terrain not being covered by vanilla terrain.
*/
IDhApiConfigValue<Boolean> getUseExtendedNearClipPlane();
/**
* Modifies how bright fake chunks are. <br>
* This is done when generating the vertex data and is applied before any shaders.
*/
IDhApiConfigValue<Double> getBrightnessMultiplier();
/**
* Modifies how saturated fake chunks are. <br>
* This is done when generating the vertex data and is applied before any shaders.
*/
IDhApiConfigValue<Double> getSaturationMultiplier();
/** Defines if Distant Horizons should attempt to cull fake chunk cave geometry. */
IDhApiConfigValue<Boolean> getCaveCullingEnabled();
/** Defines what height cave culling should be used below if enabled. */
IDhApiConfigValue<Integer> getCaveCullingHeight();
/** This ratio is relative to Earth's real world curvature. */
IDhApiConfigValue<Integer> getEarthCurvatureRatio();
/** If enabled vanilla chunk rendering is disabled and only fake chunks are rendered. */
IDhApiConfigValue<Boolean> getEnableLodOnlyMode();
/** Defines how often the geometry should be rebuilt when the player moves. */
IDhApiConfigValue<EBufferRebuildTimes> getGeometryRebuildFrequency();
}
@@ -0,0 +1,130 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.interfaces.config.client;
import com.seibel.lod.api.enums.rendering.*;
import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup;
import com.seibel.lod.api.interfaces.config.IDhApiConfigValue;
/**
* Distant Horizons' fog configuration. <br><br>
*
* Note: unless an option explicitly states that it modifies
* Minecraft's vanilla rendering (like DisableVanillaFog)
* these settings will only affect Distant horizons' fog.
*
* @author James Seibel
* @version 2022-9-15
*/
public interface IDhApiGraphicsFogConfig extends IDhApiConfigGroup
{
//====================//
// basic fog settings //
//====================//
/** Defines at what distance fog is rendered on fake chunks. */
IDhApiConfigValue<EFogDistance> getFogDistance();
/** Should be used to enable/disable fog rendering. */
IDhApiConfigValue<EFogDrawMode> getFogRender();
/** Can be used to enable support with mods that change vanilla MC's fog color. */
IDhApiConfigValue<EFogColorMode> getFogColor();
/**
* If enabled attempts to disable vanilla MC's fog on real chunks. <br>
* May not play nice with other fog editing mods.
*/
IDhApiConfigValue<Boolean> getDisableVanillaFog();
//=======================//
// advanced fog settings //
//=======================//
/**
* Defines where the fog starts as a percent of the
* fake chunks render distance radius. <br>
* Can be greater than the fog end distance to invert the fog direction. <br> <br>
*
* 0.0 = fog starts at the camera <br>
* 1.0 = fog starts at the edge of the fake chunk render distance <br>
*/
IDhApiConfigValue<Double> getFogStartDistance();
/**
* Defines where the fog ends as a percent of the radius
* of the fake chunks render distance. <br>
* Can be less than the fog start distance to invert the fog direction. <br> <br>
*
* 0.0 = fog ends at the camera <br>
* 1.0 = fog ends at the edge of the fake chunk render distance <br>
*/
IDhApiConfigValue<Double> getFogEndDistance();
/** Defines how opaque the fog is at its thinnest point. */
IDhApiConfigValue<Double> getFogMinThickness();
/** Defines how opaque the fog is at its thickest point. */
IDhApiConfigValue<Double> getFogMaxThickness();
/** Defines how the fog changes in thickness. */
IDhApiConfigValue<EFogFalloff> getFogFalloff();
/** Defines the fog density. */
IDhApiConfigValue<Double> getFogDensity();
//=====================//
// height fog settings //
//=====================//
/** Defines how the height fog mixes. */
IDhApiConfigValue<EHeightFogMixMode> getHeightFogMixMode();
/** Defines how the height fog is drawn relative to the camera or world. */
IDhApiConfigValue<EHeightFogMode> getHeightFogMode();
/**
* Defines the height fog's base height if {@link IDhApiGraphicsFogConfig#getHeightFogMode()}
* is set to use a specific height.
*/
IDhApiConfigValue<Double> getHeightFogBaseHeight();
/** Defines the height fog's starting height as a percent of the world height. */
IDhApiConfigValue<Double> getHeightFogStartingHeightPercent();
/** Defines the height fog's ending height as a percent of the world height. */
IDhApiConfigValue<Double> getHeightFogEndingHeightPercent();
/** Defines how opaque the height fog is at its thinnest point. */
IDhApiConfigValue<Double> getHeightFogMinThickness();
/** Defines how opaque the height fog is at its thickest point. */
IDhApiConfigValue<Double> getHeightFogMaxThickness();
/** Defines how the height fog changes in thickness. */
IDhApiConfigValue<EFogFalloff> getHeightFogFalloff();
/** Defines the height fog's density. */
IDhApiConfigValue<Double> getHeightFogDensity();
}
@@ -0,0 +1,53 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.interfaces.config.client;
import com.seibel.lod.api.interfaces.config.IDhApiConfigValue;
import com.seibel.lod.api.enums.config.EServerFolderNameMode;
import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup;
/**
* Distant Horizons' client-side multiplayer configuration.
*
* @author James Seibel
* @version 2022-9-15
*/
public interface IDhApiMultiplayerConfig extends IDhApiConfigGroup
{
/**
* Defines how multiplayer server folders are named. <br>
* Note: Changing this while connected to a multiplayer world will cause undefined behavior!
*/
IDhApiConfigValue<EServerFolderNameMode> getFolderSavingMode();
/**
* Defines the necessary similarity (as a percent) that two potential levels
* need in order to be considered the same. <br> <br>
*
* Setting this to zero causes every level of a specific dimension type to be consider
* the same level. <br>
* Setting this to a non-zero value allows for usage in servers that user Multiverse
* or similar mods.
*/
IDhApiConfigValue<Double> getMultiverseSimilarityRequirement();
}
@@ -0,0 +1,64 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.interfaces.config.client;
import com.seibel.lod.api.interfaces.config.IDhApiConfigValue;
import com.seibel.lod.api.interfaces.config.IDhApiConfigGroup;
/**
* Distant Horizons' threading configuration.
*
* @author James Seibel
* @version 2022-9-15
*/
public interface IDhApiThreadingConfig extends IDhApiConfigGroup
{
/**
* Defines how many world generator threads are used to generate
* terrain outside Minecraf's vanilla render distance. <br>
* <br>
* If the number of threads is less than 1 it will be treated as a percentage
* representing how often the single thread will actively generate terrain. <br> <br>
*
* 0.1 = 1 thread active 10% of the time <br>
* 0.5 = 1 thread active 50% of the time <br>
* 1.0 = 1 thread active 100% of the time <br>
* 1.5 = 2 threads active 100% of the time (partial values are rounded up) <br>
* 2.0 = 2 threads active 100% of the time <br>
*
* @deprecated this (and the related config) should be replaced with an int
* count of threads and then a double percent active config.
*/
@Deprecated
IDhApiConfigValue<Double> getWorldGeneratorThread();
// TODO the above should be replaced with these
// IDhApiConfig<Integer> getWorldGeneratorThreadConfig()
// { return new DhApiConfig<>(Threading.numberOfWorldGenerationThreads); }
// IDhApiConfig<Double> getWorldGeneratorThreadActivePercentConfig()
// { return new DhApiConfig<>(Threading.ToBeDetermined); }
/** Defines how many buffer (GPU Terrain data) builder threads are used. */
IDhApiConfigValue<Integer> getBufferBuilderThread();
}
@@ -0,0 +1,64 @@
package com.seibel.lod.api.interfaces.data;
import com.seibel.lod.api.interfaces.world.IDhApiLevelWrapper;
import com.seibel.lod.api.objects.DhApiResult;
import com.seibel.lod.api.objects.data.DhApiRaycastResult;
import com.seibel.lod.api.objects.data.DhApiTerrainDataPoint;
/**
* Used to interface with Distant Horizons' terrain data.
*
* @author James Seibel
* @version 2022-11-19
*/
public interface IDhApiTerrainDataRepo
{
/** Returns the terrain datapoint at the given block position, at or containing the given Y position. */
DhApiResult<DhApiTerrainDataPoint> getSingleDataPointAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosY, int blockPosZ);
/** Returns every datapoint in the column located at the given block X and Z position top to bottom. */
DhApiResult<DhApiTerrainDataPoint[]> getColumnDataAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosZ);
/**
* Returns every datapoint in the given chunk's X and Z position. <br><br>
*
* The returned array is ordered: [relativeBlockX][relativeBlockZ][columnIndex] <br>
* RelativeBlockX/Z are relative to the block position closest to negative infinity in the chunk's position. <br>
* The column data is ordered from top to bottom. Note: each column may have a different number of values. <br>
*/
DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtChunkPos(IDhApiLevelWrapper levelWrapper, int chunkPosX, int chunkPosZ);
/**
* Returns every datapoint in the given region's X and Z position. <br><br>
*
* The returned array is ordered: [relativeBlockX][relativeBlockZ][columnIndex] <br>
* RelativeBlockX/Z are relative to the block position closest to negative infinity in the region's position. <br>
* The column data is ordered from top to bottom. Note: each column may have a different number of values. <br>
*/
DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtRegionPos(IDhApiLevelWrapper levelWrapper, int regionPosX, int regionPosZ);
/**
* Returns every datapoint in the column located at the given detail level and X/Z position. <br>
* This can be used to return terrain data for non-standard sizes (IE 2x2 blocks or 2x2 chunks).
*
* @param detailLevel a positive byte defining the detail level of the returned data. <br>
* Every increase doubles the width of the returned area. <br>
* Example values: 0 = block, 1 = 2x2 blocks, 2 = 4x4 blocks, ... 4 = chunk (16x16 blocks), ... 9 = region (512x512 blocks)
*/
DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtDetailLevelAndPos(IDhApiLevelWrapper levelWrapper, byte detailLevel, int posX, int posZ);
/**
* Returns the datapoint and position of the LOD
* at the end of the given ray. <br><br>
*
* Will return "success" with a null datapoint if the ray reaches the max length without finding any data.
*/
DhApiResult<DhApiRaycastResult> raycast(IDhApiLevelWrapper levelWrapper,
double rayOriginX, double rayOriginY, double rayOriginZ,
float rayDirectionX, float rayDirectionY, float rayDirectionZ,
int maxRayBlockLength);
}
@@ -0,0 +1,54 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.interfaces.events;
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.lod.coreapi.interfaces.dependencyInjection.IDependencyInjector;
/**
* This class takes care of dependency injection for API events.
*
* @author James Seibel
* @version 2022-9-13
*/
public interface IDhApiEventInjector extends IDependencyInjector<IDhApiEvent>
{
/**
* Unlinks the given event handler, preventing the handler from being called in the future.
*
* @throws IllegalArgumentException if the implementation object doesn't implement the interface
* @return true if the handler was unbound, false if the handler wasn't bound.
*/
// Note to self: Don't try adding a generic type to IDhApiEvent, the constructor won't accept it
boolean unbind(Class<? extends IDhApiEvent> dependencyInterface, Class<? extends IDhApiEvent> dependencyClassToRemove) throws IllegalArgumentException;
/**
* Fires all bound events of the given type (does nothing if no events are bound).
*
* @param abstractEvent event type
* @param eventParameterObject event parameter
* @return if any of bound event handlers returned that this event should be canceled.
* @param <T> the parameter type taken by the event handlers.
*/
<T, U extends IDhApiEvent<T>> boolean fireAllEvents(Class<U> abstractEvent, T eventParameterObject);
}
@@ -0,0 +1,31 @@
package com.seibel.lod.api.interfaces.override;
import com.seibel.lod.api.enums.worldGeneration.EDhApiDistantGeneratorMode;
import com.seibel.lod.api.interfaces.world.IDhApiLevelWrapper;
import com.seibel.lod.api.enums.worldGeneration.EDhApiWorldGenThreadMode;
import com.seibel.lod.api.interfaces.world.IDhApiChunkWrapper;
/**
* @author James Seibel
* @version 2022-9-8
*/
public abstract class AbstractDhApiWorldGenerator implements IDhApiOverrideable
{
/** Returns which thread chunk generation requests can be created on. */
public abstract EDhApiWorldGenThreadMode getThreadingMode();
public EDhApiWorldGenThreadMode getCoreThreadingMode()
{
return this.getThreadingMode();
}
public abstract IDhApiChunkWrapper generateChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiDistantGeneratorMode maxStepToGenerate);
public final IDhApiChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiDistantGeneratorMode maxStepToGenerate)
{
// TODO probably need to change the return type
return null; //generateChunk(chunkPosX, chunkPosZ, null, generationStepEnumConverter.convertToApiType(maxStepToGenerate));
}
}
@@ -0,0 +1,20 @@
package com.seibel.lod.api.interfaces.override;
import com.seibel.lod.coreapi.interfaces.dependencyInjection.IBindable;
import com.seibel.lod.coreapi.interfaces.dependencyInjection.IOverrideInjector;
/**
* Implemented by all DhApi objects that can be overridden.
*
* @author James Seibel
* @version 2022-9-5
*/
public interface IDhApiOverrideable extends IBindable
{
/**
* Higher (larger numerical) priorities override lower (smaller numerical) priorities . <br>
* For most developers this can be left at the default.
*/
default int getPriority() { return IOverrideInjector.DEFAULT_NON_CORE_OVERRIDE_PRIORITY; }
}
@@ -0,0 +1,126 @@
package com.seibel.lod.api.interfaces.override.worldGenerator;
import com.seibel.lod.api.enums.EDhApiDetailLevel;
import com.seibel.lod.api.enums.worldGeneration.EDhApiDistantGeneratorMode;
import com.seibel.lod.api.enums.worldGeneration.EDhApiWorldGenThreadMode;
import com.seibel.lod.api.interfaces.override.IDhApiOverrideable;
import java.io.Closeable;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
/**
* @author James Seibel
* @version 2022-12-10
*/
public interface IDhApiWorldGenerator extends Closeable, IDhApiOverrideable
{
//============//
// parameters //
//============//
/**
* Returns which thread chunk generation requests will be run on. <br>
* TODO: only {@link EDhApiWorldGenThreadMode#SINGLE_THREADED} is currently supported
*/
EDhApiWorldGenThreadMode getThreadingMode();
/**
* Defines the smallest datapoint size that can be generated at a time. <br>
* Minimum detail level is 0 (1 block) <br>
* Default detail level is 0 <br>
* For more information on what detail levels represent see: {@link EDhApiDetailLevel}. <br><br>
*
* TODO: System currently only supports 1x1 block per data.
*
* @see EDhApiDetailLevel
*/
default byte getMinDataDetailLevel() { return EDhApiDetailLevel.BLOCK.detailLevel; }
/**
* Defines the largest datapoint size that can be generated at a time. <br>
* Minimum detail level is 0 (1 block) <br>
* Default detail level is 0 <br>
* For more information on what detail levels represent see: {@link EDhApiDetailLevel}.
*
* @see EDhApiDetailLevel
*/
default byte getMaxDataDetailLevel() { return EDhApiDetailLevel.BLOCK.detailLevel; }
/**
* When creating generation requests the system will attempt to group nearby tasks together. <br><br>
* What is the minimum size a single generation call can batch together? <br>
*
* Minimum detail level is 4 (the size of a MC chunk) <br>
* Default detail level is 4 <br>
* For more information on what detail levels represent see: {@link EDhApiDetailLevel}.
*
* @see EDhApiDetailLevel
*/
default byte getMinGenerationGranularity() { return EDhApiDetailLevel.CHUNK.detailLevel; }
/**
* When creating generation requests the system will attempt to group nearby tasks together. <br><br>
* What is the maximum size a single generation call can batch together? <br>
*
* Minimum detail level is 4 (the size of a MC chunk) <br>
* Default detail level is 6 (4x4 chunks) <br>
* For more information on what detail levels represent see: {@link EDhApiDetailLevel}.
*
* @see EDhApiDetailLevel
*/
default byte getMaxGenerationGranularity() { return (byte) (EDhApiDetailLevel.CHUNK.detailLevel + 2); }
/** Returns true if the generator is unable to accept new generation requests. */
boolean isBusy();
//=================//
// world generator //
//=================//
/**
* This method is called by Distant Horizons to generate terrain over a given area
* from a thread defined by {@link IDhApiWorldGenerator#getThreadingMode}. <br><br>
*
* After a chunk has been generated it (and any necessary supporting objects as listed below) should be passed into the
* resultConsumer's {@link Consumer#accept} method. If the Consumer is given the wrong data
* type(s) it will throw a {@link ClassCastException} with a list of what objects it was expecting. <br>
* <strong>Note:</strong> these objects are minecraft version dependent and will change without notice!
* Please run your generator in game at least once to confirm the objects you are returning are correct. <br><br>
*
* Consumer expected inputs for each minecraft version (in order): <br>
* <strong>1.18:</strong> {@link net.minecraft.world.level.chunk.ChunkAccess} and {@link net.minecraft.world.level.LevelReader} <br>
*
* @throws ClassCastException if incompatible objects are passed into the resultConsumer.
*/
CompletableFuture<Void> generateChunks(int chunkPosMinX, int chunkPosMinZ,
byte granularity, byte targetDataDetail, EDhApiDistantGeneratorMode generatorMode,
Consumer<Object[]> resultConsumer) throws ClassCastException;
//===============//
// event methods //
//===============//
/**
* Called before a new generator task is started. <br>
* This can be used to run cleanup on existing tasks before new tasks are started.
*/
void preGeneratorTaskStart();
//===========//
// overrides //
//===========//
// This is overridden to remove the "throws IOException"
// that is present in the default Closeable.close() method
@Override
void close();
}
@@ -0,0 +1,23 @@
package com.seibel.lod.api.interfaces.override.worldGenerator;
import com.seibel.lod.api.interfaces.world.IDhApiLevelWrapper;
import com.seibel.lod.api.objects.DhApiResult;
/**
* Handles adding world generator overrides.
*
* @author James Seibel
* @version 2022-12-10
*/
public interface IDhApiWorldGeneratorOverrideRegister
{
/**
* Registers the given world generator for the given level. <Br> <Br>
*
* Only one world generator can be registered for a specific level at a given time. <Br>
* If another world generator has already been registered, DhApiResult will return
* the name of the previously registered generator and success = false.
*/
DhApiResult<Void> registerWorldGeneratorOverride(IDhApiLevelWrapper levelWrapper, IDhApiWorldGenerator worldGenerator);
}
@@ -0,0 +1,47 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.interfaces.render;
import com.seibel.lod.api.objects.DhApiResult;
/**
* Used to interact with Distant Horizons rendering systems.
*
* @author James Seibel
* @version 2023-2-8
*/
public interface IDhApiRenderProxy
{
/**
* Forces any cached render data to be deleted and regenerated.
* This is generally called whenever resource packs are changed or specific
* rendering settings are changed in Distant Horizon's config. <Br><Br>
*
* If this is called on a dedicated server it won't do anything and will return {@link DhApiResult#success} = false <Br><Br>
*
* Background: <Br>
* Distant Horizons has two different file formats: Full data and Render data. <Br>
* - Full data files store the block, biome, etc. information and is the result of loading or generating new chunks. <Br>
* - Render data files store LOD colors and are created using the Full data and currently loaded resource packs. <Br>
* This is the data cleared by this method.
*/
DhApiResult<Boolean> clearRenderDataCache();
}
@@ -0,0 +1,68 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.interfaces.world;
import com.seibel.lod.api.interfaces.IDhApiUnsafeWrapper;
/**
* @author James Seibel
* @version 2022-7-14
*/
public interface IDhApiChunkWrapper extends IDhApiUnsafeWrapper
{
/** Returns the absolute Y coordinate of the highest block for the given relative X and Z coordinates. */
int getMaxY(int relativeX, int relativeZ);
/** Returns the maximum absolute block position in the X direction. */
int getMaxX();
/** Returns the maximum absolute block position in the Z direction. */
int getMaxZ();
/** Returns the absolute Y coordinate of the lowest block for the given relative X and Z coordinates. */
int getMinY(int relativeX, int relativeZ);
/** Returns the minimum absolute block position in the X direction. */
int getMinX();
/** Returns the minimum absolute block position in the Z direction. */
int getMinZ();
/**
* Returns true if this chunk's lighting has been built. <br>
* Note: for some versions of Minecraft this value may be unreliable.
*/
boolean isLightCorrect();
/** TODO what side of the block should this return the light for? */
default int getBlockLight(int x, int y, int z) {return -1;}
/** TODO what side of the block should this return the light for? */
default int getSkyLight(int x, int y, int z) {return -1;}
/**
* Returns true if chunks exist in all 4 cardinal and 4 ordinal directions
* relative to this chunk. <br>
* IE: returns true if there are chunks to the North, South, East, West, NE, SE, SW, and NW
* of this chunk.
*/
boolean doNearbyChunksExist();
// TODO these will probably need replacing once 1.7's ID system is done
//IBlockStateWrapper getBlockState(int x, int y, int z);
//IBiomeWrapper getBiome(int x, int y, int z);
}
@@ -1,35 +1,35 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.wrapperInterfaces.world;
package com.seibel.lod.api.interfaces.world;
import com.seibel.lod.core.handlers.dependencyInjection.IBindable;
import com.seibel.lod.api.interfaces.IDhApiUnsafeWrapper;
/**
* @author James Seibel
* @version 3-5-2022
* @version 2022-7-14
*/
public interface IDimensionTypeWrapper extends IBindable
public interface IDhApiDimensionTypeWrapper extends IDhApiUnsafeWrapper
{
String getDimensionName();
boolean hasCeiling();
boolean hasSkyLight();
}
@@ -0,0 +1,50 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.interfaces.world;
import com.seibel.lod.api.interfaces.IDhApiUnsafeWrapper;
import com.seibel.lod.api.enums.worldGeneration.EDhApiLevelType;
/**
* Can be either a Server or Client level.
*
* @author James Seibel
* @version 2022-7-14
*/
public interface IDhApiLevelWrapper extends IDhApiUnsafeWrapper
{
IDhApiDimensionTypeWrapper getDimensionType();
EDhApiLevelType getLevelType();
boolean hasCeiling();
boolean hasSkyLight();
/** Returns the max block height of the level(?) */
int getHeight();
/**
* Returns the lowest possible block position for the level. <br>
* For MC versions before 1.18 this will return 0.
*/
default int getMinHeight() { return 0; }
}
@@ -0,0 +1,62 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.interfaces.world;
import com.seibel.lod.api.interfaces.IDhApiUnsafeWrapper;
/**
* Used to interact with Distant Horizons current world.
*
* @author James Seibel
* @version 2022-11-20
*/
public interface IDhApiWorldProxy
{
/** Returns true if a world is loaded. */
boolean worldLoaded();
/**
* In singleplayer this will return the level the player is currently in. <br>
* In multiplayer this will return null.
*
* @throws IllegalStateException if no world is loaded
*/
IDhApiLevelWrapper getSinglePlayerLevel() throws IllegalStateException;
/** @throws IllegalStateException if no world is loaded */
Iterable<IDhApiLevelWrapper> getAllLoadedLevelWrappers() throws IllegalStateException;
/**
* In the case of servers running multiverse there may be multiple levels for the same dimensionType.
*
* @throws IllegalStateException if no world is loaded
*/
Iterable<IDhApiLevelWrapper> getAllLoadedLevelsForDimensionType(IDhApiDimensionTypeWrapper dimensionTypeWrapper) throws IllegalStateException;
/**
* Returns any dimensions that have names containing the given string (case-insensitive). <br>
* In the case of servers running multiverse there may be multiple levels for the same dimensionType.
*
* @throws IllegalStateException if no world is loaded
*/
Iterable<IDhApiLevelWrapper> getAllLoadedLevelsWithDimensionNameLike(String dimensionName) throws IllegalStateException;
}
@@ -0,0 +1,51 @@
package com.seibel.lod.api.methods.events;
import com.seibel.lod.api.objects.DhApiResult;
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.lod.coreapi.DependencyInjection.ApiEventInjector;
/**
* Handles adding/removing event handlers.
*
* @author James Seibel
* @version 2022-9-16
*/
public class DhApiEventRegister
{
/**
* Registers the given event handler. <Br>
* Only one eventHandler of a specific class can be registered at a time.
* If multiple of the same eventHandler are added DhApiResult will return
* the name of the already added handler and success = false.
*/
public static DhApiResult<Void> on(Class<? extends IDhApiEvent> eventInterface, IDhApiEvent eventHandlerImplementation)
{
try
{
ApiEventInjector.INSTANCE.bind(eventInterface, eventHandlerImplementation);
return DhApiResult.createSuccess();
}
catch (IllegalStateException e)
{
return DhApiResult.createFail(e.getMessage());
}
}
/**
* Unregisters the given event handler for this event if one has been registered. <br>
* If no eventHandler of the given class has been registered the result will return
* success = false.
*/
public static DhApiResult<Void> off(Class<? extends IDhApiEvent> eventInterface, Class<IDhApiEvent> eventHandlerClass)
{
if (ApiEventInjector.INSTANCE.unbind(eventInterface, eventHandlerClass))
{
return DhApiResult.createSuccess();
}
else
{
return DhApiResult.createFail("No event handler [" + eventHandlerClass.getSimpleName() + "] was bound for the event [" + eventInterface.getSimpleName() + "].");
}
}
}
@@ -0,0 +1,3 @@
The events api package holds objects and methods for listening to events fired by Distant Horizons'.
Each interface should only contain one method and that method should match the name of the file. This is done so Developers can mix and match what events they want their classes to handle.
@@ -0,0 +1,31 @@
package com.seibel.lod.api.methods.events.abstractEvents;
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.lod.api.objects.events.DhApiEventDefinition;
/**
* @author James Seibel
* @version 2022-11-21
*/
public abstract class DhApiAfterDhInitEvent implements IDhApiEvent<Void>
{
/** Fired after Distant Horizons finishes its initial setup on Minecraft startup. */
public abstract void afterDistantHorizonsInit();
//=========================//
// internal DH API methods //
//=========================//
@Override
public final boolean fireEvent(Void ignoredParam)
{
this.afterDistantHorizonsInit();
return false;
}
public final static DhApiEventDefinition EVENT_DEFINITION = new DhApiEventDefinition(false, true);
@Override
public final DhApiEventDefinition getEventDefinition() { return EVENT_DEFINITION; }
}
@@ -0,0 +1,45 @@
package com.seibel.lod.api.methods.events.abstractEvents;
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.lod.api.methods.events.sharedParameterObjects.DhApiRenderParam;
import com.seibel.lod.api.objects.events.DhApiEventDefinition;
/**
* @author James Seibel
* @version 2022-11-21
*/
public abstract class DhApiAfterRenderEvent implements IDhApiEvent<DhApiAfterRenderEvent.EventParam>
{
/** Fired after Distant Horizons finishes rendering fake chunks. */
public abstract void afterRender(EventParam input);
//=========================//
// internal DH API methods //
//=========================//
@Override
public final boolean fireEvent(EventParam input)
{
this.afterRender(input);
return false;
}
public final static DhApiEventDefinition EVENT_DEFINITION = new DhApiEventDefinition(false, false);
@Override
public final DhApiEventDefinition getEventDefinition() { return EVENT_DEFINITION; }
//==================//
// parameter object //
//==================//
public static class EventParam extends DhApiRenderParam
{
public EventParam(DhApiRenderParam parent)
{
super(parent.mcProjectionMatrix, parent.mcModelViewMatrix, parent.dhProjectionMatrix, parent.dhModelViewMatrix, parent.partialTicks);
}
}
}
@@ -0,0 +1,33 @@
package com.seibel.lod.api.methods.events.abstractEvents;
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.lod.api.objects.events.DhApiEventDefinition;
/**
* @author James Seibel
* @version 2022-11-21
*/
public abstract class DhApiBeforeDhInitEvent implements IDhApiEvent<Void>
{
/** Fired before Distant Horizons starts its initial setup on Minecraft startup. */
public abstract void beforeDistantHorizonsInit();
//=========================//
// internal DH API methods //
//=========================//
@Override
public final boolean fireEvent(Void ignoredParam)
{
this.beforeDistantHorizonsInit();
return false;
}
public final static DhApiEventDefinition EVENT_DEFINITION = new DhApiEventDefinition(false, true);
@Override
public final DhApiEventDefinition getEventDefinition() { return EVENT_DEFINITION; }
}
@@ -0,0 +1,45 @@
package com.seibel.lod.api.methods.events.abstractEvents;
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.lod.api.methods.events.sharedParameterObjects.DhApiRenderParam;
import com.seibel.lod.api.objects.events.DhApiEventDefinition;
/**
* @author James Seibel
* @version 2022-11-21
*/
public abstract class DhApiBeforeRenderEvent implements IDhApiEvent<DhApiBeforeRenderEvent.EventParam>
{
/**
* Fired before Distant Horizons renders fake chunks.
*
* @return whether the event should be canceled or not.
*/
public abstract boolean beforeRender(EventParam input);
//=========================//
// internal DH API methods //
//=========================//
@Override
public final boolean fireEvent(EventParam input) { return this.beforeRender(input); }
public final static DhApiEventDefinition EVENT_DEFINITION = new DhApiEventDefinition(true, false);
@Override
public final DhApiEventDefinition getEventDefinition() { return EVENT_DEFINITION; }
//==================//
// parameter object //
//==================//
public static class EventParam extends DhApiRenderParam
{
public EventParam(DhApiRenderParam parent)
{
super(parent.mcProjectionMatrix, parent.mcModelViewMatrix, parent.dhProjectionMatrix, parent.dhModelViewMatrix, parent.partialTicks);
}
}
}
@@ -0,0 +1,46 @@
package com.seibel.lod.api.methods.events.abstractEvents;
import com.seibel.lod.api.interfaces.world.IDhApiLevelWrapper;
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.lod.api.objects.events.DhApiEventDefinition;
/**
* @author James Seibel
* @version 2022-11-21
*/
public abstract class DhApiLevelLoadEvent implements IDhApiEvent<DhApiLevelLoadEvent.EventParam>
{
/** Fired after Distant Horizons loads a new level. */
public abstract void onLevelLoad(EventParam input);
//=========================//
// internal DH API methods //
//=========================//
@Override
public final boolean fireEvent(EventParam input)
{
this.onLevelLoad(input);
return false;
}
public final static DhApiEventDefinition EVENT_DEFINITION = new DhApiEventDefinition(false, false);
@Override
public final DhApiEventDefinition getEventDefinition() { return EVENT_DEFINITION; }
//==================//
// parameter object //
//==================//
public static class EventParam
{
/** The newly loaded level. */
public final IDhApiLevelWrapper levelWrapper;
public EventParam(IDhApiLevelWrapper newLevelWrapper) { this.levelWrapper = newLevelWrapper; }
}
}
@@ -0,0 +1,46 @@
package com.seibel.lod.api.methods.events.abstractEvents;
import com.seibel.lod.api.interfaces.world.IDhApiLevelWrapper;
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.lod.api.objects.events.DhApiEventDefinition;
/**
* @author James Seibel
* @version 2022-11-21
*/
public abstract class DhApiLevelSaveEvent implements IDhApiEvent<DhApiLevelSaveEvent.EventParam>
{
/** Fired after Distant Horizons saves LOD data for the server. */
public abstract void onLevelSave(EventParam input);
//=========================//
// internal DH API methods //
//=========================//
@Override
public final boolean fireEvent(EventParam input)
{
this.onLevelSave(input);
return false;
}
public final static DhApiEventDefinition EVENT_DEFINITION = new DhApiEventDefinition(false, false);
@Override
public final DhApiEventDefinition getEventDefinition() { return EVENT_DEFINITION; }
//==================//
// parameter object //
//==================//
public static class EventParam
{
/** The saved level. */
public final IDhApiLevelWrapper levelWrapper;
public EventParam(IDhApiLevelWrapper newLevelWrapper) { this.levelWrapper = newLevelWrapper; }
}
}
@@ -0,0 +1,45 @@
package com.seibel.lod.api.methods.events.abstractEvents;
import com.seibel.lod.api.interfaces.world.IDhApiLevelWrapper;
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.lod.api.objects.events.DhApiEventDefinition;
/**
* @author James Seibel
* @version 2022-11-21
*/
public abstract class DhApiLevelUnloadEvent implements IDhApiEvent<DhApiLevelUnloadEvent.EventParam>
{
/** Fired before Distant Horizons unloads a level. */
public abstract void onLevelUnload(EventParam input);
//=========================//
// internal DH API methods //
//=========================//
@Override
public final boolean fireEvent(EventParam input)
{
this.onLevelUnload(input);
return false;
}
public final static DhApiEventDefinition EVENT_DEFINITION = new DhApiEventDefinition(false, false);
@Override
public final DhApiEventDefinition getEventDefinition() { return EVENT_DEFINITION; }
//==================//
// parameter object //
//==================//
public static class EventParam
{
/** The recently unloaded level. */
public final IDhApiLevelWrapper levelWrapper;
public EventParam(IDhApiLevelWrapper newLevelWrapper) { this.levelWrapper = newLevelWrapper; }
}
}
@@ -0,0 +1,52 @@
package com.seibel.lod.api.methods.events.interfaces;
import com.seibel.lod.api.objects.events.DhApiEventDefinition;
import com.seibel.lod.coreapi.interfaces.dependencyInjection.IBindable;
/**
* The interface used by all DH Api events.
*
* @param <T> This is the datatype that will be passed into the event handler's method.
*
* @author James Seibel
* @version 2022-11-20
*/
public interface IDhApiEvent<T> extends IBindable
{
//==========//
// external //
//==========//
/**
* Returns true if the event should be automatically unbound
* after firing. <br>
* Can be useful for one time setup events or waiting for a specific game state. <br> <Br>
*
* Defaults to False
* IE: The event will not be removed after firing and will continue firing until removed.
*/
default boolean removeAfterFiring() { return false; };
//==========//
// internal //
//==========//
/**
* The event definition includes meta information about how the event will behave. <br>
* For example: if the event is cancelable or not.
*/
DhApiEventDefinition getEventDefinition();
/**
* Called internally by Distant Horizons when the event happens.
* This method shouldn't directly be overridden and
* should call a more specific method instead.
*
* @param input the parameter object passed in from the event source. Can be null.
* @return whether the event should be canceled or not.
* A canceled event will still fire the other event handlers that are queued.
*/
boolean fireEvent(T input);
}
@@ -0,0 +1,42 @@
package com.seibel.lod.api.methods.events.sharedParameterObjects;
import com.seibel.lod.coreapi.util.math.Mat4f;
/**
* Parameter passed into Render events.
*
* @author James Seibel
* @version 2022-9-5
*/
public class DhApiRenderParam
{
/** The projection matrix Minecraft is using to render this frame. */
public final Mat4f mcProjectionMatrix;
/** The model view matrix Minecraft is using to render this frame. */
public final Mat4f mcModelViewMatrix;
/** The projection matrix Distant Horizons is using to render this frame. */
public final Mat4f dhProjectionMatrix;
/** The model view matrix Distant Horizons is using to render this frame. */
public final Mat4f dhModelViewMatrix;
/** Indicates how far into this tick the frame is. */
public final float partialTicks;
public DhApiRenderParam(
Mat4f newMcProjectionMatrix, Mat4f newMcModelViewMatrix,
Mat4f newDhProjectionMatrix, Mat4f newDhModelViewMatrix,
float newPartialTicks)
{
this.mcProjectionMatrix = newMcProjectionMatrix;
this.mcModelViewMatrix = newMcModelViewMatrix;
this.dhProjectionMatrix = newDhProjectionMatrix;
this.dhModelViewMatrix = newDhModelViewMatrix;
this.partialTicks = newPartialTicks;
}
}
@@ -0,0 +1,37 @@
package com.seibel.lod.api.methods.override;
import com.seibel.lod.api.interfaces.override.worldGenerator.IDhApiWorldGenerator;
import com.seibel.lod.api.interfaces.override.worldGenerator.IDhApiWorldGeneratorOverrideRegister;
import com.seibel.lod.api.interfaces.world.IDhApiLevelWrapper;
import com.seibel.lod.api.objects.DhApiResult;
import com.seibel.lod.coreapi.DependencyInjection.WorldGeneratorInjector;
/**
* Handles adding world generator overrides.
*
* @author James Seibel
* @version 2022-12-10
*/
public class DhApiWorldGeneratorOverrideRegister implements IDhApiWorldGeneratorOverrideRegister
{
public static DhApiWorldGeneratorOverrideRegister INSTANCE = new DhApiWorldGeneratorOverrideRegister();
private DhApiWorldGeneratorOverrideRegister() { }
@Override
public DhApiResult<Void> registerWorldGeneratorOverride(IDhApiLevelWrapper levelWrapper, IDhApiWorldGenerator worldGenerator)
{
try
{
WorldGeneratorInjector.INSTANCE.bind(levelWrapper, worldGenerator);
return DhApiResult.createSuccess();
}
catch (Exception e)
{
return DhApiResult.createFail(e.getMessage());
}
}
}
@@ -0,0 +1 @@
The overide api package holds objects and methods for overriding Distant Horizons' backend systems, so they can be replaced and improved.
@@ -0,0 +1,51 @@
package com.seibel.lod.api.objects;
/**
* Allows for more descriptive non-critical failure states.
*
* @param <T> The payload type this result contains, can be Void if the result is just used to notify success/failure.
*
* @author James Seibel
* @version 2022-11-24
*/
public class DhApiResult<T>
{
/** True if the action succeeded, false otherwise. */
public final boolean success;
/**
* If the action failed this will contain the reason as to why. <br>
* If the action was successful this will generally be the empty string.
*/
public final String message;
/**
* Whatever object the API Method generated/returned. <br>
* Will be null/Void if this result is just used to notify success/failure.
*/
public final T payload;
// these constructors are private because the create... methods below are easier to understand
private DhApiResult(boolean success, String message) { this(success, message, null); }
private DhApiResult(boolean success, String message, T payload)
{
this.success = success;
// don't allow null messages, in the case of a null message return the empty string to prevent potential null pointers
this.message = (message == null) ? "" : message;
this.payload = payload;
}
public static <Pt> DhApiResult<Pt> createSuccess() { return new DhApiResult<>(true, ""); }
public static <Pt> DhApiResult<Pt> createSuccess(Pt payload) { return new DhApiResult<Pt>(true, "", payload); }
// There is no createSuccess(String message) method because it would be too easy to confuse with createSuccess(Pt payload) when returning null
public static <Pt> DhApiResult<Pt> createSuccess(String message, Pt payload) { return new DhApiResult<Pt>(true, message, payload); }
public static <Pt> DhApiResult<Pt> createFail() { return new DhApiResult<>(false, ""); }
public static <Pt> DhApiResult<Pt> createFail(String message) { return new DhApiResult<>(false, message); }
public static <Pt> DhApiResult<Pt> createFail(String message, Pt payload) { return new DhApiResult<Pt>(false, message, payload); }
}
@@ -0,0 +1,75 @@
package com.seibel.lod.api.objects.config;
import com.seibel.lod.api.interfaces.config.IDhApiConfigValue;
import com.seibel.lod.coreapi.interfaces.config.IConfigEntry;
import com.seibel.lod.coreapi.interfaces.config.IConverter;
import com.seibel.lod.coreapi.util.converters.DefaultConverter;
/**
* A wrapper used to interface with Distant Horizon's Config. <br> <br>
*
* When using this object you need to explicitly define the generic types,
* otherwise Intellij won't do any type checking and the wrong types can be used. <br>
* For example a method returning IDhApiConfig<Integer> when the config should be a Boolean.
*
* @param <apiType> The datatype you, an API dev will use.
* @param <coreType> The datatype Distant Horizons uses in the background; implementing developers can ignore this.
*
* @author James Seibel
* @version 2022-6-30
*/
public class DhApiConfigValue<coreType, apiType> implements IDhApiConfigValue<apiType>
{
private final IConfigEntry<coreType> configEntry;
private final IConverter<coreType, apiType> configConverter;
/**
* This constructor should only be called internally. <br>
* There is no reason for API users to create this object. <br><br>
*
* Uses the default object converter, this requires coreType and apiType to be the same.
*/
@SuppressWarnings("unchecked") // DefaultConverter's cast is safe
public DhApiConfigValue(IConfigEntry<coreType> newConfigEntry)
{
this.configEntry = newConfigEntry;
this.configConverter = (IConverter<coreType, apiType>) new DefaultConverter<coreType>();
}
/**
* This constructor should only be called internally. <br>
* There is no reason for API users to create this object. <br><br>
*/
public DhApiConfigValue(IConfigEntry<coreType> newConfigEntry, IConverter<coreType, apiType> newConverter)
{
this.configEntry = newConfigEntry;
this.configConverter = newConverter;
}
public apiType getValue() { return this.configConverter.convertToApiType(this.configEntry.get()); }
public apiType getTrueValue() { return this.configConverter.convertToApiType(this.configEntry.getTrueValue()); }
public apiType getApiValue() { return this.configConverter.convertToApiType(this.configEntry.getApiValue()); }
public boolean setValue(apiType newValue)
{
if (this.configEntry.getAllowApiOverride())
{
this.configEntry.setApiValue(this.configConverter.convertToCoreType(newValue));
return true;
}
else
{
return false;
}
}
public boolean getCanBeOverrodeByApi() { return this.configEntry.getAllowApiOverride(); }
public apiType getDefaultValue() { return this.configConverter.convertToApiType(configEntry.getDefaultValue()); }
public apiType getMaxValue() { return this.configConverter.convertToApiType(this.configEntry.getMax()); }
public apiType getMinValue() { return this.configConverter.convertToApiType(this.configEntry.getMin()); }
}
@@ -0,0 +1,36 @@
package com.seibel.lod.api.objects.data;
import com.seibel.lod.api.objects.math.DhApiVec3i;
import com.seibel.lod.coreapi.util.math.Vec3i;
/**
* Holds a single datapoint of terrain data
* and the block position from the raycast.
*
* @author James Seibel
* @version 2022-11-19
*/
public class DhApiRaycastResult
{
/**
* LOD position of this raycast. <br><br>
*
* <strong>Note: </strong>
* This will NOT be the exact block position if the LOD the ray
* hits is more than one block tall. In that case this will
* be the bottom block position for that LOD.
*/
public final DhApiVec3i pos;
/** The LOD data at this position. */
public final DhApiTerrainDataPoint dataPoint;
public DhApiRaycastResult(DhApiTerrainDataPoint dataPoint, Vec3i blockPos)
{
this.dataPoint = dataPoint;
this.pos = blockPos;
}
}
@@ -0,0 +1,44 @@
package com.seibel.lod.api.objects.data;
import com.seibel.lod.api.interfaces.block.IDhApiBiomeWrapper;
import com.seibel.lod.api.interfaces.block.IDhApiBlockStateWrapper;
/**
* Holds a single datapoint of terrain data.
*
* @author James Seibel
* @version 2022-11-13
*/
public class DhApiTerrainDataPoint
{
/**
* 0 = block <br>
* 1 = 2x2 blocks <br>
* 2 = 4x4 blocks <br>
* 4 = chunk (16x16 blocks) <br>
* 9 = region (512x512 blocks) <br>
*/
public final byte detailLevel;
public final int lightLevel;
public final int topYBlockPos;
public final int bottomYBlockPos;
public final IDhApiBlockStateWrapper blockStateWrapper;
public final IDhApiBiomeWrapper biomeWrapper;
public DhApiTerrainDataPoint(byte detailLevel, int lightLevel, int topYBlockPos, int bottomYBlockPos, IDhApiBlockStateWrapper blockStateWrapper, IDhApiBiomeWrapper biomeWrapper)
{
this.detailLevel = detailLevel;
this.lightLevel = lightLevel;
this.topYBlockPos = topYBlockPos;
this.bottomYBlockPos = bottomYBlockPos;
this.blockStateWrapper = blockStateWrapper;
this.biomeWrapper = biomeWrapper;
}
}
@@ -0,0 +1,55 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.objects.events;
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.HashMap;
/**
* The event definition includes meta information about how the event will behave.
*
* @author James Seibel
* @version 2022-11-20
*/
public class DhApiEventDefinition
{
/** True if the event can be canceled. */
public final boolean isCancelable;
/**
* True if the event will only ever be fired once. <Br>
* An example of this would be initial setup methods, DH won't run its initial setup more than once. <br><br>
*
* If a handler is bound for a one time event after the event has been fired, the handler will be immediately fired.
*/
public final boolean isOneTimeEvent;
public DhApiEventDefinition(boolean isCancelable, boolean isOneTimeEvent)
{
this.isCancelable = isCancelable;
this.isOneTimeEvent = isOneTimeEvent;
}
}
@@ -0,0 +1,92 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.objects.math;
/**
* Often used to store block positions or any other
* position in 3D space.
*
* @author James Seibel
* @version 2022-11-19
*/
public class DhApiVec3i
{
public int x;
public int y;
public int z;
/** creates a Vec3 at (0,0,0) */
public DhApiVec3i()
{
this.x = 0;
this.y = 0;
this.z = 0;
}
public DhApiVec3i(int x, int y, int z)
{
this.x = x;
this.y = y;
this.z = z;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
else if (obj != null && this.getClass() == obj.getClass())
{
DhApiVec3i Vec3f = (DhApiVec3i) obj;
if (Float.compare(Vec3f.x, this.x) != 0)
{
return false;
}
else if (Float.compare(Vec3f.y, this.y) != 0)
{
return false;
}
else
{
return Float.compare(Vec3f.z, this.z) == 0;
}
}
else
{
return false;
}
}
@Override
public int hashCode()
{
int i = Float.floatToIntBits(this.x);
i = 31 * i + Float.floatToIntBits(this.y);
return 31 * i + Float.floatToIntBits(this.z);
}
@Override
public String toString() { return "[" + this.x + ", " + this.y + ", " + this.z + "]"; }
}
@@ -0,0 +1,155 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.coreapi.DependencyInjection;
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
import com.seibel.lod.coreapi.events.ApiEventDefinitionHandler;
import com.seibel.lod.coreapi.interfaces.dependencyInjection.IBindable;
import com.seibel.lod.api.interfaces.events.IDhApiEventInjector;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.HashMap;
/**
* This class takes care of dependency injection for API events.
*
* @author James Seibel
* @version 2022-11-24
*/
public class ApiEventInjector extends DependencyInjector<IDhApiEvent> implements IDhApiEventInjector // Note to self: Don't try adding a generic type to IDhApiEvent, the constructor won't accept it
{
public static final ApiEventInjector INSTANCE = new ApiEventInjector();
private static final Logger LOGGER = LogManager.getLogger(ApiEventInjector.class.getSimpleName());
private final HashMap<Class<? extends IDhApiEvent>, Object> firedOneTimeEventParamsByEventInterface = new HashMap<>();
private ApiEventInjector() { super(IDhApiEvent.class, true); }
@SuppressWarnings("unchecked")
@Override
public void bind(Class<? extends IDhApiEvent> abstractEvent, IDhApiEvent eventImplementation) throws IllegalStateException, IllegalArgumentException
{
// is this a one time event?
if (ApiEventDefinitionHandler.INSTANCE.getEventDefinition(abstractEvent).isOneTimeEvent)
{
// has this one time event been fired yet?
if (this.firedOneTimeEventParamsByEventInterface.containsKey(abstractEvent))
{
// the one time event has happened, fire the handler
// this has to be an unsafe cast since the hash map can't hold the generic objects
Object parameter = this.firedOneTimeEventParamsByEventInterface.get(abstractEvent);
eventImplementation.fireEvent(parameter);
}
}
// bind the event handler
super.bind(abstractEvent, eventImplementation);
}
@Override
public boolean unbind(Class<? extends IDhApiEvent> abstractEvent, Class<? extends IDhApiEvent> eventClassToRemove) throws IllegalArgumentException
{
// make sure the given dependency implements the necessary interfaces
boolean implementsInterface = this.checkIfClassImplements(eventClassToRemove, abstractEvent) ||
this.checkIfClassExtends(eventClassToRemove, abstractEvent);
boolean implementsBindable = this.checkIfClassImplements(eventClassToRemove, this.bindableInterface);
// display any errors
if (!implementsInterface)
{
throw new IllegalArgumentException("The event handler [" + eventClassToRemove.getSimpleName() + "] doesn't implement or extend: [" + abstractEvent.getSimpleName() + "].");
}
if (!implementsBindable)
{
throw new IllegalArgumentException("The event handler [" + eventClassToRemove.getSimpleName() + "] doesn't implement the interface: [" + IBindable.class.getSimpleName() + "].");
}
// actually remove the dependency
if (this.dependencies.containsKey(abstractEvent))
{
ArrayList<IDhApiEvent> dependencyList = this.dependencies.get(abstractEvent);
int indexToRemove = -1;
for(int i = 0; i < dependencyList.size(); i++)
{
IBindable dependency = dependencyList.get(i);
if (dependency.getClass().equals(eventClassToRemove))
{
indexToRemove = i;
break;
}
}
if (indexToRemove != -1)
{
return dependencyList.remove(indexToRemove) != null;
}
}
// no item was removed
return false;
}
@Override
public <T, U extends IDhApiEvent<T>> boolean fireAllEvents(Class<U> abstractEvent, T eventParameterObject)
{
boolean cancelEvent = false;
// if this is a one time event, record that it was called
if (ApiEventDefinitionHandler.INSTANCE.getEventDefinition(abstractEvent).isOneTimeEvent &&
!this.firedOneTimeEventParamsByEventInterface.containsKey(abstractEvent))
{
this.firedOneTimeEventParamsByEventInterface.put(abstractEvent, eventParameterObject);
}
// fire each bound event
ArrayList<U> eventList = this.getAll(abstractEvent);
for (IDhApiEvent<T> event : eventList)
{
if (event != null)
{
try
{
// fire each event and record if any of them
// request to cancel the event.
cancelEvent |= event.fireEvent(eventParameterObject);
}
catch (Exception e)
{
LOGGER.error("Exception thrown by event handler [" + event.getClass().getSimpleName() + "] for event type [" + abstractEvent.getSimpleName() + "], error:" + e.getMessage(), e);
}
}
}
return cancelEvent;
}
}
@@ -0,0 +1,205 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.coreapi.DependencyInjection;
import com.seibel.lod.coreapi.interfaces.dependencyInjection.IBindable;
import com.seibel.lod.coreapi.interfaces.dependencyInjection.IDependencyInjector;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* This class takes care of tracking objects used in dependency injection.
*
* @param <BindableType> extends IBindable and defines what interfaces this dependency handler can deal with.
* @author James Seibel
* @version 2022-11-24
*/
public class DependencyInjector<BindableType extends IBindable> implements IDependencyInjector<BindableType> // Note to self: Don't try adding a generic type to IDhApiEvent, the constructor won't accept it
{
protected final Map<Class<? extends BindableType>, ArrayList<BindableType>> dependencies = new HashMap<>();
/** Internal class reference to BindableType since we can't get it any other way. */
protected final Class<? extends BindableType> bindableInterface;
protected final boolean allowDuplicateBindings;
public DependencyInjector(Class<BindableType> newBindableInterface)
{
this.bindableInterface = newBindableInterface;
this.allowDuplicateBindings = false;
}
public DependencyInjector(Class<BindableType> newBindableInterface, boolean newAllowDuplicateBindings)
{
this.bindableInterface = newBindableInterface;
this.allowDuplicateBindings = newAllowDuplicateBindings;
}
@Override
public void bind(Class<? extends BindableType> dependencyInterface, BindableType dependencyImplementation) throws IllegalStateException, IllegalArgumentException
{
// duplicate check if requested
if (this.dependencies.containsKey(dependencyInterface) && !this.allowDuplicateBindings)
{
throw new IllegalStateException("The dependency [" + dependencyInterface.getSimpleName() + "] has already been bound.");
}
// make sure the given dependency implements the necessary interfaces
boolean implementsInterface = this.checkIfClassImplements(dependencyImplementation.getClass(), dependencyInterface) ||
this.checkIfClassExtends(dependencyImplementation.getClass(), dependencyInterface);
boolean implementsBindable = this.checkIfClassImplements(dependencyImplementation.getClass(), this.bindableInterface);
// display any errors
if (!implementsInterface)
{
throw new IllegalArgumentException("The dependency [" + dependencyImplementation.getClass().getSimpleName() + "] doesn't implement or extend: [" + dependencyInterface.getSimpleName() + "].");
}
if (!implementsBindable)
{
throw new IllegalArgumentException("The dependency [" + dependencyImplementation.getClass().getSimpleName() + "] doesn't implement the interface: [" + IBindable.class.getSimpleName() + "].");
}
// make sure the hashSet has an array to hold the dependency
if (!this.dependencies.containsKey(dependencyInterface))
{
this.dependencies.put(dependencyInterface, new ArrayList<BindableType>());
}
// add the dependency
this.dependencies.get(dependencyInterface).add(dependencyImplementation);
}
@Override
public boolean checkIfClassImplements(Class<?> classToTest, Class<?> interfaceToLookFor)
{
// check the parent class (if applicable)
if (classToTest.getSuperclass() != Object.class && classToTest.getSuperclass() != null)
{
if (this.checkIfClassImplements(classToTest.getSuperclass(), interfaceToLookFor))
{
return true;
}
}
// check interfaces
for (Class<?> implementationInterface : classToTest.getInterfaces())
{
// recurse to check interface parents if necessary
if (implementationInterface.getInterfaces().length != 0)
{
if (this.checkIfClassImplements(implementationInterface, interfaceToLookFor))
{
return true;
}
}
if (implementationInterface.equals(interfaceToLookFor))
{
return true;
}
}
return false;
}
@Override
public boolean checkIfClassExtends(Class<?> classToTest, Class<?> extensionToLookFor) { return extensionToLookFor.isAssignableFrom(classToTest); }
@SuppressWarnings("unchecked")
@Override
public <T extends BindableType> T get(Class<T> interfaceClass) throws ClassCastException
{
return (T) this.getInternalLogic(interfaceClass, false).get(0);
}
@Override
public <T extends BindableType> ArrayList<T> getAll(Class<T> interfaceClass) throws ClassCastException
{
return this.getInternalLogic(interfaceClass, false);
}
@Override
public <T extends BindableType> T get(Class<T> interfaceClass, boolean allowIncompleteDependencies) throws ClassCastException
{
return (T) this.getInternalLogic(interfaceClass, allowIncompleteDependencies).get(0);
}
/**
* Always returns a list of size 1 or greater,
* if no dependencies have been bound the list will contain null.
*/
@SuppressWarnings("unchecked")
private <T extends BindableType> ArrayList<T> getInternalLogic(Class<T> interfaceClass, boolean allowIncompleteDependencies) throws ClassCastException
{
ArrayList<BindableType> dependencyList = this.dependencies.get(interfaceClass);
if (dependencyList != null && dependencyList.size() != 0)
{
// check if each dependencies' delayed setup has been completed
for (IBindable dependency : dependencyList)
{
if (!dependency.getDelayedSetupComplete() && !allowIncompleteDependencies)
{
// a warning can be used here instead if desired
//this.logger.warn("Got dependency of type [" + interfaceClass.getSimpleName() + "], but the dependency's delayed setup hasn't been run!");
throw new IllegalStateException("Got dependency of type [" + interfaceClass.getSimpleName() + "], but the dependency's delayed setup hasn't been run!");
}
}
return (ArrayList<T>) dependencyList;
}
// return an empty list to prevent null pointers
ArrayList<T> emptyList = new ArrayList<T>();
emptyList.add(null);
return emptyList;
}
/** Removes all bound dependencies. */
@Override
public void clear() { this.dependencies.clear(); }
/** Runs delayed setup for any dependencies that require it. */
@Override
public void runDelayedSetup()
{
for (Class<? extends BindableType> interfaceKey : this.dependencies.keySet())
{
IBindable concreteObject = this.get(interfaceKey, true);
if (!concreteObject.getDelayedSetupComplete())
{
concreteObject.finishDelayedSetup();
}
}
}
}
@@ -0,0 +1,132 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.coreapi.DependencyInjection;
import com.seibel.lod.api.interfaces.override.IDhApiOverrideable;
import com.seibel.lod.coreapi.interfaces.dependencyInjection.IOverrideInjector;
import com.seibel.lod.coreapi.util.StringUtil;
import java.util.HashMap;
/**
* This class takes care of dependency injection for overridable objects. <Br>
* This is done so other mods can override our methods to improve features down the line.
*
* @author James Seibel
* @version 2022-9-8
*/
public class OverrideInjector implements IOverrideInjector<IDhApiOverrideable>
{
public static final OverrideInjector INSTANCE = new OverrideInjector();
private final HashMap<Class<? extends IDhApiOverrideable>, OverridePriorityListContainer> overrideContainerByInterface = new HashMap<>();
/**
* This is used to determine if an override is part of Distant Horizons'
* Core or not.
* This probably isn't the best way of going about this, but it works for now.
*/
private final String corePackagePath;
public OverrideInjector()
{
String thisPackageName = this.getClass().getPackage().getName();
int secondPackageEndingIndex = StringUtil.nthIndexOf(thisPackageName, ".", 3);
this.corePackagePath = thisPackageName.substring(0, secondPackageEndingIndex); // this should be "com.seibel.lod"
}
public OverrideInjector(String newCorePackagePath) { this.corePackagePath = newCorePackagePath; }
@Override
public void bind(Class<? extends IDhApiOverrideable> dependencyInterface, IDhApiOverrideable dependencyImplementation) throws IllegalStateException, IllegalArgumentException
{
// make sure a override container exists
OverridePriorityListContainer overrideContainer = this.overrideContainerByInterface.get(dependencyInterface);
if (overrideContainer == null)
{
overrideContainer = new OverridePriorityListContainer();
this.overrideContainerByInterface.put(dependencyInterface, overrideContainer);
}
// validate the new override //
// check if this override is a core override
if (dependencyImplementation.getPriority() == CORE_PRIORITY)
{
// this claims to be a core override, is that true?
String packageName = dependencyImplementation.getClass().getPackage().getName();
if (!packageName.startsWith(this.corePackagePath))
{
throw new IllegalArgumentException("Only Distant Horizons internal objects can use the Override Priority [" + CORE_PRIORITY + "]. Please use a higher number.");
}
}
// make sure the override has a valid priority
else if (dependencyImplementation.getPriority() < MIN_NON_CORE_OVERRIDE_PRIORITY)
{
throw new IllegalArgumentException("Invalid priority value [" + dependencyImplementation.getPriority() + "], override priorities must be [" + MIN_NON_CORE_OVERRIDE_PRIORITY + "] or greater.");
}
// check if an override already exists with this priority
IDhApiOverrideable existingOverride = overrideContainer.getOverrideWithPriority(dependencyImplementation.getPriority());
if (existingOverride != null)
{
throw new IllegalStateException("An override already exists with the priority [" + dependencyImplementation.getPriority() + "].");
}
// bind the override
overrideContainer.addOverride(dependencyImplementation);
}
@Override
@SuppressWarnings("unchecked")
public <T extends IDhApiOverrideable> T get(Class<T> interfaceClass) throws ClassCastException
{
OverridePriorityListContainer overrideContainer = this.overrideContainerByInterface.get(interfaceClass);
return overrideContainer != null ? (T) overrideContainer.getOverrideWithHighestPriority() : null;
}
@Override
@SuppressWarnings("unchecked")
public <T extends IDhApiOverrideable> T get(Class<T> interfaceClass, int priority) throws ClassCastException
{
OverridePriorityListContainer overrideContainer = this.overrideContainerByInterface.get(interfaceClass);
return overrideContainer != null ? (T) overrideContainer.getOverrideWithPriority(priority) : null;
}
@Override
public void clear() { this.overrideContainerByInterface.clear(); }
}
@@ -0,0 +1,116 @@
package com.seibel.lod.coreapi.DependencyInjection;
import com.seibel.lod.api.interfaces.override.IDhApiOverrideable;
import com.seibel.lod.coreapi.interfaces.dependencyInjection.IBindable;
import java.util.ArrayList;
/**
* Contains a list of overrides and their priorities.
*
* @author James Seibel
* @version 2022-9-5
*/
public class OverridePriorityListContainer implements IBindable
{
/** Sorted highest priority to lowest */
private final ArrayList<OverridePriorityPair> overridePairList = new ArrayList<>();
/** Doesn't do any validation */
public void addOverride(IDhApiOverrideable override)
{
OverridePriorityPair priorityPair = new OverridePriorityPair(override, override.getPriority());
this.overridePairList.add(priorityPair);
sortList();
}
/** @return true if the override was removed from the list, false otherwise. */
public boolean removeOverride(IDhApiOverrideable override)
{
if (this.overridePairList.contains(override))
{
this.overridePairList.remove(override);
sortList();
return true;
}
else
{
return false;
}
}
// getters //
public IDhApiOverrideable getOverrideWithLowestPriority()
{
if (this.overridePairList.size() == 0)
{
return null;
}
else
{
// last item should have the highest priority
return this.overridePairList.get(this.overridePairList.size() - 1).override;
}
}
public IDhApiOverrideable getOverrideWithHighestPriority()
{
if (this.overridePairList.size() != 0)
{
return this.overridePairList.get(0).override;
}
else
{
return null;
}
}
public IDhApiOverrideable getCoreOverride()
{
int lastIndex = this.overridePairList.size() - 1;
if (this.overridePairList.get(lastIndex) != null && this.overridePairList.get(lastIndex).priority == OverrideInjector.CORE_PRIORITY)
{
return this.overridePairList.get(lastIndex).override;
}
else
{
return null;
}
}
/** Returns null if no override with the given priority is found */
public IDhApiOverrideable getOverrideWithPriority(int priority)
{
for (OverridePriorityPair pair : this.overridePairList)
{
if (pair.priority == priority)
{
return pair.override;
}
}
return null;
}
// utils //
/** sort the list so the highest priority item is first in the list */
private void sortList() { this.overridePairList.sort((x,y) -> Integer.compare(y.priority, x.priority)); }
private class OverridePriorityPair
{
public final IDhApiOverrideable override;
public int priority;
public OverridePriorityPair(IDhApiOverrideable newOverride, int newPriority)
{
this.override = newOverride;
this.priority = newPriority;
}
}
}
@@ -0,0 +1,124 @@
/*
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
* licensed under the GNU LGPL v3 License.
*
* Copyright (C) 2020-2022 James Seibel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.coreapi.DependencyInjection;
import com.seibel.lod.api.interfaces.override.worldGenerator.IDhApiWorldGenerator;
import com.seibel.lod.api.interfaces.world.IDhApiLevelWrapper;
import com.seibel.lod.coreapi.interfaces.dependencyInjection.IBindable;
import com.seibel.lod.coreapi.util.StringUtil;
import java.util.HashMap;
/**
* This class takes care of dependency injection for world generators. <Br>
* This is done so other mods can override our world generator(s) to improve or replace them.
* @author James Seibel
* @version 2022-12-10
*/
public class WorldGeneratorInjector
{
public static final WorldGeneratorInjector INSTANCE = new WorldGeneratorInjector();
private final HashMap<IDhApiLevelWrapper, OverrideInjector> worldGeneratorByLevelWrapper = new HashMap<>();
/**
* This is used to determine if an override is part of Distant Horizons'
* Core or not.
* This probably isn't the best way of going about this, but it works for now.
*/
private final String corePackagePath;
public WorldGeneratorInjector()
{
String thisPackageName = this.getClass().getPackage().getName();
int secondPackageEndingIndex = StringUtil.nthIndexOf(thisPackageName, ".", 3);
this.corePackagePath = thisPackageName.substring(0, secondPackageEndingIndex); // this should be "com.seibel.lod"
}
/** This constructor should only be used for testing different corePackagePaths. */
public WorldGeneratorInjector(String newCorePackagePath)
{
this.corePackagePath = newCorePackagePath;
}
/**
* Binds a world generator to the given level. <Br>
* See {@link DependencyInjector#bind(Class, IBindable) bind(Class, IBindable)} for full documentation.
*
* @throws NullPointerException if any parameter is null
* @throws IllegalArgumentException if a non-Distant Horizons world generator with the priority CORE is passed in
*
* @see DependencyInjector#bind(Class, IBindable)
*/
public void bind(IDhApiLevelWrapper levelForWorldGenerator, IDhApiWorldGenerator worldGeneratorImplementation) throws NullPointerException, IllegalArgumentException
{
// validate inputs
if (levelForWorldGenerator == null)
{
throw new NullPointerException("A [" + IDhApiLevelWrapper.class.getSimpleName() + "] is required when binding a world generator.");
}
if (worldGeneratorImplementation == null)
{
throw new NullPointerException("No [" + IDhApiWorldGenerator.class.getSimpleName() + "] given.");
}
// bind this generator to the given level
if (!this.worldGeneratorByLevelWrapper.containsKey(levelForWorldGenerator))
{
this.worldGeneratorByLevelWrapper.put(levelForWorldGenerator, new OverrideInjector(this.corePackagePath));
}
this.worldGeneratorByLevelWrapper.get(levelForWorldGenerator).bind(IDhApiWorldGenerator.class, worldGeneratorImplementation);
}
/**
* Returns the bound world generator with the highest priority. <br>
* Returns null if no world generators have been bound for this specific level. <br><br>
*
* See {@link OverrideInjector#get(Class) get(Class)} for full documentation.
* @see OverrideInjector#get(Class)
*/
public IDhApiWorldGenerator get(IDhApiLevelWrapper levelForWorldGenerator) throws ClassCastException
{
if (!this.worldGeneratorByLevelWrapper.containsKey(levelForWorldGenerator))
{
// no generator exists for this specific level.
return null;
}
// use the existing world generator
return this.worldGeneratorByLevelWrapper.get(levelForWorldGenerator).get(IDhApiWorldGenerator.class);
}
/** Removes all bound world generators. */
public void clear() { this.worldGeneratorByLevelWrapper.clear(); }
}

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