Jump to content

Register an item that uses another as a container? (1.15.2)


Recommended Posts

Posted

I recently changed my registration structure to use deferred register for scalability reasons and have encountered an error.

 

One of my items called GAS_TANK, and is being registered like so:

//Gas Tanks
public static final RegistryObject<Item> GAS_TANK = ITEMS.register("gas_tank",
        () -> new Item(PropertiesGeneric));

private static final Item.Properties PropertiesGasTank = new Item.Properties().group(solidarityGroup)//solidarityGroup)
        .maxStackSize(1).containerItem(GAS_TANK.get());

public static final RegistryObject<Item> GAS_TANK_CO2 = ITEMS.register("gas_tank_co2",
        () -> new Item(PropertiesGasTank));
public static final RegistryObject<Item> GAS_TANK_SO2 = ITEMS.register("gas_tank_so2",
        () -> new Item(PropertiesGasTank));

I'm trying to make some more items that use GAS_TANK as a containerItem, similar water/lava buckets, so they won't be consumed when used as an ingredient or fuel. However, since GAS_TANK won't be registered yet, it gives me an error when trying to run the line that defines PropertiesGasTank.

How should I arrange/modify the code so that I can set GAS_TANK as the containerItem for the gas tank variants?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.