mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-26 15:03:03 +00:00
Added the Wand of the Forst. Will make it do something... later.
This commit is contained in:
1 parent
209bd34d3d
commit
e7d84d6376
14 files changed
+267
-6
No files matched your search
@@ -45,6 +45,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
|
||||
addItem(ModItems.petal);
|
||||
addItem(ModItems.pestleAndMortar);
|
||||
addItem(ModItems.dye);
|
||||
addItem(ModItems.twigWand);
|
||||
}
|
||||
|
||||
private void addItem(Item item) {
|
||||
|
||||
@@ -36,7 +36,8 @@ public final class ConfigHandler {
|
||||
LibItemIDs.idPetal = loadItem(LibItemNames.PETAL, LibItemIDs.idPetal);
|
||||
LibItemIDs.idDye = loadItem(LibItemNames.DYE, LibItemIDs.idDye);
|
||||
LibItemIDs.idPestleAndMortar = loadItem(LibItemNames.PESTLE_AND_MORTAR, LibItemIDs.idPestleAndMortar);
|
||||
|
||||
LibItemIDs.idTwigWand = loadItem(LibItemNames.TWIG_WAND, LibItemIDs.idTwigWand);
|
||||
|
||||
config.save();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the ThaumicTinkerer Mod.
|
||||
*
|
||||
* ThaumicTinkerer 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)
|
||||
*
|
||||
* ThaumicTinkerer is a Derivative Work on Thaumcraft 4.
|
||||
* Thaumcraft 4 (c) Azanor 2012
|
||||
* (http://www.minecraftforum.net/topic/1585216-)
|
||||
*
|
||||
* File Created @ [8 Sep 2013, 19:36:25 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.core.helper;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public final class ItemNBTHelper {
|
||||
|
||||
/** Checks if an ItemStack has a Tag Compound **/
|
||||
public static boolean detectNBT(ItemStack stack) {
|
||||
return stack.hasTagCompound();
|
||||
}
|
||||
|
||||
/** Tries to initialize an NBT Tag Compound in an ItemStack,
|
||||
* this will not do anything if the stack already has a tag
|
||||
* compound **/
|
||||
public static void initNBT(ItemStack stack) {
|
||||
if(!detectNBT(stack))
|
||||
injectNBT(stack, new NBTTagCompound());
|
||||
}
|
||||
|
||||
/** Injects an NBT Tag Compound to an ItemStack, no checks
|
||||
* are made previously **/
|
||||
public static void injectNBT(ItemStack stack, NBTTagCompound nbt) {
|
||||
stack.setTagCompound(nbt);
|
||||
}
|
||||
|
||||
/** Gets the NBTTagCompound in an ItemStack. Tries to init it
|
||||
* previously in case there isn't one present **/
|
||||
public static NBTTagCompound getNBT(ItemStack stack) {
|
||||
initNBT(stack);
|
||||
return stack.getTagCompound();
|
||||
}
|
||||
|
||||
// SETTERS ///////////////////////////////////////////////////////////////////
|
||||
|
||||
public static void setBoolean(ItemStack stack, String tag, boolean b) {
|
||||
getNBT(stack).setBoolean(tag, b);
|
||||
}
|
||||
|
||||
public static void setByte(ItemStack stack, String tag, byte b) {
|
||||
getNBT(stack).setByte(tag, b);
|
||||
}
|
||||
|
||||
public static void setShort(ItemStack stack, String tag, short s) {
|
||||
getNBT(stack).setShort(tag, s);
|
||||
}
|
||||
|
||||
public static void setInt(ItemStack stack, String tag, int i) {
|
||||
getNBT(stack).setInteger(tag, i);
|
||||
}
|
||||
|
||||
public static void setLong(ItemStack stack, String tag, long l) {
|
||||
getNBT(stack).setLong(tag, l);
|
||||
}
|
||||
|
||||
public static void setFloat(ItemStack stack, String tag, float f) {
|
||||
getNBT(stack).setFloat(tag, f);
|
||||
}
|
||||
|
||||
public static void setDouble(ItemStack stack, String tag, double d) {
|
||||
getNBT(stack).setDouble(tag, d);
|
||||
}
|
||||
|
||||
public static void setCompound(ItemStack stack, String tag, NBTTagCompound cmp) {
|
||||
if(!tag.equalsIgnoreCase("ench")) // not override the enchantments
|
||||
getNBT(stack).setCompoundTag(tag, cmp);
|
||||
}
|
||||
|
||||
public static void setCompound(ItemStack stack, NBTTagCompound cmp) {
|
||||
setCompound(stack, cmp.getName(), cmp);
|
||||
}
|
||||
|
||||
public static void setString(ItemStack stack, String tag, String s) {
|
||||
getNBT(stack).setString(tag, s);
|
||||
}
|
||||
|
||||
// GETTERS ///////////////////////////////////////////////////////////////////
|
||||
|
||||
public static boolean verifyExistance(ItemStack stack, String tag) {
|
||||
return getNBT(stack).hasKey(tag);
|
||||
}
|
||||
|
||||
public static boolean getBoolean(ItemStack stack, String tag, boolean defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? getNBT(stack).getBoolean(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static byte getByte(ItemStack stack, String tag, byte defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? getNBT(stack).getByte(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static short getShort(ItemStack stack, String tag, short defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? getNBT(stack).getShort(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static int getInt(ItemStack stack, String tag, int defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? getNBT(stack).getInteger(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static long getLong(ItemStack stack, String tag, long defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? getNBT(stack).getLong(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static float getFloat(ItemStack stack, String tag, float defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? getNBT(stack).getFloat(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static double getDouble(ItemStack stack, String tag, double defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? getNBT(stack).getDouble(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
/** If nullifyOnFail is true it'll return null if it doesn't find any
|
||||
* compounds, otherwise it'll return a new one. **/
|
||||
public static NBTTagCompound getCompound(ItemStack stack, String tag, boolean nullifyOnFail) {
|
||||
return verifyExistance(stack, tag) ? getNBT(stack).getCompoundTag(tag) : nullifyOnFail ? null : new NBTTagCompound();
|
||||
}
|
||||
|
||||
public static String getString(ItemStack stack, String tag, String defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? getNBT(stack).getString(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.item.ItemTwigWand;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibOreDict;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
@@ -31,6 +32,7 @@ public final class ModCrafingRecipes {
|
||||
public static List<IRecipe> recipesPetals;
|
||||
public static List<IRecipe> recipesDyes;
|
||||
public static IRecipe recipePestleAndMortar;
|
||||
public static List<IRecipe> recipesTwigWand;
|
||||
|
||||
public static void init() {
|
||||
// Lexicon Recipe
|
||||
@@ -53,6 +55,17 @@ public final class ModCrafingRecipes {
|
||||
'W', "plankWood",
|
||||
'B', Item.bowlEmpty);
|
||||
recipePestleAndMortar = BotaniaAPI.getLatestAddedRecipe();
|
||||
|
||||
// Wand of the Forest Recipes
|
||||
for(int i = 0; i < 16; i++)
|
||||
for(int j = 0; j < 16; j++) {
|
||||
addOreDictRecipe(ItemTwigWand.forColors(i, j),
|
||||
" AS", " SB", "S ",
|
||||
'A', LibOreDict.PETAL[i],
|
||||
'B', LibOreDict.PETAL[j],
|
||||
'S', "stickWood");
|
||||
}
|
||||
recipesTwigWand = BotaniaAPI.getLatestAddedRecipes(256);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,11 @@ public class Item16Colors extends ItemMod {
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
||||
return super.getUnlocalizedName(par1ItemStack) + par1ItemStack.getItemDamage();
|
||||
return getUnlocalizedNameLazy(par1ItemStack) + par1ItemStack.getItemDamage();
|
||||
}
|
||||
|
||||
String getUnlocalizedNameLazy(ItemStack par1ItemStack) {
|
||||
return super.getUnlocalizedName(par1ItemStack);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* 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 @ [Jan 20, 2014, 7:42:46 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.item;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.lib.LibItemIDs;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
public class ItemTwigWand extends Item16Colors {
|
||||
|
||||
Icon[] icons;
|
||||
|
||||
private static final String TAG_COLOR1 = "color1";
|
||||
private static final String TAG_COLOR2 = "color2";
|
||||
|
||||
public ItemTwigWand() {
|
||||
super(LibItemIDs.idTwigWand, LibItemNames.TWIG_WAND);
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister) {
|
||||
icons = new Icon[3];
|
||||
for(int i = 0; i < icons.length; i++)
|
||||
icons[i] = IconHelper.forItem(par1IconRegister, this, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(ItemStack stack, int pass) {
|
||||
return icons[Math.min(2, pass)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack par1ItemStack, int par2) {
|
||||
if(par2 == 0)
|
||||
return 0xFFFFFF;
|
||||
|
||||
float[] color = EntitySheep.fleeceColorTable[par2 == 1 ? getColor1(par1ItemStack) : getColor2(par1ItemStack)];
|
||||
return new Color(color[0], color[1], color[2]).getRGB();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int metadata) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for(int i = 0; i < 16; i++)
|
||||
par3List.add(forColors(i, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
||||
return getUnlocalizedNameLazy(par1ItemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack par1ItemStack) {
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
public static ItemStack forColors(int color1, int color2) {
|
||||
ItemStack stack = new ItemStack(ModItems.twigWand);
|
||||
ItemNBTHelper.setInt(stack, TAG_COLOR1, color1);
|
||||
ItemNBTHelper.setInt(stack, TAG_COLOR2, color2);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static int getColor1(ItemStack stack) {
|
||||
return ItemNBTHelper.getInt(stack, TAG_COLOR1, 0xFFFFFF);
|
||||
}
|
||||
|
||||
public static int getColor2(ItemStack stack) {
|
||||
return ItemNBTHelper.getInt(stack, TAG_COLOR2, 0xFFFFFF);
|
||||
}
|
||||
}
|
||||
@@ -22,12 +22,14 @@ public final class ModItems {
|
||||
public static Item petal;
|
||||
public static Item dye;
|
||||
public static Item pestleAndMortar;
|
||||
public static Item twigWand;
|
||||
|
||||
public static void init() {
|
||||
lexicon = new ItemLexicon();
|
||||
petal = new ItemPetal();
|
||||
dye = new ItemDye();
|
||||
pestleAndMortar = new ItemPestleAndMortar();
|
||||
twigWand = new ItemTwigWand();
|
||||
|
||||
OreDictionary.registerOre(LibOreDict.LEXICON, lexicon);
|
||||
for(int i = 0; i < 16; i++) {
|
||||
|
||||
@@ -17,5 +17,6 @@ public final class LibItemIDs {
|
||||
public static int idPetal = 19556;
|
||||
public static int idDye = 19557;
|
||||
public static int idPestleAndMortar = 19558;
|
||||
public static int idTwigWand = 19559;
|
||||
|
||||
}
|
||||
@@ -19,5 +19,6 @@ public final class LibItemNames {
|
||||
public static final String PETAL = LibResources.PREFIX_MOD + "petal";
|
||||
public static final String DYE = LibResources.PREFIX_MOD + "dye";
|
||||
public static final String PESTLE_AND_MORTAR = LibResources.PREFIX_MOD + "pestleAndMortar";
|
||||
public static final String TWIG_WAND = LibResources.PREFIX_MOD + "twigWand";
|
||||
|
||||
}
|
||||
@@ -13,12 +13,14 @@ package vazkii.botania.common.lib;
|
||||
|
||||
public final class LibOreDict {
|
||||
|
||||
public static final String LEXICON = "lexicaBotania";
|
||||
public static final String PESTLE_AND_MORTAR = "pestleAndMortar";
|
||||
public static final String TWIG_WAND = "twigWand";
|
||||
|
||||
public static final String[] FLOWER = new String[] {
|
||||
"mysticFlowerWhite", "mysticFlowerOrange", "mysticFlowerMagenta", "mysticFlowerLightBlue", "mysticFlowerYellow", "mysticFlowerLime", "mysticFlowerPink", "mysticFlowerGray", "mysticFlowerLightGray", "mysticFlowerCyan", "mysticFlowerPurple", "mysticFlowerBlue", "mysticFlowerBrown", "mysticFlowerGreen", "mysticFlowerRed", "mysticFlowerBlack",
|
||||
};
|
||||
|
||||
public static final String LEXICON = "lexicaBotania";
|
||||
|
||||
public static final String[] PETAL = new String[] {
|
||||
"petalWhite", "petalOrange", "petalMagenta", "petalLightBlue", "petalYellow", "petalLime", "petalPink", "petalGray", "petalLightGray", "petalCyan", "petalPurple", "petalBlue", "petalBrown", "petalGreen", "petalRed", "petalBlack",
|
||||
};
|
||||
@@ -26,6 +28,4 @@ public final class LibOreDict {
|
||||
public static final String[] DYE = new String[] {
|
||||
"dyeWhite", "dyeOrange", "dyeMagenta", "dyeLightBlue", "dyeYellow", "dyeLime", "dyePink", "dyeGray", "dyeLightGray", "dyeCyan", "dyePurple", "dyeBlue", "dyeBrown", "dyeGreen", "dyeRed", "dyeBlack",
|
||||
};
|
||||
|
||||
public static final String PESTLE_AND_MORTAR = "pestleAndMortar";
|
||||
}
|
||||
@@ -60,6 +60,7 @@ item.botania:dye13.name=Floral Green Dye
|
||||
item.botania:dye14.name=Floral Red Dye
|
||||
item.botania:dye15.name=Floral Black Dye
|
||||
item.botania:pestleAndMortar.name=Pestle and Mortar
|
||||
item.botania:twigWand.name=Wand of the Forest
|
||||
|
||||
# GUI TEXT
|
||||
botania.gui.lexicon.header=Lexica Botania Index - Pick which category you would like to study:
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
Reference in new issue
Block a user