Skip to content

Commit

Permalink
Update to 1.21 (#51)
Browse files Browse the repository at this point in the history
Co-authored-by: LCLP <[email protected]>
  • Loading branch information
pisaiah and LCLPYT authored Jun 16, 2024
1 parent c8dd252 commit 6c22614
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 22 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx2G

# Fabric Properties

minecraft_version=1.20.6
yarn_mappings=1.20.6+build.1
loader_version=0.15.10
minecraft_version=1.21
yarn_mappings=1.21+build.1
loader_version=0.15.11

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

# Dependencies
fabric_version=0.97.8+1.20.6
fabric_version=0.100.1+1.21
4 changes: 2 additions & 2 deletions src/main/java/xyz/nucleoid/fantasy/Fantasy.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public final class Fantasy {
public static final Logger LOGGER = LogManager.getLogger(Fantasy.class);
public static final String ID = "fantasy";
public static final RegistryKey<DimensionType> DEFAULT_DIM_TYPE = RegistryKey.of(RegistryKeys.DIMENSION_TYPE, new Identifier(Fantasy.ID, "default"));
public static final RegistryKey<DimensionType> DEFAULT_DIM_TYPE = RegistryKey.of(RegistryKeys.DIMENSION_TYPE, Identifier.of(Fantasy.ID, "default"));

private static Fantasy instance;

Expand Down Expand Up @@ -249,6 +249,6 @@ private List<RuntimeWorld> collectTemporaryWorlds() {

private static Identifier generateTemporaryWorldKey() {
String key = RandomStringUtils.random(16, "abcdefghijklmnopqrstuvwxyz0123456789");
return new Identifier(Fantasy.ID, key);
return Identifier.of(Fantasy.ID, key);
}
}
4 changes: 2 additions & 2 deletions src/main/java/xyz/nucleoid/fantasy/FantasyInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public final class FantasyInitializer implements ModInitializer {
@Override
public void onInitialize() {
Registry.register(Registries.CHUNK_GENERATOR, new Identifier(Fantasy.ID, "void"), VoidChunkGenerator.CODEC);
Registry.register(Registries.CHUNK_GENERATOR, new Identifier(Fantasy.ID, "transient"), TransientChunkGenerator.CODEC);
Registry.register(Registries.CHUNK_GENERATOR, Identifier.of(Fantasy.ID, "void"), VoidChunkGenerator.CODEC);
Registry.register(Registries.CHUNK_GENERATOR, Identifier.of(Fantasy.ID, "transient"), TransientChunkGenerator.CODEC);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.server.world.ThreadedAnvilChunkStorage;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.server.world.ServerChunkLoadingManager;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import xyz.nucleoid.fantasy.util.ChunkGeneratorSettingsProvider;

@Mixin(ThreadedAnvilChunkStorage.class)
public class ThreadedAnvilChunkStorageMixin {
@Shadow
private ChunkGenerator chunkGenerator;
@Mixin(ServerChunkLoadingManager.class)
public class ServerChunkLoadingManagerMixin {

@WrapOperation(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/gen/chunk/ChunkGeneratorSettings;createMissingSettings()Lnet/minecraft/world/gen/chunk/ChunkGeneratorSettings;"))
private ChunkGeneratorSettings fantasy$useProvidedChunkGeneratorSettings(Operation<ChunkGeneratorSettings> original) {
if (this.chunkGenerator instanceof ChunkGeneratorSettingsProvider provider) {
private ChunkGeneratorSettings fantasy$useProvidedChunkGeneratorSettings(Operation<ChunkGeneratorSettings> original, @Local(argsOnly = true) ChunkGenerator chunkGenerator) {
if (chunkGenerator instanceof ChunkGeneratorSettingsProvider provider) {
ChunkGeneratorSettings settings = provider.getSettings();
if (settings != null) return settings;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void addStructureReferences(StructureWorldAccess world, StructureAccessor
}

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

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"depends": {
"fabricloader": ">=0.15.10",
"minecraft": "1.20.6",
"minecraft": ">=1.21-",
"fabric-api": "*",
"java": ">=21"
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fantasy.accesswidener
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
accessWidener v1 named

accessible class net/minecraft/server/world/ThreadedAnvilChunkStorage$EntityTracker
accessible class net/minecraft/server/world/ServerChunkLoadingManager$EntityTracker

accessible field net/minecraft/world/GameRules$IntRule value I
2 changes: 1 addition & 1 deletion src/main/resources/fantasy.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"MinecraftServerMixin",
"ServerChunkManagerMixin",
"ServerWorldMixin",
"ThreadedAnvilChunkStorageMixin",
"ServerChunkLoadingManagerMixin",
"registry.DimensionOptionsMixin",
"registry.SimpleRegistryMixin",
"registry.WorldGenSettingsMixin"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.mojang.logging.LogUtils;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.dimension.v1.FabricDimensions;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.minecraft.command.argument.IdentifierArgumentType;
import net.minecraft.registry.RegistryKeys;
Expand Down Expand Up @@ -68,7 +67,7 @@ public void onInitialize() {

ref.t = System.currentTimeMillis();
if (source.getEntity() != null) {
FabricDimensions.teleport(source.getEntity(), x.asWorld(), new TeleportTarget(new Vec3d(0, 100, 0), Vec3d.ZERO, 0, 0));
source.getEntity().teleportTo(new TeleportTarget(x.asWorld(), new Vec3d(0, 100, 0), Vec3d.ZERO, 0, 0, TeleportTarget.NO_OP));
}

source.sendFeedback(() -> Text.literal("Teleport: " + (System.currentTimeMillis() - ref.t)), false);
Expand Down

0 comments on commit 6c22614

Please sign in to comment.