Fix potion effect values may be null
This commit is contained in:
parent
86e1562219
commit
6c8d6d832a
|
@ -0,0 +1,28 @@
|
||||||
|
package io.izzel.arclight.common.mixin.bukkit;
|
||||||
|
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@Mixin(PotionEffectType.class)
|
||||||
|
public class PotionEffectTypeMixin {
|
||||||
|
|
||||||
|
@Shadow @Final private static PotionEffectType[] byId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author IzzelAliz
|
||||||
|
* @reason
|
||||||
|
*/
|
||||||
|
@Overwrite
|
||||||
|
@NotNull
|
||||||
|
public static PotionEffectType[] values() {
|
||||||
|
int from = byId[0] == null ? 1 : 0;
|
||||||
|
int to = byId[byId.length - 1] == null ? byId.length - 1 : byId.length;
|
||||||
|
return Arrays.copyOfRange(byId, from, to);
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,6 +26,7 @@
|
||||||
"JavaPluginLoaderMixin",
|
"JavaPluginLoaderMixin",
|
||||||
"JavaPluginMixin",
|
"JavaPluginMixin",
|
||||||
"MaterialMixin",
|
"MaterialMixin",
|
||||||
"PluginClassLoaderMixin"
|
"PluginClassLoaderMixin",
|
||||||
|
"PotionEffectTypeMixin"
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user