Closed za3k closed 6 years ago
I agree with the concept and have had the same thoughts - but don't see a way in Forge's modding framework to change the stacking behavior away from the default (where it compares to see if the items are identical or not - and since each stack of meat has a different use-by date, they are different and not identical from the view of MC's stacking code). I'll keep looking for a solution or workaround.
What about a (configurable) grace period for all items in the user's inventory before decay begins? Supposing carrots lasted for 30 seconds before beginning to decay, and that 30-second timer reset every time I picked up a fresh, un-decayed carrot, I could harvest an entire field of them and store them as a single stack with a single decay clock, as long as I never paused for longer than 30 seconds during the harvest. Similarly, if I killed an entire herd of cows/pigs/whatever, all the meat would have the same decay clock as long as I didn't dawdle during my horrific slaughter.
I'm not a modder, so I don't know if this sort of approach is even compatible with the way your code works.
@MessyConfessor - Interesting idea!
I don't know if I could get something similar to work though - the whole rot portion of the system is event-based for efficiency, and so when a rottable item is created it initializes the rot data. Minecraft+Forge doesn't seem to allow overriding of stacking checks, and it insists the items be completely identical (other than item count) to stack.
If the system waits after an item is created for X seconds to set rot data, the tooltip would be incorrect (not having the data to display) during that time, and other events (like putting the item in a preserving container, or soon going through portal) need to modify the rot data that wouldn't yet be present (thus resulting in an invalid state when the X seconds pass and the rot data is set).
Stacking has been improved in version 4.0.3.
The config option Rotting.chunkingPercentage (defaults to 1) makes it so that every rotable item created within discrete time lengths (1% of its rot time with chunkingPercentage set to 1) will be able to stack.
The only negative is rot percentage will stay at 0% a little longer than before (since the system basically gives 1% bonus time at beginning). Also, it is possible for an rotable item to be created right before time-chunk-0 ends then another immediately afterward when time-chunk-1 begins and not be able to stack.
Hell yeah, excellent implementation.
Thanks so much! I'll keep playtesting but this will make it so much more fun!
Love the mod idea, an innovative mechanic. I'm trying it in a survival test world along with Hunger Overhaul for balance in a modpack.
I find that if kill a herd of cows at the beginning of the game, my inventory is full (stacks of 2-3 meat each). It would be amazingif stack combined a bit better (for example, merging together and averaging rottenness %s if they are pretty close, maybe 0.5-1 day). I see that the furnace succeeds at smelting a stack even while rot happens.