Diamond Pipe doesn't distinguish cables from ic2
ashlanderr opened this issue · 8 comments
- Minecraft Version: 1.12.2
- Forge Version: 14.23.5.2847
- BuildCraft Version: buildcraft-all-7.99.24.5
- IndustrialCraft Version: industrialcraft-2-2.8.176-ex112
Steps to reproduce the behavior:
- Create a diamond pipe.
- Attach two cobblestone pipes for output.
- Attach some pipe for input.
- In diamond pipe filters, set "Copper Cable" for the first pipe, and "Insulated Copper Cable" for the second.
- Pass multiple cables into the diamond pipe.
Expected: The "Copper Cable" must go out from the first pipe, and the "Insulated Copper Cable" - from the second pipe.
Actual: The items choose pipes randomly.
This also works with "Tin Cable".
For some reason ic2 stores insulated cable variants in NBT, rather than in the items metadata or as a different item, however the diamond pipe doesn't filter by NBT - instead you can use a list, and click the P
button to make it compare items precisely.
We don't filter by NBT by default because NBT is normally used for things with large variance - like written books, or the amount of liquid in a container, etc. For ic2 however it might make sense to compare the specific NBT tags that ic2 uses, as insulated cables should probably be sortable by default. (However that would need to go in compat somehow rather than in base BC).
I think the problem is here.
if (base.getItem() != comparison.getItem()) {
return false;
}
Somehow "Copper Cable" and "Insulated Copper Cable" have the same stack.getItem()
object.
I've changed the condition, and now it works.
if (!Objects.equals(base.getDisplayName(), comparison.getDisplayName())) {
return false;
}
I know, it's not a good idea to compare items by name, but now we know where is the problem.
Thank you for the reference to a list. It was hard to find any info about the list and its usage with diamond pipes.
If you don't mind, I want to try to fix the issue. My idea is to add some registry of comparison rules to the StackUtils. Other mods, like BuildCraftCompat, can use this registry to add their own rules. These rules can represent some "common sense comparison", like the difference between insulated and simple cables.
I've finally released this fix in 7.99.24.7 - sorry for the delay.