#Error when trying to create a custom casing block

7 messages · Page 1 of 1 (latest)

unborn sky
#
static {
        REGISTRATE.creativeModeTab(() -> GTGCCreativeModeTab.MAIN);
    }

    public static final BlockEntry<Block> STERILE_MACHINE_CASING = createCasingBlock("sterile_machine_casing",
            GTGardenCore.id("block/casing/sterile_machine_casing"));

    public static BlockEntry<Block> createCasingBlock(String name, ResourceLocation texture) {
        return createCasingBlock(name, Block::new, texture, () -> Blocks.IRON_BLOCK,
                () -> RenderType::cutoutMipped);
    }

    @SuppressWarnings("removal")
    public static BlockEntry<Block> createCasingBlock(String name,
                                                      NonNullFunction<BlockBehaviour.Properties, Block> blockSupplier,
                                                      ResourceLocation texture,
                                                      NonNullSupplier<? extends Block> properties,
                                                      Supplier<Supplier<RenderType>> type) {
        return REGISTRATE.block(name, blockSupplier)
                .initialProperties(properties)
                .properties(p -> p.isValidSpawn((state, level, pos, ent) -> false))
                .addLayer(type)
                .blockstate(GTModels.cubeAllModel(name, texture))
                .tag(GTToolType.WRENCH.harvestTags.get(0), BlockTags.MINEABLE_WITH_PICKAXE)
                .item(BlockItem::new)
                .build()
                .register();
    }

    public static void init() {};
#

And then in my main Mod class

REGISTRATE = GTRegistrate.create(GTGardenCore.MOD_ID);
        GTGCItems.init();
        GTGCBlocks.init();

        var bus = FMLJavaModLoadingContext.get().getModEventBus();
        bus.register(this);
        bus.addGenericListener(GTRecipeType.class, this::registerRecipeTypes);
        bus.addGenericListener(MachineDefinition.class, this::registerMachines);
        bus.addGenericListener(SoundEntry.class, this::registerSounds);

This code gives me an error that says
Caused by: java.lang.IllegalStateException: [register] registry gtceu:sound has been frozen
Any ideas

unborn sky
#

I’ve looked at GTCAs and Cosmic Cores code and I can’t find any differences

patent totem
#

you aren't allowed to access GTToolType.WRENCH.harvestTags.get(0) before GT initializes it
most addons copy the actual tag to some other place and this should be fixed completely whenever 1.7.0 comes around

patent totem
#

some util class

#

your pick