From 8e41bb1216656570fd56a391081a9d101e143b55 Mon Sep 17 00:00:00 2001 From: plusls Date: Fri, 4 Mar 2022 12:58:32 +0800 Subject: [PATCH] update to 1.18.2 --- build.gradle | 6 +++-- gradle.properties | 12 ++++----- .../MixinServerWorld.java | 6 +++-- .../rule/spawnBiome/MixinSpawnHelper.java | 26 +++++++------------ 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/build.gradle b/build.gradle index 8d6f663..8ad5fdc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id('fabric-loom').version('0.10-SNAPSHOT') + id('fabric-loom').version('0.11-SNAPSHOT') id('maven-publish') id('org.ajoberstar.grgit').version('4.1.0') } @@ -36,7 +36,9 @@ dependencies { // fabric-carpet modImplementation("curse.maven:carpet-349239:${project.carpet_core_version}") // multiconnect - modImplementation("net.earthcomputer.multiconnect:multiconnect-api:${project.multiconnect_version}") + modImplementation("net.earthcomputer.multiconnect:multiconnect-api:${project.multiconnect_version}") { + transitive = false + } include("net.earthcomputer.multiconnect:multiconnect-api:${project.multiconnect_version}") } diff --git a/gradle.properties b/gradle.properties index 3e9b140..e031338 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,9 +2,9 @@ org.gradle.jvmargs=-Xmx1G # Minecraft Properties -minecraft_version=1.18.1 -yarn_mappings=11 -loader_version=0.12.12 +minecraft_version=1.18.2 +yarn_mappings=1 +loader_version=0.13.3 # Mod Properties mod_version=0.2.5 @@ -14,6 +14,6 @@ maven_group=com.plusls archives_base_name=plusls-carpet-addition # Dependencies -fabric_version=0.45.0+1.18 -carpet_core_version=3542018 -multiconnect_version=1.4.16 \ No newline at end of file +fabric_version=0.47.9+1.18.2 +carpet_core_version=3667635 +multiconnect_version=1.5.10 \ No newline at end of file diff --git a/src/main/java/com/plusls/carpet/mixin/rule/sleepingDuringTheDay/MixinServerWorld.java b/src/main/java/com/plusls/carpet/mixin/rule/sleepingDuringTheDay/MixinServerWorld.java index 87dee90..122da61 100644 --- a/src/main/java/com/plusls/carpet/mixin/rule/sleepingDuringTheDay/MixinServerWorld.java +++ b/src/main/java/com/plusls/carpet/mixin/rule/sleepingDuringTheDay/MixinServerWorld.java @@ -3,6 +3,7 @@ import com.plusls.carpet.PcaSettings; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.profiler.Profiler; +import net.minecraft.util.registry.RegistryEntry; import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.MutableWorldProperties; import net.minecraft.world.StructureWorldAccess; @@ -16,8 +17,9 @@ @Mixin(ServerWorld.class) public abstract class MixinServerWorld extends World implements StructureWorldAccess { - protected MixinServerWorld(MutableWorldProperties properties, RegistryKey registryRef, DimensionType dimensionType, Supplier profiler, boolean isClient, boolean debugWorld, long seed) { - super(properties, registryRef, dimensionType, profiler, isClient, debugWorld, seed); + + protected MixinServerWorld(MutableWorldProperties properties, RegistryKey registryRef, RegistryEntry registryEntry, Supplier profiler, boolean isClient, boolean debugWorld, long seed) { + super(properties, registryRef, registryEntry, profiler, isClient, debugWorld, seed); } // 根据当前时间设置夜晚和白天 diff --git a/src/main/java/com/plusls/carpet/mixin/rule/spawnBiome/MixinSpawnHelper.java b/src/main/java/com/plusls/carpet/mixin/rule/spawnBiome/MixinSpawnHelper.java index abbab25..43e18b0 100755 --- a/src/main/java/com/plusls/carpet/mixin/rule/spawnBiome/MixinSpawnHelper.java +++ b/src/main/java/com/plusls/carpet/mixin/rule/spawnBiome/MixinSpawnHelper.java @@ -1,38 +1,32 @@ package com.plusls.carpet.mixin.rule.spawnBiome; import com.plusls.carpet.PcaSettings; -import net.minecraft.entity.SpawnGroup; -import net.minecraft.util.collection.Pool; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.registry.BuiltinRegistries; +import net.minecraft.util.registry.RegistryEntry; import net.minecraft.world.SpawnHelper; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.BiomeKeys; -import net.minecraft.world.biome.SpawnSettings; -import net.minecraft.world.gen.StructureAccessor; -import net.minecraft.world.gen.chunk.ChunkGenerator; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.ModifyVariable; @Mixin(SpawnHelper.class) public class MixinSpawnHelper { - @Redirect(method = "getSpawnEntries", - at = @At(value = "INVOKE", - target = "Lnet/minecraft/world/gen/chunk/ChunkGenerator;getEntitySpawnList(Lnet/minecraft/world/biome/Biome;Lnet/minecraft/world/gen/StructureAccessor;Lnet/minecraft/entity/SpawnGroup;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/collection/Pool;")) - private static Pool modifyBiome(ChunkGenerator chunkGenerator, Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos) { + @ModifyVariable(method = "getSpawnEntries", + at = @At(value = "HEAD"), ordinal = 0, argsOnly = true) + private static RegistryEntry modifyBiome(RegistryEntry biomeEntry) { if (PcaSettings.spawnBiome != PcaSettings.PCA_SPAWN_BIOME.DEFAULT) { if (PcaSettings.spawnBiome == PcaSettings.PCA_SPAWN_BIOME.DESERT) { - biome = BuiltinRegistries.BIOME.get(BiomeKeys.DESERT); + biomeEntry = RegistryEntry.of(BuiltinRegistries.BIOME.get(BiomeKeys.DESERT)); } else if (PcaSettings.spawnBiome == PcaSettings.PCA_SPAWN_BIOME.PLAINS) { // BuiltinBiomes - biome = BuiltinRegistries.BIOME.get(BiomeKeys.PLAINS); + biomeEntry = RegistryEntry.of(BuiltinRegistries.BIOME.get(BiomeKeys.PLAINS)); } else if (PcaSettings.spawnBiome == PcaSettings.PCA_SPAWN_BIOME.THE_END) { - biome = BuiltinRegistries.BIOME.get(BiomeKeys.THE_END); + biomeEntry = RegistryEntry.of(BuiltinRegistries.BIOME.get(BiomeKeys.THE_END)); } else if (PcaSettings.spawnBiome == PcaSettings.PCA_SPAWN_BIOME.NETHER_WASTES) { - biome = BuiltinRegistries.BIOME.get(BiomeKeys.NETHER_WASTES); + biomeEntry = RegistryEntry.of(BuiltinRegistries.BIOME.get(BiomeKeys.NETHER_WASTES)); } } - return chunkGenerator.getEntitySpawnList(biome, accessor, group, pos); + return biomeEntry; } }