mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 00:15:35 +00:00
manually create terra-refmap.json because loom is dumb
This commit is contained in:
commit
c047209b86
25
README.md
25
README.md
@ -1,20 +1,25 @@
|
|||||||
# Terra
|
# Terra
|
||||||
Terra is a data-driven world generator based on [Gaea](https://github.com/PolyhedralDev/Gaea). Find out more on our
|
|
||||||
[Spigot page](https://www.spigotmc.org/resources/85151/)!
|
Terra is an incredibly powerful free & open-source data-driven, platform-agnostic world generator. It allows you to create a world exactly
|
||||||
|
to your specifications, with no knowledge of Java required.
|
||||||
|
|
||||||
|
## Downloads:
|
||||||
|
|
||||||
|
* Paper+ servers (Paper, Tuinity, Purpur, etc): [SpigotMC](https://www.spigotmc.org/resources/85151/)
|
||||||
|
* Fabric: [Modrinth](https://modrinth.com/mod/terra) / [CurseForge](https://www.curseforge.com/minecraft/mc-mods/terra-world-generator)
|
||||||
|
|
||||||
## Building and running Terra
|
## Building and running Terra
|
||||||
To build, simply run `./gradlew build` on Linux/MacOS, or `gradlew.bat build` on Windows.
|
|
||||||
This will produce a jar in `build/libs` called `Terra-[CURRENT VERSION].jar`.
|
To build, simply run `./gradlew build` (`gradlew.bat build` on Windows). This will produce a jar in `build/libs`
|
||||||
You can put this right into your plugins dir, along with the correct Gaea version.
|
called `Terra-[CURRENT VERSION].jar`. You can put this right into your plugins dir, along with the correct Gaea version.
|
||||||
|
|
||||||
If you would like to test it with a default server config, just run `./gradlew setupServer` or
|
If you would like to test it with a default server config, just run `./gradlew setupServer` or
|
||||||
`./gradlew.bat setupServer` to set up the server, then `./gradlew testWithPaper` or `gradlew.bat testWithPaper` to run
|
`./gradlew.bat setupServer` to set up the server, then `./gradlew testWithPaper` or `gradlew.bat testWithPaper` to run the server. If you
|
||||||
the server. If you want a clean installation of the server, re-run the `setupServer` task.
|
want a clean installation of the server, re-run the `setupServer` task. This will download a default server config
|
||||||
This will download a default server config from [here](https://github.com/PolyhedralDev/WorldGenTestServer)
|
from [here](https://github.com/PolyhedralDev/WorldGenTestServer)
|
||||||
and install the server in the `target/server` directory, along with all the needed plugins.
|
and install the server in the `target/server` directory, along with all the needed plugins.
|
||||||
|
|
||||||
**Note: You will need to adjust the `NAME` variable `bukkit.yml` of the test server if you are not using the default
|
**Note: You will need to adjust the `NAME` variable `bukkit.yml` of the test server if you are not using the default Terra config.**
|
||||||
Terra config.**
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
Contributions are welcome! If you want to see a feature in Terra, please, open an issue, or implement it yourself and
|
Contributions are welcome! If you want to see a feature in Terra, please, open an issue, or implement it yourself and
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.dfsek.terra.api.platform.world.generator;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.platform.Handle;
|
||||||
|
import com.dfsek.terra.api.world.generation.TerraChunkGenerator;
|
||||||
|
|
||||||
|
public interface GeneratorWrapper extends Handle {
|
||||||
|
@Override
|
||||||
|
TerraChunkGenerator getHandle();
|
||||||
|
}
|
@ -39,7 +39,7 @@ public class OakTree extends FractalTree {
|
|||||||
|
|
||||||
private void growBranch(Location l1, Vector3 diff, double d1, int recursions, Random r) {
|
private void growBranch(Location l1, Vector3 diff, double d1, int recursions, Random r) {
|
||||||
BlockData wood = getMain().getWorldHandle().createBlockData("minecraft:oak_wood");
|
BlockData wood = getMain().getWorldHandle().createBlockData("minecraft:oak_wood");
|
||||||
BlockData leaves = getMain().getWorldHandle().createBlockData("minecraft:oak_leave");
|
BlockData leaves = getMain().getWorldHandle().createBlockData("minecraft:oak_leaves");
|
||||||
if(recursions > 1) {
|
if(recursions > 1) {
|
||||||
geo.generateSphere(l1, leaves, 1 + r.nextInt(2) + (3 - recursions), false, r);
|
geo.generateSphere(l1, leaves, 1 + r.nextInt(2) + (3 - recursions), false, r);
|
||||||
if(recursions > 2) return;
|
if(recursions > 2) return;
|
||||||
|
@ -7,6 +7,7 @@ import com.dfsek.terra.api.platform.entity.EntityType;
|
|||||||
import com.dfsek.terra.api.platform.world.Chunk;
|
import com.dfsek.terra.api.platform.world.Chunk;
|
||||||
import com.dfsek.terra.api.platform.world.World;
|
import com.dfsek.terra.api.platform.world.World;
|
||||||
import com.dfsek.terra.api.platform.world.generator.ChunkGenerator;
|
import com.dfsek.terra.api.platform.world.generator.ChunkGenerator;
|
||||||
|
import com.dfsek.terra.api.platform.world.generator.GeneratorWrapper;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -24,12 +25,12 @@ public class DummyWorld implements World {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxHeight() {
|
public int getMaxHeight() {
|
||||||
return 155;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChunkGenerator getGenerator() {
|
public ChunkGenerator getGenerator() {
|
||||||
return () -> (ChunkGenerator) () -> null;
|
return () -> (GeneratorWrapper) () -> null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -6,7 +6,7 @@ import com.dfsek.terra.api.math.vector.Location;
|
|||||||
import com.dfsek.terra.api.math.vector.Vector3;
|
import com.dfsek.terra.api.math.vector.Vector3;
|
||||||
import com.dfsek.terra.api.platform.block.BlockData;
|
import com.dfsek.terra.api.platform.block.BlockData;
|
||||||
import com.dfsek.terra.api.platform.world.World;
|
import com.dfsek.terra.api.platform.world.World;
|
||||||
import com.dfsek.terra.api.platform.world.generator.ChunkGenerator;
|
import com.dfsek.terra.api.platform.world.generator.GeneratorWrapper;
|
||||||
import com.dfsek.terra.api.world.biome.UserDefinedBiome;
|
import com.dfsek.terra.api.world.biome.UserDefinedBiome;
|
||||||
import com.dfsek.terra.api.world.biome.provider.BiomeProvider;
|
import com.dfsek.terra.api.world.biome.provider.BiomeProvider;
|
||||||
import com.dfsek.terra.api.world.generation.TerraChunkGenerator;
|
import com.dfsek.terra.api.world.generation.TerraChunkGenerator;
|
||||||
@ -37,16 +37,16 @@ public class TerraWorld {
|
|||||||
safe = true;
|
safe = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TerraChunkGenerator getGenerator() {
|
public static boolean isTerraWorld(World w) {
|
||||||
return (TerraChunkGenerator) ((ChunkGenerator) world.getGenerator().getHandle()).getHandle();
|
return w.getGenerator().getHandle() instanceof GeneratorWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isTerraWorld(World w) {
|
public TerraChunkGenerator getGenerator() {
|
||||||
return w.getGenerator().getHandle() instanceof ChunkGenerator;
|
return ((GeneratorWrapper) world.getGenerator().getHandle()).getHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BiomeProvider getBiomeProvider() {
|
public BiomeProvider getBiomeProvider() {
|
||||||
|
@ -2,6 +2,7 @@ package com.dfsek.terra.bukkit.generator;
|
|||||||
|
|
||||||
import com.dfsek.terra.api.TerraPlugin;
|
import com.dfsek.terra.api.TerraPlugin;
|
||||||
import com.dfsek.terra.api.platform.world.Chunk;
|
import com.dfsek.terra.api.platform.world.Chunk;
|
||||||
|
import com.dfsek.terra.api.platform.world.generator.GeneratorWrapper;
|
||||||
import com.dfsek.terra.api.world.generation.TerraBlockPopulator;
|
import com.dfsek.terra.api.world.generation.TerraBlockPopulator;
|
||||||
import com.dfsek.terra.api.world.generation.TerraChunkGenerator;
|
import com.dfsek.terra.api.world.generation.TerraChunkGenerator;
|
||||||
import com.dfsek.terra.bukkit.population.PopulationManager;
|
import com.dfsek.terra.bukkit.population.PopulationManager;
|
||||||
@ -29,7 +30,7 @@ import java.util.Map;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class BukkitChunkGeneratorWrapper extends ChunkGenerator implements com.dfsek.terra.api.platform.world.generator.ChunkGenerator {
|
public class BukkitChunkGeneratorWrapper extends ChunkGenerator implements GeneratorWrapper {
|
||||||
|
|
||||||
private static final Map<com.dfsek.terra.api.platform.world.World, PopulationManager> popMap = new HashMap<>();
|
private static final Map<com.dfsek.terra.api.platform.world.World, PopulationManager> popMap = new HashMap<>();
|
||||||
|
|
||||||
|
@ -3,44 +3,30 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|||||||
import net.fabricmc.loom.LoomGradleExtension
|
import net.fabricmc.loom.LoomGradleExtension
|
||||||
import net.fabricmc.loom.task.RemapJarTask
|
import net.fabricmc.loom.task.RemapJarTask
|
||||||
|
|
||||||
buildscript {
|
plugins {
|
||||||
repositories {
|
`java-library`
|
||||||
mavenCentral()
|
id("fabric-loom").version("0.6-SNAPSHOT")
|
||||||
maven {
|
|
||||||
name = "Fabric"
|
|
||||||
url = uri("https://maven.fabricmc.net/")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath("net.fabricmc:fabric-loom:0.6-SNAPSHOT")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(plugin = "fabric-loom")
|
|
||||||
apply(plugin = "java-library")
|
|
||||||
|
|
||||||
configureCommon()
|
configureCommon()
|
||||||
|
|
||||||
val mixinVersion = "0.8.1+build.21"
|
tasks.named<ShadowJar>("shadowJar") {
|
||||||
val loomVersion = "0.6-SNAPSHOT"
|
relocate("org.json", "com.dfsek.terra.lib.json")
|
||||||
|
relocate("org.yaml", "com.dfsek.terra.lib.yaml")
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "com.dfsek.terra.fabric"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
"shadedApi"(project(":common"))
|
"shadedApi"(project(":common"))
|
||||||
"shadedImplementation"("org.yaml:snakeyaml:1.27")
|
"shadedImplementation"("org.yaml:snakeyaml:1.27")
|
||||||
"shadedImplementation"("com.googlecode.json-simple:json-simple:1.1.1")
|
"shadedImplementation"("com.googlecode.json-simple:json-simple:1.1.1")
|
||||||
|
|
||||||
|
|
||||||
// To change the versions see the gradle.properties file
|
|
||||||
"minecraft"("com.mojang:minecraft:1.16.5")
|
"minecraft"("com.mojang:minecraft:1.16.5")
|
||||||
"mappings"("net.fabricmc:yarn:1.16.5+build.5:v2")
|
"mappings"("net.fabricmc:yarn:1.16.5+build.5:v2")
|
||||||
"modImplementation"("net.fabricmc:fabric-loader:0.11.2")
|
"modImplementation"("net.fabricmc:fabric-loader:0.11.2")
|
||||||
|
|
||||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
|
||||||
"modImplementation"("net.fabricmc.fabric-api:fabric-api:0.31.0+1.16")
|
"modImplementation"("net.fabricmc.fabric-api:fabric-api:0.31.0+1.16")
|
||||||
|
|
||||||
"compileOnly"("net.fabricmc:sponge-mixin:${mixinVersion}")
|
|
||||||
"annotationProcessor"("net.fabricmc:sponge-mixin:${mixinVersion}")
|
|
||||||
"annotationProcessor"("net.fabricmc:fabric-loom:${loomVersion}")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named<ShadowJar>("shadowJar") {
|
tasks.named<ShadowJar>("shadowJar") {
|
||||||
|
1
platforms/fabric/gradle.properties
Normal file
1
platforms/fabric/gradle.properties
Normal file
@ -0,0 +1 @@
|
|||||||
|
org.gradle.jvmargs=-Xmx4G
|
@ -1,6 +1,8 @@
|
|||||||
package com.dfsek.terra.fabric.world.generator;
|
package com.dfsek.terra.fabric.world.generator;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.platform.world.generator.GeneratorWrapper;
|
||||||
import com.dfsek.terra.api.util.FastRandom;
|
import com.dfsek.terra.api.util.FastRandom;
|
||||||
|
import com.dfsek.terra.api.world.generation.TerraChunkGenerator;
|
||||||
import com.dfsek.terra.config.pack.ConfigPack;
|
import com.dfsek.terra.config.pack.ConfigPack;
|
||||||
import com.dfsek.terra.fabric.TerraFabricPlugin;
|
import com.dfsek.terra.fabric.TerraFabricPlugin;
|
||||||
import com.dfsek.terra.fabric.world.TerraBiomeSource;
|
import com.dfsek.terra.fabric.world.TerraBiomeSource;
|
||||||
@ -30,7 +32,7 @@ import net.minecraft.world.gen.chunk.ChunkGenerator;
|
|||||||
import net.minecraft.world.gen.chunk.StructuresConfig;
|
import net.minecraft.world.gen.chunk.StructuresConfig;
|
||||||
import net.minecraft.world.gen.chunk.VerticalBlockSample;
|
import net.minecraft.world.gen.chunk.VerticalBlockSample;
|
||||||
|
|
||||||
public class FabricChunkGeneratorWrapper extends ChunkGenerator implements com.dfsek.terra.api.platform.world.generator.ChunkGenerator {
|
public class FabricChunkGeneratorWrapper extends ChunkGenerator implements GeneratorWrapper {
|
||||||
private final long seed;
|
private final long seed;
|
||||||
private final DefaultChunkGenerator3D delegate;
|
private final DefaultChunkGenerator3D delegate;
|
||||||
private final TerraBiomeSource biomeSource;
|
private final TerraBiomeSource biomeSource;
|
||||||
@ -85,10 +87,6 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements com.d
|
|||||||
this.seed = seed;
|
this.seed = seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public DefaultChunkGenerator3D getHandle() {
|
|
||||||
return delegate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Codec<? extends ChunkGenerator> getCodec() {
|
protected Codec<? extends ChunkGenerator> getCodec() {
|
||||||
@ -149,4 +147,9 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements com.d
|
|||||||
|
|
||||||
return new VerticalBlockSample(array);
|
return new VerticalBlockSample(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TerraChunkGenerator getHandle() {
|
||||||
|
return delegate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
16
platforms/fabric/src/main/resources/terra-refmap.json
Normal file
16
platforms/fabric/src/main/resources/terra-refmap.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"mappings": {
|
||||||
|
"com/dfsek/terra/fabric/mixin/GeneratorTypeAccessor": {
|
||||||
|
"VALUES": "field_25052:Ljava/util/List;",
|
||||||
|
"translationKey": "field_25060:Lnet/minecraft/class_2561;"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"named:intermediary": {
|
||||||
|
"com/dfsek/terra/fabric/mixin/GeneratorTypeAccessor": {
|
||||||
|
"VALUES": "field_25052:Ljava/util/List;",
|
||||||
|
"translationKey": "field_25060:Lnet/minecraft/class_2561;"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,5 +11,6 @@
|
|||||||
"server": [],
|
"server": [],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
}
|
},
|
||||||
|
"refmap": "terra-refmap.json"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user