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    117

poopoodice

poopoodice    117

  • Dragon Slayer
  • poopoodice
  • Members
  • 117
  • 925 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

    • Eksity
      Another freaking "error in currently selected datapacks prevented world from loading"

      By Eksity · Posted 2 minutes ago

      fair enough.
    • diesieben07
      Another freaking "error in currently selected datapacks prevented world from loading"

      By diesieben07 · Posted 4 minutes ago

      Well, you can do a binary search: Take out half the mods every time to narrow down the mods you need to check by half every time.
    • Eksity
      Another freaking "error in currently selected datapacks prevented world from loading"

      By Eksity · Posted 7 minutes ago

      great. Is there anything I can do other than go mod-by-mod and test everything?
    • diesieben07
      Another freaking "error in currently selected datapacks prevented world from loading"

      By diesieben07 · Posted 8 minutes ago

      Well, it looks like some of the mods you have installed are breaking your world. I can't tell from the logs which one it is though.
    • Eksity
      Another freaking "error in currently selected datapacks prevented world from loading"

      By Eksity · Posted 10 minutes ago

      also if I save and quit and try to rejoin it doesn't work
  • Topics

    • Eksity
      14
      Another freaking "error in currently selected datapacks prevented world from loading"

      By Eksity
      Started 19 hours ago

    • Ariel David
      1
      Do i need minecraft installed

      By Ariel David
      Started 33 minutes ago

    • Skyriis
      12
      [1.16.5] Adding a Button to KeyBindings

      By Skyriis
      Started Wednesday at 11:07 PM

    • Deadlocked47
      1
      Can't get into forge discord

      By Deadlocked47
      Started 21 hours ago

    • IntentScarab
      6
      (SOLVED)[1.16.4] Block entity invalid

      By IntentScarab
      Started 1 hour ago

  • Who's Online (See full list)

    • vemerion
    • Eksity
    • diesieben07
    • Beethoven92
    • gottsch
    • IntentScarab
    • Aviator737
    • KatiePandaEx
  • 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