#Unable to resolve methods with mixins

3 messages · Page 1 of 1 (latest)

misty marten
#

Thanks in advance to anyone that can help! I am working on a mod that adds new sherds into the game with the help of another modder with more experience. Below is the mixin to add new sherds that works for them, but not for me. This mixin works in a 1.20.1 version, but not a 1.21.

@Mixin(DecoratedPotPatterns.class)
public class DecoratedPotPatternsChanger {

    @Inject(method = "fromSherd", at = @At("HEAD"), cancellable = true)
    private static void fromSherd(Item item, CallbackInfoReturnable<RegistryKey<DecoratedPotPattern>> cir) {
        if (item == ModItems.MELODY_POTTERY_SHERD) {
            cir.setReturnValue(ModCustomSherdPatterns.MELODY_POTTERY_PATTERN);
        }
        if (item == ModItems.RECORD_POTTERY_SHERD) {
            cir.setReturnValue(ModCustomSherdPatterns.RECORD_POTTERY_PATTERN);
        }
        if (item == ModItems.SOLO_POTTERY_SHERD) {
            cir.setReturnValue(ModCustomSherdPatterns.SOLO_POTTERY_PATTERN);
        }
    }

    @Inject(method = "registerAndGetDefault", at = @At("TAIL"), cancellable = true)
    private static void registerAndGetDefault(Registry<DecoratedPotPattern> registry, CallbackInfoReturnable<DecoratedPotPattern> cir) {
        ModCustomSherdPatterns.register(registry, ModCustomSherdPatterns.MELODY_POTTERY_PATTERN, "melody_pottery_sherd");
        ModCustomSherdPatterns.register(registry, ModCustomSherdPatterns.RECORD_POTTERY_PATTERN, "record_pottery_sherd");
        ModCustomSherdPatterns.register(registry, ModCustomSherdPatterns.SOLO_POTTERY_PATTERN, "solo_pottery_sherd");
    }
}
#

This code references the ModCustomSherdPatterns class, which is working as intended. Some things I have done to troubleshoot...

  • Translated from their Mojang mapping to my yarn mappings.
  • Updated gradle
  • Made a separate test project which has the same issue with the example ExampleMixin.java class
  • Updated project and JAVA_HOME to Java 21
  • Rebuild the project and sources
  • Confirms my mixin.json file is set up correctly.
#

The sherds work and can be crafted, its just the mixin which is failing is used to load the textures themselves.