Skip to content

Commit

Permalink
fix fantasy issue
Browse files Browse the repository at this point in the history
  • Loading branch information
PinkGoosik committed Mar 21, 2023
1 parent 92cf312 commit 8190768
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 8 deletions.
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@ dependencies {
include "dev.onyxstudios.cardinal-components-api:cardinal-components-world:${project.cca}"
include "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cca}"

modImplementation include("xyz.nucleoid:fantasy:${project.fantasy}")
modImplementation(files("libs/fantasy-${project.fantasy}.jar"))
// modImplementation include("xyz.nucleoid:fantasy:${project.fantasy}")
modImplementation include("eu.pb4:placeholder-api:${project.placeholder_api}")
modImplementation include("xyz.nucleoid:server-translations-api:${project.server_translations_api}")
modImplementation include("me.lucko:fabric-permissions-api:0.2-SNAPSHOT")
}

loom {
accessWidenerPath = file("src/main/resources/" + archivesBaseName + ".accesswidener")
}

processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.parallel = true
# Mod Properties
maven_group = ru.pinkgoosik
archives_base_name = skylands
mod_version = 0.3.0
mod_version = 0.3.2

# Dependencies | Check these on https://fabricmc.net/develop
minecraft_version = 1.19.4
Expand All @@ -16,7 +16,7 @@ fabric_api = 0.76.0+1.19.4
# https://github.com/OnyxStudios/Cardinal-Components-API/releases
cca = 5.1.0
# https://github.com/NucleoidMC/fantasy/releases
fantasy = 0.4.9+1.19.4-rc2
fantasy = 0.4.10+1.19.4
# https://github.com/Patbox/TextPlaceholderAPI/releases
placeholder_api = 2.0.0-rc.1+1.19.3
# https://github.com/NucleoidMC/Server-Translations/releases
Expand Down
Binary file added libs/fantasy-0.4.10+1.19.4-sources.jar
Binary file not shown.
Binary file added libs/fantasy-0.4.10+1.19.4.jar
Binary file not shown.
17 changes: 13 additions & 4 deletions src/main/java/skylands/logic/Island.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntryList;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.structure.StructurePlacementData;
Expand Down Expand Up @@ -47,6 +48,7 @@ public class Island {
public Vec3d spawnPos = Skylands.config.defaultSpawnPos;
public Vec3d visitsPos = Skylands.config.defaultVisitsPos;
public boolean hasNether = false;
public long seed = 0L;

public Instant created = Instant.now();

Expand All @@ -67,6 +69,7 @@ public static Island fromNbt(NbtCompound nbt) {
island.hasNether = nbt.getBoolean("hasNether");
island.created = Instant.parse(nbt.getString("created"));
island.locked = nbt.getBoolean("locked");
island.seed = nbt.getLong("seed");

var spawnPosNbt = nbt.getCompound("spawnPos");
double spawnPosX = spawnPosNbt.getDouble("x");
Expand Down Expand Up @@ -103,6 +106,7 @@ public NbtCompound toNbt() {
nbt.putBoolean("hasNether", this.hasNether);
nbt.putString("created", this.created.toString());
nbt.putBoolean("locked", this.locked);
nbt.putLong("seed", this.seed);

NbtCompound spawnPosNbt = new NbtCompound();
spawnPosNbt.putDouble("x", this.spawnPos.getX());
Expand Down Expand Up @@ -171,6 +175,11 @@ public boolean isBanned(String player) {
return false;
}

public long getSeed() {
if (this.seed == 0) this.seed = RandomSeed.getSeed();
return this.seed;
}

public RuntimeWorldHandle getHandler() {
if(this.islandConfig == null) {
this.islandConfig = createIslandConfig();
Expand All @@ -180,15 +189,15 @@ public RuntimeWorldHandle getHandler() {

private RuntimeWorldConfig createIslandConfig() {
var biome = this.server.getRegistryManager().get(RegistryKeys.BIOME).getEntry(this.server.getRegistryManager().get(RegistryKeys.BIOME).getOrThrow(BiomeKeys.PLAINS));
FlatChunkGeneratorConfig flat = new FlatChunkGeneratorConfig(Optional.empty(), biome, List.of());
FlatChunkGeneratorConfig flat = new FlatChunkGeneratorConfig(Optional.of(RegistryEntryList.of()), biome, List.of());
FlatChunkGenerator generator = new FlatChunkGenerator(flat);

return new RuntimeWorldConfig()
.setDimensionType(DimensionTypes.OVERWORLD)
.setGenerator(generator)
.setDifficulty(Difficulty.NORMAL)
.setShouldTickTime(true)
.setSeed(RandomSeed.getSeed());
.setSeed(this.getSeed());
}

public RuntimeWorldHandle getNetherHandler() {
Expand All @@ -200,15 +209,15 @@ public RuntimeWorldHandle getNetherHandler() {

private RuntimeWorldConfig createNetherConfig() {
var biome = this.server.getRegistryManager().get(RegistryKeys.BIOME).getEntry(this.server.getRegistryManager().get(RegistryKeys.BIOME).getOrThrow(BiomeKeys.NETHER_WASTES));
FlatChunkGeneratorConfig flat = new FlatChunkGeneratorConfig(Optional.empty(), biome, List.of());
FlatChunkGeneratorConfig flat = new FlatChunkGeneratorConfig(Optional.of(RegistryEntryList.of()), biome, List.of());
FlatChunkGenerator generator = new FlatChunkGenerator(flat);

return new RuntimeWorldConfig()
.setDimensionType(DimensionTypes.THE_NETHER)
.setGenerator(generator)
.setDifficulty(Difficulty.NORMAL)
.setShouldTickTime(true)
.setSeed(RandomSeed.getSeed());
.setSeed(this.getSeed());
}

public ServerWorld getEnd() {
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"skylands.data.Components"
]
},
"accessWidener": "skylands.accesswidener",
"mixins": [
"skylands.mixins.json"
],
Expand All @@ -38,7 +39,7 @@
"depends": {
"fabricloader": "*",
"fabric": "*",
"minecraft": ">=1.19",
"minecraft": ">=1.19.4",
"java": ">=17"
}
}
1 change: 1 addition & 0 deletions src/main/resources/skylands.accesswidener
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
accessWidener v1 named

0 comments on commit 8190768

Please sign in to comment.