Fixed Mixin and Frozen Registry Errors
This commit is contained in:
parent
8edddec2b6
commit
73687e3401
10 changed files with 89 additions and 110 deletions
|
@ -8,7 +8,7 @@ import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen;
|
|||
import net.minecraft.client.gui.screens.worldselection.WorldGenSettingsComponent;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.server.WorldLoader;
|
||||
import net.minecraft.world.level.DataPackConfig;
|
||||
import net.minecraft.world.level.WorldDataConfiguration;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
|
@ -34,7 +34,7 @@ public class CreateWorldScreenMixin {
|
|||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
private void wt_init(
|
||||
Screen screen,
|
||||
DataPackConfig dataPackConfig,
|
||||
WorldDataConfiguration worldDataConfiguration,
|
||||
WorldGenSettingsComponent worldGenSettingsComponent,
|
||||
CallbackInfo ci
|
||||
) {
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
package org.betterx.worlds.together.mixin.common;
|
||||
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.progress.ChunkProgressListener;
|
||||
import net.minecraft.world.level.storage.WorldData;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
@ -18,12 +14,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
*/
|
||||
@Mixin(value = MinecraftServer.class, priority = 2000)
|
||||
public class MinecraftServerMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private RegistryAccess.Frozen registryHolder;
|
||||
@Shadow
|
||||
@Final
|
||||
protected WorldData worldData;
|
||||
// @Shadow
|
||||
// @Final
|
||||
// private RegistryAccess.Frozen registryHolder;
|
||||
// @Shadow
|
||||
// @Final
|
||||
// protected WorldData worldData;
|
||||
|
||||
@Inject(method = "createLevels", at = @At(value = "HEAD"))
|
||||
private void together_addSurfaceRules(ChunkProgressListener worldGenerationProgressListener, CallbackInfo ci) {
|
||||
|
|
|
@ -14,7 +14,8 @@ public class WorldLoaderMixin {
|
|||
//this is the place a new Registry access gets first istantiated
|
||||
//either when a new Datapack was added to a world on the create-screen
|
||||
//or because we did start world loading
|
||||
@ModifyArg(method = "load", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/ReloadableServerResources;loadResources(Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/core/RegistryAccess$Frozen;Lnet/minecraft/commands/Commands$CommandSelection;ILjava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;"))
|
||||
//TODO: 1.19.3 This might get replaced by the data Providers...
|
||||
@ModifyArg(method = "load", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/ReloadableServerResources;loadResources(Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/core/RegistryAccess$Frozen;Lnet/minecraft/world/flag/FeatureFlagSet;Lnet/minecraft/commands/Commands$CommandSelection;ILjava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;"))
|
||||
private static RegistryAccess.Frozen wt_newRegistry(RegistryAccess.Frozen frozen) {
|
||||
WorldBootstrap.InGUI.registryReady(frozen);
|
||||
return frozen;
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
package org.betterx.worlds.together.mixin.common;
|
||||
|
||||
import org.betterx.worlds.together.levelgen.WorldGenUtil;
|
||||
import org.betterx.worlds.together.worldPreset.WorldPresets;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
import net.minecraft.world.level.levelgen.structure.StructureSet;
|
||||
|
@ -16,8 +12,6 @@ import net.minecraft.world.level.levelgen.synth.NormalNoise;
|
|||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
||||
@Mixin(net.minecraft.world.level.levelgen.presets.WorldPresets.Bootstrap.class)
|
||||
public abstract class WorldPresetsBootstrapMixin {
|
||||
|
@ -48,26 +42,27 @@ public abstract class WorldPresetsBootstrapMixin {
|
|||
|
||||
//see WorldPresets.register
|
||||
|
||||
@ModifyArg(method = "run", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/world/level/levelgen/presets/WorldPresets$Bootstrap;registerCustomOverworldPreset(Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/world/level/dimension/LevelStem;)Lnet/minecraft/core/Holder;"))
|
||||
private LevelStem bcl_getOverworldStem(LevelStem overworldStem) {
|
||||
WorldGenUtil.Context netherContext = new WorldGenUtil.Context(
|
||||
this.biomes,
|
||||
this.netherDimensionType,
|
||||
this.structureSets,
|
||||
this.noises,
|
||||
this.netherNoiseSettings
|
||||
);
|
||||
WorldGenUtil.Context endContext = new WorldGenUtil.Context(
|
||||
this.biomes,
|
||||
this.endDimensionType,
|
||||
this.structureSets,
|
||||
this.noises,
|
||||
this.endNoiseSettings
|
||||
);
|
||||
|
||||
WorldPresets.bootstrapPresets(presets, overworldStem, netherContext, endContext);
|
||||
|
||||
return overworldStem;
|
||||
}
|
||||
//TODO: 1.19.3
|
||||
// @ModifyArg(method = "run", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/world/level/levelgen/presets/WorldPresets$Bootstrap;registerCustomOverworldPreset(Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/world/level/dimension/LevelStem;)Lnet/minecraft/core/Holder;"))
|
||||
// private LevelStem bcl_getOverworldStem(LevelStem overworldStem) {
|
||||
// WorldGenUtil.Context netherContext = new WorldGenUtil.Context(
|
||||
// this.biomes,
|
||||
// this.netherDimensionType,
|
||||
// this.structureSets,
|
||||
// this.noises,
|
||||
// this.netherNoiseSettings
|
||||
// );
|
||||
// WorldGenUtil.Context endContext = new WorldGenUtil.Context(
|
||||
// this.biomes,
|
||||
// this.endDimensionType,
|
||||
// this.structureSets,
|
||||
// this.noises,
|
||||
// this.endNoiseSettings
|
||||
// );
|
||||
//
|
||||
// WorldPresets.bootstrapPresets(presets, overworldStem, netherContext, endContext);
|
||||
//
|
||||
// return overworldStem;
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -90,7 +90,8 @@ public class WorldPresets {
|
|||
|
||||
for (Map.Entry<ResourceKey<WorldPreset>, PresetBuilder> e : BUILDERS.entrySet()) {
|
||||
TogetherWorldPreset preset = e.getValue().create(overworldStem, netherContext, endContext);
|
||||
BuiltinRegistries.register(presets, e.getKey(), preset);
|
||||
//TODO: 1.19.3 already frozen
|
||||
//BuiltinRegistries.register(presets, e.getKey(), preset);
|
||||
}
|
||||
BUILDERS = null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue