Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.