[Changes] Build for 1.19.3-pre3

This commit is contained in:
Frank 2022-11-30 01:40:42 +01:00
parent 0dcb7809b8
commit 7b726d958d
96 changed files with 1315 additions and 1198 deletions

View file

@ -8,6 +8,7 @@ import net.minecraft.client.color.block.BlockColors;
import net.minecraft.client.color.item.ItemColors;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.main.GameConfig;
import net.minecraft.core.registries.BuiltInRegistries;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;

View file

@ -3,7 +3,6 @@ package org.betterx.bclib.mixin.common;
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeRegistry;
import com.mojang.serialization.Lifecycle;
import net.minecraft.core.MappedRegistry;
import net.minecraft.core.Registry;
import net.minecraft.core.WritableRegistry;
import net.minecraft.core.registries.BuiltInRegistries;
@ -18,21 +17,21 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(BuiltInRegistries.class)
public abstract class BuiltinRegistriesMixin {
@Shadow
protected static <T, R extends WritableRegistry<T>> R internalRegister(
private static <T, R extends WritableRegistry<T>> R internalRegister(
ResourceKey<? extends Registry<T>> resourceKey,
R writableRegistry,
BuiltInRegistries.RegistryBootstrap<T> registryBootstrap,
Lifecycle lifecycle
) {
throw new RuntimeException("Shadowed Call");
throw new RuntimeException("Shadowed");
}
//this needs to be added BEFORE the WORLD_PRESET-Registry. Otherwise decoding will fail!
@Inject(method = "<clinit>", at = @At(value = "INVOKE", target = "Lnet/minecraft/data/BuiltinRegistries;registerSimple(Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/data/BuiltinRegistries$RegistryBootstrap;)Lnet/minecraft/core/Registry;", ordinal = 0))
@Inject(method = "<clinit>", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/core/registries/BuiltInRegistries;registerSimple(Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/core/registries/BuiltInRegistries$RegistryBootstrap;)Lnet/minecraft/core/Registry;"))
private static void bcl_registerBuiltin(CallbackInfo ci) {
BCLBiomeRegistry.BUILTIN_BCL_BIOMES = internalRegister(
BCLBiomeRegistry.BCL_BIOMES_REGISTRY,
(MappedRegistry) BCLBiomeRegistry.BUILTIN_BCL_BIOMES,
BCLBiomeRegistry.BUILTIN_BCL_BIOMES,
BCLBiomeRegistry::bootstrap,
Lifecycle.stable()
);

View file

@ -9,9 +9,7 @@ import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.structure.StructureSet;
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.ModifyArg;
@ -19,9 +17,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ChunkGenerator.class)
public class ChunkGeneratorMixin implements ChunkGeneratorAccessor {
@Shadow
@Final
protected Registry<StructureSet> structureSets;
private int bclib_featureIteratorSeed;
@ -41,6 +36,6 @@ public class ChunkGeneratorMixin implements ChunkGeneratorAccessor {
}
public Registry<StructureSet> bclib_getStructureSetsRegistry() {
return structureSets;
return null;
}
}

View file

@ -4,10 +4,8 @@ import org.betterx.bclib.interfaces.NoiseGeneratorSettingsProvider;
import org.betterx.bclib.interfaces.SurfaceProvider;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
import net.minecraft.world.level.levelgen.synth.NormalNoise;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@ -19,9 +17,6 @@ public abstract class NoiseBasedChunkGeneratorMixin implements SurfaceProvider,
@Shadow
protected Holder<NoiseGeneratorSettings> settings;
@Shadow
@Final
private Registry<NormalNoise.NoiseParameters> noises;
@Override
public NoiseGeneratorSettings bclib_getNoiseGeneratorSettings() {
@ -32,9 +27,4 @@ public abstract class NoiseBasedChunkGeneratorMixin implements SurfaceProvider,
public Holder<NoiseGeneratorSettings> bclib_getNoiseGeneratorSettingHolders() {
return settings;
}
@Override
public Registry<NormalNoise.NoiseParameters> bclib_getNoises() {
return noises;
}
}

View file

@ -1,36 +1,22 @@
package org.betterx.bclib.mixin.common;
import org.betterx.bclib.api.v2.generator.BCLChunkGenerator;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
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.CallbackInfoReturnable;
@Mixin(NoiseGeneratorSettings.class)
public abstract class NoiseGeneratorSettingsMixin {
@Shadow
static protected Holder<NoiseGeneratorSettings> register(
Registry<NoiseGeneratorSettings> registry,
ResourceKey<NoiseGeneratorSettings> resourceKey,
NoiseGeneratorSettings noiseGeneratorSettings
) {
return null;
}
;
@Inject(method = "bootstrap", at = @At("HEAD"))
private static void bcl_addNoiseGenerators(
Registry<NoiseGeneratorSettings> registry,
CallbackInfoReturnable<Holder<NoiseGeneratorSettings>> cir
) {
register(registry, BCLChunkGenerator.AMPLIFIED_NETHER, BCLChunkGenerator.amplifiedNether());
}
//TODO:1.19.3 Replaced by Datagen pack file in NoiseDatagen
// @Inject(method = "bootstrap", at = @At("HEAD"))
// private static void bcl_addNoiseGenerators(
// BootstapContext<NoiseGeneratorSettings> bootstapContext, CallbackInfo ci
// ) {
// bootstapContext.register(
// BCLChunkGenerator.AMPLIFIED_NETHER,
// BCLChunkGenerator.amplifiedNether(bootstapContext)
// );
// }
}

View file

@ -1,17 +1,14 @@
package org.betterx.bclib.mixin.common;
import net.minecraft.core.Holder;
import net.minecraft.data.worldgen.Structures;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.levelgen.structure.Structure;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(Structures.class)
public interface StructuresAccessor {
@Invoker
static Holder<Structure> callRegister(ResourceKey<Structure> resourceKey, Structure structure) {
throw new RuntimeException("Unexpected call");
}
//TODO: 1.19.3 Refactor
// @Invoker
// static Holder<Structure> callRegister(ResourceKey<Structure> resourceKey, Structure structure) {
// throw new RuntimeException("Unexpected call");
// }
}

View file

@ -48,7 +48,7 @@ public abstract class BoatMixin extends Entity implements CustomBoatTypeOverride
return bcl_type;
}
@Inject(method = "setType", at = @At("HEAD"), cancellable = true)
@Inject(method = "setVariant", at = @At("HEAD"), cancellable = true)
void bcl_setType(Boat.Type type, CallbackInfo ci) {
if (bcl_type != null) {
this.entityData.set(DATA_ID_TYPE, bcl_type.ordinal());
@ -56,7 +56,7 @@ public abstract class BoatMixin extends Entity implements CustomBoatTypeOverride
}
}
@Inject(method = "getBoatType", at = @At("HEAD"), cancellable = true)
@Inject(method = "getVariant", at = @At("HEAD"), cancellable = true)
void bcl_getBoatType(CallbackInfoReturnable<Boat.Type> cir) {
BoatTypeOverride type = BoatTypeOverride.byId(this.entityData.get(DATA_ID_TYPE));
if (type != null) {