This should no longer be needed

This commit is contained in:
Frank 2022-07-05 19:14:23 +02:00
parent f679e5241b
commit 19add56099

View file

@ -1,5 +1,7 @@
package org.betterx.betterend.mixin.common;
import com.mojang.serialization.Lifecycle;
import net.minecraft.core.Holder;
import net.minecraft.core.MappedRegistry;
import net.minecraft.resources.ResourceKey;
@ -7,12 +9,45 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(MappedRegistry.class)
public class MappedRegistryMixin<T> {
// TODO Make this a part of BCLib (implement froze/unfroze methods)
@Inject(method = "validateWrite", at = @At("HEAD"), cancellable = true)
private void be_validateWrite(ResourceKey<T> resourceKey, CallbackInfo info) {
info.cancel();
//info.cancel();
}
@Inject(method = "registerMapping(ILnet/minecraft/resources/ResourceKey;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;Z)Lnet/minecraft/core/Holder;", at = @At("HEAD"))
private void be_debugDummy(
int i,
ResourceKey<T> resourceKey,
T object,
Lifecycle lifecycle,
boolean bl,
CallbackInfoReturnable<Holder<T>> cir
) {
if (resourceKey.location().getPath().equals("dark_amaranth_forest")) {
System.out.println("Promenade registers: " + resourceKey);
}
}
@Inject(method = "getOrCreateHolderOrThrow", at = @At("HEAD"))
private void be_debugDummy2(
ResourceKey<T> resourceKey, CallbackInfoReturnable<Holder<T>> cir
) {
if (resourceKey.location().getPath().equals("dark_amaranth_forest")) {
System.out.println("Promenade registers: " + resourceKey);
}
}
@Inject(method = "getOrCreateHolder", at = @At("HEAD"))
private void be_debugDummy3(
ResourceKey<T> resourceKey, CallbackInfoReturnable<Holder<T>> cir
) {
if (resourceKey.location().getPath().equals("dark_amaranth_forest")) {
System.out.println("Promenade registers: " + resourceKey);
}
}
}