manually create terra-refmap.json because loom is dumb

This commit is contained in:
dfsek 2021-03-06 22:26:13 -07:00
commit c047209b86
11 changed files with 72 additions and 49 deletions

View File

@ -1,20 +1,25 @@
# 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
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`.
You can put this right into your plugins dir, along with the correct Gaea version.
To build, simply run `./gradlew build` (`gradlew.bat build` on Windows). This will produce a jar in `build/libs`
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
`./gradlew.bat setupServer` to set up the server, then `./gradlew testWithPaper` or `gradlew.bat testWithPaper` to run
the server. If you want a clean installation of the server, re-run the `setupServer` task.
This will download a default server config from [here](https://github.com/PolyhedralDev/WorldGenTestServer)
`./gradlew.bat setupServer` to set up the server, then `./gradlew testWithPaper` or `gradlew.bat testWithPaper` to run the server. If you
want a clean installation of the server, re-run the `setupServer` task. This will download a default server config
from [here](https://github.com/PolyhedralDev/WorldGenTestServer)
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
Terra config.**
**Note: You will need to adjust the `NAME` variable `bukkit.yml` of the test server if you are not using the default Terra config.**
## Contributing
Contributions are welcome! If you want to see a feature in Terra, please, open an issue, or implement it yourself and

View File

@ -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();
}

View File

@ -39,7 +39,7 @@ public class OakTree extends FractalTree {
private void growBranch(Location l1, Vector3 diff, double d1, int recursions, Random r) {
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) {
geo.generateSphere(l1, leaves, 1 + r.nextInt(2) + (3 - recursions), false, r);
if(recursions > 2) return;

View File

@ -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.World;
import com.dfsek.terra.api.platform.world.generator.ChunkGenerator;
import com.dfsek.terra.api.platform.world.generator.GeneratorWrapper;
import java.io.File;
import java.util.UUID;
@ -24,12 +25,12 @@ public class DummyWorld implements World {
@Override
public int getMaxHeight() {
return 155;
return 255;
}
@Override
public ChunkGenerator getGenerator() {
return () -> (ChunkGenerator) () -> null;
return () -> (GeneratorWrapper) () -> null;
}
@Override

View File

@ -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.platform.block.BlockData;
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.provider.BiomeProvider;
import com.dfsek.terra.api.world.generation.TerraChunkGenerator;
@ -37,16 +37,16 @@ public class TerraWorld {
safe = true;
}
public TerraChunkGenerator getGenerator() {
return (TerraChunkGenerator) ((ChunkGenerator) world.getGenerator().getHandle()).getHandle();
public static boolean isTerraWorld(World w) {
return w.getGenerator().getHandle() instanceof GeneratorWrapper;
}
public World getWorld() {
return world;
}
public static boolean isTerraWorld(World w) {
return w.getGenerator().getHandle() instanceof ChunkGenerator;
public TerraChunkGenerator getGenerator() {
return ((GeneratorWrapper) world.getGenerator().getHandle()).getHandle();
}
public BiomeProvider getBiomeProvider() {

View File

@ -2,6 +2,7 @@ package com.dfsek.terra.bukkit.generator;
import com.dfsek.terra.api.TerraPlugin;
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.TerraChunkGenerator;
import com.dfsek.terra.bukkit.population.PopulationManager;
@ -29,7 +30,7 @@ import java.util.Map;
import java.util.Random;
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<>();

View File

@ -3,44 +3,30 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.fabricmc.loom.LoomGradleExtension
import net.fabricmc.loom.task.RemapJarTask
buildscript {
repositories {
mavenCentral()
maven {
name = "Fabric"
url = uri("https://maven.fabricmc.net/")
}
}
dependencies {
classpath("net.fabricmc:fabric-loom:0.6-SNAPSHOT")
}
plugins {
`java-library`
id("fabric-loom").version("0.6-SNAPSHOT")
}
apply(plugin = "fabric-loom")
apply(plugin = "java-library")
configureCommon()
val mixinVersion = "0.8.1+build.21"
val loomVersion = "0.6-SNAPSHOT"
tasks.named<ShadowJar>("shadowJar") {
relocate("org.json", "com.dfsek.terra.lib.json")
relocate("org.yaml", "com.dfsek.terra.lib.yaml")
}
group = "com.dfsek.terra.fabric"
dependencies {
"shadedApi"(project(":common"))
"shadedImplementation"("org.yaml:snakeyaml:1.27")
"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")
"mappings"("net.fabricmc:yarn:1.16.5+build.5:v2")
"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")
"compileOnly"("net.fabricmc:sponge-mixin:${mixinVersion}")
"annotationProcessor"("net.fabricmc:sponge-mixin:${mixinVersion}")
"annotationProcessor"("net.fabricmc:fabric-loom:${loomVersion}")
}
tasks.named<ShadowJar>("shadowJar") {

View File

@ -0,0 +1 @@
org.gradle.jvmargs=-Xmx4G

View File

@ -1,6 +1,8 @@
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.world.generation.TerraChunkGenerator;
import com.dfsek.terra.config.pack.ConfigPack;
import com.dfsek.terra.fabric.TerraFabricPlugin;
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.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 DefaultChunkGenerator3D delegate;
private final TerraBiomeSource biomeSource;
@ -85,10 +87,6 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements com.d
this.seed = seed;
}
@Override
public DefaultChunkGenerator3D getHandle() {
return delegate;
}
@Override
protected Codec<? extends ChunkGenerator> getCodec() {
@ -149,4 +147,9 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements com.d
return new VerticalBlockSample(array);
}
@Override
public TerraChunkGenerator getHandle() {
return delegate;
}
}

View 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;"
}
}
}
}

View File

@ -11,5 +11,6 @@
"server": [],
"injectors": {
"defaultRequire": 1
}
},
"refmap": "terra-refmap.json"
}