diff options
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/potions')
| -rw-r--r-- | src/main/java/darkknight/jewelrycraft/potions/PotionList.java | 55 | ||||
| -rw-r--r-- | src/main/java/darkknight/jewelrycraft/potions/PotionStun.java | 26 |
2 files changed, 81 insertions, 0 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/potions/PotionList.java b/src/main/java/darkknight/jewelrycraft/potions/PotionList.java new file mode 100644 index 0000000..2ee508d --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/potions/PotionList.java @@ -0,0 +1,55 @@ +/** + * + */ +package darkknight.jewelrycraft.potions; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import net.minecraft.potion.Potion; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; + +/** + * @author Sorin + * + */ +public class PotionList +{ + public static Potion stun; + + public static void preInit(FMLPreInitializationEvent e) + { + Potion[] potionTypes = null; + + for (Field f : Potion.class.getDeclaredFields()) { + f.setAccessible(true); + try { + if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) { + Field modfield = Field.class.getDeclaredField("modifiers"); + modfield.setAccessible(true); + modfield.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 e1) { + System.err.println("Severe error, please report this to the mod author:"); + System.err.println(e1); + } + } + + } + + public static void init(FMLInitializationEvent e) + { + stun = new PotionStun(32, true, 0x000000); + } + + public static void postInit(FMLPostInitializationEvent e) + { + + } +} diff --git a/src/main/java/darkknight/jewelrycraft/potions/PotionStun.java b/src/main/java/darkknight/jewelrycraft/potions/PotionStun.java new file mode 100644 index 0000000..f01a467 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/potions/PotionStun.java @@ -0,0 +1,26 @@ +/** + * + */ +package darkknight.jewelrycraft.potions; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import darkknight.jewelrycraft.util.Variables; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; + +/** + * @author Sorin + */ +public class PotionStun extends Potion +{ + protected PotionStun(int id, boolean isBad, int color) + { + super(id, isBad, color); + this.setPotionName(Variables.MODID + ".potion.stun"); + } + + @SideOnly(Side.CLIENT) + public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) { } +} |
