Ex Astris

Ex Astris

5M Downloads

Sanguine Utilities Crash

Alex-hawks opened this issue ยท 7 comments

commented

In Sanguine Utilities, I iterate over the list of altar recipes looking for orbs, then doing unchecked casts to IBloodOrb. I intentionally do this unsafe cast to catch what would otherwise be a game-breaking bug so that I may expose it to the author at fault. You have registered an orb fill recipe that does not have an orb as the input and null as the output. You will find it here. To fix it, all you need to do is change the last parameter (a true) to a false.

Related: OpenEye crashlog

Note: this is a clone of LoveHoly#41 after I was linked to this repo

commented

I have fixed this, although deliberately crashing a game because of this isn't something anyone should be doing. I have not registered an "Orb" recipe, as this would be under registerAltarOrbRecipe in the blood magic API. The way the recipe was previously registered, while probably not correct, was still functional.
The usage of the API should be dictated by it's creator/maintainers, not the users.

commented

I'll have to refer you to some of @WayofTime's code, particularly here, where registerAltarOrbRecipe just calls through to the normal registerAltarRecipe with certain predefined parameters, and here, where if the boolean parameter is present, it is always false

commented

The code isn't deliberately crashing, it is just an oversight. Since this is actually github and not a dictatorship, please submit a PR instead of bitching about it. This is not GregTech, this is OS. This is not a professional programmer: this is a person that is coding for fun.

Please remember that I'm not perfect, nor will I ever be. If I do something stupid, let me know and don't just bitch about it when you are able to give a concrete solution.

commented

@WayofTime ๐Ÿ‘

commented

"The usage of the API should be dictated by it's creator/maintainers, not the users."

If the parameter should be false always, unless it's an orb recipe, then the parameter shouldn't be exposed.
Whether my method was correct or not is not the point here. The point is, deliberately crashing the game because something doesn't conform to your standards is not smart. Why do you think people rag on GregTech all the time? It's the same thing.

commented

Just to be clear here, I'm not trying to rag on anyone's API, or implementation methods. The parameter in my method should indeed be false (as has been corrected to). I'm just slightly annoyed that another addon developer is deliberately causing an unnecessary crash. As @WayofTime has implied, @Alex-hawks know's what he's doing, and so could just make a PR for the one-line fix instead. And please, let's try and remain friendly and positive about doing what we like doing.

commented

I just make the (usually) safe expectation that other addon makers use the API the same way that Way uses it in his own code. If it has been used that way, I don't need to check the cast, and the unsafe cast has not and will not cause issues with just Blood Magic installed.