Skip to content

Commit

Permalink
Update to 1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Jun 20, 2022
1 parent fd58345 commit 056aaa1
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 58 deletions.
25 changes: 21 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.11-SNAPSHOT'
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'maven-publish'
}

Expand All @@ -10,9 +10,6 @@ archivesBaseName = project.archives_base_name
version = project.mod_version + "+" + project.minecraft_version
group = project.maven_group

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

sourceSets {
testmod {
Expand All @@ -21,8 +18,26 @@ sourceSets {
}
}

loom {
runs {
testmodClient {
client()
name = "Testmod Client"
source sourceSets.testmod
}
testmodServer {
server()
name = "Testmod Server"
source sourceSets.testmod
}
}

accessWidenerPath = file("src/main/resources/fantasy.accesswidener")
}

repositories {
maven { url = "https://maven.gegy.dev/" }
maven { url = "https://maven.nucleoid.xyz/" }
}

dependencies {
Expand All @@ -32,6 +47,8 @@ dependencies {

modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modLocalRuntime "eu.pb4:polymer-reg-sync-manipulator:0.0.1+1.19"

testmodImplementation sourceSets.main.output
}

Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
org.gradle.jvmargs=-Xmx1G

# Fabric Properties
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.1
loader_version=0.13.3
minecraft_version=1.19
yarn_mappings=1.19+build.4
loader_version=0.14.7

# Mod Properties
mod_version=0.4.5
maven_group=xyz.nucleoid
archives_base_name=fantasy

# Dependencies
fabric_version=0.47.8+1.18.2
fabric_version=0.56.1+1.19
3 changes: 1 addition & 2 deletions src/main/java/xyz/nucleoid/fantasy/RuntimeWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ class RuntimeWorld extends ServerWorld {
server, Util.getMainWorkerExecutor(), ((MinecraftServerAccess) server).getSession(),
new RuntimeWorldProperties(server.getSaveProperties(), config),
registryKey,
config.createDimensionOptions(server).getDimensionTypeSupplier(),
config.createDimensionOptions(server),
VoidWorldProgressListener.INSTANCE,
config.getGenerator(),
false,
BiomeAccess.hashSeed(config.getSeed()),
ImmutableList.of(),
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/xyz/nucleoid/fantasy/util/FilteredRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.common.collect.Iterators;
import com.mojang.datafixers.util.Pair;
import com.mojang.serialization.DataResult;
import com.mojang.serialization.Lifecycle;
import net.minecraft.tag.TagKey;
import net.minecraft.util.Identifier;
Expand Down Expand Up @@ -96,8 +97,13 @@ public Set<Map.Entry<RegistryKey<T>, T>> getEntrySet() {
}

@Override
public Optional<RegistryEntry<T>> getRandom(Random random) {
return this.getRandom(random);
public Set<RegistryKey<T>> getKeys() {
return null;
}

@Override
public Optional<RegistryEntry<T>> getRandom(net.minecraft.util.math.random.Random random) {
return Optional.empty();
}

@Override
Expand All @@ -120,6 +126,11 @@ public RegistryEntry<T> getOrCreateEntry(RegistryKey<T> key) {
return this.source.getOrCreateEntry(key);
}

@Override
public DataResult<RegistryEntry<T>> getOrCreateEntryDataResult(RegistryKey<T> key) {
return null;
}

@Override
public RegistryEntry.Reference<T> createEntry(T value) {
return null;
Expand Down
72 changes: 48 additions & 24 deletions src/main/java/xyz/nucleoid/fantasy/util/VoidChunkGenerator.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
package xyz.nucleoid.fantasy.util;

import com.mojang.datafixers.util.Pair;
import com.mojang.serialization.Codec;
import com.mojang.serialization.Lifecycle;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.block.BlockState;
import net.minecraft.structure.StructureManager;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.structure.StructureSet;
import net.minecraft.structure.StructureTemplateManager;
import net.minecraft.util.collection.Pool;
import net.minecraft.util.dynamic.CodecHolder;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.registry.*;
import net.minecraft.world.ChunkRegion;
import net.minecraft.world.HeightLimitView;
import net.minecraft.world.Heightmap;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.biome.source.BiomeAccess;
import net.minecraft.world.biome.source.FixedBiomeSource;
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
Expand All @@ -23,7 +30,11 @@
import net.minecraft.world.gen.chunk.Blender;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.VerticalBlockSample;
import net.minecraft.world.gen.chunk.placement.ConcentricRingsStructurePlacement;
import net.minecraft.world.gen.densityfunction.DensityFunction;
import net.minecraft.world.gen.noise.NoiseConfig;
import net.minecraft.world.gen.structure.Structure;
import org.jetbrains.annotations.Nullable;

import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -70,8 +81,8 @@ public double maxValue() {
}

@Override
public Codec<? extends DensityFunction> getCodec() {
return Codec.unit(this);
public CodecHolder<? extends DensityFunction> getCodec() {
return CodecHolder.of(Codec.unit(this));
}
};

Expand Down Expand Up @@ -101,47 +112,53 @@ protected Codec<? extends ChunkGenerator> getCodec() {
}

@Override
public ChunkGenerator withSeed(long seed) {
return this;
public void carve(ChunkRegion chunkRegion, long seed, NoiseConfig noiseConfig, BiomeAccess world, StructureAccessor structureAccessor, Chunk chunk, GenerationStep.Carver carverStep) {

}

@Override
public MultiNoiseUtil.MultiNoiseSampler getMultiNoiseSampler() {
return EMPTY_SAMPLER;
public void addStructureReferences(StructureWorldAccess world, StructureAccessor accessor, Chunk chunk) {
}

@Override
public void carve(ChunkRegion chunkRegion, long seed, BiomeAccess biomeAccess, StructureAccessor structureAccessor, Chunk chunk, GenerationStep.Carver generationStep) {

public CompletableFuture<Chunk> populateNoise(Executor executor, Blender blender, NoiseConfig noiseConfig, StructureAccessor structureAccessor, Chunk chunk) {
return CompletableFuture.completedFuture(chunk);
}

@Override
public void setStructureStarts(DynamicRegistryManager registryManager, StructureAccessor accessor, Chunk chunk, StructureManager manager, long seed) {
public int getSeaLevel() {
return 0;
}

@Override
public void addStructureReferences(StructureWorldAccess world, StructureAccessor accessor, Chunk chunk) {
public int getMinimumY() {
return 0;
}

@Override
public CompletableFuture<Chunk> populateNoise(Executor executor, Blender blender, StructureAccessor structureAccessor, Chunk chunk) {
return CompletableFuture.completedFuture(chunk);
public int getHeight(int x, int z, Heightmap.Type heightmap, HeightLimitView world, NoiseConfig noiseConfig) {
return 0;
}

@Override
public int getSeaLevel() {
return 0;
public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView world, NoiseConfig noiseConfig) {
return EMPTY_SAMPLE;
}

@Override
public int getMinimumY() {
return 0;
public void getDebugHudText(List<String> text, NoiseConfig noiseConfig, BlockPos pos) {

}

@Override
public void generateFeatures(StructureWorldAccess world, Chunk chunk, StructureAccessor structureAccessor) {
}

@Override
public void buildSurface(ChunkRegion region, StructureAccessor structures, NoiseConfig noiseConfig, Chunk chunk) {

}

@Override
public void populateEntities(ChunkRegion region) {
}
Expand All @@ -151,23 +168,30 @@ public int getWorldHeight() {
return 0;
}

@Nullable
@Override
public int getHeight(int x, int z, Heightmap.Type heightmap, HeightLimitView world) {
return 0;
public Pair<BlockPos, RegistryEntry<Structure>> locateStructure(ServerWorld world, RegistryEntryList<Structure> structures, BlockPos center, int radius, boolean skipReferencedStructures) {
return null;
}

@Override
public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView world) {
return EMPTY_SAMPLE;
public boolean shouldStructureGenerateInRange(RegistryEntry<StructureSet> structureSet, NoiseConfig noiseConfig, long seed, int chunkX, int chunkZ, int chunkRange) {
return false;
}

@Override
public void getDebugHudText(List<String> text, BlockPos pos) {

public Pool<SpawnSettings.SpawnEntry> getEntitySpawnList(RegistryEntry<Biome> biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos) {
return Pool.empty();
}

@Override
public void buildSurface(ChunkRegion region, StructureAccessor structures, Chunk chunk) {
public void setStructureStarts(DynamicRegistryManager registryManager, NoiseConfig noiseConfig, StructureAccessor structureAccessor, Chunk chunk, StructureTemplateManager structureTemplateManager, long seed) {

}

@Nullable
@Override
public List<ChunkPos> getConcentricRingsStartChunks(ConcentricRingsStructurePlacement structurePlacement, NoiseConfig noiseConfig) {
return null;
}
}
2 changes: 2 additions & 0 deletions src/main/resources/data/fantasy/dimension_type/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"respawn_anchor_works": false,
"has_raids": true,
"min_y": 0,
"monster_spawn_block_light_limit": 0,
"monster_spawn_light_level": 0,
"height": 256,
"natural": true,
"coordinate_scale": 1.0,
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
}
},
"depends": {
"fabricloader": ">=0.11.3",
"minecraft": "1.18.x",
"fabricloader": ">=0.14.0",
"minecraft": "1.19.x",
"fabric-lifecycle-events-v1": "*",
"java": ">=17"
}
Expand Down
20 changes: 0 additions & 20 deletions src/testmod/java/xyz/nucleoid/fantasy/FantasyInitializer.java

This file was deleted.

27 changes: 27 additions & 0 deletions src/testmod/java/xyz/nucleoid/fantasy/test/FantasyInitializer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package xyz.nucleoid.fantasy.test;

import com.mojang.brigadier.CommandDispatcher;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import xyz.nucleoid.fantasy.Fantasy;
import xyz.nucleoid.fantasy.RuntimeWorldConfig;
import xyz.nucleoid.fantasy.util.VoidChunkGenerator;

public final class FantasyInitializer implements ModInitializer {
@Override
public void onInitialize() {
ServerLifecycleEvents.SERVER_STARTED.register((s) -> {
Fantasy.get(s).openTemporaryWorld(new RuntimeWorldConfig().setGenerator(new VoidChunkGenerator(s.getRegistryManager().get(Registry.BIOME_KEY).getEntry(0).get())));
Fantasy.get(s).getOrOpenPersistentWorld(
new Identifier("fantasytest:test"),
new RuntimeWorldConfig()
.setGenerator(s.getOverworld().getChunkManager().getChunkGenerator())
);
});
}

}

0 comments on commit 056aaa1

Please sign in to comment.