Closed Technici4n closed 2 years ago
I want to point out that assert
is not used in that class, it is a simple check.
when such items are stacked accidentally
shouldn't that simply not happen? What is megane doing that it might? Anyway, if it can be so common, I suggest a return and a logging before that, so the MC instance doesn't crash. Simple removal won't do...
"Assertions" are the general pattern, in this case it's a hard crash if the count is not exactly 1: https://github.com/TechReborn/Energy/blob/master/src/main/java/team/reborn/energy/api/base/SimpleBatteryItem.java#L54
generally that exception could be caught
Yes, but it's annoying, and the exception isn't very useful anyway.
Trust me, I wrote that code :P
We should remove these assertions from
SimpleBatteryItem
, they are not particularly useful and can cause crashes when such items are stacked accidentally (for example by megane for rendering purposes).