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.

Featured Replies

Posted

Hey there,

 

So I have 4 types of 'gems', in the inventory, they cannot be stacked, however, when they are picked up or /give they look like the respective crystal, but they ended up stacking in the inventory. My explanation might be dull, so here are some captioned pictures of whats happening:

 

 

93056514526d4d3b9de2af6f325eee05.png

In the inventory, the different gems cannot be stacked.

 

7a839c023cda428aa15fece19c2d3417.png

|

v

ccfc539728c1491ea5d83f0b3a66a49f.png

However, when I pick up a clearly non-stackable crystal, it stacks into it.

 

 

 

Here is item class code:

public class ItemMagicGems extends ItemBase {

    public static final Gems[] ALL_GEMS = Gems.values();

    public Gems type;
    private final boolean isEmpowered;



    public ItemMagicGems(String name, boolean isEmpowered) {
        super(name);
        this.setFull3D();
        this.isEmpowered = isEmpowered;

    }

    @Override
    public String getUnlocalizedName(ItemStack stack){
        return stack.getItemDamage() >= ALL_GEMS.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+"_"+ALL_GEMS[stack.getItemDamage()].name;
    }

    @Override
    public boolean hasEffect(ItemStack stack){
        return this.isEmpowered;
    }

    @Override
    public EnumRarity getRarity(ItemStack stack){
        return stack.getItemDamage() >= ALL_GEMS.length ? EnumRarity.COMMON : ALL_GEMS[stack.getItemDamage()].rarity;
    }

    @Override
    @SideOnly(Side.CLIENT)
    public void getSubItems(Item item, CreativeTabs tab, NonNullList list){
        for(int j = 0; j < ALL_GEMS.length; j++){
            list.add(new ItemStack(this, 1, j));
        }
    }

    @Override
    protected void registerRendering(){
        for(int i = 0; i < ALL_GEMS.length; i++){
            String name = this.getRegistryName()+"_"+ALL_GEMS[i].name;
            PlentifulMisc.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(name), "inventory");
        }
    }

}

,

here is how I'm registering them:

        item_gems = new ItemMagicGems("item_gem", false);

 

Thanks

Relatively new to modding.

Currently developing:

https://github.com/LambdaXV/DynamicGenerators

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.