Blood Magic

Blood Magic

90M Downloads

Compression Sigil Disconnect

Trcx528 opened this issue ยท 7 comments

commented

After crafting and activating a compression sigil, all the player on the server (eventually including myself) would be disconnect. An admin speculated that it could be sending packet spam to the other players.

commented

Can you provide a server log from that time?

commented

The Compression Sigil also "soft crash" singleplayer. its like a huge tick lag that never ends. the console also say nothing about this

commented

I assume that this happens because the AdvancedCompressionHandler's compressInventory-Method calls the getRecipe and isResultStackReversible-Method two times for every ItemStack in the inventory.

  • getRecipe calls CraftingManager.getInstance().findMatchingRecipe.
  • isResultStackReversible calls getRecipe again and also does a findMatchingRecipe as well.

If my math is not totally off, this results in 6 findMatchingRecipe-calls per ItemStack per onUpdate?
I think its safe to assume that this is a horrible idea.

Crafting Recipes should not be that variable: you can probably query the CraftingManager once for all IRecipes and search for Compression-Recipes and create BaseCompressionHandlers for them.

commented

If recipes added after postInit really are a problem you can probably just read them on the first Compression-Tick.
I think custom IRecipe-Implementations might be more problematic, because you cannot read their ingredient requirements without writing custom code for them. (AE2, for example)

On the other hand: It will not be a serious problem if it does not work for ALL of the modded items... i think nobody should expects full mod interoperability anyway...

commented

Yeah, this is going to be my goal going forward. I am going to add in my postInit a query of all crafting recipes that are reversible in the manner that I need. If mods add stuff after this post init, it may be rather bothersome, but alas I won't be able to do anything. I at least have the other compression handler that will be able to handle the stuff for that, so they'll be able to do that.

Wonder how hard it will be to make my own crafting handler for this. I suppose it'll just be a question of copying it and just having a list of the particular recipes.

commented

I think it is now fixed in the latest commit. There are some issues of lost materials, but that I will be able to sort out later.

commented

If i understand 8fbb19a correctly you reduce the amount of recipes you have to search through by only adding recipes for items to the list for which you can find Decompression-Recipes. That should drastically reduce the amount of recipes that need to be searched and solve the issue.

If i find time i might propose a different way of implementing this, though, because i think the solution i have stuck in my head is easier to read and execute.