Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [SOLVED] ItemModelProperties override not working when iterating
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
Korall

[SOLVED] ItemModelProperties override not working when iterating

By Korall, November 7, 2020 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Korall    0

Korall

Korall    0

  • Tree Puncher
  • Korall
  • Members
  • 0
  • 10 posts
Posted November 7, 2020 (edited)

I have this piece of code that gets called with DefferedWorkQue.runLater and it works without issue

        ItemModelsProperties.func_239418_a_(ModItems.FLINTLOCK_MUSKET.get(), new ResourceLocation(MatchlockGuns.modID, "is_loading"),
                (stack, world, entity) -> {

                    if(stack.getTag().getBoolean("is_loading"))
                    {
                        return 1f;
                    }
                    return 0f;
                }
        );

 

However, I want this property to apply to all of my items of a certain type, but when I try to iterate on this, it doesn't seem to work anymore and does nothing, no errors.

        ModItems.ITEMS.getEntries().forEach(
                (itemRegister) -> {
                    if(itemRegister.get() instanceof GunItem)
                        ItemModelsProperties.func_239418_a_(itemRegister.get(), new ResourceLocation(MatchlockGuns.modID, "is_loading"),
                                (stack, world, entity) -> {

                                    if(stack.getTag().getBoolean("is_loading"))
                                    {
                                        return 1f;
                                    }
                                    return 0f;
                                }
                        );
                }
        );

I've also tried some other forms of iteration, but none of them seem to work. What is the issue here? And is there any way to add a model property to all items of a certain type without having to manually add it for each of them?

 

Another thing I've tried is to call the runLater function for each item inside the Item class constructor, but this again does nothing

Edited November 7, 2020 by Korall
  • Quote

Share this post


Link to post
Share on other sites

poopoodice    114

poopoodice

poopoodice    114

  • Dragon Slayer
  • poopoodice
  • Members
  • 114
  • 900 posts
Posted November 7, 2020

Can you provide a repo?

  • Thanks 1
  • Quote

Share this post


Link to post
Share on other sites

Korall    0

Korall

Korall    0

  • Tree Puncher
  • Korall
  • Members
  • 0
  • 10 posts
Posted November 7, 2020 (edited)
1 hour ago, poopoodice said:

Can you provide a repo?

Nevermind. I figured it out. I just referenced the wrong class in iteration. Needed to be instanceof NewGunItem and not GunItem. Sorry, I'm just kind of tired haha

 

 

Edited November 7, 2020 by Korall
  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • blubb
      My forge server wont make a mods folder

      By blubb · Posted 35 minutes ago

      I got it working Im not sure why but if I had to guess its because I cleaned up my desktop into 2 neat folders and suddenly it works
    • blubb
      My forge server wont make a mods folder

      By blubb · Posted 1 hour ago

      No
    • DaemonUmbra
      My forge server wont make a mods folder

      By DaemonUmbra · Posted 1 hour ago

      Are you renaming any files after reinstalling?
    • blubb
      My forge server wont make a mods folder

      By blubb · Posted 1 hour ago

      Also after that I looked and they where all gone and I tried again but still didn't work
    • blubb
      My forge server wont make a mods folder

      By blubb · Posted 1 hour ago

      Sorry for the late reply but I did that and it was the same thing for all of them
  • Topics

    • blubb
      36
      My forge server wont make a mods folder

      By blubb
      Started 5 hours ago

    • ZDOG22
      0
      [1.16.4] Remove Minecraft Pitch Limit

      By ZDOG22
      Started 3 hours ago

    • Eridani
      0
      Best way to create a new dye.

      By Eridani
      Started 3 hours ago

    • djsweely
      1
      SERVER CRASH

      By djsweely
      Started 4 hours ago

    • Luis_ST
      1
      [1.16.5] Help with custom Glass Block

      By Luis_ST
      Started Friday at 07:35 AM

  • Who's Online (See full list)

    • LuizRique899
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [SOLVED] ItemModelProperties override not working when iterating
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community