mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 02:20:57 +00:00
Merge pull request #420 from PolyhedralDev/ver/6.4.0
Terra Version 6.4.0
This commit is contained in:
@@ -8,7 +8,7 @@ indent_style = space
|
|||||||
insert_final_newline = false
|
insert_final_newline = false
|
||||||
max_line_length = 140
|
max_line_length = 140
|
||||||
tab_width = 4
|
tab_width = 4
|
||||||
ij_continuation_indent_size = 8
|
ij_continuation_indent_size = 4
|
||||||
ij_formatter_off_tag = @formatter:off
|
ij_formatter_off_tag = @formatter:off
|
||||||
ij_formatter_on_tag = @formatter:on
|
ij_formatter_on_tag = @formatter:on
|
||||||
ij_formatter_tags_enabled = false
|
ij_formatter_tags_enabled = false
|
||||||
@@ -25,12 +25,12 @@ ij_java_align_multiline_annotation_parameters = true
|
|||||||
ij_java_align_multiline_array_initializer_expression = true
|
ij_java_align_multiline_array_initializer_expression = true
|
||||||
ij_java_align_multiline_assignment = true
|
ij_java_align_multiline_assignment = true
|
||||||
ij_java_align_multiline_binary_operation = true
|
ij_java_align_multiline_binary_operation = true
|
||||||
ij_java_align_multiline_chained_methods = true
|
ij_java_align_multiline_chained_methods = false
|
||||||
ij_java_align_multiline_extends_list = true
|
ij_java_align_multiline_extends_list = true
|
||||||
ij_java_align_multiline_for = true
|
ij_java_align_multiline_for = true
|
||||||
ij_java_align_multiline_method_parentheses = true
|
ij_java_align_multiline_method_parentheses = false
|
||||||
ij_java_align_multiline_parameters = true
|
ij_java_align_multiline_parameters = true
|
||||||
ij_java_align_multiline_parameters_in_calls = true
|
ij_java_align_multiline_parameters_in_calls = false
|
||||||
ij_java_align_multiline_parenthesized_expression = true
|
ij_java_align_multiline_parenthesized_expression = true
|
||||||
ij_java_align_multiline_records = true
|
ij_java_align_multiline_records = true
|
||||||
ij_java_align_multiline_resources = true
|
ij_java_align_multiline_resources = true
|
||||||
@@ -127,7 +127,7 @@ ij_java_keep_blank_lines_in_declarations = 2
|
|||||||
ij_java_keep_builder_methods_indents = true
|
ij_java_keep_builder_methods_indents = true
|
||||||
ij_java_keep_control_statement_in_one_line = true
|
ij_java_keep_control_statement_in_one_line = true
|
||||||
ij_java_keep_first_column_comment = false
|
ij_java_keep_first_column_comment = false
|
||||||
ij_java_keep_indents_on_empty_lines = true
|
ij_java_keep_indents_on_empty_lines = false
|
||||||
ij_java_keep_line_breaks = true
|
ij_java_keep_line_breaks = true
|
||||||
ij_java_keep_multiple_expressions_in_one_line = false
|
ij_java_keep_multiple_expressions_in_one_line = false
|
||||||
ij_java_keep_simple_blocks_in_one_line = true
|
ij_java_keep_simple_blocks_in_one_line = true
|
||||||
@@ -577,14 +577,14 @@ ij_properties_keep_blank_lines = false
|
|||||||
ij_properties_key_value_delimiter = equals
|
ij_properties_key_value_delimiter = equals
|
||||||
ij_properties_spaces_around_key_value_delimiter = false
|
ij_properties_spaces_around_key_value_delimiter = false
|
||||||
|
|
||||||
[{*.yaml, *.yml}]
|
[{*.yml, *.yaml}]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
ij_visual_guides = none
|
ij_visual_guides = none
|
||||||
ij_yaml_align_values_properties = do_not_align
|
ij_yaml_align_values_properties = do_not_align
|
||||||
ij_yaml_autoinsert_sequence_marker = true
|
ij_yaml_autoinsert_sequence_marker = true
|
||||||
ij_yaml_block_mapping_on_new_line = false
|
ij_yaml_block_mapping_on_new_line = false
|
||||||
ij_yaml_indent_sequence_value = true
|
ij_yaml_indent_sequence_value = true
|
||||||
ij_yaml_keep_indents_on_empty_lines = true
|
ij_yaml_keep_indents_on_empty_lines = false
|
||||||
ij_yaml_keep_line_breaks = true
|
ij_yaml_keep_line_breaks = true
|
||||||
ij_yaml_sequence_on_new_line = false
|
ij_yaml_sequence_on_new_line = false
|
||||||
ij_yaml_space_before_colon = false
|
ij_yaml_space_before_colon = false
|
||||||
|
|||||||
2
.github/ISSUE_TEMPLATE/BUG_REPORT.md
vendored
2
.github/ISSUE_TEMPLATE/BUG_REPORT.md
vendored
@@ -52,7 +52,7 @@ assignees: ""
|
|||||||
<!-- You can fill out the different items by putting the correct value beside each cell. -->
|
<!-- You can fill out the different items by putting the correct value beside each cell. -->
|
||||||
|
|
||||||
| Name | Value |
|
| Name | Value |
|
||||||
|------------------------------|-------|
|
|------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| Terra Version | <!-- Put your Terra version here. (remove the comment) -->
|
| Terra Version | <!-- Put your Terra version here. (remove the comment) -->
|
||||||
| Platform / Platform Version | <!-- Put your platform and platform version here. (remove the comment) (eg. Spigot, Fabric, Paper, etc.) (If you are using the Region generator, put that here instead) -->
|
| Platform / Platform Version | <!-- Put your platform and platform version here. (remove the comment) (eg. Spigot, Fabric, Paper, etc.) (If you are using the Region generator, put that here instead) -->
|
||||||
| Any External Plugins or Mods | <!-- Put a list of all the plugins or mods you have installed here. (remove the comment) (Make sure to NOT include any new lines) -->
|
| Any External Plugins or Mods | <!-- Put a list of all the plugins or mods you have installed here. (remove the comment) (Make sure to NOT include any new lines) -->
|
||||||
|
|||||||
146
.github/PULL_REQUEST_TEMPLATE.md
vendored
146
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,58 +1,19 @@
|
|||||||
# Pull Request
|
# Pull Request
|
||||||
|
|
||||||
## Brief description.
|
## Description
|
||||||
|
|
||||||
<!-- Please provide a brief description of the goals of your PR -->
|
<!-- Include a description of the PR here -->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
###########################################################################
|
If applicable, include 'Fixes #XXXX' or 'Closes #XXXX' for any related open issues.
|
||||||
## WARNING! ##
|
This helps us relate, track, and close the relevant issues.
|
||||||
## IGNORING THE FOLLOWING TEMPLATE WILL RESULT IN YOUR PR BEING CLOSED ##
|
|
||||||
###########################################################################
|
|
||||||
-->
|
|
||||||
<!--
|
|
||||||
Please go through this checklist item by item and make sure you have successfully completed each of these steps.
|
|
||||||
- Your pull request MUST be either on the latest version of Terra, or on a branch for a future release.
|
|
||||||
- Make sure that there are no already existing PRs that fix this. If so, it will be closed as a duplicate.
|
|
||||||
- Make sure that this change is actually within the scope of Terra and is something a terrain generator should be doing.
|
|
||||||
- Make sure that this is not an issue with a specific Terra *pack*, and instead applies to all of Terra.
|
|
||||||
- Make sure that you have filled out all the required information and given descriptions of everything.
|
|
||||||
-->
|
|
||||||
<!-- You can erase any parts of this template not applicable to your Pull Request. -->
|
|
||||||
|
|
||||||
### What Issues Does This Fix?
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Put Fix #XXXX or Closes #XXXX here if there are any open issues that this PR fixes.
|
|
||||||
This is to automatically close the relevant issues.
|
|
||||||
You may remove this if there is no issue for this PR.
|
|
||||||
But unless this is a very small change, you should make an issue for it.
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
## Licensing
|
### Changelog
|
||||||
|
|
||||||
<!-- In order to be accepted, your changes must be under the GPLv3 license. Please check one of the following: -->
|
|
||||||
|
|
||||||
- [ ] I am the original author of this code, and I am willing to release it
|
|
||||||
under [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html).
|
|
||||||
- [ ] I am not the original author of this code, but it is in public domain or
|
|
||||||
released under [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html) or a
|
|
||||||
compatible license.
|
|
||||||
<!--
|
|
||||||
Please provide reliable evidence of this.
|
|
||||||
NOTE: for compatible licenses, you must make sure to add the included license somewhere in the program, if so required.
|
|
||||||
(And even if it's not required, it's still nice to do it. Also add attribution somewhere.)
|
|
||||||
-->
|
|
||||||
|
|
||||||
## Goal of the PR
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
What is the goal of the PR?
|
Fill out a changelog below of what has been done, and what might be planned to be done.
|
||||||
Put a checklist here of what has been done
|
You may delete this if your PR is not adding new features, only fixing bugs or adding translations.
|
||||||
(and what *hasn't*, but you plan to do),
|
|
||||||
so we can easily know what was changed.
|
|
||||||
Note: this is only required for PRs that add new features.
|
|
||||||
If your PR is not adding new features, only fixing bugs or adding translations, then you may delete this section.
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
- [ ] <!-- First thing -->
|
- [ ] <!-- First thing -->
|
||||||
@@ -61,47 +22,58 @@
|
|||||||
- [ ] <!-- Second thing -->
|
- [ ] <!-- Second thing -->
|
||||||
- [ ] <!-- etc. -->
|
- [ ] <!-- etc. -->
|
||||||
|
|
||||||
## Affects of the PR
|
## Checklist
|
||||||
|
|
||||||
<!---
|
<!--
|
||||||
What types of changes does your code introduce? (Select any that apply. You may select multiple.)
|
Select the options below that apply.
|
||||||
You must put an x in all the boxes that it applies to. (Like this: [x])
|
You must put an x in all the boxes that it applies to. (Like this: [x])
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
#### Mandatory checks
|
||||||
|
|
||||||
|
- [ ] The base branch of this PR is an unreleased version branch (that has a `ver/` prefix)
|
||||||
|
or is a branch that is intended to be merged into a version branch.
|
||||||
|
<!--
|
||||||
|
This is not applicable if the PR is a version branch itself.
|
||||||
|
PRs for new versions should use the `master` branch instead.
|
||||||
|
-->
|
||||||
|
- [ ] There are no already existing PRs that provide the same changes.
|
||||||
|
<!-- If this is not applicable, the PR will be removed as a duplicate. -->
|
||||||
|
- [ ] The PR is within the scope of Terra (i.e. is something a configurable terrain generator should be doing).
|
||||||
|
- [ ] Changes follow the code style for this project.
|
||||||
|
<!-- There is an included `.editorconfig` file in the base of the repo. Please use a plugin for your IDE of choice that follows those settings. -->
|
||||||
|
- [ ] I have read the [`CONTRIBUTING.md`](https://github.com/PolyhedralDev/Terra/blob/master/CONTRIBUTING.md)
|
||||||
|
document in the root of the git repository.
|
||||||
|
|
||||||
#### Types of changes
|
#### Types of changes
|
||||||
|
|
||||||
- [ ] Bug Fix <!-- Anything which fixes an issue in Terra. -->
|
- [ ] Bug Fix <!-- Changes include bug fixes. -->
|
||||||
- [ ] Build system <!-- Anything which pretain to the build system. -->
|
- [ ] Build system <!-- Changes the build system. -->
|
||||||
- [ ] Documentation <!-- Anything which adds or improves documentation for existing features. -->
|
- [ ] Documentation <!-- Changes add to or improve documentation. -->
|
||||||
- [ ] New Feature <!-- Anything which adds new functionality to Terra. -->
|
- [ ] New Feature <!-- Changes add new functionality to Terra. -->
|
||||||
- [ ] Performance <!-- Anything which is imrpoves the performance of Terra. -->
|
- [ ] Performance <!-- Changes improve the performance of Terra. -->
|
||||||
- [ ] Refactoring <!-- Anything which does not add any new code, only moves code around. -->
|
- [ ] Refactoring <!-- Changes do not add any new code, only moves code around. -->
|
||||||
- [ ] Repository <!-- Anything which affects the repository. Eg. changes to the `README.md` file. -->
|
- [ ] Repository <!-- Changes affect the repository. E.g. changes to the `README.md` file. -->
|
||||||
- [ ] Revert <!-- Anything which reverts previous commits. -->
|
- [ ] Revert <!-- Changes revert previous commits. -->
|
||||||
- [ ] Style <!-- Anything which updates style. -->
|
- [ ] Style <!-- Changes update style, namely the .editorconfig file. -->
|
||||||
- [ ] Tests <!-- Anything which adds or updates tests. -->
|
- [ ] Tests <!-- Changes add or update tests. -->
|
||||||
- [ ] Translation <!-- Anything which is internationalizing the Terra program to other languages. -->
|
- [ ] Translation <!-- Changes include translations to other languages for Terra. -->
|
||||||
|
|
||||||
#### Compatiblity
|
#### Compatibility
|
||||||
|
|
||||||
- [ ] Breaking
|
<!-- The following options determine if the PR pertains to a major, minor, or patch version bump -->
|
||||||
change <!-- A fix, or a feature, that breaks some previous functionality to Terra. -->
|
|
||||||
- [ ] Non-Breaking change.
|
- [ ] Introduces a breaking change
|
||||||
<!--
|
<!--
|
||||||
A change which does not break *any* previous functionality of Terra.
|
Breaking changes are any fix or feature that breaks some previous functionality to Terra / is not backwards compatible.
|
||||||
(ie. is backwards compatible and will work with *any* previously existing supported features.
|
Breaking changes do not include:
|
||||||
Note: if a feature is annotated with @Incubating, @Preview, @Experimental,
|
- changes that are backwards compatible and will work with *any* previously existing supported features.
|
||||||
or is in a package called something similar to the previous annotations,
|
- changes to code marked as in a pre-release
|
||||||
then you may push breaking changes to only THOSE parts of Terra.)
|
state (annotated with @Incubating, @Preview, @Experimental
|
||||||
|
or in a package called something similar to the previous annotations)
|
||||||
-->
|
-->
|
||||||
|
- [ ] Introduces new functionality in a backwards compatible way.
|
||||||
#### Contribution Guidelines.
|
- [ ] Introduces bug fixes
|
||||||
|
|
||||||
- [ ] I have read
|
|
||||||
the [`CONTRIBUTING.md`](https://github.com/PolyhedralDev/Terra/blob/master/CONTRIBUTING.md)
|
|
||||||
document in the root of the git repository.
|
|
||||||
- [ ] My code follows the code style for this
|
|
||||||
project. <!-- There is an included `.editorconfig` file in the base of the repo. Please use a plugin for your IDE of choice that follows those settings. -->
|
|
||||||
|
|
||||||
#### Documentation
|
#### Documentation
|
||||||
|
|
||||||
@@ -113,6 +85,20 @@
|
|||||||
- [ ] I have added tests to cover my changes.
|
- [ ] I have added tests to cover my changes.
|
||||||
- [ ] All new and existing tests passed.
|
- [ ] All new and existing tests passed.
|
||||||
<!--
|
<!--
|
||||||
If it only introduces small changes, you don't need to add tests.
|
Tests are typically not necessary for small changes.
|
||||||
But if you add big changes, you should probably at least write *some* testing, where applicable.
|
Including *some* testing is recommended for large changes where applicable.
|
||||||
|
-->
|
||||||
|
|
||||||
|
#### Licensing
|
||||||
|
|
||||||
|
<!-- In order to be accepted, your changes must be under the GPLv3 license. Please check one of the following: -->
|
||||||
|
|
||||||
|
- [ ] I am the original author of this code, and I am willing to
|
||||||
|
release it under [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html).
|
||||||
|
- [ ] I am not the original author of this code, but it is in public domain or
|
||||||
|
released under [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html) or a compatible license.
|
||||||
|
<!--
|
||||||
|
Please provide reliable evidence of this.
|
||||||
|
NOTE: for compatible licenses, you must make sure to add the included license somewhere in the program, if so required.
|
||||||
|
(And even if it's not required, it's still nice to do it. Also add attribution somewhere.)
|
||||||
-->
|
-->
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020-2021 Polyhedral Development
|
Copyright (c) 2020-2023 Polyhedral Development
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -47,14 +47,7 @@ JARs are produced in `platforms/<platform>/build/libs`.
|
|||||||
To run Minecraft with Terra in the IDE (for testing) use the following tasks:
|
To run Minecraft with Terra in the IDE (for testing) use the following tasks:
|
||||||
|
|
||||||
* Bukkit
|
* Bukkit
|
||||||
* `installPaper` - Install a [Paper](https://github.com/PaperMC/Paper) test
|
* `runServer` - Run the Paper test server with Terra installed.
|
||||||
server. (Only needs to be run once).
|
|
||||||
* `installPurpur` - Install a [Purpur](https://github.com/pl3xgaming/Purpur)
|
|
||||||
test server. (Only needs to be run once).
|
|
||||||
* `runPaper` - Run the Paper test server with Terra (`installPaper` must
|
|
||||||
have been run previously).
|
|
||||||
* `runPurpur` - Run the Purpur test server with Terra (`installPurpur` must
|
|
||||||
have been run previously).
|
|
||||||
* Fabric
|
* Fabric
|
||||||
* `runClient` - Run a Minecraft Fabric client with Terra installed.
|
* `runClient` - Run a Minecraft Fabric client with Terra installed.
|
||||||
* `runServer` - Run a Minecraft Fabric server with Terra installed.
|
* `runServer` - Run a Minecraft Fabric server with Terra installed.
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
preRelease(true)
|
preRelease(true)
|
||||||
|
|
||||||
versionProjects(":common:api", version("6.3.1"))
|
versionProjects(":common:api", version("6.4.0"))
|
||||||
versionProjects(":common:implementation", version("6.3.1"))
|
versionProjects(":common:implementation", version("6.4.0"))
|
||||||
versionProjects(":platforms", version("6.3.1"))
|
versionProjects(":platforms", version("6.4.0"))
|
||||||
|
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
|||||||
@@ -3,15 +3,6 @@ plugins {
|
|||||||
kotlin("jvm") version embeddedKotlinVersion
|
kotlin("jvm") version embeddedKotlinVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
|
||||||
configurations.all {
|
|
||||||
resolutionStrategy {
|
|
||||||
force("org.ow2.asm:asm:9.3") // TODO: remove when ShadowJar updates ASM version
|
|
||||||
force("org.ow2.asm:asm-commons:9.3")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
@@ -24,11 +15,12 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("gradle.plugin.com.github.jengelman.gradle.plugins:shadow:+")
|
//TODO Allow pulling from Versions.kt
|
||||||
implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.3.5")
|
implementation("com.github.johnrengelman", "shadow", "8.1.1")
|
||||||
|
implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "1.5.6")
|
||||||
|
|
||||||
implementation("org.ow2.asm:asm:9.3")
|
implementation("org.ow2.asm", "asm", "9.5")
|
||||||
implementation("org.ow2.asm:asm-tree:9.3")
|
implementation("org.ow2.asm", "asm-tree", "9.5")
|
||||||
implementation("com.dfsek.tectonic:common:4.2.0")
|
implementation("com.dfsek.tectonic", "common", "4.2.0")
|
||||||
implementation("org.yaml:snakeyaml:1.27")
|
implementation("org.yaml", "snakeyaml", "2.2")
|
||||||
}
|
}
|
||||||
@@ -48,6 +48,9 @@ fun Project.configureDependencies() {
|
|||||||
maven("https://jitpack.io") {
|
maven("https://jitpack.io") {
|
||||||
name = "JitPack"
|
name = "JitPack"
|
||||||
}
|
}
|
||||||
|
maven("https://nexuslite.gcnt.net/repos/other/") {
|
||||||
|
name = "GCNT"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
@@ -3,13 +3,11 @@ import java.io.File
|
|||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
import java.nio.file.FileSystemNotFoundException
|
||||||
import java.nio.file.FileSystems
|
import java.nio.file.FileSystems
|
||||||
import java.nio.file.Files
|
|
||||||
import java.nio.file.StandardCopyOption
|
|
||||||
import org.gradle.api.DefaultTask
|
import org.gradle.api.DefaultTask
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.plugins.BasePluginExtension
|
import org.gradle.api.plugins.BasePluginExtension
|
||||||
import org.gradle.kotlin.dsl.TaskContainerScope
|
|
||||||
import org.gradle.kotlin.dsl.apply
|
import org.gradle.kotlin.dsl.apply
|
||||||
import org.gradle.kotlin.dsl.configure
|
import org.gradle.kotlin.dsl.configure
|
||||||
import org.gradle.kotlin.dsl.extra
|
import org.gradle.kotlin.dsl.extra
|
||||||
@@ -17,6 +15,10 @@ import org.gradle.kotlin.dsl.get
|
|||||||
import org.gradle.kotlin.dsl.named
|
import org.gradle.kotlin.dsl.named
|
||||||
import org.yaml.snakeyaml.DumperOptions
|
import org.yaml.snakeyaml.DumperOptions
|
||||||
import org.yaml.snakeyaml.Yaml
|
import org.yaml.snakeyaml.Yaml
|
||||||
|
import kotlin.io.path.copyTo
|
||||||
|
import kotlin.io.path.createDirectories
|
||||||
|
import kotlin.io.path.createFile
|
||||||
|
import kotlin.io.path.exists
|
||||||
|
|
||||||
|
|
||||||
fun Project.configureDistribution() {
|
fun Project.configureDistribution() {
|
||||||
@@ -47,19 +49,28 @@ fun Project.configureDistribution() {
|
|||||||
// https://github.com/johnrengelman/shadow/issues/111
|
// https://github.com/johnrengelman/shadow/issues/111
|
||||||
val dest = URI.create("jar:" + tasks.named<ShadowJar>("shadowJar").get().archiveFile.get().asFile.toURI())
|
val dest = URI.create("jar:" + tasks.named<ShadowJar>("shadowJar").get().archiveFile.get().asFile.toURI())
|
||||||
|
|
||||||
FileSystems.newFileSystem(dest, mapOf("create" to "false"), null).use { fs ->
|
val provider = try {
|
||||||
|
FileSystems.getFileSystem(dest)
|
||||||
|
} catch (e: FileSystemNotFoundException) {
|
||||||
|
null
|
||||||
|
} ?: FileSystems.newFileSystem(dest, mapOf("create" to "false"), null)
|
||||||
|
provider?.use { fs ->
|
||||||
forSubProjects(":common:addons") {
|
forSubProjects(":common:addons") {
|
||||||
|
if (fs.isOpen) {
|
||||||
val jar = getJarTask()
|
val jar = getJarTask()
|
||||||
|
|
||||||
|
if (jar.archiveFile.get().asFile.exists()) {
|
||||||
println("Packaging addon ${jar.archiveFileName.get()} to $dest. size: ${jar.archiveFile.get().asFile.length() / 1024}KB")
|
println("Packaging addon ${jar.archiveFileName.get()} to $dest. size: ${jar.archiveFile.get().asFile.length() / 1024}KB")
|
||||||
|
|
||||||
val boot = if (extra.has("bootstrap") && extra.get("bootstrap") as Boolean) "bootstrap/" else ""
|
val boot = if (extra.has("bootstrap") && extra.get("bootstrap") as Boolean) "bootstrap/" else ""
|
||||||
val addonPath = fs.getPath("/addons/$boot${jar.archiveFileName.get()}")
|
val addonPath = fs.getPath("/addons/$boot${jar.archiveFileName.get()}")
|
||||||
|
|
||||||
if (!Files.exists(addonPath)) {
|
if (!addonPath.exists()) {
|
||||||
Files.createDirectories(addonPath.parent)
|
addonPath.parent.createDirectories()
|
||||||
Files.createFile(addonPath)
|
addonPath.createFile()
|
||||||
Files.copy(jar.archiveFile.get().asFile.toPath(), addonPath, StandardCopyOption.REPLACE_EXISTING)
|
jar.archiveFile.get().asFile.toPath().copyTo(addonPath, overwrite = true)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -89,7 +100,8 @@ fun Project.configureDistribution() {
|
|||||||
val jar = getJarTask().archiveFileName.get()
|
val jar = getJarTask().archiveFileName.get()
|
||||||
resources.computeIfAbsent(
|
resources.computeIfAbsent(
|
||||||
if (extra.has("bootstrap") && extra.get("bootstrap") as Boolean) "addons/bootstrap"
|
if (extra.has("bootstrap") && extra.get("bootstrap") as Boolean) "addons/bootstrap"
|
||||||
else "addons") { ArrayList() }.add(jar)
|
else "addons"
|
||||||
|
) { ArrayList() }.add(jar)
|
||||||
}
|
}
|
||||||
|
|
||||||
val options = DumperOptions()
|
val options = DumperOptions()
|
||||||
@@ -126,7 +138,7 @@ fun Project.configureDistribution() {
|
|||||||
dependsOn(downloadDefaultPacks)
|
dependsOn(downloadDefaultPacks)
|
||||||
configurations = listOf(project.configurations["shaded"])
|
configurations = listOf(project.configurations["shaded"])
|
||||||
archiveClassifier.set("shaded")
|
archiveClassifier.set("shaded")
|
||||||
setVersion(project.version)
|
version = project.version
|
||||||
relocate("org.apache.commons", "com.dfsek.terra.lib.commons")
|
relocate("org.apache.commons", "com.dfsek.terra.lib.commons")
|
||||||
relocate("org.objectweb.asm", "com.dfsek.terra.lib.asm")
|
relocate("org.objectweb.asm", "com.dfsek.terra.lib.asm")
|
||||||
relocate("com.dfsek.paralithic", "com.dfsek.terra.lib.paralithic")
|
relocate("com.dfsek.paralithic", "com.dfsek.terra.lib.paralithic")
|
||||||
|
|||||||
@@ -1,68 +1,71 @@
|
|||||||
object Versions {
|
object Versions {
|
||||||
object Libraries {
|
object Libraries {
|
||||||
const val tectonic = "4.2.0"
|
const val tectonic = "4.2.1"
|
||||||
const val paralithic = "0.7.0"
|
const val paralithic = "0.7.1"
|
||||||
const val strata = "1.1.1"
|
const val strata = "1.3.2"
|
||||||
|
|
||||||
const val cloud = "1.8.0"
|
const val cloud = "1.8.4"
|
||||||
|
|
||||||
const val slf4j = "1.7.36"
|
const val slf4j = "2.0.9"
|
||||||
const val log4j_slf4j_impl = "2.14.1"
|
const val log4j_slf4j_impl = "2.20.0"
|
||||||
|
|
||||||
object Internal {
|
object Internal {
|
||||||
const val apacheText = "1.9"
|
const val shadow = "8.1.1"
|
||||||
const val jafama = "2.3.2"
|
const val apacheText = "1.10.0"
|
||||||
const val apacheIO = "2.6"
|
const val apacheIO = "2.14.0"
|
||||||
const val fastutil = "8.5.6"
|
const val guava = "32.1.3-jre"
|
||||||
|
const val asm = "9.5"
|
||||||
|
const val snakeYml = "2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object Fabric {
|
object Fabric {
|
||||||
const val fabricLoader = "0.14.8"
|
const val fabricAPI = "0.90.0+${Mod.minecraft}"
|
||||||
const val fabricAPI = "0.83.1+1.20.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
object Quilt {
|
|
||||||
const val quiltLoader = "0.17.0"
|
|
||||||
const val fabricApi = "6.0.0-beta.3+0.76.0-1.19.4"
|
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// object Quilt {
|
||||||
|
// const val quiltLoader = "0.20.2"
|
||||||
|
// const val fabricApi = "7.3.1+0.89.3-1.20.1"
|
||||||
|
// }
|
||||||
|
|
||||||
object Mod {
|
object Mod {
|
||||||
const val mixin = "0.11.2+mixin.0.8.5"
|
const val mixin = "0.12.5+mixin.0.8.5"
|
||||||
|
|
||||||
const val minecraft = "1.20.1"
|
const val minecraft = "1.20.2"
|
||||||
const val yarn = "$minecraft+build.2"
|
const val yarn = "$minecraft+build.4"
|
||||||
const val fabricLoader = "0.14.21"
|
const val fabricLoader = "0.14.23"
|
||||||
|
|
||||||
const val architecuryLoom = "0.12.0.290"
|
const val architecuryLoom = "1.3.357"
|
||||||
const val architecturyPlugin = "3.4-SNAPSHOT"
|
const val architecturyPlugin = "3.4.146"
|
||||||
|
|
||||||
const val loomQuiltflower = "1.7.1"
|
const val loomVineflower = "1.11.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
object Forge {
|
object Forge {
|
||||||
const val forge = "${Mod.minecraft}-47.0.3"
|
const val forge = "${Mod.minecraft}-48.0.13"
|
||||||
const val burningwave = "12.53.0"
|
const val burningwave = "12.63.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
object Bukkit {
|
object Bukkit {
|
||||||
const val paper = "1.18.2-R0.1-SNAPSHOT"
|
const val paper = "1.18.2-R0.1-SNAPSHOT"
|
||||||
const val paperLib = "1.0.5"
|
const val paperLib = "1.0.5"
|
||||||
const val minecraft = "1.20.1"
|
const val foliaLib = "0.2.5"
|
||||||
|
const val minecraft = "1.20.2"
|
||||||
const val reflectionRemapper = "0.1.0-SNAPSHOT"
|
const val reflectionRemapper = "0.1.0-SNAPSHOT"
|
||||||
const val paperDevBundle = "1.20.1-R0.1-SNAPSHOT"
|
const val paperDevBundle = "1.20.2-R0.1-SNAPSHOT"
|
||||||
}
|
const val runPaper = "2.2.0"
|
||||||
|
const val paperWeight = "1.5.6"
|
||||||
object Sponge {
|
|
||||||
const val sponge = "9.0.0-SNAPSHOT"
|
|
||||||
const val mixin = "0.8.2"
|
|
||||||
const val minecraft = "1.17.1"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// object Sponge {
|
||||||
|
// const val sponge = "9.0.0-SNAPSHOT"
|
||||||
|
// const val mixin = "0.8.2"
|
||||||
|
// const val minecraft = "1.17.1"
|
||||||
|
// }
|
||||||
|
//
|
||||||
object CLI {
|
object CLI {
|
||||||
const val nbt = "6.1"
|
const val nbt = "6.1"
|
||||||
const val logback = "1.2.9"
|
const val logback = "1.4.11"
|
||||||
const val commonsIO = "2.7"
|
|
||||||
const val guava = "31.0.1-jre"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020-2021 Polyhedral Development
|
Copyright (c) 2020-2023 Polyhedral Development
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
package com.dfsek.terra.addons.biome.extrusion.extrusions;
|
package com.dfsek.terra.addons.biome.extrusion.extrusions;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.function.Predicate;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import com.dfsek.terra.addons.biome.extrusion.api.Extrusion;
|
import com.dfsek.terra.addons.biome.extrusion.api.Extrusion;
|
||||||
import com.dfsek.terra.addons.biome.extrusion.api.ReplaceableBiome;
|
import com.dfsek.terra.addons.biome.extrusion.api.ReplaceableBiome;
|
||||||
import com.dfsek.terra.addons.biome.query.api.BiomeQueries;
|
import com.dfsek.terra.addons.biome.query.api.BiomeQueries;
|
||||||
@@ -12,6 +8,10 @@ import com.dfsek.terra.api.util.Range;
|
|||||||
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||||
import com.dfsek.terra.api.world.biome.Biome;
|
import com.dfsek.terra.api.world.biome.Biome;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets biomes at locations based on a sampler.
|
* Sets biomes at locations based on a sampler.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020-2021 Polyhedral Development
|
Copyright (c) 2020-2023 Polyhedral Development
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
version = version("1.0.0")
|
version = version("1.0.1")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||||
compileOnlyApi(project(":common:addons:library-image"))
|
compileOnlyApi(project(":common:addons:library-image"))
|
||||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
|
||||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
|
||||||
relocate("net.jafama", "com.dfsek.terra.addons.biome.image.lib.jafama")
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.biome.image.v2;
|
package com.dfsek.terra.addons.biome.image.v2;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import com.dfsek.terra.addons.image.converter.ColorConverter;
|
|
||||||
import com.dfsek.terra.addons.image.colorsampler.ColorSampler;
|
import com.dfsek.terra.addons.image.colorsampler.ColorSampler;
|
||||||
|
import com.dfsek.terra.addons.image.converter.ColorConverter;
|
||||||
import com.dfsek.terra.api.world.biome.Biome;
|
import com.dfsek.terra.api.world.biome.Biome;
|
||||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
public class ImageBiomeProvider implements BiomeProvider {
|
public class ImageBiomeProvider implements BiomeProvider {
|
||||||
private final int resolution;
|
private final int resolution;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -58,15 +58,19 @@ public class ImageBiomeProviderAddon implements AddonInitializer {
|
|||||||
providerRegistry.register(addon.key("IMAGE"), ImageProviderTemplate::new);
|
providerRegistry.register(addon.key("IMAGE"), ImageProviderTemplate::new);
|
||||||
})
|
})
|
||||||
.then(event -> {
|
.then(event -> {
|
||||||
CheckedRegistry<Supplier<ObjectTemplate<ColorConverter<Biome>>>> biomeColorConverterRegistry = event.getPack().getOrCreateRegistry(
|
CheckedRegistry<Supplier<ObjectTemplate<ColorConverter<Biome>>>> biomeColorConverterRegistry =
|
||||||
|
event.getPack().getOrCreateRegistry(
|
||||||
BIOME_COLOR_CONVERTER_REGISTRY_KEY);
|
BIOME_COLOR_CONVERTER_REGISTRY_KEY);
|
||||||
biomeColorConverterRegistry.register(addon.key("EXACT"), ExactBiomeColorConverterTemplate::new);
|
biomeColorConverterRegistry.register(addon.key("EXACT"), ExactBiomeColorConverterTemplate::new);
|
||||||
biomeColorConverterRegistry.register(addon.key("CLOSEST"), ClosestBiomeColorConverterTemplate::new);
|
biomeColorConverterRegistry.register(addon.key("CLOSEST"), ClosestBiomeColorConverterTemplate::new);
|
||||||
})
|
})
|
||||||
.then(event -> {
|
.then(event -> {
|
||||||
CheckedRegistry<Supplier<ObjectTemplate<ColorMapping<Biome>>>> biomeColorMappingRegistry = event.getPack().getOrCreateRegistry(
|
CheckedRegistry<Supplier<ObjectTemplate<ColorMapping<Biome>>>> biomeColorMappingRegistry =
|
||||||
|
event.getPack().getOrCreateRegistry(
|
||||||
BIOME_COLOR_MAPPING_REGISTRY_KEY);
|
BIOME_COLOR_MAPPING_REGISTRY_KEY);
|
||||||
biomeColorMappingRegistry.register(addon.key("USE_BIOME_COLORS"), () -> () -> new BiomeDefinedColorMapping<>(event.getPack().getRegistry(Biome.class), b -> b));
|
biomeColorMappingRegistry.register(addon.key("USE_BIOME_COLORS"),
|
||||||
|
() -> () -> new BiomeDefinedColorMapping<>(event.getPack().getRegistry(Biome.class),
|
||||||
|
b -> b));
|
||||||
biomeColorMappingRegistry.register(addon.key("MAP"), DefinedBiomeColorMappingTemplate::new);
|
biomeColorMappingRegistry.register(addon.key("MAP"), DefinedBiomeColorMappingTemplate::new);
|
||||||
})
|
})
|
||||||
.failThrough();
|
.failThrough();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -13,8 +13,8 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
|
|||||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.biome.image.v2.ImageBiomeProvider;
|
import com.dfsek.terra.addons.biome.image.v2.ImageBiomeProvider;
|
||||||
import com.dfsek.terra.addons.image.converter.ColorConverter;
|
|
||||||
import com.dfsek.terra.addons.image.colorsampler.ColorSampler;
|
import com.dfsek.terra.addons.image.colorsampler.ColorSampler;
|
||||||
|
import com.dfsek.terra.addons.image.converter.ColorConverter;
|
||||||
import com.dfsek.terra.api.world.biome.Biome;
|
import com.dfsek.terra.api.world.biome.Biome;
|
||||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020-2021 Polyhedral Development
|
Copyright (c) 2020-2023 Polyhedral Development
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
version = version("1.0.0")
|
version = version("1.0.1")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
|
||||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
|
||||||
relocate("net.jafama", "com.dfsek.terra.addons.biome.image.lib.jafama")
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.biome.image;
|
package com.dfsek.terra.addons.biome.image;
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -34,7 +32,7 @@ public class ImageBiomeProvider implements BiomeProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static int distance(Color a, Color b) {
|
private static int distance(Color a, Color b) {
|
||||||
return FastMath.abs(a.getRed() - b.getRed()) + FastMath.abs(a.getGreen() - b.getGreen()) + FastMath.abs(a.getBlue() - b.getBlue());
|
return Math.abs(a.getRed() - b.getRed()) + Math.abs(a.getGreen() - b.getGreen()) + Math.abs(a.getBlue() - b.getBlue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -70,14 +68,14 @@ public class ImageBiomeProvider implements BiomeProvider {
|
|||||||
CENTER {
|
CENTER {
|
||||||
@Override
|
@Override
|
||||||
public Color getColor(BufferedImage image, int x, int z) {
|
public Color getColor(BufferedImage image, int x, int z) {
|
||||||
return new Color(image.getRGB(FastMath.floorMod(x - image.getWidth() / 2, image.getWidth()),
|
return new Color(image.getRGB(Math.floorMod(x - image.getWidth() / 2, image.getWidth()),
|
||||||
FastMath.floorMod(z - image.getHeight() / 2, image.getHeight())));
|
Math.floorMod(z - image.getHeight() / 2, image.getHeight())));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
NONE {
|
NONE {
|
||||||
@Override
|
@Override
|
||||||
public Color getColor(BufferedImage image, int x, int z) {
|
public Color getColor(BufferedImage image, int x, int z) {
|
||||||
return new Color(image.getRGB(FastMath.floorMod(x, image.getWidth()), FastMath.floorMod(z, image.getHeight())));
|
return new Color(image.getRGB(Math.floorMod(x, image.getWidth()), Math.floorMod(z, image.getHeight())));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -27,11 +27,9 @@ import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
|||||||
|
|
||||||
public class ImageBiomeProviderAddon implements AddonInitializer {
|
public class ImageBiomeProviderAddon implements AddonInitializer {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ImageBiomeProviderAddon.class);
|
|
||||||
|
|
||||||
public static final TypeKey<Supplier<ObjectTemplate<BiomeProvider>>> PROVIDER_REGISTRY_KEY = new TypeKey<>() {
|
public static final TypeKey<Supplier<ObjectTemplate<BiomeProvider>>> PROVIDER_REGISTRY_KEY = new TypeKey<>() {
|
||||||
};
|
};
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ImageBiomeProviderAddon.class);
|
||||||
@Inject
|
@Inject
|
||||||
private Platform platform;
|
private Platform platform;
|
||||||
|
|
||||||
@@ -50,6 +48,9 @@ public class ImageBiomeProviderAddon implements AddonInitializer {
|
|||||||
() -> new ImageProviderTemplate(event.getPack().getRegistry(Biome.class)));
|
() -> new ImageProviderTemplate(event.getPack().getRegistry(Biome.class)));
|
||||||
})
|
})
|
||||||
.failThrough();
|
.failThrough();
|
||||||
logger.warn("The biome-provider-image addon is deprecated and scheduled for removal in Terra 7.0. It is recommended to use the biome-provider-image-v2 addon for future pack development instead.");
|
if(platform.getTerraConfig().isDebugLog())
|
||||||
|
logger.warn(
|
||||||
|
"The biome-provider-image addon is deprecated and scheduled for removal in Terra 7.0. It is recommended to use the " +
|
||||||
|
"biome-provider-image-v2 addon for future pack development instead.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020-2021 Polyhedral Development
|
Copyright (c) 2020-2023 Polyhedral Development
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
version = version("1.0.0")
|
version = version("1.0.1")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||||
|
|
||||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
|
||||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
|
||||||
relocate("net.jafama", "com.dfsek.terra.addons.biome.pipeline.lib.jafama")
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -11,6 +11,9 @@ import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
|||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.Source;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.config.BiomePipelineTemplate;
|
import com.dfsek.terra.addons.biome.pipeline.v2.config.BiomePipelineTemplate;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.config.PipelineBiomeLoader;
|
import com.dfsek.terra.addons.biome.pipeline.v2.config.PipelineBiomeLoader;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.config.source.SamplerSourceTemplate;
|
import com.dfsek.terra.addons.biome.pipeline.v2.config.source.SamplerSourceTemplate;
|
||||||
@@ -20,9 +23,6 @@ import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.mutator.BorderStage
|
|||||||
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.mutator.ReplaceListStageTemplate;
|
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.mutator.ReplaceListStageTemplate;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.mutator.ReplaceStageTemplate;
|
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.mutator.ReplaceStageTemplate;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.mutator.SmoothStageTemplate;
|
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.mutator.SmoothStageTemplate;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.Source;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
|
||||||
import com.dfsek.terra.addons.manifest.api.AddonInitializer;
|
import com.dfsek.terra.addons.manifest.api.AddonInitializer;
|
||||||
import com.dfsek.terra.api.Platform;
|
import com.dfsek.terra.api.Platform;
|
||||||
import com.dfsek.terra.api.addon.BaseAddon;
|
import com.dfsek.terra.api.addon.BaseAddon;
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
package com.dfsek.terra.addons.biome.pipeline.v2;
|
package com.dfsek.terra.addons.biome.pipeline.v2;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.BiomeChunk;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.Pipeline;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.SeededVector;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||||
import net.jafama.FastMath;
|
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -15,6 +9,11 @@ import java.util.Optional;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.StreamSupport;
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.BiomeChunk;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.Pipeline;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.SeededVector;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
||||||
import com.dfsek.terra.api.noise.NoiseSampler;
|
import com.dfsek.terra.api.noise.NoiseSampler;
|
||||||
import com.dfsek.terra.api.registry.key.StringIdentifiable;
|
import com.dfsek.terra.api.registry.key.StringIdentifiable;
|
||||||
import com.dfsek.terra.api.util.Column;
|
import com.dfsek.terra.api.util.Column;
|
||||||
@@ -61,7 +60,8 @@ public class PipelineBiomeProvider implements BiomeProvider {
|
|||||||
.append(delegate.getClass().getCanonicalName())
|
.append(delegate.getClass().getCanonicalName())
|
||||||
.append('\n'));
|
.append('\n'));
|
||||||
throw new IllegalArgumentException("Biome Pipeline leaks placeholder biome \"" + pipelineBiome.getID() +
|
throw new IllegalArgumentException("Biome Pipeline leaks placeholder biome \"" + pipelineBiome.getID() +
|
||||||
"\". Ensure there is a stage to guarantee replacement of the placeholder biome. Biomes: " +
|
"\". Ensure there is a stage to guarantee replacement of the placeholder biome. " +
|
||||||
|
"Biomes: " +
|
||||||
biomeList);
|
biomeList);
|
||||||
}
|
}
|
||||||
this.biomes.add(pipelineBiome.getBiome());
|
this.biomes.add(pipelineBiome.getBiome());
|
||||||
@@ -81,8 +81,8 @@ public class PipelineBiomeProvider implements BiomeProvider {
|
|||||||
x /= resolution;
|
x /= resolution;
|
||||||
z /= resolution;
|
z /= resolution;
|
||||||
|
|
||||||
int chunkX = FastMath.floorDiv(x, chunkSize);
|
int chunkX = Math.floorDiv(x, chunkSize);
|
||||||
int chunkZ = FastMath.floorDiv(z, chunkSize);
|
int chunkZ = Math.floorDiv(z, chunkSize);
|
||||||
|
|
||||||
int chunkWorldX = chunkX * chunkSize;
|
int chunkWorldX = chunkX * chunkSize;
|
||||||
int chunkWorldZ = chunkZ * chunkSize;
|
int chunkWorldZ = chunkZ * chunkSize;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.dfsek.terra.addons.biome.pipeline.v2.api;
|
package com.dfsek.terra.addons.biome.pipeline.v2.api;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.pipeline.BiomeChunkImpl.ViewPoint;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.pipeline.BiomeChunkImpl.ViewPoint;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.dfsek.terra.addons.biome.pipeline.v2.api;
|
package com.dfsek.terra.addons.biome.pipeline.v2.api;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.pipeline.BiomeChunkImpl.ViewPoint;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.pipeline.BiomeChunkImpl.ViewPoint;
|
||||||
|
|
||||||
|
|
||||||
public interface Stage {
|
public interface Stage {
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import com.dfsek.terra.api.world.biome.Biome;
|
|||||||
|
|
||||||
|
|
||||||
public interface PipelineBiome extends StringIdentifiable {
|
public interface PipelineBiome extends StringIdentifiable {
|
||||||
Biome getBiome();
|
|
||||||
|
|
||||||
static PipelineBiome placeholder(String id) {
|
static PipelineBiome placeholder(String id) {
|
||||||
return new PlaceholderPipelineBiome(id);
|
return new PlaceholderPipelineBiome(id);
|
||||||
}
|
}
|
||||||
@@ -21,6 +19,8 @@ public interface PipelineBiome extends StringIdentifiable {
|
|||||||
return SelfPipelineBiome.INSTANCE;
|
return SelfPipelineBiome.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Biome getBiome();
|
||||||
|
|
||||||
Set<String> getTags();
|
Set<String> getTags();
|
||||||
|
|
||||||
default boolean isPlaceholder() {
|
default boolean isPlaceholder() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -15,9 +15,9 @@ import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.PipelineBiomeProvider;
|
import com.dfsek.terra.addons.biome.pipeline.v2.PipelineBiomeProvider;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.pipeline.PipelineImpl;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.Source;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.Source;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.pipeline.PipelineImpl;
|
||||||
import com.dfsek.terra.api.config.meta.Meta;
|
import com.dfsek.terra.api.config.meta.Meta;
|
||||||
import com.dfsek.terra.api.noise.NoiseSampler;
|
import com.dfsek.terra.api.noise.NoiseSampler;
|
||||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||||
@@ -33,24 +33,20 @@ public class BiomePipelineTemplate implements ObjectTemplate<BiomeProvider> {
|
|||||||
Larger values are quadratically faster, but produce lower quality results.
|
Larger values are quadratically faster, but produce lower quality results.
|
||||||
For example, a value of 3 would sample every 3 blocks.""")
|
For example, a value of 3 would sample every 3 blocks.""")
|
||||||
protected @Meta int resolution = 1;
|
protected @Meta int resolution = 1;
|
||||||
|
|
||||||
@Value("pipeline.source")
|
|
||||||
@Description("The Biome Source to use for initial population of biomes.")
|
|
||||||
private @Meta Source source;
|
|
||||||
|
|
||||||
@Value("pipeline.stages")
|
|
||||||
@Description("A list of pipeline stages to apply to the result of #source")
|
|
||||||
private @Meta List<@Meta Stage> stages;
|
|
||||||
|
|
||||||
@Value("blend.sampler")
|
@Value("blend.sampler")
|
||||||
@Default
|
@Default
|
||||||
@Description("A sampler to use for blending the edges of biomes via domain warping.")
|
@Description("A sampler to use for blending the edges of biomes via domain warping.")
|
||||||
protected @Meta NoiseSampler blendSampler = NoiseSampler.zero();
|
protected @Meta NoiseSampler blendSampler = NoiseSampler.zero();
|
||||||
|
|
||||||
@Value("blend.amplitude")
|
@Value("blend.amplitude")
|
||||||
@Default
|
@Default
|
||||||
@Description("The amplitude at which to perform blending.")
|
@Description("The amplitude at which to perform blending.")
|
||||||
protected @Meta double blendAmplitude = 0d;
|
protected @Meta double blendAmplitude = 0d;
|
||||||
|
@Value("pipeline.source")
|
||||||
|
@Description("The Biome Source to use for initial population of biomes.")
|
||||||
|
private @Meta Source source;
|
||||||
|
@Value("pipeline.stages")
|
||||||
|
@Description("A list of pipeline stages to apply to the result of #source")
|
||||||
|
private @Meta List<@Meta Stage> stages;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeProvider get() {
|
public BiomeProvider get() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.biome.pipeline.v2.config.stage.expander;
|
package com.dfsek.terra.addons.biome.pipeline.v2.config.stage.expander;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.StageTemplate;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.Expander;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.Expander;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.StageTemplate;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.stage.expander.FractalExpander;
|
import com.dfsek.terra.addons.biome.pipeline.v2.stage.expander.FractalExpander;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -11,9 +11,9 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.StageTemplate;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.StageTemplate;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.stage.mutators.BorderListStage;
|
import com.dfsek.terra.addons.biome.pipeline.v2.stage.mutators.BorderListStage;
|
||||||
import com.dfsek.terra.api.config.meta.Meta;
|
import com.dfsek.terra.api.config.meta.Meta;
|
||||||
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -9,9 +9,9 @@ package com.dfsek.terra.addons.biome.pipeline.v2.config.stage.mutator;
|
|||||||
|
|
||||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.StageTemplate;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.StageTemplate;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.stage.mutators.BorderStage;
|
import com.dfsek.terra.addons.biome.pipeline.v2.stage.mutators.BorderStage;
|
||||||
import com.dfsek.terra.api.config.meta.Meta;
|
import com.dfsek.terra.api.config.meta.Meta;
|
||||||
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -11,9 +11,9 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.StageTemplate;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.StageTemplate;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.stage.mutators.ReplaceListStage;
|
import com.dfsek.terra.addons.biome.pipeline.v2.stage.mutators.ReplaceListStage;
|
||||||
import com.dfsek.terra.api.config.meta.Meta;
|
import com.dfsek.terra.api.config.meta.Meta;
|
||||||
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -9,9 +9,9 @@ package com.dfsek.terra.addons.biome.pipeline.v2.config.stage.mutator;
|
|||||||
|
|
||||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.StageTemplate;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.StageTemplate;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.stage.mutators.ReplaceStage;
|
import com.dfsek.terra.addons.biome.pipeline.v2.stage.mutators.ReplaceStage;
|
||||||
import com.dfsek.terra.api.config.meta.Meta;
|
import com.dfsek.terra.api.config.meta.Meta;
|
||||||
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.biome.pipeline.v2.config.stage.mutator;
|
package com.dfsek.terra.addons.biome.pipeline.v2.config.stage.mutator;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.StageTemplate;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.config.stage.StageTemplate;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.stage.mutators.SmoothStage;
|
import com.dfsek.terra.addons.biome.pipeline.v2.stage.mutators.SmoothStage;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,20 @@
|
|||||||
package com.dfsek.terra.addons.biome.pipeline.v2.pipeline;
|
package com.dfsek.terra.addons.biome.pipeline.v2.pipeline;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.BiomeChunk;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.BiomeChunk;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.Expander;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.Expander;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.SeededVector;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.SeededVector;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.Stage;
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
||||||
import net.jafama.FastMath;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
public class BiomeChunkImpl implements BiomeChunk {
|
public class BiomeChunkImpl implements BiomeChunk {
|
||||||
|
|
||||||
private PipelineBiome[][] biomes;
|
|
||||||
private final SeededVector worldOrigin;
|
private final SeededVector worldOrigin;
|
||||||
private final int chunkOriginArrayIndex;
|
private final int chunkOriginArrayIndex;
|
||||||
private final int worldCoordinateScale;
|
private final int worldCoordinateScale;
|
||||||
|
private PipelineBiome[][] biomes;
|
||||||
|
|
||||||
public BiomeChunkImpl(SeededVector worldOrigin, PipelineImpl pipeline) {
|
public BiomeChunkImpl(SeededVector worldOrigin, PipelineImpl pipeline) {
|
||||||
|
|
||||||
@@ -44,7 +43,8 @@ public class BiomeChunkImpl implements BiomeChunk {
|
|||||||
for(int gridZ = 0; gridZ < gridSize; gridZ++) {
|
for(int gridZ = 0; gridZ < gridSize; gridZ++) {
|
||||||
int xIndex = gridOrigin + gridX * gridInterval;
|
int xIndex = gridOrigin + gridX * gridInterval;
|
||||||
int zIndex = gridOrigin + gridZ * gridInterval;
|
int zIndex = gridOrigin + gridZ * gridInterval;
|
||||||
biomes[xIndex][zIndex] = pipeline.getSource().get(worldOrigin.seed(), xIndexToWorldCoordinate(xIndex), zIndexToWorldCoordinate(zIndex));
|
biomes[xIndex][zIndex] = pipeline.getSource().get(worldOrigin.seed(), xIndexToWorldCoordinate(xIndex),
|
||||||
|
zIndexToWorldCoordinate(zIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,21 +80,6 @@ public class BiomeChunkImpl implements BiomeChunk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PipelineBiome get(int xInChunk, int zInChunk) {
|
|
||||||
int xIndex = xInChunk + chunkOriginArrayIndex;
|
|
||||||
int zIndex = zInChunk + chunkOriginArrayIndex;
|
|
||||||
return biomes[xIndex][zIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
private int xIndexToWorldCoordinate(int xIndex) {
|
|
||||||
return (worldOrigin.x() + xIndex - chunkOriginArrayIndex) * worldCoordinateScale;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int zIndexToWorldCoordinate(int zIndex) {
|
|
||||||
return (worldOrigin.z() + zIndex - chunkOriginArrayIndex) * worldCoordinateScale;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static int initialSizeToArraySize(int expanderCount, int initialSize) {
|
protected static int initialSizeToArraySize(int expanderCount, int initialSize) {
|
||||||
int size = initialSize;
|
int size = initialSize;
|
||||||
for(int i = 0; i < expanderCount; i++) {
|
for(int i = 0; i < expanderCount; i++) {
|
||||||
@@ -111,15 +96,15 @@ public class BiomeChunkImpl implements BiomeChunk {
|
|||||||
// chunk samples points on the same overall grid.
|
// chunk samples points on the same overall grid.
|
||||||
// Without this, shared chunk borders (required because of adjacent cell reads) will not be identical
|
// Without this, shared chunk borders (required because of adjacent cell reads) will not be identical
|
||||||
// because points would be sampled on grids at different offsets, resulting in artifacts at borders.
|
// because points would be sampled on grids at different offsets, resulting in artifacts at borders.
|
||||||
return FastMath.ceilToInt((double) finalGridOrigin / initialGridInterval) * initialGridInterval;
|
return (int) Math.ceil((double) finalGridOrigin / initialGridInterval) * initialGridInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int calculateFinalGridOrigin(int totalExpanderCount, List<Stage> stages) {
|
private static int calculateFinalGridOrigin(int totalExpanderCount, List<Stage> stages) {
|
||||||
int gridOrigin = 0;
|
int gridOrigin = 0;
|
||||||
int expansionsApplied = 0;
|
int expansionsApplied = 0;
|
||||||
int gridInterval = calculateGridInterval(totalExpanderCount, expansionsApplied);
|
int gridInterval = calculateGridInterval(totalExpanderCount, expansionsApplied);
|
||||||
for (Stage stage : stages) {
|
for(Stage stage : stages) {
|
||||||
if (stage instanceof Expander) {
|
if(stage instanceof Expander) {
|
||||||
expansionsApplied++;
|
expansionsApplied++;
|
||||||
gridInterval = calculateGridInterval(totalExpanderCount, expansionsApplied);
|
gridInterval = calculateGridInterval(totalExpanderCount, expansionsApplied);
|
||||||
}
|
}
|
||||||
@@ -144,6 +129,21 @@ public class BiomeChunkImpl implements BiomeChunk {
|
|||||||
return 1 << (totalExpansions - expansionsApplied);
|
return 1 << (totalExpansions - expansionsApplied);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PipelineBiome get(int xInChunk, int zInChunk) {
|
||||||
|
int xIndex = xInChunk + chunkOriginArrayIndex;
|
||||||
|
int zIndex = zInChunk + chunkOriginArrayIndex;
|
||||||
|
return biomes[xIndex][zIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
private int xIndexToWorldCoordinate(int xIndex) {
|
||||||
|
return (worldOrigin.x() + xIndex - chunkOriginArrayIndex) * worldCoordinateScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int zIndexToWorldCoordinate(int zIndex) {
|
||||||
|
return (worldOrigin.z() + zIndex - chunkOriginArrayIndex) * worldCoordinateScale;
|
||||||
|
}
|
||||||
|
|
||||||
private SeededVector getOrigin() {
|
private SeededVector getOrigin() {
|
||||||
return worldOrigin;
|
return worldOrigin;
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,8 @@ public class BiomeChunkImpl implements BiomeChunk {
|
|||||||
private final int zIndex;
|
private final int zIndex;
|
||||||
private final PipelineBiome[][] lookupArray;
|
private final PipelineBiome[][] lookupArray;
|
||||||
|
|
||||||
private ViewPoint(BiomeChunkImpl chunk, int gridInterval, int gridX, int gridZ, int xIndex, int zIndex, PipelineBiome[][] lookupArray) {
|
private ViewPoint(BiomeChunkImpl chunk, int gridInterval, int gridX, int gridZ, int xIndex, int zIndex,
|
||||||
|
PipelineBiome[][] lookupArray) {
|
||||||
this.chunk = chunk;
|
this.chunk = chunk;
|
||||||
this.gridInterval = gridInterval;
|
this.gridInterval = gridInterval;
|
||||||
this.gridX = gridX;
|
this.gridX = gridX;
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ public class PipelineImpl implements Pipeline {
|
|||||||
int chunkOriginArrayIndex;
|
int chunkOriginArrayIndex;
|
||||||
int chunkSize;
|
int chunkSize;
|
||||||
int initialSize = 1;
|
int initialSize = 1;
|
||||||
while (true) {
|
while(true) {
|
||||||
arraySize = BiomeChunkImpl.initialSizeToArraySize(expanderCount, initialSize);
|
arraySize = BiomeChunkImpl.initialSizeToArraySize(expanderCount, initialSize);
|
||||||
chunkOriginArrayIndex = BiomeChunkImpl.calculateChunkOriginArrayIndex(expanderCount, stages);
|
chunkOriginArrayIndex = BiomeChunkImpl.calculateChunkOriginArrayIndex(expanderCount, stages);
|
||||||
chunkSize = BiomeChunkImpl.calculateChunkSize(arraySize, chunkOriginArrayIndex, expanderCount);
|
chunkSize = BiomeChunkImpl.calculateChunkSize(arraySize, chunkOriginArrayIndex, expanderCount);
|
||||||
if (chunkSize > 1 && arraySize >= idealChunkArraySize) break;
|
if(chunkSize > 1 && arraySize >= idealChunkArraySize) break;
|
||||||
initialSize++;
|
initialSize++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package com.dfsek.terra.addons.biome.pipeline.v2.source;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
|
||||||
import com.dfsek.terra.addons.biome.pipeline.v2.api.Source;
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.Source;
|
||||||
|
import com.dfsek.terra.addons.biome.pipeline.v2.api.biome.PipelineBiome;
|
||||||
|
|
||||||
|
|
||||||
public class SingleSource implements Source {
|
public class SingleSource implements Source {
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ public class FractalExpander implements Expander {
|
|||||||
|
|
||||||
double roll = sampler.noise(viewPoint.worldSeed(), viewPoint.worldX(), viewPoint.worldZ());
|
double roll = sampler.noise(viewPoint.worldSeed(), viewPoint.worldX(), viewPoint.worldZ());
|
||||||
|
|
||||||
if (xMod2 == 1 && zMod2 == 0) { // Pick one of 2 neighbors on X axis randomly
|
if(xMod2 == 1 && zMod2 == 0) { // Pick one of 2 neighbors on X axis randomly
|
||||||
return roll > 0 ? viewPoint.getRelativeBiome(-1, 0) : viewPoint.getRelativeBiome(1, 0);
|
return roll > 0 ? viewPoint.getRelativeBiome(-1, 0) : viewPoint.getRelativeBiome(1, 0);
|
||||||
|
|
||||||
} else if (xMod2 == 0 && zMod2 == 1) { // Pick one of 2 neighbors on Z axis randomly
|
} else if(xMod2 == 0 && zMod2 == 1) { // Pick one of 2 neighbors on Z axis randomly
|
||||||
return roll > 0 ? viewPoint.getRelativeBiome(0, -1) : viewPoint.getRelativeBiome(0, 1);
|
return roll > 0 ? viewPoint.getRelativeBiome(0, -1) : viewPoint.getRelativeBiome(0, 1);
|
||||||
|
|
||||||
} else { // Pick one of 4 corners randomly
|
} else { // Pick one of 4 corners randomly
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -71,7 +71,8 @@ public class BorderListStage implements Stage {
|
|||||||
viewPoint.worldSeed());
|
viewPoint.worldSeed());
|
||||||
return replacement.isSelf() ? center : replacement;
|
return replacement.isSelf() ? center : replacement;
|
||||||
}
|
}
|
||||||
PipelineBiome replacement = replaceDefault.get(noiseSampler, viewPoint.worldX(), viewPoint.worldZ(), viewPoint.worldSeed());
|
PipelineBiome replacement = replaceDefault.get(noiseSampler, viewPoint.worldX(), viewPoint.worldZ(),
|
||||||
|
viewPoint.worldSeed());
|
||||||
return replacement.isSelf() ? center : replacement;
|
return replacement.isSelf() ? center : replacement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020-2021 Polyhedral Development
|
Copyright (c) 2020-2023 Polyhedral Development
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
version = version("1.0.1")
|
version = version("1.0.2")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||||
|
|
||||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
|
||||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
|
||||||
relocate("net.jafama", "com.dfsek.terra.addons.biome.pipeline.lib.jafama")
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -41,15 +41,13 @@ import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
|||||||
|
|
||||||
public class BiomePipelineAddon implements AddonInitializer {
|
public class BiomePipelineAddon implements AddonInitializer {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(BiomePipelineAddon.class);
|
|
||||||
|
|
||||||
public static final TypeKey<Supplier<ObjectTemplate<BiomeSource>>> SOURCE_REGISTRY_KEY = new TypeKey<>() {
|
public static final TypeKey<Supplier<ObjectTemplate<BiomeSource>>> SOURCE_REGISTRY_KEY = new TypeKey<>() {
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final TypeKey<Supplier<ObjectTemplate<Stage>>> STAGE_REGISTRY_KEY = new TypeKey<>() {
|
public static final TypeKey<Supplier<ObjectTemplate<Stage>>> STAGE_REGISTRY_KEY = new TypeKey<>() {
|
||||||
};
|
};
|
||||||
public static final TypeKey<Supplier<ObjectTemplate<BiomeProvider>>> PROVIDER_REGISTRY_KEY = new TypeKey<>() {
|
public static final TypeKey<Supplier<ObjectTemplate<BiomeProvider>>> PROVIDER_REGISTRY_KEY = new TypeKey<>() {
|
||||||
};
|
};
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(BiomePipelineAddon.class);
|
||||||
@Inject
|
@Inject
|
||||||
private Platform platform;
|
private Platform platform;
|
||||||
|
|
||||||
@@ -90,6 +88,9 @@ public class BiomePipelineAddon implements AddonInitializer {
|
|||||||
event.getPack().applyLoader(BiomeDelegate.class, new BiomeDelegateLoader(biomeRegistry));
|
event.getPack().applyLoader(BiomeDelegate.class, new BiomeDelegateLoader(biomeRegistry));
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.warn("The biome-provider-pipeline addon is deprecated and scheduled for removal in Terra 7.0. It is recommended to use the biome-provider-pipeline-v2 addon for future pack development instead.");
|
if(platform.getTerraConfig().isDebugLog())
|
||||||
|
logger.warn(
|
||||||
|
"The biome-provider-pipeline addon is deprecated and scheduled for removal in Terra 7.0. It is recommended to use the" +
|
||||||
|
" biome-provider-pipeline-v2 addon for future pack development instead.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -9,7 +9,6 @@ package com.dfsek.terra.addons.biome.pipeline;
|
|||||||
|
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||||
import net.jafama.FastMath;
|
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -86,8 +85,8 @@ public class BiomePipelineProvider implements BiomeProvider {
|
|||||||
x /= resolution;
|
x /= resolution;
|
||||||
z /= resolution;
|
z /= resolution;
|
||||||
|
|
||||||
int fdX = FastMath.floorDiv(x, pipeline.getSize());
|
int fdX = Math.floorDiv(x, pipeline.getSize());
|
||||||
int fdZ = FastMath.floorDiv(z, pipeline.getSize());
|
int fdZ = Math.floorDiv(z, pipeline.getSize());
|
||||||
return holderCache.get(new SeededVector(fdX, fdZ, seed)).getBiome(x - fdX * pipeline.getSize(),
|
return holderCache.get(new SeededVector(fdX, fdZ, seed)).getBiome(x - fdX * pipeline.getSize(),
|
||||||
z - fdZ * pipeline.getSize()).getBiome();
|
z - fdZ * pipeline.getSize()).getBiome();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020-2021 Polyhedral Development
|
Copyright (c) 2020-2023 Polyhedral Development
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020-2021 Polyhedral Development
|
Copyright (c) 2020-2023 Polyhedral Development
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
version = version("1.1.0")
|
version = version("1.2.1")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||||
|
|
||||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
|
||||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
|
||||||
relocate("net.jafama", "com.dfsek.terra.addons.chunkgenerator.lib.jafama")
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -68,10 +68,13 @@ public class NoiseChunkGenerator3DAddon implements AddonInitializer {
|
|||||||
.register(addon, ConfigurationLoadEvent.class)
|
.register(addon, ConfigurationLoadEvent.class)
|
||||||
.then(event -> {
|
.then(event -> {
|
||||||
if(event.is(Biome.class)) {
|
if(event.is(Biome.class)) {
|
||||||
NoiseChunkGeneratorPackConfigTemplate config = event.getPack().getContext().get(NoiseChunkGeneratorPackConfigTemplate.class);
|
NoiseChunkGeneratorPackConfigTemplate config = event.getPack().getContext().get(
|
||||||
|
NoiseChunkGeneratorPackConfigTemplate.class);
|
||||||
|
|
||||||
event.getLoadedObject(Biome.class).getContext().put(paletteInfoPropertyKey,
|
event.getLoadedObject(Biome.class).getContext().put(paletteInfoPropertyKey,
|
||||||
event.load(new BiomePaletteTemplate(platform, config.getSlantCalculationMethod())).get());
|
event.load(new BiomePaletteTemplate(platform,
|
||||||
|
config.getSlantCalculationMethod()))
|
||||||
|
.get());
|
||||||
event.getLoadedObject(Biome.class).getContext().put(noisePropertiesPropertyKey,
|
event.getLoadedObject(Biome.class).getContext().put(noisePropertiesPropertyKey,
|
||||||
event.load(new BiomeNoiseConfigTemplate()).get());
|
event.load(new BiomeNoiseConfigTemplate()).get());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -16,8 +16,8 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.chunkgenerator.palette.PaletteHolder;
|
|
||||||
import com.dfsek.terra.addons.chunkgenerator.palette.BiomePaletteInfo;
|
import com.dfsek.terra.addons.chunkgenerator.palette.BiomePaletteInfo;
|
||||||
|
import com.dfsek.terra.addons.chunkgenerator.palette.PaletteHolder;
|
||||||
import com.dfsek.terra.addons.chunkgenerator.palette.slant.SlantHolder;
|
import com.dfsek.terra.addons.chunkgenerator.palette.slant.SlantHolder;
|
||||||
import com.dfsek.terra.api.Platform;
|
import com.dfsek.terra.api.Platform;
|
||||||
import com.dfsek.terra.api.block.state.BlockState;
|
import com.dfsek.terra.api.block.state.BlockState;
|
||||||
@@ -27,26 +27,22 @@ import com.dfsek.terra.api.world.chunk.generation.util.Palette;
|
|||||||
|
|
||||||
public class BiomePaletteTemplate implements ObjectTemplate<BiomePaletteInfo> {
|
public class BiomePaletteTemplate implements ObjectTemplate<BiomePaletteInfo> {
|
||||||
private final Platform platform;
|
private final Platform platform;
|
||||||
|
private final SlantHolder.CalculationMethod slantCalculationMethod;
|
||||||
@Value("slant")
|
@Value("slant")
|
||||||
@Default
|
@Default
|
||||||
@Description("The slant palettes to use in this biome.")
|
@Description("The slant palettes to use in this biome.")
|
||||||
private @Meta List<SlantHolder.@Meta Layer> slantLayers = Collections.emptyList();
|
private @Meta List<SlantHolder.@Meta Layer> slantLayers = Collections.emptyList();
|
||||||
|
|
||||||
@Value("slant-depth")
|
@Value("slant-depth")
|
||||||
@Default
|
@Default
|
||||||
@Description("The maximum depth at which to apply a slant palette.")
|
@Description("The maximum depth at which to apply a slant palette.")
|
||||||
private @Meta int slantDepth = Integer.MAX_VALUE;
|
private @Meta int slantDepth = Integer.MAX_VALUE;
|
||||||
|
|
||||||
@Value("palette")
|
@Value("palette")
|
||||||
@Description("The palettes to use in this biome.")
|
@Description("The palettes to use in this biome.")
|
||||||
private @Meta List<@Meta Map<@Meta Palette, @Meta Integer>> palettes;
|
private @Meta List<@Meta Map<@Meta Palette, @Meta Integer>> palettes;
|
||||||
|
|
||||||
@Value("ocean.level")
|
@Value("ocean.level")
|
||||||
@Description("Sea level in this biome. Defaults to zero")
|
@Description("Sea level in this biome. Defaults to zero")
|
||||||
@Default
|
@Default
|
||||||
private @Meta int seaLevel = 0;
|
private @Meta int seaLevel = 0;
|
||||||
|
|
||||||
@Value("ocean.palette")
|
@Value("ocean.palette")
|
||||||
@Description("The palette to use for the ocean in this biome. Defaults to a blank palette.")
|
@Description("The palette to use for the ocean in this biome. Defaults to a blank palette.")
|
||||||
@Default
|
@Default
|
||||||
@@ -56,13 +52,10 @@ public class BiomePaletteTemplate implements ObjectTemplate<BiomePaletteInfo> {
|
|||||||
return platform.getWorldHandle().air();
|
return platform.getWorldHandle().air();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Value("carving.update-palette")
|
@Value("carving.update-palette")
|
||||||
@Default
|
@Default
|
||||||
private @Meta boolean updatePalette = false;
|
private @Meta boolean updatePalette = false;
|
||||||
|
|
||||||
private final SlantHolder.CalculationMethod slantCalculationMethod;
|
|
||||||
|
|
||||||
public BiomePaletteTemplate(Platform platform, SlantHolder.CalculationMethod slantCalculationMethod) {
|
public BiomePaletteTemplate(Platform platform, SlantHolder.CalculationMethod slantCalculationMethod) {
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
this.slantCalculationMethod = slantCalculationMethod;
|
this.slantCalculationMethod = slantCalculationMethod;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -8,15 +8,14 @@
|
|||||||
package com.dfsek.terra.addons.chunkgenerator.generation;
|
package com.dfsek.terra.addons.chunkgenerator.generation;
|
||||||
|
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
|
import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
|
||||||
import com.dfsek.terra.addons.chunkgenerator.palette.BiomePaletteInfo;
|
|
||||||
import com.dfsek.terra.addons.chunkgenerator.generation.math.PaletteUtil;
|
import com.dfsek.terra.addons.chunkgenerator.generation.math.PaletteUtil;
|
||||||
import com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation.LazilyEvaluatedInterpolator;
|
import com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation.LazilyEvaluatedInterpolator;
|
||||||
import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.Sampler3D;
|
import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.Sampler3D;
|
||||||
import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.SamplerProvider;
|
import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.SamplerProvider;
|
||||||
|
import com.dfsek.terra.addons.chunkgenerator.palette.BiomePaletteInfo;
|
||||||
import com.dfsek.terra.api.Platform;
|
import com.dfsek.terra.api.Platform;
|
||||||
import com.dfsek.terra.api.block.state.BlockState;
|
import com.dfsek.terra.api.block.state.BlockState;
|
||||||
import com.dfsek.terra.api.config.ConfigPack;
|
import com.dfsek.terra.api.config.ConfigPack;
|
||||||
@@ -133,8 +132,8 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
|
|||||||
|
|
||||||
BiomePaletteInfo paletteInfo = biome.getContext().get(paletteInfoPropertyKey);
|
BiomePaletteInfo paletteInfo = biome.getContext().get(paletteInfoPropertyKey);
|
||||||
|
|
||||||
int fdX = FastMath.floorMod(x, 16);
|
int fdX = Math.floorMod(x, 16);
|
||||||
int fdZ = FastMath.floorMod(z, 16);
|
int fdZ = Math.floorMod(z, 16);
|
||||||
|
|
||||||
Palette palette = PaletteUtil.getPalette(fdX, y, fdZ, sampler, paletteInfo, 0);
|
Palette palette = PaletteUtil.getPalette(fdX, y, fdZ, sampler, paletteInfo, 0);
|
||||||
double noise = sampler.sample(fdX, y, fdZ);
|
double noise = sampler.sample(fdX, y, fdZ);
|
||||||
@@ -155,6 +154,16 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
|
|||||||
return biomeProvider.getBiome(x, y, z, world.getSeed()).getContext().get(paletteInfoPropertyKey).paletteHolder().getPalette(y);
|
return biomeProvider.getBiome(x, y, z, world.getSeed()).getContext().get(paletteInfoPropertyKey).paletteHolder().getPalette(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getSlant(int x, int y, int z, WorldProperties world, BiomeProvider biomeProvider) {
|
||||||
|
int fdX = Math.floorMod(x, 16);
|
||||||
|
int fdZ = Math.floorMod(z, 16);
|
||||||
|
return biomeProvider.getBiome(x, y, z, world.getSeed())
|
||||||
|
.getContext()
|
||||||
|
.get(paletteInfoPropertyKey)
|
||||||
|
.slantHolder()
|
||||||
|
.calculateSlant(samplerCache.get(x, z, world, biomeProvider), fdX, y, fdZ);
|
||||||
|
}
|
||||||
|
|
||||||
public SamplerProvider samplerProvider() {
|
public SamplerProvider samplerProvider() {
|
||||||
return samplerCache;
|
return samplerCache;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.chunkgenerator.generation.math;
|
package com.dfsek.terra.addons.chunkgenerator.generation.math;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.chunkgenerator.palette.BiomePaletteInfo;
|
|
||||||
import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.Sampler3D;
|
import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.Sampler3D;
|
||||||
|
import com.dfsek.terra.addons.chunkgenerator.palette.BiomePaletteInfo;
|
||||||
import com.dfsek.terra.addons.chunkgenerator.palette.slant.SlantHolder;
|
import com.dfsek.terra.addons.chunkgenerator.palette.slant.SlantHolder;
|
||||||
import com.dfsek.terra.api.world.chunk.generation.util.Palette;
|
import com.dfsek.terra.api.world.chunk.generation.util.Palette;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation;
|
package com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation;
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
|
||||||
|
|
||||||
import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
|
import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
|
||||||
import com.dfsek.terra.api.properties.PropertyKey;
|
import com.dfsek.terra.api.properties.PropertyKey;
|
||||||
import com.dfsek.terra.api.util.Column;
|
import com.dfsek.terra.api.util.Column;
|
||||||
@@ -134,7 +132,7 @@ public class ChunkInterpolator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static int reRange(int value, int high) {
|
private static int reRange(int value, int high) {
|
||||||
return FastMath.max(FastMath.min(value, high), 0);
|
return Math.max(Math.min(value, high), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -146,7 +144,7 @@ public class ChunkInterpolator {
|
|||||||
* @return double - The interpolated noise at the coordinates.
|
* @return double - The interpolated noise at the coordinates.
|
||||||
*/
|
*/
|
||||||
public double getNoise(double x, double y, double z) {
|
public double getNoise(double x, double y, double z) {
|
||||||
return interpGrid[reRange(((int) x) / 4, 3)][(FastMath.max(FastMath.min(((int) y), max), min) - min) / 4][reRange(((int) z) / 4,
|
return interpGrid[reRange(((int) x) / 4, 3)][(Math.max(Math.min(((int) y), max), min) - min) / 4][reRange(((int) z) / 4,
|
||||||
3)].trilerp(
|
3)].trilerp(
|
||||||
(x % 4) / 4, (y % 4) / 4, (z % 4) / 4);
|
(x % 4) / 4, (y % 4) / 4, (z % 4) / 4);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -7,6 +7,9 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation;
|
package com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.util.MathUtil;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for bilinear interpolation of values arranged on a unit square.
|
* Class for bilinear interpolation of values arranged on a unit square.
|
||||||
*/
|
*/
|
||||||
@@ -28,19 +31,6 @@ public class Interpolator {
|
|||||||
this.v3 = v3;
|
this.v3 = v3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 1D Linear interpolation between 2 points 1 unit apart.
|
|
||||||
*
|
|
||||||
* @param t - Distance from v0. Total distance between v0 and v1 is 1 unit.
|
|
||||||
* @param v0 - Value at v0.
|
|
||||||
* @param v1 - Value at v1.
|
|
||||||
*
|
|
||||||
* @return double - The interpolated value.
|
|
||||||
*/
|
|
||||||
public static double lerp(double t, double v0, double v1) {
|
|
||||||
return v0 + t * (v1 - v0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2D Bilinear interpolation between 4 points on a unit square.
|
* 2D Bilinear interpolation between 4 points on a unit square.
|
||||||
*
|
*
|
||||||
@@ -50,8 +40,8 @@ public class Interpolator {
|
|||||||
* @return double - The interpolated value.
|
* @return double - The interpolated value.
|
||||||
*/
|
*/
|
||||||
public double bilerp(double s, double t) {
|
public double bilerp(double s, double t) {
|
||||||
double v01 = lerp(s, v0, v1);
|
double v01 = MathUtil.lerp(s, v0, v1);
|
||||||
double v23 = lerp(s, v2, v3);
|
double v23 = MathUtil.lerp(s, v2, v3);
|
||||||
return lerp(t, v01, v23);
|
return MathUtil.lerp(t, v01, v23);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -7,6 +7,9 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation;
|
package com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.util.MathUtil;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for bilinear interpolation of values arranged on a unit square.
|
* Class for bilinear interpolation of values arranged on a unit square.
|
||||||
*/
|
*/
|
||||||
@@ -34,6 +37,6 @@ public class Interpolator3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double trilerp(double x, double y, double z) {
|
public double trilerp(double x, double y, double z) {
|
||||||
return Interpolator.lerp(x, top.bilerp(y, z), bottom.bilerp(y, z));
|
return MathUtil.lerp(x, top.bilerp(y, z), bottom.bilerp(y, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,10 @@
|
|||||||
package com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation;
|
package com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation;
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
|
||||||
|
|
||||||
import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
|
import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
|
||||||
import com.dfsek.terra.api.properties.PropertyKey;
|
import com.dfsek.terra.api.properties.PropertyKey;
|
||||||
|
import com.dfsek.terra.api.util.MathUtil;
|
||||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||||
|
|
||||||
import static com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation.Interpolator.lerp;
|
|
||||||
|
|
||||||
|
|
||||||
public class LazilyEvaluatedInterpolator {
|
public class LazilyEvaluatedInterpolator {
|
||||||
private final Double[] samples; //
|
private final Double[] samples; //
|
||||||
@@ -30,8 +27,8 @@ public class LazilyEvaluatedInterpolator {
|
|||||||
PropertyKey<BiomeNoiseProperties> noisePropertiesKey, int min, int horizontalRes, int verticalRes,
|
PropertyKey<BiomeNoiseProperties> noisePropertiesKey, int min, int horizontalRes, int verticalRes,
|
||||||
long seed) {
|
long seed) {
|
||||||
this.noisePropertiesKey = noisePropertiesKey;
|
this.noisePropertiesKey = noisePropertiesKey;
|
||||||
int hSamples = FastMath.ceilToInt(16.0 / horizontalRes);
|
int hSamples = (int) Math.ceil(16.0 / horizontalRes);
|
||||||
int vSamples = FastMath.ceilToInt((double) (max - min) / verticalRes);
|
int vSamples = (int) Math.ceil((double) (max - min) / verticalRes);
|
||||||
this.zMul = (hSamples + 1);
|
this.zMul = (hSamples + 1);
|
||||||
this.yMul = zMul * zMul;
|
this.yMul = zMul * zMul;
|
||||||
samples = new Double[yMul * (vSamples + 1)];
|
samples = new Double[yMul * (vSamples + 1)];
|
||||||
@@ -52,7 +49,7 @@ public class LazilyEvaluatedInterpolator {
|
|||||||
int xi = ox + chunkX;
|
int xi = ox + chunkX;
|
||||||
int zi = oz + chunkZ;
|
int zi = oz + chunkZ;
|
||||||
|
|
||||||
int y = FastMath.min(max, oy);
|
int y = Math.min(max, oy);
|
||||||
|
|
||||||
sample = biomeProvider
|
sample = biomeProvider
|
||||||
.getBiome(xi, y, zi, seed)
|
.getBiome(xi, y, zi, seed)
|
||||||
@@ -84,16 +81,16 @@ public class LazilyEvaluatedInterpolator {
|
|||||||
|
|
||||||
double xFrac = (double) (x % horizontalRes) / horizontalRes;
|
double xFrac = (double) (x % horizontalRes) / horizontalRes;
|
||||||
double zFrac = (double) (z % horizontalRes) / horizontalRes;
|
double zFrac = (double) (z % horizontalRes) / horizontalRes;
|
||||||
double lerp_bottom_0 = lerp(zFrac, sample_0_0_0, sample_0_0_1);
|
double lerp_bottom_0 = MathUtil.lerp(zFrac, sample_0_0_0, sample_0_0_1);
|
||||||
double lerp_bottom_1 = lerp(zFrac, sample_1_0_0, sample_1_0_1);
|
double lerp_bottom_1 = MathUtil.lerp(zFrac, sample_1_0_0, sample_1_0_1);
|
||||||
|
|
||||||
double lerp_bottom = lerp(xFrac, lerp_bottom_0, lerp_bottom_1);
|
double lerp_bottom = MathUtil.lerp(xFrac, lerp_bottom_0, lerp_bottom_1);
|
||||||
|
|
||||||
if(yRange) { // we can do bilerp
|
if(yRange) { // we can do bilerp
|
||||||
return lerp_bottom;
|
return lerp_bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
double yFrac = (double) FastMath.floorMod(y, verticalRes) / verticalRes;
|
double yFrac = (double) Math.floorMod(y, verticalRes) / verticalRes;
|
||||||
|
|
||||||
|
|
||||||
double sample_0_1_0 = sample(xIndex, yIndex + 1, zIndex, x, y + verticalRes, z);
|
double sample_0_1_0 = sample(xIndex, yIndex + 1, zIndex, x, y + verticalRes, z);
|
||||||
@@ -103,11 +100,11 @@ public class LazilyEvaluatedInterpolator {
|
|||||||
double sample_1_1_0 = sample(xIndex + 1, yIndex + 1, zIndex, x + horizontalRes, y + verticalRes, z);
|
double sample_1_1_0 = sample(xIndex + 1, yIndex + 1, zIndex, x + horizontalRes, y + verticalRes, z);
|
||||||
double sample_1_1_1 = sample(xIndex + 1, yIndex + 1, zIndex + 1, x + horizontalRes, y + verticalRes, z + horizontalRes);
|
double sample_1_1_1 = sample(xIndex + 1, yIndex + 1, zIndex + 1, x + horizontalRes, y + verticalRes, z + horizontalRes);
|
||||||
|
|
||||||
double lerp_top_0 = lerp(zFrac, sample_0_1_0, sample_0_1_1);
|
double lerp_top_0 = MathUtil.lerp(zFrac, sample_0_1_0, sample_0_1_1);
|
||||||
double lerp_top_1 = lerp(zFrac, sample_1_1_0, sample_1_1_1);
|
double lerp_top_1 = MathUtil.lerp(zFrac, sample_1_1_0, sample_1_1_1);
|
||||||
|
|
||||||
double lerp_top = lerp(xFrac, lerp_top_0, lerp_top_1);
|
double lerp_top = MathUtil.lerp(xFrac, lerp_top_0, lerp_top_1);
|
||||||
|
|
||||||
return lerp(yFrac, lerp_bottom, lerp_top);
|
return MathUtil.lerp(yFrac, lerp_bottom, lerp_top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.chunkgenerator.generation.math.samplers;
|
package com.dfsek.terra.addons.chunkgenerator.generation.math.samplers;
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
|
||||||
|
|
||||||
import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
|
import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
|
||||||
import com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation.ChunkInterpolator;
|
import com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation.ChunkInterpolator;
|
||||||
import com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation.ElevationInterpolator;
|
import com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation.ElevationInterpolator;
|
||||||
@@ -28,10 +26,10 @@ public class Sampler3D {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double sample(double x, double y, double z) {
|
public double sample(double x, double y, double z) {
|
||||||
return interpolator.getNoise(x, y, z) + elevationInterpolator.getElevation(FastMath.roundToInt(x), FastMath.roundToInt(z));
|
return interpolator.getNoise(x, y, z) + elevationInterpolator.getElevation((int) Math.round(x), (int) Math.round(z));
|
||||||
}
|
}
|
||||||
|
|
||||||
public double sample(int x, int y, int z) {
|
public double sample(int x, int y, int z) {
|
||||||
return interpolator.getNoise(x, y, z) + elevationInterpolator.getElevation(FastMath.roundToInt(x), FastMath.roundToInt(z));
|
return interpolator.getNoise(x, y, z) + elevationInterpolator.getElevation(x, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package com.dfsek.terra.addons.chunkgenerator.generation.math.samplers;
|
|||||||
|
|
||||||
import com.github.benmanes.caffeine.cache.Cache;
|
import com.github.benmanes.caffeine.cache.Cache;
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||||
import net.jafama.FastMath;
|
|
||||||
|
|
||||||
import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
|
import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
|
||||||
import com.dfsek.terra.api.Platform;
|
import com.dfsek.terra.api.Platform;
|
||||||
@@ -45,8 +44,8 @@ public class SamplerProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Sampler3D get(int x, int z, WorldProperties world, BiomeProvider provider) {
|
public Sampler3D get(int x, int z, WorldProperties world, BiomeProvider provider) {
|
||||||
int cx = FastMath.floorDiv(x, 16);
|
int cx = Math.floorDiv(x, 16);
|
||||||
int cz = FastMath.floorDiv(z, 16);
|
int cz = Math.floorDiv(z, 16);
|
||||||
return getChunk(cx, cz, world, provider);
|
return getChunk(cx, cz, world, provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021 Polyhedral Development
|
* Copyright (c) 2020-2023 Polyhedral Development
|
||||||
*
|
*
|
||||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||||
* reference the LICENSE file in this module's root directory.
|
* reference the LICENSE file in this module's root directory.
|
||||||
@@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.chunkgenerator.palette;
|
package com.dfsek.terra.addons.chunkgenerator.palette;
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@@ -26,15 +24,6 @@ public class PaletteHolder {
|
|||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Palette getPalette(int y) {
|
|
||||||
int index = y + offset;
|
|
||||||
return index >= 0
|
|
||||||
? index < palettes.length
|
|
||||||
? palettes[index]
|
|
||||||
: palettes[palettes.length - 1]
|
|
||||||
: palettes[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PaletteHolder of(List<Map<Palette, Integer>> palettes) {
|
public static PaletteHolder of(List<Map<Palette, Integer>> palettes) {
|
||||||
PaletteHolderBuilder builder = new PaletteHolderBuilder();
|
PaletteHolderBuilder builder = new PaletteHolderBuilder();
|
||||||
for(Map<Palette, Integer> layer : palettes) {
|
for(Map<Palette, Integer> layer : palettes) {
|
||||||
@@ -45,6 +34,16 @@ public class PaletteHolder {
|
|||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Palette getPalette(int y) {
|
||||||
|
int index = y + offset;
|
||||||
|
return index >= 0
|
||||||
|
? index < palettes.length
|
||||||
|
? palettes[index]
|
||||||
|
: palettes[palettes.length - 1]
|
||||||
|
: palettes[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static class PaletteHolderBuilder {
|
private static class PaletteHolderBuilder {
|
||||||
private final TreeMap<Integer, Palette> paletteMap = new TreeMap<>();
|
private final TreeMap<Integer, Palette> paletteMap = new TreeMap<>();
|
||||||
|
|
||||||
@@ -55,11 +54,11 @@ public class PaletteHolder {
|
|||||||
|
|
||||||
public PaletteHolder build() {
|
public PaletteHolder build() {
|
||||||
|
|
||||||
int min = FastMath.min(paletteMap.keySet().stream().min(Integer::compareTo).orElse(0), 0);
|
int min = Math.min(paletteMap.keySet().stream().min(Integer::compareTo).orElse(0), 0);
|
||||||
int max = FastMath.max(paletteMap.keySet().stream().max(Integer::compareTo).orElse(255), 255);
|
int max = Math.max(paletteMap.keySet().stream().max(Integer::compareTo).orElse(255), 255);
|
||||||
|
|
||||||
Palette[] palettes = new Palette[paletteMap.lastKey() + 1 - min];
|
Palette[] palettes = new Palette[paletteMap.lastKey() + 1 - min];
|
||||||
for(int y = min; y <= FastMath.max(paletteMap.lastKey(), max); y++) {
|
for(int y = min; y <= Math.max(paletteMap.lastKey(), max); y++) {
|
||||||
Palette d = null;
|
Palette d = null;
|
||||||
for(Entry<Integer, Palette> e : paletteMap.entrySet()) {
|
for(Entry<Integer, Palette> e : paletteMap.entrySet()) {
|
||||||
if(e.getKey() >= y) {
|
if(e.getKey() >= y) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user