Electrical-Age / ElectricalAge

Electrical Age (ELN) is a Minecraft Mod offering the ability to perform large-scale in-game electrical simulations.
https://electrical-age.net/
Other
212 stars 96 forks source link

Farming lamps don't work exclusively on crops. #776

Open DonBruce64 opened 7 years ago

DonBruce64 commented 7 years ago

Farming lamps tick blocks indiscriminately without regards to the block itself. This means that non-crop blocks from other mods that use block ticks can have extra update ticks applied to them. Not good for blocks that use ticks for processing or rendering.

OmegaHaxors commented 7 years ago

Not to sound like the developer of Railcraft on his hidden air block or anything, but it seems this is a case of reasonable assumption of mod design. Why are mods using random ticks for unrelated events when so many tick-accelerating mechanics exist in modded MC? As far as I understand random tick acceleration is the standard method for crop growth boosters.

Can I have a specific example of this causing unintentional behavior?

DonBruce64 commented 7 years ago

Take the Realistic Torches mod. In order to do its torch burnout it schedules an update tick X seconds in the future, on which it burns itself out. This is done to prevent having to use TEs to track burnout time. Therefore anything that calls the block's updateTick() method will cause it to burn out.

In the case of the farming lamp, that means that the torch will burn out much faster as the lamp calls that method without checking to see if the block is even scheduled to receive updates. In the torch's case, setTickRandomly(false) is called in the constructor, indicating that the torch should not even be ticked by tick-accelerating mods. At a minimum a check to see if the block is set to tick randomly would be nice before applying the random tick. A more robust way would to be to somehow check if the block drops foodstuffs, but I'm aware that's a bit more involved.