Remove potion array extending
It's already patched by Forge to be 256.
This commit is contained in:
parent
a895809274
commit
eaefd89287
|
@ -1,8 +1,5 @@
|
||||||
package WayofTime.bloodmagic.registry;
|
package WayofTime.bloodmagic.registry;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
|
|
||||||
import net.minecraft.potion.Potion;
|
import net.minecraft.potion.Potion;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import WayofTime.bloodmagic.potion.PotionBloodMagic;
|
import WayofTime.bloodmagic.potion.PotionBloodMagic;
|
||||||
|
@ -19,9 +16,6 @@ public class ModPotions
|
||||||
|
|
||||||
public static void init()
|
public static void init()
|
||||||
{
|
{
|
||||||
if (Potion.potionTypes.length < 256)
|
|
||||||
extendPortionArray();
|
|
||||||
|
|
||||||
new PotionEventHandlers();
|
new PotionEventHandlers();
|
||||||
|
|
||||||
// TODO FUTURE MAKE POTION TEXTURES
|
// TODO FUTURE MAKE POTION TEXTURES
|
||||||
|
@ -43,31 +37,4 @@ public class ModPotions
|
||||||
// ResourceLocation(resourceLocation +
|
// ResourceLocation(resourceLocation +
|
||||||
// heavyHeart.getName().toLowerCase()), true, 0, 0, 0);
|
// heavyHeart.getName().toLowerCase()), true, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void extendPortionArray()
|
|
||||||
{
|
|
||||||
Potion[] potionTypes;
|
|
||||||
|
|
||||||
for (Field f : Potion.class.getDeclaredFields())
|
|
||||||
{
|
|
||||||
f.setAccessible(true);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a"))
|
|
||||||
{
|
|
||||||
Field field = Field.class.getDeclaredField("modifiers");
|
|
||||||
field.setAccessible(true);
|
|
||||||
field.setInt(f, f.getModifiers() & ~Modifier.FINAL);
|
|
||||||
|
|
||||||
potionTypes = (Potion[]) f.get(null);
|
|
||||||
final Potion[] newPotionTypes = new Potion[256];
|
|
||||||
System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length);
|
|
||||||
f.set(null, newPotionTypes);
|
|
||||||
}
|
|
||||||
} catch (Exception e)
|
|
||||||
{
|
|
||||||
System.err.println(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue