Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registroid auto registration silently fails #9

Open
PaintNinja opened this issue Jun 16, 2023 · 1 comment
Open

Registroid auto registration silently fails #9

PaintNinja opened this issue Jun 16, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@PaintNinja
Copy link
Member

PaintNinja commented Jun 16, 2023

The DeferredRegister is never registered to the modBus, with no compiler errors or warnings.

Here's the item class and its compiled output:

@CompileStatic
final class CoinItems {
    @Registroid
    public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, NinjasCash.MOD_ID)

    static final Item ONE_PENCE = NinjasCash.newBasicItem()
}
public final class CoinItems implements GroovyObject {
    public static final DeferredRegister<Item> ITEMS;
    @Generated
    private static final RegistryObject<Item> $registryObjectForONE_PENCE;

    static {
        DeferredRegister var0 = DeferredRegister.create(ForgeRegistries.ITEMS, NinjasCash.MOD_ID);
        ITEMS = var0;
        RegistryObject var1 = ITEMS.register("one_pence", () -> {
            return NinjasCash.newBasicItem();
        });
        $registryObjectForONE_PENCE = var1;
    }

    @Generated
    private static Item getONE_PENCE() {
        return (Item)$registryObjectForONE_PENCE.get();
    }
}

And here's the main mod entrypoint class:

@CompileStatic
@GMod(NinjasCash.MOD_ID)
final class NinjasCash {
    @PackageScope static final String MOD_ID = 'ninjascash'
    
    NinjasCash() {}

    @PackageScope static Item newBasicItem() {
        return new Item(new Item.Properties())
    }
}
@GMod("ninjascash")
public final class NinjasCash implements GroovyObject {
    static final String MOD_ID = "ninjascash";
    private final GModEventBus modBus;
    private final IEventBus forgeBus;

    public NinjasCash() {
        GModEventBus var1 = GMLModLoadingContext.get().getModEventBus();
        this.modBus = var1;
        IEventBus var2 = MinecraftForge.EVENT_BUS;
        this.forgeBus = var2;
    }

    static Item newBasicItem() {
        return new Item(new Item.Properties());
    }

    @Generated
    public GModEventBus getModBus() {
        return this.modBus;
    }

    @Generated
    public IEventBus getForgeBus() {
        return this.forgeBus;
    }
}
@PaintNinja PaintNinja added the bug Something isn't working label Jun 16, 2023
@PaintNinja
Copy link
Member Author

The issue persists with CGL 0.3.6

@PaintNinja PaintNinja reopened this Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant