3
0

fix getById can not get mod's potion

This commit is contained in:
聪聪 2017-06-25 19:11:11 +08:00
parent a9e1137c30
commit 6556b08a43

View File

@ -9,19 +9,18 @@
private static final Map<String, PotionEffectType> byName = new HashMap<String, PotionEffectType>(); private static final Map<String, PotionEffectType> byName = new HashMap<String, PotionEffectType>();
// will break on updates. // will break on updates.
private static boolean acceptingNew = true; private static boolean acceptingNew = true;
@@ -216,9 +216,9 @@ @@ -216,9 +216,7 @@
*/ */
@Deprecated @Deprecated
public static PotionEffectType getById(int id) { public static PotionEffectType getById(int id) {
- if (id >= byId.length || id < 0) - if (id >= byId.length || id < 0)
+ if (id >= byId.size() || id < 0) // Cauldron - return null;
return null;
- return byId[id]; - return byId[id];
+ return byId.get(id); // Cauldron + return byId.get(id); // Cauldron
} }
/** /**
@@ -240,15 +240,18 @@ @@ -240,15 +238,18 @@
* @param type PotionType to register * @param type PotionType to register
*/ */
public static void registerPotionEffectType(PotionEffectType type) { public static void registerPotionEffectType(PotionEffectType type) {
@ -42,7 +41,7 @@
} }
/** /**
@@ -264,6 +267,11 @@ @@ -264,6 +265,11 @@
* @return Array of types. * @return Array of types.
*/ */
public static PotionEffectType[] values() { public static PotionEffectType[] values() {