Revert "Use new lifetime hook for level loading"
This reverts commit c90540c33e
.
This commit is contained in:
parent
0392fd4059
commit
3413fb5c4e
2 changed files with 25 additions and 19 deletions
|
@ -1,16 +1,21 @@
|
||||||
package ru.betterend.mixin.common;
|
package ru.betterend.mixin.common;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.server.level.progress.ChunkProgressListener;
|
||||||
import net.minecraft.util.profiling.ProfilerFiller;
|
import net.minecraft.util.profiling.ProfilerFiller;
|
||||||
|
import net.minecraft.world.level.CustomSpawner;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||||
import net.minecraft.world.level.dimension.DimensionType;
|
import net.minecraft.world.level.dimension.DimensionType;
|
||||||
|
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||||
|
import net.minecraft.world.level.storage.ServerLevelData;
|
||||||
import net.minecraft.world.level.storage.WritableLevelData;
|
import net.minecraft.world.level.storage.WritableLevelData;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
@ -20,27 +25,32 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
import ru.bclib.api.BiomeAPI;
|
import ru.bclib.api.BiomeAPI;
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
|
import ru.betterend.registry.EndBiomes;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.world.generator.GeneratorOptions;
|
import ru.betterend.world.generator.GeneratorOptions;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@Mixin(ServerLevel.class)
|
@Mixin(ServerLevel.class)
|
||||||
public abstract class ServerLevelMixin extends Level {
|
public abstract class ServerLevelMixin extends Level {
|
||||||
// private static String be_lastWorld = null;
|
private static String be_lastWorld = null;
|
||||||
|
|
||||||
protected ServerLevelMixin(WritableLevelData writableLevelData, ResourceKey<Level> resourceKey, DimensionType dimensionType, Supplier<ProfilerFiller> supplier, boolean bl, boolean bl2, long l) {
|
protected ServerLevelMixin(WritableLevelData writableLevelData, ResourceKey<Level> resourceKey, DimensionType dimensionType, Supplier<ProfilerFiller> supplier, boolean bl, boolean bl2, long l) {
|
||||||
super(writableLevelData, resourceKey, dimensionType, supplier, bl, bl2, l);
|
super(writableLevelData, resourceKey, dimensionType, supplier, bl, bl2, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Inject(method = "<init>*", at = @At("TAIL"))
|
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||||
// private void be_onServerWorldInit(MinecraftServer server, Executor workerExecutor, LevelStorageSource.LevelStorageAccess session, ServerLevelData properties, ResourceKey<Level> registryKey, DimensionType dimensionType, ChunkProgressListener worldGenerationProgressListener, ChunkGenerator chunkGenerator, boolean debugWorld, long l, List<CustomSpawner> list, boolean bl, CallbackInfo info) {
|
private void be_onServerWorldInit(MinecraftServer server, Executor workerExecutor, LevelStorageSource.LevelStorageAccess session, ServerLevelData properties, ResourceKey<Level> registryKey, DimensionType dimensionType, ChunkProgressListener worldGenerationProgressListener, ChunkGenerator chunkGenerator, boolean debugWorld, long l, List<CustomSpawner> list, boolean bl, CallbackInfo info) {
|
||||||
//// if (be_lastWorld != null && be_lastWorld.equals(session.getLevelId())) {
|
if (be_lastWorld != null && be_lastWorld.equals(session.getLevelId())) {
|
||||||
//// return;
|
return;
|
||||||
//// }
|
}
|
||||||
////
|
|
||||||
//// be_lastWorld = session.getLevelId();
|
be_lastWorld = session.getLevelId();
|
||||||
// ServerLevel level = ServerLevel.class.cast(this);
|
ServerLevel world = ServerLevel.class.cast(this);
|
||||||
// EndBiomes.onWorldLoad(level, level.getSeed(), level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY));
|
EndBiomes.onWorldLoad(world.getSeed(), world.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY));
|
||||||
// }
|
}
|
||||||
|
|
||||||
@Inject(method = "getSharedSpawnPos", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "getSharedSpawnPos", at = @At("HEAD"), cancellable = true)
|
||||||
private void be_getSharedSpawnPos(CallbackInfoReturnable<BlockPos> info) {
|
private void be_getSharedSpawnPos(CallbackInfoReturnable<BlockPos> info) {
|
||||||
|
|
|
@ -2,10 +2,8 @@ package ru.betterend.registry;
|
||||||
|
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import ru.bclib.api.BiomeAPI;
|
import ru.bclib.api.BiomeAPI;
|
||||||
import ru.bclib.api.LifeCycleAPI;
|
|
||||||
import ru.bclib.world.biomes.BCLBiome;
|
import ru.bclib.world.biomes.BCLBiome;
|
||||||
import ru.bclib.world.generator.BiomeMap;
|
import ru.bclib.world.generator.BiomeMap;
|
||||||
import ru.bclib.world.generator.BiomePicker;
|
import ru.bclib.world.generator.BiomePicker;
|
||||||
|
@ -76,11 +74,9 @@ public class EndBiomes {
|
||||||
public static final EndCaveBiome LUSH_AURORA_CAVE = registerCaveBiome(new LushAuroraCaveBiome());
|
public static final EndCaveBiome LUSH_AURORA_CAVE = registerCaveBiome(new LushAuroraCaveBiome());
|
||||||
public static final EndCaveBiome JADE_CAVE = registerCaveBiome(new JadeCaveBiome());
|
public static final EndCaveBiome JADE_CAVE = registerCaveBiome(new JadeCaveBiome());
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {}
|
||||||
LifeCycleAPI.onLevelLoad(EndBiomes::onWorldLoad);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void onWorldLoad(ServerLevel level, long seed, Registry<Biome> registry) {
|
public static void onWorldLoad(long seed, Registry<Biome> registry) {
|
||||||
CAVE_BIOMES.getBiomes().forEach(biome -> biome.updateActualBiomes(registry));
|
CAVE_BIOMES.getBiomes().forEach(biome -> biome.updateActualBiomes(registry));
|
||||||
CAVE_BIOMES.rebuild();
|
CAVE_BIOMES.rebuild();
|
||||||
if (caveBiomeMap == null || caveBiomeMap.getSeed() != seed) {
|
if (caveBiomeMap == null || caveBiomeMap.getSeed() != seed) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue