desht / ModularRouters

A Forge Mod for item routers with pluggable modules
18 stars 21 forks source link

Inspection filter, differentiate 0% and no durability #131

Closed tvanderka closed 3 years ago

tvanderka commented 3 years ago

Minecraft: 1.16.5 Forge: 36.1.2 Mod: 1.16.5-7.4.0-55

I want to filter items with ANY durability, but items with 1/1000=0% durability are matched the same way as items without durability. This is caused by fix for #20, changing to val.orElse(-1) should work here https://github.com/desht/ModularRouters/blob/af547758f3b93da171f5f4f6c99b609779a415d8/src/main/java/me/desht/modularrouters/logic/filter/matchers/InspectionMatcher.java#L85

desht commented 3 years ago

Are you using an Inspection Filter with "durability >= 0%" to match any item that has any durability?

Yeah, I can see the problem (since that filter also matches items that don't have durability at all). Your fix does work for this case, but I'll need to do some more testing to ensure something else doesn't break....

desht commented 3 years ago

Fixed in 7.5.0