Giter VIP home page Giter VIP logo

Comments (2)

JimiIT92 avatar JimiIT92 commented on June 8, 2024 1

While this gets fixed, you can try doing something like this:

  • Create the Armor Material before registering the items
  • Register an armor piece (like an helmet) providing an Holder.direct(yourArmorMaterial) as the ArmorMaterial Holder

It's not the best solution but at least it works for now. Of course when this will get patched I recommend switching to the DeferredRegister methods and using the proper RegistryObjects

from minecraftforge.

LexManos avatar LexManos commented on June 8, 2024 1

So, it is an issue with the way I sort the registry fire events. Currently it's being sorted by the first time register is called.
Which usually works, except in cases where the first entry in the registry doesn't force another registry to be initialized, but the nth entry does.
Unfortunately, there is no generic "we're done making all vanilla entries" event in a registry. At least not one that isn't a stagnant order. So we can't gather the order on last register.

For now i've made a solution that works for this simple test case:

    private static final DeferredRegister<ArmorMaterial> ARMORS = deferred(Registries.ARMOR_MATERIAL);
    private static final RegistryObject<ArmorMaterial> ARMOR = ARMORS.register("test", () -> {
        return new ArmorMaterial(
            Collections.emptyMap(),
            1,
            SoundEvents.ARMOR_EQUIP_CHAIN,
            () -> Ingredient.of(Items.IRON_INGOT),
            Collections.emptyList(),
            1.0f, 1.0f
        );
    });
    private static final DeferredRegister<Item> ITEMS = deferred(Registries.ITEM);
    private static final RegistryObject<Item> ARMOR_CHEST = ITEMS.register("test_chest", () -> {
        return new ArmorItem(
            ARMOR.getHolder().orElseThrow(),
            ArmorItem.Type.CHESTPLATE,
            new Item.Properties().durability(ArmorItem.Type.CHESTPLATE.getDurability(15))
        );
    });
    

Eventually I need to go in and simplify the registry system yet again. I really wish Mojang would get their crap together and solve the few minor things that make all our registry hooks necessary. Namely, ID syncing between network and saves for non-data driven registries.

from minecraftforge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.