Fix EnumRarity, make sure extensible enums have at least one factory candidate
This commit is contained in:
parent
bda3f1b7c6
commit
cab1b9716c
|
@ -1,9 +1,7 @@
|
|||
--- a/net/minecraft/item/EnumRarity.java
|
||||
+++ b/net/minecraft/item/EnumRarity.java
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.minecraft.item;
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
+import net.minecraft.tileentity.BannerPattern;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
-public enum EnumRarity {
|
||||
|
@ -11,12 +9,12 @@
|
|||
COMMON(TextFormatting.WHITE),
|
||||
UNCOMMON(TextFormatting.YELLOW),
|
||||
RARE(TextFormatting.AQUA),
|
||||
@@ -13,4 +14,8 @@
|
||||
@@ -13,4 +13,8 @@
|
||||
private EnumRarity(TextFormatting p_i48837_3_) {
|
||||
this.field_77937_e = p_i48837_3_;
|
||||
}
|
||||
+
|
||||
+ public static BannerPattern create(String enumName, TextFormatting p_i48837_3_) {
|
||||
+ public static EnumRarity create(String enumName, TextFormatting p_i48837_3_) {
|
||||
+ throw new IllegalStateException("Enum not extended");
|
||||
+ }
|
||||
}
|
||||
|
|
|
@ -88,6 +88,10 @@ public class RuntimeEnumExtender implements ILaunchPluginService {
|
|||
.filter(m -> ((m.access & Opcodes.ACC_STATIC) != 0) && m.name.equals("create") && Type.getReturnType(m.desc).equals(classType))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (candidates.isEmpty()) {
|
||||
throw new IllegalStateException("IExtensibleEnum has no candidate factory methods: " + classType.getClassName());
|
||||
}
|
||||
|
||||
candidates.forEach(mtd ->
|
||||
{
|
||||
Type[] args = Type.getArgumentTypes(mtd.desc);
|
||||
|
|
Loading…
Reference in New Issue