This commit is contained in:
Frank 2022-10-26 00:06:06 +02:00
parent 9fcec2b033
commit 409534e6f1
9 changed files with 39 additions and 68 deletions

View file

@ -18,7 +18,6 @@ import net.minecraft.world.level.dimension.LevelStem;
public final class BCLibPatch {
public static void register() {
// TODO separate values in config on client side (config screen)
if (Configs.MAIN_CONFIG.repairBiomes() && (GeneratorOptions.fixEndBiomeSource() || GeneratorOptions.fixNetherBiomeSource())) {
DataFixerAPI.registerPatch(BiomeSourcePatch::new);
}

View file

@ -120,7 +120,6 @@ public class StructureWorld {
BlockState[] states = new BlockState[map2.size()];
for (int i = 0; i < states.length; i++) {
states[i] = NbtUtils.readBlockState(
//TODO: 1.19.3 This appears to be used on a level registry, not the global one?
HolderLookup.forRegistry(Registry.BLOCK),
(CompoundTag) map2.get(i)
);

View file

@ -36,7 +36,6 @@ public class TextureAtlasMixin {
private boolean bclib_modifyAtlas;
private static ResourceManager bclib_resourceManager;
//TODO: 1.19.3 How were FabricSprites replaced?
@Inject(method = "<init>*", at = @At("TAIL"))
private void bclib_onAtlasInit(
ResourceLocation textureAtlasLocation,

View file

@ -1,35 +0,0 @@
package org.betterx.bclib.mixin.common;
import net.minecraft.core.RegistryAccess;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(RegistryAccess.class)
public interface RegistryAccessMixin {
//TODO: 1.19.3 Will probably be a new custom data provider now
// @ModifyArg(method = "<clinit>", at = @At(value = "INVOKE", target = "Lnet/minecraft/Util;make(Ljava/util/function/Supplier;)Ljava/lang/Object;"))
// private static Supplier<ImmutableMap<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>>> together_addRegistry(
// Supplier<ImmutableMap<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>>> supplier
// ) {
// return () -> {
// ImmutableMap.Builder<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>> builder = ImmutableMap.builder();
// //Make sure this gets added before WORLD_PRESETS
// put(builder, BCLBiomeRegistry.BCL_BIOMES_REGISTRY, BiomeData.CODEC);
//
// Map<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>> res = supplier.get();
// builder.putAll(res);
//
// return builder.build();
// };
// }
//
// @Shadow
// static <E> void put(
// ImmutableMap.Builder<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>> builder,
// ResourceKey<? extends Registry<E>> resourceKey,
// Codec<E> codec
// ) {
// throw new RuntimeException("Shadowed Call");
// }
}

View file

@ -0,0 +1,35 @@
package org.betterx.bclib.mixin.common;
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeRegistry;
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeData;
import net.minecraft.resources.RegistryDataLoader;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.ArrayList;
import java.util.List;
@Mixin(RegistryDataLoader.class)
public interface RegistryDataLoaderMixin {
@Accessor("WORLDGEN_REGISTRIES")
@Mutable
static void wt_set_WORLDGEN_REGISTRIES(List<RegistryDataLoader.RegistryData<?>> list) {
//SHADOWED
}
@Inject(method = "<clinit>", at = @At("TAIL"))
private static void wt_init(CallbackInfo ci) {
List<RegistryDataLoader.RegistryData<?>> enhanced = new ArrayList(RegistryDataLoader.WORLDGEN_REGISTRIES.size() + 1);
enhanced.addAll(RegistryDataLoader.WORLDGEN_REGISTRIES);
enhanced.add(new RegistryDataLoader.RegistryData<>(
BCLBiomeRegistry.BCL_BIOMES_REGISTRY, BiomeData.CODEC
));
wt_set_WORLDGEN_REGISTRIES(enhanced);
}
}

View file

@ -16,7 +16,7 @@ import java.util.ArrayList;
import java.util.List;
@Mixin(RegistryDataLoader.class)
public abstract class RegistryAccessMixin {
public abstract class RegistryDataLoaderMixin {
@Accessor("WORLDGEN_REGISTRIES")
@Mutable
static void wt_set_WORLDGEN_REGISTRIES(List<RegistryDataLoader.RegistryData<?>> list) {
@ -33,29 +33,4 @@ public abstract class RegistryAccessMixin {
));
wt_set_WORLDGEN_REGISTRIES(enhanced);
}
//TODO: 1.19.3 This will probably be a new kind of DataProvider.
// @ModifyArg(method = "<clinit>", at = @At(value = "INVOKE", target = "Lnet/minecraft/Util;make(Ljava/util/function/Supplier;)Ljava/lang/Object;"))
// private static Supplier<ImmutableMap<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>>> together_addRegistry(
// Supplier<ImmutableMap<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>>> supplier
// ) {
//
// return () -> {
// Map<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>> res = supplier.get();
// ImmutableMap.Builder<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>> builder = ImmutableMap.builder();
//
// builder.putAll(res);
// put(builder, SurfaceRuleRegistry.SURFACE_RULES_REGISTRY, AssignedSurfaceRule.CODEC);
// return builder.build();
// };
// }
//
// @Shadow
// static <E> void put(
// ImmutableMap.Builder<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>> builder,
// ResourceKey<? extends Registry<E>> resourceKey,
// Codec<E> codec
// ) {
// throw new RuntimeException("Shadowed Call");
// }
}

View file

@ -47,8 +47,7 @@ public abstract class WorldPresetsBootstrapMixin {
private Holder<NoiseGeneratorSettings> endNoiseSettings;
//see WorldPresets.register
//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(

View file

@ -31,7 +31,7 @@
"RecipeManagerAccessor",
"RecipeManagerMixin",
"RecipeMixin",
"RegistryAccessMixin",
"RegistryDataLoaderMixin",
"ServerAdvancementManagerMixin",
"ServerLevelMixin",
"ShovelItemAccessor",

View file

@ -15,7 +15,7 @@
"NoiseBasedChunkGeneratorMixin",
"NoiseGeneratorSettingsMixin",
"PrimaryLevelDataMixin",
"RegistryAccessMixin",
"RegistryDataLoaderMixin",
"RegistryOpsAccessor",
"TagLoaderMixin",
"WorldGenPropertiesMixin",