
Using a eternal stella on a item does not lead to the unbreakable component being applied
Closed this issue ยท 2 comments
Most if not all mods expect items to only be unbreakable when they have the unbreakable component, however since F&A handles this with it's own component compat with other mods is not great, you should be applying the unbreakable component whenever the eternal stella is applied on a item.
Relevent: Creators-of-Create/Create#8193
Hi @IThundxr, thanks for the report
While adding the Unbreakable
component to every eternal item might be a solution, I would prefer to not do this. Compatibility should still be doable, at least I haven't heard any such issues from other mods yet.
I took a quick look at the Super Glue code and noticed a few things.
The whole method currently returns true
if any item in the inventory has the Unbreakable
component, this seems wrong as I guess it should only check for unbreakable super glues.
https://github.com/Creators-of-Create/Create/blob/1491ed3a620b3f78f02fc09386f3b98bee37b637/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueSelectionHelper.java#L77
Furthermore, you don't need to check if the item is damageable before using stack.hurtAndBreak
.
So simply removing this check altogether should allow compatibility with the Eternal Stella.
this code should fix this and allow compat with the Eternal Stella (untested, written from the top of my head)
for (int i = -1; i < items.size(); i++) {
int slot = i == -1 ? player.getInventory().selected : i;
ItemStack stack = items.get(slot);
if (stack.isEmpty())
continue;
if (!(stack.getItem() instanceof SuperGlueItem))
continue;
if (!simulate)
stack.hurtAndBreak(requiredAmount, player, i == -1 ? SuperGlueItem::onBroken : $ -> {
});
return true;
}