[1.71][BUG+FIX] Fertilizer and Hydration cells are very broken

  • Warning: This bug report contains information obtained by decompiling the agriculture system. Do not read if you are concerned about spoilers.


    As of 1.71, fertilizer (IC2 or plain bonemeal) and hydration cells are very broken. The water and nutrient storage values range from 0-200, but are stored in a signed byte, with a range of -128 to +127. This produces two extremely bad results:


    • Using a single fertilizer on a new crop tile is fine, as the nutrient storage becomes 100.
    • A second fertilizer will raise the nutrient storage to 200, which wraps around to -56, causing a permanent -2 penalty to nutrient score vs an unfertilized tile. Additional fertilizer will continue oscillating between positive and negative until it reaches a value between 101 and 127; on a new crop tile, this happens after 14 consecutive uses.
    • Using a hydration cell is even worse, as it sets the water storage to 200 directly, again wrapping around to -56 and causing a -2 penalty. Additional uses consume 256 water from the cell, but do not alter the water storage. Using a water cell or bucket will reset the water storage to +10.


    The basic fix is simple: make the value for both storage types unsigned. Additional work may be required to handle NBT save/load; I haven't looked.



    Edit: Confirmed that this is still present in 1.71.

    • Official Post

    *headdesk*
    Why in gods name did i use a byte in first place... Got infected by Mojangs "save-bits"-manic.


    You could have just said "the values reachable by hydration/nutrients can exceed their types maximum" though.

  • I have a theory that it's impossible to become a good programmer without realizing that you are (at least occasionally) a complete idiot. The computer keeps proving it by doing exactly what you said to... which wasn't at all what you meant.


    And yeah, I suppose I could have been less specific, but it goes against the grain for me. My instinct on bug reports is to include as much information as possible, so that it's really easy to see exactly what went wrong and how to fix it. I suppose I could send a PM next time, if you'd rather?