mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-18 23:01:03 +00:00
reformat all code
This commit is contained in:
@@ -37,9 +37,12 @@ assignees: ""
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
- [ ] I have checked that I am on the latest version of Terra.
|
- [ ] I have checked that I am on the latest version of Terra.
|
||||||
- [ ] I have searched the github issue tracker for similar issues, including closed ones.
|
- [ ] I have searched the github issue tracker for similar issues, including
|
||||||
- [ ] I have made sure that this is not a bug with another mod or plugin, and it is Terra that is causing the issue.
|
closed ones.
|
||||||
- [ ] I have checked that this is an issue with Terra and not an issue with the pack I am using.
|
- [ ] I have made sure that this is not a bug with another mod or plugin, and it
|
||||||
|
is Terra that is causing the issue.
|
||||||
|
- [ ] I have checked that this is an issue with Terra and not an issue with the
|
||||||
|
pack I am using.
|
||||||
<!-- If this is an issue with the default Terra pack, please open an issue on the pack repo: https://github.com/PolyhedralDev/TerraDefaultConfig/issues/new -->
|
<!-- If this is an issue with the default Terra pack, please open an issue on the pack repo: https://github.com/PolyhedralDev/TerraDefaultConfig/issues/new -->
|
||||||
- [ ] I have attached a copy of the `latest.log` file
|
- [ ] I have attached a copy of the `latest.log` file
|
||||||
- [ ] I have filled out and provided all the appropriate information.
|
- [ ] I have filled out and provided all the appropriate information.
|
||||||
|
|||||||
@@ -31,9 +31,11 @@ assignees: ""
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
- [ ] I have checked that I am on the latest version of Terra.
|
- [ ] I have checked that I am on the latest version of Terra.
|
||||||
- [ ] I have searched github for similar features requests, including closed ones, and found none.
|
- [ ] I have searched github for similar features requests, including closed
|
||||||
|
ones, and found none.
|
||||||
- [ ] I believe this is within the scope of Terra.
|
- [ ] I believe this is within the scope of Terra.
|
||||||
- [ ] This feature request is for *all* of Terra, and isn't something that should be implemented by a pack or addon.
|
- [ ] This feature request is for *all* of Terra, and isn't something that
|
||||||
|
should be implemented by a pack or addon.
|
||||||
|
|
||||||
## Feature Description
|
## Feature Description
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: "Other Issue"
|
name: "Other Issue"
|
||||||
about: "Use this template if your issue doesn't accurately fit into any of the other categories."
|
about: "Use this template if your issue doesn't accurately fit into any of the
|
||||||
|
other categories."
|
||||||
title: ""
|
title: ""
|
||||||
labels: "Type: Question, Status: Pending"
|
labels: "Type: Question, Status: Pending"
|
||||||
assignees: ""
|
assignees: ""
|
||||||
|
|||||||
@@ -33,9 +33,11 @@
|
|||||||
|
|
||||||
<!-- In order to be accepted, your changes must be under the GPLv3 license. Please check one of the following: -->
|
<!-- 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 the original author of this code, and I am willing to release it
|
||||||
- [ ] 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).
|
||||||
under [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html) or a compatible license.
|
- [ ] 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.
|
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.
|
NOTE: for compatible licenses, you must make sure to add the included license somewhere in the program, if so required.
|
||||||
@@ -70,19 +72,24 @@
|
|||||||
|
|
||||||
- [ ] Bug Fix <!-- Anything which fixes an issue in Terra. -->
|
- [ ] Bug Fix <!-- Anything which fixes an issue in Terra. -->
|
||||||
- [ ] Build system <!-- Anything which pretain to the build system. -->
|
- [ ] Build system <!-- Anything which pretain to the build system. -->
|
||||||
- [ ] Documentation <!-- Anything which adds or improves documentation for existing features. -->
|
- [ ]
|
||||||
|
Documentation <!-- Anything which adds or improves documentation for existing features. -->
|
||||||
- [ ] New Feature <!-- Anything which adds new functionality to Terra. -->
|
- [ ] New Feature <!-- Anything which adds new functionality to Terra. -->
|
||||||
- [ ] Performance <!-- Anything which is imrpoves the performance of Terra. -->
|
- [ ] Performance <!-- Anything which is imrpoves the performance of Terra. -->
|
||||||
- [ ] Refactoring <!-- Anything which does not add any new code, only moves code around. -->
|
- [ ]
|
||||||
- [ ] Repository <!-- Anything which affects the repository. Eg. changes to the `README.md` file. -->
|
Refactoring <!-- Anything which does not add any new code, only moves code around. -->
|
||||||
|
- [ ]
|
||||||
|
Repository <!-- Anything which affects the repository. Eg. changes to the `README.md` file. -->
|
||||||
- [ ] Revert <!-- Anything which reverts previous commits. -->
|
- [ ] Revert <!-- Anything which reverts previous commits. -->
|
||||||
- [ ] Style <!-- Anything which updates style. -->
|
- [ ] Style <!-- Anything which updates style. -->
|
||||||
- [ ] Tests <!-- Anything which adds or updates tests. -->
|
- [ ] Tests <!-- Anything which adds or updates tests. -->
|
||||||
- [ ] Translation <!-- Anything which is internationalizing the Terra program to other languages. -->
|
- [ ]
|
||||||
|
Translation <!-- Anything which is internationalizing the Terra program to other languages. -->
|
||||||
|
|
||||||
#### Compatiblity
|
#### Compatiblity
|
||||||
|
|
||||||
- [ ] Breaking change <!-- A fix, or a feature, that breaks some previous functionality to Terra. -->
|
- [ ] Breaking
|
||||||
|
change <!-- A fix, or a feature, that breaks some previous functionality to Terra. -->
|
||||||
- [ ] Non-Breaking change.
|
- [ ] Non-Breaking change.
|
||||||
<!--
|
<!--
|
||||||
A change which does not break *any* previous functionality of Terra.
|
A change which does not break *any* previous functionality of Terra.
|
||||||
@@ -94,8 +101,9 @@
|
|||||||
|
|
||||||
#### Contribution Guidelines.
|
#### Contribution Guidelines.
|
||||||
|
|
||||||
- [ ] I have read the [`CONTRIBUTING.md`](https://github.com/PolyhedralDev/Terra/blob/master/CONTRIBUTING.md) document in the root of the
|
- [ ] I have read
|
||||||
git repository.
|
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
|
- [ ] 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. -->
|
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. -->
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -58,8 +58,8 @@ listen carefully, apologize sincerely, and correct the behavior going forward.
|
|||||||
Any member of the Terra community should always be open to new ideas and must
|
Any member of the Terra community should always be open to new ideas and must
|
||||||
always be open to the possibility of being wrong. Nobody can always be right,
|
always be open to the possibility of being wrong. Nobody can always be right,
|
||||||
and we are only human; we are
|
and we are only human; we are
|
||||||
[fallible](https://www.merriam-webster.com/dictionary/fallible) by nature.
|
[fallible](https://www.merriam-webster.com/dictionary/fallible) by nature. It is
|
||||||
It is okay to make mistakes, but we must be willing to admit when we make one.
|
okay to make mistakes, but we must be willing to admit when we make one.
|
||||||
|
|
||||||
### Be Direct but Professional
|
### Be Direct but Professional
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -365,8 +365,9 @@ into packs) is acceptable in the platform project.
|
|||||||
|
|
||||||
#### Specific Compatibility
|
#### Specific Compatibility
|
||||||
|
|
||||||
Specific compatibility should *not* be put in the platform project. (Example: Adding
|
Specific compatibility should *not* be put in the platform project. (Example:
|
||||||
the ability to generate TechCraft v7's doo-dads with a TerraScript function)
|
Adding the ability to generate TechCraft v7's doo-dads with a TerraScript
|
||||||
|
function)
|
||||||
|
|
||||||
Having specific compatibilities leads to tons of extra dependencies to keep
|
Having specific compatibilities leads to tons of extra dependencies to keep
|
||||||
track of, as well as adding lots of additional stuff to maintain. It quickly
|
track of, as well as adding lots of additional stuff to maintain. It quickly
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ If you're not sure which license a particular file is under, check:
|
|||||||
Terra is still in beta! While it is stable, it is not feature-complete. There is
|
Terra is still in beta! While it is stable, it is not feature-complete. There is
|
||||||
a lot to be added!
|
a lot to be added!
|
||||||
|
|
||||||
|
|
||||||
## Special Thanks
|
## Special Thanks
|
||||||
|
|
||||||
[](https://www.yourkit.com/)
|
[](https://www.yourkit.com/)
|
||||||
@@ -100,9 +99,9 @@ YourKit has granted Polyhedral Development an open-source license to their
|
|||||||
outstanding Java profiler, allowing us to make our software as performant as it
|
outstanding Java profiler, allowing us to make our software as performant as it
|
||||||
can be!
|
can be!
|
||||||
|
|
||||||
YourKit supports open source projects with innovative and intelligent tools
|
YourKit supports open source projects with innovative and intelligent tools for
|
||||||
for monitoring and profiling Java and .NET applications.
|
monitoring and profiling Java and .NET applications. YourKit is the creator of
|
||||||
YourKit is the creator of the
|
the
|
||||||
[YourKit Java Profiler](https://www.yourkit.com/java/profiler/),
|
[YourKit Java Profiler](https://www.yourkit.com/java/profiler/),
|
||||||
[YourKit .NET Profiler](https://www.yourkit.com/.net/profiler/),
|
[YourKit .NET Profiler](https://www.yourkit.com/.net/profiler/),
|
||||||
and [YourKit YouMonitor](https://www.yourkit.com/youmonitor/).
|
and [YourKit YouMonitor](https://www.yourkit.com/youmonitor/).
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
preRelease(true)
|
preRelease(true)
|
||||||
|
|
||||||
versionProjects(":common:api", version("6.0.0"))
|
versionProjects(":common:api", version("6.0.0"))
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import com.dfsek.terra.tectonicdoc.TectonicDocPlugin
|
||||||
import org.apache.tools.ant.filters.ReplaceTokens
|
import org.apache.tools.ant.filters.ReplaceTokens
|
||||||
import org.gradle.api.JavaVersion
|
import org.gradle.api.JavaVersion
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
@@ -12,7 +13,6 @@ import org.gradle.kotlin.dsl.getByName
|
|||||||
import org.gradle.kotlin.dsl.register
|
import org.gradle.kotlin.dsl.register
|
||||||
import org.gradle.kotlin.dsl.withType
|
import org.gradle.kotlin.dsl.withType
|
||||||
import org.gradle.language.jvm.tasks.ProcessResources
|
import org.gradle.language.jvm.tasks.ProcessResources
|
||||||
import com.dfsek.terra.tectonicdoc.TectonicDocPlugin
|
|
||||||
|
|
||||||
fun Project.configureCompilation() {
|
fun Project.configureCompilation() {
|
||||||
apply(plugin = "maven-publish")
|
apply(plugin = "maven-publish")
|
||||||
|
|||||||
+2
-1
@@ -41,7 +41,8 @@ public class ImageBiomeProviderAddon implements AddonInitializer {
|
|||||||
.then(event -> {
|
.then(event -> {
|
||||||
CheckedRegistry<Supplier<ObjectTemplate<BiomeProvider>>> providerRegistry = event.getPack().getOrCreateRegistry(
|
CheckedRegistry<Supplier<ObjectTemplate<BiomeProvider>>> providerRegistry = event.getPack().getOrCreateRegistry(
|
||||||
PROVIDER_REGISTRY_KEY);
|
PROVIDER_REGISTRY_KEY);
|
||||||
providerRegistry.register(addon.key("IMAGE"), () -> new ImageProviderTemplate(event.getPack().getRegistry(Biome.class)));
|
providerRegistry.register(addon.key("IMAGE"),
|
||||||
|
() -> new ImageProviderTemplate(event.getPack().getRegistry(Biome.class)));
|
||||||
})
|
})
|
||||||
.failThrough();
|
.failThrough();
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -1,6 +1,5 @@
|
|||||||
package com.dfsek.terra.addons.biome.pipeline.api.delegate;
|
package com.dfsek.terra.addons.biome.pipeline.api.delegate;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,6 @@ import com.dfsek.tectonic.api.depth.DepthTracker;
|
|||||||
import com.dfsek.tectonic.api.exception.LoadException;
|
import com.dfsek.tectonic.api.exception.LoadException;
|
||||||
import com.dfsek.tectonic.api.loader.ConfigLoader;
|
import com.dfsek.tectonic.api.loader.ConfigLoader;
|
||||||
import com.dfsek.tectonic.api.loader.type.TypeLoader;
|
import com.dfsek.tectonic.api.loader.type.TypeLoader;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.lang.reflect.AnnotatedType;
|
import java.lang.reflect.AnnotatedType;
|
||||||
@@ -22,7 +21,8 @@ public class BiomeDelegateLoader implements TypeLoader<BiomeDelegate> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeDelegate load(@NotNull AnnotatedType t, @NotNull Object c, @NotNull ConfigLoader loader, DepthTracker depthTracker) throws LoadException {
|
public BiomeDelegate load(@NotNull AnnotatedType t, @NotNull Object c, @NotNull ConfigLoader loader, DepthTracker depthTracker)
|
||||||
|
throws LoadException {
|
||||||
if(c.equals("SELF")) return BiomeDelegate.self();
|
if(c.equals("SELF")) return BiomeDelegate.self();
|
||||||
return biomeRegistry
|
return biomeRegistry
|
||||||
.getByID((String) c)
|
.getByID((String) c)
|
||||||
|
|||||||
+1
-2
@@ -8,8 +8,6 @@
|
|||||||
package com.dfsek.terra.addons.chunkgenerator.generation;
|
package com.dfsek.terra.addons.chunkgenerator.generation;
|
||||||
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.world.info.WorldProperties;
|
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -26,6 +24,7 @@ import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
|||||||
import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator;
|
import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator;
|
||||||
import com.dfsek.terra.api.world.chunk.generation.ProtoChunk;
|
import com.dfsek.terra.api.world.chunk.generation.ProtoChunk;
|
||||||
import com.dfsek.terra.api.world.chunk.generation.util.Palette;
|
import com.dfsek.terra.api.world.chunk.generation.util.Palette;
|
||||||
|
import com.dfsek.terra.api.world.info.WorldProperties;
|
||||||
|
|
||||||
|
|
||||||
public class NoiseChunkGenerator3D implements ChunkGenerator {
|
public class NoiseChunkGenerator3D implements ChunkGenerator {
|
||||||
|
|||||||
+2
-5
@@ -8,12 +8,8 @@
|
|||||||
package com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation;
|
package com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
|
import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
|
||||||
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 java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
|
|
||||||
public class ElevationInterpolator {
|
public class ElevationInterpolator {
|
||||||
private final double[][] values = new double[18][18];
|
private final double[][] values = new double[18][18];
|
||||||
@@ -42,7 +38,8 @@ public class ElevationInterpolator {
|
|||||||
|
|
||||||
for(int xi = -smooth; xi <= smooth; xi++) {
|
for(int xi = -smooth; xi <= smooth; xi++) {
|
||||||
for(int zi = -smooth; zi <= smooth; zi++) {
|
for(int zi = -smooth; zi <= smooth; zi++) {
|
||||||
if(gens[x + 1 + smooth + xi][z + 1 + smooth + zi] != center) { // test referential equality because thats all we need to know
|
if(gens[x + 1 + smooth + xi][z + 1 + smooth + zi] !=
|
||||||
|
center) { // test referential equality because thats all we need to know
|
||||||
same = false;
|
same = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-12
@@ -17,23 +17,16 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.chunkgenerator.generation.math.samplers;
|
package com.dfsek.terra.addons.chunkgenerator.generation.math.samplers;
|
||||||
|
|
||||||
import com.dfsek.terra.api.world.info.WorldProperties;
|
|
||||||
|
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import com.google.common.cache.CacheLoader;
|
|
||||||
import com.google.common.cache.LoadingCache;
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.Platform;
|
|
||||||
import com.dfsek.terra.api.util.MathUtil;
|
|
||||||
import com.dfsek.terra.api.util.generic.pair.Pair;
|
|
||||||
import com.dfsek.terra.api.world.World;
|
|
||||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
|
||||||
|
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.Platform;
|
||||||
|
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||||
|
import com.dfsek.terra.api.world.info.WorldProperties;
|
||||||
|
|
||||||
|
|
||||||
public class SamplerProvider {
|
public class SamplerProvider {
|
||||||
private final Cache<WorldContext, Sampler3D> cache;
|
private final Cache<WorldContext, Sampler3D> cache;
|
||||||
@@ -53,7 +46,8 @@ public class SamplerProvider {
|
|||||||
public Sampler3D getChunk(int cx, int cz, WorldProperties world, BiomeProvider provider) {
|
public Sampler3D getChunk(int cx, int cz, WorldProperties world, BiomeProvider provider) {
|
||||||
WorldContext context = new WorldContext(cx, cz, world.getSeed(), world.getMinHeight(), world.getMaxHeight());
|
WorldContext context = new WorldContext(cx, cz, world.getSeed(), world.getMinHeight(), world.getMaxHeight());
|
||||||
try {
|
try {
|
||||||
return cache.get(context, () -> new Sampler3D(context.cx, context.cz, context.seed, context.minHeight, context.maxHeight, provider,
|
return cache.get(context,
|
||||||
|
() -> new Sampler3D(context.cx, context.cz, context.seed, context.minHeight, context.maxHeight, provider,
|
||||||
elevationSmooth));
|
elevationSmooth));
|
||||||
} catch(ExecutionException e) {
|
} catch(ExecutionException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|||||||
+1
-5
@@ -6,16 +6,12 @@ import cloud.commandframework.CommandManager;
|
|||||||
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;
|
||||||
import com.dfsek.terra.api.command.arguments.RegistryArgument;
|
|
||||||
import com.dfsek.terra.api.command.CommandSender;
|
import com.dfsek.terra.api.command.CommandSender;
|
||||||
import com.dfsek.terra.api.config.ConfigPack;
|
import com.dfsek.terra.api.command.arguments.RegistryArgument;
|
||||||
import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent;
|
import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent;
|
||||||
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
||||||
import com.dfsek.terra.api.inject.annotations.Inject;
|
import com.dfsek.terra.api.inject.annotations.Inject;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
|
|
||||||
public class AddonsCommandAddon implements AddonInitializer {
|
public class AddonsCommandAddon implements AddonInitializer {
|
||||||
@Inject
|
@Inject
|
||||||
|
|||||||
+3
-15
@@ -2,30 +2,18 @@ package com.dfsek.terra.addons.commands.packs;
|
|||||||
|
|
||||||
import cloud.commandframework.ArgumentDescription;
|
import cloud.commandframework.ArgumentDescription;
|
||||||
import cloud.commandframework.CommandManager;
|
import cloud.commandframework.CommandManager;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import cloud.commandframework.arguments.standard.EnumArgument;
|
import org.slf4j.LoggerFactory;
|
||||||
import cloud.commandframework.arguments.standard.LongArgument;
|
|
||||||
import cloud.commandframework.context.CommandContext;
|
|
||||||
|
|
||||||
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;
|
||||||
import com.dfsek.terra.api.command.arguments.RegistryArgument;
|
|
||||||
import com.dfsek.terra.api.command.CommandSender;
|
import com.dfsek.terra.api.command.CommandSender;
|
||||||
|
import com.dfsek.terra.api.command.arguments.RegistryArgument;
|
||||||
import com.dfsek.terra.api.config.ConfigPack;
|
import com.dfsek.terra.api.config.ConfigPack;
|
||||||
import com.dfsek.terra.api.entity.Entity;
|
|
||||||
import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent;
|
import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent;
|
||||||
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
||||||
import com.dfsek.terra.api.inject.annotations.Inject;
|
import com.dfsek.terra.api.inject.annotations.Inject;
|
||||||
import com.dfsek.terra.api.registry.Registry;
|
|
||||||
import com.dfsek.terra.api.structure.Structure;
|
|
||||||
import com.dfsek.terra.api.util.Rotation;
|
|
||||||
import com.dfsek.terra.api.util.reflection.TypeKey;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
|
|
||||||
public class PacksCommandAddon implements AddonInitializer {
|
public class PacksCommandAddon implements AddonInitializer {
|
||||||
|
|||||||
+2
-4
@@ -2,19 +2,17 @@ package com.dfsek.terra.addons.commands.profiler;
|
|||||||
|
|
||||||
import cloud.commandframework.ArgumentDescription;
|
import cloud.commandframework.ArgumentDescription;
|
||||||
import cloud.commandframework.CommandManager;
|
import cloud.commandframework.CommandManager;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
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;
|
||||||
import com.dfsek.terra.api.command.arguments.RegistryArgument;
|
|
||||||
import com.dfsek.terra.api.command.CommandSender;
|
import com.dfsek.terra.api.command.CommandSender;
|
||||||
import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent;
|
import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent;
|
||||||
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
||||||
import com.dfsek.terra.api.inject.annotations.Inject;
|
import com.dfsek.terra.api.inject.annotations.Inject;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
|
|
||||||
public class ProfilerCommandAddon implements AddonInitializer {
|
public class ProfilerCommandAddon implements AddonInitializer {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ProfilerCommandAddon.class);
|
private static final Logger logger = LoggerFactory.getLogger(ProfilerCommandAddon.class);
|
||||||
|
|||||||
+6
-8
@@ -2,16 +2,17 @@ package com.dfsek.terra.addons.commands.structure;
|
|||||||
|
|
||||||
import cloud.commandframework.ArgumentDescription;
|
import cloud.commandframework.ArgumentDescription;
|
||||||
import cloud.commandframework.CommandManager;
|
import cloud.commandframework.CommandManager;
|
||||||
|
|
||||||
import cloud.commandframework.arguments.standard.EnumArgument;
|
import cloud.commandframework.arguments.standard.EnumArgument;
|
||||||
import cloud.commandframework.arguments.standard.LongArgument;
|
import cloud.commandframework.arguments.standard.LongArgument;
|
||||||
import cloud.commandframework.context.CommandContext;
|
import cloud.commandframework.context.CommandContext;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
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;
|
||||||
import com.dfsek.terra.api.command.arguments.RegistryArgument;
|
|
||||||
import com.dfsek.terra.api.command.CommandSender;
|
import com.dfsek.terra.api.command.CommandSender;
|
||||||
|
import com.dfsek.terra.api.command.arguments.RegistryArgument;
|
||||||
import com.dfsek.terra.api.entity.Entity;
|
import com.dfsek.terra.api.entity.Entity;
|
||||||
import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent;
|
import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent;
|
||||||
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
||||||
@@ -21,8 +22,6 @@ import com.dfsek.terra.api.structure.Structure;
|
|||||||
import com.dfsek.terra.api.util.Rotation;
|
import com.dfsek.terra.api.util.Rotation;
|
||||||
import com.dfsek.terra.api.util.reflection.TypeKey;
|
import com.dfsek.terra.api.util.reflection.TypeKey;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
|
|
||||||
public class StructureCommandAddon implements AddonInitializer {
|
public class StructureCommandAddon implements AddonInitializer {
|
||||||
@Inject
|
@Inject
|
||||||
@@ -31,6 +30,9 @@ public class StructureCommandAddon implements AddonInitializer {
|
|||||||
@Inject
|
@Inject
|
||||||
private BaseAddon addon;
|
private BaseAddon addon;
|
||||||
|
|
||||||
|
private static Registry<Structure> getStructureRegistry(CommandContext<CommandSender> sender) {
|
||||||
|
return sender.getSender().getEntity().orElseThrow().world().getPack().getRegistry(Structure.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
@@ -62,8 +64,4 @@ public class StructureCommandAddon implements AddonInitializer {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Registry<Structure> getStructureRegistry(CommandContext<CommandSender> sender) {
|
|
||||||
return sender.getSender().getEntity().orElseThrow().world().getPack().getRegistry(Structure.class);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -13,10 +13,8 @@ import com.dfsek.tectonic.api.config.template.annotations.Final;
|
|||||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.dfsek.terra.api.Platform;
|
import com.dfsek.terra.api.Platform;
|
||||||
|
|||||||
+3
-3
@@ -11,6 +11,7 @@ import com.dfsek.tectonic.api.depth.DepthTracker;
|
|||||||
import com.dfsek.tectonic.api.exception.LoadException;
|
import com.dfsek.tectonic.api.exception.LoadException;
|
||||||
import com.dfsek.tectonic.api.loader.ConfigLoader;
|
import com.dfsek.tectonic.api.loader.ConfigLoader;
|
||||||
import com.dfsek.tectonic.api.loader.type.TypeLoader;
|
import com.dfsek.tectonic.api.loader.type.TypeLoader;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.lang.reflect.AnnotatedType;
|
import java.lang.reflect.AnnotatedType;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -18,13 +19,12 @@ import java.util.Map;
|
|||||||
|
|
||||||
import com.dfsek.terra.api.world.chunk.generation.util.Palette;
|
import com.dfsek.terra.api.world.chunk.generation.util.Palette;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
|
|
||||||
public class PaletteHolderLoader implements TypeLoader<PaletteHolder> {
|
public class PaletteHolderLoader implements TypeLoader<PaletteHolder> {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public PaletteHolder load(@NotNull AnnotatedType type, @NotNull Object o, @NotNull ConfigLoader configLoader, DepthTracker depthTracker) throws LoadException {
|
public PaletteHolder load(@NotNull AnnotatedType type, @NotNull Object o, @NotNull ConfigLoader configLoader, DepthTracker depthTracker)
|
||||||
|
throws LoadException {
|
||||||
List<Map<String, Integer>> palette = (List<Map<String, Integer>>) o;
|
List<Map<String, Integer>> palette = (List<Map<String, Integer>>) o;
|
||||||
PaletteHolderBuilder builder = new PaletteHolderBuilder();
|
PaletteHolderBuilder builder = new PaletteHolderBuilder();
|
||||||
for(Map<String, Integer> layer : palette) {
|
for(Map<String, Integer> layer : palette) {
|
||||||
|
|||||||
+2
-2
@@ -13,10 +13,10 @@ import java.util.function.Supplier;
|
|||||||
|
|
||||||
import com.dfsek.terra.addons.feature.distributor.config.AndDistributorTemplate;
|
import com.dfsek.terra.addons.feature.distributor.config.AndDistributorTemplate;
|
||||||
import com.dfsek.terra.addons.feature.distributor.config.NoDistributorTemplate;
|
import com.dfsek.terra.addons.feature.distributor.config.NoDistributorTemplate;
|
||||||
import com.dfsek.terra.addons.feature.distributor.config.PaddedGridDistributorTemplate;
|
|
||||||
import com.dfsek.terra.addons.feature.distributor.config.SamplerDistributorTemplate;
|
|
||||||
import com.dfsek.terra.addons.feature.distributor.config.OrDistributorTemplate;
|
import com.dfsek.terra.addons.feature.distributor.config.OrDistributorTemplate;
|
||||||
|
import com.dfsek.terra.addons.feature.distributor.config.PaddedGridDistributorTemplate;
|
||||||
import com.dfsek.terra.addons.feature.distributor.config.PointSetDistributorTemplate;
|
import com.dfsek.terra.addons.feature.distributor.config.PointSetDistributorTemplate;
|
||||||
|
import com.dfsek.terra.addons.feature.distributor.config.SamplerDistributorTemplate;
|
||||||
import com.dfsek.terra.addons.feature.distributor.config.XorDistributorTemplate;
|
import com.dfsek.terra.addons.feature.distributor.config.XorDistributorTemplate;
|
||||||
import com.dfsek.terra.addons.feature.distributor.config.YesDistributorTemplate;
|
import com.dfsek.terra.addons.feature.distributor.config.YesDistributorTemplate;
|
||||||
import com.dfsek.terra.addons.feature.distributor.util.Point;
|
import com.dfsek.terra.addons.feature.distributor.util.Point;
|
||||||
|
|||||||
+2
-2
@@ -12,11 +12,11 @@ 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.tectonic.api.exception.ValidationException;
|
import com.dfsek.tectonic.api.exception.ValidationException;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.dfsek.terra.api.config.meta.Meta;
|
import com.dfsek.terra.api.config.meta.Meta;
|
||||||
import com.dfsek.terra.api.structure.feature.Distributor;
|
import com.dfsek.terra.api.structure.feature.Distributor;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
public class XorDistributorTemplate implements ObjectTemplate<Distributor>, ValidatedConfigTemplate {
|
public class XorDistributorTemplate implements ObjectTemplate<Distributor>, ValidatedConfigTemplate {
|
||||||
@Value("distributors")
|
@Value("distributors")
|
||||||
|
|||||||
+12
-13
@@ -1,13 +1,12 @@
|
|||||||
package com.dfsek.terra.addons.feature.distributor.distributors;
|
package com.dfsek.terra.addons.feature.distributor.distributors;
|
||||||
|
|
||||||
import com.dfsek.terra.api.structure.feature.Distributor;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.util.MathUtil;
|
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.structure.feature.Distributor;
|
||||||
|
import com.dfsek.terra.api.util.MathUtil;
|
||||||
|
|
||||||
|
|
||||||
public class PaddedGridDistributor implements Distributor {
|
public class PaddedGridDistributor implements Distributor {
|
||||||
private final int width;
|
private final int width;
|
||||||
@@ -22,6 +21,15 @@ public class PaddedGridDistributor implements Distributor {
|
|||||||
this.cellWidth = width + padding;
|
this.cellWidth = width + padding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static long murmur64(long h) {
|
||||||
|
h ^= h >>> 33;
|
||||||
|
h *= 0xff51afd7ed558ccdL;
|
||||||
|
h ^= h >>> 33;
|
||||||
|
h *= 0xc4ceb9fe1a85ec53L;
|
||||||
|
h ^= h >>> 33;
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(int x, int z, long seed) {
|
public boolean matches(int x, int z, long seed) {
|
||||||
int cellX = FastMath.floorDiv(x, cellWidth);
|
int cellX = FastMath.floorDiv(x, cellWidth);
|
||||||
@@ -34,13 +42,4 @@ public class PaddedGridDistributor implements Distributor {
|
|||||||
|
|
||||||
return x == pointX && z == pointZ;
|
return x == pointX && z == pointZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static long murmur64(long h) {
|
|
||||||
h ^= h >>> 33;
|
|
||||||
h *= 0xff51afd7ed558ccdL;
|
|
||||||
h ^= h >>> 33;
|
|
||||||
h *= 0xc4ceb9fe1a85ec53L;
|
|
||||||
h ^= h >>> 33;
|
|
||||||
return h;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.flora.flora.gen;
|
package com.dfsek.terra.addons.flora.flora.gen;
|
||||||
|
|
||||||
import com.dfsek.terra.api.util.vector.Vector3Int;
|
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -24,6 +22,7 @@ import com.dfsek.terra.api.structure.Structure;
|
|||||||
import com.dfsek.terra.api.util.Rotation;
|
import com.dfsek.terra.api.util.Rotation;
|
||||||
import com.dfsek.terra.api.util.collection.MaterialSet;
|
import com.dfsek.terra.api.util.collection.MaterialSet;
|
||||||
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||||
|
import com.dfsek.terra.api.util.vector.Vector3Int;
|
||||||
import com.dfsek.terra.api.world.WritableWorld;
|
import com.dfsek.terra.api.world.WritableWorld;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -14,11 +14,11 @@ import java.util.function.Supplier;
|
|||||||
import com.dfsek.terra.addons.feature.locator.config.AdjacentPatternLocatorTemplate;
|
import com.dfsek.terra.addons.feature.locator.config.AdjacentPatternLocatorTemplate;
|
||||||
import com.dfsek.terra.addons.feature.locator.config.AndLocatorTemplate;
|
import com.dfsek.terra.addons.feature.locator.config.AndLocatorTemplate;
|
||||||
import com.dfsek.terra.addons.feature.locator.config.GaussianRandomLocatorTemplate;
|
import com.dfsek.terra.addons.feature.locator.config.GaussianRandomLocatorTemplate;
|
||||||
import com.dfsek.terra.addons.feature.locator.config.Sampler3DLocatorTemplate;
|
|
||||||
import com.dfsek.terra.addons.feature.locator.config.SamplerLocatorTemplate;
|
|
||||||
import com.dfsek.terra.addons.feature.locator.config.OrLocatorTemplate;
|
import com.dfsek.terra.addons.feature.locator.config.OrLocatorTemplate;
|
||||||
import com.dfsek.terra.addons.feature.locator.config.PatternLocatorTemplate;
|
import com.dfsek.terra.addons.feature.locator.config.PatternLocatorTemplate;
|
||||||
import com.dfsek.terra.addons.feature.locator.config.RandomLocatorTemplate;
|
import com.dfsek.terra.addons.feature.locator.config.RandomLocatorTemplate;
|
||||||
|
import com.dfsek.terra.addons.feature.locator.config.Sampler3DLocatorTemplate;
|
||||||
|
import com.dfsek.terra.addons.feature.locator.config.SamplerLocatorTemplate;
|
||||||
import com.dfsek.terra.addons.feature.locator.config.SurfaceLocatorTemplate;
|
import com.dfsek.terra.addons.feature.locator.config.SurfaceLocatorTemplate;
|
||||||
import com.dfsek.terra.addons.feature.locator.config.TopLocatorTemplate;
|
import com.dfsek.terra.addons.feature.locator.config.TopLocatorTemplate;
|
||||||
import com.dfsek.terra.addons.feature.locator.config.XorLocatorTemplate;
|
import com.dfsek.terra.addons.feature.locator.config.XorLocatorTemplate;
|
||||||
|
|||||||
-1
@@ -11,7 +11,6 @@ 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.feature.locator.locators.SurfaceLocator;
|
import com.dfsek.terra.addons.feature.locator.locators.SurfaceLocator;
|
||||||
import com.dfsek.terra.api.Platform;
|
|
||||||
import com.dfsek.terra.api.config.meta.Meta;
|
import com.dfsek.terra.api.config.meta.Meta;
|
||||||
import com.dfsek.terra.api.structure.feature.Locator;
|
import com.dfsek.terra.api.structure.feature.Locator;
|
||||||
import com.dfsek.terra.api.util.Range;
|
import com.dfsek.terra.api.util.Range;
|
||||||
|
|||||||
-2
@@ -10,9 +10,7 @@ package com.dfsek.terra.addons.feature.locator.config;
|
|||||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
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.feature.locator.locators.SurfaceLocator;
|
|
||||||
import com.dfsek.terra.addons.feature.locator.locators.TopLocator;
|
import com.dfsek.terra.addons.feature.locator.locators.TopLocator;
|
||||||
import com.dfsek.terra.api.Platform;
|
|
||||||
import com.dfsek.terra.api.config.meta.Meta;
|
import com.dfsek.terra.api.config.meta.Meta;
|
||||||
import com.dfsek.terra.api.structure.feature.Locator;
|
import com.dfsek.terra.api.structure.feature.Locator;
|
||||||
import com.dfsek.terra.api.util.Range;
|
import com.dfsek.terra.api.util.Range;
|
||||||
|
|||||||
+2
-2
@@ -12,11 +12,11 @@ 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.tectonic.api.exception.ValidationException;
|
import com.dfsek.tectonic.api.exception.ValidationException;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.dfsek.terra.api.config.meta.Meta;
|
import com.dfsek.terra.api.config.meta.Meta;
|
||||||
import com.dfsek.terra.api.structure.feature.Locator;
|
import com.dfsek.terra.api.structure.feature.Locator;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
public class XorLocatorTemplate implements ObjectTemplate<Locator>, ValidatedConfigTemplate {
|
public class XorLocatorTemplate implements ObjectTemplate<Locator>, ValidatedConfigTemplate {
|
||||||
@Value("locators")
|
@Value("locators")
|
||||||
|
|||||||
+2
-2
@@ -12,11 +12,11 @@ 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.tectonic.api.exception.ValidationException;
|
import com.dfsek.tectonic.api.exception.ValidationException;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.feature.locator.patterns.Pattern;
|
import com.dfsek.terra.addons.feature.locator.patterns.Pattern;
|
||||||
import com.dfsek.terra.api.config.meta.Meta;
|
import com.dfsek.terra.api.config.meta.Meta;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
public class XorPatternTemplate implements ObjectTemplate<Pattern>, ValidatedConfigTemplate {
|
public class XorPatternTemplate implements ObjectTemplate<Pattern>, ValidatedConfigTemplate {
|
||||||
@Value("patterns")
|
@Value("patterns")
|
||||||
|
|||||||
+2
-2
@@ -7,14 +7,14 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.feature.locator.locators;
|
package com.dfsek.terra.addons.feature.locator.locators;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.dfsek.terra.api.structure.feature.BinaryColumn;
|
import com.dfsek.terra.api.structure.feature.BinaryColumn;
|
||||||
import com.dfsek.terra.api.structure.feature.Locator;
|
import com.dfsek.terra.api.structure.feature.Locator;
|
||||||
import com.dfsek.terra.api.util.Range;
|
import com.dfsek.terra.api.util.Range;
|
||||||
import com.dfsek.terra.api.world.chunk.generation.util.Column;
|
import com.dfsek.terra.api.world.chunk.generation.util.Column;
|
||||||
import com.dfsek.terra.api.world.chunk.generation.util.Column.BinaryColumnBuilder;
|
import com.dfsek.terra.api.world.chunk.generation.util.Column.BinaryColumnBuilder;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
|
|
||||||
public class GaussianRandomLocator implements Locator {
|
public class GaussianRandomLocator implements Locator {
|
||||||
private final double mean;
|
private final double mean;
|
||||||
|
|||||||
+1
-2
@@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.feature.locator.locators;
|
package com.dfsek.terra.addons.feature.locator.locators;
|
||||||
|
|
||||||
import com.dfsek.terra.api.world.chunk.generation.util.Column.BinaryColumnBuilder;
|
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -17,6 +15,7 @@ import com.dfsek.terra.api.noise.NoiseSampler;
|
|||||||
import com.dfsek.terra.api.structure.feature.BinaryColumn;
|
import com.dfsek.terra.api.structure.feature.BinaryColumn;
|
||||||
import com.dfsek.terra.api.structure.feature.Locator;
|
import com.dfsek.terra.api.structure.feature.Locator;
|
||||||
import com.dfsek.terra.api.world.chunk.generation.util.Column;
|
import com.dfsek.terra.api.world.chunk.generation.util.Column;
|
||||||
|
import com.dfsek.terra.api.world.chunk.generation.util.Column.BinaryColumnBuilder;
|
||||||
|
|
||||||
|
|
||||||
public class SamplerLocator implements Locator {
|
public class SamplerLocator implements Locator {
|
||||||
|
|||||||
+2
-2
@@ -2,12 +2,12 @@ package com.dfsek.terra.addons.noise.config.templates;
|
|||||||
|
|
||||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||||
|
|
||||||
|
import java.util.function.BiFunction;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.noise.samplers.arithmetic.BinaryArithmeticSampler;
|
import com.dfsek.terra.addons.noise.samplers.arithmetic.BinaryArithmeticSampler;
|
||||||
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 java.util.function.BiFunction;
|
|
||||||
|
|
||||||
|
|
||||||
public class BinaryArithmeticTemplate<T extends BinaryArithmeticSampler> extends SamplerTemplate<T> {
|
public class BinaryArithmeticTemplate<T extends BinaryArithmeticSampler> extends SamplerTemplate<T> {
|
||||||
private final BiFunction<NoiseSampler, NoiseSampler, T> function;
|
private final BiFunction<NoiseSampler, NoiseSampler, T> function;
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package com.dfsek.terra.addons.noise.samplers.arithmetic;
|
package com.dfsek.terra.addons.noise.samplers.arithmetic;
|
||||||
|
|
||||||
import com.dfsek.terra.api.noise.NoiseSampler;
|
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.noise.NoiseSampler;
|
||||||
|
|
||||||
|
|
||||||
public class MaxSampler extends BinaryArithmeticSampler {
|
public class MaxSampler extends BinaryArithmeticSampler {
|
||||||
public MaxSampler(NoiseSampler left, NoiseSampler right) {
|
public MaxSampler(NoiseSampler left, NoiseSampler right) {
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package com.dfsek.terra.addons.noise.samplers.arithmetic;
|
package com.dfsek.terra.addons.noise.samplers.arithmetic;
|
||||||
|
|
||||||
import com.dfsek.terra.api.noise.NoiseSampler;
|
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.noise.NoiseSampler;
|
||||||
|
|
||||||
|
|
||||||
public class MinSampler extends BinaryArithmeticSampler {
|
public class MinSampler extends BinaryArithmeticSampler {
|
||||||
public MinSampler(NoiseSampler left, NoiseSampler right) {
|
public MinSampler(NoiseSampler left, NoiseSampler right) {
|
||||||
|
|||||||
+1
-1
@@ -18,10 +18,10 @@ public class GaborNoiseSampler extends NoiseFunction {
|
|||||||
private double a = 0.1;
|
private double a = 0.1;
|
||||||
private double f0 = 0.625;
|
private double f0 = 0.625;
|
||||||
private double kernelRadius = (FastMath.sqrt(-FastMath.log(0.05) / Math.PI) / a);
|
private double kernelRadius = (FastMath.sqrt(-FastMath.log(0.05) / Math.PI) / a);
|
||||||
private double impulsesPerKernel = 64d;
|
|
||||||
private double impulseDensity = (impulsesPerKernel / (Math.PI * kernelRadius * kernelRadius));
|
private double impulseDensity = (impulsesPerKernel / (Math.PI * kernelRadius * kernelRadius));
|
||||||
private double impulsesPerCell = impulseDensity * kernelRadius * kernelRadius;
|
private double impulsesPerCell = impulseDensity * kernelRadius * kernelRadius;
|
||||||
private double g = FastMath.exp(-impulsesPerCell);
|
private double g = FastMath.exp(-impulsesPerCell);
|
||||||
|
private double impulsesPerKernel = 64d;
|
||||||
private double omega0 = Math.PI * 0.25;
|
private double omega0 = Math.PI * 0.25;
|
||||||
private boolean isotropic = true;
|
private boolean isotropic = true;
|
||||||
|
|
||||||
|
|||||||
-3
@@ -7,9 +7,6 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.noise.samplers.noise.random;
|
package com.dfsek.terra.addons.noise.samplers.noise.random;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.noise.samplers.noise.NoiseFunction;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NoiseSampler implementation to produce random, uniformly distributed (white) noise.
|
* NoiseSampler implementation to produce random, uniformly distributed (white) noise.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public class OreFactory implements ConfigFactory<OreTemplate, Structure> {
|
|||||||
@Override
|
@Override
|
||||||
public VanillaOre build(OreTemplate config, Platform platform) {
|
public VanillaOre build(OreTemplate config, Platform platform) {
|
||||||
BlockState m = config.getMaterial();
|
BlockState m = config.getMaterial();
|
||||||
return new VanillaOre(m, config.getSize(), config.getReplaceable(), config.doPhysics(), config.isExposed(), config.getMaterialOverrides());
|
return new VanillaOre(m, config.getSize(), config.getReplaceable(), config.doPhysics(), config.isExposed(),
|
||||||
|
config.getMaterialOverrides());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.ore.ores;
|
package com.dfsek.terra.addons.ore.ores;
|
||||||
|
|
||||||
import com.dfsek.terra.api.util.vector.Vector3Int;
|
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -19,6 +17,7 @@ import com.dfsek.terra.api.block.state.BlockState;
|
|||||||
import com.dfsek.terra.api.structure.Structure;
|
import com.dfsek.terra.api.structure.Structure;
|
||||||
import com.dfsek.terra.api.util.Rotation;
|
import com.dfsek.terra.api.util.Rotation;
|
||||||
import com.dfsek.terra.api.util.collection.MaterialSet;
|
import com.dfsek.terra.api.util.collection.MaterialSet;
|
||||||
|
import com.dfsek.terra.api.util.vector.Vector3Int;
|
||||||
import com.dfsek.terra.api.world.WritableWorld;
|
import com.dfsek.terra.api.world.WritableWorld;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
-7
@@ -7,17 +7,10 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.palette;
|
package com.dfsek.terra.addons.palette;
|
||||||
|
|
||||||
import com.dfsek.tectonic.api.exception.LoadException;
|
|
||||||
import com.dfsek.tectonic.api.loader.type.TypeLoader;
|
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
import com.dfsek.terra.addons.palette.palette.PaletteImpl;
|
|
||||||
import com.dfsek.terra.api.Platform;
|
import com.dfsek.terra.api.Platform;
|
||||||
import com.dfsek.terra.api.config.ConfigFactory;
|
import com.dfsek.terra.api.config.ConfigFactory;
|
||||||
import com.dfsek.terra.api.config.ConfigPack;
|
import com.dfsek.terra.api.config.ConfigPack;
|
||||||
import com.dfsek.terra.api.config.ConfigType;
|
import com.dfsek.terra.api.config.ConfigType;
|
||||||
import com.dfsek.terra.api.registry.OpenRegistry;
|
|
||||||
import com.dfsek.terra.api.util.reflection.TypeKey;
|
import com.dfsek.terra.api.util.reflection.TypeKey;
|
||||||
import com.dfsek.terra.api.world.chunk.generation.util.Palette;
|
import com.dfsek.terra.api.world.chunk.generation.util.Palette;
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -7,14 +7,14 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.palette.palette;
|
package com.dfsek.terra.addons.palette.palette;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.dfsek.terra.api.block.state.BlockState;
|
import com.dfsek.terra.api.block.state.BlockState;
|
||||||
import com.dfsek.terra.api.noise.NoiseSampler;
|
import com.dfsek.terra.api.noise.NoiseSampler;
|
||||||
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||||
import com.dfsek.terra.api.world.chunk.generation.util.Palette;
|
import com.dfsek.terra.api.world.chunk.generation.util.Palette;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class representation of a "slice" of the world.
|
* A class representation of a "slice" of the world.
|
||||||
|
|||||||
-9
@@ -10,20 +10,11 @@ package com.dfsek.terra.addons.palette.palette;
|
|||||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
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.tectonic.api.depth.DepthTracker;
|
|
||||||
import com.dfsek.tectonic.api.exception.LoadException;
|
|
||||||
import com.dfsek.tectonic.api.loader.ConfigLoader;
|
|
||||||
import com.dfsek.tectonic.api.loader.type.TypeLoader;
|
|
||||||
|
|
||||||
import java.lang.reflect.AnnotatedType;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.block.state.BlockState;
|
import com.dfsek.terra.api.block.state.BlockState;
|
||||||
import com.dfsek.terra.api.noise.NoiseSampler;
|
import com.dfsek.terra.api.noise.NoiseSampler;
|
||||||
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
|
|
||||||
public class PaletteLayerLoader implements ObjectTemplate<PaletteLayerHolder> {
|
public class PaletteLayerLoader implements ObjectTemplate<PaletteLayerHolder> {
|
||||||
@Value("materials")
|
@Value("materials")
|
||||||
|
|||||||
+1
-1
@@ -13,8 +13,8 @@ import java.util.Random;
|
|||||||
import com.dfsek.terra.addons.generation.feature.config.BiomeFeatures;
|
import com.dfsek.terra.addons.generation.feature.config.BiomeFeatures;
|
||||||
import com.dfsek.terra.api.Platform;
|
import com.dfsek.terra.api.Platform;
|
||||||
import com.dfsek.terra.api.profiler.ProfileFrame;
|
import com.dfsek.terra.api.profiler.ProfileFrame;
|
||||||
import com.dfsek.terra.api.util.Rotation;
|
|
||||||
import com.dfsek.terra.api.registry.key.StringIdentifiable;
|
import com.dfsek.terra.api.registry.key.StringIdentifiable;
|
||||||
|
import com.dfsek.terra.api.util.Rotation;
|
||||||
import com.dfsek.terra.api.util.vector.Vector3Int;
|
import com.dfsek.terra.api.util.vector.Vector3Int;
|
||||||
import com.dfsek.terra.api.world.WritableWorld;
|
import com.dfsek.terra.api.world.WritableWorld;
|
||||||
import com.dfsek.terra.api.world.chunk.generation.ProtoWorld;
|
import com.dfsek.terra.api.world.chunk.generation.ProtoWorld;
|
||||||
|
|||||||
-3
@@ -9,9 +9,6 @@ package com.dfsek.terra.addons.manifest.impl;
|
|||||||
|
|
||||||
import ca.solostudios.strata.version.Version;
|
import ca.solostudios.strata.version.Version;
|
||||||
import ca.solostudios.strata.version.VersionRange;
|
import ca.solostudios.strata.version.VersionRange;
|
||||||
|
|
||||||
import com.dfsek.terra.api.inject.impl.InjectorImpl;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -21,7 +21,8 @@ import java.lang.reflect.AnnotatedType;
|
|||||||
|
|
||||||
public class VersionLoader implements TypeLoader<Version> {
|
public class VersionLoader implements TypeLoader<Version> {
|
||||||
@Override
|
@Override
|
||||||
public Version load(@NotNull AnnotatedType t, @NotNull Object c, @NotNull ConfigLoader loader, DepthTracker depthTracker) throws LoadException {
|
public Version load(@NotNull AnnotatedType t, @NotNull Object c, @NotNull ConfigLoader loader, DepthTracker depthTracker)
|
||||||
|
throws LoadException {
|
||||||
try {
|
try {
|
||||||
return Versions.parseVersion((String) c);
|
return Versions.parseVersion((String) c);
|
||||||
} catch(ParseException e) {
|
} catch(ParseException e) {
|
||||||
|
|||||||
+2
-1
@@ -21,7 +21,8 @@ import java.lang.reflect.AnnotatedType;
|
|||||||
|
|
||||||
public class VersionRangeLoader implements TypeLoader<VersionRange> {
|
public class VersionRangeLoader implements TypeLoader<VersionRange> {
|
||||||
@Override
|
@Override
|
||||||
public VersionRange load(@NotNull AnnotatedType t, @NotNull Object c, @NotNull ConfigLoader loader, DepthTracker depthTracker) throws LoadException {
|
public VersionRange load(@NotNull AnnotatedType t, @NotNull Object c, @NotNull ConfigLoader loader, DepthTracker depthTracker)
|
||||||
|
throws LoadException {
|
||||||
try {
|
try {
|
||||||
return Versions.parseVersionRange((String) c);
|
return Versions.parseVersionRange((String) c);
|
||||||
} catch(ParseException e) {
|
} catch(ParseException e) {
|
||||||
|
|||||||
+2
-1
@@ -23,7 +23,8 @@ public class PaletteBlockShortcutAddon implements AddonInitializer {
|
|||||||
.register(addon, ConfigPackPreLoadEvent.class)
|
.register(addon, ConfigPackPreLoadEvent.class)
|
||||||
.then(event -> event.getPack()
|
.then(event -> event.getPack()
|
||||||
.registerShortcut(Palette.class, "BLOCK",
|
.registerShortcut(Palette.class, "BLOCK",
|
||||||
(configLoader, input, tracker) -> new SingletonPalette(configLoader.loadType(BlockState.class, input, tracker))))
|
(configLoader, input, tracker) -> new SingletonPalette(
|
||||||
|
configLoader.loadType(BlockState.class, input, tracker))))
|
||||||
.failThrough();
|
.failThrough();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -1,14 +1,13 @@
|
|||||||
package com.dfsek.terra.addons.palette.shortcut.block;
|
package com.dfsek.terra.addons.palette.shortcut.block;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.dfsek.terra.api.block.state.BlockState;
|
import com.dfsek.terra.api.block.state.BlockState;
|
||||||
import com.dfsek.terra.api.registry.key.RegistryKey;
|
|
||||||
import com.dfsek.terra.api.structure.Structure;
|
import com.dfsek.terra.api.structure.Structure;
|
||||||
import com.dfsek.terra.api.util.Rotation;
|
import com.dfsek.terra.api.util.Rotation;
|
||||||
import com.dfsek.terra.api.util.vector.Vector3Int;
|
import com.dfsek.terra.api.util.vector.Vector3Int;
|
||||||
import com.dfsek.terra.api.world.WritableWorld;
|
import com.dfsek.terra.api.world.WritableWorld;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
|
|
||||||
public class SingletonStructure implements Structure {
|
public class SingletonStructure implements Structure {
|
||||||
private final BlockState blockState;
|
private final BlockState blockState;
|
||||||
|
|||||||
+2
-1
@@ -23,7 +23,8 @@ public class StructureBlockShortcutAddon implements AddonInitializer {
|
|||||||
.register(addon, ConfigPackPreLoadEvent.class)
|
.register(addon, ConfigPackPreLoadEvent.class)
|
||||||
.then(event -> event.getPack()
|
.then(event -> event.getPack()
|
||||||
.registerShortcut(Structure.class, "BLOCK",
|
.registerShortcut(Structure.class, "BLOCK",
|
||||||
(configLoader, input, tracker) -> new SingletonStructure(configLoader.loadType(BlockState.class, input, tracker)
|
(configLoader, input, tracker) -> new SingletonStructure(
|
||||||
|
configLoader.loadType(BlockState.class, input, tracker)
|
||||||
)))
|
)))
|
||||||
.failThrough();
|
.failThrough();
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,7 @@
|
|||||||
package com.dfsek.terra.addons.structure.mutator;
|
package com.dfsek.terra.addons.structure.mutator;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.dfsek.terra.api.registry.key.Keyed;
|
import com.dfsek.terra.api.registry.key.Keyed;
|
||||||
import com.dfsek.terra.api.registry.key.RegistryKey;
|
import com.dfsek.terra.api.registry.key.RegistryKey;
|
||||||
import com.dfsek.terra.api.structure.Structure;
|
import com.dfsek.terra.api.structure.Structure;
|
||||||
@@ -9,8 +11,6 @@ import com.dfsek.terra.api.world.WritableWorld;
|
|||||||
import com.dfsek.terra.api.world.util.ReadInterceptor;
|
import com.dfsek.terra.api.world.util.ReadInterceptor;
|
||||||
import com.dfsek.terra.api.world.util.WriteInterceptor;
|
import com.dfsek.terra.api.world.util.WriteInterceptor;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
|
|
||||||
public class MutatedStructure implements Structure, Keyed<MutatedStructure> {
|
public class MutatedStructure implements Structure, Keyed<MutatedStructure> {
|
||||||
private final RegistryKey key;
|
private final RegistryKey key;
|
||||||
|
|||||||
-2
@@ -1,7 +1,5 @@
|
|||||||
package com.dfsek.terra.addons.structure.mutator.config;
|
package com.dfsek.terra.addons.structure.mutator.config;
|
||||||
|
|
||||||
import com.dfsek.tectonic.api.config.template.ConfigTemplate;
|
|
||||||
|
|
||||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||||
|
|
||||||
import com.dfsek.terra.api.config.AbstractableTemplate;
|
import com.dfsek.terra.api.config.AbstractableTemplate;
|
||||||
|
|||||||
-2
@@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.terrascript;
|
package com.dfsek.terra.addons.terrascript;
|
||||||
|
|
||||||
import com.dfsek.tectonic.api.exception.LoadException;
|
|
||||||
|
|
||||||
import com.dfsek.terra.addons.manifest.api.AddonInitializer;
|
import com.dfsek.terra.addons.manifest.api.AddonInitializer;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.exceptions.ParseException;
|
import com.dfsek.terra.addons.terrascript.parser.exceptions.ParseException;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.FunctionBuilder;
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.FunctionBuilder;
|
||||||
|
|||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
package com.dfsek.terra.addons.terrascript.parser.lang;
|
package com.dfsek.terra.addons.terrascript.parser.lang;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.variables.Variable;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.variables.Variable;
|
||||||
|
|
||||||
|
|
||||||
public class Scope {
|
public class Scope {
|
||||||
private static final Scope NULL = new Scope() {
|
private static final Scope NULL = new Scope() {
|
||||||
|
|||||||
+5
-1
@@ -7,11 +7,15 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.terrascript.parser.lang.keywords.looplike;
|
package com.dfsek.terra.addons.terrascript.parser.lang.keywords.looplike;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.*;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Block;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Keyword;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -7,7 +7,11 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.terrascript.parser.lang.keywords.looplike;
|
package com.dfsek.terra.addons.terrascript.parser.lang.keywords.looplike;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.*;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Block;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Keyword;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-4
@@ -7,10 +7,6 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.terrascript.script;
|
package com.dfsek.terra.addons.terrascript.script;
|
||||||
|
|
||||||
import com.dfsek.terra.api.registry.key.Keyed;
|
|
||||||
import com.dfsek.terra.api.registry.key.RegistryKey;
|
|
||||||
import com.dfsek.terra.api.util.vector.Vector3Int;
|
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -45,9 +41,12 @@ import com.dfsek.terra.addons.terrascript.script.builders.ZeroArgFunctionBuilder
|
|||||||
import com.dfsek.terra.api.Platform;
|
import com.dfsek.terra.api.Platform;
|
||||||
import com.dfsek.terra.api.profiler.ProfileFrame;
|
import com.dfsek.terra.api.profiler.ProfileFrame;
|
||||||
import com.dfsek.terra.api.registry.Registry;
|
import com.dfsek.terra.api.registry.Registry;
|
||||||
|
import com.dfsek.terra.api.registry.key.Keyed;
|
||||||
|
import com.dfsek.terra.api.registry.key.RegistryKey;
|
||||||
import com.dfsek.terra.api.structure.LootTable;
|
import com.dfsek.terra.api.structure.LootTable;
|
||||||
import com.dfsek.terra.api.structure.Structure;
|
import com.dfsek.terra.api.structure.Structure;
|
||||||
import com.dfsek.terra.api.util.Rotation;
|
import com.dfsek.terra.api.util.Rotation;
|
||||||
|
import com.dfsek.terra.api.util.vector.Vector3Int;
|
||||||
import com.dfsek.terra.api.world.WritableWorld;
|
import com.dfsek.terra.api.world.WritableWorld;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -24,8 +24,8 @@ public class TerraImplementationArguments implements ImplementationArguments {
|
|||||||
private final WritableWorld world;
|
private final WritableWorld world;
|
||||||
private final Map<Vector3, String> marks = new HashMap<>();
|
private final Map<Vector3, String> marks = new HashMap<>();
|
||||||
private final int recursions;
|
private final int recursions;
|
||||||
private boolean waterlog = false;
|
|
||||||
private final Vector3Int origin;
|
private final Vector3Int origin;
|
||||||
|
private boolean waterlog = false;
|
||||||
|
|
||||||
public TerraImplementationArguments(Vector3Int origin, Rotation rotation, Random random, WritableWorld world, int recursions) {
|
public TerraImplementationArguments(Vector3Int origin, Rotation rotation, Random random, WritableWorld world, int recursions) {
|
||||||
this.rotation = rotation;
|
this.rotation = rotation;
|
||||||
|
|||||||
+1
-1
@@ -7,11 +7,11 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||||
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
|
|||||||
+4
-7
@@ -7,30 +7,27 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
|
||||||
import com.dfsek.terra.api.block.state.properties.base.Properties;
|
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.constants.StringConstant;
|
import com.dfsek.terra.addons.terrascript.parser.lang.constants.StringConstant;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.variables.Variable;
|
|
||||||
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
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.block.state.properties.base.Properties;
|
||||||
import com.dfsek.terra.api.util.RotationUtil;
|
import com.dfsek.terra.api.util.RotationUtil;
|
||||||
import com.dfsek.terra.api.util.vector.Vector2;
|
import com.dfsek.terra.api.util.vector.Vector2;
|
||||||
import com.dfsek.terra.api.util.vector.Vector3;
|
import com.dfsek.terra.api.util.vector.Vector3;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
|
|
||||||
public class BlockFunction implements Function<Void> {
|
public class BlockFunction implements Function<Void> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(BlockFunction.class);
|
private static final Logger logger = LoggerFactory.getLogger(BlockFunction.class);
|
||||||
|
|||||||
+1
-1
@@ -7,11 +7,11 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||||
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
|
|||||||
+6
-1
@@ -48,7 +48,12 @@ public class EntityFunction implements Function<Void> {
|
|||||||
Vector2 xz = RotationUtil.rotateVector(Vector2.of(x.apply(implementationArguments, scope).doubleValue(),
|
Vector2 xz = RotationUtil.rotateVector(Vector2.of(x.apply(implementationArguments, scope).doubleValue(),
|
||||||
z.apply(implementationArguments, scope).doubleValue()), arguments.getRotation());
|
z.apply(implementationArguments, scope).doubleValue()), arguments.getRotation());
|
||||||
|
|
||||||
Entity entity = arguments.getWorld().spawnEntity(Vector3.of(xz.getX(), y.apply(implementationArguments, scope).doubleValue(), xz.getZ()).mutable().add(arguments.getOrigin()).add(0.5, 0, 0.5).immutable(), data);
|
Entity entity = arguments.getWorld().spawnEntity(Vector3.of(xz.getX(), y.apply(implementationArguments, scope).doubleValue(),
|
||||||
|
xz.getZ())
|
||||||
|
.mutable()
|
||||||
|
.add(arguments.getOrigin())
|
||||||
|
.add(0.5, 0, 0.5)
|
||||||
|
.immutable(), data);
|
||||||
platform.getEventManager().callEvent(new EntitySpawnEvent(entity.world().getPack(), entity));
|
platform.getEventManager().callEvent(new EntitySpawnEvent(entity.world().getPack(), entity));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -7,11 +7,11 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||||
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
@@ -38,7 +38,11 @@ public class GetMarkFunction implements Function<String> {
|
|||||||
z.apply(implementationArguments, scope).doubleValue()), arguments.getRotation());
|
z.apply(implementationArguments, scope).doubleValue()), arguments.getRotation());
|
||||||
|
|
||||||
String mark = arguments.getMark(Vector3.of(FastMath.floorToInt(xz.getX()), FastMath.floorToInt(
|
String mark = arguments.getMark(Vector3.of(FastMath.floorToInt(xz.getX()), FastMath.floorToInt(
|
||||||
y.apply(implementationArguments, scope).doubleValue()), FastMath.floorToInt(xz.getZ())).mutable().add(arguments.getOrigin()).immutable());
|
y.apply(implementationArguments, scope).doubleValue()),
|
||||||
|
FastMath.floorToInt(xz.getZ()))
|
||||||
|
.mutable()
|
||||||
|
.add(arguments.getOrigin())
|
||||||
|
.immutable());
|
||||||
return mark == null ? "" : mark;
|
return mark == null ? "" : mark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-8
@@ -7,14 +7,6 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
|
||||||
import com.dfsek.terra.api.block.entity.BlockEntity;
|
|
||||||
import com.dfsek.terra.api.block.entity.Container;
|
|
||||||
import com.dfsek.terra.api.event.events.world.generation.LootPopulateEvent;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.registry.key.RegistryKey;
|
|
||||||
import com.dfsek.terra.api.util.vector.Vector3;
|
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -23,15 +15,21 @@ import java.util.Random;
|
|||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||||
import com.dfsek.terra.addons.terrascript.script.StructureScript;
|
import com.dfsek.terra.addons.terrascript.script.StructureScript;
|
||||||
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
import com.dfsek.terra.api.Platform;
|
import com.dfsek.terra.api.Platform;
|
||||||
|
import com.dfsek.terra.api.block.entity.BlockEntity;
|
||||||
|
import com.dfsek.terra.api.block.entity.Container;
|
||||||
|
import com.dfsek.terra.api.event.events.world.generation.LootPopulateEvent;
|
||||||
import com.dfsek.terra.api.registry.Registry;
|
import com.dfsek.terra.api.registry.Registry;
|
||||||
|
import com.dfsek.terra.api.registry.key.RegistryKey;
|
||||||
import com.dfsek.terra.api.structure.LootTable;
|
import com.dfsek.terra.api.structure.LootTable;
|
||||||
import com.dfsek.terra.api.util.RotationUtil;
|
import com.dfsek.terra.api.util.RotationUtil;
|
||||||
import com.dfsek.terra.api.util.vector.Vector2;
|
import com.dfsek.terra.api.util.vector.Vector2;
|
||||||
|
import com.dfsek.terra.api.util.vector.Vector3;
|
||||||
|
|
||||||
|
|
||||||
public class LootFunction implements Function<Void> {
|
public class LootFunction implements Function<Void> {
|
||||||
|
|||||||
+1
-1
@@ -7,12 +7,12 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.exceptions.ParseException;
|
import com.dfsek.terra.addons.terrascript.parser.exceptions.ParseException;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.constants.ConstantExpression;
|
import com.dfsek.terra.addons.terrascript.parser.lang.constants.ConstantExpression;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||||
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||||
|
|||||||
+3
-2
@@ -7,11 +7,11 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||||
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
@@ -43,7 +43,8 @@ public class SetMarkFunction implements Function<Void> {
|
|||||||
arguments.setMark(Vector3.of(FastMath.floorToInt(xz.getX()),
|
arguments.setMark(Vector3.of(FastMath.floorToInt(xz.getX()),
|
||||||
FastMath.floorToInt(
|
FastMath.floorToInt(
|
||||||
y.apply(implementationArguments, scope).doubleValue()),
|
y.apply(implementationArguments, scope).doubleValue()),
|
||||||
FastMath.floorToInt(xz.getZ())).mutable().add(arguments.getOrigin()).immutable(), mark.apply(implementationArguments, scope));
|
FastMath.floorToInt(xz.getZ())).mutable().add(arguments.getOrigin()).immutable(),
|
||||||
|
mark.apply(implementationArguments, scope));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-6
@@ -7,23 +7,21 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
|
||||||
import com.dfsek.terra.api.block.entity.BlockEntity;
|
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||||
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
|
import com.dfsek.terra.api.block.entity.BlockEntity;
|
||||||
import com.dfsek.terra.api.util.RotationUtil;
|
import com.dfsek.terra.api.util.RotationUtil;
|
||||||
import com.dfsek.terra.api.util.vector.Vector2;
|
import com.dfsek.terra.api.util.vector.Vector2;
|
||||||
import com.dfsek.terra.api.util.vector.Vector3;
|
import com.dfsek.terra.api.util.vector.Vector3;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
|
|
||||||
public class StateFunction implements Function<Void> {
|
public class StateFunction implements Function<Void> {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(StateFunction.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(StateFunction.class);
|
||||||
|
|||||||
+2
-3
@@ -7,9 +7,6 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
|
||||||
import com.dfsek.terra.addons.terrascript.script.StructureScript;
|
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -18,7 +15,9 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||||
|
import com.dfsek.terra.addons.terrascript.script.StructureScript;
|
||||||
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
import com.dfsek.terra.api.Platform;
|
import com.dfsek.terra.api.Platform;
|
||||||
|
|||||||
@@ -8,13 +8,11 @@
|
|||||||
package structure;
|
package structure;
|
||||||
|
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.Parser;
|
import com.dfsek.terra.addons.terrascript.parser.Parser;
|
||||||
@@ -22,6 +20,7 @@ import com.dfsek.terra.addons.terrascript.parser.exceptions.ParseException;
|
|||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Block;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Block;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.FunctionBuilder;
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.FunctionBuilder;
|
||||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
|
|||||||
+7
-7
@@ -1,5 +1,12 @@
|
|||||||
package structure;
|
package structure;
|
||||||
|
|
||||||
|
import net.jafama.FastMath;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.Parser;
|
import com.dfsek.terra.addons.terrascript.parser.Parser;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Block;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Block;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
@@ -12,13 +19,6 @@ import com.dfsek.terra.addons.terrascript.script.builders.UnaryNumberFunctionBui
|
|||||||
import com.dfsek.terra.addons.terrascript.script.builders.UnaryStringFunctionBuilder;
|
import com.dfsek.terra.addons.terrascript.script.builders.UnaryStringFunctionBuilder;
|
||||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
public class PerformanceTest {
|
public class PerformanceTest {
|
||||||
public static void main(String... args) throws IOException {
|
public static void main(String... args) throws IOException {
|
||||||
|
|||||||
+1
-1
@@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addon.terrascript.check;
|
package com.dfsek.terra.addon.terrascript.check;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.chunkgenerator.generation.NoiseChunkGenerator3D;
|
import com.dfsek.terra.addons.chunkgenerator.generation.NoiseChunkGenerator3D;
|
||||||
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.terrascript.parser.lang.ImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||||
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
|
|||||||
+2
-1
@@ -23,7 +23,8 @@ public class TerraScriptCheckFunctionAddon implements AddonInitializer {
|
|||||||
.register(addon, ConfigPackPreLoadEvent.class)
|
.register(addon, ConfigPackPreLoadEvent.class)
|
||||||
.priority(1)
|
.priority(1)
|
||||||
.then(event -> {
|
.then(event -> {
|
||||||
event.getPack().getOrCreateRegistry(FunctionBuilder.class).register(addon.key("check"), new CheckFunctionBuilder(platform));
|
event.getPack().getOrCreateRegistry(FunctionBuilder.class).register(addon.key("check"),
|
||||||
|
new CheckFunctionBuilder(platform));
|
||||||
})
|
})
|
||||||
.failThrough();
|
.failThrough();
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,7 @@
|
|||||||
package com.dfsek.terra.addons.terrascript.sampler;
|
package com.dfsek.terra.addons.terrascript.sampler;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||||
@@ -8,8 +10,6 @@ import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
|||||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
import com.dfsek.terra.api.noise.NoiseSampler;
|
import com.dfsek.terra.api.noise.NoiseSampler;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
|
|
||||||
public class SamplerFunction implements Function<Number> {
|
public class SamplerFunction implements Function<Number> {
|
||||||
private final Returnable<Number> x, y, z;
|
private final Returnable<Number> x, y, z;
|
||||||
|
|||||||
+7
-7
@@ -1,5 +1,12 @@
|
|||||||
package com.dfsek.terra.addons.terrascript.sampler;
|
package com.dfsek.terra.addons.terrascript.sampler;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.noise.config.DimensionApplicableNoiseSampler;
|
import com.dfsek.terra.addons.noise.config.DimensionApplicableNoiseSampler;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable.ReturnType;
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable.ReturnType;
|
||||||
@@ -9,13 +16,6 @@ import com.dfsek.terra.addons.terrascript.parser.lang.functions.FunctionBuilder;
|
|||||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
import com.dfsek.terra.api.noise.NoiseSampler;
|
import com.dfsek.terra.api.noise.NoiseSampler;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
|
|
||||||
public class SamplerFunctionBuilder implements FunctionBuilder<SamplerFunction> {
|
public class SamplerFunctionBuilder implements FunctionBuilder<SamplerFunction> {
|
||||||
private final Map<String, DimensionApplicableNoiseSampler> samplers2d;
|
private final Map<String, DimensionApplicableNoiseSampler> samplers2d;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public interface BaseAddon extends StringIdentifiable, Namespaced {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the dependencies of this addon.
|
* Gets the dependencies of this addon.
|
||||||
|
*
|
||||||
* @return Map of dependency ID to {@link VersionRange} of dependency
|
* @return Map of dependency ID to {@link VersionRange} of dependency
|
||||||
*/
|
*/
|
||||||
default Map<String, VersionRange> getDependencies() {
|
default Map<String, VersionRange> getDependencies() {
|
||||||
@@ -36,6 +37,7 @@ public interface BaseAddon extends StringIdentifiable, Namespaced {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the version of the addon
|
* Get the version of the addon
|
||||||
|
*
|
||||||
* @return Version of addon
|
* @return Version of addon
|
||||||
*/
|
*/
|
||||||
Version getVersion();
|
Version getVersion();
|
||||||
|
|||||||
+3
-2
@@ -14,12 +14,13 @@ import com.dfsek.terra.api.addon.BaseAddon;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface representing a bootstrap addon.
|
* Interface representing a bootstrap addon.
|
||||||
*
|
* <p>
|
||||||
* A bootstrap addon is the only type of addon Terra implements a loader for.
|
* A bootstrap addon is the only type of addon Terra implements a loader for.
|
||||||
* It is a minimal base for addon loaders to be implemented on top of.
|
* It is a minimal base for addon loaders to be implemented on top of.
|
||||||
*
|
* <p>
|
||||||
* Unless you are writing your own addon loader, you will want to depend on the
|
* Unless you are writing your own addon loader, you will want to depend on the
|
||||||
* {@code manifest-addon-loader} addon, and implement its AddonInitializer.
|
* {@code manifest-addon-loader} addon, and implement its AddonInitializer.
|
||||||
|
*
|
||||||
* @param <T> Type of addon this bootstrap addon loads
|
* @param <T> Type of addon this bootstrap addon loads
|
||||||
*/
|
*/
|
||||||
public interface BootstrapBaseAddon<T extends BaseAddon> extends BaseAddon {
|
public interface BootstrapBaseAddon<T extends BaseAddon> extends BaseAddon {
|
||||||
|
|||||||
@@ -17,18 +17,21 @@ import com.dfsek.terra.api.block.state.BlockState;
|
|||||||
public interface BlockType extends Handle {
|
public interface BlockType extends Handle {
|
||||||
/**
|
/**
|
||||||
* Get the default {@link BlockState} of this block
|
* Get the default {@link BlockState} of this block
|
||||||
|
*
|
||||||
* @return Default block state
|
* @return Default block state
|
||||||
*/
|
*/
|
||||||
BlockState getDefaultState();
|
BlockState getDefaultState();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get whether this block is solid.
|
* Get whether this block is solid.
|
||||||
|
*
|
||||||
* @return Whether this block is solid.
|
* @return Whether this block is solid.
|
||||||
*/
|
*/
|
||||||
boolean isSolid();
|
boolean isSolid();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get whether this block is water.
|
* Get whether this block is water.
|
||||||
|
*
|
||||||
* @return Whether this block is water.
|
* @return Whether this block is water.
|
||||||
*/
|
*/
|
||||||
boolean isWater();
|
boolean isWater();
|
||||||
|
|||||||
@@ -21,39 +21,49 @@ public interface BlockState extends Handle {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether this {@link BlockState} matches another.
|
* Whether this {@link BlockState} matches another.
|
||||||
*
|
* <p>
|
||||||
* "matches" is defined as this {@link BlockState} holding a matching {@link #getBlockType()}.
|
* "matches" is defined as this {@link BlockState} holding a matching {@link #getBlockType()}.
|
||||||
|
*
|
||||||
* @param other Other {@link BlockState}
|
* @param other Other {@link BlockState}
|
||||||
|
*
|
||||||
* @return Whether this state matches the other
|
* @return Whether this state matches the other
|
||||||
*/
|
*/
|
||||||
boolean matches(BlockState other);
|
boolean matches(BlockState other);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether this {@link BlockState} has a {@link Property}.
|
* Check whether this {@link BlockState} has a {@link Property}.
|
||||||
|
*
|
||||||
* @param property Property to check for
|
* @param property Property to check for
|
||||||
|
*
|
||||||
* @return Whether this state has the property.
|
* @return Whether this state has the property.
|
||||||
*/
|
*/
|
||||||
<T extends Comparable<T>> boolean has(Property<T> property);
|
<T extends Comparable<T>> boolean has(Property<T> property);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value of a {@link Property} on this state.
|
* Get the value of a {@link Property} on this state.
|
||||||
|
*
|
||||||
* @param property Property to get
|
* @param property Property to get
|
||||||
|
*
|
||||||
* @return Value of the property
|
* @return Value of the property
|
||||||
*/
|
*/
|
||||||
<T extends Comparable<T>> T get(Property<T> property);
|
<T extends Comparable<T>> T get(Property<T> property);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a new {@link BlockState} with a {@link Property} set to a value.
|
* Return a new {@link BlockState} with a {@link Property} set to a value.
|
||||||
|
*
|
||||||
* @param property Property to set
|
* @param property Property to set
|
||||||
* @param value Value of property
|
* @param value Value of property
|
||||||
|
*
|
||||||
* @return New {@link BlockState} with property set.
|
* @return New {@link BlockState} with property set.
|
||||||
*/
|
*/
|
||||||
<T extends Comparable<T>> BlockState set(Property<T> property, T value);
|
<T extends Comparable<T>> BlockState set(Property<T> property, T value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform an action on this {@link BlockState} if it contains a {@link Property}
|
* Perform an action on this {@link BlockState} if it contains a {@link Property}
|
||||||
|
*
|
||||||
* @param property Property to check for
|
* @param property Property to check for
|
||||||
* @param action Action to perform if property is present
|
* @param action Action to perform if property is present
|
||||||
|
*
|
||||||
* @return This {@link BlockState}
|
* @return This {@link BlockState}
|
||||||
*/
|
*/
|
||||||
default <T extends Comparable<T>> BlockState ifProperty(Property<T> property, Consumer<BlockState> action) {
|
default <T extends Comparable<T>> BlockState ifProperty(Property<T> property, Consumer<BlockState> action) {
|
||||||
@@ -63,8 +73,10 @@ public interface BlockState extends Handle {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of a {@link Property} on this {@link BlockState} if it is present.
|
* Set the value of a {@link Property} on this {@link BlockState} if it is present.
|
||||||
|
*
|
||||||
* @param property Property to check for/set.
|
* @param property Property to check for/set.
|
||||||
* @param value Value to set if property is present.
|
* @param value Value to set if property is present.
|
||||||
|
*
|
||||||
* @return Thie {@link BlockState}
|
* @return Thie {@link BlockState}
|
||||||
*/
|
*/
|
||||||
default <T extends Comparable<T>> BlockState setIfPresent(Property<T> property, T value) {
|
default <T extends Comparable<T>> BlockState setIfPresent(Property<T> property, T value) {
|
||||||
@@ -74,12 +86,14 @@ public interface BlockState extends Handle {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link BlockType} this state applies to.
|
* Get the {@link BlockType} this state applies to.
|
||||||
|
*
|
||||||
* @return Block type.
|
* @return Block type.
|
||||||
*/
|
*/
|
||||||
BlockType getBlockType();
|
BlockType getBlockType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get this state and its properties as a String
|
* Get this state and its properties as a String
|
||||||
|
*
|
||||||
* @return String representation of this state
|
* @return String representation of this state
|
||||||
*/
|
*/
|
||||||
default String getAsString() {
|
default String getAsString() {
|
||||||
@@ -88,13 +102,16 @@ public interface BlockState extends Handle {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get this state and its properties as a String
|
* Get this state and its properties as a String
|
||||||
|
*
|
||||||
* @param properties Whether to include properties
|
* @param properties Whether to include properties
|
||||||
|
*
|
||||||
* @return String representation of this state
|
* @return String representation of this state
|
||||||
*/
|
*/
|
||||||
String getAsString(boolean properties);
|
String getAsString(boolean properties);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get whether this BlockState is air
|
* Get whether this BlockState is air
|
||||||
|
*
|
||||||
* @return Whether this state is air
|
* @return Whether this state is air
|
||||||
*/
|
*/
|
||||||
boolean isAir();
|
boolean isAir();
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.api.block.state.properties;
|
package com.dfsek.terra.api.block.state.properties;
|
||||||
|
|
||||||
import com.dfsek.terra.api.registry.key.StringIdentifiable;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.registry.key.StringIdentifiable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a property a state holds
|
* Represents a property a state holds
|
||||||
@@ -18,12 +18,14 @@ import java.util.Collection;
|
|||||||
public interface Property<T> extends StringIdentifiable {
|
public interface Property<T> extends StringIdentifiable {
|
||||||
/**
|
/**
|
||||||
* Get all possible values of this property
|
* Get all possible values of this property
|
||||||
|
*
|
||||||
* @return All values of this property
|
* @return All values of this property
|
||||||
*/
|
*/
|
||||||
Collection<T> values();
|
Collection<T> values();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the type of this property.
|
* Get the type of this property.
|
||||||
|
*
|
||||||
* @return {@link Class} instance representing the type of this property
|
* @return {@link Class} instance representing the type of this property
|
||||||
*/
|
*/
|
||||||
Class<T> getType();
|
Class<T> getType();
|
||||||
|
|||||||
+1
@@ -14,6 +14,7 @@ import com.dfsek.terra.api.block.state.properties.enums.RailShape;
|
|||||||
import com.dfsek.terra.api.block.state.properties.enums.RedstoneConnection;
|
import com.dfsek.terra.api.block.state.properties.enums.RedstoneConnection;
|
||||||
import com.dfsek.terra.api.block.state.properties.enums.WallHeight;
|
import com.dfsek.terra.api.block.state.properties.enums.WallHeight;
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public final class Properties {
|
public final class Properties {
|
||||||
public static final EnumProperty<Direction> DIRECTION = EnumProperty.of("facing", Direction.class);
|
public static final EnumProperty<Direction> DIRECTION = EnumProperty.of("facing", Direction.class);
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.api.command;
|
package com.dfsek.terra.api.command;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import com.dfsek.terra.api.Handle;
|
import com.dfsek.terra.api.Handle;
|
||||||
import com.dfsek.terra.api.entity.Entity;
|
import com.dfsek.terra.api.entity.Entity;
|
||||||
import com.dfsek.terra.api.entity.Player;
|
import com.dfsek.terra.api.entity.Player;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
|
|
||||||
public interface CommandSender extends Handle {
|
public interface CommandSender extends Handle {
|
||||||
void sendMessage(String message);
|
void sendMessage(String message);
|
||||||
|
|||||||
+13
-14
@@ -5,16 +5,6 @@ import cloud.commandframework.arguments.CommandArgument;
|
|||||||
import cloud.commandframework.arguments.parser.ArgumentParseResult;
|
import cloud.commandframework.arguments.parser.ArgumentParseResult;
|
||||||
import cloud.commandframework.arguments.parser.ArgumentParser;
|
import cloud.commandframework.arguments.parser.ArgumentParser;
|
||||||
import cloud.commandframework.context.CommandContext;
|
import cloud.commandframework.context.CommandContext;
|
||||||
|
|
||||||
import com.dfsek.terra.api.registry.Registry;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.registry.exception.NoSuchEntryException;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.registry.key.RegistryKey;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.structure.Structure;
|
|
||||||
import com.dfsek.terra.api.util.reflection.TypeKey;
|
|
||||||
|
|
||||||
import io.leangen.geantyref.TypeToken;
|
import io.leangen.geantyref.TypeToken;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
@@ -26,6 +16,11 @@ import java.util.function.BiFunction;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.registry.Registry;
|
||||||
|
import com.dfsek.terra.api.registry.exception.NoSuchEntryException;
|
||||||
|
import com.dfsek.terra.api.registry.key.RegistryKey;
|
||||||
|
import com.dfsek.terra.api.util.reflection.TypeKey;
|
||||||
|
|
||||||
|
|
||||||
public class RegistryArgument<T, R> extends CommandArgument<T, R> {
|
public class RegistryArgument<T, R> extends CommandArgument<T, R> {
|
||||||
private RegistryArgument(
|
private RegistryArgument(
|
||||||
@@ -63,19 +58,23 @@ public class RegistryArgument<T, R> extends CommandArgument<T, R> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <T, R> Builder<T, R> builder(String name, Function<CommandContext<T>, Registry<R>> registryFunction, TypeKey<R> registryType) {
|
public static <T, R> Builder<T, R> builder(String name, Function<CommandContext<T>, Registry<R>> registryFunction,
|
||||||
|
TypeKey<R> registryType) {
|
||||||
return new Builder<>(name, registryFunction, (TypeToken<R>) TypeToken.get(registryType.getType()));
|
return new Builder<>(name, registryFunction, (TypeToken<R>) TypeToken.get(registryType.getType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T, R> CommandArgument<T, R> of(String name, Function<CommandContext<T>, Registry<R>> registryFunction, TypeKey<R> registryType) {
|
public static <T, R> CommandArgument<T, R> of(String name, Function<CommandContext<T>, Registry<R>> registryFunction,
|
||||||
|
TypeKey<R> registryType) {
|
||||||
return RegistryArgument.<T, R>builder(name, registryFunction, registryType).build();
|
return RegistryArgument.<T, R>builder(name, registryFunction, registryType).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T, R> CommandArgument<T, R> optional(String name, Function<CommandContext<T>, Registry<R>> registryFunction, TypeKey<R> registryType) {
|
public static <T, R> CommandArgument<T, R> optional(String name, Function<CommandContext<T>, Registry<R>> registryFunction,
|
||||||
|
TypeKey<R> registryType) {
|
||||||
return RegistryArgument.builder(name, registryFunction, registryType).asOptional().build();
|
return RegistryArgument.builder(name, registryFunction, registryType).asOptional().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T, R> CommandArgument<T, R> optional(String name, Function<CommandContext<T>, Registry<R>> registryFunction, TypeKey<R> registryType, String defaultKey) {
|
public static <T, R> CommandArgument<T, R> optional(String name, Function<CommandContext<T>, Registry<R>> registryFunction,
|
||||||
|
TypeKey<R> registryType, String defaultKey) {
|
||||||
return RegistryArgument.builder(name, registryFunction, registryType).asOptionalWithDefault(defaultKey).build();
|
return RegistryArgument.builder(name, registryFunction, registryType).asOptionalWithDefault(defaultKey).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
import com.dfsek.terra.api.addon.BaseAddon;
|
import com.dfsek.terra.api.addon.BaseAddon;
|
||||||
import com.dfsek.terra.api.properties.PropertyHolder;
|
import com.dfsek.terra.api.properties.PropertyHolder;
|
||||||
import com.dfsek.terra.api.registry.CheckedRegistry;
|
|
||||||
import com.dfsek.terra.api.registry.key.Keyed;
|
import com.dfsek.terra.api.registry.key.Keyed;
|
||||||
import com.dfsek.terra.api.registry.key.RegistryKey;
|
import com.dfsek.terra.api.registry.key.RegistryKey;
|
||||||
import com.dfsek.terra.api.registry.meta.CheckedRegistryHolder;
|
import com.dfsek.terra.api.registry.meta.CheckedRegistryHolder;
|
||||||
import com.dfsek.terra.api.registry.meta.RegistryHolder;
|
|
||||||
import com.dfsek.terra.api.registry.meta.RegistryProvider;
|
import com.dfsek.terra.api.registry.meta.RegistryProvider;
|
||||||
import com.dfsek.terra.api.tectonic.ConfigLoadingDelegate;
|
import com.dfsek.terra.api.tectonic.ConfigLoadingDelegate;
|
||||||
import com.dfsek.terra.api.tectonic.LoaderRegistrar;
|
import com.dfsek.terra.api.tectonic.LoaderRegistrar;
|
||||||
|
|||||||
@@ -7,10 +7,7 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.api.config;
|
package com.dfsek.terra.api.config;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.Platform;
|
import com.dfsek.terra.api.Platform;
|
||||||
import com.dfsek.terra.api.registry.OpenRegistry;
|
|
||||||
import com.dfsek.terra.api.util.reflection.TypeKey;
|
import com.dfsek.terra.api.util.reflection.TypeKey;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ package com.dfsek.terra.api.noise;
|
|||||||
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.util.vector.Vector2;
|
import com.dfsek.terra.api.util.vector.Vector2;
|
||||||
import com.dfsek.terra.api.util.vector.Vector3;
|
|
||||||
import com.dfsek.terra.api.util.vector.Vector2Int;
|
import com.dfsek.terra.api.util.vector.Vector2Int;
|
||||||
|
import com.dfsek.terra.api.util.vector.Vector3;
|
||||||
import com.dfsek.terra.api.util.vector.Vector3Int;
|
import com.dfsek.terra.api.util.vector.Vector3Int;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,11 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.api.registry;
|
package com.dfsek.terra.api.registry;
|
||||||
|
|
||||||
import com.dfsek.terra.api.registry.key.Keyed;
|
|
||||||
import com.dfsek.terra.api.registry.key.RegistryKey;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import com.dfsek.terra.api.registry.exception.DuplicateEntryException;
|
import com.dfsek.terra.api.registry.exception.DuplicateEntryException;
|
||||||
|
import com.dfsek.terra.api.registry.key.Keyed;
|
||||||
|
import com.dfsek.terra.api.registry.key.RegistryKey;
|
||||||
|
|
||||||
|
|
||||||
public interface CheckedRegistry<T> extends Registry<T> {
|
public interface CheckedRegistry<T> extends Registry<T> {
|
||||||
|
|||||||
@@ -7,12 +7,11 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.api.registry;
|
package com.dfsek.terra.api.registry;
|
||||||
|
|
||||||
import com.dfsek.terra.api.registry.key.Keyed;
|
|
||||||
import com.dfsek.terra.api.registry.key.RegistryKey;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import com.dfsek.terra.api.registry.exception.DuplicateEntryException;
|
import com.dfsek.terra.api.registry.exception.DuplicateEntryException;
|
||||||
|
import com.dfsek.terra.api.registry.key.Keyed;
|
||||||
|
import com.dfsek.terra.api.registry.key.RegistryKey;
|
||||||
|
|
||||||
|
|
||||||
public interface OpenRegistry<T> extends Registry<T> {
|
public interface OpenRegistry<T> extends Registry<T> {
|
||||||
|
|||||||
@@ -8,10 +8,6 @@
|
|||||||
package com.dfsek.terra.api.registry;
|
package com.dfsek.terra.api.registry;
|
||||||
|
|
||||||
import com.dfsek.tectonic.api.loader.type.TypeLoader;
|
import com.dfsek.tectonic.api.loader.type.TypeLoader;
|
||||||
|
|
||||||
import com.dfsek.terra.api.registry.key.RegistryKey;
|
|
||||||
import com.dfsek.terra.api.util.reflection.TypeKey;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.Contract;
|
import org.jetbrains.annotations.Contract;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -23,6 +19,9 @@ import java.util.function.BiConsumer;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.registry.key.RegistryKey;
|
||||||
|
import com.dfsek.terra.api.util.reflection.TypeKey;
|
||||||
|
|
||||||
|
|
||||||
public interface Registry<T> extends TypeLoader<T> {
|
public interface Registry<T> extends TypeLoader<T> {
|
||||||
/**
|
/**
|
||||||
|
|||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
package com.dfsek.terra.api.registry.meta;
|
package com.dfsek.terra.api.registry.meta;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
import com.dfsek.terra.api.registry.CheckedRegistry;
|
import com.dfsek.terra.api.registry.CheckedRegistry;
|
||||||
import com.dfsek.terra.api.util.reflection.TypeKey;
|
import com.dfsek.terra.api.util.reflection.TypeKey;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
|
|
||||||
|
|
||||||
public interface CheckedRegistryHolder extends RegistryHolder {
|
public interface CheckedRegistryHolder extends RegistryHolder {
|
||||||
default <T> CheckedRegistry<T> getCheckedRegistry(Class<T> clazz) throws IllegalStateException {
|
default <T> CheckedRegistry<T> getCheckedRegistry(Class<T> clazz) throws IllegalStateException {
|
||||||
|
|||||||
@@ -9,9 +9,7 @@ package com.dfsek.terra.api.structure;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.dfsek.terra.api.registry.key.Keyed;
|
|
||||||
import com.dfsek.terra.api.util.Rotation;
|
import com.dfsek.terra.api.util.Rotation;
|
||||||
import com.dfsek.terra.api.registry.key.StringIdentifiable;
|
|
||||||
import com.dfsek.terra.api.util.vector.Vector3Int;
|
import com.dfsek.terra.api.util.vector.Vector3Int;
|
||||||
import com.dfsek.terra.api.world.WritableWorld;
|
import com.dfsek.terra.api.world.WritableWorld;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,10 +9,10 @@ package com.dfsek.terra.api.structure.configured;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.ApiStatus.Experimental;
|
import org.jetbrains.annotations.ApiStatus.Experimental;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.registry.key.StringIdentifiable;
|
||||||
import com.dfsek.terra.api.structure.Structure;
|
import com.dfsek.terra.api.structure.Structure;
|
||||||
import com.dfsek.terra.api.structure.StructureSpawn;
|
import com.dfsek.terra.api.structure.StructureSpawn;
|
||||||
import com.dfsek.terra.api.util.Range;
|
import com.dfsek.terra.api.util.Range;
|
||||||
import com.dfsek.terra.api.registry.key.StringIdentifiable;
|
|
||||||
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,8 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.api.structure.feature;
|
package com.dfsek.terra.api.structure.feature;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.function.BooleanSupplier;
|
import java.util.function.BooleanSupplier;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.function.IntConsumer;
|
import java.util.function.IntConsumer;
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.util.Range;
|
import com.dfsek.terra.api.util.Range;
|
||||||
import com.dfsek.terra.api.util.function.IntToBooleanFunction;
|
import com.dfsek.terra.api.util.function.IntToBooleanFunction;
|
||||||
@@ -22,16 +19,15 @@ import com.dfsek.terra.api.util.generic.Lazy;
|
|||||||
* A column of binary data
|
* A column of binary data
|
||||||
*/
|
*/
|
||||||
public class BinaryColumn {
|
public class BinaryColumn {
|
||||||
|
private static final BinaryColumn NULL = new BinaryColumn(0, 1, y -> false);
|
||||||
private final IntToBooleanFunction data;
|
private final IntToBooleanFunction data;
|
||||||
private final int minY;
|
private final int minY;
|
||||||
private final int maxY;
|
private final int maxY;
|
||||||
|
|
||||||
private final Lazy<boolean[]> results;
|
private final Lazy<boolean[]> results;
|
||||||
|
|
||||||
private static final BinaryColumn NULL = new BinaryColumn(0, 1, y -> false);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@link BinaryColumn} with all values initiated to {@code false}
|
* Constructs a new {@link BinaryColumn} with all values initiated to {@code false}
|
||||||
|
*
|
||||||
* @param minY Minimum Y value
|
* @param minY Minimum Y value
|
||||||
* @param maxY Maximum Y value
|
* @param maxY Maximum Y value
|
||||||
*/
|
*/
|
||||||
@@ -57,17 +53,19 @@ public class BinaryColumn {
|
|||||||
this.data = y -> data[y - minY];
|
this.data = y -> data[y - minY];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BinaryColumn getNull() {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BinaryColumn(Range y, IntToBooleanFunction data) {
|
public BinaryColumn(Range y, IntToBooleanFunction data) {
|
||||||
this(y.getMin(), y.getMax(), data);
|
this(y.getMin(), y.getMax(), data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BinaryColumn getNull() {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value at a height.
|
* Get the value at a height.
|
||||||
|
*
|
||||||
* @param y Height of entry to get.
|
* @param y Height of entry to get.
|
||||||
|
*
|
||||||
* @return Whether height has been set.
|
* @return Whether height has been set.
|
||||||
*/
|
*/
|
||||||
public boolean get(int y) {
|
public boolean get(int y) {
|
||||||
@@ -81,6 +79,7 @@ public class BinaryColumn {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform an action for all heights which have been set.
|
* Perform an action for all heights which have been set.
|
||||||
|
*
|
||||||
* @param consumer Action to perform
|
* @param consumer Action to perform
|
||||||
*/
|
*/
|
||||||
public void forEach(IntConsumer consumer) {
|
public void forEach(IntConsumer consumer) {
|
||||||
@@ -94,7 +93,9 @@ public class BinaryColumn {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a {@link BinaryColumn} of equal height with a boolean AND operation applied to each height.
|
* Return a {@link BinaryColumn} of equal height with a boolean AND operation applied to each height.
|
||||||
|
*
|
||||||
* @param that Other binary column, must match this column's height.
|
* @param that Other binary column, must match this column's height.
|
||||||
|
*
|
||||||
* @return Merged column.
|
* @return Merged column.
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException if column heights do not match
|
* @throws IllegalArgumentException if column heights do not match
|
||||||
@@ -105,7 +106,9 @@ public class BinaryColumn {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a {@link BinaryColumn} of equal height with a boolean OR operation applied to each height.
|
* Return a {@link BinaryColumn} of equal height with a boolean OR operation applied to each height.
|
||||||
|
*
|
||||||
* @param that Other binary column, must match this column's height.
|
* @param that Other binary column, must match this column's height.
|
||||||
|
*
|
||||||
* @return Merged column.
|
* @return Merged column.
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException if column heights do not match
|
* @throws IllegalArgumentException if column heights do not match
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.api.structure.feature;
|
package com.dfsek.terra.api.structure.feature;
|
||||||
|
|
||||||
import com.dfsek.terra.api.structure.Structure;
|
|
||||||
import com.dfsek.terra.api.registry.key.StringIdentifiable;
|
import com.dfsek.terra.api.registry.key.StringIdentifiable;
|
||||||
|
import com.dfsek.terra.api.structure.Structure;
|
||||||
import com.dfsek.terra.api.world.WritableWorld;
|
import com.dfsek.terra.api.world.WritableWorld;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.dfsek.terra.api.util;
|
package com.dfsek.terra.api.util;
|
||||||
|
|
||||||
import com.dfsek.terra.api.util.vector.Vector3Int;
|
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.util.vector.Vector3Int;
|
||||||
|
|
||||||
|
|
||||||
public final class GeometryUtil {
|
public final class GeometryUtil {
|
||||||
private GeometryUtil() {
|
private GeometryUtil() {
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ package com.dfsek.terra.api.util.collection;
|
|||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|||||||
+2
-3
@@ -7,9 +7,6 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.api.util.collection;
|
package com.dfsek.terra.api.util.collection;
|
||||||
|
|
||||||
import com.dfsek.terra.api.util.vector.Vector3;
|
|
||||||
import com.dfsek.terra.api.util.vector.Vector3Int;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -25,6 +22,8 @@ import java.util.function.Function;
|
|||||||
import com.dfsek.terra.api.noise.NoiseSampler;
|
import com.dfsek.terra.api.noise.NoiseSampler;
|
||||||
import com.dfsek.terra.api.util.MathUtil;
|
import com.dfsek.terra.api.util.MathUtil;
|
||||||
import com.dfsek.terra.api.util.mutable.MutableInteger;
|
import com.dfsek.terra.api.util.mutable.MutableInteger;
|
||||||
|
import com.dfsek.terra.api.util.vector.Vector3;
|
||||||
|
import com.dfsek.terra.api.util.vector.Vector3Int;
|
||||||
|
|
||||||
|
|
||||||
public class ProbabilityCollection<E> implements Collection<E> {
|
public class ProbabilityCollection<E> implements Collection<E> {
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ public class Vector2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the length of this Vector
|
* Get the length of this Vector
|
||||||
*
|
*
|
||||||
@@ -127,6 +126,12 @@ public class Vector2 {
|
|||||||
return new Mutable(x, z);
|
return new Mutable(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "(" + x + ", " + z + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class Mutable extends Vector2 {
|
public static class Mutable extends Vector2 {
|
||||||
|
|
||||||
private Mutable(double x, double z) {
|
private Mutable(double x, double z) {
|
||||||
@@ -137,24 +142,24 @@ public class Vector2 {
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getZ() {
|
|
||||||
return z;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector2 immutable() {
|
|
||||||
return Vector2.of(x, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Mutable setX(double x) {
|
public Mutable setX(double x) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getZ() {
|
||||||
|
return z;
|
||||||
|
}
|
||||||
|
|
||||||
public Mutable setZ(double z) {
|
public Mutable setZ(double z) {
|
||||||
this.z = z;
|
this.z = z;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector2 immutable() {
|
||||||
|
return Vector2.of(x, z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the length of this Vector
|
* Get the length of this Vector
|
||||||
*
|
*
|
||||||
@@ -241,9 +246,4 @@ public class Vector2 {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "(" + x + ", " + z + ")";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,20 @@ public class Vector2Int {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return (31 * x) + z;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if(obj instanceof Vector2Int that) {
|
||||||
|
return this.x == that.x && this.z == that.z;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class Mutable extends Vector2Int {
|
public static class Mutable extends Vector2Int {
|
||||||
|
|
||||||
protected Mutable(int x, int z) {
|
protected Mutable(int x, int z) {
|
||||||
@@ -80,17 +94,4 @@ public class Vector2Int {
|
|||||||
return new Vector2Int(x, z);
|
return new Vector2Int(x, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return (31 * x) + z;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if(obj instanceof Vector2Int that) {
|
|
||||||
return this.x == that.x && this.z == that.z;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,6 +150,12 @@ public class Vector3 {
|
|||||||
return new Mutable(x, y, z);
|
return new Mutable(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "(" + getX() + ", " + getY() + ", " + getZ() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class Mutable extends Vector3 {
|
public static class Mutable extends Vector3 {
|
||||||
private Mutable(double x, double y, double z) {
|
private Mutable(double x, double y, double z) {
|
||||||
super(x, y, z);
|
super(x, y, z);
|
||||||
@@ -425,9 +431,4 @@ public class Vector3 {
|
|||||||
return FastMath.floorToInt(z);
|
return FastMath.floorToInt(z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "(" + getX() + ", " + getY() + ", " + getZ() + ")";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ public class BufferedWorld implements WritableWorld {
|
|||||||
this.writeInterceptor = writeInterceptor;
|
this.writeInterceptor = writeInterceptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static Builder builder(WritableWorld world) {
|
||||||
|
return new Builder(world);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getHandle() {
|
public Object getHandle() {
|
||||||
return delegate.getHandle();
|
return delegate.getHandle();
|
||||||
@@ -101,6 +105,7 @@ public class BufferedWorld implements WritableWorld {
|
|||||||
return delegate;
|
return delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
private final WritableWorld delegate;
|
private final WritableWorld delegate;
|
||||||
private ReadInterceptor readInterceptor;
|
private ReadInterceptor readInterceptor;
|
||||||
@@ -155,8 +160,4 @@ public class BufferedWorld implements WritableWorld {
|
|||||||
Objects.requireNonNullElse(writeInterceptor, Interceptors.writeThrough()));
|
Objects.requireNonNullElse(writeInterceptor, Interceptors.writeThrough()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static Builder builder(WritableWorld world) {
|
|
||||||
return new Builder(world);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,16 +12,20 @@ import com.dfsek.terra.api.util.vector.Vector3Int;
|
|||||||
public interface ReadableWorld extends World {
|
public interface ReadableWorld extends World {
|
||||||
/**
|
/**
|
||||||
* Get the {@link BlockState} at a location.
|
* Get the {@link BlockState} at a location.
|
||||||
|
*
|
||||||
* @param x X coordinate
|
* @param x X coordinate
|
||||||
* @param y Y coordinate
|
* @param y Y coordinate
|
||||||
* @param z Z coordinate
|
* @param z Z coordinate
|
||||||
|
*
|
||||||
* @return {@link BlockState} at coordinates.
|
* @return {@link BlockState} at coordinates.
|
||||||
*/
|
*/
|
||||||
BlockState getBlockState(int x, int y, int z);
|
BlockState getBlockState(int x, int y, int z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link BlockState} at a location.
|
* Get the {@link BlockState} at a location.
|
||||||
|
*
|
||||||
* @param position Location to get block.
|
* @param position Location to get block.
|
||||||
|
*
|
||||||
* @return {@link BlockState} at coordinates.
|
* @return {@link BlockState} at coordinates.
|
||||||
*/
|
*/
|
||||||
default BlockState getBlockState(Vector3 position) {
|
default BlockState getBlockState(Vector3 position) {
|
||||||
@@ -30,7 +34,9 @@ public interface ReadableWorld extends World {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link BlockState} at a location.
|
* Get the {@link BlockState} at a location.
|
||||||
|
*
|
||||||
* @param position Location to get block.
|
* @param position Location to get block.
|
||||||
|
*
|
||||||
* @return {@link BlockState} at coordinates.
|
* @return {@link BlockState} at coordinates.
|
||||||
*/
|
*/
|
||||||
default BlockState getBlockState(Vector3Int position) {
|
default BlockState getBlockState(Vector3Int position) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user