mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-22 22:29:43 +00:00
Fix: Reset Unique field counters on Mixin application. (#136)
They previously caused hotswaps to fail due to the number increasing on each application.
This commit is contained in:
1 parent
a2091792e8
commit
320b74c2d4
2 files changed
+10
-1
No files matched your search
@@ -76,6 +76,14 @@ class MethodMapper {
|
||||
public ClassInfo getClassInfo() {
|
||||
return this.info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the counters to prepare for application, which can happen multiple times due to hotswap.
|
||||
*/
|
||||
public void reset() {
|
||||
this.nextUniqueMethodIndex = 0;
|
||||
this.nextUniqueFieldIndex = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conforms an injector handler method
|
||||
|
||||
@@ -407,9 +407,10 @@ final class TargetClassContext extends ClassContext implements ITargetClassConte
|
||||
}
|
||||
|
||||
/**
|
||||
* Run extensions before apply
|
||||
* Run extensions before apply and clean up any global state in case this is a hotswap
|
||||
*/
|
||||
private void preApply() {
|
||||
this.getClassInfo().getMethodMapper().reset();
|
||||
this.extensions.preApply(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user