-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix CME from Accessing World in onLoad #1623
Conversation
I think there is a similar reference to |
This is a bug that is extremely difficult (maybe even close to impossible) to replicate but I experienced it in my world. Doing this change resolved it and I witnessed no functional change. |
It seems to me that there is a backwards compatibility issue where a MetaTileEntity could do
This possibility could be avoided if the patch was instead implemented in MetaTileEntityHolder
|
Doing this for the pipes looks to be more complicated. The pipes have 2 different states, ticking and not ticking. The redstone power cache is however maintained for both types. Without a first tick for non ticking pipes its not so simple to move the onLoad() One possible implementation is to make it lazily initialised, something like:
But notice the "What to do here?" question in the code. This code is invoked on a block update next to the pipe. But it could also miss an update if we don't. Maybe it should always fire the change if redstoneInitialised == false? |
AFAICT, the only usecase for the redstone signal in base GTCE is the machine controller |
My example code above for the pipe lazy initialsation has a "recursion" problem. |
Pending GTCE PRs: GregTechCE/GregTech#1623 GregTechCE/GregTech#1724 GregTechCE/GregTech#1733 Lang file adjustment: Fixes #852 by overriding the electrolyzer name in lang files All changes source code is here: Nomifactory/GregTech@master...bansoukou
Remove patch from GregTechCE/GregTech#1623 Add mod "CensoredASM" 4.4 - Add its config file * disable reuseBucketQuads - Among other things, should patch the cause of the redstone first-tick bug throwing a ConcurrentModificationException in rare circumstances on world loads (GregTechCE/GregTech#1256). Add mod MixinBooter 2.0 (library/dependency)
What:
This PR simply moves the check for redstone power out of
MetaTileEntity#onLoad
intoMetaTileEntity#update
with a check ensuring it only runs on first tick. As it was before, it caused a ConcurrentModificationException in some cases, detailed in #1256, caused by a known bug in Forge: MinecraftForge/MinecraftForge#2365.How solved:
I moved the redstone check from
onLoad
toupdate
with a check for first tick.Outcome:
getRedstonePower
Possible compatibility issue:
None expected