mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-22 13:09:42 +00:00
Framework for new potions is operational.
This commit is contained in:
1 parent
55c837a053
commit
ede1a40a44
10 files changed
+161
-4
No files matched your search
@@ -38,8 +38,9 @@ public final class LibResources {
|
||||
public static final String GUI_CREATIVE = "botania.png";
|
||||
public static final String GUI_TOFF = PREFIX_GUI + "toff.png";
|
||||
public static final String GUI_BOSS_BAR = PREFIX_GUI + "bossBar.png";
|
||||
public static final String GUI_POTIONS = PREFIX_GUI + "potions.png";
|
||||
public static final String GUI_NEI_BLANK = PREFIX_GUI + "neiBlank.png";
|
||||
|
||||
|
||||
public static final String ENTRY_FLOWERS = PREFIX_ENTRIES + "flowers.png";
|
||||
public static final String ENTRY_APOTHECARY = PREFIX_ENTRIES + "apothecary.png";
|
||||
public static final String ENTRY_PURE_DAISY = PREFIX_ENTRIES + "pureDaisy.png";
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Nov 2, 2014, 10:37:12 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.brew;
|
||||
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
public class BrewModPotion extends BrewMod {
|
||||
|
||||
public BrewModPotion(String key, int cost, PotionEffect... effects) {
|
||||
super(key, Potion.potionTypes[effects[0].getPotionID()].getLiquidColor(), cost, effects);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,6 +31,8 @@ public class ModBrews {
|
||||
public static Brew nightVision;
|
||||
public static Brew absorption;
|
||||
|
||||
public static Brew soulCross;
|
||||
|
||||
public static void init() {
|
||||
speed = new BrewMod(LibBrewNames.SPEED, 0x59B7FF, 4000, new PotionEffect(Potion.moveSpeed.id, 1800, 1));
|
||||
strength = new BrewMod(LibBrewNames.STRENGTH, 0xEE3F3F, 4000, new PotionEffect(Potion.damageBoost.id, 1800, 1));
|
||||
@@ -44,6 +46,8 @@ public class ModBrews {
|
||||
invisibility = new BrewMod(LibBrewNames.INVISIBILITY, 0xAEAEAE, 4000, new PotionEffect(Potion.invisibility.id, 9600, 0));
|
||||
nightVision = new BrewMod(LibBrewNames.NIGHT_VISION, 0x7C4BEB, 4000, new PotionEffect(Potion.nightVision.id, 9600, 0));
|
||||
absorption = new BrewMod(LibBrewNames.ABSORPTION, 0xF2EB23, 7000, new PotionEffect(Potion.field_76444_x.id, 1800, 3));
|
||||
|
||||
soulCross = new BrewModPotion(LibBrewNames.SOUL_CROSS, 10000, new PotionEffect(ModPotions.soulCross.id, 1800, 0));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,10 +11,46 @@
|
||||
*/
|
||||
package vazkii.botania.common.brew;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
import net.minecraft.potion.Potion;
|
||||
import vazkii.botania.common.brew.potion.PotionSoulCross;
|
||||
|
||||
public class ModPotions {
|
||||
|
||||
public static void init() {
|
||||
|
||||
}
|
||||
public static Potion soulCross;
|
||||
|
||||
public static void init() {
|
||||
if(Potion.potionTypes.length < 256)
|
||||
extendPotionArray();
|
||||
|
||||
soulCross = new PotionSoulCross();
|
||||
}
|
||||
|
||||
// This is the method that everyone and their mom uses right?
|
||||
// Source: http://www.minecraftforge.net/wiki/Potion_Tutorial
|
||||
private static void extendPotionArray() {
|
||||
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);
|
||||
Potion[] newPotionTypes = new Potion[256];
|
||||
System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length);
|
||||
f.set(null, newPotionTypes);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("Botania done goofed:");
|
||||
System.err.println(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Nov 2, 2014, 10:12:45 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.brew.potion;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PotionMod extends Potion {
|
||||
|
||||
private static final ResourceLocation resource = new ResourceLocation(LibResources.GUI_POTIONS);
|
||||
|
||||
public PotionMod(String name, boolean badEffect, int color, int iconIndex) {
|
||||
super(findFreeID(), badEffect, color);
|
||||
setPotionName("botania.potion." + name);
|
||||
setIconIndex(iconIndex % 8 * 8, iconIndex / 8);
|
||||
}
|
||||
|
||||
static int findFreeID() {
|
||||
for(int i = 0; i < potionTypes.length; i++)
|
||||
if(potionTypes[i] == null)
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getStatusIconIndex() {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(resource);
|
||||
|
||||
return super.getStatusIconIndex();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Nov 2, 2014, 10:31:48 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.brew.potion;
|
||||
|
||||
import vazkii.botania.common.lib.LibPotionNames;
|
||||
|
||||
public class PotionSoulCross extends PotionMod {
|
||||
|
||||
public PotionSoulCross() {
|
||||
super(LibPotionNames.SOUL_CROSS, false, 0x47453d, 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,4 +26,6 @@ public final class LibBrewNames {
|
||||
public static final String NIGHT_VISION = "nightVision";
|
||||
public static final String ABSORPTION = "absorption";
|
||||
|
||||
public static final String SOUL_CROSS = "soulCross";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Nov 2, 2014, 10:33:37 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.lib;
|
||||
|
||||
public final class LibPotionNames {
|
||||
|
||||
public static final String SOUL_CROSS = "soulCross";
|
||||
|
||||
}
|
||||
@@ -787,6 +787,10 @@ botania.brew.waterBreathing=Gills
|
||||
botania.brew.invisibility=Cloaking
|
||||
botania.brew.nightVision=Owlsight
|
||||
botania.brew.absorption=Shielding
|
||||
botania.brew.soulCross=Crossed Souls
|
||||
|
||||
# POTION NAMES
|
||||
botania.potion.soulCross=Soul Cross
|
||||
|
||||
# GUI TEXT
|
||||
botania.gui.lexicon.header=Lexica Botania, %s Edition Table of Contents
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
Reference in new issue
Block a user