
reregistering itemgroup of an existing name, with a different builder, doesnt work as expected?
Merith-TK opened this issue ยท 0 comments
ItemGroup.Builder ITEM_GROUP = new GroupFactory().createGroup(Identifier.of("ovenlib:testgroup"), Text.literal("Original group"));
// Test Group without name or icon
ItemGroup.Builder ITEM_GROUP1 = new GroupFactory().createGroup(Identifier.of("ovenlib:testgroup1"));
/*
At first, I thought adding an entry, and then doing it again
later as shown here for group-1 would work, it does not,
Adding entries must be done all at once,
*/
ITEM_GROUP1.entries((ctx, e) -> {
e.add(Items.ITEM_FRAME); // DOES NOT GET ADDED
});
ITEM_GROUP1.entries((ctx, e) -> {
e.add(Items.GLOW_ITEM_FRAME); // BECAUSE THIS OVERRIDES IT
});
new GroupFactory().register(Identifier.of("ovenlib:testgroup1"), ITEM_GROUP1.build());
// Rebuilding the group does not override it, once you build it the first time that's it.
new GroupFactory().register(Identifier.of("ovenlib:testgroup"), ITEM_GROUP.build());
new GroupFactory().register(Identifier.of("ovenlib:testgroup"), ITEM_GROUP1.build());
That register function is literally just a wrapper with a logger to keep code somewhat-ish clean
[13:43:44] [main/INFO] (ovenlib) Registering Group ovenlib:testgroup1 as literal{Unnamed Bakery}
[13:43:44] [main/INFO] (ovenlib) Registering Group ovenlib:testgroup as literal{Original group}
[13:43:44] [main/INFO] (ovenlib) Registering Group ovenlib:testgroup as literal{Unnamed Bakery}
The third item group, in my understanding should now contain the contents of the first one, due to being registered with the first builder, but instead you get the behaviour shown