mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-25 02:54:21 +00:00
0.7.11 - Fix handling of maxShiftBy and set hard limit to 5, fixes #265
This commit is contained in:
1 parent
81a22a4f1d
commit
c08fb6bf31
3 files changed
+19
-12
No files matched your search
@@ -34,11 +34,11 @@ import org.spongepowered.asm.mixin.MixinEnvironment.Phase;
|
||||
import org.spongepowered.asm.service.MixinService;
|
||||
|
||||
/**
|
||||
* Bootstaps the mixin subsystem. This class acts as a bridge between the mixin
|
||||
* Bootstraps the mixin subsystem. This class acts as a bridge between the mixin
|
||||
* subsystem and the tweaker or coremod which is boostrapping it. Without this
|
||||
* class, a coremod may cause classload of MixinEnvironment in the
|
||||
* LaunchClassLoader before we have a chance to exclude it. By placing the main
|
||||
* bootstap logic here we avoid the need for consumers to add the classloader
|
||||
* bootstrap logic here we avoid the need for consumers to add the classloader
|
||||
* exclusion themselves.
|
||||
*
|
||||
* <p>In development, where (because of the classloader environment at dev time)
|
||||
@@ -51,7 +51,7 @@ import org.spongepowered.asm.service.MixinService;
|
||||
* its constructor and that would be the end of the story. However we also need
|
||||
* to register the additional tweaker for environment to detect the transition
|
||||
* from pre-init to default and we cannot do this within the tweaker constructor
|
||||
* witout triggering a ConcurrentModificationException in the tweaker list. To
|
||||
* without triggering a ConcurrentModificationException in the tweaker list. To
|
||||
* work around this we register the secondary tweaker from within the mixin
|
||||
* tweaker's acceptOptions method instead.</p>
|
||||
*/
|
||||
@@ -60,7 +60,7 @@ public abstract class MixinBootstrap {
|
||||
/**
|
||||
* Subsystem version
|
||||
*/
|
||||
public static final String VERSION = "0.7.10";
|
||||
public static final String VERSION = "0.7.11";
|
||||
|
||||
/**
|
||||
* Log all the things
|
||||
|
||||
@@ -160,10 +160,9 @@ public abstract class InjectionPoint {
|
||||
public static final int DEFAULT_ALLOWED_SHIFT_BY = 0;
|
||||
|
||||
/**
|
||||
* Hard limit on the value of {@link At#by} which triggers warning/error
|
||||
* (based on environment)
|
||||
* Hard limit on the value of {@link At#by} which triggers error
|
||||
*/
|
||||
public static final int MAX_ALLOWED_SHIFT_BY = 0;
|
||||
public static final int MAX_ALLOWED_SHIFT_BY = 5;
|
||||
|
||||
/**
|
||||
* Available injection point types
|
||||
@@ -665,6 +664,8 @@ public abstract class InjectionPoint {
|
||||
return;
|
||||
}
|
||||
|
||||
String limitBreached = "the maximum allowed value: ";
|
||||
String advice = "Increase the value of maxShiftBy to suppress this warning.";
|
||||
int allowed = InjectionPoint.DEFAULT_ALLOWED_SHIFT_BY;
|
||||
if (context instanceof MixinTargetContext) {
|
||||
allowed = ((MixinTargetContext)context).getMaxShiftByValue();
|
||||
@@ -674,11 +675,17 @@ public abstract class InjectionPoint {
|
||||
return;
|
||||
}
|
||||
|
||||
String message = String.format("@%s(%s) Shift.BY=%d on %s::%s exceeds the maximum allowed value %d.", Bytecode.getSimpleName(parent), point,
|
||||
by, context, method.name, allowed);
|
||||
if (by > InjectionPoint.MAX_ALLOWED_SHIFT_BY) {
|
||||
limitBreached = "MAX_ALLOWED_SHIFT_BY=";
|
||||
advice = "You must use an alternate query or a custom injection point.";
|
||||
allowed = InjectionPoint.MAX_ALLOWED_SHIFT_BY;
|
||||
}
|
||||
|
||||
if (err == ShiftByViolationBehaviour.WARN) {
|
||||
LogManager.getLogger("mixin").warn("{} Increase the value of maxShiftBy to suppress this warning.", message);
|
||||
String message = String.format("@%s(%s) Shift.BY=%d on %s::%s exceeds %s%d. %s", Bytecode.getSimpleName(parent), point,
|
||||
by, context, method.name, limitBreached, allowed, advice);
|
||||
|
||||
if (err == ShiftByViolationBehaviour.WARN && allowed < InjectionPoint.MAX_ALLOWED_SHIFT_BY) {
|
||||
LogManager.getLogger("mixin").warn(message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user