-
Hey, because I do not create the Items for the Turtles, I don't know how to change the Creative Inventory Tab of my Turtle Upgrades. I already took a look at the Source Code, but I didn't find any solution. |
Beta Was this translation helpful? Give feedback.
Answered by
SquidDev
Mar 18, 2021
Replies: 1 comment 2 replies
-
Easiest solution is to overwrite public void fillItemCategory(@Nonnull ItemGroup group, @Nonnull NonNullList<ItemStack> list) {
if(!allowededIn(group)) return;
super.fillItemCategory(group, list);
// Add turtles
list.add(makeTurtle(TURTLE_NORMAL, "my_upgrade_id"));
list.add(makeTurtle(TURTLE_ADVANCED, "my_upgrade_id"));
}
// Probably put this stuff in a helper class:
// Think this is the syntax for ObjectHolder??
@ObjectHolder("computercraft:turtle_normal") public static Item TURTLE_NORMAL;
@ObjectHolder("computercraft:turtle_advanced") public static Item TURTLE_ADVANCED;
public ItemStack makeTurtle(Item turtle, String upgrade) {
ItemStack stack = new ItemStack(turtle);
stack.getOrCreateTag().putString(RightUpgrade, upgrade);
return stack;
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
SquidDev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Easiest solution is to overwrite
fillItemCategory
for your upgrade items to also add the turtles. So something along the lines of: