CivClassic / FactoryMod

Configurable factories for automating item production - Built for Paper 1.16.5
Other
2 stars 17 forks source link

Fix compactors continuing to run when full #13

Closed Falvyu closed 4 years ago

Falvyu commented 4 years ago

This changes stops compactors when there is not enough space left in the chests and prints a message when that happens. (see #10)

This is done by adding a boolean return value to the applyEffect() method of "IRecipe" interface and updating it for derived classes. This return value is checked by the FurnCraftChestFactory class in its run() method.

The proposed behavior is to deactivate the factory when the recipe fails and print a warning message. The DecompactingRecipe and the PylonRecipe are the only recipe that check and return false when the chest is full (the one in PylonRecipe was already testing if the output fit in and was returning if that was the case. Changing that wasn't really hard). Other recipes do not currently test this condition but it's not a difficult fix.

It's also worth noting that this behavior might break some existing devices: For instance, someone could use a hopper to evacuate decompacted items. The hopper rate wouldn't be able to follow the factory's rate but it'd still eventually work without deleting anything as the compactor would simply loop the recipe. With the new behavior, such systems would break. It's not a major regression but it might be worth considering.