gkbm2013 / tinker-IO

Tinker I/O - An addon for Tinkers' Construct!
https://tio.gkbsite.org/
GNU General Public License v3.0
13 stars 8 forks source link

Smart Output causing tps lag when liquids are left in its tank #86

Closed alyip98 closed 6 years ago

alyip98 commented 6 years ago

I believe that the problem is due to SORecipeChecker rebuilding a list of recipes from all registered casting recipes every tick. I'm not sure if this is addressed in the rw version, but if not, could you cache the recipes?

gkbm2013 commented 6 years ago

Could provide the version of Tinker I/O ? Thanks!

alyip98 commented 6 years ago

tinker_io-1.12.2-release 2.6.1, playing Enigmatica 2 Expert

alyip98 commented 6 years ago

From tinker-IO/src/main/java/tinker_io/tileentity/TileEntitySmartOutput.java:

    private void updateRecipe() {
        ItemStack cast = inventory.getStackInSlot(ContainerSmartOutput.PATTERN);
        FluidStack fluidStack = tank.getFluid();
        if(currentMode == MODE_BASIN) {
            currentRecipe = SmartOutputRecipeHandler.findBasinCastingRecipe(cast, fluidStack);
        } else if(currentMode == MODE_CAST) {
            currentRecipe = SmartOutputRecipeHandler.findTableCastingRecipe(cast, fluidStack);
        }
    }

I suggest storing currentRecipe locally and only calling findBasinCastingRecipe when the fluid type has changed

gkbm2013 commented 6 years ago

The code you found is in the RW version. And findBasinCastingRecipe() will be called only if private boolean isChanged() return true.