diff --git a/MODSRC/vazkii/botania/api/BotaniaAPI.java b/MODSRC/vazkii/botania/api/BotaniaAPI.java index 73fb9cc96..f463dc2cd 100644 --- a/MODSRC/vazkii/botania/api/BotaniaAPI.java +++ b/MODSRC/vazkii/botania/api/BotaniaAPI.java @@ -2,20 +2,17 @@ * This class was created by . 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 14, 2014, 6:15:28 PM (GMT)] */ package vazkii.botania.api; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemStack; @@ -32,190 +29,195 @@ import vazkii.botania.api.recipe.RecipePetals; import vazkii.botania.api.recipe.RecipeRuneAltar; import vazkii.botania.api.subtile.SubTileEntity; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public final class BotaniaAPI { - private static List categories = new ArrayList(); - private static List allEntries = new ArrayList(); + private static List categories = new ArrayList(); + private static List allEntries = new ArrayList(); - public static List petalRecipes = new ArrayList(); - public static List runeAltarRecipes = new ArrayList(); - public static List manaInfusionRecipes = new ArrayList(); + public static List petalRecipes = new ArrayList(); + public static List runeAltarRecipes = new ArrayList(); + public static List manaInfusionRecipes = new ArrayList(); - private static BiMap> subTiles = HashBiMap.> create(); + private static BiMap> subTiles = HashBiMap.>create(); - public static Map oreWeights = new HashMap(); + public static Map oreWeights = new HashMap(); - public static ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", 16, new int[] { 2, 6, 5, 2 }, 18); - public static ToolMaterial manasteelToolMaterial = EnumHelper.addToolMaterial("MANASTEEL", 3, 300, 6.2F, 2F, 20); + public static ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", 16, new int[]{2, 6, 5, 2}, 18); + public static ToolMaterial manasteelToolMaterial = EnumHelper.addToolMaterial("MANASTEEL", 3, 300, 6.2F, 2F, 20); - public static ArmorMaterial terrasteelArmorMaterial = EnumHelper.addArmorMaterial("TERRASTEEL", 34, new int[] {3, 8, 6, 3}, 26); - public static ToolMaterial terrasteelToolMaterial = EnumHelper.addToolMaterial("TERRASTEEL", 3, 2300, 9F, 3F, 26); + public static ArmorMaterial terrasteelArmorMaterial = EnumHelper.addArmorMaterial("TERRASTEEL", 34, new int[]{3, 8, 6, 3}, 26); + public static ToolMaterial terrasteelToolMaterial = EnumHelper.addToolMaterial("TERRASTEEL", 3, 2300, 9F, 3F, 26); - static { - registerSubTile("", DummySubTile.class); + static { + registerSubTile("", DummySubTile.class); - addOreWeight("oreAluminum", 3940); // Tinkers' Construct - addOreWeight("oreAmber", 2075); // Thaumcraft - addOreWeight("oreApatite", 1595); // Forestry - addOreWeight("oreBlueTopaz", 3195); // Ars Magica - addOreWeight("oreCassiterite", 1634); // GregTech - addOreWeight("oreCertusQuartz", 3975); // Applied Energistics - addOreWeight("oreChimerite", 3970); // Ars Magica - addOreWeight("oreCinnabar", 2585); // Thaumcraft - addOreWeight("oreCoal", 46525); // Vanilla - addOreWeight("oreCooperite", 5); // GregTech - addOreWeight("oreCopper", 8325); // IC2, Thermal Expansion, Tinkers' Construct, etc. - addOreWeight("oreDarkIron", 1700); // Factorization - addOreWeight("oreDiamond", 1265); // Vanilla - addOreWeight("oreEmerald", 780); // Vanilla - addOreWeight("oreEmery", 415); // GregTech - addOreWeight("oreGalena", 1000); // Factorization - addOreWeight("oreGold", 2970); // Vanilla - addOreWeight("oreInfusedAir", 925); // Thaumcraft - addOreWeight("oreInfusedEarth", 925); // Thaumcraft - addOreWeight("oreInfusedEntropy", 925); // Thaumcraft - addOreWeight("oreInfusedFire", 925); // Thaumcraft - addOreWeight("oreInfusedOrder", 925); // Thaumcraft - addOreWeight("oreInfusedWater", 925); // Thaumcraft - addOreWeight("oreIridium", 30); // GregTech - addOreWeight("oreIron", 20665); // Vanilla - addOreWeight("oreLapis", 1285); // Vanilla - addOreWeight("oreLead", 7985); // IC2, Thermal Expansion, Factorization, etc. - addOreWeight("oreMCropsEssence", 3085); // Magical Crops - addOreWeight("oreNickel", 2275); // Thermal Expansion - addOreWeight("oreOlivine", 1100); // Project RED - addOreWeight("oreRedstone", 6885); // Vanilla - addOreWeight("oreRuby", 1100); // Project RED - addOreWeight("oreSapphire", 1100); // Project RED - addOreWeight("oreSilver", 6300); // Thermal Expansion, Factorization, etc. - addOreWeight("oreSphalerite", 25); // GregTech - addOreWeight("oreSulfur", 1105); // Railcraft - addOreWeight("oreTetrahedrite", 4040); // GregTech - addOreWeight("oreTin", 9450); // IC2, Thermal Expansion, etc. - addOreWeight("oreTungstate", 20); // GregTech - addOreWeight("oreUranium", 1337); // IC2 - addOreWeight("oreVinteum", 5925); // Ars Magica - addOreWeight("oreYellorite", 3520); // Big Reactors - } + addOreWeight("oreAluminum", 3940); // Tinkers' Construct + addOreWeight("oreAmber", 2075); // Thaumcraft + addOreWeight("oreApatite", 1595); // Forestry + addOreWeight("oreBlueTopaz", 3195); // Ars Magica + addOreWeight("oreCassiterite", 1634); // GregTech + addOreWeight("oreCertusQuartz", 3975); // Applied Energistics + addOreWeight("oreChimerite", 3970); // Ars Magica + addOreWeight("oreCinnabar", 2585); // Thaumcraft + addOreWeight("oreCoal", 46525); // Vanilla + addOreWeight("oreCooperite", 5); // GregTech + addOreWeight("oreCopper", 8325); // IC2, Thermal Expansion, Tinkers' Construct, etc. + addOreWeight("oreDarkIron", 1700); // Factorization + addOreWeight("oreDiamond", 1265); // Vanilla + addOreWeight("oreEmerald", 780); // Vanilla + addOreWeight("oreEmery", 415); // GregTech + addOreWeight("oreGalena", 1000); // Factorization + addOreWeight("oreGold", 2970); // Vanilla + addOreWeight("oreInfusedAir", 925); // Thaumcraft + addOreWeight("oreInfusedEarth", 925); // Thaumcraft + addOreWeight("oreInfusedEntropy", 925); // Thaumcraft + addOreWeight("oreInfusedFire", 925); // Thaumcraft + addOreWeight("oreInfusedOrder", 925); // Thaumcraft + addOreWeight("oreInfusedWater", 925); // Thaumcraft + addOreWeight("oreIridium", 30); // GregTech + addOreWeight("oreIron", 20665); // Vanilla + addOreWeight("oreLapis", 1285); // Vanilla + addOreWeight("oreLead", 7985); // IC2, Thermal Expansion, Factorization, etc. + addOreWeight("oreMCropsEssence", 3085); // Magical Crops + addOreWeight("oreNickel", 2275); // Thermal Expansion + addOreWeight("oreOlivine", 1100); // Project RED + addOreWeight("oreRedstone", 6885); // Vanilla + addOreWeight("oreRuby", 1100); // Project RED + addOreWeight("oreSapphire", 1100); // Project RED + addOreWeight("oreSilver", 6300); // Thermal Expansion, Factorization, etc. + addOreWeight("oreSphalerite", 25); // GregTech + addOreWeight("oreSulfur", 1105); // Railcraft + addOreWeight("oreTetrahedrite", 4040); // GregTech + addOreWeight("oreTin", 9450); // IC2, Thermal Expansion, etc. + addOreWeight("oreTungstate", 20); // GregTech + addOreWeight("oreUranium", 1337); // IC2 + addOreWeight("oreVinteum", 5925); // Ars Magica + addOreWeight("oreYellorite", 3520); // Big Reactors + } - /** - * The internal method handler in use. Do not overwrite. - * @see IInternalMethodHandler - */ - public static IInternalMethodHandler internalHandler = new DummyMethodHandler(); + /** + * The internal method handler in use. Do not overwrite. + * + * @see IInternalMethodHandler + */ + public static IInternalMethodHandler internalHandler = new DummyMethodHandler(); - /** - * Registers a Petal Recipe. - * @param output The ItemStack to craft. - * @param inputs The objects for crafting. Can be ItemStack, MappableStackWrapper - * or String (case for Ore Dictionary). The array can't be larger than 16. - * @return The recipe created. - */ - public static RecipePetals registerPetalRecipe(ItemStack output, Object... inputs) { - RecipePetals recipe = new RecipePetals(output, inputs); - petalRecipes.add(recipe); - return recipe; - } + /** + * Registers a Petal Recipe. + * + * @param output The ItemStack to craft. + * @param inputs The objects for crafting. Can be ItemStack, MappableStackWrapper + * or String (case for Ore Dictionary). The array can't be larger than 16. + * @return The recipe created. + */ + public static RecipePetals registerPetalRecipe(ItemStack output, Object... inputs) { + RecipePetals recipe = new RecipePetals(output, inputs); + petalRecipes.add(recipe); + return recipe; + } - /** - * Registers a Rune Altar - * @param output The ItemStack to craft. - * @param mana The amount of mana required. Don't go over 100000! - * @param inputs The objects for crafting. Can be ItemStack, MappableStackWrapper - * or String (case for Ore Dictionary). The array can't be larger than 16. - * @return The recipe created. - */ - public static RecipeRuneAltar registerRuneAltarRecipe(ItemStack output, int mana, Object... inputs) { - RecipeRuneAltar recipe = new RecipeRuneAltar(output, mana, inputs); - runeAltarRecipes.add(recipe); - return recipe; - } + /** + * Registers a Rune Altar + * + * @param output The ItemStack to craft. + * @param mana The amount of mana required. Don't go over 100000! + * @param inputs The objects for crafting. Can be ItemStack, MappableStackWrapper + * or String (case for Ore Dictionary). The array can't be larger than 16. + * @return The recipe created. + */ + public static RecipeRuneAltar registerRuneAltarRecipe(ItemStack output, int mana, Object... inputs) { + RecipeRuneAltar recipe = new RecipeRuneAltar(output, mana, inputs); + runeAltarRecipes.add(recipe); + return recipe; + } - /** - * Registers a Mana Infusion Recipe (throw an item in a mana pool) - * @param output The ItemStack to craft - * @param input The input item, be it an ItemStack or an ore dictionary entry String. - * @param mana The amount of mana required. Don't go over 100000! - * @return The recipe created. - */ - public static RecipeManaInfusion registerManaInfusionRecipe(ItemStack output, Object input, int mana) { - RecipeManaInfusion recipe = new RecipeManaInfusion(output, input, mana); - manaInfusionRecipes.add(recipe); - return recipe; - } + /** + * Registers a Mana Infusion Recipe (throw an item in a mana pool) + * + * @param output The ItemStack to craft + * @param input The input item, be it an ItemStack or an ore dictionary entry String. + * @param mana The amount of mana required. Don't go over 100000! + * @return The recipe created. + */ + public static RecipeManaInfusion registerManaInfusionRecipe(ItemStack output, Object input, int mana) { + RecipeManaInfusion recipe = new RecipeManaInfusion(output, input, mana); + manaInfusionRecipes.add(recipe); + return recipe; + } - public static void registerSubTile(String key, Class subtileClass) { - subTiles.put(key, subtileClass); - } + public static void registerSubTile(String key, Class subtileClass) { + subTiles.put(key, subtileClass); + } - /** - * Adds a category to the list of registered categories to appear in the Lexicon. - */ - public static void addCategory(LexiconCategory category) { - categories.add(category); - } + /** + * Adds a category to the list of registered categories to appear in the Lexicon. + */ + public static void addCategory(LexiconCategory category) { + categories.add(category); + } - /** - * Gets all registered categories. - */ - public static List getAllCategories() { - return categories; - } + /** + * Gets all registered categories. + */ + public static List getAllCategories() { + return categories; + } - /** - * Registers a Lexicon Entry and adds it to the category passed in. - */ - public static void addEntry(LexiconEntry entry, LexiconCategory category) { - allEntries.add(entry); - category.entries.add(entry); - } + /** + * Registers a Lexicon Entry and adds it to the category passed in. + */ + public static void addEntry(LexiconEntry entry, LexiconCategory category) { + allEntries.add(entry); + category.entries.add(entry); + } - /** - * Maps an ore (ore dictionary key) to it's weight on the world generation. This - * is used for the Orechid flower. Check the static block in the BotaniaAPI class - * to get the weights for the vanilla blocks.
- * Alternatively get the values with the OreDetector mod:
- * https://gist.github.com/Vazkii/9493322 - */ - public static void addOreWeight(String ore, int weight) { - oreWeights.put(ore, weight); - } + /** + * Maps an ore (ore dictionary key) to it's weight on the world generation. This + * is used for the Orechid flower. Check the static block in the BotaniaAPI class + * to get the weights for the vanilla blocks.
+ * Alternatively get the values with the OreDetector mod:
+ * https://gist.github.com/Vazkii/9493322 + */ + public static void addOreWeight(String ore, int weight) { + oreWeights.put(ore, weight); + } - public static int getOreWeight(String ore) { - return oreWeights.get(ore); - } + public static int getOreWeight(String ore) { + return oreWeights.get(ore); + } - /** - * Gets the last recipe to have been added to the recipe list. - */ - public static IRecipe getLatestAddedRecipe() { - List list = CraftingManager.getInstance().getRecipeList(); - return list.get(list.size() - 1); - } + /** + * Gets the last recipe to have been added to the recipe list. + */ + public static IRecipe getLatestAddedRecipe() { + List list = CraftingManager.getInstance().getRecipeList(); + return list.get(list.size() - 1); + } - /** - * Gets the last x recipes added to the recipe list. - */ - public static List getLatestAddedRecipes(int x) { - List list = CraftingManager.getInstance().getRecipeList(); - List newList = new ArrayList(); - for(int i = x - 1; i >= 0; i--) - newList.add(list.get(list.size() - 1 - i)); + /** + * Gets the last x recipes added to the recipe list. + */ + public static List getLatestAddedRecipes(int x) { + List list = CraftingManager.getInstance().getRecipeList(); + List newList = new ArrayList(); + for(int i = x - 1; i >= 0; i--) + newList.add(list.get(list.size() - 1 - i)); - return newList; - } + return newList; + } - public static Class getSubTileMapping(String key) { - if(!subTiles.containsKey(key)) - key = ""; + public static Class getSubTileMapping(String key) { + if(!subTiles.containsKey(key)) key = ""; - return subTiles.get(key); - } + return subTiles.get(key); + } - public static String getSubTileStringMapping(Class clazz) { - return subTiles.inverse().get(clazz); - } + public static String getSubTileStringMapping(Class clazz) { + return subTiles.inverse().get(clazz); + } } diff --git a/MODSRC/vazkii/botania/api/ILexiconable.java b/MODSRC/vazkii/botania/api/ILexiconable.java index 20fe16ccd..07d7049d4 100644 --- a/MODSRC/vazkii/botania/api/ILexiconable.java +++ b/MODSRC/vazkii/botania/api/ILexiconable.java @@ -2,11 +2,11 @@ * This class was created by . 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:05:44 PM (GMT)] */ package vazkii.botania.api; @@ -22,9 +22,9 @@ import vazkii.botania.api.lexicon.LexiconEntry; */ public interface ILexiconable { - /** - * Gets the lexicon entry to open at this location. null works too. - */ - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon); + /** + * Gets the lexicon entry to open at this location. null works too. + */ + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon); } diff --git a/MODSRC/vazkii/botania/api/ISpecialFlower.java b/MODSRC/vazkii/botania/api/ISpecialFlower.java index abef20f72..3387949b4 100644 --- a/MODSRC/vazkii/botania/api/ISpecialFlower.java +++ b/MODSRC/vazkii/botania/api/ISpecialFlower.java @@ -2,11 +2,11 @@ * This class was created by . 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 22, 2014, 7:12:28 PM (GMT)] */ package vazkii.botania.api; diff --git a/MODSRC/vazkii/botania/api/ITileBound.java b/MODSRC/vazkii/botania/api/ITileBound.java index 6dfec0ce0..703d31334 100644 --- a/MODSRC/vazkii/botania/api/ITileBound.java +++ b/MODSRC/vazkii/botania/api/ITileBound.java @@ -2,18 +2,18 @@ * This class was created by . 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 @ [Mar 24, 2014, 6:47:53 PM (GMT)] */ package vazkii.botania.api; -import net.minecraft.util.ChunkCoordinates; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.util.ChunkCoordinates; /** * Any TileEntity that implements this is technically bound @@ -22,10 +22,10 @@ import cpw.mods.fml.relauncher.SideOnly; */ public interface ITileBound { - /** - * Gets where this block is bound to, can return null. - */ - @SideOnly(Side.CLIENT) - public ChunkCoordinates getBinding(); + /** + * Gets where this block is bound to, can return null. + */ + @SideOnly(Side.CLIENT) + public ChunkCoordinates getBinding(); } diff --git a/MODSRC/vazkii/botania/api/IWandHUD.java b/MODSRC/vazkii/botania/api/IWandHUD.java index 41436c251..675710f94 100644 --- a/MODSRC/vazkii/botania/api/IWandHUD.java +++ b/MODSRC/vazkii/botania/api/IWandHUD.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Feb 5, 2014, 1:34:44 PM (GMT)] */ package vazkii.botania.api; @@ -21,6 +21,6 @@ import net.minecraft.world.World; */ public interface IWandHUD { - public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z); + public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z); } diff --git a/MODSRC/vazkii/botania/api/IWandable.java b/MODSRC/vazkii/botania/api/IWandable.java index cc3a5640d..ad7f0847d 100644 --- a/MODSRC/vazkii/botania/api/IWandable.java +++ b/MODSRC/vazkii/botania/api/IWandable.java @@ -2,11 +2,11 @@ * This class was created by . 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 22, 2014, 5:12:53 PM (GMT)] */ package vazkii.botania.api; @@ -20,6 +20,6 @@ import net.minecraft.world.World; */ public interface IWandable { - public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side); + public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side); } diff --git a/MODSRC/vazkii/botania/api/IWireframeAABBProvider.java b/MODSRC/vazkii/botania/api/IWireframeAABBProvider.java index 21cb10f30..532f58248 100644 --- a/MODSRC/vazkii/botania/api/IWireframeAABBProvider.java +++ b/MODSRC/vazkii/botania/api/IWireframeAABBProvider.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Apr 19, 2014, 7:23:59 PM (GMT)] */ package vazkii.botania.api; @@ -20,6 +20,6 @@ import net.minecraft.world.World; */ public interface IWireframeAABBProvider { - public AxisAlignedBB getWireframeAABB(World world, int x, int y, int z); - + public AxisAlignedBB getWireframeAABB(World world, int x, int y, int z); + } diff --git a/MODSRC/vazkii/botania/api/internal/DummyManaNetwork.java b/MODSRC/vazkii/botania/api/internal/DummyManaNetwork.java index 04e4ca333..266364f2e 100644 --- a/MODSRC/vazkii/botania/api/internal/DummyManaNetwork.java +++ b/MODSRC/vazkii/botania/api/internal/DummyManaNetwork.java @@ -2,48 +2,48 @@ * This class was created by . 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 @ [Mar 7, 2014, 3:47:43 PM (GMT)] */ package vazkii.botania.api.internal; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; +import java.util.ArrayList; +import java.util.List; + public class DummyManaNetwork implements IManaNetwork { - public static final DummyManaNetwork instance = new DummyManaNetwork(); + public static final DummyManaNetwork instance = new DummyManaNetwork(); - @Override - public void clear() { - // NO-OP - } + @Override + public void clear() { + // NO-OP + } - @Override - public TileEntity getClosestPool(ChunkCoordinates pos, int dimension, int limit) { - return null; - } + @Override + public TileEntity getClosestPool(ChunkCoordinates pos, int dimension, int limit) { + return null; + } - @Override - public TileEntity getClosestCollector(ChunkCoordinates pos, int dimension, int limit) { - return null; - } + @Override + public TileEntity getClosestCollector(ChunkCoordinates pos, int dimension, int limit) { + return null; + } - @Override - public List getAllCollectorsInWorld(int dim) { - return new ArrayList(); - } + @Override + public List getAllCollectorsInWorld(int dim) { + return new ArrayList(); + } - @Override - public List getAllPoolsInWorld(int dim) { - return new ArrayList(); - } + @Override + public List getAllPoolsInWorld(int dim) { + return new ArrayList(); + } } diff --git a/MODSRC/vazkii/botania/api/internal/DummyMethodHandler.java b/MODSRC/vazkii/botania/api/internal/DummyMethodHandler.java index c10e5238e..7980eef5c 100644 --- a/MODSRC/vazkii/botania/api/internal/DummyMethodHandler.java +++ b/MODSRC/vazkii/botania/api/internal/DummyMethodHandler.java @@ -2,17 +2,15 @@ * This class was created by . 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 14, 2014, 6:43:03 PM (GMT)] */ package vazkii.botania.api.internal; -import java.util.List; - import net.minecraft.client.gui.ScaledResolution; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -24,85 +22,87 @@ import vazkii.botania.api.recipe.RecipeManaInfusion; import vazkii.botania.api.recipe.RecipePetals; import vazkii.botania.api.recipe.RecipeRuneAltar; +import java.util.List; + public class DummyMethodHandler implements IInternalMethodHandler { - @Override - public LexiconPage textPage(String key) { - return dummyPage(key); - } + @Override + public LexiconPage textPage(String key) { + return dummyPage(key); + } - @Override - public LexiconPage imagePage(String key, String resource) { - return dummyPage(key); - } + @Override + public LexiconPage imagePage(String key, String resource) { + return dummyPage(key); + } - @Override - public LexiconPage craftingRecipesPage(String key, List recipes) { - return dummyPage(key); - } + @Override + public LexiconPage craftingRecipesPage(String key, List recipes) { + return dummyPage(key); + } - @Override - public LexiconPage craftingRecipePage(String key, IRecipe recipe) { - return dummyPage(key); - } + @Override + public LexiconPage craftingRecipePage(String key, IRecipe recipe) { + return dummyPage(key); + } - @Override - public LexiconPage petalRecipesPage(String key, List recipes) { - return dummyPage(key); - } + @Override + public LexiconPage petalRecipesPage(String key, List recipes) { + return dummyPage(key); + } - @Override - public LexiconPage petalRecipePage(String key, RecipePetals recipe) { - return dummyPage(key); - } + @Override + public LexiconPage petalRecipePage(String key, RecipePetals recipe) { + return dummyPage(key); + } - @Override - public LexiconPage runeRecipesPage(String key, List recipes) { - return dummyPage(key); - } + @Override + public LexiconPage runeRecipesPage(String key, List recipes) { + return dummyPage(key); + } - @Override - public LexiconPage runeRecipePage(String key, RecipeRuneAltar recipe) { - return dummyPage(key); - } + @Override + public LexiconPage runeRecipePage(String key, RecipeRuneAltar recipe) { + return dummyPage(key); + } - @Override - public LexiconPage manaInfusionRecipesPage(String key, List recipes) { - return dummyPage(key); - } + @Override + public LexiconPage manaInfusionRecipesPage(String key, List recipes) { + return dummyPage(key); + } - @Override - public LexiconPage manaInfusionRecipePage(String key, RecipeManaInfusion recipe) { - return dummyPage(key); - } + @Override + public LexiconPage manaInfusionRecipePage(String key, RecipeManaInfusion recipe) { + return dummyPage(key); + } - private LexiconPage dummyPage(String key) { - return new DummyPage(key); - } + private LexiconPage dummyPage(String key) { + return new DummyPage(key); + } - @Override - public ItemStack getSubTileAsStack(String subTile) { - return new ItemStack(Blocks.stone, 0, 0); - } + @Override + public ItemStack getSubTileAsStack(String subTile) { + return new ItemStack(Blocks.stone, 0, 0); + } - @Override - public IIcon getSubTileIconForName(String name) { - return Blocks.red_flower.getIcon(0, 0); - } + @Override + public IIcon getSubTileIconForName(String name) { + return Blocks.red_flower.getIcon(0, 0); + } - @Override - public IManaNetwork getManaNetworkInstance() { - return DummyManaNetwork.instance; - } + @Override + public IManaNetwork getManaNetworkInstance() { + return DummyManaNetwork.instance; + } - @Override - public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) { - // NO-OP - } + @Override + public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) { + // NO-OP + } - @Override - public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) { - // NO-OP - } + @Override + public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) { + // NO-OP + } } diff --git a/MODSRC/vazkii/botania/api/internal/DummyPage.java b/MODSRC/vazkii/botania/api/internal/DummyPage.java index 33cbcf840..c3c06a412 100644 --- a/MODSRC/vazkii/botania/api/internal/DummyPage.java +++ b/MODSRC/vazkii/botania/api/internal/DummyPage.java @@ -2,18 +2,18 @@ * This class was created by . 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 14, 2014, 6:41:23 PM (GMT)] */ package vazkii.botania.api.internal; -import vazkii.botania.api.lexicon.LexiconPage; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import vazkii.botania.api.lexicon.LexiconPage; /** * A dummy page. It does absolutely nothing and is only @@ -22,14 +22,14 @@ import cpw.mods.fml.relauncher.SideOnly; */ public class DummyPage extends LexiconPage { - public DummyPage(String unlocalizedName) { - super(unlocalizedName); - } + public DummyPage(String unlocalizedName) { + super(unlocalizedName); + } - @Override - @SideOnly(Side.CLIENT) - public void renderScreen(IGuiLexiconEntry gui, int x, int y) { - // NO-OP - } + @Override + @SideOnly(Side.CLIENT) + public void renderScreen(IGuiLexiconEntry gui, int x, int y) { + // NO-OP + } } diff --git a/MODSRC/vazkii/botania/api/internal/DummySubTile.java b/MODSRC/vazkii/botania/api/internal/DummySubTile.java index d23adced7..f5cdfe42e 100644 --- a/MODSRC/vazkii/botania/api/internal/DummySubTile.java +++ b/MODSRC/vazkii/botania/api/internal/DummySubTile.java @@ -2,11 +2,11 @@ * This class was created by . 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 24, 2014, 4:17:33 PM (GMT)] */ package vazkii.botania.api.internal; diff --git a/MODSRC/vazkii/botania/api/internal/IGuiLexiconEntry.java b/MODSRC/vazkii/botania/api/internal/IGuiLexiconEntry.java index c8bf6da14..f98ea54a2 100644 --- a/MODSRC/vazkii/botania/api/internal/IGuiLexiconEntry.java +++ b/MODSRC/vazkii/botania/api/internal/IGuiLexiconEntry.java @@ -2,11 +2,11 @@ * This class was created by . 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 14, 2014, 6:48:41 PM (GMT)] */ package vazkii.botania.api.internal; @@ -20,38 +20,38 @@ import vazkii.botania.api.lexicon.LexiconEntry; */ public interface IGuiLexiconEntry { - /** - * Gets the entry currently portrayed in this gui. - */ - public LexiconEntry getEntry(); + /** + * Gets the entry currently portrayed in this gui. + */ + public LexiconEntry getEntry(); - /** - * Gets the current page the lexicon GUI is browsing. - */ - public int getPageOn(); + /** + * Gets the current page the lexicon GUI is browsing. + */ + public int getPageOn(); - /** - * Gets the leftmost part of the GUI. - */ - public int getLeft(); + /** + * Gets the leftmost part of the GUI. + */ + public int getLeft(); - /** - * Gets the topmost part of the GUI. - */ - public int getTop(); + /** + * Gets the topmost part of the GUI. + */ + public int getTop(); - /** - * Gets the GUI's width. - */ - public int getWidth(); + /** + * Gets the GUI's width. + */ + public int getWidth(); - /** - * Gets the GUI's height - */ - public int getHeight(); + /** + * Gets the GUI's height + */ + public int getHeight(); - /** - * Gets the GUI's Z level for rendering. - */ - public float getZLevel(); + /** + * Gets the GUI's Z level for rendering. + */ + public float getZLevel(); } diff --git a/MODSRC/vazkii/botania/api/internal/IInternalMethodHandler.java b/MODSRC/vazkii/botania/api/internal/IInternalMethodHandler.java index 5a8a7e32f..27fb59701 100644 --- a/MODSRC/vazkii/botania/api/internal/IInternalMethodHandler.java +++ b/MODSRC/vazkii/botania/api/internal/IInternalMethodHandler.java @@ -2,17 +2,17 @@ * This class was created by . 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 14, 2014, 6:34:34 PM (GMT)] */ package vazkii.botania.api.internal; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; @@ -22,8 +22,8 @@ import vazkii.botania.api.lexicon.LexiconPage; import vazkii.botania.api.recipe.RecipeManaInfusion; import vazkii.botania.api.recipe.RecipePetals; import vazkii.botania.api.recipe.RecipeRuneAltar; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + +import java.util.List; /** * Any methods that refer to internal methods in Botania are here. @@ -34,35 +34,35 @@ import cpw.mods.fml.relauncher.SideOnly; */ public interface IInternalMethodHandler { - public LexiconPage textPage(String key); + public LexiconPage textPage(String key); - public LexiconPage imagePage(String key, String resource); + public LexiconPage imagePage(String key, String resource); - public LexiconPage craftingRecipesPage(String key, List recipes); + public LexiconPage craftingRecipesPage(String key, List recipes); - public LexiconPage craftingRecipePage(String key, IRecipe recipe); + public LexiconPage craftingRecipePage(String key, IRecipe recipe); - public LexiconPage petalRecipesPage(String key, List recipes); + public LexiconPage petalRecipesPage(String key, List recipes); - public LexiconPage petalRecipePage(String key, RecipePetals recipe); + public LexiconPage petalRecipePage(String key, RecipePetals recipe); - public LexiconPage runeRecipesPage(String key, List recipes); + public LexiconPage runeRecipesPage(String key, List recipes); - public LexiconPage runeRecipePage(String key, RecipeRuneAltar recipe); + public LexiconPage runeRecipePage(String key, RecipeRuneAltar recipe); - public LexiconPage manaInfusionRecipesPage(String key, List recipes); + public LexiconPage manaInfusionRecipesPage(String key, List recipes); - public LexiconPage manaInfusionRecipePage(String key, RecipeManaInfusion recipe); + public LexiconPage manaInfusionRecipePage(String key, RecipeManaInfusion recipe); - public IManaNetwork getManaNetworkInstance(); + public IManaNetwork getManaNetworkInstance(); - public ItemStack getSubTileAsStack(String subTile); + public ItemStack getSubTileAsStack(String subTile); - public IIcon getSubTileIconForName(String name); + public IIcon getSubTileIconForName(String name); - @SideOnly(Side.CLIENT) - public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res); + @SideOnly(Side.CLIENT) + public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res); - public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m); + public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m); } diff --git a/MODSRC/vazkii/botania/api/internal/IManaBurst.java b/MODSRC/vazkii/botania/api/internal/IManaBurst.java index bf8291e17..be301b1ce 100644 --- a/MODSRC/vazkii/botania/api/internal/IManaBurst.java +++ b/MODSRC/vazkii/botania/api/internal/IManaBurst.java @@ -2,11 +2,11 @@ * This class was created by . 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 31, 2014, 4:36:13 PM (GMT)] */ package vazkii.botania.api.internal; @@ -19,42 +19,42 @@ import net.minecraft.util.ChunkCoordinates; */ public interface IManaBurst { - public boolean isFake(); + public boolean isFake(); - public void setMotion(double x, double y, double z); + public void setMotion(double x, double y, double z); - public int getColor(); + public int getColor(); - public void setColor(int color); + public void setColor(int color); - public int getMana(); + public int getMana(); - public void setMana(int mana); + public void setMana(int mana); - public int getStartingMana(); + public int getStartingMana(); - public void setStartingMana(int mana); + public void setStartingMana(int mana); - public int getMinManaLoss(); + public int getMinManaLoss(); - public void setMinManaLoss(int minManaLoss); + public void setMinManaLoss(int minManaLoss); - public float getManaLossPerTick(); + public float getManaLossPerTick(); - public void setManaLossPerTick(float mana); + public void setManaLossPerTick(float mana); - public float getGravity(); + public float getGravity(); - public void setGravity(float gravity); + public void setGravity(float gravity); - public ChunkCoordinates getBurstSourceChunkCoordinates(); + public ChunkCoordinates getBurstSourceChunkCoordinates(); - public void setBurstSourceCoords(int x, int y, int z); + public void setBurstSourceCoords(int x, int y, int z); - public ItemStack getSourceLens(); + public ItemStack getSourceLens(); - public void setSourceLens(ItemStack lens); + public void setSourceLens(ItemStack lens); - public boolean hasAlreadyCollidedAt(int x, int y, int z); + public boolean hasAlreadyCollidedAt(int x, int y, int z); } diff --git a/MODSRC/vazkii/botania/api/internal/IManaNetwork.java b/MODSRC/vazkii/botania/api/internal/IManaNetwork.java index 4883fba6c..354655167 100644 --- a/MODSRC/vazkii/botania/api/internal/IManaNetwork.java +++ b/MODSRC/vazkii/botania/api/internal/IManaNetwork.java @@ -2,65 +2,68 @@ * This class was created by . 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 @ [Mar 7, 2014, 3:39:48 PM (GMT)] */ package vazkii.botania.api.internal; -import java.util.List; - import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; +import java.util.List; + /** * A basic interface for a world's Mana Network. + * * @see IInternalMethodHandler#getManaNetworkInstance() */ public interface IManaNetwork { - /** - * Clears the entire Mana Network of all it's contents, you probably - * don't want to call this unless you have a very good reason. - */ - public void clear(); + /** + * Clears the entire Mana Network of all it's contents, you probably + * don't want to call this unless you have a very good reason. + */ + public void clear(); - /** - * Gets the closest Mana Collector (eg. Mana Spreader) in the network to the Chunk - * Coordinates passed in, in the given dimension.
- * A way of getting the dimension is via worldObj.provider.dimensionId
- * Note that this function *can* get performance intensive, it's reccomended you - * call it sparingly and take cache of the value returned. - * @param limit The maximum distance the closest block can be, if the closest block - * is farther away than that, null will be returned instead. - */ - public TileEntity getClosestCollector(ChunkCoordinates pos, int dim, int limit); + /** + * Gets the closest Mana Collector (eg. Mana Spreader) in the network to the Chunk + * Coordinates passed in, in the given dimension.
+ * A way of getting the dimension is via worldObj.provider.dimensionId
+ * Note that this function *can* get performance intensive, it's reccomended you + * call it sparingly and take cache of the value returned. + * + * @param limit The maximum distance the closest block can be, if the closest block + * is farther away than that, null will be returned instead. + */ + public TileEntity getClosestCollector(ChunkCoordinates pos, int dim, int limit); - /** - * Gets the closest Mana Pool in the network to the Chunk Coordinates passed in, - * in the given dimension.
- * A way of getting the dimension is via worldObj.provider.dimensionId
- * Note that this function *can* get performance intensive, it's reccomended you - * call it sparingly and take cache of the value returned. - * @param limit The maximum distance the closest block can be, if the closest block - * is farther away than that, null will be returned instead. - */ - public TileEntity getClosestPool(ChunkCoordinates pos, int dim, int limit); + /** + * Gets the closest Mana Pool in the network to the Chunk Coordinates passed in, + * in the given dimension.
+ * A way of getting the dimension is via worldObj.provider.dimensionId
+ * Note that this function *can* get performance intensive, it's reccomended you + * call it sparingly and take cache of the value returned. + * + * @param limit The maximum distance the closest block can be, if the closest block + * is farther away than that, null will be returned instead. + */ + public TileEntity getClosestPool(ChunkCoordinates pos, int dim, int limit); - /** - * Gets the list of all Mana Collectors (eg. Mana Spreader) in the dimension - * passed in. Note that this is the actual list and not a copy, make sure to - * clone the list if you intend to change it in any way. - */ - public List getAllCollectorsInWorld(int dim); + /** + * Gets the list of all Mana Collectors (eg. Mana Spreader) in the dimension + * passed in. Note that this is the actual list and not a copy, make sure to + * clone the list if you intend to change it in any way. + */ + public List getAllCollectorsInWorld(int dim); - /** - * Gets the list of all Mana Pools in the dimension passed in. Note that this - * is the actual list and not a copy, make sure to clone the list if you intend - * to change it in any way. - */ - public List getAllPoolsInWorld(int dim); + /** + * Gets the list of all Mana Pools in the dimension passed in. Note that this + * is the actual list and not a copy, make sure to clone the list if you intend + * to change it in any way. + */ + public List getAllPoolsInWorld(int dim); } diff --git a/MODSRC/vazkii/botania/api/lexicon/IRecipeKeyProvider.java b/MODSRC/vazkii/botania/api/lexicon/IRecipeKeyProvider.java index d07c0325b..316125878 100644 --- a/MODSRC/vazkii/botania/api/lexicon/IRecipeKeyProvider.java +++ b/MODSRC/vazkii/botania/api/lexicon/IRecipeKeyProvider.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 20, 2014, 6:08:48 PM (GMT)] */ package vazkii.botania.api.lexicon; @@ -19,6 +19,6 @@ import net.minecraft.item.ItemStack; */ public interface IRecipeKeyProvider { - public String getKey(ItemStack stack); + public String getKey(ItemStack stack); } diff --git a/MODSRC/vazkii/botania/api/lexicon/LexiconCategory.java b/MODSRC/vazkii/botania/api/lexicon/LexiconCategory.java index 76273419c..1e82000c9 100644 --- a/MODSRC/vazkii/botania/api/lexicon/LexiconCategory.java +++ b/MODSRC/vazkii/botania/api/lexicon/LexiconCategory.java @@ -2,11 +2,11 @@ * This class was created by . 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 14, 2014, 6:23:47 PM (GMT)] */ package vazkii.botania.api.lexicon; @@ -16,17 +16,17 @@ import java.util.List; public final class LexiconCategory { - public final String unlocalizedName; - public final List entries = new ArrayList(); + public final String unlocalizedName; + public final List entries = new ArrayList(); - /** - * @param unlocalizedName The unlocalized name of this category. This will be localized by the client display. - */ - public LexiconCategory(String unlocalizedName) { - this.unlocalizedName = unlocalizedName; - } + /** + * @param unlocalizedName The unlocalized name of this category. This will be localized by the client display. + */ + public LexiconCategory(String unlocalizedName) { + this.unlocalizedName = unlocalizedName; + } - public String getUnlocalizedName() { - return unlocalizedName; - } + public String getUnlocalizedName() { + return unlocalizedName; + } } diff --git a/MODSRC/vazkii/botania/api/lexicon/LexiconEntry.java b/MODSRC/vazkii/botania/api/lexicon/LexiconEntry.java index 708ca373d..ee3144543 100644 --- a/MODSRC/vazkii/botania/api/lexicon/LexiconEntry.java +++ b/MODSRC/vazkii/botania/api/lexicon/LexiconEntry.java @@ -2,78 +2,78 @@ * This class was created by . 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 14, 2014, 6:17:06 PM (GMT)] */ package vazkii.botania.api.lexicon; +import net.minecraft.util.StatCollector; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import net.minecraft.util.StatCollector; +public class LexiconEntry implements Comparable { -public class LexiconEntry implements Comparable{ + public final String unlocalizedName; + public final LexiconCategory category; - public final String unlocalizedName; - public final LexiconCategory category; + public List pages = new ArrayList(); + private boolean priority = false; - public List pages = new ArrayList(); - private boolean priority = false; + /** + * @param unlocalizedName The unlocalized name of this entry. This will be localized by the client display. + */ + public LexiconEntry(String unlocalizedName, LexiconCategory category) { + this.unlocalizedName = unlocalizedName; + this.category = category; + } - /** - * @param unlocalizedName The unlocalized name of this entry. This will be localized by the client display. - */ - public LexiconEntry(String unlocalizedName, LexiconCategory category) { - this.unlocalizedName = unlocalizedName; - this.category = category; - } + /** + * Sets this page as prioritized, as in, will appear before others in the lexicon. + */ + public LexiconEntry setPriority() { + priority = true; + return this; + } - /** - * Sets this page as prioritized, as in, will appear before others in the lexicon. - */ - public LexiconEntry setPriority() { - priority = true; - return this; - } + public boolean isPriority() { + return priority; + } - public boolean isPriority() { - return priority; - } + public String getUnlocalizedName() { + return unlocalizedName; + } - public String getUnlocalizedName() { - return unlocalizedName; - } + /** + * Sets what pages you want this entry to have. + */ + public LexiconEntry setLexiconPages(LexiconPage... pages) { + this.pages.addAll(Arrays.asList(pages)); - /** - * Sets what pages you want this entry to have. - */ - public LexiconEntry setLexiconPages(LexiconPage... pages) { - this.pages.addAll(Arrays.asList(pages)); + for(int i = 0; i < this.pages.size(); i++) + this.pages.get(i).onPageAdded(this, i); - for(int i = 0; i < this.pages.size(); i++) - this.pages.get(i).onPageAdded(this, i); + return this; + } - return this; - } + /** + * Adds a page to the list of pages. + */ + public void addPage(LexiconPage page) { + pages.add(page); + } - /** - * Adds a page to the list of pages. - */ - public void addPage(LexiconPage page) { - pages.add(page); - } + public final String getNameForSorting() { + return (priority ? 0 : 1) + StatCollector.translateToLocal(getUnlocalizedName()); + } - public final String getNameForSorting() { - return (priority ? 0 : 1) + StatCollector.translateToLocal(getUnlocalizedName()); - } - - @Override - public int compareTo(LexiconEntry o) { - return getNameForSorting().compareTo(o.getNameForSorting()); - } + @Override + public int compareTo(LexiconEntry o) { + return getNameForSorting().compareTo(o.getNameForSorting()); + } } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/api/lexicon/LexiconPage.java b/MODSRC/vazkii/botania/api/lexicon/LexiconPage.java index 4ab7bd7b2..65468aac2 100644 --- a/MODSRC/vazkii/botania/api/lexicon/LexiconPage.java +++ b/MODSRC/vazkii/botania/api/lexicon/LexiconPage.java @@ -2,52 +2,53 @@ * This class was created by . 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 14, 2014, 6:17:24 PM (GMT)] */ package vazkii.botania.api.lexicon; -import vazkii.botania.api.internal.IGuiLexiconEntry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import vazkii.botania.api.internal.IGuiLexiconEntry; public abstract class LexiconPage { - public String unlocalizedName; + public String unlocalizedName; - public LexiconPage(String unlocalizedName) { - this.unlocalizedName = unlocalizedName; - } + public LexiconPage(String unlocalizedName) { + this.unlocalizedName = unlocalizedName; + } - /** - * Does the rendering for this page. - * @param gui The active GuiScreen - * @param mx The mouse's relative X position. - * @param my The mouse's relative Y position. - */ - @SideOnly(Side.CLIENT) - public abstract void renderScreen(IGuiLexiconEntry gui, int mx, int my); + /** + * Does the rendering for this page. + * + * @param gui The active GuiScreen + * @param mx The mouse's relative X position. + * @param my The mouse's relative Y position. + */ + @SideOnly(Side.CLIENT) + public abstract void renderScreen(IGuiLexiconEntry gui, int mx, int my); - /** - * Called per update tick. - */ - @SideOnly(Side.CLIENT) - public void updateScreen() { - // NO-OP - } + /** + * Called per update tick. + */ + @SideOnly(Side.CLIENT) + public void updateScreen() { + // NO-OP + } - /** - * Called when {@link LexiconEntry#setLexiconPages(LexiconPage...)} is called. - */ - public void onPageAdded(LexiconEntry entry, int index) { - // NO-OP - } + /** + * Called when {@link LexiconEntry#setLexiconPages(LexiconPage...)} is called. + */ + public void onPageAdded(LexiconEntry entry, int index) { + // NO-OP + } - public String getUnlocalizedName() { - return unlocalizedName; - } + public String getUnlocalizedName() { + return unlocalizedName; + } } diff --git a/MODSRC/vazkii/botania/api/lexicon/LexiconRecipeMappings.java b/MODSRC/vazkii/botania/api/lexicon/LexiconRecipeMappings.java index 49b2a133e..6aff32ec5 100644 --- a/MODSRC/vazkii/botania/api/lexicon/LexiconRecipeMappings.java +++ b/MODSRC/vazkii/botania/api/lexicon/LexiconRecipeMappings.java @@ -2,20 +2,20 @@ * This class was created by . 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 @ [Mar 6, 2014, 3:54:12 PM (GMT)] */ package vazkii.botania.api.lexicon; +import net.minecraft.item.ItemStack; + import java.util.HashMap; import java.util.Map; -import net.minecraft.item.ItemStack; - /** * This class contains mappings for which entry and page correspond to each * craftable ItemStack. Use the map method to map an ItemStack to a page in @@ -23,44 +23,43 @@ import net.minecraft.item.ItemStack; */ public final class LexiconRecipeMappings { - private static Map mappings = new HashMap(); + private static Map mappings = new HashMap(); - /** - * Maps the given stack to the given page of the entry. - */ - public static void map(ItemStack stack, LexiconEntry entry, int page, boolean force) { - EntryData data = new EntryData(entry, page); - String str = stackToString(stack); + /** + * Maps the given stack to the given page of the entry. + */ + public static void map(ItemStack stack, LexiconEntry entry, int page, boolean force) { + EntryData data = new EntryData(entry, page); + String str = stackToString(stack); - if(force || !mappings.containsKey(str)) - mappings.put(str, data); - } + if(force || !mappings.containsKey(str)) mappings.put(str, data); + } - public static void map(ItemStack stack, LexiconEntry entry, int page) { - map(stack, entry, page, false); - } + public static void map(ItemStack stack, LexiconEntry entry, int page) { + map(stack, entry, page, false); + } - public static EntryData getDataForStack(ItemStack stack) { - return mappings.get(stackToString(stack)); - } + public static EntryData getDataForStack(ItemStack stack) { + return mappings.get(stackToString(stack)); + } - public static String stackToString(ItemStack stack) { - if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider) - return ((IRecipeKeyProvider) stack.getItem()).getKey(stack); + public static String stackToString(ItemStack stack) { + if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider) + return ((IRecipeKeyProvider) stack.getItem()).getKey(stack); - return stack.getUnlocalizedName() + "~" + stack.getItemDamage(); - } + return stack.getUnlocalizedName() + "~" + stack.getItemDamage(); + } - public static class EntryData { + public static class EntryData { - public final LexiconEntry entry; - public final int page; + public final LexiconEntry entry; + public final int page; - public EntryData(LexiconEntry entry, int page) { - this.entry = entry; - this.page = page; - } + public EntryData(LexiconEntry entry, int page) { + this.entry = entry; + this.page = page; + } - } + } } diff --git a/MODSRC/vazkii/botania/api/mana/BurstProperties.java b/MODSRC/vazkii/botania/api/mana/BurstProperties.java index eed748091..0b6c32ecb 100644 --- a/MODSRC/vazkii/botania/api/mana/BurstProperties.java +++ b/MODSRC/vazkii/botania/api/mana/BurstProperties.java @@ -2,11 +2,11 @@ * This class was created by . 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 31, 2014, 3:49:30 PM (GMT)] */ package vazkii.botania.api.mana; @@ -17,21 +17,21 @@ package vazkii.botania.api.mana; */ public final class BurstProperties { - public int maxMana; - public int ticksBeforeManaLoss; - public float manaLossPerTick; - public float gravity; - public float motionModifier; + public int maxMana; + public int ticksBeforeManaLoss; + public float manaLossPerTick; + public float gravity; + public float motionModifier; - public int color; + public int color; - public BurstProperties(int maxMana, int ticksBeforeManaLoss, float manaLossPerTick, float gravity, float motionModifier, int color) { - this.maxMana = maxMana; - this.ticksBeforeManaLoss = ticksBeforeManaLoss; - this.manaLossPerTick = manaLossPerTick; - this.gravity = gravity; - this.motionModifier = motionModifier; - this.color = color; - } + public BurstProperties(int maxMana, int ticksBeforeManaLoss, float manaLossPerTick, float gravity, float motionModifier, int color) { + this.maxMana = maxMana; + this.ticksBeforeManaLoss = ticksBeforeManaLoss; + this.manaLossPerTick = manaLossPerTick; + this.gravity = gravity; + this.motionModifier = motionModifier; + this.color = color; + } } diff --git a/MODSRC/vazkii/botania/api/mana/ILens.java b/MODSRC/vazkii/botania/api/mana/ILens.java index ef2357cc4..ec81a089f 100644 --- a/MODSRC/vazkii/botania/api/mana/ILens.java +++ b/MODSRC/vazkii/botania/api/mana/ILens.java @@ -2,44 +2,42 @@ * This class was created by . 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 31, 2014, 3:03:04 PM (GMT)] */ package vazkii.botania.api.mana; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition; -import vazkii.botania.api.internal.IManaBurst; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.item.ItemStack; /** * Have an Item implement this to be counted as a lens for the mana spreader. */ public interface ILens extends ILensEffect { - @SideOnly(Side.CLIENT) - public int getLensColor(ItemStack stack); + @SideOnly(Side.CLIENT) + public int getLensColor(ItemStack stack); - /** - * Can the source lens be combined with the composite lens? This is called - * for both the ILens instance of ItemStack.getItem() of sourceLens and compositeLens. - */ - public boolean canCombineLenses(ItemStack sourceLens, ItemStack compositeLens); - - /** - * Gets the composite lens in the stack passed in, return null for none. - */ - public ItemStack getCompositeLens(ItemStack stack); + /** + * Can the source lens be combined with the composite lens? This is called + * for both the ILens instance of ItemStack.getItem() of sourceLens and compositeLens. + */ + public boolean canCombineLenses(ItemStack sourceLens, ItemStack compositeLens); - /** - * Sets the composite lens for the sourceLens as the compositeLens, returns - * the ItemStack with the combination. - */ - public ItemStack setCompositeLens(ItemStack sourceLens, ItemStack compositeLens); + /** + * Gets the composite lens in the stack passed in, return null for none. + */ + public ItemStack getCompositeLens(ItemStack stack); + + /** + * Sets the composite lens for the sourceLens as the compositeLens, returns + * the ItemStack with the combination. + */ + public ItemStack setCompositeLens(ItemStack sourceLens, ItemStack compositeLens); } diff --git a/MODSRC/vazkii/botania/api/mana/ILensEffect.java b/MODSRC/vazkii/botania/api/mana/ILensEffect.java index ca4f0ca09..104193ea0 100644 --- a/MODSRC/vazkii/botania/api/mana/ILensEffect.java +++ b/MODSRC/vazkii/botania/api/mana/ILensEffect.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Apr 14, 2014, 7:30:00 PM (GMT)] */ package vazkii.botania.api.mana; @@ -21,29 +21,30 @@ import vazkii.botania.api.internal.IManaBurst; */ public interface ILensEffect { - /** - * Called when a mana spreader that has this focus shoots a burst. This is where - * you change the properties of the burst. - */ - public void apply(ItemStack stack, BurstProperties props); + /** + * Called when a mana spreader that has this focus shoots a burst. This is where + * you change the properties of the burst. + */ + public void apply(ItemStack stack, BurstProperties props); - /** - * Called when a mana burst fired from a mana spreader with this focus collides against - * any block. This is called after the collision is handled. - * @return True to kill the burst. False to keep it alive. - */ - public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack); + /** + * Called when a mana burst fired from a mana spreader with this focus collides against + * any block. This is called after the collision is handled. + * + * @return True to kill the burst. False to keep it alive. + */ + public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack); - /** - * Called when a mana burst fired from a mana spreader with this focus is updated. - * This is called before the update is handled. - */ - public void updateBurst(IManaBurst burst, ItemStack stack); + /** + * Called when a mana burst fired from a mana spreader with this focus is updated. + * This is called before the update is handled. + */ + public void updateBurst(IManaBurst burst, ItemStack stack); + + /** + * Called when the mana burst should do it's particles. Return false to not + * do any particles. + */ + public boolean doParticles(IManaBurst burst, ItemStack stack); - /** - * Called when the mana burst should do it's particles. Return false to not - * do any particles. - */ - public boolean doParticles(IManaBurst burst, ItemStack stack); - } diff --git a/MODSRC/vazkii/botania/api/mana/IManaBlock.java b/MODSRC/vazkii/botania/api/mana/IManaBlock.java index 6896f059a..a96632b5e 100644 --- a/MODSRC/vazkii/botania/api/mana/IManaBlock.java +++ b/MODSRC/vazkii/botania/api/mana/IManaBlock.java @@ -2,11 +2,11 @@ * This class was created by . 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 22, 2014, 4:59:05 PM (GMT)] */ package vazkii.botania.api.mana; @@ -18,9 +18,9 @@ package vazkii.botania.api.mana; */ public interface IManaBlock { - /** - * Gets the amount of mana currently in this block. - */ - public int getCurrentMana(); + /** + * Gets the amount of mana currently in this block. + */ + public int getCurrentMana(); } diff --git a/MODSRC/vazkii/botania/api/mana/IManaCollector.java b/MODSRC/vazkii/botania/api/mana/IManaCollector.java index 64b21a1cb..47b2f54a8 100644 --- a/MODSRC/vazkii/botania/api/mana/IManaCollector.java +++ b/MODSRC/vazkii/botania/api/mana/IManaCollector.java @@ -2,11 +2,11 @@ * This class was created by . 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 22, 2014, 5:01:19 PM (GMT)] */ package vazkii.botania.api.mana; @@ -16,23 +16,23 @@ import vazkii.botania.api.internal.IManaBurst; /** * Any TileEntity that implements this is considered a mana collector, by * which nearby generating flowers will pump mana into it.

- * + *

* Implementation Instructions:
* - Override invalidate() and onChunkUnload(), calling ManaNetworkEvent.removeCollector(this); on both.
* - On the first tick of onUpdate(), call ManaNetworkEvent.addCollector(this); */ public interface IManaCollector extends IManaReceiver { - /** - * Called every tick on the client case the player is holding a Wand of the Forest. - */ - public void onClientDisplayTick(); + /** + * Called every tick on the client case the player is holding a Wand of the Forest. + */ + public void onClientDisplayTick(); - /** - * Get the multiplier of mana to input into the block, 1.0 is the original amount of mana - * in the burst. 0.9, for example, is 90%, so 10% of the mana in the burst will get - * dissipated. - */ - public float getManaYieldMultiplier(IManaBurst burst); + /** + * Get the multiplier of mana to input into the block, 1.0 is the original amount of mana + * in the burst. 0.9, for example, is 90%, so 10% of the mana in the burst will get + * dissipated. + */ + public float getManaYieldMultiplier(IManaBurst burst); } diff --git a/MODSRC/vazkii/botania/api/mana/IManaCollisionGhost.java b/MODSRC/vazkii/botania/api/mana/IManaCollisionGhost.java index 420f683c4..f71f49146 100644 --- a/MODSRC/vazkii/botania/api/mana/IManaCollisionGhost.java +++ b/MODSRC/vazkii/botania/api/mana/IManaCollisionGhost.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 10, 2014, 7:49:19 PM (GMT)] */ package vazkii.botania.api.mana; @@ -17,6 +17,6 @@ package vazkii.botania.api.mana; */ public interface IManaCollisionGhost { - public boolean isGhost(); + public boolean isGhost(); } diff --git a/MODSRC/vazkii/botania/api/mana/IManaItem.java b/MODSRC/vazkii/botania/api/mana/IManaItem.java index 92a2ae295..ee9442c5e 100644 --- a/MODSRC/vazkii/botania/api/mana/IManaItem.java +++ b/MODSRC/vazkii/botania/api/mana/IManaItem.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 6, 2014, 9:07:40 AM (GMT)] */ package vazkii.botania.api.mana; @@ -20,45 +20,47 @@ import net.minecraft.tileentity.TileEntity; */ public interface IManaItem { - /** - * Gets the amount of mana this item contains - */ - public int getMana(ItemStack stack); + /** + * Gets the amount of mana this item contains + */ + public int getMana(ItemStack stack); - /** - * Gets the max amount of mana this item can hold. - */ - public int getMaxMana(ItemStack stack); + /** + * Gets the max amount of mana this item can hold. + */ + public int getMaxMana(ItemStack stack); - /** - * Adds mana to this item. - */ - public void addMana(ItemStack stack, int mana); + /** + * Adds mana to this item. + */ + public void addMana(ItemStack stack, int mana); - /** - * Can this item receive mana from a mana Pool? - * @param pool The pool it's receiving mana from, can be casted to IManaPool. - * @see IManaPool#isOutputtingPower() - */ - public boolean canReceiveManaFromPool(ItemStack stack, TileEntity pool); + /** + * Can this item receive mana from a mana Pool? + * + * @param pool The pool it's receiving mana from, can be casted to IManaPool. + * @see IManaPool#isOutputtingPower() + */ + public boolean canReceiveManaFromPool(ItemStack stack, TileEntity pool); - /** - * Can this item recieve mana from another item? - * The getItem() of both stacks can be casted to IManaItem. - */ - public boolean canReceiveManaFromItem(ItemStack stack, ItemStack otherStack); + /** + * Can this item recieve mana from another item? + * The getItem() of both stacks can be casted to IManaItem. + */ + public boolean canReceiveManaFromItem(ItemStack stack, ItemStack otherStack); - /** - * Can this item export mana to a mana Pool? - * @param pool The pool it's exporting mana to, can be casted to IManaPool. - * @see IManaPool#isOutputtingPower() - */ - public boolean canExportManaToPool(ItemStack stack,TileEntity pool); + /** + * Can this item export mana to a mana Pool? + * + * @param pool The pool it's exporting mana to, can be casted to IManaPool. + * @see IManaPool#isOutputtingPower() + */ + public boolean canExportManaToPool(ItemStack stack, TileEntity pool); - /** - * Can this item export mana to another item? - * The getItem() of both stacks can be casted to IManaItem. - */ - public boolean canExportManaToItem(ItemStack stack, ItemStack otherStack); + /** + * Can this item export mana to another item? + * The getItem() of both stacks can be casted to IManaItem. + */ + public boolean canExportManaToItem(ItemStack stack, ItemStack otherStack); } diff --git a/MODSRC/vazkii/botania/api/mana/IManaPool.java b/MODSRC/vazkii/botania/api/mana/IManaPool.java index b93bf6e8a..a767e45dc 100644 --- a/MODSRC/vazkii/botania/api/mana/IManaPool.java +++ b/MODSRC/vazkii/botania/api/mana/IManaPool.java @@ -2,11 +2,11 @@ * This class was created by . 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 22, 2014, 5:03:09 PM (GMT)] */ package vazkii.botania.api.mana; @@ -15,17 +15,17 @@ package vazkii.botania.api.mana; * Any TileEntity that implements this is considered a Mana Pool, * by which nearby functional flowers will pull mana from it.
* Mana Distributors will also accept it as valid output.

- * + *

* Implementation Instructions:
* - Override invalidate() and onChunkUnload(), calling ManaNetworkEvent.removePool(this); on both.
* - On the first tick of onUpdate(), call ManaNetworkEvent.addPool(this); */ public interface IManaPool extends IManaReceiver { - /** - * Returns false if the mana pool is accepting power from other power items, - * true if it's sending power into them. - */ - public boolean isOutputtingPower(); + /** + * Returns false if the mana pool is accepting power from other power items, + * true if it's sending power into them. + */ + public boolean isOutputtingPower(); } diff --git a/MODSRC/vazkii/botania/api/mana/IManaReceiver.java b/MODSRC/vazkii/botania/api/mana/IManaReceiver.java index 2838c7b7f..f9fe2dc81 100644 --- a/MODSRC/vazkii/botania/api/mana/IManaReceiver.java +++ b/MODSRC/vazkii/botania/api/mana/IManaReceiver.java @@ -2,11 +2,11 @@ * This class was created by . 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 22, 2014, 4:55:00 PM (GMT)] */ package vazkii.botania.api.mana; @@ -16,20 +16,20 @@ package vazkii.botania.api.mana; */ public interface IManaReceiver extends IManaBlock { - /** - * Is this Mana Receiver is full? Being full means no mana bursts will be sent. - */ - public boolean isFull(); + /** + * Is this Mana Receiver is full? Being full means no mana bursts will be sent. + */ + public boolean isFull(); - /** - * Called when this receiver receives mana. - */ - public void recieveMana(int mana); + /** + * Called when this receiver receives mana. + */ + public void recieveMana(int mana); - /** - * Can this tile receive mana from bursts? Generally set to false for - * implementations of IManaCollector. - */ - public boolean canRecieveManaFromBursts(); + /** + * Can this tile receive mana from bursts? Generally set to false for + * implementations of IManaCollector. + */ + public boolean canRecieveManaFromBursts(); } diff --git a/MODSRC/vazkii/botania/api/mana/ManaItemHandler.java b/MODSRC/vazkii/botania/api/mana/ManaItemHandler.java index def634a00..03a358569 100644 --- a/MODSRC/vazkii/botania/api/mana/ManaItemHandler.java +++ b/MODSRC/vazkii/botania/api/mana/ManaItemHandler.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 13, 2014, 5:32:24 PM (GMT)] */ package vazkii.botania.api.mana; @@ -16,72 +16,68 @@ import net.minecraft.item.ItemStack; public final class ManaItemHandler { - /** - * Requests mana from items in a given player's inventory. Note that stack.getItem() - * must be instanceof IManaItem. - * @param manaToGet How much mana is to be requested, if less mana exists than this amount, - * the amount of mana existent will be returned instead, if you want exact values use requestManaExact. - * @param remove If true, the mana will be removed from the target item. Set to false to just check. - * @return The amount of mana received from the request. - */ - public static int requestMana(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) { - if(stack == null) - return 0; + /** + * Requests mana from items in a given player's inventory. Note that stack.getItem() + * must be instanceof IManaItem. + * + * @param manaToGet How much mana is to be requested, if less mana exists than this amount, + * the amount of mana existent will be returned instead, if you want exact values use requestManaExact. + * @param remove If true, the mana will be removed from the target item. Set to false to just check. + * @return The amount of mana received from the request. + */ + public static int requestMana(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) { + if(stack == null) return 0; - for(ItemStack stackInSlot : player.inventory.mainInventory) { - if(stackInSlot == stack) - continue; + for(ItemStack stackInSlot : player.inventory.mainInventory) { + if(stackInSlot == stack) continue; - if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) { - IManaItem manaItem = (IManaItem) stackInSlot.getItem(); - if(manaItem.canExportManaToItem(stackInSlot, stack) && manaItem.getMana(stackInSlot) > 0) { - if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canReceiveManaFromItem(stack, stackInSlot)) - continue; + if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) { + IManaItem manaItem = (IManaItem) stackInSlot.getItem(); + if(manaItem.canExportManaToItem(stackInSlot, stack) && manaItem.getMana(stackInSlot) > 0) { + if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canReceiveManaFromItem(stack, stackInSlot)) + continue; - int mana = Math.min(manaToGet, manaItem.getMana(stackInSlot)); + int mana = Math.min(manaToGet, manaItem.getMana(stackInSlot)); - if(remove) - manaItem.addMana(stackInSlot, -mana); + if(remove) manaItem.addMana(stackInSlot, -mana); - return mana; - } - } - } + return mana; + } + } + } - return 0; - } + return 0; + } - /** - * Requests an exact amount of mana from items in a given player's inventory. - * Note that stack.getItem() must be instanceof IManaItem. - * @param manaToGet How much mana is to be requested, if less mana exists than this amount, - * false will be returned instead, and nothing will happen. - * @param remove If true, the mana will be removed from the target item. Set to false to just check. - * @return If the request was succesful. - */ - public static boolean requestManaExact(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) { - if(stack == null) - return false; + /** + * Requests an exact amount of mana from items in a given player's inventory. + * Note that stack.getItem() must be instanceof IManaItem. + * + * @param manaToGet How much mana is to be requested, if less mana exists than this amount, + * false will be returned instead, and nothing will happen. + * @param remove If true, the mana will be removed from the target item. Set to false to just check. + * @return If the request was succesful. + */ + public static boolean requestManaExact(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) { + if(stack == null) return false; - for(ItemStack stackInSlot : player.inventory.mainInventory) { - if(stackInSlot == stack) - continue; + for(ItemStack stackInSlot : player.inventory.mainInventory) { + if(stackInSlot == stack) continue; - if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) { - IManaItem manaItemSlot = (IManaItem) stackInSlot.getItem(); - if(manaItemSlot.canExportManaToItem(stackInSlot, stack) && manaItemSlot.getMana(stackInSlot) > manaToGet) { - if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canReceiveManaFromItem(stack, stackInSlot)) - continue; + if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) { + IManaItem manaItemSlot = (IManaItem) stackInSlot.getItem(); + if(manaItemSlot.canExportManaToItem(stackInSlot, stack) && manaItemSlot.getMana(stackInSlot) > manaToGet) { + if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canReceiveManaFromItem(stack, stackInSlot)) + continue; - if(remove) - manaItemSlot.addMana(stackInSlot, -manaToGet); + if(remove) manaItemSlot.addMana(stackInSlot, -manaToGet); - return true; - } - } - } + return true; + } + } + } - return false; - } + return false; + } } diff --git a/MODSRC/vazkii/botania/api/mana/ManaNetworkEvent.java b/MODSRC/vazkii/botania/api/mana/ManaNetworkEvent.java index e04253a7d..d84eabd9e 100644 --- a/MODSRC/vazkii/botania/api/mana/ManaNetworkEvent.java +++ b/MODSRC/vazkii/botania/api/mana/ManaNetworkEvent.java @@ -2,56 +2,56 @@ * This class was created by . 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 22, 2014, 5:04:30 PM (GMT)] */ package vazkii.botania.api.mana; +import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.MinecraftForge; -import cpw.mods.fml.common.eventhandler.Event; public class ManaNetworkEvent extends Event { - public final TileEntity tile; - public final ManaBlockType type; - public final Action action; + public final TileEntity tile; + public final ManaBlockType type; + public final Action action; - public ManaNetworkEvent(TileEntity tile, ManaBlockType type, Action action) { - this.tile = tile; - this.type = type; - this.action = action; - } + public ManaNetworkEvent(TileEntity tile, ManaBlockType type, Action action) { + this.tile = tile; + this.type = type; + this.action = action; + } - public static void addCollector(TileEntity tile) { - ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.COLLECTOR, Action.ADD); - MinecraftForge.EVENT_BUS.post(event); - } + public static void addCollector(TileEntity tile) { + ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.COLLECTOR, Action.ADD); + MinecraftForge.EVENT_BUS.post(event); + } - public static void removeCollector(TileEntity tile) { - ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.COLLECTOR, Action.REMOVE); - MinecraftForge.EVENT_BUS.post(event); - } + public static void removeCollector(TileEntity tile) { + ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.COLLECTOR, Action.REMOVE); + MinecraftForge.EVENT_BUS.post(event); + } - public static void addPool(TileEntity tile) { - ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.POOL, Action.ADD); - MinecraftForge.EVENT_BUS.post(event); - } + public static void addPool(TileEntity tile) { + ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.POOL, Action.ADD); + MinecraftForge.EVENT_BUS.post(event); + } - public static void removePool(TileEntity tile) { - ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.POOL, Action.REMOVE); - MinecraftForge.EVENT_BUS.post(event); - } + public static void removePool(TileEntity tile) { + ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.POOL, Action.REMOVE); + MinecraftForge.EVENT_BUS.post(event); + } - public enum ManaBlockType { - POOL, COLLECTOR - } + public enum ManaBlockType { + POOL, COLLECTOR + } - public enum Action { - REMOVE, ADD - } + public enum Action { + REMOVE, ADD + } } diff --git a/MODSRC/vazkii/botania/api/recipe/IFlowerComponent.java b/MODSRC/vazkii/botania/api/recipe/IFlowerComponent.java index fe5bf3cd6..136edcbc3 100644 --- a/MODSRC/vazkii/botania/api/recipe/IFlowerComponent.java +++ b/MODSRC/vazkii/botania/api/recipe/IFlowerComponent.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Feb 15, 2014, 2:36:35 PM (GMT)] */ package vazkii.botania.api.recipe; @@ -19,8 +19,8 @@ import net.minecraft.item.ItemStack; */ public interface IFlowerComponent { - public boolean canFit(ItemStack stack, IInventory apothecary); + public boolean canFit(ItemStack stack, IInventory apothecary); - public int getParticleColor(ItemStack stack); + public int getParticleColor(ItemStack stack); } diff --git a/MODSRC/vazkii/botania/api/recipe/RecipeManaInfusion.java b/MODSRC/vazkii/botania/api/recipe/RecipeManaInfusion.java index c92d33dba..d081fb48f 100644 --- a/MODSRC/vazkii/botania/api/recipe/RecipeManaInfusion.java +++ b/MODSRC/vazkii/botania/api/recipe/RecipeManaInfusion.java @@ -2,11 +2,11 @@ * This class was created by . 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 30, 2014, 5:57:07 PM (GMT)] */ package vazkii.botania.api.recipe; @@ -16,34 +16,33 @@ import net.minecraftforge.oredict.OreDictionary; public class RecipeManaInfusion { - ItemStack output; - Object input; - int mana; + ItemStack output; + Object input; + int mana; - public RecipeManaInfusion(ItemStack output, Object input, int mana) { - this.output = output; - this.input = input; - this.mana = mana; - } + public RecipeManaInfusion(ItemStack output, Object input, int mana) { + this.output = output; + this.input = input; + this.mana = mana; + } - public boolean matches(ItemStack stack) { - if(input instanceof ItemStack) - return stack.isItemEqual((ItemStack) input); + public boolean matches(ItemStack stack) { + if(input instanceof ItemStack) return stack.isItemEqual((ItemStack) input); - String oredict = OreDictionary.getOreName(OreDictionary.getOreID(stack)); - return oredict.equals(input); - } + String oredict = OreDictionary.getOreName(OreDictionary.getOreID(stack)); + return oredict.equals(input); + } - public Object getInput() { - return input; - } + public Object getInput() { + return input; + } - public ItemStack getOutput() { - return output; - } + public ItemStack getOutput() { + return output; + } - public int getManaToConsume() { - return mana; - } + public int getManaToConsume() { + return mana; + } } diff --git a/MODSRC/vazkii/botania/api/recipe/RecipePetals.java b/MODSRC/vazkii/botania/api/recipe/RecipePetals.java index fda3587ff..876633fa5 100644 --- a/MODSRC/vazkii/botania/api/recipe/RecipePetals.java +++ b/MODSRC/vazkii/botania/api/recipe/RecipePetals.java @@ -2,83 +2,79 @@ * This class was created by . 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 22, 2014, 2:02:44 PM (GMT)] */ package vazkii.botania.api.recipe; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; +import java.util.ArrayList; +import java.util.List; + public class RecipePetals { - ItemStack output; - List inputs; + ItemStack output; + List inputs; - public RecipePetals(ItemStack output, Object... inputs) { - this.output = output; + public RecipePetals(ItemStack output, Object... inputs) { + this.output = output; - List inputsToSet = new ArrayList(); - for(Object obj : inputs) { - if(obj instanceof String || obj instanceof ItemStack) - inputsToSet.add(obj); - else throw new IllegalArgumentException("Invalid input"); - } + List inputsToSet = new ArrayList(); + for(Object obj : inputs) { + if(obj instanceof String || obj instanceof ItemStack) inputsToSet.add(obj); + else throw new IllegalArgumentException("Invalid input"); + } - this.inputs = inputsToSet; - } + this.inputs = inputsToSet; + } - public boolean matches(IInventory inv) { - List inputsMissing = new ArrayList(inputs); + public boolean matches(IInventory inv) { + List inputsMissing = new ArrayList(inputs); - for(int i = 0; i < inv.getSizeInventory(); i++) { - ItemStack stack = inv.getStackInSlot(i); - if(stack == null) - break; + for(int i = 0; i < inv.getSizeInventory(); i++) { + ItemStack stack = inv.getStackInSlot(i); + if(stack == null) break; - String oredict = OreDictionary.getOreName(OreDictionary.getOreID(stack)); + String oredict = OreDictionary.getOreName(OreDictionary.getOreID(stack)); - int stackIndex = -1, oredictIndex = -1; + int stackIndex = -1, oredictIndex = -1; - for(int j = 0; j < inputsMissing.size(); j++) { - Object input = inputsMissing.get(j); - if(input instanceof String && input.equals(oredict)) { - oredictIndex = j; - break; - } else if(input instanceof ItemStack && simpleAreStacksEqual((ItemStack) input, stack)) { - stackIndex = j; - break; - } - } + for(int j = 0; j < inputsMissing.size(); j++) { + Object input = inputsMissing.get(j); + if(input instanceof String && input.equals(oredict)) { + oredictIndex = j; + break; + } else if(input instanceof ItemStack && simpleAreStacksEqual((ItemStack) input, stack)) { + stackIndex = j; + break; + } + } - if(stackIndex != -1) - inputsMissing.remove(stackIndex); - else if(oredictIndex != -1) - inputsMissing.remove(oredictIndex); - else return false; - } + if(stackIndex != -1) inputsMissing.remove(stackIndex); + else if(oredictIndex != -1) inputsMissing.remove(oredictIndex); + else return false; + } - return inputsMissing.isEmpty(); - } + return inputsMissing.isEmpty(); + } - boolean simpleAreStacksEqual(ItemStack stack, ItemStack stack2) { - return stack.getItem() == stack2.getItem() && stack.getItemDamage() == stack2.getItemDamage(); - } + boolean simpleAreStacksEqual(ItemStack stack, ItemStack stack2) { + return stack.getItem() == stack2.getItem() && stack.getItemDamage() == stack2.getItemDamage(); + } - public List getInputs() { - return new ArrayList(inputs); - } + public List getInputs() { + return new ArrayList(inputs); + } - public ItemStack getOutput() { - return output; - } + public ItemStack getOutput() { + return output; + } } diff --git a/MODSRC/vazkii/botania/api/recipe/RecipeRuneAltar.java b/MODSRC/vazkii/botania/api/recipe/RecipeRuneAltar.java index 745c9573e..49d96dc98 100644 --- a/MODSRC/vazkii/botania/api/recipe/RecipeRuneAltar.java +++ b/MODSRC/vazkii/botania/api/recipe/RecipeRuneAltar.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Feb 5, 2014, 1:41:14 PM (GMT)] */ package vazkii.botania.api.recipe; @@ -15,17 +15,17 @@ import net.minecraft.item.ItemStack; public class RecipeRuneAltar extends RecipePetals { - ItemStack output; - int mana; + ItemStack output; + int mana; - public RecipeRuneAltar(ItemStack output, int mana, Object... inputs) { - super(output, inputs); - this.output = output; - this.mana = mana; - } + public RecipeRuneAltar(ItemStack output, int mana, Object... inputs) { + super(output, inputs); + this.output = output; + this.mana = mana; + } - public int getManaUsage() { - return mana; - } + public int getManaUsage() { + return mana; + } } diff --git a/MODSRC/vazkii/botania/api/subtile/SubTileEntity.java b/MODSRC/vazkii/botania/api/subtile/SubTileEntity.java index 23d528469..0ce88e721 100644 --- a/MODSRC/vazkii/botania/api/subtile/SubTileEntity.java +++ b/MODSRC/vazkii/botania/api/subtile/SubTileEntity.java @@ -2,15 +2,17 @@ * This class was created by . 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 24, 2014, 3:59:06 PM (GMT)] */ package vazkii.botania.api.subtile; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.player.EntityPlayer; @@ -21,8 +23,6 @@ import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.IIcon; import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.lexicon.LexiconEntry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; /** * A Sub-TileEntity, this is used for the flower system. Make sure to map subclasses @@ -31,80 +31,85 @@ import cpw.mods.fml.relauncher.SideOnly; */ public class SubTileEntity { - protected TileEntity supertile; + protected TileEntity supertile; - /** The Tag items should use to store which sub tile they are. **/ - public static final String TAG_TYPE = "type"; + /** + * The Tag items should use to store which sub tile they are. * + */ + public static final String TAG_TYPE = "type"; - public void setSupertile(TileEntity tile) { - supertile = tile; - } + public void setSupertile(TileEntity tile) { + supertile = tile; + } - public boolean canUpdate() { - return false; - } + public boolean canUpdate() { + return false; + } - public void onUpdate() { } + public void onUpdate() { + } - /** - * Writes some extra data to a network packet. This data is read - * by readFromPacketNBT on the client that receives the packet. - * Note: This method is also used to write to the world NBT. - */ - public void writeToPacketNBT(NBTTagCompound cmp) { } + /** + * Writes some extra data to a network packet. This data is read + * by readFromPacketNBT on the client that receives the packet. + * Note: This method is also used to write to the world NBT. + */ + public void writeToPacketNBT(NBTTagCompound cmp) { + } - /** - * Reads data from a network packet. This data is written by - * writeToPacketNBT in the server. Note: This method is also used - * to read from the world NBT. - */ - public void readFromPacketNBT(NBTTagCompound cmp) { } + /** + * Reads data from a network packet. This data is written by + * writeToPacketNBT in the server. Note: This method is also used + * to read from the world NBT. + */ + public void readFromPacketNBT(NBTTagCompound cmp) { + } - public void sync() { - supertile.getWorldObj().markBlockForUpdate(supertile.xCoord, supertile.yCoord, supertile.zCoord); - } - - public String getUnlocalizedName() { - return BotaniaAPI.getSubTileStringMapping(getClass()); - } + public void sync() { + supertile.getWorldObj().markBlockForUpdate(supertile.xCoord, supertile.yCoord, supertile.zCoord); + } - /** - * Gets the icon for this SubTileEntity, this is a block icon. - */ - @SideOnly(Side.CLIENT) - public IIcon getIcon() { - return BotaniaAPI.internalHandler.getSubTileIconForName(getUnlocalizedName()); - } + public String getUnlocalizedName() { + return BotaniaAPI.getSubTileStringMapping(getClass()); + } - /** - * Called when a Wand of the Forest is used on this sub tile. - */ - public boolean onWanded(EntityPlayer player, ItemStack wand) { - return false; - } + /** + * Gets the icon for this SubTileEntity, this is a block icon. + */ + @SideOnly(Side.CLIENT) + public IIcon getIcon() { + return BotaniaAPI.internalHandler.getSubTileIconForName(getUnlocalizedName()); + } - /** - * Gets which Lexicon Entry to open when this sub tile is right clicked with a lexicon. - */ - public LexiconEntry getEntry() { - return null; - } + /** + * Called when a Wand of the Forest is used on this sub tile. + */ + public boolean onWanded(EntityPlayer player, ItemStack wand) { + return false; + } - /** - * Gets the block coordinates this is bound to, for use with the wireframe render - * when the sub tile is being hovered with a wand of the forest. - */ - @SideOnly(Side.CLIENT) - public ChunkCoordinates getBinding() { - return null; - } + /** + * Gets which Lexicon Entry to open when this sub tile is right clicked with a lexicon. + */ + public LexiconEntry getEntry() { + return null; + } - /** - * Called on the client when the block being pointed at is the one with this sub tile. - * Used to render a HUD portraying some data from this sub tile. - */ - @SideOnly(Side.CLIENT) - public void renderHUD(Minecraft mc, ScaledResolution res) { - // NO-OP - } + /** + * Gets the block coordinates this is bound to, for use with the wireframe render + * when the sub tile is being hovered with a wand of the forest. + */ + @SideOnly(Side.CLIENT) + public ChunkCoordinates getBinding() { + return null; + } + + /** + * Called on the client when the block being pointed at is the one with this sub tile. + * Used to render a HUD portraying some data from this sub tile. + */ + @SideOnly(Side.CLIENT) + public void renderHUD(Minecraft mc, ScaledResolution res) { + // NO-OP + } } diff --git a/MODSRC/vazkii/botania/api/subtile/SubTileFunctional.java b/MODSRC/vazkii/botania/api/subtile/SubTileFunctional.java index 6e778a748..534a70111 100644 --- a/MODSRC/vazkii/botania/api/subtile/SubTileFunctional.java +++ b/MODSRC/vazkii/botania/api/subtile/SubTileFunctional.java @@ -2,17 +2,15 @@ * This class was created by . 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 24, 2014, 8:03:44 PM (GMT)] */ package vazkii.botania.api.subtile; -import java.awt.Color; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.player.EntityPlayer; @@ -25,145 +23,146 @@ import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.internal.IManaNetwork; import vazkii.botania.api.mana.IManaPool; +import java.awt.*; + /** * The basic class for a Functional Flower. */ public class SubTileFunctional extends SubTileEntity { - private static final String TAG_MANA = "mana"; + private static final String TAG_MANA = "mana"; - private static final String TAG_POOL_X = "poolX"; - private static final String TAG_POOL_Y = "poolY"; - private static final String TAG_POOL_Z = "poolZ"; + private static final String TAG_POOL_X = "poolX"; + private static final String TAG_POOL_Y = "poolY"; + private static final String TAG_POOL_Z = "poolZ"; - public int mana; + public int mana; - int sizeLastCheck = -1; - TileEntity linkedPool = null; - public int knownMana = -1; + int sizeLastCheck = -1; + TileEntity linkedPool = null; + public int knownMana = -1; - ChunkCoordinates cachedPoolCoordinates = null; + ChunkCoordinates cachedPoolCoordinates = null; - @Override - public boolean canUpdate() { - return true; - } + @Override + public boolean canUpdate() { + return true; + } - @Override - public void onUpdate() { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - linkPool(); + linkPool(); - if(linkedPool != null) { - IManaPool pool = (IManaPool) linkedPool; - int manaInPool = pool.getCurrentMana(); - int manaMissing = getMaxMana() - mana; - int manaToRemove = Math.min(manaMissing, manaInPool); - pool.recieveMana(-manaToRemove); - addMana(manaToRemove); - } + if(linkedPool != null) { + IManaPool pool = (IManaPool) linkedPool; + int manaInPool = pool.getCurrentMana(); + int manaMissing = getMaxMana() - mana; + int manaToRemove = Math.min(manaMissing, manaInPool); + pool.recieveMana(-manaToRemove); + addMana(manaToRemove); + } - if(supertile.getWorldObj().isRemote) { - double particleChance = 1F - (double) mana / (double) getMaxMana() / 2F; - Color color = new Color(getColor()); - if(Math.random() > particleChance) - BotaniaAPI.internalHandler.sparkleFX(supertile.getWorldObj(), supertile.xCoord + 0.3 + Math.random() * 0.5, supertile.yCoord + 0.5 + Math.random() * 0.5, supertile.zCoord + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5); - } - } + if(supertile.getWorldObj().isRemote) { + double particleChance = 1F - (double) mana / (double) getMaxMana() / 2F; + Color color = new Color(getColor()); + if(Math.random() > particleChance) + BotaniaAPI.internalHandler.sparkleFX(supertile.getWorldObj(), supertile.xCoord + 0.3 + Math.random() * 0.5, supertile.yCoord + 0.5 + Math.random() * 0.5, supertile.zCoord + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5); + } + } - public void linkPool() { - final int range = 10; + public void linkPool() { + final int range = 10; - boolean needsNew = false; - if(linkedPool == null) { - needsNew = true; + boolean needsNew = false; + if(linkedPool == null) { + needsNew = true; - if(cachedPoolCoordinates != null) { - TileEntity tileAt = supertile.getWorldObj().getTileEntity(cachedPoolCoordinates.posX, cachedPoolCoordinates.posY, cachedPoolCoordinates.posZ); - if(tileAt != null && tileAt instanceof IManaPool) { - linkedPool = tileAt; - needsNew = false; - } - cachedPoolCoordinates = null; - } - } + if(cachedPoolCoordinates != null) { + TileEntity tileAt = supertile.getWorldObj().getTileEntity(cachedPoolCoordinates.posX, cachedPoolCoordinates.posY, cachedPoolCoordinates.posZ); + if(tileAt != null && tileAt instanceof IManaPool) { + linkedPool = tileAt; + needsNew = false; + } + cachedPoolCoordinates = null; + } + } - if(!needsNew) { - TileEntity tileAt = supertile.getWorldObj().getTileEntity(linkedPool.xCoord, linkedPool.yCoord, linkedPool.zCoord); - if(!(tileAt instanceof IManaPool)) { - linkedPool = null; - needsNew = true; - } else linkedPool = tileAt; - } + if(!needsNew) { + TileEntity tileAt = supertile.getWorldObj().getTileEntity(linkedPool.xCoord, linkedPool.yCoord, linkedPool.zCoord); + if(!(tileAt instanceof IManaPool)) { + linkedPool = null; + needsNew = true; + } else linkedPool = tileAt; + } - if(needsNew) { - IManaNetwork network = BotaniaAPI.internalHandler.getManaNetworkInstance(); - int size = network.getAllPoolsInWorld(supertile.getWorldObj().provider.dimensionId).size(); - if(size != sizeLastCheck) { - ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord, supertile.yCoord, supertile.zCoord); - linkedPool = network.getClosestPool(coords, supertile.getWorldObj().provider.dimensionId, range); - sizeLastCheck = size; - } - } - } + if(needsNew) { + IManaNetwork network = BotaniaAPI.internalHandler.getManaNetworkInstance(); + int size = network.getAllPoolsInWorld(supertile.getWorldObj().provider.dimensionId).size(); + if(size != sizeLastCheck) { + ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord, supertile.yCoord, supertile.zCoord); + linkedPool = network.getClosestPool(coords, supertile.getWorldObj().provider.dimensionId, range); + sizeLastCheck = size; + } + } + } - public void addMana(int mana) { - this.mana = Math.min(getMaxMana(), this.mana + mana); - } + public void addMana(int mana) { + this.mana = Math.min(getMaxMana(), this.mana + mana); + } - @Override - public boolean onWanded(EntityPlayer player, ItemStack wand) { - knownMana = mana; - player.worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 1F); + @Override + public boolean onWanded(EntityPlayer player, ItemStack wand) { + knownMana = mana; + player.worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 1F); - return super.onWanded(player, wand); - } + return super.onWanded(player, wand); + } - public int getMaxMana() { - return 20; - } + public int getMaxMana() { + return 20; + } - public int getColor() { - return 0xFFFFFF; - } + public int getColor() { + return 0xFFFFFF; + } - @Override - public void readFromPacketNBT(NBTTagCompound cmp) { - mana = cmp.getInteger(TAG_MANA); + @Override + public void readFromPacketNBT(NBTTagCompound cmp) { + mana = cmp.getInteger(TAG_MANA); - int x = cmp.getInteger(TAG_POOL_X); - int y = cmp.getInteger(TAG_POOL_Y); - int z = cmp.getInteger(TAG_POOL_Z); + int x = cmp.getInteger(TAG_POOL_X); + int y = cmp.getInteger(TAG_POOL_Y); + int z = cmp.getInteger(TAG_POOL_Z); - cachedPoolCoordinates = new ChunkCoordinates(x, y, z); - } + cachedPoolCoordinates = new ChunkCoordinates(x, y, z); + } - @Override - public void writeToPacketNBT(NBTTagCompound cmp) { - cmp.setInteger(TAG_MANA, mana); + @Override + public void writeToPacketNBT(NBTTagCompound cmp) { + cmp.setInteger(TAG_MANA, mana); - int x = linkedPool == null ? 0 : linkedPool.xCoord; - int y = linkedPool == null ? -1 : linkedPool.yCoord; - int z = linkedPool == null ? 0 : linkedPool.zCoord; + int x = linkedPool == null ? 0 : linkedPool.xCoord; + int y = linkedPool == null ? -1 : linkedPool.yCoord; + int z = linkedPool == null ? 0 : linkedPool.zCoord; - cmp.setInteger(TAG_POOL_X, x); - cmp.setInteger(TAG_POOL_Y, y); - cmp.setInteger(TAG_POOL_Z, z); - } + cmp.setInteger(TAG_POOL_X, x); + cmp.setInteger(TAG_POOL_Y, y); + cmp.setInteger(TAG_POOL_Z, z); + } - @Override - public ChunkCoordinates getBinding() { - if(linkedPool == null) - return null; - return new ChunkCoordinates(linkedPool.xCoord, linkedPool.yCoord, linkedPool.zCoord); - } + @Override + public ChunkCoordinates getBinding() { + if(linkedPool == null) return null; + return new ChunkCoordinates(linkedPool.xCoord, linkedPool.yCoord, linkedPool.zCoord); + } - @Override - public void renderHUD(Minecraft mc, ScaledResolution res) { - String name = StatCollector.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name"); - int color = 0x66000000 | getColor(); - BotaniaAPI.internalHandler.drawSimpleManaHUD(color, knownMana, getMaxMana(), name, res); - } + @Override + public void renderHUD(Minecraft mc, ScaledResolution res) { + String name = StatCollector.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name"); + int color = 0x66000000 | getColor(); + BotaniaAPI.internalHandler.drawSimpleManaHUD(color, knownMana, getMaxMana(), name, res); + } } diff --git a/MODSRC/vazkii/botania/api/subtile/SubTileGenerating.java b/MODSRC/vazkii/botania/api/subtile/SubTileGenerating.java index 67708f739..fc7721ff7 100644 --- a/MODSRC/vazkii/botania/api/subtile/SubTileGenerating.java +++ b/MODSRC/vazkii/botania/api/subtile/SubTileGenerating.java @@ -2,17 +2,15 @@ * This class was created by . 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 24, 2014, 8:03:36 PM (GMT)] */ package vazkii.botania.api.subtile; -import java.awt.Color; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.player.EntityPlayer; @@ -25,176 +23,175 @@ import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.internal.IManaNetwork; import vazkii.botania.api.mana.IManaCollector; +import java.awt.*; + /** * The basic class for a Generating Flower. */ public class SubTileGenerating extends SubTileEntity { - private static final String TAG_MANA = "mana"; + private static final String TAG_MANA = "mana"; - private static final String TAG_COLLECTOR_X = "collectorX"; - private static final String TAG_COLLECTOR_Y = "collectorY"; - private static final String TAG_COLLECTOR_Z = "collectorZ"; + private static final String TAG_COLLECTOR_X = "collectorX"; + private static final String TAG_COLLECTOR_Y = "collectorY"; + private static final String TAG_COLLECTOR_Z = "collectorZ"; - protected int mana; + protected int mana; - int sizeLastCheck = -1; - protected TileEntity linkedCollector = null; - public int knownMana = -1; + int sizeLastCheck = -1; + protected TileEntity linkedCollector = null; + public int knownMana = -1; - ChunkCoordinates cachedCollectorCoordinates = null; + ChunkCoordinates cachedCollectorCoordinates = null; - @Override - public boolean canUpdate() { - return true; - } + @Override + public boolean canUpdate() { + return true; + } - @Override - public void onUpdate() { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - linkCollector(); + linkCollector(); - if(canGeneratePassively()) { - int delay = getDelayBetweenPassiveGeneration(); - if(delay > 0 && supertile.getWorldObj().getWorldTime() % delay == 0) { - if(shouldSyncPassiveGeneration()) - sync(); - addMana(getValueForPassiveGeneration()); - } - emptyManaIntoCollector(); - } + if(canGeneratePassively()) { + int delay = getDelayBetweenPassiveGeneration(); + if(delay > 0 && supertile.getWorldObj().getWorldTime() % delay == 0) { + if(shouldSyncPassiveGeneration()) sync(); + addMana(getValueForPassiveGeneration()); + } + emptyManaIntoCollector(); + } - if(supertile.getWorldObj().isRemote) { - double particleChance = 1F - (double) mana / (double) getMaxMana() / 2F; - Color color = new Color(getColor()); - if(Math.random() > particleChance) - BotaniaAPI.internalHandler.sparkleFX(supertile.getWorldObj(), supertile.xCoord + 0.3 + Math.random() * 0.5, supertile.yCoord + 0.5 + Math.random() * 0.5, supertile.zCoord + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5); - } - } + if(supertile.getWorldObj().isRemote) { + double particleChance = 1F - (double) mana / (double) getMaxMana() / 2F; + Color color = new Color(getColor()); + if(Math.random() > particleChance) + BotaniaAPI.internalHandler.sparkleFX(supertile.getWorldObj(), supertile.xCoord + 0.3 + Math.random() * 0.5, supertile.yCoord + 0.5 + Math.random() * 0.5, supertile.zCoord + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5); + } + } - public void linkCollector() { - final int range = 4; + public void linkCollector() { + final int range = 4; - boolean needsNew = false; - if(linkedCollector == null) { - needsNew = true; + boolean needsNew = false; + if(linkedCollector == null) { + needsNew = true; - if(cachedCollectorCoordinates != null) { - TileEntity tileAt = supertile.getWorldObj().getTileEntity(cachedCollectorCoordinates.posX, cachedCollectorCoordinates.posY, cachedCollectorCoordinates.posZ); - if(tileAt != null && tileAt instanceof IManaCollector) { - linkedCollector = tileAt; - needsNew = false; - } - cachedCollectorCoordinates = null; - } - } + if(cachedCollectorCoordinates != null) { + TileEntity tileAt = supertile.getWorldObj().getTileEntity(cachedCollectorCoordinates.posX, cachedCollectorCoordinates.posY, cachedCollectorCoordinates.posZ); + if(tileAt != null && tileAt instanceof IManaCollector) { + linkedCollector = tileAt; + needsNew = false; + } + cachedCollectorCoordinates = null; + } + } - if(!needsNew) { - TileEntity tileAt = supertile.getWorldObj().getTileEntity(linkedCollector.xCoord, linkedCollector.yCoord, linkedCollector.zCoord); - if(!(tileAt instanceof IManaCollector)) { - linkedCollector = null; - needsNew = true; - } else linkedCollector = tileAt; - } + if(!needsNew) { + TileEntity tileAt = supertile.getWorldObj().getTileEntity(linkedCollector.xCoord, linkedCollector.yCoord, linkedCollector.zCoord); + if(!(tileAt instanceof IManaCollector)) { + linkedCollector = null; + needsNew = true; + } else linkedCollector = tileAt; + } - if(needsNew) { - IManaNetwork network = BotaniaAPI.internalHandler.getManaNetworkInstance(); - int size = network.getAllCollectorsInWorld(supertile.getWorldObj().provider.dimensionId).size(); - if(size != sizeLastCheck) { - ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord, supertile.yCoord, supertile.zCoord); - linkedCollector = network.getClosestCollector(coords, supertile.getWorldObj().provider.dimensionId, range); - sizeLastCheck = size; - } - } - } + if(needsNew) { + IManaNetwork network = BotaniaAPI.internalHandler.getManaNetworkInstance(); + int size = network.getAllCollectorsInWorld(supertile.getWorldObj().provider.dimensionId).size(); + if(size != sizeLastCheck) { + ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord, supertile.yCoord, supertile.zCoord); + linkedCollector = network.getClosestCollector(coords, supertile.getWorldObj().provider.dimensionId, range); + sizeLastCheck = size; + } + } + } - public void addMana(int mana) { - this.mana = Math.min(getMaxMana(), this.mana + mana); - } + public void addMana(int mana) { + this.mana = Math.min(getMaxMana(), this.mana + mana); + } - public void emptyManaIntoCollector() { - if(linkedCollector != null) { - IManaCollector collector = (IManaCollector) linkedCollector; - if(!collector.isFull()) { - collector.recieveMana(mana); - mana = 0; - } - } - } + public void emptyManaIntoCollector() { + if(linkedCollector != null) { + IManaCollector collector = (IManaCollector) linkedCollector; + if(!collector.isFull()) { + collector.recieveMana(mana); + mana = 0; + } + } + } - public boolean shouldSyncPassiveGeneration() { - return false; - } + public boolean shouldSyncPassiveGeneration() { + return false; + } - public boolean canGeneratePassively() { - boolean rain = supertile.getWorldObj().getWorldChunkManager().getBiomeGenAt(supertile.xCoord, supertile.zCoord).getIntRainfall() > 0 && (supertile.getWorldObj().isRaining() || supertile.getWorldObj().isThundering()); - return !supertile.getWorldObj().isRemote && supertile.getWorldObj().isDaytime() && !rain && supertile.getWorldObj().canBlockSeeTheSky(supertile.xCoord, supertile.yCoord + 1, supertile.zCoord); - } + public boolean canGeneratePassively() { + boolean rain = supertile.getWorldObj().getWorldChunkManager().getBiomeGenAt(supertile.xCoord, supertile.zCoord).getIntRainfall() > 0 && (supertile.getWorldObj().isRaining() || supertile.getWorldObj().isThundering()); + return !supertile.getWorldObj().isRemote && supertile.getWorldObj().isDaytime() && !rain && supertile.getWorldObj().canBlockSeeTheSky(supertile.xCoord, supertile.yCoord + 1, supertile.zCoord); + } - public int getDelayBetweenPassiveGeneration() { - return 20; - } + public int getDelayBetweenPassiveGeneration() { + return 20; + } - public int getValueForPassiveGeneration() { - return 1; - } + public int getValueForPassiveGeneration() { + return 1; + } - @Override - public boolean onWanded(EntityPlayer player, ItemStack wand) { - if(!player.worldObj.isRemote) - sync(); + @Override + public boolean onWanded(EntityPlayer player, ItemStack wand) { + if(!player.worldObj.isRemote) sync(); - knownMana = mana; - player.worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 1F); + knownMana = mana; + player.worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 1F); - return super.onWanded(player, wand); - } + return super.onWanded(player, wand); + } - public int getMaxMana() { - return 20; - } + public int getMaxMana() { + return 20; + } - public int getColor() { - return 0xFFFFFF; - } + public int getColor() { + return 0xFFFFFF; + } - @Override - public void readFromPacketNBT(NBTTagCompound cmp) { - mana = cmp.getInteger(TAG_MANA); + @Override + public void readFromPacketNBT(NBTTagCompound cmp) { + mana = cmp.getInteger(TAG_MANA); - int x = cmp.getInteger(TAG_COLLECTOR_X); - int y = cmp.getInteger(TAG_COLLECTOR_Y); - int z = cmp.getInteger(TAG_COLLECTOR_Z); + int x = cmp.getInteger(TAG_COLLECTOR_X); + int y = cmp.getInteger(TAG_COLLECTOR_Y); + int z = cmp.getInteger(TAG_COLLECTOR_Z); - cachedCollectorCoordinates = new ChunkCoordinates(x, y, z); - } + cachedCollectorCoordinates = new ChunkCoordinates(x, y, z); + } - @Override - public void writeToPacketNBT(NBTTagCompound cmp) { - cmp.setInteger(TAG_MANA, mana); + @Override + public void writeToPacketNBT(NBTTagCompound cmp) { + cmp.setInteger(TAG_MANA, mana); - int x = linkedCollector == null ? 0 : linkedCollector.xCoord; - int y = linkedCollector == null ? -1 : linkedCollector.yCoord; - int z = linkedCollector == null ? 0 : linkedCollector.zCoord; + int x = linkedCollector == null ? 0 : linkedCollector.xCoord; + int y = linkedCollector == null ? -1 : linkedCollector.yCoord; + int z = linkedCollector == null ? 0 : linkedCollector.zCoord; - cmp.setInteger(TAG_COLLECTOR_X, x); - cmp.setInteger(TAG_COLLECTOR_Y, y); - cmp.setInteger(TAG_COLLECTOR_Z, z); - } + cmp.setInteger(TAG_COLLECTOR_X, x); + cmp.setInteger(TAG_COLLECTOR_Y, y); + cmp.setInteger(TAG_COLLECTOR_Z, z); + } - @Override - public ChunkCoordinates getBinding() { - if(linkedCollector == null) - return null; - return new ChunkCoordinates(linkedCollector.xCoord, linkedCollector.yCoord, linkedCollector.zCoord); - } + @Override + public ChunkCoordinates getBinding() { + if(linkedCollector == null) return null; + return new ChunkCoordinates(linkedCollector.xCoord, linkedCollector.yCoord, linkedCollector.zCoord); + } - @Override - public void renderHUD(Minecraft mc, ScaledResolution res) { - String name = StatCollector.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name"); - int color = 0x66000000 | getColor(); - BotaniaAPI.internalHandler.drawSimpleManaHUD(color, knownMana, getMaxMana(), name, res); - } + @Override + public void renderHUD(Minecraft mc, ScaledResolution res) { + String name = StatCollector.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name"); + int color = 0x66000000 | getColor(); + BotaniaAPI.internalHandler.drawSimpleManaHUD(color, knownMana, getMaxMana(), name, res); + } } diff --git a/MODSRC/vazkii/botania/client/core/handler/BoundTileRenderer.java b/MODSRC/vazkii/botania/client/core/handler/BoundTileRenderer.java index a1eeb1fcc..1abf9296c 100644 --- a/MODSRC/vazkii/botania/client/core/handler/BoundTileRenderer.java +++ b/MODSRC/vazkii/botania/client/core/handler/BoundTileRenderer.java @@ -2,17 +2,16 @@ * This class was created by . 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 @ [Mar 24, 2014, 7:02:37 PM (GMT)] */ package vazkii.botania.client.core.handler; -import java.awt.Color; - +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; @@ -25,116 +24,115 @@ import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderWorldLastEvent; - import org.lwjgl.opengl.GL11; - import vazkii.botania.api.ITileBound; import vazkii.botania.api.IWireframeAABBProvider; import vazkii.botania.common.item.ItemTwigWand; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +import java.awt.*; public final class BoundTileRenderer { - @SubscribeEvent - public void onWorldRenderLast(RenderWorldLastEvent event) { - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glEnable(GL11.GL_BLEND); + @SubscribeEvent + public void onWorldRenderLast(RenderWorldLastEvent event) { + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_BLEND); - Tessellator.renderingWorldRenderer = false; + Tessellator.renderingWorldRenderer = false; - EntityPlayer player = Minecraft.getMinecraft().thePlayer; - World world = player.worldObj; - ItemStack stack = player.getCurrentEquippedItem(); - if(stack != null && stack.getItem() instanceof ItemTwigWand) { - MovingObjectPosition pos = Minecraft.getMinecraft().objectMouseOver; - if(pos != null) { - TileEntity tile = world.getTileEntity(pos.blockX, pos.blockY, pos.blockZ); - if(tile != null && tile instanceof ITileBound) { - ChunkCoordinates coords = ((ITileBound) tile).getBinding(); - if(coords != null) - renderBlockOutlineAt(coords, Color.HSBtoRGB(world.getTotalWorldTime() % 200 / 200F, 0.6F, 1F)); - } - } - } + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + World world = player.worldObj; + ItemStack stack = player.getCurrentEquippedItem(); + if(stack != null && stack.getItem() instanceof ItemTwigWand) { + MovingObjectPosition pos = Minecraft.getMinecraft().objectMouseOver; + if(pos != null) { + TileEntity tile = world.getTileEntity(pos.blockX, pos.blockY, pos.blockZ); + if(tile != null && tile instanceof ITileBound) { + ChunkCoordinates coords = ((ITileBound) tile).getBinding(); + if(coords != null) + renderBlockOutlineAt(coords, Color.HSBtoRGB(world.getTotalWorldTime() % 200 / 200F, 0.6F, 1F)); + } + } + } - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_BLEND); - GL11.glPopMatrix(); - } + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_BLEND); + GL11.glPopMatrix(); + } - private void renderBlockOutlineAt(ChunkCoordinates pos, int color) { - GL11.glPushMatrix(); - GL11.glTranslated(pos.posX - RenderManager.renderPosX, pos.posY - RenderManager.renderPosY, pos.posZ - RenderManager.renderPosZ + 1); - Color colorRGB = new Color(color); - GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 255); + private void renderBlockOutlineAt(ChunkCoordinates pos, int color) { + GL11.glPushMatrix(); + GL11.glTranslated(pos.posX - RenderManager.renderPosX, pos.posY - RenderManager.renderPosY, pos.posZ - RenderManager.renderPosZ + 1); + Color colorRGB = new Color(color); + GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 255); - World world = Minecraft.getMinecraft().theWorld; - Block block = world.getBlock(pos.posX, pos.posY, pos.posZ); - drawWireframe : { - if(block != null) { - AxisAlignedBB axis; + World world = Minecraft.getMinecraft().theWorld; + Block block = world.getBlock(pos.posX, pos.posY, pos.posZ); + drawWireframe: + { + if(block != null) { + AxisAlignedBB axis; - if(block instanceof IWireframeAABBProvider) - axis = ((IWireframeAABBProvider) block).getWireframeAABB(world, pos.posX, pos.posY, pos.posZ); - else axis = block.getSelectedBoundingBoxFromPool(world, pos.posX, pos.posY, pos.posZ); + if(block instanceof IWireframeAABBProvider) + axis = ((IWireframeAABBProvider) block).getWireframeAABB(world, pos.posX, pos.posY, pos.posZ); + else axis = block.getSelectedBoundingBoxFromPool(world, pos.posX, pos.posY, pos.posZ); - if(axis == null) - break drawWireframe; + if(axis == null) break drawWireframe; - axis.minX -= pos.posX; - axis.maxX -= pos.posX; - axis.minY -= pos.posY; - axis.maxY -= pos.posY; - axis.minZ -= pos.posZ; - axis.maxZ -= pos.posZ; + axis.minX -= pos.posX; + axis.maxX -= pos.posX; + axis.minY -= pos.posY; + axis.maxY -= pos.posY; + axis.minZ -= pos.posZ; + axis.maxZ -= pos.posZ; - GL11.glTranslated(axis.minX, axis.minY, axis.minZ); - GL11.glScaled(axis.maxX - axis.minX, axis.maxY - axis.minY, axis.maxZ - axis.minZ); + GL11.glTranslated(axis.minX, axis.minY, axis.minZ); + GL11.glScaled(axis.maxX - axis.minX, axis.maxY - axis.minY, axis.maxZ - axis.minZ); - GL11.glLineWidth(1F); - renderBlockOutline(); + GL11.glLineWidth(1F); + renderBlockOutline(); - GL11.glLineWidth(4F); - GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 64); - renderBlockOutline(); - } - } + GL11.glLineWidth(4F); + GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 64); + renderBlockOutline(); + } + } - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } - private void renderBlockOutline() { - Tessellator tessellator = Tessellator.instance; + private void renderBlockOutline() { + Tessellator tessellator = Tessellator.instance; - tessellator.startDrawing(GL11.GL_LINES); - tessellator.addVertex(0, 0, 0); - tessellator.addVertex(0, 1, 0); - tessellator.addVertex(0, 1, 0); - tessellator.addVertex(1, 1, 0); - tessellator.addVertex(1, 1, 0); - tessellator.addVertex(1, 0, 0); - tessellator.addVertex(1, 0, 0); - tessellator.addVertex(0, 0, 0); - tessellator.addVertex(0, 0, -1); - tessellator.addVertex(0, 1, -1); - tessellator.addVertex(0, 0, -1); - tessellator.addVertex(1, 0, -1); - tessellator.addVertex(1, 0, -1); - tessellator.addVertex(1, 1, -1); - tessellator.addVertex(0, 1, -1); - tessellator.addVertex(1, 1, -1); - tessellator.addVertex(0, 0, 0); - tessellator.addVertex(0, 0, -1); - tessellator.addVertex(0, 1, 0); - tessellator.addVertex(0, 1, -1); - tessellator.addVertex(1, 0, 0); - tessellator.addVertex(1, 0, -1); - tessellator.addVertex(1, 1, 0); - tessellator.addVertex(1, 1, -1); + tessellator.startDrawing(GL11.GL_LINES); + tessellator.addVertex(0, 0, 0); + tessellator.addVertex(0, 1, 0); + tessellator.addVertex(0, 1, 0); + tessellator.addVertex(1, 1, 0); + tessellator.addVertex(1, 1, 0); + tessellator.addVertex(1, 0, 0); + tessellator.addVertex(1, 0, 0); + tessellator.addVertex(0, 0, 0); + tessellator.addVertex(0, 0, -1); + tessellator.addVertex(0, 1, -1); + tessellator.addVertex(0, 0, -1); + tessellator.addVertex(1, 0, -1); + tessellator.addVertex(1, 0, -1); + tessellator.addVertex(1, 1, -1); + tessellator.addVertex(0, 1, -1); + tessellator.addVertex(1, 1, -1); + tessellator.addVertex(0, 0, 0); + tessellator.addVertex(0, 0, -1); + tessellator.addVertex(0, 1, 0); + tessellator.addVertex(0, 1, -1); + tessellator.addVertex(1, 0, 0); + tessellator.addVertex(1, 0, -1); + tessellator.addVertex(1, 1, 0); + tessellator.addVertex(1, 1, -1); - tessellator.draw(); - } + tessellator.draw(); + } } diff --git a/MODSRC/vazkii/botania/client/core/handler/CapeHandler.java b/MODSRC/vazkii/botania/client/core/handler/CapeHandler.java index f22abce94..ae2657c22 100644 --- a/MODSRC/vazkii/botania/client/core/handler/CapeHandler.java +++ b/MODSRC/vazkii/botania/client/core/handler/CapeHandler.java @@ -2,77 +2,75 @@ * This class was created by . 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 @ [? (GMT)] */ package vazkii.botania.client.core.handler; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.util.ArrayList; - -import javax.imageio.ImageIO; - +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.renderer.ThreadDownloadImageData; import net.minecraftforge.client.event.RenderPlayerEvent; import vazkii.botania.client.lib.LibResources; import vazkii.botania.common.Botania; import vazkii.botania.common.lib.LibObfuscation; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.relauncher.ReflectionHelper; + +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.ArrayList; public class CapeHandler { - private ArrayList capePlayers = new ArrayList(); + private ArrayList capePlayers = new ArrayList(); - public static CapeHandler instance; + public static CapeHandler instance; - public CapeHandler() { - instance = this; - } + public CapeHandler() { + instance = this; + } - @SubscribeEvent - public void onPreRenderSpecials (RenderPlayerEvent.Specials.Pre event) { - if(Loader.isModLoaded("shadersmod")) - return; + @SubscribeEvent + public void onPreRenderSpecials(RenderPlayerEvent.Specials.Pre event) { + if(Loader.isModLoaded("shadersmod")) return; - if(event.entityPlayer instanceof AbstractClientPlayer && (event.entityPlayer.getCommandSenderName().equals("Vazkii"))) { - AbstractClientPlayer abstractClientPlayer = (AbstractClientPlayer) event.entityPlayer; + if(event.entityPlayer instanceof AbstractClientPlayer && (event.entityPlayer.getCommandSenderName().equals("Vazkii"))) { + AbstractClientPlayer abstractClientPlayer = (AbstractClientPlayer) event.entityPlayer; - if (!capePlayers.contains(abstractClientPlayer)) { - ReflectionHelper.setPrivateValue(ThreadDownloadImageData.class, abstractClientPlayer.getTextureCape(), false, LibObfuscation.TEXTURE_UPLOADED); - new Thread(new CloakThread(abstractClientPlayer)).start(); - event.renderCape = true; - } - } - } + if(!capePlayers.contains(abstractClientPlayer)) { + ReflectionHelper.setPrivateValue(ThreadDownloadImageData.class, abstractClientPlayer.getTextureCape(), false, LibObfuscation.TEXTURE_UPLOADED); + new Thread(new CloakThread(abstractClientPlayer)).start(); + event.renderCape = true; + } + } + } - private class CloakThread implements Runnable { + private class CloakThread implements Runnable { - AbstractClientPlayer abstractClientPlayer; + AbstractClientPlayer abstractClientPlayer; - public CloakThread(AbstractClientPlayer player) { - abstractClientPlayer = player; - } + public CloakThread(AbstractClientPlayer player) { + abstractClientPlayer = player; + } - @Override - public void run() { - try { - BufferedImage bo = ImageIO.read(Botania.class.getResourceAsStream(LibResources.MODEL_CAPE)); - ReflectionHelper.setPrivateValue(ThreadDownloadImageData.class, abstractClientPlayer.getTextureCape(), bo, LibObfuscation.BUFFERED_IMAGE); - } catch (IOException e) { - e.printStackTrace(); - } - } - } + @Override + public void run() { + try { + BufferedImage bo = ImageIO.read(Botania.class.getResourceAsStream(LibResources.MODEL_CAPE)); + ReflectionHelper.setPrivateValue(ThreadDownloadImageData.class, abstractClientPlayer.getTextureCape(), bo, LibObfuscation.BUFFERED_IMAGE); + } catch(IOException e) { + e.printStackTrace(); + } + } + } - public void refreshCapes() { - capePlayers.clear(); - } + public void refreshCapes() { + capePlayers.clear(); + } } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/client/core/handler/ClientTickHandler.java b/MODSRC/vazkii/botania/client/core/handler/ClientTickHandler.java index 3d58bb655..7267e148b 100644 --- a/MODSRC/vazkii/botania/client/core/handler/ClientTickHandler.java +++ b/MODSRC/vazkii/botania/client/core/handler/ClientTickHandler.java @@ -2,19 +2,19 @@ * This class was created by . 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 @ [Feb 3, 2014, 9:59:17 PM (GMT)] */ package vazkii.botania.client.core.handler; -import java.util.ArrayList; -import java.util.EnumSet; -import java.util.List; - +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent; +import cpw.mods.fml.common.gameevent.TickEvent.Phase; +import cpw.mods.fml.common.gameevent.TickEvent.Type; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; @@ -25,65 +25,56 @@ import vazkii.botania.client.core.handler.LightningHandler.LightningBolt; import vazkii.botania.client.gui.GuiLexicon; import vazkii.botania.common.core.handler.ManaNetworkHandler; import vazkii.botania.common.item.ItemTwigWand; -import vazkii.botania.common.lib.LibMisc; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent; -import cpw.mods.fml.common.gameevent.TickEvent.Phase; -import cpw.mods.fml.common.gameevent.TickEvent.Type; + +import java.util.ArrayList; +import java.util.List; public class ClientTickHandler { - public static int ticksWithLexicaOpen = 0; - public static int pageFlipTicks = 0; - public static int ticksInGame = 0; + public static int ticksWithLexicaOpen = 0; + public static int pageFlipTicks = 0; + public static int ticksInGame = 0; - @SubscribeEvent - public void tickEnd(ClientTickEvent event) { - if(event.phase == Phase.END && event.type == Type.CLIENT) { - LightningBolt.update(); + @SubscribeEvent + public void tickEnd(ClientTickEvent event) { + if(event.phase == Phase.END && event.type == Type.CLIENT) { + LightningBolt.update(); - if(Minecraft.getMinecraft().theWorld == null) - ManaNetworkHandler.instance.clear(); + if(Minecraft.getMinecraft().theWorld == null) ManaNetworkHandler.instance.clear(); - GuiScreen gui = Minecraft.getMinecraft().currentScreen; - if(gui == null || !gui.doesGuiPauseGame()) { - ticksInGame++; - - EntityPlayer player = Minecraft.getMinecraft().thePlayer; - if(player != null) { - ItemStack stack = player.getCurrentEquippedItem(); - if(stack != null && stack.getItem() instanceof ItemTwigWand) { - List list = new ArrayList(ManaNetworkHandler.instance.getAllCollectorsInWorld(Minecraft.getMinecraft().theWorld.provider.dimensionId)); - for(TileEntity tile : list) { - if(tile instanceof IManaCollector) - ((IManaCollector) tile).onClientDisplayTick(); - } - } - } - } + GuiScreen gui = Minecraft.getMinecraft().currentScreen; + if(gui == null || !gui.doesGuiPauseGame()) { + ticksInGame++; - int ticksToOpen = 10; - if(gui instanceof GuiLexicon) { - if(ticksWithLexicaOpen < 0) - ticksWithLexicaOpen = 0; - if(ticksWithLexicaOpen < ticksToOpen) - ticksWithLexicaOpen++; - if(pageFlipTicks > 0) - pageFlipTicks--; - } else { - pageFlipTicks = 0; - if(ticksWithLexicaOpen > 0) { - if(ticksWithLexicaOpen > ticksToOpen) - ticksWithLexicaOpen = ticksToOpen; - ticksWithLexicaOpen--; - } - } - } - } + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + if(player != null) { + ItemStack stack = player.getCurrentEquippedItem(); + if(stack != null && stack.getItem() instanceof ItemTwigWand) { + List list = new ArrayList(ManaNetworkHandler.instance.getAllCollectorsInWorld(Minecraft.getMinecraft().theWorld.provider.dimensionId)); + for(TileEntity tile : list) { + if(tile instanceof IManaCollector) ((IManaCollector) tile).onClientDisplayTick(); + } + } + } + } - public static void notifyPageChange() { - if(pageFlipTicks == 0) - pageFlipTicks = 5; - } + int ticksToOpen = 10; + if(gui instanceof GuiLexicon) { + if(ticksWithLexicaOpen < 0) ticksWithLexicaOpen = 0; + if(ticksWithLexicaOpen < ticksToOpen) ticksWithLexicaOpen++; + if(pageFlipTicks > 0) pageFlipTicks--; + } else { + pageFlipTicks = 0; + if(ticksWithLexicaOpen > 0) { + if(ticksWithLexicaOpen > ticksToOpen) ticksWithLexicaOpen = ticksToOpen; + ticksWithLexicaOpen--; + } + } + } + } + + public static void notifyPageChange() { + if(pageFlipTicks == 0) pageFlipTicks = 5; + } } diff --git a/MODSRC/vazkii/botania/client/core/handler/HUDHandler.java b/MODSRC/vazkii/botania/client/core/handler/HUDHandler.java index 3f990c939..ddde53be0 100644 --- a/MODSRC/vazkii/botania/client/core/handler/HUDHandler.java +++ b/MODSRC/vazkii/botania/client/core/handler/HUDHandler.java @@ -2,17 +2,16 @@ * This class was created by . 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 25, 2014, 6:11:10 PM (GMT)] */ package vazkii.botania.client.core.handler; -import java.awt.Color; - +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; @@ -23,103 +22,98 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; - import org.lwjgl.opengl.GL11; - import vazkii.botania.api.ILexiconable; import vazkii.botania.api.IWandHUD; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.client.core.helper.RenderHelper; import vazkii.botania.client.lib.LibResources; import vazkii.botania.common.item.ModItems; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +import java.awt.*; public final class HUDHandler { - private static final ResourceLocation manaBar = new ResourceLocation(LibResources.GUI_MANA_HUD); - private static final RenderItem itemRender = new RenderItem(); + private static final ResourceLocation manaBar = new ResourceLocation(LibResources.GUI_MANA_HUD); + private static final RenderItem itemRender = new RenderItem(); - @SubscribeEvent - public void onDrawScreen(RenderGameOverlayEvent.Post event) { - if(event.type == ElementType.ALL) { - Minecraft mc = Minecraft.getMinecraft(); - MovingObjectPosition pos = mc.objectMouseOver; - if(pos != null && mc.thePlayer.getCurrentEquippedItem() != null && mc.thePlayer.getCurrentEquippedItem().getItem() == ModItems.twigWand) { - Block block = mc.theWorld.getBlock(pos.blockX, pos.blockY, pos.blockZ); - if(block instanceof IWandHUD) - ((IWandHUD) block).renderHUD(mc, event.resolution, mc.theWorld, pos.blockX, pos.blockY, pos.blockZ); - } + @SubscribeEvent + public void onDrawScreen(RenderGameOverlayEvent.Post event) { + if(event.type == ElementType.ALL) { + Minecraft mc = Minecraft.getMinecraft(); + MovingObjectPosition pos = mc.objectMouseOver; + if(pos != null && mc.thePlayer.getCurrentEquippedItem() != null && mc.thePlayer.getCurrentEquippedItem().getItem() == ModItems.twigWand) { + Block block = mc.theWorld.getBlock(pos.blockX, pos.blockY, pos.blockZ); + if(block instanceof IWandHUD) + ((IWandHUD) block).renderHUD(mc, event.resolution, mc.theWorld, pos.blockX, pos.blockY, pos.blockZ); + } else if(pos != null && mc.thePlayer.getCurrentEquippedItem() != null && mc.thePlayer.getCurrentEquippedItem().getItem() == ModItems.lexicon) { + Block block = mc.theWorld.getBlock(pos.blockX, pos.blockY, pos.blockZ); + if(block instanceof ILexiconable) { + LexiconEntry entry = ((ILexiconable) block).getEntry(mc.theWorld, pos.blockX, pos.blockY, pos.blockZ, mc.thePlayer, mc.thePlayer.getCurrentEquippedItem()); + if(entry != null) drawLexiconGUI(entry, event.resolution); + } + } + } + } - else if(pos != null && mc.thePlayer.getCurrentEquippedItem() != null && mc.thePlayer.getCurrentEquippedItem().getItem() == ModItems.lexicon) { - Block block = mc.theWorld.getBlock(pos.blockX, pos.blockY, pos.blockZ); - if(block instanceof ILexiconable) { - LexiconEntry entry = ((ILexiconable) block).getEntry(mc.theWorld, pos.blockX, pos.blockY, pos.blockZ, mc.thePlayer, mc.thePlayer.getCurrentEquippedItem()); - if(entry != null) - drawLexiconGUI(entry, event.resolution); - } - } - } - } + private void drawLexiconGUI(LexiconEntry entry, ScaledResolution res) { + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + Minecraft mc = Minecraft.getMinecraft(); + int x = res.getScaledWidth() / 2 + 8; + int y = res.getScaledHeight() / 2 - 4; - private void drawLexiconGUI(LexiconEntry entry, ScaledResolution res) { - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - Minecraft mc = Minecraft.getMinecraft(); - int x = res.getScaledWidth() / 2 + 8; - int y = res.getScaledHeight() / 2 - 4; + int color = 0x6600FF00; - int color = 0x6600FF00; + mc.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal(entry.getUnlocalizedName()), x + 18, y, color); + mc.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("botaniamisc.shiftToRead"), x + 18, y + 11, color); + itemRender.renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModItems.lexicon), x, y); + GL11.glDisable(GL11.GL_LIGHTING); + mc.fontRenderer.drawStringWithShadow("?", x + 10, y + 8, 0xFFFFFF); - mc.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal(entry.getUnlocalizedName()), x + 18, y, color); - mc.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("botaniamisc.shiftToRead"), x + 18, y + 11, color); - itemRender.renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModItems.lexicon), x, y); - GL11.glDisable(GL11.GL_LIGHTING); - mc.fontRenderer.drawStringWithShadow("?", x + 10, y + 8, 0xFFFFFF); + GL11.glDisable(GL11.GL_BLEND); + GL11.glColor4f(1F, 1F, 1F, 1F); + } - GL11.glDisable(GL11.GL_BLEND); - GL11.glColor4f(1F, 1F, 1F, 1F); - } + public static void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) { + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + Minecraft mc = Minecraft.getMinecraft(); + int x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(name) / 2; + int y = res.getScaledHeight() / 2 + 10; - public static void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) { - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - Minecraft mc = Minecraft.getMinecraft(); - int x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(name) / 2; - int y = res.getScaledHeight() / 2 + 10; + mc.fontRenderer.drawStringWithShadow(name, x, y, color); - mc.fontRenderer.drawStringWithShadow(name, x, y, color); + x = res.getScaledWidth() / 2 - 51; + y += 10; - x = res.getScaledWidth() / 2 - 51; - y += 10; + renderManaBar(x, y, color, 0.5F, mana, maxMana); - renderManaBar(x, y, color, 0.5F, mana, maxMana); + if(mana < 0) { + String text = StatCollector.translateToLocal("botaniamisc.statusUnknown"); + x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(text) / 2; + y -= 1; + mc.fontRenderer.drawStringWithShadow(text, x, y, color); + } - if(mana < 0) { - String text = StatCollector.translateToLocal("botaniamisc.statusUnknown"); - x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(text) / 2; - y -= 1; - mc.fontRenderer.drawStringWithShadow(text, x, y, color); - } + GL11.glDisable(GL11.GL_BLEND); + } - GL11.glDisable(GL11.GL_BLEND); - } + public static void renderManaBar(int x, int y, int color, float alpha, int mana, int maxMana) { + Minecraft mc = Minecraft.getMinecraft(); - public static void renderManaBar(int x, int y, int color, float alpha, int mana, int maxMana) { - Minecraft mc = Minecraft.getMinecraft(); + GL11.glColor4f(1F, 1F, 1F, alpha); + mc.renderEngine.bindTexture(manaBar); + RenderHelper.drawTexturedModalRect(x, y, 0, 0, 0, 102, 5); - GL11.glColor4f(1F, 1F, 1F, alpha); - mc.renderEngine.bindTexture(manaBar); - RenderHelper.drawTexturedModalRect(x, y, 0, 0, 0, 102, 5); + int manaPercentage = Math.max(0, (int) ((double) mana / (double) maxMana * 100)); - int manaPercentage = Math.max(0, (int) ((double) mana / (double) maxMana * 100)); + if(manaPercentage == 0 && mana > 0) manaPercentage = 1; - if(manaPercentage == 0 && mana > 0) - manaPercentage = 1; + RenderHelper.drawTexturedModalRect(x + 1 + manaPercentage, y + 1, 0, 0, 5, 100 - manaPercentage, 3); - RenderHelper.drawTexturedModalRect(x + 1 + manaPercentage, y + 1, 0, 0, 5, 100 - manaPercentage, 3); - - Color color_ = new Color(color); - GL11.glColor4ub((byte) color_.getRed(), (byte) color_.getGreen(),(byte) color_.getBlue(), (byte) (255F * alpha)); - RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0, 0, 5, manaPercentage, 3); - } + Color color_ = new Color(color); + GL11.glColor4ub((byte) color_.getRed(), (byte) color_.getGreen(), (byte) color_.getBlue(), (byte) (255F * alpha)); + RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0, 0, 5, manaPercentage, 3); + } } diff --git a/MODSRC/vazkii/botania/client/core/handler/LightningHandler.java b/MODSRC/vazkii/botania/client/core/handler/LightningHandler.java index f51accd64..14cfc9042 100644 --- a/MODSRC/vazkii/botania/client/core/handler/LightningHandler.java +++ b/MODSRC/vazkii/botania/client/core/handler/LightningHandler.java @@ -2,23 +2,16 @@ * This class was created by . 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 @ [Feb 3, 2014, 9:05:38 PM (GMT)] */ package vazkii.botania.client.core.handler; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Random; -import java.util.concurrent.ConcurrentLinkedQueue; - +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ActiveRenderInfo; @@ -32,450 +25,437 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderWorldLastEvent; - import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; import vazkii.botania.client.core.handler.LightningHandler.LightningBolt.Segment; import vazkii.botania.client.lib.LibResources; import vazkii.botania.common.core.helper.Vector3; +import java.util.*; +import java.util.concurrent.ConcurrentLinkedQueue; + public class LightningHandler { - private static final ResourceLocation outsideResource = new ResourceLocation(LibResources.MISC_WISP_LARGE); - private static final ResourceLocation insideResource = new ResourceLocation(LibResources.MISC_WISP_SMALL); + private static final ResourceLocation outsideResource = new ResourceLocation(LibResources.MISC_WISP_LARGE); + private static final ResourceLocation insideResource = new ResourceLocation(LibResources.MISC_WISP_SMALL); - static double interpPosX; - static double interpPosY; - static double interpPosZ; + static double interpPosX; + static double interpPosY; + static double interpPosZ; - private static Vector3 getRelativeViewVector(Vector3 pos) { - Entity renderEntity = Minecraft.getMinecraft().renderViewEntity; - return new Vector3((float) renderEntity.posX - pos.x, (float) renderEntity.posY + renderEntity.getEyeHeight() - pos.y, (float) renderEntity.posZ - pos.z); - } + private static Vector3 getRelativeViewVector(Vector3 pos) { + Entity renderEntity = Minecraft.getMinecraft().renderViewEntity; + return new Vector3((float) renderEntity.posX - pos.x, (float) renderEntity.posY + renderEntity.getEyeHeight() - pos.y, (float) renderEntity.posZ - pos.z); + } - @SubscribeEvent - public void onRenderWorldLast(RenderWorldLastEvent event) { - float frame = event.partialTicks; - Entity entity = Minecraft.getMinecraft().thePlayer; + @SubscribeEvent + public void onRenderWorldLast(RenderWorldLastEvent event) { + float frame = event.partialTicks; + Entity entity = Minecraft.getMinecraft().thePlayer; - interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * frame; - interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * frame; - interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * frame; + interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * frame; + interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * frame; + interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * frame; - GL11.glTranslated(-interpPosX, -interpPosY, -interpPosZ); + GL11.glTranslated(-interpPosX, -interpPosY, -interpPosZ); - Tessellator tessellator = Tessellator.instance; - - GL11.glDepthMask(false); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - - TextureManager render = Minecraft.getMinecraft().renderEngine; + Tessellator tessellator = Tessellator.instance; - render.bindTexture(outsideResource); - tessellator.startDrawingQuads(); - tessellator.setBrightness(0xF000F0); - for (LightningBolt bolt : LightningBolt.boltlist) - renderBolt(bolt, tessellator, frame, ActiveRenderInfo.rotationX, ActiveRenderInfo.rotationXZ, ActiveRenderInfo.rotationZ, ActiveRenderInfo.rotationXY, 0, false); - tessellator.draw(); + GL11.glDepthMask(false); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - render.bindTexture(insideResource); - tessellator.startDrawingQuads(); - tessellator.setBrightness(0xF000F0); - for (LightningBolt bolt : LightningBolt.boltlist) - renderBolt(bolt, tessellator, frame, ActiveRenderInfo.rotationX, ActiveRenderInfo.rotationXZ, ActiveRenderInfo.rotationZ, ActiveRenderInfo.rotationXY, 1, true); - tessellator.draw(); + TextureManager render = Minecraft.getMinecraft().renderEngine; - GL11.glDisable(GL11.GL_BLEND); - GL11.glDepthMask(true); + render.bindTexture(outsideResource); + tessellator.startDrawingQuads(); + tessellator.setBrightness(0xF000F0); + for(LightningBolt bolt : LightningBolt.boltlist) + renderBolt(bolt, tessellator, frame, ActiveRenderInfo.rotationX, ActiveRenderInfo.rotationXZ, ActiveRenderInfo.rotationZ, ActiveRenderInfo.rotationXY, 0, false); + tessellator.draw(); - GL11.glTranslated(interpPosX, interpPosY, interpPosZ); - } + render.bindTexture(insideResource); + tessellator.startDrawingQuads(); + tessellator.setBrightness(0xF000F0); + for(LightningBolt bolt : LightningBolt.boltlist) + renderBolt(bolt, tessellator, frame, ActiveRenderInfo.rotationX, ActiveRenderInfo.rotationXZ, ActiveRenderInfo.rotationZ, ActiveRenderInfo.rotationXY, 1, true); + tessellator.draw(); - public static void spawnLightningBolt(World world, Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) { - LightningBolt bolt = new LightningBolt(world, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner); - bolt.defaultFractal(); - bolt.finalizeBolt(); - LightningBolt.boltlist.add(bolt); - } + GL11.glDisable(GL11.GL_BLEND); + GL11.glDepthMask(true); - private void renderBolt(LightningBolt bolt, Tessellator tessellator, float partialframe, float cosyaw, float cospitch, float sinyaw, float cossinpitch, int pass, boolean inner) { - float boltage = bolt.particleAge < 0 ? 0 : (float) bolt.particleAge / (float) bolt.particleMaxAge; - float mainalpha = 1; - if(pass == 0) - mainalpha = (1 - boltage) * 0.4F; - else mainalpha = 1 - boltage * 0.5F; + GL11.glTranslated(interpPosX, interpPosY, interpPosZ); + } - int expandTime = (int) (bolt.length * bolt.speed); + public static void spawnLightningBolt(World world, Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) { + LightningBolt bolt = new LightningBolt(world, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner); + bolt.defaultFractal(); + bolt.finalizeBolt(); + LightningBolt.boltlist.add(bolt); + } - int renderstart = (int) ((expandTime / 2 - bolt.particleMaxAge + bolt.particleAge) / (float) (expandTime / 2) * bolt.numsegments0); - int renderend = (int) ((bolt.particleAge + expandTime) / (float) expandTime * bolt.numsegments0); + private void renderBolt(LightningBolt bolt, Tessellator tessellator, float partialframe, float cosyaw, float cospitch, float sinyaw, float cossinpitch, int pass, boolean inner) { + float boltage = bolt.particleAge < 0 ? 0 : (float) bolt.particleAge / (float) bolt.particleMaxAge; + float mainalpha = 1; + if(pass == 0) mainalpha = (1 - boltage) * 0.4F; + else mainalpha = 1 - boltage * 0.5F; - for(Segment rendersegment : bolt.segments) { - if(rendersegment.segmentno < renderstart || rendersegment.segmentno > renderend) - continue; - - Vector3 playervec = getRelativeViewVector(rendersegment.startpoint.point).multiply(-1); - - double width = 0.025F * (playervec.mag() / 5 + 1) * (1 + rendersegment.light) * 0.5F; - - Vector3 diff1 = playervec.copy().crossProduct(rendersegment.prevdiff).normalize().multiply(width / rendersegment.sinprev); - Vector3 diff2 = playervec.copy().crossProduct(rendersegment.nextdiff).normalize().multiply(width / rendersegment.sinnext); - - Vector3 startvec = rendersegment.startpoint.point; - Vector3 endvec = rendersegment.endpoint.point; - - tessellator.setColorRGBA_I(inner ? bolt.colorInner : bolt.colorOuter, (int) (mainalpha * rendersegment.light * 255)); - - tessellator.addVertexWithUV(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z, 0.5, 0); - tessellator.addVertexWithUV(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z, 0.5, 0); - tessellator.addVertexWithUV(startvec.x + diff1.x, startvec.y + diff1.y, startvec.z + diff1.z, 0.5, 1); - tessellator.addVertexWithUV(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z, 0.5, 1); - - if(rendersegment.next == null) { - Vector3 roundend = rendersegment.endpoint.point.copy().add(rendersegment.diff.copy().normalize().multiply(width)); - - tessellator.addVertexWithUV(roundend.x - diff2.x, roundend.y - diff2.y, roundend.z - diff2.z, 0, 0); - tessellator.addVertexWithUV(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z, 0.5, 0); - tessellator.addVertexWithUV(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z, 0.5, 1); - tessellator.addVertexWithUV(roundend.x + diff2.x, roundend.y + diff2.y, roundend.z + diff2.z, 0, 1); - } - - if(rendersegment.prev == null) { - Vector3 roundend = rendersegment.startpoint.point.copy().subtract(rendersegment.diff.copy().normalize().multiply(width)); - - tessellator.addVertexWithUV(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z, 0.5, 0); - tessellator.addVertexWithUV(roundend.x - diff1.x, roundend.y - diff1.y, roundend.z - diff1.z, 0, 0); - tessellator.addVertexWithUV(roundend.x + diff1.x, roundend.y + diff1.y, roundend.z + diff1.z, 0, 1); - tessellator.addVertexWithUV(startvec.x + diff1.x, startvec.y + diff1.y, startvec.z + diff1.z, 0.5, 1); - } - } - } - - public static class LightningBolt { - - public ArrayList segments = new ArrayList(); - public Vector3 start; - public Vector3 end; - ChunkCoordinates target; - HashMap splitparents = new HashMap(); - - public double length; - public int numsegments0; - private int numsplits; - private boolean finalized; - private Random rand; - public long seed; - - public int particleAge; - public int particleMaxAge; - public boolean isDead; - private AxisAlignedBB boundingBox; - - private World world; - private Entity source; - - public static ConcurrentLinkedQueue boltlist = new ConcurrentLinkedQueue(); - - public float speed = 1.5F; - public static final int fadetime = 20; - - public static int playerdamage = 1; - public static int entitydamage = 1; - - public int colorOuter; - public int colorInner; - - public class BoltPoint { - - public BoltPoint(Vector3 basepoint, Vector3 offsetvec) { - point = basepoint.copy().add(offsetvec); - this.basepoint = basepoint; - this.offsetvec = offsetvec; - } - - public Vector3 point; - Vector3 basepoint; - Vector3 offsetvec; - } + int expandTime = (int) (bolt.length * bolt.speed); - public class SegmentSorter implements Comparator { - - @Override - public int compare(Segment o1, Segment o2) { - int comp = Integer.valueOf(o1.splitno).compareTo(o2.splitno); - if(comp == 0) - return Integer.valueOf(o1.segmentno).compareTo(o2.segmentno); - else return comp; - } - } + int renderstart = (int) ((expandTime / 2 - bolt.particleMaxAge + bolt.particleAge) / (float) (expandTime / 2) * bolt.numsegments0); + int renderend = (int) ((bolt.particleAge + expandTime) / (float) expandTime * bolt.numsegments0); - public class SegmentLightSorter implements Comparator { - @Override - public int compare(Segment o1, Segment o2) { - return Float.compare(o2.light, o1.light); - } - } - - public class Segment { - public Segment(BoltPoint start, BoltPoint end, float light, int segmentnumber, int splitnumber) { - startpoint = start; - endpoint = end; - this.light = light; - segmentno = segmentnumber; - splitno = splitnumber; - - calcDiff(); - } - - public Segment(Vector3 start, Vector3 end) { - this(new BoltPoint(start, new Vector3(0, 0, 0)), new BoltPoint(end, new Vector3(0, 0, 0)), 1, 0, 0); - } - - public void calcDiff() { - diff = endpoint.point.copy().subtract(startpoint.point); - } - - public void calcEndDiffs() { - if(prev != null) { - Vector3 prevdiffnorm = prev.diff.copy().normalize(); - Vector3 thisdiffnorm = diff.copy().normalize(); + for(Segment rendersegment : bolt.segments) { + if(rendersegment.segmentno < renderstart || rendersegment.segmentno > renderend) continue; + + Vector3 playervec = getRelativeViewVector(rendersegment.startpoint.point).multiply(-1); - prevdiff = thisdiffnorm.copy().add(prevdiffnorm).normalize(); - sinprev = (float) Math.sin(thisdiffnorm.angle(prevdiffnorm.multiply(-1)) / 2); - } else { - prevdiff = diff.copy().normalize(); - sinprev = 1; - } + double width = 0.025F * (playervec.mag() / 5 + 1) * (1 + rendersegment.light) * 0.5F; + + Vector3 diff1 = playervec.copy().crossProduct(rendersegment.prevdiff).normalize().multiply(width / rendersegment.sinprev); + Vector3 diff2 = playervec.copy().crossProduct(rendersegment.nextdiff).normalize().multiply(width / rendersegment.sinnext); + + Vector3 startvec = rendersegment.startpoint.point; + Vector3 endvec = rendersegment.endpoint.point; + + tessellator.setColorRGBA_I(inner ? bolt.colorInner : bolt.colorOuter, (int) (mainalpha * rendersegment.light * 255)); + + tessellator.addVertexWithUV(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z, 0.5, 0); + tessellator.addVertexWithUV(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z, 0.5, 0); + tessellator.addVertexWithUV(startvec.x + diff1.x, startvec.y + diff1.y, startvec.z + diff1.z, 0.5, 1); + tessellator.addVertexWithUV(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z, 0.5, 1); + + if(rendersegment.next == null) { + Vector3 roundend = rendersegment.endpoint.point.copy().add(rendersegment.diff.copy().normalize().multiply(width)); + + tessellator.addVertexWithUV(roundend.x - diff2.x, roundend.y - diff2.y, roundend.z - diff2.z, 0, 0); + tessellator.addVertexWithUV(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z, 0.5, 0); + tessellator.addVertexWithUV(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z, 0.5, 1); + tessellator.addVertexWithUV(roundend.x + diff2.x, roundend.y + diff2.y, roundend.z + diff2.z, 0, 1); + } + + if(rendersegment.prev == null) { + Vector3 roundend = rendersegment.startpoint.point.copy().subtract(rendersegment.diff.copy().normalize().multiply(width)); + + tessellator.addVertexWithUV(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z, 0.5, 0); + tessellator.addVertexWithUV(roundend.x - diff1.x, roundend.y - diff1.y, roundend.z - diff1.z, 0, 0); + tessellator.addVertexWithUV(roundend.x + diff1.x, roundend.y + diff1.y, roundend.z + diff1.z, 0, 1); + tessellator.addVertexWithUV(startvec.x + diff1.x, startvec.y + diff1.y, startvec.z + diff1.z, 0.5, 1); + } + } + } + + public static class LightningBolt { + + public ArrayList segments = new ArrayList(); + public Vector3 start; + public Vector3 end; + ChunkCoordinates target; + HashMap splitparents = new HashMap(); + + public double length; + public int numsegments0; + private int numsplits; + private boolean finalized; + private Random rand; + public long seed; + + public int particleAge; + public int particleMaxAge; + public boolean isDead; + private AxisAlignedBB boundingBox; + + private World world; + private Entity source; + + public static ConcurrentLinkedQueue boltlist = new ConcurrentLinkedQueue(); + + public float speed = 1.5F; + public static final int fadetime = 20; + + public static int playerdamage = 1; + public static int entitydamage = 1; + + public int colorOuter; + public int colorInner; + + public class BoltPoint { + + public BoltPoint(Vector3 basepoint, Vector3 offsetvec) { + point = basepoint.copy().add(offsetvec); + this.basepoint = basepoint; + this.offsetvec = offsetvec; + } + + public Vector3 point; + Vector3 basepoint; + Vector3 offsetvec; + } - if(next != null) { - Vector3 nextdiffnorm = next.diff.copy().normalize(); - Vector3 thisdiffnorm = diff.copy().normalize(); + public class SegmentSorter implements Comparator { - nextdiff = thisdiffnorm.add(nextdiffnorm).normalize(); - sinnext = (float) Math.sin(thisdiffnorm.angle(nextdiffnorm.multiply(-1)) / 2); - } else { - nextdiff = diff.copy().normalize(); - sinnext = 1; - } - } + @Override + public int compare(Segment o1, Segment o2) { + int comp = Integer.valueOf(o1.splitno).compareTo(o2.splitno); + if(comp == 0) return Integer.valueOf(o1.segmentno).compareTo(o2.segmentno); + else return comp; + } + } - @Override - public String toString() { - return startpoint.point.toString() + " " + endpoint.point.toString(); - } + public class SegmentLightSorter implements Comparator { + @Override + public int compare(Segment o1, Segment o2) { + return Float.compare(o2.light, o1.light); + } + } + + public class Segment { + public Segment(BoltPoint start, BoltPoint end, float light, int segmentnumber, int splitnumber) { + startpoint = start; + endpoint = end; + this.light = light; + segmentno = segmentnumber; + splitno = splitnumber; + + calcDiff(); + } + + public Segment(Vector3 start, Vector3 end) { + this(new BoltPoint(start, new Vector3(0, 0, 0)), new BoltPoint(end, new Vector3(0, 0, 0)), 1, 0, 0); + } + + public void calcDiff() { + diff = endpoint.point.copy().subtract(startpoint.point); + } - public BoltPoint startpoint; - public BoltPoint endpoint; + public void calcEndDiffs() { + if(prev != null) { + Vector3 prevdiffnorm = prev.diff.copy().normalize(); + Vector3 thisdiffnorm = diff.copy().normalize(); - public Vector3 diff; + prevdiff = thisdiffnorm.copy().add(prevdiffnorm).normalize(); + sinprev = (float) Math.sin(thisdiffnorm.angle(prevdiffnorm.multiply(-1)) / 2); + } else { + prevdiff = diff.copy().normalize(); + sinprev = 1; + } - public Segment prev; - public Segment next; + if(next != null) { + Vector3 nextdiffnorm = next.diff.copy().normalize(); + Vector3 thisdiffnorm = diff.copy().normalize(); - public Vector3 nextdiff; - public Vector3 prevdiff; + nextdiff = thisdiffnorm.add(nextdiffnorm).normalize(); + sinnext = (float) Math.sin(thisdiffnorm.angle(nextdiffnorm.multiply(-1)) / 2); + } else { + nextdiff = diff.copy().normalize(); + sinnext = 1; + } + } - public float sinprev; - public float sinnext; - public float light; + @Override + public String toString() { + return startpoint.point.toString() + " " + endpoint.point.toString(); + } - public int segmentno; - public int splitno; - } + public BoltPoint startpoint; + public BoltPoint endpoint; - public LightningBolt(World world, Vector3 sourcevec, Vector3 targetvec, float ticksPerMeter, long seed, int colorOuter, int colorInner) { - this.world = world; - this.seed = seed; - rand = new Random(seed); - - start = sourcevec; - end = targetvec; + public Vector3 diff; - speed = ticksPerMeter; + public Segment prev; + public Segment next; - this.colorOuter = colorOuter; - this.colorInner = colorInner; + public Vector3 nextdiff; + public Vector3 prevdiff; - numsegments0 = 1; + public float sinprev; + public float sinnext; + public float light; - length = end.copy().subtract(start).mag(); - particleMaxAge = fadetime + rand.nextInt(fadetime) - fadetime / 2; - particleAge = -(int) (length * speed); + public int segmentno; + public int splitno; + } - boundingBox = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0); - boundingBox.setBB(AxisAlignedBB.getBoundingBox(Math.min(start.x, end.x), Math.min(start.y, end.y), Math.min(start.z, end.z), Math.max(start.x, end.x), Math.max(start.y, end.y), Math.max(start.z, end.z)).expand(length / 2, length / 2, length / 2)); + public LightningBolt(World world, Vector3 sourcevec, Vector3 targetvec, float ticksPerMeter, long seed, int colorOuter, int colorInner) { + this.world = world; + this.seed = seed; + rand = new Random(seed); - segments.add(new Segment(start, end)); - } + start = sourcevec; + end = targetvec; - public static Vector3 getFocalPoint(TileEntity tile) { - return Vector3.fromTileEntityCenter(tile); - } + speed = ticksPerMeter; - public LightningBolt(World world, Vector3 sourcevec, TileEntity target, float ticksPerMeter, long seed, int colorOuter, int colorInner) { - this(world, sourcevec, getFocalPoint(target), ticksPerMeter, seed, colorOuter, colorInner); - this.target = new ChunkCoordinates(target.xCoord, target.yCoord, target.zCoord); - } + this.colorOuter = colorOuter; + this.colorInner = colorInner; - public void setWrapper(Entity entity) { - source = entity; - } + numsegments0 = 1; - public void fractal(int splits, double amount, double splitchance, double splitlength, double splitangle) { - if(finalized) - return; + length = end.copy().subtract(start).mag(); + particleMaxAge = fadetime + rand.nextInt(fadetime) - fadetime / 2; + particleAge = -(int) (length * speed); - ArrayList oldsegments = segments; - segments = new ArrayList(); + boundingBox = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0); + boundingBox.setBB(AxisAlignedBB.getBoundingBox(Math.min(start.x, end.x), Math.min(start.y, end.y), Math.min(start.z, end.z), Math.max(start.x, end.x), Math.max(start.y, end.y), Math.max(start.z, end.z)).expand(length / 2, length / 2, length / 2)); - Segment prev = null; + segments.add(new Segment(start, end)); + } - for(Segment segment : oldsegments) { - prev = segment.prev; + public static Vector3 getFocalPoint(TileEntity tile) { + return Vector3.fromTileEntityCenter(tile); + } - Vector3 subsegment = segment.diff.copy().multiply(1F / splits); + public LightningBolt(World world, Vector3 sourcevec, TileEntity target, float ticksPerMeter, long seed, int colorOuter, int colorInner) { + this(world, sourcevec, getFocalPoint(target), ticksPerMeter, seed, colorOuter, colorInner); + this.target = new ChunkCoordinates(target.xCoord, target.yCoord, target.zCoord); + } - BoltPoint[] newpoints = new BoltPoint[splits + 1]; + public void setWrapper(Entity entity) { + source = entity; + } - Vector3 startpoint = segment.startpoint.point; - newpoints[0] = segment.startpoint; - newpoints[splits] = segment.endpoint; + public void fractal(int splits, double amount, double splitchance, double splitlength, double splitangle) { + if(finalized) return; - for(int i = 1; i < splits; i++) { - Vector3 randoff = segment.diff.copy().perpendicular().normalize().rotate(rand.nextFloat() * 360, segment.diff); - randoff.multiply((rand.nextFloat() - 0.5F) * amount * 2); + ArrayList oldsegments = segments; + segments = new ArrayList(); - Vector3 basepoint = startpoint.copy().add(subsegment.copy().multiply(i)); + Segment prev = null; - newpoints[i] = new BoltPoint(basepoint, randoff); - } + for(Segment segment : oldsegments) { + prev = segment.prev; - for(int i = 0; i < splits; i++) { - Segment next = new Segment(newpoints[i], newpoints[i + 1], segment.light, segment.segmentno * splits + i, segment.splitno); - next.prev = prev; - if (prev != null) - prev.next = next; + Vector3 subsegment = segment.diff.copy().multiply(1F / splits); - if(i != 0 && rand.nextFloat() < splitchance) { - Vector3 splitrot = next.diff.copy().xCrossProduct().rotate(rand.nextFloat() * 360, next.diff); - Vector3 diff = next.diff.copy().rotate((rand.nextFloat() * 0.66F + 0.33F) * splitangle, splitrot).multiply(splitlength); + BoltPoint[] newpoints = new BoltPoint[splits + 1]; - numsplits++; - splitparents.put(numsplits, next.splitno); + Vector3 startpoint = segment.startpoint.point; + newpoints[0] = segment.startpoint; + newpoints[splits] = segment.endpoint; - Segment split = new Segment(newpoints[i], new BoltPoint(newpoints[i + 1].basepoint, newpoints[i + 1].offsetvec.copy().add(diff)), segment.light / 2F, next.segmentno, numsplits); - split.prev = prev; + for(int i = 1; i < splits; i++) { + Vector3 randoff = segment.diff.copy().perpendicular().normalize().rotate(rand.nextFloat() * 360, segment.diff); + randoff.multiply((rand.nextFloat() - 0.5F) * amount * 2); - segments.add(split); - } + Vector3 basepoint = startpoint.copy().add(subsegment.copy().multiply(i)); - prev = next; - segments.add(next); - } + newpoints[i] = new BoltPoint(basepoint, randoff); + } - if(segment.next != null) - segment.next.prev = prev; - } + for(int i = 0; i < splits; i++) { + Segment next = new Segment(newpoints[i], newpoints[i + 1], segment.light, segment.segmentno * splits + i, segment.splitno); + next.prev = prev; + if(prev != null) prev.next = next; - numsegments0 *= splits; - } + if(i != 0 && rand.nextFloat() < splitchance) { + Vector3 splitrot = next.diff.copy().xCrossProduct().rotate(rand.nextFloat() * 360, next.diff); + Vector3 diff = next.diff.copy().rotate((rand.nextFloat() * 0.66F + 0.33F) * splitangle, splitrot).multiply(splitlength); - public void defaultFractal() { - fractal(2, length / 1.5, 0.7F, 0.7F, 45); - fractal(2, length / 4, 0.5F, 0.8F, 50); - fractal(2, length / 15, 0.5F, 0.9F, 55); - fractal(2, length / 30, 0.5F, 1.0F, 60); - fractal(2, length / 60, 0, 0, 0); - fractal(2, length / 100, 0, 0, 0); - fractal(2, length / 400, 0, 0, 0); - } + numsplits++; + splitparents.put(numsplits, next.splitno); - private float rayTraceResistance(Vector3 start, Vector3 end, float prevresistance) { - MovingObjectPosition mop = world.rayTraceBlocks(start.toVec3D(), end.toVec3D()); + Segment split = new Segment(newpoints[i], new BoltPoint(newpoints[i + 1].basepoint, newpoints[i + 1].offsetvec.copy().add(diff)), segment.light / 2F, next.segmentno, numsplits); + split.prev = prev; - if(mop == null) - return prevresistance; + segments.add(split); + } - if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - Block block = world.getBlock(mop.blockX, mop.blockY, mop.blockZ); + prev = next; + segments.add(next); + } - if(world.isAirBlock(mop.blockX, mop.blockY, mop.blockZ)) - return prevresistance; + if(segment.next != null) segment.next.prev = prev; + } - return prevresistance + block.getExplosionResistance(source) + 0.3F; - } else return prevresistance; - } + numsegments0 *= splits; + } - private void calculateCollisionAndDiffs() { - HashMap lastactivesegment = new HashMap(); + public void defaultFractal() { + fractal(2, length / 1.5, 0.7F, 0.7F, 45); + fractal(2, length / 4, 0.5F, 0.8F, 50); + fractal(2, length / 15, 0.5F, 0.9F, 55); + fractal(2, length / 30, 0.5F, 1.0F, 60); + fractal(2, length / 60, 0, 0, 0); + fractal(2, length / 100, 0, 0, 0); + fractal(2, length / 400, 0, 0, 0); + } - Collections.sort(segments, new SegmentSorter()); + private float rayTraceResistance(Vector3 start, Vector3 end, float prevresistance) { + MovingObjectPosition mop = world.rayTraceBlocks(start.toVec3D(), end.toVec3D()); - int lastsplitcalc = 0; - int lastactiveseg = 0;// unterminated - float splitresistance = 0; + if(mop == null) return prevresistance; - for(Segment segment : segments) { - if(segment.splitno > lastsplitcalc) { - lastactivesegment.put(lastsplitcalc, lastactiveseg); - lastsplitcalc = segment.splitno; - lastactiveseg = lastactivesegment.get(splitparents.get(segment.splitno)); - splitresistance = lastactiveseg < segment.segmentno ? 50 : 0; - } + if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + Block block = world.getBlock(mop.blockX, mop.blockY, mop.blockZ); - if(splitresistance >= 40 * segment.light) - continue; + if(world.isAirBlock(mop.blockX, mop.blockY, mop.blockZ)) return prevresistance; - splitresistance = rayTraceResistance(segment.startpoint.point, segment.endpoint.point, splitresistance); - lastactiveseg = segment.segmentno; - } - lastactivesegment.put(lastsplitcalc, lastactiveseg); + return prevresistance + block.getExplosionResistance(source) + 0.3F; + } else return prevresistance; + } - lastsplitcalc = 0; - lastactiveseg = lastactivesegment.get(0); - for(Iterator iterator = segments.iterator(); iterator.hasNext();) { - Segment segment = iterator.next(); - if(lastsplitcalc != segment.splitno) { - lastsplitcalc = segment.splitno; - lastactiveseg = lastactivesegment.get(segment.splitno); - } - - if(segment.segmentno > lastactiveseg) - iterator.remove(); - segment.calcEndDiffs(); - } - } - - public void finalizeBolt() { - if(finalized) - return; - finalized = true; - - calculateCollisionAndDiffs(); - - Collections.sort(segments, new SegmentLightSorter()); - - boltlist.add(this); - } - - public void onUpdate() { - particleAge++; - - if (particleAge >= particleMaxAge) - isDead = true; - } - - // Called in ClientTickHandler - public static void update() { - for(Iterator iterator = boltlist.iterator(); iterator.hasNext();) { - LightningBolt bolt = iterator.next(); - - bolt.onUpdate(); - if(bolt.isDead) - iterator.remove(); - } - } - } + private void calculateCollisionAndDiffs() { + HashMap lastactivesegment = new HashMap(); + + Collections.sort(segments, new SegmentSorter()); + + int lastsplitcalc = 0; + int lastactiveseg = 0;// unterminated + float splitresistance = 0; + + for(Segment segment : segments) { + if(segment.splitno > lastsplitcalc) { + lastactivesegment.put(lastsplitcalc, lastactiveseg); + lastsplitcalc = segment.splitno; + lastactiveseg = lastactivesegment.get(splitparents.get(segment.splitno)); + splitresistance = lastactiveseg < segment.segmentno ? 50 : 0; + } + + if(splitresistance >= 40 * segment.light) continue; + + splitresistance = rayTraceResistance(segment.startpoint.point, segment.endpoint.point, splitresistance); + lastactiveseg = segment.segmentno; + } + lastactivesegment.put(lastsplitcalc, lastactiveseg); + + lastsplitcalc = 0; + lastactiveseg = lastactivesegment.get(0); + for(Iterator iterator = segments.iterator(); iterator.hasNext(); ) { + Segment segment = iterator.next(); + if(lastsplitcalc != segment.splitno) { + lastsplitcalc = segment.splitno; + lastactiveseg = lastactivesegment.get(segment.splitno); + } + + if(segment.segmentno > lastactiveseg) iterator.remove(); + segment.calcEndDiffs(); + } + } + + public void finalizeBolt() { + if(finalized) return; + finalized = true; + + calculateCollisionAndDiffs(); + + Collections.sort(segments, new SegmentLightSorter()); + + boltlist.add(this); + } + + public void onUpdate() { + particleAge++; + + if(particleAge >= particleMaxAge) isDead = true; + } + + // Called in ClientTickHandler + public static void update() { + for(Iterator iterator = boltlist.iterator(); iterator.hasNext(); ) { + LightningBolt bolt = iterator.next(); + + bolt.onUpdate(); + if(bolt.isDead) iterator.remove(); + } + } + } } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/client/core/handler/LocalizationHandler.java b/MODSRC/vazkii/botania/client/core/handler/LocalizationHandler.java index a211da94d..dc695ec4e 100644 --- a/MODSRC/vazkii/botania/client/core/handler/LocalizationHandler.java +++ b/MODSRC/vazkii/botania/client/core/handler/LocalizationHandler.java @@ -2,23 +2,23 @@ * This class was created by . 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 14, 2014, 6:04:31 PM (GMT)] */ package vazkii.botania.client.core.handler; -import vazkii.botania.client.lib.LibResources; import cpw.mods.fml.common.registry.LanguageRegistry; +import vazkii.botania.client.lib.LibResources; public final class LocalizationHandler { - public static void loadLocalizations() { - for(String locale : LibResources.LANGS) - LanguageRegistry.instance().loadLocalization(LibResources.PREFIX_LANG + locale + ".lang", locale, false); - } + public static void loadLocalizations() { + for(String locale : LibResources.LANGS) + LanguageRegistry.instance().loadLocalization(LibResources.PREFIX_LANG + locale + ".lang", locale, false); + } } diff --git a/MODSRC/vazkii/botania/client/core/helper/FontHelper.java b/MODSRC/vazkii/botania/client/core/helper/FontHelper.java index a8000df11..b19a98c4f 100644 --- a/MODSRC/vazkii/botania/client/core/helper/FontHelper.java +++ b/MODSRC/vazkii/botania/client/core/helper/FontHelper.java @@ -2,42 +2,40 @@ * This class was created by . 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 16, 2014, 5:30:52 PM (GMT)] */ package vazkii.botania.client.core.helper; public final class FontHelper { - public static boolean isFormatColor(char par0) { - return par0 >= 48 && par0 <= 57 || par0 >= 97 && par0 <= 102 || par0 >= 65 && par0 <= 70; - } + public static boolean isFormatColor(char par0) { + return par0 >= 48 && par0 <= 57 || par0 >= 97 && par0 <= 102 || par0 >= 65 && par0 <= 70; + } - public static boolean isFormatSpecial(char par0) { - return par0 >= 107 && par0 <= 111 || par0 >= 75 && par0 <= 79 || par0 == 114 || par0 == 82; - } + public static boolean isFormatSpecial(char par0) { + return par0 >= 107 && par0 <= 111 || par0 >= 75 && par0 <= 79 || par0 == 114 || par0 == 82; + } - public static String getFormatFromString(String par0Str) { - String s1 = ""; - int i = -1; - int j = par0Str.length(); + public static String getFormatFromString(String par0Str) { + String s1 = ""; + int i = -1; + int j = par0Str.length(); - while ((i = par0Str.indexOf(167, i + 1)) != -1) { - if (i < j - 1) { - char c0 = par0Str.charAt(i + 1); + while((i = par0Str.indexOf(167, i + 1)) != -1) { + if(i < j - 1) { + char c0 = par0Str.charAt(i + 1); - if (isFormatColor(c0)) - s1 = "\u00a7" + c0; - else if (isFormatSpecial(c0)) - s1 = s1 + "\u00a7" + c0; - } - } + if(isFormatColor(c0)) s1 = "\u00a7" + c0; + else if(isFormatSpecial(c0)) s1 = s1 + "\u00a7" + c0; + } + } - return s1; - } + return s1; + } } diff --git a/MODSRC/vazkii/botania/client/core/helper/IconHelper.java b/MODSRC/vazkii/botania/client/core/helper/IconHelper.java index a0d608c22..53f05e979 100644 --- a/MODSRC/vazkii/botania/client/core/helper/IconHelper.java +++ b/MODSRC/vazkii/botania/client/core/helper/IconHelper.java @@ -2,11 +2,11 @@ * This class was created by . 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 14, 2014, 5:28:21 PM (GMT)] */ package vazkii.botania.client.core.helper; @@ -20,36 +20,36 @@ import vazkii.botania.client.lib.LibResources; public final class IconHelper { - public static IIcon forName(IIconRegister ir, String name) { - return ir.registerIcon(LibResources.PREFIX_MOD + name); - } + public static IIcon forName(IIconRegister ir, String name) { + return ir.registerIcon(LibResources.PREFIX_MOD + name); + } - public static IIcon forNameRaw(IIconRegister ir, String name) { - return ir.registerIcon(name); - } + public static IIcon forNameRaw(IIconRegister ir, String name) { + return ir.registerIcon(name); + } - public static IIcon forBlock(IIconRegister ir, Block block) { - return forNameRaw(ir, block.getUnlocalizedName().replaceAll("tile.", "")); - } + public static IIcon forBlock(IIconRegister ir, Block block) { + return forNameRaw(ir, block.getUnlocalizedName().replaceAll("tile.", "")); + } - public static IIcon forBlock(IIconRegister ir, Block block, int i) { - return forBlock(ir, block, Integer.toString(i)); - } + public static IIcon forBlock(IIconRegister ir, Block block, int i) { + return forBlock(ir, block, Integer.toString(i)); + } - public static IIcon forBlock(IIconRegister ir, Block block, String s) { - return forNameRaw(ir, block.getUnlocalizedName().replaceAll("tile.", "") + s); - } + public static IIcon forBlock(IIconRegister ir, Block block, String s) { + return forNameRaw(ir, block.getUnlocalizedName().replaceAll("tile.", "") + s); + } - public static IIcon forItem(IIconRegister ir, Item item) { - return forNameRaw(ir, item.getUnlocalizedName().replaceAll("item.", "")); - } + public static IIcon forItem(IIconRegister ir, Item item) { + return forNameRaw(ir, item.getUnlocalizedName().replaceAll("item.", "")); + } - public static IIcon forItem(IIconRegister ir, Item item, int i) { - return forItem(ir, item, Integer.toString(i)); - } + public static IIcon forItem(IIconRegister ir, Item item, int i) { + return forItem(ir, item, Integer.toString(i)); + } - public static IIcon forItem(IIconRegister ir, Item item, String s) { - return forNameRaw(ir, item.getUnlocalizedName().replaceAll("item.", "") + s); - } + public static IIcon forItem(IIconRegister ir, Item item, String s) { + return forNameRaw(ir, item.getUnlocalizedName().replaceAll("item.", "") + s); + } } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/client/core/helper/RenderHelper.java b/MODSRC/vazkii/botania/client/core/helper/RenderHelper.java index 5b00e26c1..6d91104b6 100644 --- a/MODSRC/vazkii/botania/client/core/helper/RenderHelper.java +++ b/MODSRC/vazkii/botania/client/core/helper/RenderHelper.java @@ -2,186 +2,178 @@ * This class was created by . 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 19, 2014, 5:40:38 PM (GMT)] */ package vazkii.botania.client.core.helper; -import java.util.List; -import java.util.Random; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.Tessellator; - import org.lwjgl.opengl.GL11; +import java.util.List; +import java.util.Random; + public final class RenderHelper { - public static void renderTooltip(int x, int y, List tooltipData) { - int color = 0x505000ff; - int color2 = 0xf0100010; + public static void renderTooltip(int x, int y, List tooltipData) { + int color = 0x505000ff; + int color2 = 0xf0100010; - renderTooltip(x, y, tooltipData, color, color2); - } + renderTooltip(x, y, tooltipData, color, color2); + } - public static void renderTooltipOrange(int x, int y, List tooltipData) { - int color = 0x50a06600; - int color2 = 0xf01e1200; + public static void renderTooltipOrange(int x, int y, List tooltipData) { + int color = 0x50a06600; + int color2 = 0xf01e1200; - renderTooltip(x, y, tooltipData, color, color2); - } + renderTooltip(x, y, tooltipData, color, color2); + } - public static void renderTooltipGreen(int x, int y, List tooltipData) { - int color = 0x5000a000; - int color2 = 0xf0001e00; + public static void renderTooltipGreen(int x, int y, List tooltipData) { + int color = 0x5000a000; + int color2 = 0xf0001e00; - renderTooltip(x, y, tooltipData, color, color2); - } + renderTooltip(x, y, tooltipData, color, color2); + } - public static void renderTooltip(int x, int y, List tooltipData, int color, int color2) { - boolean lighting = GL11.glGetBoolean(GL11.GL_LIGHTING); - if(lighting) - net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); + public static void renderTooltip(int x, int y, List tooltipData, int color, int color2) { + boolean lighting = GL11.glGetBoolean(GL11.GL_LIGHTING); + if(lighting) net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); - if (!tooltipData.isEmpty()) { - int var5 = 0; - int var6; - int var7; - FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - for (var6 = 0; var6 < tooltipData.size(); ++var6) { - var7 = fontRenderer.getStringWidth(tooltipData.get(var6)); - if (var7 > var5) - var5 = var7; - } - var6 = x + 12; - var7 = y - 12; - int var9 = 8; - if (tooltipData.size() > 1) - var9 += 2 + (tooltipData.size() - 1) * 10; - float z = 300F; - drawGradientRect(var6 - 3, var7 - 4, z, var6 + var5 + 3, var7 - 3, color2, color2); - drawGradientRect(var6 - 3, var7 + var9 + 3, z, var6 + var5 + 3, var7 + var9 + 4, color2, color2); - drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 + var9 + 3, color2, color2); - drawGradientRect(var6 - 4, var7 - 3, z, var6 - 3, var7 + var9 + 3, color2, color2); - drawGradientRect(var6 + var5 + 3, var7 - 3, z, var6 + var5 + 4, var7 + var9 + 3, color2, color2); - int var12 = (color & 0xFFFFFF) >> 1 | color & -16777216; - drawGradientRect(var6 - 3, var7 - 3 + 1, z, var6 - 3 + 1, var7 + var9 + 3 - 1, color, var12); - drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, z, var6 + var5 + 3, var7 + var9 + 3 - 1, color, var12); - drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 - 3 + 1, color, color); - drawGradientRect(var6 - 3, var7 + var9 + 2, z, var6 + var5 + 3, var7 + var9 + 3, var12, var12); + if(!tooltipData.isEmpty()) { + int var5 = 0; + int var6; + int var7; + FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; + for(var6 = 0; var6 < tooltipData.size(); ++var6) { + var7 = fontRenderer.getStringWidth(tooltipData.get(var6)); + if(var7 > var5) var5 = var7; + } + var6 = x + 12; + var7 = y - 12; + int var9 = 8; + if(tooltipData.size() > 1) var9 += 2 + (tooltipData.size() - 1) * 10; + float z = 300F; + drawGradientRect(var6 - 3, var7 - 4, z, var6 + var5 + 3, var7 - 3, color2, color2); + drawGradientRect(var6 - 3, var7 + var9 + 3, z, var6 + var5 + 3, var7 + var9 + 4, color2, color2); + drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 + var9 + 3, color2, color2); + drawGradientRect(var6 - 4, var7 - 3, z, var6 - 3, var7 + var9 + 3, color2, color2); + drawGradientRect(var6 + var5 + 3, var7 - 3, z, var6 + var5 + 4, var7 + var9 + 3, color2, color2); + int var12 = (color & 0xFFFFFF) >> 1 | color & -16777216; + drawGradientRect(var6 - 3, var7 - 3 + 1, z, var6 - 3 + 1, var7 + var9 + 3 - 1, color, var12); + drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, z, var6 + var5 + 3, var7 + var9 + 3 - 1, color, var12); + drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 - 3 + 1, color, color); + drawGradientRect(var6 - 3, var7 + var9 + 2, z, var6 + var5 + 3, var7 + var9 + 3, var12, var12); - GL11.glDisable(GL11.GL_DEPTH_TEST); - for (int var13 = 0; var13 < tooltipData.size(); ++var13) { - String var14 = tooltipData.get(var13); - fontRenderer.drawStringWithShadow(var14, var6, var7, -1); - if (var13 == 0) - var7 += 2; - var7 += 10; - } - GL11.glEnable(GL11.GL_DEPTH_TEST); - } - if(!lighting) - net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); - GL11.glColor4f(1F, 1F, 1F, 1F); - } + GL11.glDisable(GL11.GL_DEPTH_TEST); + for(int var13 = 0; var13 < tooltipData.size(); ++var13) { + String var14 = tooltipData.get(var13); + fontRenderer.drawStringWithShadow(var14, var6, var7, -1); + if(var13 == 0) var7 += 2; + var7 += 10; + } + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + if(!lighting) net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); + GL11.glColor4f(1F, 1F, 1F, 1F); + } - public static void drawGradientRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) { - float var7 = (par5 >> 24 & 255) / 255F; - float var8 = (par5 >> 16 & 255) / 255F; - float var9 = (par5 >> 8 & 255) / 255F; - float var10 = (par5 & 255) / 255F; - float var11 = (par6 >> 24 & 255) / 255F; - float var12 = (par6 >> 16 & 255) / 255F; - float var13 = (par6 >> 8 & 255) / 255F; - float var14 = (par6 & 255) / 255F; - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glShadeModel(GL11.GL_SMOOTH); - Tessellator var15 = Tessellator.instance; - var15.startDrawingQuads(); - var15.setColorRGBA_F(var8, var9, var10, var7); - var15.addVertex(par3, par2, z); - var15.addVertex(par1, par2, z); - var15.setColorRGBA_F(var12, var13, var14, var11); - var15.addVertex(par1, par4, z); - var15.addVertex(par3, par4, z); - var15.draw(); - GL11.glShadeModel(GL11.GL_FLAT); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_TEXTURE_2D); - } + public static void drawGradientRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) { + float var7 = (par5 >> 24 & 255) / 255F; + float var8 = (par5 >> 16 & 255) / 255F; + float var9 = (par5 >> 8 & 255) / 255F; + float var10 = (par5 & 255) / 255F; + float var11 = (par6 >> 24 & 255) / 255F; + float var12 = (par6 >> 16 & 255) / 255F; + float var13 = (par6 >> 8 & 255) / 255F; + float var14 = (par6 & 255) / 255F; + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glShadeModel(GL11.GL_SMOOTH); + Tessellator var15 = Tessellator.instance; + var15.startDrawingQuads(); + var15.setColorRGBA_F(var8, var9, var10, var7); + var15.addVertex(par3, par2, z); + var15.addVertex(par1, par2, z); + var15.setColorRGBA_F(var12, var13, var14, var11); + var15.addVertex(par1, par4, z); + var15.addVertex(par3, par4, z); + var15.draw(); + GL11.glShadeModel(GL11.GL_FLAT); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } - public static void drawTexturedModalRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) { - float f = 0.00390625F; - float f1 = 0.00390625F; - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(par1 + 0, par2 + par6, z, (par3 + 0) * f, (par4 + par6) * f1); - tessellator.addVertexWithUV(par1 + par5, par2 + par6, z, (par3 + par5) * f, (par4 + par6) * f1); - tessellator.addVertexWithUV(par1 + par5, par2 + 0, z, (par3 + par5) * f, (par4 + 0) * f1); - tessellator.addVertexWithUV(par1 + 0, par2 + 0, z, (par3 + 0) * f, (par4 + 0) * f1); - tessellator.draw(); - } + public static void drawTexturedModalRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) { + float f = 0.00390625F; + float f1 = 0.00390625F; + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(par1 + 0, par2 + par6, z, (par3 + 0) * f, (par4 + par6) * f1); + tessellator.addVertexWithUV(par1 + par5, par2 + par6, z, (par3 + par5) * f, (par4 + par6) * f1); + tessellator.addVertexWithUV(par1 + par5, par2 + 0, z, (par3 + par5) * f, (par4 + 0) * f1); + tessellator.addVertexWithUV(par1 + 0, par2 + 0, z, (par3 + 0) * f, (par4 + 0) * f1); + tessellator.draw(); + } - public static void renderStar(int color, float xScale, float yScale, float zScale, long seed) { - Tessellator tessellator = Tessellator.instance; + public static void renderStar(int color, float xScale, float yScale, float zScale, long seed) { + Tessellator tessellator = Tessellator.instance; - int ticks = (int) (Minecraft.getMinecraft().theWorld.getTotalWorldTime() % 200); - if (ticks >= 100) - ticks = 200 - ticks - 1; + int ticks = (int) (Minecraft.getMinecraft().theWorld.getTotalWorldTime() % 200); + if(ticks >= 100) ticks = 200 - ticks - 1; - float f1 = ticks / 200F; - float f2 = 0F; - if (f1 > 0.7F) - f2 = (f1 - 0.7F) / 0.2F; - Random random = new Random(seed); + float f1 = ticks / 200F; + float f2 = 0F; + if(f1 > 0.7F) f2 = (f1 - 0.7F) / 0.2F; + Random random = new Random(seed); - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glShadeModel(GL11.GL_SMOOTH); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(770, 1); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDepthMask(false); - GL11.glTranslatef(0F, -1F, -2F); - GL11.glScalef(xScale, yScale, zScale); + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glShadeModel(GL11.GL_SMOOTH); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(770, 1); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glDepthMask(false); + GL11.glTranslatef(0F, -1F, -2F); + GL11.glScalef(xScale, yScale, zScale); - for (int i = 0; i < (f1 + f1 * f1) / 2F * 90F + 30F; i++) { - GL11.glRotatef(random.nextFloat() * 360F, 1F, 0F, 0F); - GL11.glRotatef(random.nextFloat() * 360F, 0F, 1F, 0F); - GL11.glRotatef(random.nextFloat() * 360F, 0F, 0F, 1F); - GL11.glRotatef(random.nextFloat() * 360F, 1F, 0F, 0F); - GL11.glRotatef(random.nextFloat() * 360F, 0F, 1F, 0F); - GL11.glRotatef(random.nextFloat() * 360F + f1 * 90F, 0F, 0F, 1F); - tessellator.startDrawing(GL11.GL_TRIANGLE_FAN); - float f3 = random.nextFloat() * 20F + 5F + f2 * 10F; - float f4 = random.nextFloat() * 2F + 1F + f2 * 2F; - tessellator.setColorRGBA_I(color, (int) (255F * (1F - f2))); - tessellator.addVertex(0, 0, 0); - tessellator.setColorRGBA_F(0F, 0F, 0F, 0); - tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4); - tessellator.addVertex(0.866D * f4, f3, -0.5F * f4); - tessellator.addVertex(0, f3, 1F * f4); - tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4); - tessellator.draw(); - } + for(int i = 0; i < (f1 + f1 * f1) / 2F * 90F + 30F; i++) { + GL11.glRotatef(random.nextFloat() * 360F, 1F, 0F, 0F); + GL11.glRotatef(random.nextFloat() * 360F, 0F, 1F, 0F); + GL11.glRotatef(random.nextFloat() * 360F, 0F, 0F, 1F); + GL11.glRotatef(random.nextFloat() * 360F, 1F, 0F, 0F); + GL11.glRotatef(random.nextFloat() * 360F, 0F, 1F, 0F); + GL11.glRotatef(random.nextFloat() * 360F + f1 * 90F, 0F, 0F, 1F); + tessellator.startDrawing(GL11.GL_TRIANGLE_FAN); + float f3 = random.nextFloat() * 20F + 5F + f2 * 10F; + float f4 = random.nextFloat() * 2F + 1F + f2 * 2F; + tessellator.setColorRGBA_I(color, (int) (255F * (1F - f2))); + tessellator.addVertex(0, 0, 0); + tessellator.setColorRGBA_F(0F, 0F, 0F, 0); + tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4); + tessellator.addVertex(0.866D * f4, f3, -0.5F * f4); + tessellator.addVertex(0, f3, 1F * f4); + tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4); + tessellator.draw(); + } - GL11.glDepthMask(true); - GL11.glDisable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_BLEND); - GL11.glShadeModel(GL11.GL_FLAT); - GL11.glColor4f(1F, 1F, 1F, 1F); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glPopMatrix(); - } + GL11.glDepthMask(true); + GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glDisable(GL11.GL_BLEND); + GL11.glShadeModel(GL11.GL_FLAT); + GL11.glColor4f(1F, 1F, 1F, 1F); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glPopMatrix(); + } } diff --git a/MODSRC/vazkii/botania/client/core/helper/ShaderHelper.java b/MODSRC/vazkii/botania/client/core/helper/ShaderHelper.java index 7b5769a61..8d628e8a1 100644 --- a/MODSRC/vazkii/botania/client/core/helper/ShaderHelper.java +++ b/MODSRC/vazkii/botania/client/core/helper/ShaderHelper.java @@ -2,178 +2,160 @@ * This class was created by . 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 @ [Apr 9, 2014, 11:20:26 PM (GMT)] */ package vazkii.botania.client.core.helper; -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; - +import cpw.mods.fml.common.FMLLog; import net.minecraft.client.renderer.OpenGlHelper; - import org.apache.logging.log4j.Level; import org.lwjgl.opengl.ARBFragmentShader; import org.lwjgl.opengl.ARBShaderObjects; import org.lwjgl.opengl.ARBVertexShader; import org.lwjgl.opengl.GL11; - import vazkii.botania.client.core.handler.ClientTickHandler; import vazkii.botania.client.lib.LibResources; import vazkii.botania.common.core.handler.ConfigHandler; -import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; public final class ShaderHelper { - private static final int VERT = ARBVertexShader.GL_VERTEX_SHADER_ARB; - private static final int FRAG = ARBFragmentShader.GL_FRAGMENT_SHADER_ARB; + private static final int VERT = ARBVertexShader.GL_VERTEX_SHADER_ARB; + private static final int FRAG = ARBFragmentShader.GL_FRAGMENT_SHADER_ARB; - public static int pylonGlow = 0; - public static int enchanterRune = 0; - public static int manaPool = 0; + public static int pylonGlow = 0; + public static int enchanterRune = 0; + public static int manaPool = 0; - public static void initShaders() { - if(!useShaders()) - return; - - pylonGlow = createProgram(null, LibResources.SHADER_PYLON_GLOW_FRAG); - enchanterRune = createProgram(null, LibResources.SHADER_ENCHANTER_RUNE_FRAG); - manaPool = createProgram(null, LibResources.SHADER_MANA_POOL_FRAG); - } + public static void initShaders() { + if(!useShaders()) return; - public static void useShader(int shader) { - if(!useShaders()) - return; - - ARBShaderObjects.glUseProgramObjectARB(shader); - - if(shader != 0) { - int time = ARBShaderObjects.glGetUniformLocationARB(shader, "time"); - ARBShaderObjects.glUniform1iARB(time, ClientTickHandler.ticksInGame); - } - } + pylonGlow = createProgram(null, LibResources.SHADER_PYLON_GLOW_FRAG); + enchanterRune = createProgram(null, LibResources.SHADER_ENCHANTER_RUNE_FRAG); + manaPool = createProgram(null, LibResources.SHADER_MANA_POOL_FRAG); + } - public static void releaseShader() { - useShader(0); - } - - public static boolean useShaders() { - return ConfigHandler.useShaders && OpenGlHelper.shadersSupported; - } - - // Most of the code taken from the LWJGL wiki - // http://lwjgl.org/wiki/index.php?title=GLSL_Shaders_with_LWJGL + public static void useShader(int shader) { + if(!useShaders()) return; - private static int createProgram(String vert, String frag) { - int vertId = 0, fragId = 0, program = 0; - if(vert != null) - vertId = createShader(vert, VERT); - if(frag != null) - fragId = createShader(frag, FRAG); + ARBShaderObjects.glUseProgramObjectARB(shader); - program = ARBShaderObjects.glCreateProgramObjectARB(); - if(program == 0) - return 0; + if(shader != 0) { + int time = ARBShaderObjects.glGetUniformLocationARB(shader, "time"); + ARBShaderObjects.glUniform1iARB(time, ClientTickHandler.ticksInGame); + } + } - if(vert != null) - ARBShaderObjects.glAttachObjectARB(program, vertId); - if(frag != null) - ARBShaderObjects.glAttachObjectARB(program, fragId); + public static void releaseShader() { + useShader(0); + } - ARBShaderObjects.glLinkProgramARB(program); - if(ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) { - FMLLog.log(Level.ERROR, getLogInfo(program)); - return 0; - } - - ARBShaderObjects.glValidateProgramARB(program); - if (ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) { - FMLLog.log(Level.ERROR, getLogInfo(program)); - return 0; - } - - return program; - } + public static boolean useShaders() { + return ConfigHandler.useShaders && OpenGlHelper.shadersSupported; + } - private static int createShader(String filename, int shaderType){ - int shader = 0; - try { - shader = ARBShaderObjects.glCreateShaderObjectARB(shaderType); + // Most of the code taken from the LWJGL wiki + // http://lwjgl.org/wiki/index.php?title=GLSL_Shaders_with_LWJGL - if(shader == 0) - return 0; + private static int createProgram(String vert, String frag) { + int vertId = 0, fragId = 0, program = 0; + if(vert != null) vertId = createShader(vert, VERT); + if(frag != null) fragId = createShader(frag, FRAG); - ARBShaderObjects.glShaderSourceARB(shader, readFileAsString(filename)); - ARBShaderObjects.glCompileShaderARB(shader); + program = ARBShaderObjects.glCreateProgramObjectARB(); + if(program == 0) return 0; - if (ARBShaderObjects.glGetObjectParameteriARB(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE) - throw new RuntimeException("Error creating shader: " + getLogInfo(shader)); + if(vert != null) ARBShaderObjects.glAttachObjectARB(program, vertId); + if(frag != null) ARBShaderObjects.glAttachObjectARB(program, fragId); - return shader; - } - catch(Exception e) { - ARBShaderObjects.glDeleteObjectARB(shader); - e.printStackTrace(); - return -1; - } - } + ARBShaderObjects.glLinkProgramARB(program); + if(ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) { + FMLLog.log(Level.ERROR, getLogInfo(program)); + return 0; + } - private static String getLogInfo(int obj) { - return ARBShaderObjects.glGetInfoLogARB(obj, ARBShaderObjects.glGetObjectParameteriARB(obj, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB)); - } + ARBShaderObjects.glValidateProgramARB(program); + if(ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) { + FMLLog.log(Level.ERROR, getLogInfo(program)); + return 0; + } - private static String readFileAsString(String filename) throws Exception { - StringBuilder source = new StringBuilder(); - InputStream in = ShaderHelper.class.getResourceAsStream(filename); - Exception exception = null; - BufferedReader reader; + return program; + } - if(in == null) - return ""; - - try { - reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); + private static int createShader(String filename, int shaderType) { + int shader = 0; + try { + shader = ARBShaderObjects.glCreateShaderObjectARB(shaderType); - Exception innerExc= null; - try { - String line; - while((line = reader.readLine()) != null) - source.append(line).append('\n'); - } catch(Exception exc) { - exception = exc; - } finally { - try { - reader.close(); - } catch(Exception exc) { - if(innerExc == null) - innerExc = exc; - else exc.printStackTrace(); - } - } + if(shader == 0) return 0; - if(innerExc != null) - throw innerExc; - } catch(Exception exc) { - exception = exc; - } finally { - try { - in.close(); - } catch(Exception exc) { - if(exception == null) - exception = exc; - else exc.printStackTrace(); - } + ARBShaderObjects.glShaderSourceARB(shader, readFileAsString(filename)); + ARBShaderObjects.glCompileShaderARB(shader); - if(exception != null) - throw exception; - } + if(ARBShaderObjects.glGetObjectParameteriARB(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE) + throw new RuntimeException("Error creating shader: " + getLogInfo(shader)); - return source.toString(); - } + return shader; + } catch(Exception e) { + ARBShaderObjects.glDeleteObjectARB(shader); + e.printStackTrace(); + return -1; + } + } + + private static String getLogInfo(int obj) { + return ARBShaderObjects.glGetInfoLogARB(obj, ARBShaderObjects.glGetObjectParameteriARB(obj, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB)); + } + + private static String readFileAsString(String filename) throws Exception { + StringBuilder source = new StringBuilder(); + InputStream in = ShaderHelper.class.getResourceAsStream(filename); + Exception exception = null; + BufferedReader reader; + + if(in == null) return ""; + + try { + reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); + + Exception innerExc = null; + try { + String line; + while((line = reader.readLine()) != null) source.append(line).append('\n'); + } catch(Exception exc) { + exception = exc; + } finally { + try { + reader.close(); + } catch(Exception exc) { + if(innerExc == null) innerExc = exc; + else exc.printStackTrace(); + } + } + + if(innerExc != null) throw innerExc; + } catch(Exception exc) { + exception = exc; + } finally { + try { + in.close(); + } catch(Exception exc) { + if(exception == null) exception = exc; + else exc.printStackTrace(); + } + + if(exception != null) throw exception; + } + + return source.toString(); + } } diff --git a/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java b/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java index 823b9bafd..0f5ae2305 100644 --- a/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java +++ b/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java @@ -2,25 +2,25 @@ * This class was created by . 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 13, 2014, 7:46:05 PM (GMT)] */ package vazkii.botania.client.core.proxy; +import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.event.FMLInitializationEvent; import net.minecraft.client.Minecraft; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.MinecraftForge; import vazkii.botania.api.lexicon.LexiconEntry; -import vazkii.botania.client.core.handler.BoundTileRenderer; -import vazkii.botania.client.core.handler.CapeHandler; -import vazkii.botania.client.core.handler.ClientTickHandler; -import vazkii.botania.client.core.handler.HUDHandler; -import vazkii.botania.client.core.handler.LightningHandler; +import vazkii.botania.client.core.handler.*; import vazkii.botania.client.core.helper.ShaderHelper; import vazkii.botania.client.fx.FXSparkle; import vazkii.botania.client.fx.FXWisp; @@ -28,114 +28,94 @@ import vazkii.botania.client.gui.GuiLexicon; import vazkii.botania.client.gui.GuiLexiconEntry; import vazkii.botania.client.gui.GuiLexiconIndex; import vazkii.botania.client.lib.LibRenderIDs; -import vazkii.botania.client.render.block.RenderAltar; -import vazkii.botania.client.render.block.RenderPool; -import vazkii.botania.client.render.block.RenderPylon; -import vazkii.botania.client.render.block.RenderSpecialFlower; -import vazkii.botania.client.render.block.RenderSpreader; +import vazkii.botania.client.render.block.*; import vazkii.botania.client.render.item.RenderLens; import vazkii.botania.client.render.item.RenderLexicon; -import vazkii.botania.client.render.tile.RenderTileAltar; -import vazkii.botania.client.render.tile.RenderTileEnchanter; -import vazkii.botania.client.render.tile.RenderTilePool; -import vazkii.botania.client.render.tile.RenderTilePylon; -import vazkii.botania.client.render.tile.RenderTileRuneAltar; -import vazkii.botania.client.render.tile.RenderTileSpreader; -import vazkii.botania.common.block.tile.TileAltar; -import vazkii.botania.common.block.tile.TileEnchanter; -import vazkii.botania.common.block.tile.TilePool; -import vazkii.botania.common.block.tile.TilePylon; -import vazkii.botania.common.block.tile.TileRuneAltar; -import vazkii.botania.common.block.tile.TileSpreader; +import vazkii.botania.client.render.tile.*; +import vazkii.botania.common.block.tile.*; import vazkii.botania.common.core.handler.ConfigHandler; import vazkii.botania.common.core.helper.Vector3; import vazkii.botania.common.core.proxy.CommonProxy; import vazkii.botania.common.item.ModItems; -import cpw.mods.fml.client.registry.ClientRegistry; -import cpw.mods.fml.client.registry.RenderingRegistry; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.relauncher.Side; public class ClientProxy extends CommonProxy { - @Override - public void init(FMLInitializationEvent event) { - super.init(event); + @Override + public void init(FMLInitializationEvent event) { + super.init(event); - FMLCommonHandler.instance().bus().register(new ClientTickHandler()); - MinecraftForge.EVENT_BUS.register(new HUDHandler()); - MinecraftForge.EVENT_BUS.register(new LightningHandler()); - MinecraftForge.EVENT_BUS.register(new CapeHandler()); - if(ConfigHandler.boundBlockWireframe) - MinecraftForge.EVENT_BUS.register(new BoundTileRenderer()); + FMLCommonHandler.instance().bus().register(new ClientTickHandler()); + MinecraftForge.EVENT_BUS.register(new HUDHandler()); + MinecraftForge.EVENT_BUS.register(new LightningHandler()); + MinecraftForge.EVENT_BUS.register(new CapeHandler()); + if(ConfigHandler.boundBlockWireframe) MinecraftForge.EVENT_BUS.register(new BoundTileRenderer()); - initRenderers(); - } + initRenderers(); + } - private void initRenderers() { - LibRenderIDs.idAltar = RenderingRegistry.getNextAvailableRenderId(); - LibRenderIDs.idSpecialFlower = RenderingRegistry.getNextAvailableRenderId(); - LibRenderIDs.idSpreader = RenderingRegistry.getNextAvailableRenderId(); - LibRenderIDs.idPool = RenderingRegistry.getNextAvailableRenderId(); - LibRenderIDs.idPylon = RenderingRegistry.getNextAvailableRenderId(); + private void initRenderers() { + LibRenderIDs.idAltar = RenderingRegistry.getNextAvailableRenderId(); + LibRenderIDs.idSpecialFlower = RenderingRegistry.getNextAvailableRenderId(); + LibRenderIDs.idSpreader = RenderingRegistry.getNextAvailableRenderId(); + LibRenderIDs.idPool = RenderingRegistry.getNextAvailableRenderId(); + LibRenderIDs.idPylon = RenderingRegistry.getNextAvailableRenderId(); - RenderingRegistry.registerBlockHandler(new RenderAltar()); - RenderingRegistry.registerBlockHandler(new RenderSpecialFlower(LibRenderIDs.idSpecialFlower)); - RenderingRegistry.registerBlockHandler(new RenderSpreader()); - RenderingRegistry.registerBlockHandler(new RenderPool()); - RenderingRegistry.registerBlockHandler(new RenderPylon()); + RenderingRegistry.registerBlockHandler(new RenderAltar()); + RenderingRegistry.registerBlockHandler(new RenderSpecialFlower(LibRenderIDs.idSpecialFlower)); + RenderingRegistry.registerBlockHandler(new RenderSpreader()); + RenderingRegistry.registerBlockHandler(new RenderPool()); + RenderingRegistry.registerBlockHandler(new RenderPylon()); - MinecraftForgeClient.registerItemRenderer(ModItems.lens, new RenderLens()); - if(ConfigHandler.lexicon3dModel) - MinecraftForgeClient.registerItemRenderer(ModItems.lexicon, new RenderLexicon()); + MinecraftForgeClient.registerItemRenderer(ModItems.lens, new RenderLens()); + if(ConfigHandler.lexicon3dModel) + MinecraftForgeClient.registerItemRenderer(ModItems.lexicon, new RenderLexicon()); - ClientRegistry.bindTileEntitySpecialRenderer(TileAltar.class, new RenderTileAltar()); - ClientRegistry.bindTileEntitySpecialRenderer(TileSpreader.class, new RenderTileSpreader()); - ClientRegistry.bindTileEntitySpecialRenderer(TilePool.class, new RenderTilePool()); - ClientRegistry.bindTileEntitySpecialRenderer(TileRuneAltar.class, new RenderTileRuneAltar()); - ClientRegistry.bindTileEntitySpecialRenderer(TilePylon.class, new RenderTilePylon()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEnchanter.class, new RenderTileEnchanter()); - - ShaderHelper.initShaders(); - } + ClientRegistry.bindTileEntitySpecialRenderer(TileAltar.class, new RenderTileAltar()); + ClientRegistry.bindTileEntitySpecialRenderer(TileSpreader.class, new RenderTileSpreader()); + ClientRegistry.bindTileEntitySpecialRenderer(TilePool.class, new RenderTilePool()); + ClientRegistry.bindTileEntitySpecialRenderer(TileRuneAltar.class, new RenderTileRuneAltar()); + ClientRegistry.bindTileEntitySpecialRenderer(TilePylon.class, new RenderTilePylon()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEnchanter.class, new RenderTileEnchanter()); - @Override - public void setEntryToOpen(LexiconEntry entry) { - GuiLexicon.currentOpenLexicon = new GuiLexiconEntry(entry, new GuiLexiconIndex(entry.category)); - } + ShaderHelper.initShaders(); + } - @Override - public long getWorldElapsedTicks() { - return Minecraft.getMinecraft().theWorld == null ? 0 : Minecraft.getMinecraft().theWorld.getTotalWorldTime(); - } + @Override + public void setEntryToOpen(LexiconEntry entry) { + GuiLexicon.currentOpenLexicon = new GuiLexiconEntry(entry, new GuiLexiconIndex(entry.category)); + } - @Override - public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) { - FXSparkle sparkle = new FXSparkle(world, x, y, z, size, r, g, b, m); - sparkle.fake = sparkle.noClip = fake; - Minecraft.getMinecraft().effectRenderer.addEffect(sparkle); - } + @Override + public long getWorldElapsedTicks() { + return Minecraft.getMinecraft().theWorld == null ? 0 : Minecraft.getMinecraft().theWorld.getTotalWorldTime(); + } - private static boolean distanceLimit = true; + @Override + public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) { + FXSparkle sparkle = new FXSparkle(world, x, y, z, size, r, g, b, m); + sparkle.fake = sparkle.noClip = fake; + Minecraft.getMinecraft().effectRenderer.addEffect(sparkle); + } - @Override - public void setWispFXDistanceLimit(boolean limit) { - distanceLimit = limit; - } + private static boolean distanceLimit = true; - @Override - public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz, float maxAgeMul) { - FXWisp wisp = new FXWisp(world, x, y, z, size, r, g, b, distanceLimit, maxAgeMul); - wisp.motionX = motionx; - wisp.motionY = motiony; - wisp.motionZ = motionz; + @Override + public void setWispFXDistanceLimit(boolean limit) { + distanceLimit = limit; + } - Minecraft.getMinecraft().effectRenderer.addEffect(wisp); - } + @Override + public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz, float maxAgeMul) { + FXWisp wisp = new FXWisp(world, x, y, z, size, r, g, b, distanceLimit, maxAgeMul); + wisp.motionX = motionx; + wisp.motionY = motiony; + wisp.motionZ = motionz; - @Override - public void lightningFX(World world, Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) { - LightningHandler.spawnLightningBolt(world, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner); - } + Minecraft.getMinecraft().effectRenderer.addEffect(wisp); + } + + @Override + public void lightningFX(World world, Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) { + LightningHandler.spawnLightningBolt(world, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner); + } } diff --git a/MODSRC/vazkii/botania/client/fx/FXSparkle.java b/MODSRC/vazkii/botania/client/fx/FXSparkle.java index 87185bd0b..4a583f209 100644 --- a/MODSRC/vazkii/botania/client/fx/FXSparkle.java +++ b/MODSRC/vazkii/botania/client/fx/FXSparkle.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [? (GMT)] */ package vazkii.botania.client.fx; @@ -17,206 +17,201 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; - import org.lwjgl.opengl.GL11; - import vazkii.botania.client.lib.LibResources; import vazkii.botania.common.core.helper.ObfuscationHelper; public class FXSparkle extends EntityFX { - public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_PARTICLES); + public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_PARTICLES); - public FXSparkle(World world, double x, double y, double z, float size, float red, float green, float blue, int m) { - super(world, x, y, z, 0.0D, 0.0D, 0.0D); + public FXSparkle(World world, double x, double y, double z, float size, float red, float green, float blue, int m) { + super(world, x, y, z, 0.0D, 0.0D, 0.0D); - particleRed = red; - particleGreen = green; - particleBlue = blue; - particleGravity = 0; - motionX = motionY = motionZ = 0; - particleScale *= size; - particleMaxAge = 3 * m; - multiplier = m; - noClip = false; - setSize(0.01F, 0.01F); - prevPosX = posX; - prevPosY = posY; - prevPosZ = posZ; - } + particleRed = red; + particleGreen = green; + particleBlue = blue; + particleGravity = 0; + motionX = motionY = motionZ = 0; + particleScale *= size; + particleMaxAge = 3 * m; + multiplier = m; + noClip = false; + setSize(0.01F, 0.01F); + prevPosX = posX; + prevPosY = posY; + prevPosZ = posZ; + } - @Override - public void renderParticle(Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5) { - tessellator.draw(); - GL11.glPushMatrix(); + @Override + public void renderParticle(Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5) { + tessellator.draw(); + GL11.glPushMatrix(); - GL11.glDepthMask(false); - GL11.glEnable(3042); - GL11.glBlendFunc(770, blendmode); + GL11.glDepthMask(false); + GL11.glEnable(3042); + GL11.glBlendFunc(770, blendmode); - Minecraft.getMinecraft().renderEngine.bindTexture(particles); + Minecraft.getMinecraft().renderEngine.bindTexture(particles); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); - int part = particle + particleAge/multiplier; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); + int part = particle + particleAge / multiplier; - float var8 = part % 8 / 8.0F; - float var9 = var8 + 0.0624375F*2; - float var10 = part / 8 / 8.0F; - float var11 = var10 + 0.0624375F*2; - float var12 = 0.1F * particleScale; - if (shrink) var12 *= (particleMaxAge-particleAge+1)/(float)particleMaxAge; - float var13 = (float)(prevPosX + (posX - prevPosX) * f - interpPosX); - float var14 = (float)(prevPosY + (posY - prevPosY) * f - interpPosY); - float var15 = (float)(prevPosZ + (posZ - prevPosZ) * f - interpPosZ); - float var16 = 1.0F; + float var8 = part % 8 / 8.0F; + float var9 = var8 + 0.0624375F * 2; + float var10 = part / 8 / 8.0F; + float var11 = var10 + 0.0624375F * 2; + float var12 = 0.1F * particleScale; + if(shrink) var12 *= (particleMaxAge - particleAge + 1) / (float) particleMaxAge; + float var13 = (float) (prevPosX + (posX - prevPosX) * f - interpPosX); + float var14 = (float) (prevPosY + (posY - prevPosY) * f - interpPosY); + float var15 = (float) (prevPosZ + (posZ - prevPosZ) * f - interpPosZ); + float var16 = 1.0F; - tessellator.startDrawingQuads(); - tessellator.setBrightness(0x0000f0); + tessellator.startDrawingQuads(); + tessellator.setBrightness(0x0000f0); - tessellator.setColorRGBA_F(particleRed * var16, particleGreen * var16, particleBlue * var16, 1); - tessellator.addVertexWithUV(var13 - f1 * var12 - f4 * var12, var14 - f2 * var12, var15 - f3 * var12 - f5 * var12, var9, var11); - tessellator.addVertexWithUV(var13 - f1 * var12 + f4 * var12, var14 + f2 * var12, var15 - f3 * var12 + f5 * var12, var9, var10); - tessellator.addVertexWithUV(var13 + f1 * var12 + f4 * var12, var14 + f2 * var12, var15 + f3 * var12 + f5 * var12, var8, var10); - tessellator.addVertexWithUV(var13 + f1 * var12 - f4 * var12, var14 - f2 * var12, var15 + f3 * var12 - f5 * var12, var8, var11); + tessellator.setColorRGBA_F(particleRed * var16, particleGreen * var16, particleBlue * var16, 1); + tessellator.addVertexWithUV(var13 - f1 * var12 - f4 * var12, var14 - f2 * var12, var15 - f3 * var12 - f5 * var12, var9, var11); + tessellator.addVertexWithUV(var13 - f1 * var12 + f4 * var12, var14 + f2 * var12, var15 - f3 * var12 + f5 * var12, var9, var10); + tessellator.addVertexWithUV(var13 + f1 * var12 + f4 * var12, var14 + f2 * var12, var15 + f3 * var12 + f5 * var12, var8, var10); + tessellator.addVertexWithUV(var13 + f1 * var12 - f4 * var12, var14 - f2 * var12, var15 + f3 * var12 - f5 * var12, var8, var11); - tessellator.draw(); + tessellator.draw(); - GL11.glDisable(3042); - GL11.glDepthMask(true); + GL11.glDisable(3042); + GL11.glDepthMask(true); - GL11.glPopMatrix(); - Minecraft.getMinecraft().renderEngine.bindTexture(ObfuscationHelper.getParticleTexture()); - tessellator.startDrawingQuads(); - } + GL11.glPopMatrix(); + Minecraft.getMinecraft().renderEngine.bindTexture(ObfuscationHelper.getParticleTexture()); + tessellator.startDrawingQuads(); + } - @Override - public void onUpdate() { - prevPosX = posX; - prevPosY = posY; - prevPosZ = posZ; + @Override + public void onUpdate() { + prevPosX = posX; + prevPosY = posY; + prevPosZ = posZ; - if (particleAge++ >= particleMaxAge) - setDead(); + if(particleAge++ >= particleMaxAge) setDead(); - motionY -= 0.04D * particleGravity; + motionY -= 0.04D * particleGravity; - if (!noClip && !fake) - pushOutOfBlocks(posX, (boundingBox.minY + boundingBox.maxY) / 2.0D, posZ); + if(!noClip && !fake) pushOutOfBlocks(posX, (boundingBox.minY + boundingBox.maxY) / 2.0D, posZ); - posX += motionX; - posY += motionY; - posZ += motionZ; + posX += motionX; + posY += motionY; + posZ += motionZ; - if (slowdown) { - motionX *= 0.908000001907348633D; - motionY *= 0.908000001907348633D; - motionZ *= 0.908000001907348633D; + if(slowdown) { + motionX *= 0.908000001907348633D; + motionY *= 0.908000001907348633D; + motionZ *= 0.908000001907348633D; - if (onGround) { - motionX *= 0.69999998807907104D; - motionZ *= 0.69999998807907104D; - } - } + if(onGround) { + motionX *= 0.69999998807907104D; + motionZ *= 0.69999998807907104D; + } + } - if(fake && particleAge > 1) - setDead(); - } + if(fake && particleAge > 1) setDead(); + } - public void setGravity(float value) { - particleGravity = value; - } + public void setGravity(float value) { + particleGravity = value; + } - protected boolean pushOutOfBlocks(double par1, double par3, double par5) { - int var7 = MathHelper.floor_double(par1); - int var8 = MathHelper.floor_double(par3); - int var9 = MathHelper.floor_double(par5); - double var10 = par1 - var7; - double var12 = par3 - var8; - double var14 = par5 - var9; + protected boolean pushOutOfBlocks(double par1, double par3, double par5) { + int var7 = MathHelper.floor_double(par1); + int var8 = MathHelper.floor_double(par3); + int var9 = MathHelper.floor_double(par5); + double var10 = par1 - var7; + double var12 = par3 - var8; + double var14 = par5 - var9; - if (!worldObj.isAirBlock(var7, var8, var9)) { - boolean var16 = !worldObj.isBlockNormalCubeDefault(var7 - 1, var8, var9, false); - boolean var17 = !worldObj.isBlockNormalCubeDefault(var7 + 1, var8, var9, false); - boolean var18 = !worldObj.isBlockNormalCubeDefault(var7, var8 - 1, var9, false); - boolean var19 = !worldObj.isBlockNormalCubeDefault(var7, var8 + 1, var9, false); - boolean var20 = !worldObj.isBlockNormalCubeDefault(var7, var8, var9 - 1, false); - boolean var21 = !worldObj.isBlockNormalCubeDefault(var7, var8, var9 + 1, false); - byte var22 = -1; - double var23 = 9999.0D; + if(!worldObj.isAirBlock(var7, var8, var9)) { + boolean var16 = !worldObj.isBlockNormalCubeDefault(var7 - 1, var8, var9, false); + boolean var17 = !worldObj.isBlockNormalCubeDefault(var7 + 1, var8, var9, false); + boolean var18 = !worldObj.isBlockNormalCubeDefault(var7, var8 - 1, var9, false); + boolean var19 = !worldObj.isBlockNormalCubeDefault(var7, var8 + 1, var9, false); + boolean var20 = !worldObj.isBlockNormalCubeDefault(var7, var8, var9 - 1, false); + boolean var21 = !worldObj.isBlockNormalCubeDefault(var7, var8, var9 + 1, false); + byte var22 = -1; + double var23 = 9999.0D; - if (var16 && var10 < var23) { - var23 = var10; - var22 = 0; - } + if(var16 && var10 < var23) { + var23 = var10; + var22 = 0; + } - if (var17 && 1.0D - var10 < var23) { - var23 = 1.0D - var10; - var22 = 1; - } + if(var17 && 1.0D - var10 < var23) { + var23 = 1.0D - var10; + var22 = 1; + } - if (var18 && var12 < var23) { - var23 = var12; - var22 = 2; - } + if(var18 && var12 < var23) { + var23 = var12; + var22 = 2; + } - if (var19 && 1.0D - var12 < var23) { - var23 = 1.0D - var12; - var22 = 3; - } + if(var19 && 1.0D - var12 < var23) { + var23 = 1.0D - var12; + var22 = 3; + } - if (var20 && var14 < var23) { - var23 = var14; - var22 = 4; - } + if(var20 && var14 < var23) { + var23 = var14; + var22 = 4; + } - if (var21 && 1.0D - var14 < var23) { - var23 = 1.0D - var14; - var22 = 5; - } + if(var21 && 1.0D - var14 < var23) { + var23 = 1.0D - var14; + var22 = 5; + } - float var25 = rand.nextFloat() * 0.05F + 0.025F; - float var26 = (rand.nextFloat() - rand.nextFloat()) * 0.1F; + float var25 = rand.nextFloat() * 0.05F + 0.025F; + float var26 = (rand.nextFloat() - rand.nextFloat()) * 0.1F; - if (var22 == 0) { - motionX = -var25; - motionY=motionZ=var26; - } + if(var22 == 0) { + motionX = -var25; + motionY = motionZ = var26; + } - if (var22 == 1) { - motionX = var25; - motionY=motionZ=var26; - } + if(var22 == 1) { + motionX = var25; + motionY = motionZ = var26; + } - if (var22 == 2) { - motionY = -var25; - motionX=motionZ=var26; - } + if(var22 == 2) { + motionY = -var25; + motionX = motionZ = var26; + } - if (var22 == 3) { - motionY = var25; - motionX=motionZ=var26; - } + if(var22 == 3) { + motionY = var25; + motionX = motionZ = var26; + } - if (var22 == 4) { - motionZ = -var25; - motionY=motionX=var26; - } + if(var22 == 4) { + motionZ = -var25; + motionY = motionX = var26; + } - if (var22 == 5) { - motionZ = var25; - motionY=motionX=var26; - } + if(var22 == 5) { + motionZ = var25; + motionY = motionX = var26; + } - return true; - } else return false; - } + return true; + } else return false; + } - public boolean fake = false; - public int multiplier = 2; - public boolean shrink = true; - public int particle = 16; - public boolean tinkle = false; - public int blendmode = 1; - public boolean slowdown = true; - public int currentColor = 0; + public boolean fake = false; + public int multiplier = 2; + public boolean shrink = true; + public int particle = 16; + public boolean tinkle = false; + public int blendmode = 1; + public boolean slowdown = true; + public int currentColor = 0; } diff --git a/MODSRC/vazkii/botania/client/fx/FXWisp.java b/MODSRC/vazkii/botania/client/fx/FXWisp.java index 60155c491..6f4d67187 100644 --- a/MODSRC/vazkii/botania/client/fx/FXWisp.java +++ b/MODSRC/vazkii/botania/client/fx/FXWisp.java @@ -2,130 +2,124 @@ * This class was created by . 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 @ [? (GMT)] */ package vazkii.botania.client.fx; +import cpw.mods.fml.client.FMLClientHandler; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; - import org.lwjgl.opengl.GL11; - import vazkii.botania.client.lib.LibResources; import vazkii.botania.common.core.helper.ObfuscationHelper; -import cpw.mods.fml.client.FMLClientHandler; public class FXWisp extends EntityFX { - public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_WISP_LARGE); + public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_WISP_LARGE); - public FXWisp(World world, double d, double d1, double d2, float size, float red, float green, float blue, boolean distanceLimit, float maxAgeMul) { - super(world, d, d1, d2, 0.0D, 0.0D, 0.0D); - particleRed = red; - particleGreen = green; - particleBlue = blue; - particleGravity = 0; - motionX = motionY = motionZ = 0; - particleScale *= size; - moteParticleScale = particleScale; - particleMaxAge = (int)(28D / (Math.random() * 0.3D + 0.7D) * maxAgeMul); + public FXWisp(World world, double d, double d1, double d2, float size, float red, float green, float blue, boolean distanceLimit, float maxAgeMul) { + super(world, d, d1, d2, 0.0D, 0.0D, 0.0D); + particleRed = red; + particleGreen = green; + particleBlue = blue; + particleGravity = 0; + motionX = motionY = motionZ = 0; + particleScale *= size; + moteParticleScale = particleScale; + particleMaxAge = (int) (28D / (Math.random() * 0.3D + 0.7D) * maxAgeMul); - moteHalfLife = particleMaxAge / 2; - noClip = true; - setSize(0.01F, 0.01F); - EntityLivingBase renderentity = FMLClientHandler.instance().getClient().renderViewEntity; + moteHalfLife = particleMaxAge / 2; + noClip = true; + setSize(0.01F, 0.01F); + EntityLivingBase renderentity = FMLClientHandler.instance().getClient().renderViewEntity; - if(distanceLimit) { - int visibleDistance = 50; - if (!FMLClientHandler.instance().getClient().gameSettings.fancyGraphics) - visibleDistance = 25; + if(distanceLimit) { + int visibleDistance = 50; + if(!FMLClientHandler.instance().getClient().gameSettings.fancyGraphics) visibleDistance = 25; - if (renderentity == null || renderentity.getDistance(posX, posY, posZ) > visibleDistance) - particleMaxAge = 0; - } + if(renderentity == null || renderentity.getDistance(posX, posY, posZ) > visibleDistance) particleMaxAge = 0; + } - prevPosX = posX; - prevPosY = posY; - prevPosZ = posZ; - } + prevPosX = posX; + prevPosY = posY; + prevPosZ = posZ; + } - @Override - public void renderParticle(Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5) { - float agescale = 0; - agescale = (float)particleAge / (float) moteHalfLife; - if (agescale > 1F) - agescale = 2 - agescale; + @Override + public void renderParticle(Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5) { + float agescale = 0; + agescale = (float) particleAge / (float) moteHalfLife; + if(agescale > 1F) agescale = 2 - agescale; - particleScale = moteParticleScale * agescale; + particleScale = moteParticleScale * agescale; - tessellator.draw(); - GL11.glPushMatrix(); + tessellator.draw(); + GL11.glPushMatrix(); - GL11.glDepthMask(false); - GL11.glEnable(3042); - GL11.glBlendFunc(770, blendmode); + GL11.glDepthMask(false); + GL11.glEnable(3042); + GL11.glBlendFunc(770, blendmode); - Minecraft.getMinecraft().renderEngine.bindTexture(particles); + Minecraft.getMinecraft().renderEngine.bindTexture(particles); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); - float f10 = 0.5F * particleScale; - float f11 = (float)(prevPosX + (posX - prevPosX) * f - interpPosX); - float f12 = (float)(prevPosY + (posY - prevPosY) * f - interpPosY); - float f13 = (float)(prevPosZ + (posZ - prevPosZ) * f - interpPosZ); + float f10 = 0.5F * particleScale; + float f11 = (float) (prevPosX + (posX - prevPosX) * f - interpPosX); + float f12 = (float) (prevPosY + (posY - prevPosY) * f - interpPosY); + float f13 = (float) (prevPosZ + (posZ - prevPosZ) * f - interpPosZ); - tessellator.startDrawingQuads(); - tessellator.setBrightness(240); - tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, 0.5F); - tessellator.addVertexWithUV(f11 - f1 * f10 - f4 * f10, f12 - f2 * f10, f13 - f3 * f10 - f5 * f10, 0, 1); - tessellator.addVertexWithUV(f11 - f1 * f10 + f4 * f10, f12 + f2 * f10, f13 - f3 * f10 + f5 * f10, 1, 1); - tessellator.addVertexWithUV(f11 + f1 * f10 + f4 * f10, f12 + f2 * f10, f13 + f3 * f10 + f5 * f10, 1, 0); - tessellator.addVertexWithUV(f11 + f1 * f10 - f4 * f10, f12 - f2 * f10, f13 + f3 * f10 - f5 * f10, 0, 0); + tessellator.startDrawingQuads(); + tessellator.setBrightness(240); + tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, 0.5F); + tessellator.addVertexWithUV(f11 - f1 * f10 - f4 * f10, f12 - f2 * f10, f13 - f3 * f10 - f5 * f10, 0, 1); + tessellator.addVertexWithUV(f11 - f1 * f10 + f4 * f10, f12 + f2 * f10, f13 - f3 * f10 + f5 * f10, 1, 1); + tessellator.addVertexWithUV(f11 + f1 * f10 + f4 * f10, f12 + f2 * f10, f13 + f3 * f10 + f5 * f10, 1, 0); + tessellator.addVertexWithUV(f11 + f1 * f10 - f4 * f10, f12 - f2 * f10, f13 + f3 * f10 - f5 * f10, 0, 0); - tessellator.draw(); + tessellator.draw(); - GL11.glDisable(3042); - GL11.glDepthMask(true); + GL11.glDisable(3042); + GL11.glDepthMask(true); - GL11.glPopMatrix(); - Minecraft.getMinecraft().renderEngine.bindTexture(ObfuscationHelper.getParticleTexture()); - tessellator.startDrawingQuads(); - } + GL11.glPopMatrix(); + Minecraft.getMinecraft().renderEngine.bindTexture(ObfuscationHelper.getParticleTexture()); + tessellator.startDrawingQuads(); + } - @Override - public void onUpdate() { - prevPosX = posX; - prevPosY = posY; - prevPosZ = posZ; + @Override + public void onUpdate() { + prevPosX = posX; + prevPosY = posY; + prevPosZ = posZ; - if (particleAge++ >= particleMaxAge) - setDead(); + if(particleAge++ >= particleMaxAge) setDead(); - motionY -= 0.04D * particleGravity; - posX += motionX; - posY += motionY; - posZ += motionZ; - motionX *= 0.98000001907348633D; - motionY *= 0.98000001907348633D; - motionZ *= 0.98000001907348633D; - } + motionY -= 0.04D * particleGravity; + posX += motionX; + posY += motionY; + posZ += motionZ; + motionX *= 0.98000001907348633D; + motionY *= 0.98000001907348633D; + motionZ *= 0.98000001907348633D; + } - public void setGravity(float value) { - particleGravity = value; - } + public void setGravity(float value) { + particleGravity = value; + } - public boolean distanceLimit = true; - float moteParticleScale; - int moteHalfLife; - public boolean tinkle = false; - public int blendmode = 1; + public boolean distanceLimit = true; + float moteParticleScale; + int moteHalfLife; + public boolean tinkle = false; + public int blendmode = 1; } diff --git a/MODSRC/vazkii/botania/client/gui/GuiLexicon.java b/MODSRC/vazkii/botania/client/gui/GuiLexicon.java index 27169eb71..2b21ca1fa 100644 --- a/MODSRC/vazkii/botania/client/gui/GuiLexicon.java +++ b/MODSRC/vazkii/botania/client/gui/GuiLexicon.java @@ -2,24 +2,20 @@ * This class was created by . 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 14, 2014, 6:48:05 PM (GMT)] */ package vazkii.botania.client.gui; -import java.util.List; - import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; - import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.lexicon.LexiconCategory; import vazkii.botania.client.core.handler.ClientTickHandler; @@ -27,92 +23,92 @@ import vazkii.botania.client.gui.button.GuiButtonInvisible; import vazkii.botania.client.lib.LibResources; import vazkii.botania.common.item.ModItems; +import java.util.List; + public class GuiLexicon extends GuiScreen { - public static GuiLexicon currentOpenLexicon = new GuiLexicon(); + public static GuiLexicon currentOpenLexicon = new GuiLexicon(); - public static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_LEXICON); + public static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_LEXICON); - int guiWidth = 146; - int guiHeight = 180; - int left, top; + int guiWidth = 146; + int guiHeight = 180; + int left, top; - @Override - public void initGui() { - super.initGui(); - currentOpenLexicon = this; + @Override + public void initGui() { + super.initGui(); + currentOpenLexicon = this; - left = width / 2 - guiWidth / 2; - top = height / 2 - guiHeight / 2; + left = width / 2 - guiWidth / 2; + top = height / 2 - guiHeight / 2; - buttonList.clear(); - if(isIndex()) { - int x = 18; - for(int i = 0; i < 12; i++) { - int y = 16 + i * 12; - buttonList.add(new GuiButtonInvisible(i, left + x, top + y, 110, 10, "")); - } - populateIndex(); - } - } + buttonList.clear(); + if(isIndex()) { + int x = 18; + for(int i = 0; i < 12; i++) { + int y = 16 + i * 12; + buttonList.add(new GuiButtonInvisible(i, left + x, top + y, 110, 10, "")); + } + populateIndex(); + } + } - @Override - public void drawScreen(int par1, int par2, float par3) { - GL11.glColor4f(1F, 1F, 1F, 1F); - mc.renderEngine.bindTexture(texture); - drawTexturedModalRect(left, top, 0, 0, guiWidth, guiHeight); - drawCenteredString(fontRendererObj, getTitle(), left + guiWidth / 2, top - 12, 0x00FF00); + @Override + public void drawScreen(int par1, int par2, float par3) { + GL11.glColor4f(1F, 1F, 1F, 1F); + mc.renderEngine.bindTexture(texture); + drawTexturedModalRect(left, top, 0, 0, guiWidth, guiHeight); + drawCenteredString(fontRendererObj, getTitle(), left + guiWidth / 2, top - 12, 0x00FF00); - drawHeader(); + drawHeader(); - super.drawScreen(par1, par2, par3); - } + super.drawScreen(par1, par2, par3); + } - void drawHeader() { - boolean unicode = fontRendererObj.getUnicodeFlag(); - fontRendererObj.setUnicodeFlag(true); - fontRendererObj.drawSplitString(StatCollector.translateToLocal("botania.gui.lexicon.header"), left + 15, top + 20, 110, 0); - fontRendererObj.setUnicodeFlag(unicode); - } + void drawHeader() { + boolean unicode = fontRendererObj.getUnicodeFlag(); + fontRendererObj.setUnicodeFlag(true); + fontRendererObj.drawSplitString(StatCollector.translateToLocal("botania.gui.lexicon.header"), left + 15, top + 20, 110, 0); + fontRendererObj.setUnicodeFlag(unicode); + } - @Override - protected void actionPerformed(GuiButton par1GuiButton) { - int i = par1GuiButton.id - 3; - if(i < 0) - return; + @Override + protected void actionPerformed(GuiButton par1GuiButton) { + int i = par1GuiButton.id - 3; + if(i < 0) return; - List categoryList = BotaniaAPI.getAllCategories(); - LexiconCategory category = i >= categoryList.size() ? null : categoryList.get(i); + List categoryList = BotaniaAPI.getAllCategories(); + LexiconCategory category = i >= categoryList.size() ? null : categoryList.get(i); - if(category != null) { - mc.displayGuiScreen(new GuiLexiconIndex(category)); - ClientTickHandler.notifyPageChange(); - } - } + if(category != null) { + mc.displayGuiScreen(new GuiLexiconIndex(category)); + ClientTickHandler.notifyPageChange(); + } + } - @Override - public boolean doesGuiPauseGame() { - return false; - } + @Override + public boolean doesGuiPauseGame() { + return false; + } - String getTitle() { - return ModItems.lexicon.getItemStackDisplayName(null); - } + String getTitle() { + return ModItems.lexicon.getItemStackDisplayName(null); + } - boolean isIndex() { - return true; - } + boolean isIndex() { + return true; + } - void populateIndex() { - List categoryList = BotaniaAPI.getAllCategories(); - for(int i = 3; i < 12; i++) { - int i_ = i - 3; - GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i); - LexiconCategory category = i_ >= categoryList.size() ? null : categoryList.get(i_); - if(category != null) - button.displayString = StatCollector.translateToLocal(category.getUnlocalizedName()); - else button.displayString = ""; - } - } + void populateIndex() { + List categoryList = BotaniaAPI.getAllCategories(); + for(int i = 3; i < 12; i++) { + int i_ = i - 3; + GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i); + LexiconCategory category = i_ >= categoryList.size() ? null : categoryList.get(i_); + if(category != null) button.displayString = StatCollector.translateToLocal(category.getUnlocalizedName()); + else button.displayString = ""; + } + } } diff --git a/MODSRC/vazkii/botania/client/gui/GuiLexiconEntry.java b/MODSRC/vazkii/botania/client/gui/GuiLexiconEntry.java index 27f3a4047..e2c7fe1eb 100644 --- a/MODSRC/vazkii/botania/client/gui/GuiLexiconEntry.java +++ b/MODSRC/vazkii/botania/client/gui/GuiLexiconEntry.java @@ -2,11 +2,11 @@ * This class was created by . 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 14, 2014, 6:47:06 PM (GMT)] */ package vazkii.botania.client.gui; @@ -23,117 +23,117 @@ import vazkii.botania.client.gui.button.GuiButtonPage; public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry { - public int page = 0; - LexiconEntry entry; - GuiScreen parent; - String title; + public int page = 0; + LexiconEntry entry; + GuiScreen parent; + String title; - GuiButton leftButton, rightButton; + GuiButton leftButton, rightButton; - public GuiLexiconEntry(LexiconEntry entry, GuiScreen parent) { - this.entry = entry; - this.parent = parent; + public GuiLexiconEntry(LexiconEntry entry, GuiScreen parent) { + this.entry = entry; + this.parent = parent; - title = StatCollector.translateToLocal(entry.getUnlocalizedName()); - } + title = StatCollector.translateToLocal(entry.getUnlocalizedName()); + } - @Override - public void initGui() { - super.initGui(); + @Override + public void initGui() { + super.initGui(); - buttonList.add(new GuiButtonBackWithShift(0, left + guiWidth / 2 - 8, top + guiHeight + 2)); - buttonList.add(leftButton = new GuiButtonPage(1, left, top + guiHeight - 10, false)); - buttonList.add(rightButton = new GuiButtonPage(2, left + guiWidth - 18, top + guiHeight - 10, true)); + buttonList.add(new GuiButtonBackWithShift(0, left + guiWidth / 2 - 8, top + guiHeight + 2)); + buttonList.add(leftButton = new GuiButtonPage(1, left, top + guiHeight - 10, false)); + buttonList.add(rightButton = new GuiButtonPage(2, left + guiWidth - 18, top + guiHeight - 10, true)); - updatePageButtons(); - } + updatePageButtons(); + } - @Override - public LexiconEntry getEntry() { - return entry; - } + @Override + public LexiconEntry getEntry() { + return entry; + } - @Override - public int getPageOn() { - return page; - } + @Override + public int getPageOn() { + return page; + } - @Override - boolean isIndex() { - return false; - } + @Override + boolean isIndex() { + return false; + } - @Override - void drawHeader() { - // NO-OP - } + @Override + void drawHeader() { + // NO-OP + } - @Override - String getTitle() { - return String.format("%s (%s/%s)", title, page + 1, entry.pages.size()); - } + @Override + String getTitle() { + return String.format("%s (%s/%s)", title, page + 1, entry.pages.size()); + } - @Override - protected void actionPerformed(GuiButton par1GuiButton) { - switch(par1GuiButton.id) { - case 0 : - mc.displayGuiScreen(GuiScreen.isShiftKeyDown() ? new GuiLexicon() : parent); - ClientTickHandler.notifyPageChange(); - break; - case 1 : - page--; - ClientTickHandler.notifyPageChange(); - break; - case 2 : - page++; - ClientTickHandler.notifyPageChange(); - break; - } - updatePageButtons(); - } + @Override + protected void actionPerformed(GuiButton par1GuiButton) { + switch(par1GuiButton.id) { + case 0: + mc.displayGuiScreen(GuiScreen.isShiftKeyDown() ? new GuiLexicon() : parent); + ClientTickHandler.notifyPageChange(); + break; + case 1: + page--; + ClientTickHandler.notifyPageChange(); + break; + case 2: + page++; + ClientTickHandler.notifyPageChange(); + break; + } + updatePageButtons(); + } - public void updatePageButtons() { - leftButton.enabled = page != 0; - rightButton.enabled = page + 1 < entry.pages.size(); - } + public void updatePageButtons() { + leftButton.enabled = page != 0; + rightButton.enabled = page + 1 < entry.pages.size(); + } - @Override - public void drawScreen(int par1, int par2, float par3) { - super.drawScreen(par1, par2, par3); + @Override + public void drawScreen(int par1, int par2, float par3) { + super.drawScreen(par1, par2, par3); - LexiconPage page = entry.pages.get(this.page); - page.renderScreen(this, par1, par2); - } + LexiconPage page = entry.pages.get(this.page); + page.renderScreen(this, par1, par2); + } - @Override - public void updateScreen() { - LexiconPage page = entry.pages.get(this.page); - page.updateScreen(); - } + @Override + public void updateScreen() { + LexiconPage page = entry.pages.get(this.page); + page.updateScreen(); + } - @Override - public int getLeft() { - return left; - } + @Override + public int getLeft() { + return left; + } - @Override - public int getTop() { - return top; - } + @Override + public int getTop() { + return top; + } - @Override - public int getWidth() { - return guiWidth; - } + @Override + public int getWidth() { + return guiWidth; + } - @Override - public int getHeight() { - return guiHeight; - } + @Override + public int getHeight() { + return guiHeight; + } - @Override - public float getZLevel() { - return zLevel; - } + @Override + public float getZLevel() { + return zLevel; + } } diff --git a/MODSRC/vazkii/botania/client/gui/GuiLexiconIndex.java b/MODSRC/vazkii/botania/client/gui/GuiLexiconIndex.java index a0fe3ef94..a026c1505 100644 --- a/MODSRC/vazkii/botania/client/gui/GuiLexiconIndex.java +++ b/MODSRC/vazkii/botania/client/gui/GuiLexiconIndex.java @@ -2,19 +2,15 @@ * This class was created by . 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 14, 2014, 6:46:59 PM (GMT)] */ package vazkii.botania.client.gui; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - import net.minecraft.client.gui.GuiButton; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; @@ -25,89 +21,92 @@ import vazkii.botania.client.gui.button.GuiButtonBack; import vazkii.botania.client.gui.button.GuiButtonInvisible; import vazkii.botania.client.gui.button.GuiButtonPage; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + public class GuiLexiconIndex extends GuiLexicon { - LexiconCategory category; - String title; - int page = 0; + LexiconCategory category; + String title; + int page = 0; - GuiButton leftButton, rightButton; + GuiButton leftButton, rightButton; - List entriesToDisplay = new ArrayList(); + List entriesToDisplay = new ArrayList(); - public GuiLexiconIndex(LexiconCategory category) { - this.category = category; - title = StatCollector.translateToLocal(category.getUnlocalizedName()); - } + public GuiLexiconIndex(LexiconCategory category) { + this.category = category; + title = StatCollector.translateToLocal(category.getUnlocalizedName()); + } - @Override - void drawHeader() { - // NO-OP - } + @Override + void drawHeader() { + // NO-OP + } - @Override - String getTitle() { - return title; - } + @Override + String getTitle() { + return title; + } - @Override - public void initGui() { - super.initGui(); - buttonList.add(new GuiButtonBack(12, left + guiWidth / 2 - 8, top + guiHeight + 2)); - buttonList.add(leftButton = new GuiButtonPage(13, left, top + guiHeight - 10, false)); - buttonList.add(rightButton = new GuiButtonPage(14, left + guiWidth - 18, top + guiHeight - 10, true)); + @Override + public void initGui() { + super.initGui(); + buttonList.add(new GuiButtonBack(12, left + guiWidth / 2 - 8, top + guiHeight + 2)); + buttonList.add(leftButton = new GuiButtonPage(13, left, top + guiHeight - 10, false)); + buttonList.add(rightButton = new GuiButtonPage(14, left + guiWidth - 18, top + guiHeight - 10, true)); - entriesToDisplay.clear(); - entriesToDisplay.addAll(category.entries); - Collections.sort(entriesToDisplay); + entriesToDisplay.clear(); + entriesToDisplay.addAll(category.entries); + Collections.sort(entriesToDisplay); - updatePageButtons(); - populateIndex(); - } + updatePageButtons(); + populateIndex(); + } - @Override - void populateIndex() { - for(int i = page * 12; i < (page + 1) * 12; i++) { - GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i - page * 12); - LexiconEntry entry = i >= entriesToDisplay.size() ? null : entriesToDisplay.get(i); - if(entry != null) - button.displayString = (entry.isPriority() ? EnumChatFormatting.ITALIC : "") + StatCollector.translateToLocal(entry.getUnlocalizedName()); - else button.displayString = ""; - } - } + @Override + void populateIndex() { + for(int i = page * 12; i < (page + 1) * 12; i++) { + GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i - page * 12); + LexiconEntry entry = i >= entriesToDisplay.size() ? null : entriesToDisplay.get(i); + if(entry != null) + button.displayString = (entry.isPriority() ? EnumChatFormatting.ITALIC : "") + StatCollector.translateToLocal(entry.getUnlocalizedName()); + else button.displayString = ""; + } + } - @Override - protected void actionPerformed(GuiButton par1GuiButton) { - switch(par1GuiButton.id) { - case 12 : - mc.displayGuiScreen(new GuiLexicon()); - ClientTickHandler.notifyPageChange(); - break; - case 13 : - page--; - updatePageButtons(); - populateIndex(); - ClientTickHandler.notifyPageChange(); - break; - case 14 : - page++; - updatePageButtons(); - populateIndex(); - ClientTickHandler.notifyPageChange(); - break; - default : - int index = par1GuiButton.id + page * 12; - if(index >= entriesToDisplay.size()) - return; + @Override + protected void actionPerformed(GuiButton par1GuiButton) { + switch(par1GuiButton.id) { + case 12: + mc.displayGuiScreen(new GuiLexicon()); + ClientTickHandler.notifyPageChange(); + break; + case 13: + page--; + updatePageButtons(); + populateIndex(); + ClientTickHandler.notifyPageChange(); + break; + case 14: + page++; + updatePageButtons(); + populateIndex(); + ClientTickHandler.notifyPageChange(); + break; + default: + int index = par1GuiButton.id + page * 12; + if(index >= entriesToDisplay.size()) return; - LexiconEntry entry = entriesToDisplay.get(index); - mc.displayGuiScreen(new GuiLexiconEntry(entry, this)); - ClientTickHandler.notifyPageChange(); - } - } + LexiconEntry entry = entriesToDisplay.get(index); + mc.displayGuiScreen(new GuiLexiconEntry(entry, this)); + ClientTickHandler.notifyPageChange(); + } + } - public void updatePageButtons() { - leftButton.enabled = page != 0; - rightButton.enabled = page < (entriesToDisplay.size() - 1) / 12; - } + public void updatePageButtons() { + leftButton.enabled = page != 0; + rightButton.enabled = page < (entriesToDisplay.size() - 1) / 12; + } } diff --git a/MODSRC/vazkii/botania/client/gui/button/GuiButtonBack.java b/MODSRC/vazkii/botania/client/gui/button/GuiButtonBack.java index e9b9a35e6..b2ad6d74e 100644 --- a/MODSRC/vazkii/botania/client/gui/button/GuiButtonBack.java +++ b/MODSRC/vazkii/botania/client/gui/button/GuiButtonBack.java @@ -2,50 +2,47 @@ * This class was created by . 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 14, 2014, 9:54:21 PM (GMT)] */ package vazkii.botania.client.gui.button; -import java.util.Arrays; -import java.util.List; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; - import vazkii.botania.client.core.helper.RenderHelper; import vazkii.botania.client.gui.GuiLexicon; +import java.util.Arrays; +import java.util.List; + public class GuiButtonBack extends GuiButton { - public GuiButtonBack(int par1, int par2, int par3) { - super(par1, par2, par3, 18, 9, ""); - } + public GuiButtonBack(int par1, int par2, int par3) { + super(par1, par2, par3, 18, 9, ""); + } - @Override - public void drawButton(Minecraft par1Minecraft, int par2, int par3) { - field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height; - int k = getHoverState(field_146123_n); + @Override + public void drawButton(Minecraft par1Minecraft, int par2, int par3) { + field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height; + int k = getHoverState(field_146123_n); - par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture); - GL11.glColor4f(1F, 1F, 1F, 1F); - drawTexturedModalRect(xPosition, yPosition, 36, k == 2 ? 180 : 189, 18, 9); + par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture); + GL11.glColor4f(1F, 1F, 1F, 1F); + drawTexturedModalRect(xPosition, yPosition, 36, k == 2 ? 180 : 189, 18, 9); - List tooltip = getTooltip(); - int tooltipY = (tooltip.size() - 1) * 10; - if(k == 2) - RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip); - } + List tooltip = getTooltip(); + int tooltipY = (tooltip.size() - 1) * 10; + if(k == 2) RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip); + } - public List getTooltip() { - return Arrays.asList(StatCollector.translateToLocal("botaniamisc.back")); - } + public List getTooltip() { + return Arrays.asList(StatCollector.translateToLocal("botaniamisc.back")); + } } diff --git a/MODSRC/vazkii/botania/client/gui/button/GuiButtonBackWithShift.java b/MODSRC/vazkii/botania/client/gui/button/GuiButtonBackWithShift.java index a2014ee0c..05ab415bf 100644 --- a/MODSRC/vazkii/botania/client/gui/button/GuiButtonBackWithShift.java +++ b/MODSRC/vazkii/botania/client/gui/button/GuiButtonBackWithShift.java @@ -2,30 +2,30 @@ * This class was created by . 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 @ [Mar 6, 2014, 6:35:32 PM (GMT)] */ package vazkii.botania.client.gui.button; -import java.util.Arrays; -import java.util.List; - import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import java.util.Arrays; +import java.util.List; + public class GuiButtonBackWithShift extends GuiButtonBack { - public GuiButtonBackWithShift(int par1, int par2, int par3) { - super(par1, par2, par3); - } + public GuiButtonBackWithShift(int par1, int par2, int par3) { + super(par1, par2, par3); + } - @Override - public List getTooltip() { - return Arrays.asList(StatCollector.translateToLocal("botaniamisc.back"), EnumChatFormatting.GRAY + StatCollector.translateToLocal("botaniamisc.clickToIndex")); - } + @Override + public List getTooltip() { + return Arrays.asList(StatCollector.translateToLocal("botaniamisc.back"), EnumChatFormatting.GRAY + StatCollector.translateToLocal("botaniamisc.clickToIndex")); + } } diff --git a/MODSRC/vazkii/botania/client/gui/button/GuiButtonInvisible.java b/MODSRC/vazkii/botania/client/gui/button/GuiButtonInvisible.java index 4b9f96ce8..ae851f193 100644 --- a/MODSRC/vazkii/botania/client/gui/button/GuiButtonInvisible.java +++ b/MODSRC/vazkii/botania/client/gui/button/GuiButtonInvisible.java @@ -2,11 +2,11 @@ * This class was created by . 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 14, 2014, 8:34:01 PM (GMT)] */ package vazkii.botania.client.gui.button; @@ -16,19 +16,19 @@ import net.minecraft.client.gui.GuiButton; public class GuiButtonInvisible extends GuiButton { - public GuiButtonInvisible(int par1, int par2, int par3, int par4, int par5, String par6Str) { - super(par1, par2, par3, par4, par5, par6Str); - } + public GuiButtonInvisible(int par1, int par2, int par3, int par4, int par5, String par6Str) { + super(par1, par2, par3, par4, par5, par6Str); + } - @Override - public void drawButton(Minecraft par1Minecraft, int par2, int par3) { - field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height; - int k = getHoverState(field_146123_n); + @Override + public void drawButton(Minecraft par1Minecraft, int par2, int par3) { + field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height; + int k = getHoverState(field_146123_n); - boolean unicode = par1Minecraft.fontRenderer.getUnicodeFlag(); - par1Minecraft.fontRenderer.setUnicodeFlag(true); - par1Minecraft.fontRenderer.drawString(displayString, xPosition + (k == 2 ? 5 : 0), yPosition + (height - 8) / 2, 0); - par1Minecraft.fontRenderer.setUnicodeFlag(unicode); - } + boolean unicode = par1Minecraft.fontRenderer.getUnicodeFlag(); + par1Minecraft.fontRenderer.setUnicodeFlag(true); + par1Minecraft.fontRenderer.drawString(displayString, xPosition + (k == 2 ? 5 : 0), yPosition + (height - 8) / 2, 0); + par1Minecraft.fontRenderer.setUnicodeFlag(unicode); + } } diff --git a/MODSRC/vazkii/botania/client/gui/button/GuiButtonPage.java b/MODSRC/vazkii/botania/client/gui/button/GuiButtonPage.java index 1b0e723e0..a997a493e 100644 --- a/MODSRC/vazkii/botania/client/gui/button/GuiButtonPage.java +++ b/MODSRC/vazkii/botania/client/gui/button/GuiButtonPage.java @@ -2,48 +2,46 @@ * This class was created by . 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 16, 2014, 4:52:06 PM (GMT)] */ package vazkii.botania.client.gui.button; -import java.util.Arrays; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; - import vazkii.botania.client.core.helper.RenderHelper; import vazkii.botania.client.gui.GuiLexicon; +import java.util.Arrays; + public class GuiButtonPage extends GuiButton { - boolean right; + boolean right; - public GuiButtonPage(int par1, int par2, int par3, boolean right) { - super(par1, par2, par3, 18, 10, ""); - this.right = right; - } + public GuiButtonPage(int par1, int par2, int par3, boolean right) { + super(par1, par2, par3, 18, 10, ""); + this.right = right; + } - @Override - public void drawButton(Minecraft par1Minecraft, int par2, int par3) { - if(enabled) { - field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height; - int k = getHoverState(field_146123_n); + @Override + public void drawButton(Minecraft par1Minecraft, int par2, int par3) { + if(enabled) { + field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height; + int k = getHoverState(field_146123_n); - par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture); - GL11.glColor4f(1F, 1F, 1F, 1F); - drawTexturedModalRect(xPosition, yPosition, k == 2 ? 18 : 0, right ? 180 : 190, 18, 10); + par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture); + GL11.glColor4f(1F, 1F, 1F, 1F); + drawTexturedModalRect(xPosition, yPosition, k == 2 ? 18 : 0, right ? 180 : 190, 18, 10); - if(k == 2) - RenderHelper.renderTooltip(par2, par3, Arrays.asList(StatCollector.translateToLocal(right ? "botaniamisc.nextPage" : "botaniamisc.prevPage"))); - } - } + if(k == 2) + RenderHelper.renderTooltip(par2, par3, Arrays.asList(StatCollector.translateToLocal(right ? "botaniamisc.nextPage" : "botaniamisc.prevPage"))); + } + } } diff --git a/MODSRC/vazkii/botania/client/lib/LibRenderIDs.java b/MODSRC/vazkii/botania/client/lib/LibRenderIDs.java index f98645cbd..774a0ef24 100644 --- a/MODSRC/vazkii/botania/client/lib/LibRenderIDs.java +++ b/MODSRC/vazkii/botania/client/lib/LibRenderIDs.java @@ -2,21 +2,21 @@ * This class was created by . 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 21, 2014, 8:03:06 PM (GMT)] */ package vazkii.botania.client.lib; public final class LibRenderIDs { - public static int idAltar = -1; - public static int idSpecialFlower = -1; - public static int idSpreader = -1; - public static int idPool = -1; - public static int idPylon = -1; + public static int idAltar = -1; + public static int idSpecialFlower = -1; + public static int idSpreader = -1; + public static int idPool = -1; + public static int idPylon = -1; } diff --git a/MODSRC/vazkii/botania/client/lib/LibResources.java b/MODSRC/vazkii/botania/client/lib/LibResources.java index 5dd87f826..1c26f86d1 100644 --- a/MODSRC/vazkii/botania/client/lib/LibResources.java +++ b/MODSRC/vazkii/botania/client/lib/LibResources.java @@ -2,74 +2,72 @@ * This class was created by . 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 14, 2014, 5:29:31 PM (GMT)] */ package vazkii.botania.client.lib; public final class LibResources { - public static final String PREFIX_MOD = "botania:"; + public static final String PREFIX_MOD = "botania:"; - public static final String PREFIX_LANG = "/assets/botania/lang/"; - public static final String PREFIX_SHADER = "/assets/botania/shader/"; + public static final String PREFIX_LANG = "/assets/botania/lang/"; + public static final String PREFIX_SHADER = "/assets/botania/shader/"; - public static final String PREFIX_GUI = PREFIX_MOD + "textures/gui/"; - public static final String PREFIX_ENTRIES = PREFIX_GUI + "entries/"; - public static final String PREFIX_MODEL = PREFIX_MOD + "textures/model/"; - public static final String PREFIX_MISC = PREFIX_MOD + "textures/misc/"; - public static final String PREFIX_OBJ_MODEL = PREFIX_MOD + "model/"; - - public static final String EMTPY_TEXTURE = "emptyTexture"; + public static final String PREFIX_GUI = PREFIX_MOD + "textures/gui/"; + public static final String PREFIX_ENTRIES = PREFIX_GUI + "entries/"; + public static final String PREFIX_MODEL = PREFIX_MOD + "textures/model/"; + public static final String PREFIX_MISC = PREFIX_MOD + "textures/misc/"; + public static final String PREFIX_OBJ_MODEL = PREFIX_MOD + "model/"; - public static final String GUI_MANA_HUD = PREFIX_GUI + "manaHud.png"; - public static final String GUI_LEXICON = PREFIX_GUI + "lexicon.png"; - public static final String GUI_CRAFTING_OVERLAY = PREFIX_GUI + "craftingOverlay.png"; - public static final String GUI_MANA_INFUSION_OVERLAY = PREFIX_GUI + "manaInfusionOverlay.png"; - public static final String GUI_PETAL_OVERLAY = PREFIX_GUI + "petalOverlay.png"; - public static final String GUI_TERRASTEEL_OVERLAY = PREFIX_GUI + "terrasteelOverlay.png"; + public static final String EMTPY_TEXTURE = "emptyTexture"; - 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"; - public static final String ENTRY_SPREADER = PREFIX_ENTRIES + "spreader.png"; - public static final String ENTRY_UNSTABLE_BLOCK = PREFIX_ENTRIES + "unstableBlock.png"; - public static final String ENTRY_UNSTABLE_BEACON = PREFIX_ENTRIES + "unstableBeacon.png"; - public static final String ENTRY_ENCHANTER0 = PREFIX_ENTRIES + "enchanter0.png"; - public static final String ENTRY_ENCHANTER1 = PREFIX_ENTRIES + "enchanter1.png"; - public static final String ENTRY_ENCHANTER2 = PREFIX_ENTRIES + "enchanter2.png"; - public static final String ENTRY_ENCHANTER3 = PREFIX_ENTRIES + "enchanter3.png"; + public static final String GUI_MANA_HUD = PREFIX_GUI + "manaHud.png"; + public static final String GUI_LEXICON = PREFIX_GUI + "lexicon.png"; + public static final String GUI_CRAFTING_OVERLAY = PREFIX_GUI + "craftingOverlay.png"; + public static final String GUI_MANA_INFUSION_OVERLAY = PREFIX_GUI + "manaInfusionOverlay.png"; + public static final String GUI_PETAL_OVERLAY = PREFIX_GUI + "petalOverlay.png"; + public static final String GUI_TERRASTEEL_OVERLAY = PREFIX_GUI + "terrasteelOverlay.png"; - public static final String MODEL_ALTAR = PREFIX_MODEL + "altar.png"; - public static final String MODEL_SPREADER = PREFIX_MODEL + "spreader.png"; - public static final String MODEL_SPREADER_REDSTONE = PREFIX_MODEL + "spreaderRedstone.png"; - public static final String MODEL_POOL = PREFIX_MODEL + "pool.png"; - public static final String MODEL_PYLON_OLD = PREFIX_MODEL + "pylonOld.png"; - public static final String MODEL_PYLON = PREFIX_MODEL + "pylon.png"; - public static final String MODEL_LEXICA = PREFIX_MODEL + "lexica.png"; - public static final String MODEL_MANASTEEL_0 = PREFIX_MODEL + "manasteel0.png"; - public static final String MODEL_MANASTEEL_1 = PREFIX_MODEL + "manasteel1.png"; - public static final String MODEL_TERRASTEEL_0 = PREFIX_MODEL + "terrasteel0.png"; - public static final String MODEL_TERRASTEEL_1 = PREFIX_MODEL + "terrasteel1.png"; - - public static final String MODEL_CAPE = "/assets/botania/textures/model/cape.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"; + public static final String ENTRY_SPREADER = PREFIX_ENTRIES + "spreader.png"; + public static final String ENTRY_UNSTABLE_BLOCK = PREFIX_ENTRIES + "unstableBlock.png"; + public static final String ENTRY_UNSTABLE_BEACON = PREFIX_ENTRIES + "unstableBeacon.png"; + public static final String ENTRY_ENCHANTER0 = PREFIX_ENTRIES + "enchanter0.png"; + public static final String ENTRY_ENCHANTER1 = PREFIX_ENTRIES + "enchanter1.png"; + public static final String ENTRY_ENCHANTER2 = PREFIX_ENTRIES + "enchanter2.png"; + public static final String ENTRY_ENCHANTER3 = PREFIX_ENTRIES + "enchanter3.png"; - public static final String MISC_PARTICLES = PREFIX_MISC + "particles.png"; - public static final String MISC_WISP_LARGE = PREFIX_MISC + "wispLarge.png"; - public static final String MISC_WISP_SMALL = PREFIX_MISC + "wispSmall.png"; + public static final String MODEL_ALTAR = PREFIX_MODEL + "altar.png"; + public static final String MODEL_SPREADER = PREFIX_MODEL + "spreader.png"; + public static final String MODEL_SPREADER_REDSTONE = PREFIX_MODEL + "spreaderRedstone.png"; + public static final String MODEL_POOL = PREFIX_MODEL + "pool.png"; + public static final String MODEL_PYLON_OLD = PREFIX_MODEL + "pylonOld.png"; + public static final String MODEL_PYLON = PREFIX_MODEL + "pylon.png"; + public static final String MODEL_LEXICA = PREFIX_MODEL + "lexica.png"; + public static final String MODEL_MANASTEEL_0 = PREFIX_MODEL + "manasteel0.png"; + public static final String MODEL_MANASTEEL_1 = PREFIX_MODEL + "manasteel1.png"; + public static final String MODEL_TERRASTEEL_0 = PREFIX_MODEL + "terrasteel0.png"; + public static final String MODEL_TERRASTEEL_1 = PREFIX_MODEL + "terrasteel1.png"; - public static final String OBJ_MODEL_PYLON = PREFIX_OBJ_MODEL + "pylon.obj"; - - public static final String SHADER_PYLON_GLOW_FRAG = PREFIX_SHADER + "pylon_glow.frag"; - public static final String SHADER_ENCHANTER_RUNE_FRAG = PREFIX_SHADER + "enchanter_rune.frag"; - public static final String SHADER_MANA_POOL_FRAG = PREFIX_SHADER + "mana_pool.frag"; + public static final String MODEL_CAPE = "/assets/botania/textures/model/cape.png"; - public static final String[] LANGS = new String[] { - "en_US", "de_DE" - }; + public static final String MISC_PARTICLES = PREFIX_MISC + "particles.png"; + public static final String MISC_WISP_LARGE = PREFIX_MISC + "wispLarge.png"; + public static final String MISC_WISP_SMALL = PREFIX_MISC + "wispSmall.png"; + + public static final String OBJ_MODEL_PYLON = PREFIX_OBJ_MODEL + "pylon.obj"; + + public static final String SHADER_PYLON_GLOW_FRAG = PREFIX_SHADER + "pylon_glow.frag"; + public static final String SHADER_ENCHANTER_RUNE_FRAG = PREFIX_SHADER + "enchanter_rune.frag"; + public static final String SHADER_MANA_POOL_FRAG = PREFIX_SHADER + "mana_pool.frag"; + + public static final String[] LANGS = new String[]{"en_US", "de_DE"}; } diff --git a/MODSRC/vazkii/botania/client/model/IPylonModel.java b/MODSRC/vazkii/botania/client/model/IPylonModel.java index a969aaaa6..42d075a73 100644 --- a/MODSRC/vazkii/botania/client/model/IPylonModel.java +++ b/MODSRC/vazkii/botania/client/model/IPylonModel.java @@ -2,19 +2,21 @@ * This class was created by . 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 @ [Apr 1, 2014, 6:23:24 PM (GMT)] */ package vazkii.botania.client.model; public interface IPylonModel { - public void renderCrystal(); - public void renderRing(); - public void renderGems(); - + public void renderCrystal(); + + public void renderRing(); + + public void renderGems(); + } diff --git a/MODSRC/vazkii/botania/client/model/ModelAltar.java b/MODSRC/vazkii/botania/client/model/ModelAltar.java index e40358e0b..81bb5deb4 100644 --- a/MODSRC/vazkii/botania/client/model/ModelAltar.java +++ b/MODSRC/vazkii/botania/client/model/ModelAltar.java @@ -2,11 +2,11 @@ * This class was created by . 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 21, 2014, 7:56:15 PM (GMT)] */ package vazkii.botania.client.model; @@ -16,74 +16,74 @@ import net.minecraft.client.model.ModelRenderer; public class ModelAltar extends ModelBase { - ModelRenderer gobletBase; - ModelRenderer gobletBase2; - ModelRenderer gobletBase3; - ModelRenderer gobletStand; - ModelRenderer kelkBase; - ModelRenderer kelkBase2; - ModelRenderer kelkWall1; - ModelRenderer kelkWall2; - ModelRenderer kelkWall3; - ModelRenderer kelkWall4; + ModelRenderer gobletBase; + ModelRenderer gobletBase2; + ModelRenderer gobletBase3; + ModelRenderer gobletStand; + ModelRenderer kelkBase; + ModelRenderer kelkBase2; + ModelRenderer kelkWall1; + ModelRenderer kelkWall2; + ModelRenderer kelkWall3; + ModelRenderer kelkWall4; - public ModelAltar() { - textureWidth = 256; - textureHeight = 128; + public ModelAltar() { + textureWidth = 256; + textureHeight = 128; - gobletBase = new ModelRenderer(this, 0, 0); - gobletBase.addBox(0F, 0F, 0F, 16, 2, 16); - gobletBase.setRotationPoint(-8F, 22F, -8F); - gobletBase.setTextureSize(256, 128); - gobletBase2 = new ModelRenderer(this, 0, 18); - gobletBase2.addBox(0F, 0F, 0F, 14, 1, 14); - gobletBase2.setRotationPoint(-7F, 21F, -7F); - gobletBase2.setTextureSize(256, 128); - gobletStand = new ModelRenderer(this, 68, 0); - gobletStand.addBox(0F, 0F, 0F, 6, 8, 6); - gobletStand.setRotationPoint(-3F, 12F, -3F); - gobletStand.setTextureSize(256, 128); - gobletBase3 = new ModelRenderer(this, 0, 33); - gobletBase3.addBox(0F, 0F, 0F, 12, 1, 12); - gobletBase3.setRotationPoint(-6F, 20F, -6F); - gobletBase3.setTextureSize(256, 128); - kelkBase = new ModelRenderer(this, 72, 45); - kelkBase.addBox(0F, 0F, 0F, 8, 1, 8); - kelkBase.setRotationPoint(-4F, 11F, -4F); - kelkBase.setTextureSize(256, 128); - kelkBase2 = new ModelRenderer(this, 72, 34); - kelkBase2.addBox(0F, 0F, 0F, 10, 1, 10); - kelkBase2.setRotationPoint(-5F, 10F, -5F); - kelkBase2.setTextureSize(256, 128); - kelkWall1 = new ModelRenderer(this, 72, 18); - kelkWall1.addBox(0F, 0F, 0F, 1, 6, 10); - kelkWall1.setRotationPoint(5F, 4F, -5F); - kelkWall1.setTextureSize(256, 128); - kelkWall2 = new ModelRenderer(this, 72, 18); - kelkWall2.addBox(0F, 0F, 0F, 1, 6, 10); - kelkWall2.setRotationPoint(-6F, 4F, -5F); - kelkWall2.setTextureSize(256, 128); - kelkWall3 = new ModelRenderer(this, 94, 18); - kelkWall3.addBox(0F, 0F, 0F, 10, 6, 1); - kelkWall3.setRotationPoint(-5F, 4F, 5F); - kelkWall3.setTextureSize(256, 128); - kelkWall4 = new ModelRenderer(this, 94, 18); - kelkWall4.addBox(0F, 0F, 0F, 10, 6, 1); - kelkWall4.setRotationPoint(-5F, 4F, -6F); - kelkWall4.setTextureSize(256, 128); - } + gobletBase = new ModelRenderer(this, 0, 0); + gobletBase.addBox(0F, 0F, 0F, 16, 2, 16); + gobletBase.setRotationPoint(-8F, 22F, -8F); + gobletBase.setTextureSize(256, 128); + gobletBase2 = new ModelRenderer(this, 0, 18); + gobletBase2.addBox(0F, 0F, 0F, 14, 1, 14); + gobletBase2.setRotationPoint(-7F, 21F, -7F); + gobletBase2.setTextureSize(256, 128); + gobletStand = new ModelRenderer(this, 68, 0); + gobletStand.addBox(0F, 0F, 0F, 6, 8, 6); + gobletStand.setRotationPoint(-3F, 12F, -3F); + gobletStand.setTextureSize(256, 128); + gobletBase3 = new ModelRenderer(this, 0, 33); + gobletBase3.addBox(0F, 0F, 0F, 12, 1, 12); + gobletBase3.setRotationPoint(-6F, 20F, -6F); + gobletBase3.setTextureSize(256, 128); + kelkBase = new ModelRenderer(this, 72, 45); + kelkBase.addBox(0F, 0F, 0F, 8, 1, 8); + kelkBase.setRotationPoint(-4F, 11F, -4F); + kelkBase.setTextureSize(256, 128); + kelkBase2 = new ModelRenderer(this, 72, 34); + kelkBase2.addBox(0F, 0F, 0F, 10, 1, 10); + kelkBase2.setRotationPoint(-5F, 10F, -5F); + kelkBase2.setTextureSize(256, 128); + kelkWall1 = new ModelRenderer(this, 72, 18); + kelkWall1.addBox(0F, 0F, 0F, 1, 6, 10); + kelkWall1.setRotationPoint(5F, 4F, -5F); + kelkWall1.setTextureSize(256, 128); + kelkWall2 = new ModelRenderer(this, 72, 18); + kelkWall2.addBox(0F, 0F, 0F, 1, 6, 10); + kelkWall2.setRotationPoint(-6F, 4F, -5F); + kelkWall2.setTextureSize(256, 128); + kelkWall3 = new ModelRenderer(this, 94, 18); + kelkWall3.addBox(0F, 0F, 0F, 10, 6, 1); + kelkWall3.setRotationPoint(-5F, 4F, 5F); + kelkWall3.setTextureSize(256, 128); + kelkWall4 = new ModelRenderer(this, 94, 18); + kelkWall4.addBox(0F, 0F, 0F, 10, 6, 1); + kelkWall4.setRotationPoint(-5F, 4F, -6F); + kelkWall4.setTextureSize(256, 128); + } - public void render() { - float f = 1F / 16F; - gobletBase.render(f); - gobletBase2.render(f); - gobletBase3.render(f); - gobletStand.render(f); - kelkBase.render(f); - kelkBase2.render(f); - kelkWall1.render(f); - kelkWall2.render(f); - kelkWall3.render(f); - kelkWall4.render(f); - } + public void render() { + float f = 1F / 16F; + gobletBase.render(f); + gobletBase2.render(f); + gobletBase3.render(f); + gobletStand.render(f); + kelkBase.render(f); + kelkBase2.render(f); + kelkWall1.render(f); + kelkWall2.render(f); + kelkWall3.render(f); + kelkWall4.render(f); + } } diff --git a/MODSRC/vazkii/botania/client/model/ModelPool.java b/MODSRC/vazkii/botania/client/model/ModelPool.java index e0e5e860a..9c27c1aa9 100644 --- a/MODSRC/vazkii/botania/client/model/ModelPool.java +++ b/MODSRC/vazkii/botania/client/model/ModelPool.java @@ -2,11 +2,11 @@ * This class was created by . 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 25, 2014, 1:53:32 PM (GMT)] */ package vazkii.botania.client.model; @@ -16,44 +16,44 @@ import net.minecraft.client.model.ModelRenderer; public class ModelPool extends ModelBase { - ModelRenderer base; - ModelRenderer side1; - ModelRenderer side2; - ModelRenderer side3; - ModelRenderer side4; + ModelRenderer base; + ModelRenderer side1; + ModelRenderer side2; + ModelRenderer side3; + ModelRenderer side4; - public ModelPool() { - textureWidth = 64; - textureHeight = 32; + public ModelPool() { + textureWidth = 64; + textureHeight = 32; - base = new ModelRenderer(this, 0, 0); - base.addBox(0F, 0F, 0F, 16, 1, 16); - base.setRotationPoint(-8F, 23F, -8F); - base.setTextureSize(64, 32); - side1 = new ModelRenderer(this, 0, 0); - side1.addBox(0F, 0F, 0F, 16, 7, 1); - side1.setRotationPoint(-8F, 16F, 7F); - side1.setTextureSize(64, 32); - side2 = new ModelRenderer(this, 0, 0); - side2.addBox(0F, 0F, 0F, 16, 7, 1); - side2.setRotationPoint(-8F, 16F, -8F); - side2.setTextureSize(64, 32); - side3 = new ModelRenderer(this, 0, 0); - side3.addBox(0F, 0F, 0F, 1, 7, 14); - side3.setRotationPoint(-8F, 16F, -7F); - side3.setTextureSize(64, 32); - side4 = new ModelRenderer(this, 0, 0); - side4.addBox(0F, 0F, 0F, 1, 7, 14); - side4.setRotationPoint(7F, 16F, -7F); - side4.setTextureSize(64, 32); - } + base = new ModelRenderer(this, 0, 0); + base.addBox(0F, 0F, 0F, 16, 1, 16); + base.setRotationPoint(-8F, 23F, -8F); + base.setTextureSize(64, 32); + side1 = new ModelRenderer(this, 0, 0); + side1.addBox(0F, 0F, 0F, 16, 7, 1); + side1.setRotationPoint(-8F, 16F, 7F); + side1.setTextureSize(64, 32); + side2 = new ModelRenderer(this, 0, 0); + side2.addBox(0F, 0F, 0F, 16, 7, 1); + side2.setRotationPoint(-8F, 16F, -8F); + side2.setTextureSize(64, 32); + side3 = new ModelRenderer(this, 0, 0); + side3.addBox(0F, 0F, 0F, 1, 7, 14); + side3.setRotationPoint(-8F, 16F, -7F); + side3.setTextureSize(64, 32); + side4 = new ModelRenderer(this, 0, 0); + side4.addBox(0F, 0F, 0F, 1, 7, 14); + side4.setRotationPoint(7F, 16F, -7F); + side4.setTextureSize(64, 32); + } - public void render() { - float f = 1F / 16F; - base.render(f); - side1.render(f); - side2.render(f); - side3.render(f); - side4.render(f); - } + public void render() { + float f = 1F / 16F; + base.render(f); + side1.render(f); + side2.render(f); + side3.render(f); + side4.render(f); + } } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/client/model/ModelPylon.java b/MODSRC/vazkii/botania/client/model/ModelPylon.java index 4d9c321c1..b998053d7 100644 --- a/MODSRC/vazkii/botania/client/model/ModelPylon.java +++ b/MODSRC/vazkii/botania/client/model/ModelPylon.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Apr 1, 2014, 6:21:48 PM (GMT)] */ package vazkii.botania.client.model; @@ -14,31 +14,29 @@ package vazkii.botania.client.model; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; -import net.minecraftforge.client.model.obj.GroupObject; -import net.minecraftforge.client.model.obj.WavefrontObject; import vazkii.botania.client.lib.LibResources; public class ModelPylon implements IPylonModel { - private IModelCustom model; - - public ModelPylon() { - model = AdvancedModelLoader.loadModel(new ResourceLocation(LibResources.OBJ_MODEL_PYLON)); - } - - @Override - public void renderCrystal() { - model.renderPart("Crystal"); - } + private IModelCustom model; - @Override - public void renderRing() { - model.renderAllExcept("Crystal", "Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"); - } - - @Override - public void renderGems() { - for(int i = 1; i < 5; i++) - model.renderPart("Ring_Gem0" + i); - } + public ModelPylon() { + model = AdvancedModelLoader.loadModel(new ResourceLocation(LibResources.OBJ_MODEL_PYLON)); + } + + @Override + public void renderCrystal() { + model.renderPart("Crystal"); + } + + @Override + public void renderRing() { + model.renderAllExcept("Crystal", "Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"); + } + + @Override + public void renderGems() { + for(int i = 1; i < 5; i++) + model.renderPart("Ring_Gem0" + i); + } } diff --git a/MODSRC/vazkii/botania/client/model/ModelPylonOld.java b/MODSRC/vazkii/botania/client/model/ModelPylonOld.java index 2e7a68fdf..fcb7e7d25 100644 --- a/MODSRC/vazkii/botania/client/model/ModelPylonOld.java +++ b/MODSRC/vazkii/botania/client/model/ModelPylonOld.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Feb 18, 2014, 10:05:39 PM (GMT)] */ package vazkii.botania.client.model; @@ -16,144 +16,144 @@ import net.minecraft.client.model.ModelRenderer; public class ModelPylonOld extends ModelBase implements IPylonModel { - ModelRenderer crystal1; - ModelRenderer crystal2; - ModelRenderer crystal3; - ModelRenderer crystal4; - ModelRenderer crystal5; - ModelRenderer crystal6; - ModelRenderer crystal7; - ModelRenderer crystal8; - ModelRenderer outside1; - ModelRenderer outside2; - ModelRenderer outside3; - ModelRenderer outside4; - ModelRenderer outside5; - ModelRenderer outside6; - ModelRenderer outside7; - ModelRenderer outside8; + ModelRenderer crystal1; + ModelRenderer crystal2; + ModelRenderer crystal3; + ModelRenderer crystal4; + ModelRenderer crystal5; + ModelRenderer crystal6; + ModelRenderer crystal7; + ModelRenderer crystal8; + ModelRenderer outside1; + ModelRenderer outside2; + ModelRenderer outside3; + ModelRenderer outside4; + ModelRenderer outside5; + ModelRenderer outside6; + ModelRenderer outside7; + ModelRenderer outside8; - public ModelPylonOld() { - textureWidth = 64; - textureHeight = 32; + public ModelPylonOld() { + textureWidth = 64; + textureHeight = 32; - crystal1 = new ModelRenderer(this, 0, 0); - crystal1.addBox(-1.5F, -7F, -1F, 3, 7, 2); - crystal1.setRotationPoint(0F, 23F, 0F); - crystal1.setTextureSize(256, 128); - setRotation(crystal1, 0.1396263F, -0.418879F, 0F); - crystal2 = new ModelRenderer(this, 0, 0); - crystal2.addBox(-1.5F, -7F, -1F, 3, 7, 2); - crystal2.setRotationPoint(0F, 23F, 0F); - crystal2.setTextureSize(256, 128); - setRotation(crystal2, -0.1396263F, 0.418879F, 0F); - crystal3 = new ModelRenderer(this, 0, 0); - crystal3.addBox(-1.5F, -7F, -1F, 3, 7, 2); - crystal3.setRotationPoint(0F, 23F, 0F); - crystal3.setTextureSize(256, 128); - setRotation(crystal3, 0.1396263F, 0.418879F, 0F); - crystal4 = new ModelRenderer(this, 0, 0); - crystal4.addBox(-1.5F, -7F, -1F, 3, 7, 2); - crystal4.setRotationPoint(0F, 23F, 0F); - crystal4.setTextureSize(256, 128); - setRotation(crystal4, -0.1396263F, -0.418879F, 0F); - crystal5 = new ModelRenderer(this, 0, 0); - crystal5.addBox(-1.5F, 0F, -1F, 3, 7, 2); - crystal5.setRotationPoint(0F, 10F, 0F); - crystal5.setTextureSize(256, 128); - setRotation(crystal5, 0.1396263F, 0.418879F, 0F); - crystal6 = new ModelRenderer(this, 0, 0); - crystal6.addBox(-1.5F, 0F, -1F, 3, 7, 2); - crystal6.setRotationPoint(0F, 10F, 0F); - crystal6.setTextureSize(256, 128); - setRotation(crystal6, 0.1396263F, -0.418879F, 0F); - crystal7 = new ModelRenderer(this, 0, 0); - crystal7.addBox(-1.5F, 0F, -1F, 3, 7, 2); - crystal7.setRotationPoint(0F, 10F, 0F); - crystal7.setTextureSize(256, 128); - setRotation(crystal7, -0.1396263F, -0.418879F, 0F); - crystal8 = new ModelRenderer(this, 0, 0); - crystal8.addBox(-1.5F, 0F, -1F, 3, 7, 2); - crystal8.setRotationPoint(0F, 10F, 0F); - crystal8.setTextureSize(256, 128); - setRotation(crystal8, -0.1396263F, 0.418879F, 0F); - outside1 = new ModelRenderer(this, 17, 0); - outside1.addBox(0F, -4F, -1.5F, 1, 8, 3); - outside1.setRotationPoint(4F, 18F, 0F); - outside1.setTextureSize(256, 128); - setRotation(outside1, 0F, 0F, 0.1396263F); - outside2 = new ModelRenderer(this, 17, 0); - outside2.addBox(-1F, -4F, -1.5F, 1, 8, 3); - outside2.setRotationPoint(-4F, 18F, 0F); - outside2.setTextureSize(256, 128); - setRotation(outside2, 0F, 0F, -0.1396263F); - outside3 = new ModelRenderer(this, 26, 0); - outside3.addBox(-1.5F, -3F, -1F, 3, 6, 1); - outside3.setRotationPoint(0F, 18F, -4F); - outside3.setTextureSize(256, 128); - setRotation(outside3, 0.0698132F, 0F, 0F); - outside4 = new ModelRenderer(this, 26, 0); - outside4.addBox(-1.5F, -3F, 0F, 3, 6, 1); - outside4.setRotationPoint(0F, 18F, 4F); - outside4.setTextureSize(256, 128); - setRotation(outside4, -0.0698132F, 0F, 0F); - outside5 = new ModelRenderer(this, 27, 0); - outside5.addBox(0F, 0F, -4F, 1, 2, 8); - outside5.setRotationPoint(3F, 18F, 0F); - outside5.setTextureSize(256, 128); - setRotation(outside5, 0F, 0F, 0F); - outside6 = new ModelRenderer(this, 27, 0); - outside6.addBox(-1F, -1F, -4F, 1, 2, 8); - outside6.setRotationPoint(-3F, 19F, 0F); - outside6.setTextureSize(256, 128); - setRotation(outside6, 0F, 0F, 0F); - outside7 = new ModelRenderer(this, 17, 12); - outside7.addBox(-3F, -1F, 0F, 6, 2, 1); - outside7.setRotationPoint(0F, 19F, 3F); - outside7.setTextureSize(256, 128); - setRotation(outside7, 0F, 0F, 0F); - outside8 = new ModelRenderer(this, 17, 12); - outside8.addBox(-3F, -1F, -1F, 6, 2, 1); - outside8.setRotationPoint(0F, 19F, -3F); - outside8.setTextureSize(256, 128); - setRotation(outside8, 0F, 0F, 0F); - } + crystal1 = new ModelRenderer(this, 0, 0); + crystal1.addBox(-1.5F, -7F, -1F, 3, 7, 2); + crystal1.setRotationPoint(0F, 23F, 0F); + crystal1.setTextureSize(256, 128); + setRotation(crystal1, 0.1396263F, -0.418879F, 0F); + crystal2 = new ModelRenderer(this, 0, 0); + crystal2.addBox(-1.5F, -7F, -1F, 3, 7, 2); + crystal2.setRotationPoint(0F, 23F, 0F); + crystal2.setTextureSize(256, 128); + setRotation(crystal2, -0.1396263F, 0.418879F, 0F); + crystal3 = new ModelRenderer(this, 0, 0); + crystal3.addBox(-1.5F, -7F, -1F, 3, 7, 2); + crystal3.setRotationPoint(0F, 23F, 0F); + crystal3.setTextureSize(256, 128); + setRotation(crystal3, 0.1396263F, 0.418879F, 0F); + crystal4 = new ModelRenderer(this, 0, 0); + crystal4.addBox(-1.5F, -7F, -1F, 3, 7, 2); + crystal4.setRotationPoint(0F, 23F, 0F); + crystal4.setTextureSize(256, 128); + setRotation(crystal4, -0.1396263F, -0.418879F, 0F); + crystal5 = new ModelRenderer(this, 0, 0); + crystal5.addBox(-1.5F, 0F, -1F, 3, 7, 2); + crystal5.setRotationPoint(0F, 10F, 0F); + crystal5.setTextureSize(256, 128); + setRotation(crystal5, 0.1396263F, 0.418879F, 0F); + crystal6 = new ModelRenderer(this, 0, 0); + crystal6.addBox(-1.5F, 0F, -1F, 3, 7, 2); + crystal6.setRotationPoint(0F, 10F, 0F); + crystal6.setTextureSize(256, 128); + setRotation(crystal6, 0.1396263F, -0.418879F, 0F); + crystal7 = new ModelRenderer(this, 0, 0); + crystal7.addBox(-1.5F, 0F, -1F, 3, 7, 2); + crystal7.setRotationPoint(0F, 10F, 0F); + crystal7.setTextureSize(256, 128); + setRotation(crystal7, -0.1396263F, -0.418879F, 0F); + crystal8 = new ModelRenderer(this, 0, 0); + crystal8.addBox(-1.5F, 0F, -1F, 3, 7, 2); + crystal8.setRotationPoint(0F, 10F, 0F); + crystal8.setTextureSize(256, 128); + setRotation(crystal8, -0.1396263F, 0.418879F, 0F); + outside1 = new ModelRenderer(this, 17, 0); + outside1.addBox(0F, -4F, -1.5F, 1, 8, 3); + outside1.setRotationPoint(4F, 18F, 0F); + outside1.setTextureSize(256, 128); + setRotation(outside1, 0F, 0F, 0.1396263F); + outside2 = new ModelRenderer(this, 17, 0); + outside2.addBox(-1F, -4F, -1.5F, 1, 8, 3); + outside2.setRotationPoint(-4F, 18F, 0F); + outside2.setTextureSize(256, 128); + setRotation(outside2, 0F, 0F, -0.1396263F); + outside3 = new ModelRenderer(this, 26, 0); + outside3.addBox(-1.5F, -3F, -1F, 3, 6, 1); + outside3.setRotationPoint(0F, 18F, -4F); + outside3.setTextureSize(256, 128); + setRotation(outside3, 0.0698132F, 0F, 0F); + outside4 = new ModelRenderer(this, 26, 0); + outside4.addBox(-1.5F, -3F, 0F, 3, 6, 1); + outside4.setRotationPoint(0F, 18F, 4F); + outside4.setTextureSize(256, 128); + setRotation(outside4, -0.0698132F, 0F, 0F); + outside5 = new ModelRenderer(this, 27, 0); + outside5.addBox(0F, 0F, -4F, 1, 2, 8); + outside5.setRotationPoint(3F, 18F, 0F); + outside5.setTextureSize(256, 128); + setRotation(outside5, 0F, 0F, 0F); + outside6 = new ModelRenderer(this, 27, 0); + outside6.addBox(-1F, -1F, -4F, 1, 2, 8); + outside6.setRotationPoint(-3F, 19F, 0F); + outside6.setTextureSize(256, 128); + setRotation(outside6, 0F, 0F, 0F); + outside7 = new ModelRenderer(this, 17, 12); + outside7.addBox(-3F, -1F, 0F, 6, 2, 1); + outside7.setRotationPoint(0F, 19F, 3F); + outside7.setTextureSize(256, 128); + setRotation(outside7, 0F, 0F, 0F); + outside8 = new ModelRenderer(this, 17, 12); + outside8.addBox(-3F, -1F, -1F, 6, 2, 1); + outside8.setRotationPoint(0F, 19F, -3F); + outside8.setTextureSize(256, 128); + setRotation(outside8, 0F, 0F, 0F); + } - @Override - public void renderCrystal() { - float f = 1F / 16F; - crystal1.render(f); - crystal2.render(f); - crystal3.render(f); - crystal4.render(f); - crystal5.render(f); - crystal6.render(f); - crystal7.render(f); - crystal8.render(f); - } + @Override + public void renderCrystal() { + float f = 1F / 16F; + crystal1.render(f); + crystal2.render(f); + crystal3.render(f); + crystal4.render(f); + crystal5.render(f); + crystal6.render(f); + crystal7.render(f); + crystal8.render(f); + } - @Override - public void renderRing() { - float f = 1F / 16F; - outside1.render(f); - outside2.render(f); - outside3.render(f); - outside4.render(f); - outside5.render(f); - outside6.render(f); - outside7.render(f); - outside8.render(f); - } + @Override + public void renderRing() { + float f = 1F / 16F; + outside1.render(f); + outside2.render(f); + outside3.render(f); + outside4.render(f); + outside5.render(f); + outside6.render(f); + outside7.render(f); + outside8.render(f); + } - private void setRotation(ModelRenderer model, float x, float y, float z) { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } - @Override - public void renderGems() { - // NO-OP - } + @Override + public void renderGems() { + // NO-OP + } } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/client/model/ModelSpinningCubes.java b/MODSRC/vazkii/botania/client/model/ModelSpinningCubes.java index 4e573d3a3..9b4c3cbde 100644 --- a/MODSRC/vazkii/botania/client/model/ModelSpinningCubes.java +++ b/MODSRC/vazkii/botania/client/model/ModelSpinningCubes.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Feb 2, 2014, 6:37:00 PM (GMT)] */ package vazkii.botania.client.model; @@ -15,74 +15,71 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.OpenGlHelper; - import org.lwjgl.opengl.GL11; public class ModelSpinningCubes extends ModelBase { - ModelRenderer spinningCube; + ModelRenderer spinningCube; - public ModelSpinningCubes() { - spinningCube = new ModelRenderer(this, 42, 0); - spinningCube.addBox(0F, 0F, 0F, 1, 1, 1); - spinningCube.setRotationPoint(0F, 0F, 0F); - spinningCube.setTextureSize(64, 64); - } + public ModelSpinningCubes() { + spinningCube = new ModelRenderer(this, 42, 0); + spinningCube.addBox(0F, 0F, 0F, 1, 1, 1); + spinningCube.setRotationPoint(0F, 0F, 0F); + spinningCube.setTextureSize(64, 64); + } - public void renderSpinningCubes(int cubes, int repeat, int origRepeat) { - GL11.glDisable(GL11.GL_TEXTURE_2D); + public void renderSpinningCubes(int cubes, int repeat, int origRepeat) { + GL11.glDisable(GL11.GL_TEXTURE_2D); - final float modifier = 6F; - final float rotationModifier = 0.2F; - final float radiusBase = 0.35F; - final float radiusMod = 0.05F; + final float modifier = 6F; + final float rotationModifier = 0.2F; + final float radiusBase = 0.35F; + final float radiusMod = 0.05F; - double ticks = Minecraft.getMinecraft().thePlayer.ticksExisted - 1.3 * (origRepeat - repeat); - float offsetPerCube = 360 / cubes; + double ticks = Minecraft.getMinecraft().thePlayer.ticksExisted - 1.3 * (origRepeat - repeat); + float offsetPerCube = 360 / cubes; - GL11.glPushMatrix(); - GL11.glTranslatef(-0.025F, 0.85F, -0.025F); - for(int i = 0; i < cubes; i++) { - float offset = offsetPerCube * i; - float deg = (int) (ticks / rotationModifier % 360F + offset); - float rad = deg * (float) Math.PI / 180F; - float radiusX = (float) (radiusBase + radiusMod * Math.sin(ticks / modifier)); - float radiusZ = (float) (radiusBase + radiusMod * Math.cos(ticks / modifier)); - float x = (float) (radiusX * Math.cos(rad)); - float z = (float) (radiusZ * Math.sin(rad)); - float y = (float) Math.cos((ticks + 50 * i) / 5F) / 10F; + GL11.glPushMatrix(); + GL11.glTranslatef(-0.025F, 0.85F, -0.025F); + for(int i = 0; i < cubes; i++) { + float offset = offsetPerCube * i; + float deg = (int) (ticks / rotationModifier % 360F + offset); + float rad = deg * (float) Math.PI / 180F; + float radiusX = (float) (radiusBase + radiusMod * Math.sin(ticks / modifier)); + float radiusZ = (float) (radiusBase + radiusMod * Math.cos(ticks / modifier)); + float x = (float) (radiusX * Math.cos(rad)); + float z = (float) (radiusZ * Math.sin(rad)); + float y = (float) Math.cos((ticks + 50 * i) / 5F) / 10F; - GL11.glPushMatrix(); - GL11.glTranslatef(x, y, z); - float xRotate = (float) Math.sin(ticks * rotationModifier) / 2F; - float yRotate = (float) Math.max(0.6F, Math.sin(ticks * 0.1F) / 2F + 0.5F); - float zRotate = (float) Math.cos(ticks * rotationModifier) / 2F; + GL11.glPushMatrix(); + GL11.glTranslatef(x, y, z); + float xRotate = (float) Math.sin(ticks * rotationModifier) / 2F; + float yRotate = (float) Math.max(0.6F, Math.sin(ticks * 0.1F) / 2F + 0.5F); + float zRotate = (float) Math.cos(ticks * rotationModifier) / 2F; - GL11.glRotatef(deg, xRotate, yRotate, zRotate); - if(repeat < origRepeat) { - GL11.glColor4f(1F, 1F, 1F, 0.2F); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - } else GL11.glColor4f(1F, 1F, 1F, 1F); + GL11.glRotatef(deg, xRotate, yRotate, zRotate); + if(repeat < origRepeat) { + GL11.glColor4f(1F, 1F, 1F, 0.2F); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + } else GL11.glColor4f(1F, 1F, 1F, 1F); - int light = 15728880; - int lightmapX = light % 65536; - int lightmapY = light / 65536; + int light = 15728880; + int lightmapX = light % 65536; + int lightmapY = light / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY); - spinningCube.render(1F / 16F); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY); + spinningCube.render(1F / 16F); - if(repeat < origRepeat) - GL11.glDisable(GL11.GL_BLEND); + if(repeat < origRepeat) GL11.glDisable(GL11.GL_BLEND); - GL11.glPopMatrix(); - } - GL11.glPopMatrix(); + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); - GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_TEXTURE_2D); - if(repeat != 0) - renderSpinningCubes(cubes, repeat - 1, origRepeat); - } + if(repeat != 0) renderSpinningCubes(cubes, repeat - 1, origRepeat); + } } diff --git a/MODSRC/vazkii/botania/client/model/ModelSpreader.java b/MODSRC/vazkii/botania/client/model/ModelSpreader.java index 8ac352ca3..1431bff1b 100644 --- a/MODSRC/vazkii/botania/client/model/ModelSpreader.java +++ b/MODSRC/vazkii/botania/client/model/ModelSpreader.java @@ -2,11 +2,11 @@ * This class was created by . 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 25, 2014, 1:55:05 PM (GMT)] */ package vazkii.botania.client.model; @@ -16,74 +16,74 @@ import net.minecraft.client.model.ModelRenderer; public class ModelSpreader extends ModelBase { - ModelRenderer cubeSide1; - ModelRenderer cubeSide2; - ModelRenderer cubeSide3; - ModelRenderer cubeSide4; - ModelRenderer cubeSide5; - ModelRenderer cubeHole1; - ModelRenderer cubeHole2; - ModelRenderer cubeHole3; - ModelRenderer cubeHole4; - ModelRenderer cubeInside; + ModelRenderer cubeSide1; + ModelRenderer cubeSide2; + ModelRenderer cubeSide3; + ModelRenderer cubeSide4; + ModelRenderer cubeSide5; + ModelRenderer cubeHole1; + ModelRenderer cubeHole2; + ModelRenderer cubeHole3; + ModelRenderer cubeHole4; + ModelRenderer cubeInside; - public ModelSpreader() { - textureWidth = 64; - textureHeight = 32; + public ModelSpreader() { + textureWidth = 64; + textureHeight = 32; - cubeSide1 = new ModelRenderer(this, 0, 0); - cubeSide1.addBox(0F, 0F, 0F, 14, 1, 14); - cubeSide1.setRotationPoint(-7F, 22F, -7F); - cubeSide1.setTextureSize(64, 32); - cubeSide2 = new ModelRenderer(this, 0, 0); - cubeSide2.addBox(0F, 0F, 0F, 14, 13, 1); - cubeSide2.setRotationPoint(-7F, 9F, -7F); - cubeSide2.setTextureSize(64, 32); - cubeSide3 = new ModelRenderer(this, 0, 0); - cubeSide3.addBox(0F, 0F, 0F, 1, 13, 13); - cubeSide3.setRotationPoint(-7F, 9F, -6F); - cubeSide3.setTextureSize(64, 32); - cubeSide4 = new ModelRenderer(this, 0, 0); - cubeSide4.addBox(0F, 0F, 0F, 1, 13, 13); - cubeSide4.setRotationPoint(6F, 9F, -6F); - cubeSide4.setTextureSize(64, 32); - cubeSide5 = new ModelRenderer(this, 0, 0); - cubeSide5.addBox(0F, 0F, 0F, 12, 1, 13); - cubeSide5.setRotationPoint(-6F, 9F, -6F); - cubeSide5.setTextureSize(64, 32); - cubeHole1 = new ModelRenderer(this, 0, 0); - cubeHole1.addBox(0F, 0F, 0F, 4, 12, 1); - cubeHole1.setRotationPoint(2F, 10F, 6F); - cubeHole1.setTextureSize(64, 32); - cubeHole2 = new ModelRenderer(this, 0, 0); - cubeHole2.addBox(0F, 0F, 0F, 4, 12, 1); - cubeHole2.setRotationPoint(-6F, 10F, 6F); - cubeHole2.setTextureSize(64, 32); - cubeHole3 = new ModelRenderer(this, 0, 0); - cubeHole3.addBox(0F, 0F, 0F, 4, 4, 1); - cubeHole3.setRotationPoint(-2F, 18F, 6F); - cubeHole3.setTextureSize(64, 32); - cubeHole4 = new ModelRenderer(this, 0, 0); - cubeHole4.addBox(0F, 0F, 0F, 4, 4, 1); - cubeHole4.setRotationPoint(-2F, 10F, 6F); - cubeHole4.setTextureSize(64, 32); - cubeInside = new ModelRenderer(this, 30, 17); - cubeInside.addBox(0F, 0F, 0F, 6, 6, 6); - cubeInside.setRotationPoint(-3F, 13F, -3F); - cubeInside.setTextureSize(64, 32); - } + cubeSide1 = new ModelRenderer(this, 0, 0); + cubeSide1.addBox(0F, 0F, 0F, 14, 1, 14); + cubeSide1.setRotationPoint(-7F, 22F, -7F); + cubeSide1.setTextureSize(64, 32); + cubeSide2 = new ModelRenderer(this, 0, 0); + cubeSide2.addBox(0F, 0F, 0F, 14, 13, 1); + cubeSide2.setRotationPoint(-7F, 9F, -7F); + cubeSide2.setTextureSize(64, 32); + cubeSide3 = new ModelRenderer(this, 0, 0); + cubeSide3.addBox(0F, 0F, 0F, 1, 13, 13); + cubeSide3.setRotationPoint(-7F, 9F, -6F); + cubeSide3.setTextureSize(64, 32); + cubeSide4 = new ModelRenderer(this, 0, 0); + cubeSide4.addBox(0F, 0F, 0F, 1, 13, 13); + cubeSide4.setRotationPoint(6F, 9F, -6F); + cubeSide4.setTextureSize(64, 32); + cubeSide5 = new ModelRenderer(this, 0, 0); + cubeSide5.addBox(0F, 0F, 0F, 12, 1, 13); + cubeSide5.setRotationPoint(-6F, 9F, -6F); + cubeSide5.setTextureSize(64, 32); + cubeHole1 = new ModelRenderer(this, 0, 0); + cubeHole1.addBox(0F, 0F, 0F, 4, 12, 1); + cubeHole1.setRotationPoint(2F, 10F, 6F); + cubeHole1.setTextureSize(64, 32); + cubeHole2 = new ModelRenderer(this, 0, 0); + cubeHole2.addBox(0F, 0F, 0F, 4, 12, 1); + cubeHole2.setRotationPoint(-6F, 10F, 6F); + cubeHole2.setTextureSize(64, 32); + cubeHole3 = new ModelRenderer(this, 0, 0); + cubeHole3.addBox(0F, 0F, 0F, 4, 4, 1); + cubeHole3.setRotationPoint(-2F, 18F, 6F); + cubeHole3.setTextureSize(64, 32); + cubeHole4 = new ModelRenderer(this, 0, 0); + cubeHole4.addBox(0F, 0F, 0F, 4, 4, 1); + cubeHole4.setRotationPoint(-2F, 10F, 6F); + cubeHole4.setTextureSize(64, 32); + cubeInside = new ModelRenderer(this, 30, 17); + cubeInside.addBox(0F, 0F, 0F, 6, 6, 6); + cubeInside.setRotationPoint(-3F, 13F, -3F); + cubeInside.setTextureSize(64, 32); + } - public void render() { - float f = 1F / 16F; - cubeSide1.render(f); - cubeSide2.render(f); - cubeSide3.render(f); - cubeSide4.render(f); - cubeSide5.render(f); - cubeHole1.render(f); - cubeHole2.render(f); - cubeHole3.render(f); - cubeHole4.render(f); - cubeInside.render(f); - } + public void render() { + float f = 1F / 16F; + cubeSide1.render(f); + cubeSide2.render(f); + cubeSide3.render(f); + cubeSide4.render(f); + cubeSide5.render(f); + cubeHole1.render(f); + cubeHole2.render(f); + cubeHole3.render(f); + cubeHole4.render(f); + cubeInside.render(f); + } } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/client/render/block/RenderAltar.java b/MODSRC/vazkii/botania/client/render/block/RenderAltar.java index 16671e271..59037b591 100644 --- a/MODSRC/vazkii/botania/client/render/block/RenderAltar.java +++ b/MODSRC/vazkii/botania/client/render/block/RenderAltar.java @@ -2,49 +2,47 @@ * This class was created by . 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 21, 2014, 8:02:01 PM (GMT)] */ package vazkii.botania.client.render.block; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; - import org.lwjgl.opengl.GL11; - import vazkii.botania.client.lib.LibRenderIDs; import vazkii.botania.common.block.tile.TileAltar; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; public class RenderAltar implements ISimpleBlockRenderingHandler { - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.6F, -0.5F); - GL11.glScalef(0.9F, 0.9F, 0.9F); - TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileAltar(), 0.0D, 0.0D, 0.0D, 0.0F); - GL11.glPopMatrix(); - } + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.6F, -0.5F); + GL11.glScalef(0.9F, 0.9F, 0.9F); + TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileAltar(), 0.0D, 0.0D, 0.0D, 0.0F); + GL11.glPopMatrix(); + } - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + return false; + } - @Override - public int getRenderId() { - return LibRenderIDs.idAltar; - } + @Override + public int getRenderId() { + return LibRenderIDs.idAltar; + } - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/MODSRC/vazkii/botania/client/render/block/RenderPool.java b/MODSRC/vazkii/botania/client/render/block/RenderPool.java index e65e6e8cd..9b747b9fd 100644 --- a/MODSRC/vazkii/botania/client/render/block/RenderPool.java +++ b/MODSRC/vazkii/botania/client/render/block/RenderPool.java @@ -2,49 +2,47 @@ * This class was created by . 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 26, 2014, 12:25:06 AM (GMT)] */ package vazkii.botania.client.render.block; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; - import org.lwjgl.opengl.GL11; - import vazkii.botania.client.lib.LibRenderIDs; import vazkii.botania.common.block.tile.TilePool; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; public class RenderPool implements ISimpleBlockRenderingHandler { - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - TileEntityRendererDispatcher.instance.renderTileEntityAt(new TilePool(), 0.0D, 0.0D, 0.0D, 0.0F); - GL11.glPopMatrix(); - } + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + TileEntityRendererDispatcher.instance.renderTileEntityAt(new TilePool(), 0.0D, 0.0D, 0.0D, 0.0F); + GL11.glPopMatrix(); + } - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + return false; + } - @Override - public int getRenderId() { - return LibRenderIDs.idPool; - } + @Override + public int getRenderId() { + return LibRenderIDs.idPool; + } - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/MODSRC/vazkii/botania/client/render/block/RenderPylon.java b/MODSRC/vazkii/botania/client/render/block/RenderPylon.java index 9f4831e2f..a423ca772 100644 --- a/MODSRC/vazkii/botania/client/render/block/RenderPylon.java +++ b/MODSRC/vazkii/botania/client/render/block/RenderPylon.java @@ -2,49 +2,47 @@ * This class was created by . 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 @ [Feb 18, 2014, 10:20:06 PM (GMT)] */ package vazkii.botania.client.render.block; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; - import org.lwjgl.opengl.GL11; - import vazkii.botania.client.lib.LibRenderIDs; import vazkii.botania.common.block.tile.TilePylon; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; public class RenderPylon implements ISimpleBlockRenderingHandler { - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.7F, -0.5F); - TileEntityRendererDispatcher.instance.renderTileEntityAt(new TilePylon(), 0.0D, 0.0D, 0.0D, 0.0F); - GL11.glPopMatrix(); - } + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.7F, -0.5F); + TileEntityRendererDispatcher.instance.renderTileEntityAt(new TilePylon(), 0.0D, 0.0D, 0.0D, 0.0F); + GL11.glPopMatrix(); + } - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + return false; + } - @Override - public int getRenderId() { - return LibRenderIDs.idPylon; - } + @Override + public int getRenderId() { + return LibRenderIDs.idPylon; + } - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/MODSRC/vazkii/botania/client/render/block/RenderSpecialFlower.java b/MODSRC/vazkii/botania/client/render/block/RenderSpecialFlower.java index 5213cf175..af02921e7 100644 --- a/MODSRC/vazkii/botania/client/render/block/RenderSpecialFlower.java +++ b/MODSRC/vazkii/botania/client/render/block/RenderSpecialFlower.java @@ -2,112 +2,112 @@ * This class was created by . 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 25, 2014, 4:15:46 PM (GMT)] */ package vazkii.botania.client.render.block; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; public class RenderSpecialFlower implements ISimpleBlockRenderingHandler { - int id; + int id; - public RenderSpecialFlower(int id) { - this.id = id; - } + public RenderSpecialFlower(int id) { + this.id = id; + } - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - // NO-OP - } + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + // NO-OP + } - @Override - public boolean renderWorldBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return renderCrossedSquares(blockAccess, block, x, y, z, renderer); - } + @Override + public boolean renderWorldBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + return renderCrossedSquares(blockAccess, block, x, y, z, renderer); + } - // Copied from RenderBlocks - public boolean renderCrossedSquares(IBlockAccess blockAccess, Block par1Block, int par2, int par3, int par4, RenderBlocks render) { - Tessellator tessellator = Tessellator.instance; - tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(blockAccess, par2, par3, par4)); - float f = 1.0F; - int l = par1Block.colorMultiplier(blockAccess, par2, par3, par4); - float f1 = (l >> 16 & 255) / 255.0F; - float f2 = (l >> 8 & 255) / 255.0F; - float f3 = (l & 255) / 255.0F; + // Copied from RenderBlocks + public boolean renderCrossedSquares(IBlockAccess blockAccess, Block par1Block, int par2, int par3, int par4, RenderBlocks render) { + Tessellator tessellator = Tessellator.instance; + tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(blockAccess, par2, par3, par4)); + float f = 1.0F; + int l = par1Block.colorMultiplier(blockAccess, par2, par3, par4); + float f1 = (l >> 16 & 255) / 255.0F; + float f2 = (l >> 8 & 255) / 255.0F; + float f3 = (l & 255) / 255.0F; - if(EntityRenderer.anaglyphEnable) { - float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F; - float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F; - float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F; - f1 = f4; - f2 = f5; - f3 = f6; - } + if(EntityRenderer.anaglyphEnable) { + float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F; + float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F; + float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F; + f1 = f4; + f2 = f5; + f3 = f6; + } - tessellator.setColorOpaque_F(f * f1, f * f2, f * f3); - double d0 = par2; - double d1 = par3; - double d2 = par4; + tessellator.setColorOpaque_F(f * f1, f * f2, f * f3); + double d0 = par2; + double d1 = par3; + double d2 = par4; - drawCrossedSquares(blockAccess, par1Block, par2, par3, par4, d0, d1, d2, 1.0F, render); + drawCrossedSquares(blockAccess, par1Block, par2, par3, par4, d0, d1, d2, 1.0F, render); - return true; - } + return true; + } - // Copied from RenderBlocks - public void drawCrossedSquares(IBlockAccess blockAccess, Block par1Block, int x, int y, int z, double par3, double par5, double par7, float par9, RenderBlocks render) { - Tessellator tessellator = Tessellator.instance; + // Copied from RenderBlocks + public void drawCrossedSquares(IBlockAccess blockAccess, Block par1Block, int x, int y, int z, double par3, double par5, double par7, float par9, RenderBlocks render) { + Tessellator tessellator = Tessellator.instance; - // Only change here, to use xyz rather than side/meta - IIcon icon = render.getBlockIcon(par1Block, blockAccess, x, y, z, 0); + // Only change here, to use xyz rather than side/meta + IIcon icon = render.getBlockIcon(par1Block, blockAccess, x, y, z, 0); - double d3 = icon.getMinU(); - double d4 = icon.getMinV(); - double d5 = icon.getMaxU(); - double d6 = icon.getMaxV(); - double d7 = 0.45D * par9; - double d8 = par3 + 0.5D - d7; - double d9 = par3 + 0.5D + d7; - double d10 = par7 + 0.5D - d7; - double d11 = par7 + 0.5D + d7; - tessellator.addVertexWithUV(d8, par5 + par9, d10, d3, d4); - tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d3, d6); - tessellator.addVertexWithUV(d9, par5 + 0.0D, d11, d5, d6); - tessellator.addVertexWithUV(d9, par5 + par9, d11, d5, d4); - tessellator.addVertexWithUV(d9, par5 + par9, d11, d3, d4); - tessellator.addVertexWithUV(d9, par5 + 0.0D, d11, d3, d6); - tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d5, d6); - tessellator.addVertexWithUV(d8, par5 + par9, d10, d5, d4); - tessellator.addVertexWithUV(d8, par5 + par9, d11, d3, d4); - tessellator.addVertexWithUV(d8, par5 + 0.0D, d11, d3, d6); - tessellator.addVertexWithUV(d9, par5 + 0.0D, d10, d5, d6); - tessellator.addVertexWithUV(d9, par5 + par9, d10, d5, d4); - tessellator.addVertexWithUV(d9, par5 + par9, d10, d3, d4); - tessellator.addVertexWithUV(d9, par5 + 0.0D, d10, d3, d6); - tessellator.addVertexWithUV(d8, par5 + 0.0D, d11, d5, d6); - tessellator.addVertexWithUV(d8, par5 + par9, d11, d5, d4); - } + double d3 = icon.getMinU(); + double d4 = icon.getMinV(); + double d5 = icon.getMaxU(); + double d6 = icon.getMaxV(); + double d7 = 0.45D * par9; + double d8 = par3 + 0.5D - d7; + double d9 = par3 + 0.5D + d7; + double d10 = par7 + 0.5D - d7; + double d11 = par7 + 0.5D + d7; + tessellator.addVertexWithUV(d8, par5 + par9, d10, d3, d4); + tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d3, d6); + tessellator.addVertexWithUV(d9, par5 + 0.0D, d11, d5, d6); + tessellator.addVertexWithUV(d9, par5 + par9, d11, d5, d4); + tessellator.addVertexWithUV(d9, par5 + par9, d11, d3, d4); + tessellator.addVertexWithUV(d9, par5 + 0.0D, d11, d3, d6); + tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d5, d6); + tessellator.addVertexWithUV(d8, par5 + par9, d10, d5, d4); + tessellator.addVertexWithUV(d8, par5 + par9, d11, d3, d4); + tessellator.addVertexWithUV(d8, par5 + 0.0D, d11, d3, d6); + tessellator.addVertexWithUV(d9, par5 + 0.0D, d10, d5, d6); + tessellator.addVertexWithUV(d9, par5 + par9, d10, d5, d4); + tessellator.addVertexWithUV(d9, par5 + par9, d10, d3, d4); + tessellator.addVertexWithUV(d9, par5 + 0.0D, d10, d3, d6); + tessellator.addVertexWithUV(d8, par5 + 0.0D, d11, d5, d6); + tessellator.addVertexWithUV(d8, par5 + par9, d11, d5, d4); + } - @Override - public int getRenderId() { - return id; - } + @Override + public int getRenderId() { + return id; + } - @Override - public boolean shouldRender3DInInventory(int modelId) { - return false; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return false; + } } diff --git a/MODSRC/vazkii/botania/client/render/block/RenderSpreader.java b/MODSRC/vazkii/botania/client/render/block/RenderSpreader.java index 827fba9b3..f13c10264 100644 --- a/MODSRC/vazkii/botania/client/render/block/RenderSpreader.java +++ b/MODSRC/vazkii/botania/client/render/block/RenderSpreader.java @@ -2,52 +2,50 @@ * This class was created by . 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 25, 2014, 9:45:58 PM (GMT)] */ package vazkii.botania.client.render.block; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; - import org.lwjgl.opengl.GL11; - import vazkii.botania.client.lib.LibRenderIDs; import vazkii.botania.common.block.tile.TileSpreader; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; public class RenderSpreader implements ISimpleBlockRenderingHandler { - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - TileSpreader.staticRedstone = (metadata & 1) == 1; - TileSpreader spreader = new TileSpreader(); - spreader.rotationX = -180F; - TileEntityRendererDispatcher.instance.renderTileEntityAt(spreader, 0.0D, 0.0D, 0.0D, 0.0F); - GL11.glPopMatrix(); - } + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + TileSpreader.staticRedstone = (metadata & 1) == 1; + TileSpreader spreader = new TileSpreader(); + spreader.rotationX = -180F; + TileEntityRendererDispatcher.instance.renderTileEntityAt(spreader, 0.0D, 0.0D, 0.0D, 0.0F); + GL11.glPopMatrix(); + } - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + return false; + } - @Override - public int getRenderId() { - return LibRenderIDs.idSpreader; - } + @Override + public int getRenderId() { + return LibRenderIDs.idSpreader; + } - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/MODSRC/vazkii/botania/client/render/item/RenderLens.java b/MODSRC/vazkii/botania/client/render/item/RenderLens.java index 7e08965c1..c420a7ee0 100644 --- a/MODSRC/vazkii/botania/client/render/item/RenderLens.java +++ b/MODSRC/vazkii/botania/client/render/item/RenderLens.java @@ -2,120 +2,117 @@ * This class was created by . 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 31, 2014, 3:08:00 PM (GMT)] */ package vazkii.botania.client.render.item; -import java.awt.Color; - import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraftforge.client.IItemRenderer; - import org.lwjgl.opengl.GL11; - import vazkii.botania.api.mana.ILens; import vazkii.botania.common.item.ItemLens; +import java.awt.*; + public class RenderLens implements IItemRenderer { - static RenderItem render = new RenderItem(); - ItemRenderer renderer = new ItemRenderer(Minecraft.getMinecraft()); + static RenderItem render = new RenderItem(); + ItemRenderer renderer = new ItemRenderer(Minecraft.getMinecraft()); - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return type != ItemRenderType.INVENTORY; - } + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return type != ItemRenderType.INVENTORY; + } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING; - } + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING; + } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - switch(type) { - case ENTITY : { - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, 0F, 0F); - render(item); - GL11.glPopMatrix(); - break; - } - case EQUIPPED : { - render(item); - break; - } - case EQUIPPED_FIRST_PERSON : { - render(item); - break; - } - default : break; - } - } + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + switch(type) { + case ENTITY: { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, 0F, 0F); + render(item); + GL11.glPopMatrix(); + break; + } + case EQUIPPED: { + render(item); + break; + } + case EQUIPPED_FIRST_PERSON: { + render(item); + break; + } + default: + break; + } + } - public static void render(ItemStack item) { - Color color = new Color(((ILens) item.getItem()).getLensColor(item)); - render(item, color.getRGB()); - } + public static void render(ItemStack item) { + Color color = new Color(((ILens) item.getItem()).getLensColor(item)); + render(item, color.getRGB()); + } - public static void render(ItemStack item, int color_) { - int dmg = item.getItemDamage(); - IIcon icon = item.getItem().getIconFromDamageForRenderPass(dmg, 1); - float f = icon.getMinU(); - float f1 = icon.getMaxU(); - float f2 = icon.getMinV(); - float f3 = icon.getMaxV(); - float scale = 1F / 16F; + public static void render(ItemStack item, int color_) { + int dmg = item.getItemDamage(); + IIcon icon = item.getItem().getIconFromDamageForRenderPass(dmg, 1); + float f = icon.getMinU(); + float f1 = icon.getMaxU(); + float f2 = icon.getMinV(); + float f3 = icon.getMaxV(); + float scale = 1F / 16F; - GL11.glColor4f(1F, 1F, 1F, 1F); - ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), scale); + GL11.glColor4f(1F, 1F, 1F, 1F); + ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), scale); - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - Color color = new Color(color_); - GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) 255); + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + Color color = new Color(color_); + GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) 255); - boolean shiny = ItemLens.getStoredColor(item) != -1; - icon = ItemLens.iconGlass; - GL11.glScalef(scale, scale, scale); - GL11.glTranslatef(0F, 0F, -0.5F); - renderShinyLensIcon(icon, shiny); - GL11.glRotatef(180F, 0F, 1F, 0F); - GL11.glTranslatef(-16F, 0F, 0F); - renderShinyLensIcon(icon, shiny); - GL11.glDisable(GL11.GL_BLEND); - GL11.glPopMatrix(); + boolean shiny = ItemLens.getStoredColor(item) != -1; + icon = ItemLens.iconGlass; + GL11.glScalef(scale, scale, scale); + GL11.glTranslatef(0F, 0F, -0.5F); + renderShinyLensIcon(icon, shiny); + GL11.glRotatef(180F, 0F, 1F, 0F); + GL11.glTranslatef(-16F, 0F, 0F); + renderShinyLensIcon(icon, shiny); + GL11.glDisable(GL11.GL_BLEND); + GL11.glPopMatrix(); - GL11.glColor4f(1F, 1F, 1F, 1F); - } + GL11.glColor4f(1F, 1F, 1F, 1F); + } - public static void renderShinyLensIcon(IIcon icon, boolean shiny) { - float par1 = 0; - float par2 = 0; - float par4 = 16; - float par5 = 16; - float zLevel = 0F; - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - if(shiny) - tessellator.setBrightness(240); - tessellator.addVertexWithUV(par1 + 0, par2 + par5, zLevel, icon.getMinU(), icon.getMaxV()); - tessellator.addVertexWithUV(par1 + par4, par2 + par5, zLevel, icon.getMaxU(), icon.getMaxV()); - tessellator.addVertexWithUV(par1 + par4, par2 + 0, zLevel, icon.getMaxU(), icon.getMinV()); - tessellator.addVertexWithUV(par1 + 0, par2 + 0, zLevel, icon.getMinU(), icon.getMinV()); - tessellator.draw(); - } + public static void renderShinyLensIcon(IIcon icon, boolean shiny) { + float par1 = 0; + float par2 = 0; + float par4 = 16; + float par5 = 16; + float zLevel = 0F; + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + if(shiny) tessellator.setBrightness(240); + tessellator.addVertexWithUV(par1 + 0, par2 + par5, zLevel, icon.getMinU(), icon.getMaxV()); + tessellator.addVertexWithUV(par1 + par4, par2 + par5, zLevel, icon.getMaxU(), icon.getMaxV()); + tessellator.addVertexWithUV(par1 + par4, par2 + 0, zLevel, icon.getMaxU(), icon.getMinV()); + tessellator.addVertexWithUV(par1 + 0, par2 + 0, zLevel, icon.getMinU(), icon.getMinV()); + tessellator.draw(); + } } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/client/render/item/RenderLexicon.java b/MODSRC/vazkii/botania/client/render/item/RenderLexicon.java index d9f937b23..dad76a879 100644 --- a/MODSRC/vazkii/botania/client/render/item/RenderLexicon.java +++ b/MODSRC/vazkii/botania/client/render/item/RenderLexicon.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 25, 2014, 8:49:01 PM (GMT)] */ package vazkii.botania.client.render.item; @@ -16,46 +16,44 @@ import net.minecraft.client.model.ModelBook; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; - import org.lwjgl.opengl.GL11; - import vazkii.botania.client.core.handler.ClientTickHandler; import vazkii.botania.client.lib.LibResources; public class RenderLexicon implements IItemRenderer { - ModelBook model = new ModelBook(); - ResourceLocation texture = new ResourceLocation(LibResources.MODEL_LEXICA); + ModelBook model = new ModelBook(); + ResourceLocation texture = new ResourceLocation(LibResources.MODEL_LEXICA); - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return type == ItemRenderType.EQUIPPED_FIRST_PERSON; - } + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return type == ItemRenderType.EQUIPPED_FIRST_PERSON; + } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return false; - } + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return false; + } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - GL11.glPushMatrix(); - Minecraft mc = Minecraft.getMinecraft(); - mc.renderEngine.bindTexture(texture); - float opening = 0F; - float pageFlip = 0F; + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + GL11.glPushMatrix(); + Minecraft mc = Minecraft.getMinecraft(); + mc.renderEngine.bindTexture(texture); + float opening = 0F; + float pageFlip = 0F; - int ticks = ClientTickHandler.ticksWithLexicaOpen; - GL11.glTranslatef(0.3F + 0.02F * ticks, 0.475F + 0.01F * ticks, -0.2F - 0.01F * ticks); - GL11.glRotatef(95F + ticks * 5, 0F, 1F, 0F); - GL11.glRotatef(ticks * 2.5F, 0F, 0F, 1F); - GL11.glScalef(0.9F, 0.9F, 0.9F); - opening = ticks / 12F; - pageFlip = ClientTickHandler.pageFlipTicks / 5F; + int ticks = ClientTickHandler.ticksWithLexicaOpen; + GL11.glTranslatef(0.3F + 0.02F * ticks, 0.475F + 0.01F * ticks, -0.2F - 0.01F * ticks); + GL11.glRotatef(95F + ticks * 5, 0F, 1F, 0F); + GL11.glRotatef(ticks * 2.5F, 0F, 0F, 1F); + GL11.glScalef(0.9F, 0.9F, 0.9F); + opening = ticks / 12F; + pageFlip = ClientTickHandler.pageFlipTicks / 5F; - model.render(null, 0F, 0F, pageFlip, opening, 0F, 1F / 16F); + model.render(null, 0F, 0F, pageFlip, opening, 0F, 1F / 16F); - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } } diff --git a/MODSRC/vazkii/botania/client/render/tile/RenderTileAltar.java b/MODSRC/vazkii/botania/client/render/tile/RenderTileAltar.java index b51843f65..177b7b101 100644 --- a/MODSRC/vazkii/botania/client/render/tile/RenderTileAltar.java +++ b/MODSRC/vazkii/botania/client/render/tile/RenderTileAltar.java @@ -2,18 +2,15 @@ * This class was created by . 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 21, 2014, 7:55:47 PM (GMT)] */ package vazkii.botania.client.render.tile; -import java.awt.Color; - -import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; @@ -25,118 +22,117 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; - import vazkii.botania.client.lib.LibResources; import vazkii.botania.client.model.ModelAltar; import vazkii.botania.common.block.tile.TileAltar; +import java.awt.*; + public class RenderTileAltar extends TileEntitySpecialRenderer { - private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_ALTAR); - ModelAltar model = new ModelAltar(); - RenderItem renderItem = new RenderItem(); + private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_ALTAR); + ModelAltar model = new ModelAltar(); + RenderItem renderItem = new RenderItem(); - @Override - public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) { - TileAltar altar = (TileAltar) tileentity; + @Override + public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) { + TileAltar altar = (TileAltar) tileentity; - GL11.glPushMatrix(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glColor4f(1F, 1F, 1F, 1F); - Minecraft.getMinecraft().renderEngine.bindTexture(texture); + GL11.glPushMatrix(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glColor4f(1F, 1F, 1F, 1F); + Minecraft.getMinecraft().renderEngine.bindTexture(texture); - GL11.glTranslated(d0 + 0.5, d1 + 1.5, d2 + 0.5); - GL11.glScalef(1F, -1F, -1F); - model.render(); - GL11.glScalef(1F, -1F, -1F); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glTranslated(d0 + 0.5, d1 + 1.5, d2 + 0.5); + GL11.glScalef(1F, -1F, -1F); + model.render(); + GL11.glScalef(1F, -1F, -1F); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); - if(altar.hasWater) { - GL11.glPushMatrix(); - float s = 1F / 256F * 10F; - float v = 1F / 8F; - float w = -v * 2.5F; + if(altar.hasWater) { + GL11.glPushMatrix(); + float s = 1F / 256F * 10F; + float v = 1F / 8F; + float w = -v * 2.5F; - int petals = 0; - for(int i = 0; i < altar.getSizeInventory(); i++) - if(altar.getStackInSlot(i) != null) - petals++; - else break; + int petals = 0; + for(int i = 0; i < altar.getSizeInventory(); i++) + if(altar.getStackInSlot(i) != null) petals++; + else break; - if(petals > 0) { - final float modifier = 6F; - final float rotationModifier = 0.25F; - final float radiusBase = 1.2F; - final float radiusMod = 0.1F; + if(petals > 0) { + final float modifier = 6F; + final float rotationModifier = 0.25F; + final float radiusBase = 1.2F; + final float radiusMod = 0.1F; - double ticks = Minecraft.getMinecraft().thePlayer.ticksExisted * 0.5; - float offsetPerPetal = 360 / petals; + double ticks = Minecraft.getMinecraft().thePlayer.ticksExisted * 0.5; + float offsetPerPetal = 360 / petals; - GL11.glPushMatrix(); - GL11.glTranslatef(-0.05F, -0.5F, 0F); - GL11.glScalef(v, v, v); - for(int i = 0; i < petals; i++) { - float offset = offsetPerPetal * i; - float deg = (int) (ticks / rotationModifier % 360F + offset); - float rad = deg * (float) Math.PI / 180F; - float radiusX = (float) (radiusBase + radiusMod * Math.sin(ticks / modifier)); - float radiusZ = (float) (radiusBase + radiusMod * Math.cos(ticks / modifier)); - float x = (float) (radiusX * Math.cos(rad)); - float z = (float) (radiusZ * Math.sin(rad)); - float y = (float) Math.cos((ticks + 50 * i) / 5F) / 10F; + GL11.glPushMatrix(); + GL11.glTranslatef(-0.05F, -0.5F, 0F); + GL11.glScalef(v, v, v); + for(int i = 0; i < petals; i++) { + float offset = offsetPerPetal * i; + float deg = (int) (ticks / rotationModifier % 360F + offset); + float rad = deg * (float) Math.PI / 180F; + float radiusX = (float) (radiusBase + radiusMod * Math.sin(ticks / modifier)); + float radiusZ = (float) (radiusBase + radiusMod * Math.cos(ticks / modifier)); + float x = (float) (radiusX * Math.cos(rad)); + float z = (float) (radiusZ * Math.sin(rad)); + float y = (float) Math.cos((ticks + 50 * i) / 5F) / 10F; - GL11.glPushMatrix(); - GL11.glTranslatef(x, y, z); - float xRotate = (float) Math.sin(ticks * rotationModifier) / 2F; - float yRotate = (float) Math.max(0.6F, Math.sin(ticks * 0.1F) / 2F + 0.5F); - float zRotate = (float) Math.cos(ticks * rotationModifier) / 2F; + GL11.glPushMatrix(); + GL11.glTranslatef(x, y, z); + float xRotate = (float) Math.sin(ticks * rotationModifier) / 2F; + float yRotate = (float) Math.max(0.6F, Math.sin(ticks * 0.1F) / 2F + 0.5F); + float zRotate = (float) Math.cos(ticks * rotationModifier) / 2F; - v /= 2F; - GL11.glTranslatef(v, v, v); - GL11.glRotatef(deg, xRotate, yRotate, zRotate); - GL11.glTranslatef(-v, -v, -v); - v *= 2F; + v /= 2F; + GL11.glTranslatef(v, v, v); + GL11.glRotatef(deg, xRotate, yRotate, zRotate); + GL11.glTranslatef(-v, -v, -v); + v *= 2F; - GL11.glColor4f(1F, 1F, 1F, 1F); + GL11.glColor4f(1F, 1F, 1F, 1F); - ItemStack stack = altar.getStackInSlot(i); - Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); - IIcon icon = stack.getItem().getIcon(stack, 0); - if(icon != null) { - Color color = new Color(stack.getItem().getColorFromItemStack(stack, 0)); - GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); - float f = icon.getMinU(); - float f1 = icon.getMaxU(); - float f2 = icon.getMinV(); - float f3 = icon.getMaxV(); - ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); - GL11.glColor3f(1F, 1F, 1F); - } + ItemStack stack = altar.getStackInSlot(i); + Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); + IIcon icon = stack.getItem().getIcon(stack, 0); + if(icon != null) { + Color color = new Color(stack.getItem().getColorFromItemStack(stack, 0)); + GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); + float f = icon.getMinU(); + float f1 = icon.getMaxU(); + float f2 = icon.getMinV(); + float f3 = icon.getMaxV(); + ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); + GL11.glColor3f(1F, 1F, 1F); + } - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } - Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); + Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glColor4f(1F, 1F, 1F, 0.7F); - GL11.glTranslatef(w, -0.3F, w); - GL11.glRotatef(90F, 1F, 0F, 0F); - GL11.glScalef(s, s, s); - renderItem.renderIcon(0, 0, Blocks.water.getIcon(0, 0), 16, 16); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glDisable(GL11.GL_BLEND); - GL11.glPopMatrix(); - } - GL11.glPopMatrix(); - } + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glColor4f(1F, 1F, 1F, 0.7F); + GL11.glTranslatef(w, -0.3F, w); + GL11.glRotatef(90F, 1F, 0F, 0F); + GL11.glScalef(s, s, s); + renderItem.renderIcon(0, 0, Blocks.water.getIcon(0, 0), 16, 16); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_BLEND); + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } } diff --git a/MODSRC/vazkii/botania/client/render/tile/RenderTileEnchanter.java b/MODSRC/vazkii/botania/client/render/tile/RenderTileEnchanter.java index 5b262145a..84b43ce3e 100644 --- a/MODSRC/vazkii/botania/client/render/tile/RenderTileEnchanter.java +++ b/MODSRC/vazkii/botania/client/render/tile/RenderTileEnchanter.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 15, 2014, 5:04:42 PM (GMT)] */ package vazkii.botania.client.render.tile; @@ -22,98 +22,91 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.item.EntityItem; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; - import org.lwjgl.opengl.GL11; - import vazkii.botania.client.core.helper.ShaderHelper; import vazkii.botania.common.block.BlockEnchanter; import vazkii.botania.common.block.tile.TileEnchanter; -import vazkii.botania.common.core.handler.ConfigHandler; public class RenderTileEnchanter extends TileEntitySpecialRenderer { - RenderItem renderItem = new RenderItem(); - EntityItem item; + RenderItem renderItem = new RenderItem(); + EntityItem item; - @Override - public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) { - TileEnchanter enchanter = (TileEnchanter) tileentity; - float alphaMod = 0F; + @Override + public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) { + TileEnchanter enchanter = (TileEnchanter) tileentity; + float alphaMod = 0F; - if(enchanter.stage == 2) - alphaMod = Math.min(20, enchanter.stageTicks) / 20F; - else if(enchanter.stage == 4) - alphaMod = (20 - enchanter.stageTicks) / 20F; - else if(enchanter.stage > 2) - alphaMod = 1F; + if(enchanter.stage == 2) alphaMod = Math.min(20, enchanter.stageTicks) / 20F; + else if(enchanter.stage == 4) alphaMod = (20 - enchanter.stageTicks) / 20F; + else if(enchanter.stage > 2) alphaMod = 1F; - if(enchanter.itemToEnchant != null) { - if(item == null) - item = new EntityItem(enchanter.getWorldObj(), enchanter.xCoord, enchanter.yCoord + 1, enchanter.zCoord, enchanter.itemToEnchant); + if(enchanter.itemToEnchant != null) { + if(item == null) + item = new EntityItem(enchanter.getWorldObj(), enchanter.xCoord, enchanter.yCoord + 1, enchanter.zCoord, enchanter.itemToEnchant); - item.age = (int) tileentity.getWorldObj().getTotalWorldTime(); - item.setEntityItemStack(enchanter.itemToEnchant); + item.age = (int) tileentity.getWorldObj().getTotalWorldTime(); + item.setEntityItemStack(enchanter.itemToEnchant); - GL11.glColor4f(1F, 1F, 1F, 1F); - GL11.glTranslatef(0.5F, 1.25F, 0.5F); - ((Render) RenderManager.instance.entityRenderMap.get(EntityItem.class)).doRender(item, d0, d1, d2, 1F, f); - GL11.glTranslatef(-0.5F, -1.25F, -0.5F); - } + GL11.glColor4f(1F, 1F, 1F, 1F); + GL11.glTranslatef(0.5F, 1.25F, 0.5F); + ((Render) RenderManager.instance.entityRenderMap.get(EntityItem.class)).doRender(item, d0, d1, d2, 1F, f); + GL11.glTranslatef(-0.5F, -1.25F, -0.5F); + } - GL11.glPushMatrix(); - GL11.glTranslated(d0, d1, d2); + GL11.glPushMatrix(); + GL11.glTranslated(d0, d1, d2); - GL11.glRotated(90F, 1F, 0F, 0F); - GL11.glTranslatef(-2F, -2F, -0.001F); + GL11.glRotated(90F, 1F, 0F, 0F); + GL11.glTranslatef(-2F, -2F, -0.001F); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(1F, 1F, 1F, 1F); - GL11.glDisable(GL11.GL_ALPHA_TEST); - float alpha = (float) ((Math.sin(enchanter.getWorldObj().getTotalWorldTime() / 8D) + 1D) / 5D + 0.4D) * alphaMod; - if(ShaderHelper.useShaders()) - GL11.glColor4f(1F, 1F, 1F, alpha); - else { - int light = 15728880; - int lightmapX = light % 65536; - int lightmapY = light / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY); - GL11.glColor4f(0.6F + (float) ((Math.cos(enchanter.getWorldObj().getTotalWorldTime() / 6D) + 1D) / 5D), 0.1F, 0.9F, alpha); - } + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1F, 1F, 1F, 1F); + GL11.glDisable(GL11.GL_ALPHA_TEST); + float alpha = (float) ((Math.sin(enchanter.getWorldObj().getTotalWorldTime() / 8D) + 1D) / 5D + 0.4D) * alphaMod; + if(ShaderHelper.useShaders()) GL11.glColor4f(1F, 1F, 1F, alpha); + else { + int light = 15728880; + int lightmapX = light % 65536; + int lightmapY = light / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY); + GL11.glColor4f(0.6F + (float) ((Math.cos(enchanter.getWorldObj().getTotalWorldTime() / 6D) + 1D) / 5D), 0.1F, 0.9F, alpha); + } - Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); + Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); - if(enchanter.stage == 3 || enchanter.stage == 4) { - int ticks = enchanter.stageTicks + enchanter.stage3EndTicks; - int angle = ticks * 2; - float yTranslation = Math.min(20, ticks) / 20F * 1.15F; - float scale = ticks < 10 ? 1F : 1F - Math.min(20, ticks - 10) / 20F * 0.75F; + if(enchanter.stage == 3 || enchanter.stage == 4) { + int ticks = enchanter.stageTicks + enchanter.stage3EndTicks; + int angle = ticks * 2; + float yTranslation = Math.min(20, ticks) / 20F * 1.15F; + float scale = ticks < 10 ? 1F : 1F - Math.min(20, ticks - 10) / 20F * 0.75F; - GL11.glTranslatef(2.5F, 2.5F, -yTranslation); - GL11.glScalef(scale, scale, 1F); - GL11.glRotatef(angle, 0F, 0F, 1F); - GL11.glTranslatef(-2.5F, -2.5F, 0F); - } + GL11.glTranslatef(2.5F, 2.5F, -yTranslation); + GL11.glScalef(scale, scale, 1F); + GL11.glRotatef(angle, 0F, 0F, 1F); + GL11.glTranslatef(-2.5F, -2.5F, 0F); + } - ShaderHelper.useShader(ShaderHelper.enchanterRune); - renderIcon(0, 0, BlockEnchanter.overlay, 5, 5, 240); - ShaderHelper.releaseShader(); - - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glDisable(GL11.GL_BLEND); - GL11.glColor4f(1F, 1F, 1F, 1F); - GL11.glPopMatrix(); - } + ShaderHelper.useShader(ShaderHelper.enchanterRune); + renderIcon(0, 0, BlockEnchanter.overlay, 5, 5, 240); + ShaderHelper.releaseShader(); - public void renderIcon(int par1, int par2, IIcon par3Icon, int par4, int par5, int brightness) { - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.setBrightness(brightness); - tessellator.addVertexWithUV(par1 + 0, par2 + par5, 0, par3Icon.getMinU(), par3Icon.getMaxV()); - tessellator.addVertexWithUV(par1 + par4, par2 + par5, 0, par3Icon.getMaxU(), par3Icon.getMaxV()); - tessellator.addVertexWithUV(par1 + par4, par2 + 0, 0, par3Icon.getMaxU(), par3Icon.getMinV()); - tessellator.addVertexWithUV(par1 + 0, par2 + 0, 0, par3Icon.getMinU(), par3Icon.getMinV()); - tessellator.draw(); - } + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_BLEND); + GL11.glColor4f(1F, 1F, 1F, 1F); + GL11.glPopMatrix(); + } + + public void renderIcon(int par1, int par2, IIcon par3Icon, int par4, int par5, int brightness) { + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.setBrightness(brightness); + tessellator.addVertexWithUV(par1 + 0, par2 + par5, 0, par3Icon.getMinU(), par3Icon.getMaxV()); + tessellator.addVertexWithUV(par1 + par4, par2 + par5, 0, par3Icon.getMaxU(), par3Icon.getMaxV()); + tessellator.addVertexWithUV(par1 + par4, par2 + 0, 0, par3Icon.getMaxU(), par3Icon.getMinV()); + tessellator.addVertexWithUV(par1 + 0, par2 + 0, 0, par3Icon.getMinU(), par3Icon.getMinV()); + tessellator.draw(); + } } diff --git a/MODSRC/vazkii/botania/client/render/tile/RenderTilePool.java b/MODSRC/vazkii/botania/client/render/tile/RenderTilePool.java index cdee7471b..2668d362f 100644 --- a/MODSRC/vazkii/botania/client/render/tile/RenderTilePool.java +++ b/MODSRC/vazkii/botania/client/render/tile/RenderTilePool.java @@ -2,11 +2,11 @@ * This class was created by . 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 26, 2014, 12:25:11 AM (GMT)] */ package vazkii.botania.client.render.tile; @@ -20,10 +20,8 @@ import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; - import vazkii.botania.client.core.helper.ShaderHelper; import vazkii.botania.client.lib.LibResources; import vazkii.botania.client.model.ModelPool; @@ -31,64 +29,64 @@ import vazkii.botania.common.block.tile.TilePool; public class RenderTilePool extends TileEntitySpecialRenderer { - private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_POOL); - private static final ModelPool model = new ModelPool(); - RenderItem renderItem = new RenderItem(); + private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_POOL); + private static final ModelPool model = new ModelPool(); + RenderItem renderItem = new RenderItem(); - @Override - public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) { - TilePool pool = (TilePool) tileentity; + @Override + public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) { + TilePool pool = (TilePool) tileentity; - GL11.glPushMatrix(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glColor4f(1F, 1F, 1F, 1F); - GL11.glTranslated(d0, d1, d2); - Minecraft.getMinecraft().renderEngine.bindTexture(texture); + GL11.glPushMatrix(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glColor4f(1F, 1F, 1F, 1F); + GL11.glTranslated(d0, d1, d2); + Minecraft.getMinecraft().renderEngine.bindTexture(texture); - GL11.glTranslatef(0.5F, 1.5F, 0.5F); - GL11.glScalef(1F, -1F, -1F); - model.render(); - GL11.glScalef(1F, -1F, -1F); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glTranslatef(0.5F, 1.5F, 0.5F); + GL11.glScalef(1F, -1F, -1F); + model.render(); + GL11.glScalef(1F, -1F, -1F); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); - Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); + Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); - float waterLevel = (float) pool.getCurrentMana() / (float) TilePool.MAX_MANA * 0.40F; - if(waterLevel > 0) { - float s = 1F / 256F * 14F; - float v = 1F / 8F; - float w = -v * 3.5F; + float waterLevel = (float) pool.getCurrentMana() / (float) TilePool.MAX_MANA * 0.40F; + if(waterLevel > 0) { + float s = 1F / 256F * 14F; + float v = 1F / 8F; + float w = -v * 3.5F; - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glColor4f(1F, 1F, 1F, 1F); - GL11.glTranslatef(w, -1F - (0.43F - waterLevel), w); - GL11.glRotatef(90F, 1F, 0F, 0F); - GL11.glScalef(s, s, s); - float par1 = 0; - float par2 = 0; - IIcon par3Icon = Blocks.water.getIcon(0, 0); - float par4 = 16; - float par5 = 16; - float zLevel = 0F; - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.setBrightness(240); - tessellator.addVertexWithUV(par1 + 0, par2 + par5, zLevel, par3Icon.getMinU(), par3Icon.getMaxV()); - tessellator.addVertexWithUV(par1 + par4, par2 + par5, zLevel, par3Icon.getMaxU(), par3Icon.getMaxV()); - tessellator.addVertexWithUV(par1 + par4, par2 + 0, zLevel, par3Icon.getMaxU(), par3Icon.getMinV()); - tessellator.addVertexWithUV(par1 + 0, par2 + 0, zLevel, par3Icon.getMinU(), par3Icon.getMinV()); - - ShaderHelper.useShader(ShaderHelper.manaPool); - tessellator.draw(); - ShaderHelper.releaseShader(); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glDisable(GL11.GL_BLEND); - GL11.glPopMatrix(); - } - GL11.glPopMatrix(); - } + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glColor4f(1F, 1F, 1F, 1F); + GL11.glTranslatef(w, -1F - (0.43F - waterLevel), w); + GL11.glRotatef(90F, 1F, 0F, 0F); + GL11.glScalef(s, s, s); + float par1 = 0; + float par2 = 0; + IIcon par3Icon = Blocks.water.getIcon(0, 0); + float par4 = 16; + float par5 = 16; + float zLevel = 0F; + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.setBrightness(240); + tessellator.addVertexWithUV(par1 + 0, par2 + par5, zLevel, par3Icon.getMinU(), par3Icon.getMaxV()); + tessellator.addVertexWithUV(par1 + par4, par2 + par5, zLevel, par3Icon.getMaxU(), par3Icon.getMaxV()); + tessellator.addVertexWithUV(par1 + par4, par2 + 0, zLevel, par3Icon.getMaxU(), par3Icon.getMinV()); + tessellator.addVertexWithUV(par1 + 0, par2 + 0, zLevel, par3Icon.getMinU(), par3Icon.getMinV()); + + ShaderHelper.useShader(ShaderHelper.manaPool); + tessellator.draw(); + ShaderHelper.releaseShader(); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_BLEND); + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } } diff --git a/MODSRC/vazkii/botania/client/render/tile/RenderTilePylon.java b/MODSRC/vazkii/botania/client/render/tile/RenderTilePylon.java index 20ff4faed..7134dcddb 100644 --- a/MODSRC/vazkii/botania/client/render/tile/RenderTilePylon.java +++ b/MODSRC/vazkii/botania/client/render/tile/RenderTilePylon.java @@ -2,26 +2,22 @@ * This class was created by . 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 @ [Feb 18, 2014, 10:18:36 PM (GMT)] */ package vazkii.botania.client.render.tile; -import java.util.Random; - import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; - import vazkii.botania.client.core.helper.ShaderHelper; import vazkii.botania.client.lib.LibResources; import vazkii.botania.client.model.IPylonModel; @@ -29,91 +25,87 @@ import vazkii.botania.client.model.ModelPylon; import vazkii.botania.client.model.ModelPylonOld; import vazkii.botania.common.core.handler.ConfigHandler; +import java.util.Random; + public class RenderTilePylon extends TileEntitySpecialRenderer { - private static final ResourceLocation textureOld = new ResourceLocation(LibResources.MODEL_PYLON_OLD); - private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_PYLON); + private static final ResourceLocation textureOld = new ResourceLocation(LibResources.MODEL_PYLON_OLD); + private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_PYLON); - IPylonModel model; + IPylonModel model; - @Override - public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) { - if(model == null) - model = ConfigHandler.oldPylonModel ? new ModelPylonOld() : new ModelPylon(); + @Override + public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) { + if(model == null) model = ConfigHandler.oldPylonModel ? new ModelPylonOld() : new ModelPylon(); - GL11.glPushMatrix(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(1F, 1F, 1F, 1F); - Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.oldPylonModel ? textureOld : texture); - int worldTime = (int) (tileentity.getWorldObj() == null ? 0 : tileentity.getWorldObj().getTotalWorldTime()); + GL11.glPushMatrix(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1F, 1F, 1F, 1F); + Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.oldPylonModel ? textureOld : texture); + int worldTime = (int) (tileentity.getWorldObj() == null ? 0 : tileentity.getWorldObj().getTotalWorldTime()); - if(tileentity != null) - worldTime += new Random(tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord).nextInt(360); + if(tileentity != null) + worldTime += new Random(tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord).nextInt(360); - if(ConfigHandler.oldPylonModel) { - GL11.glTranslated(d0 + 0.5, d1 + 2.2, d2 + 0.5); - GL11.glScalef(1F, -1.5F, -1F); - } else { - GL11.glTranslated(d0 + 0.2, d1 + 0.05, d2 + 0.8); - GL11.glScalef(0.6F, 0.6F, 0.6F); - } + if(ConfigHandler.oldPylonModel) { + GL11.glTranslated(d0 + 0.5, d1 + 2.2, d2 + 0.5); + GL11.glScalef(1F, -1.5F, -1F); + } else { + GL11.glTranslated(d0 + 0.2, d1 + 0.05, d2 + 0.8); + GL11.glScalef(0.6F, 0.6F, 0.6F); + } - GL11.glPushMatrix(); - if(!ConfigHandler.oldPylonModel) - GL11.glTranslatef(0.5F, 0F, -0.5F); - GL11.glRotatef(worldTime * 1.5F, 0F, 1F, 0F); - if(!ConfigHandler.oldPylonModel) - GL11.glTranslatef(-0.5F, 0F, 0.5F); + GL11.glPushMatrix(); + if(!ConfigHandler.oldPylonModel) GL11.glTranslatef(0.5F, 0F, -0.5F); + GL11.glRotatef(worldTime * 1.5F, 0F, 1F, 0F); + if(!ConfigHandler.oldPylonModel) GL11.glTranslatef(-0.5F, 0F, 0.5F); - model.renderRing(); - GL11.glTranslated(0D, Math.sin(worldTime / 20D) / 20 - 0.025, 0D); - model.renderGems(); - GL11.glPopMatrix(); + model.renderRing(); + GL11.glTranslated(0D, Math.sin(worldTime / 20D) / 20 - 0.025, 0D); + model.renderGems(); + GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslated(0D, Math.sin(worldTime / 20D) / 17.5, 0D); + GL11.glPushMatrix(); + GL11.glTranslated(0D, Math.sin(worldTime / 20D) / 17.5, 0D); - if(!ConfigHandler.oldPylonModel) - GL11.glTranslatef(0.5F, 0F, -0.5F); + if(!ConfigHandler.oldPylonModel) GL11.glTranslatef(0.5F, 0F, -0.5F); - GL11.glRotatef(-worldTime, 0F, 1F, 0F); - if(!ConfigHandler.oldPylonModel) - GL11.glTranslatef(-0.5F, 0F, 0.5F); + GL11.glRotatef(-worldTime, 0F, 1F, 0F); + if(!ConfigHandler.oldPylonModel) GL11.glTranslatef(-0.5F, 0F, 0.5F); - GL11.glDisable(GL11.GL_CULL_FACE); - model.renderCrystal(); + GL11.glDisable(GL11.GL_CULL_FACE); + model.renderCrystal(); - GL11.glColor4f(1F, 1F, 1F, 1F); - if(!ShaderHelper.useShaders()) { - int light = 15728880; - int lightmapX = light % 65536; - int lightmapY = light / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY); - float alpha = (float) ((Math.sin(worldTime / 20D) / 2D + 0.5) / (ConfigHandler.oldPylonModel ? 1D : 2D)); - GL11.glColor4f(1F, 1F, 1F, alpha + 0.183F); - } + GL11.glColor4f(1F, 1F, 1F, 1F); + if(!ShaderHelper.useShaders()) { + int light = 15728880; + int lightmapX = light % 65536; + int lightmapY = light / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY); + float alpha = (float) ((Math.sin(worldTime / 20D) / 2D + 0.5) / (ConfigHandler.oldPylonModel ? 1D : 2D)); + GL11.glColor4f(1F, 1F, 1F, alpha + 0.183F); + } - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glScalef(1.1F, 1.1F, 1.1F); - if(!ConfigHandler.oldPylonModel) - GL11.glTranslatef(-0.05F, -0.1F, 0.05F); - else GL11.glTranslatef(0F, -0.09F, 0F); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glScalef(1.1F, 1.1F, 1.1F); + if(!ConfigHandler.oldPylonModel) GL11.glTranslatef(-0.05F, -0.1F, 0.05F); + else GL11.glTranslatef(0F, -0.09F, 0F); - ShaderHelper.useShader(ShaderHelper.pylonGlow); - model.renderCrystal(); - ShaderHelper.releaseShader(); + ShaderHelper.useShader(ShaderHelper.pylonGlow); + model.renderCrystal(); + ShaderHelper.releaseShader(); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glPopMatrix(); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glPopMatrix(); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glPopMatrix(); - } + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } } diff --git a/MODSRC/vazkii/botania/client/render/tile/RenderTileRuneAltar.java b/MODSRC/vazkii/botania/client/render/tile/RenderTileRuneAltar.java index cb9140a29..fcf68eb99 100644 --- a/MODSRC/vazkii/botania/client/render/tile/RenderTileRuneAltar.java +++ b/MODSRC/vazkii/botania/client/render/tile/RenderTileRuneAltar.java @@ -2,17 +2,15 @@ * This class was created by . 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 @ [Feb 2, 2014, 6:34:45 PM (GMT)] */ package vazkii.botania.client.render.tile; -import java.awt.Color; - import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; @@ -26,100 +24,99 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraftforge.client.ForgeHooksClient; - import org.lwjgl.opengl.GL11; - import vazkii.botania.client.core.helper.RenderHelper; import vazkii.botania.client.model.ModelSpinningCubes; import vazkii.botania.common.block.tile.TileRuneAltar; +import java.awt.*; + public class RenderTileRuneAltar extends TileEntitySpecialRenderer { - ModelSpinningCubes cubes = new ModelSpinningCubes(); - RenderBlocks renderBlocks = new RenderBlocks(); + ModelSpinningCubes cubes = new ModelSpinningCubes(); + RenderBlocks renderBlocks = new RenderBlocks(); - @Override - public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partticks) { - TileRuneAltar altar = (TileRuneAltar) tileentity; + @Override + public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partticks) { + TileRuneAltar altar = (TileRuneAltar) tileentity; - GL11.glPushMatrix(); - GL11.glColor4f(1F, 1F, 1F, 1F); - GL11.glTranslated(x, y, z); + GL11.glPushMatrix(); + GL11.glColor4f(1F, 1F, 1F, 1F); + GL11.glTranslated(x, y, z); - int items = 0; - for(int i = 0; i < altar.getSizeInventory(); i++) - if(altar.getStackInSlot(i) == null) - break; - else items++; - float[] angles = new float[altar.getSizeInventory()]; + int items = 0; + for(int i = 0; i < altar.getSizeInventory(); i++) + if(altar.getStackInSlot(i) == null) break; + else items++; + float[] angles = new float[altar.getSizeInventory()]; - float anglePer = 360F / items; - float totalAngle = 0F; - for(int i = 0; i < angles.length; i++) - angles[i] = totalAngle += anglePer; + float anglePer = 360F / items; + float totalAngle = 0F; + for(int i = 0; i < angles.length; i++) + angles[i] = totalAngle += anglePer; - for(int i = 0; i < altar.getSizeInventory(); i++) { - GL11.glPushMatrix(); - GL11.glScalef(0.5F, 0.5F, 0.5F); - GL11.glTranslatef(1F, 2.5F, 1F); - GL11.glRotatef(angles[i] + altar.getWorldObj().getTotalWorldTime(), 0F, 1F, 0F); - GL11.glTranslatef(2.25F, 0F, 0.5F); - GL11.glRotatef(90F, 0F, 1F, 0F); - GL11.glTranslated(0D, 0.15 * Math.sin((tileentity.getWorldObj().getTotalWorldTime() + i * 10) / 5D), 0F); - ItemStack stack = altar.getStackInSlot(i); - Minecraft mc = Minecraft.getMinecraft(); - if(stack != null) { - mc.renderEngine.bindTexture(stack.getItem() instanceof ItemBlock ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture); + for(int i = 0; i < altar.getSizeInventory(); i++) { + GL11.glPushMatrix(); + GL11.glScalef(0.5F, 0.5F, 0.5F); + GL11.glTranslatef(1F, 2.5F, 1F); + GL11.glRotatef(angles[i] + altar.getWorldObj().getTotalWorldTime(), 0F, 1F, 0F); + GL11.glTranslatef(2.25F, 0F, 0.5F); + GL11.glRotatef(90F, 0F, 1F, 0F); + GL11.glTranslated(0D, 0.15 * Math.sin((tileentity.getWorldObj().getTotalWorldTime() + i * 10) / 5D), 0F); + ItemStack stack = altar.getStackInSlot(i); + Minecraft mc = Minecraft.getMinecraft(); + if(stack != null) { + mc.renderEngine.bindTexture(stack.getItem() instanceof ItemBlock ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture); - GL11.glScalef(2F, 2F, 2F); - if(!ForgeHooksClient.renderEntityItem(new EntityItem(altar.getWorldObj(), altar.xCoord, altar.yCoord, altar.zCoord, stack), stack, 0F, 0F, altar.getWorldObj().rand, mc.renderEngine, renderBlocks, 1)) { - GL11.glScalef(0.5F, 0.5F, 0.5F); - if(stack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType())) { - GL11.glScalef(0.5F, 0.5F, 0.5F); - GL11.glTranslatef(1F, 1.1F, 0F); - renderBlocks.renderBlockAsItem(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 1F); - GL11.glTranslatef(-1F, -1.1F, 0F); - GL11.glScalef(2F, 2F, 2F); - } else { - int renderPass = 0; - do { - IIcon icon = stack.getItem().getIcon(stack, renderPass); - if(icon != null) { - Color color = new Color(stack.getItem().getColorFromItemStack(stack, renderPass)); - GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); - float f = icon.getMinU(); - float f1 = icon.getMaxU(); - float f2 = icon.getMinV(); - float f3 = icon.getMaxV(); - ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); - GL11.glColor3f(1F, 1F, 1F); - } - renderPass++; - } while(renderPass < stack.getItem().getRenderPasses(stack.getItemDamage())); - } - } - } - GL11.glPopMatrix(); - } + GL11.glScalef(2F, 2F, 2F); + if(!ForgeHooksClient.renderEntityItem(new EntityItem(altar.getWorldObj(), altar.xCoord, altar.yCoord, altar.zCoord, stack), stack, 0F, 0F, altar.getWorldObj().rand, mc.renderEngine, renderBlocks, 1)) { + GL11.glScalef(0.5F, 0.5F, 0.5F); + if(stack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType())) { + GL11.glScalef(0.5F, 0.5F, 0.5F); + GL11.glTranslatef(1F, 1.1F, 0F); + renderBlocks.renderBlockAsItem(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 1F); + GL11.glTranslatef(-1F, -1.1F, 0F); + GL11.glScalef(2F, 2F, 2F); + } else { + int renderPass = 0; + do { + IIcon icon = stack.getItem().getIcon(stack, renderPass); + if(icon != null) { + Color color = new Color(stack.getItem().getColorFromItemStack(stack, renderPass)); + GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); + float f = icon.getMinU(); + float f1 = icon.getMaxU(); + float f2 = icon.getMinV(); + float f3 = icon.getMaxV(); + ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); + GL11.glColor3f(1F, 1F, 1F); + } + renderPass++; + } while(renderPass < stack.getItem().getRenderPasses(stack.getItemDamage())); + } + } + } + GL11.glPopMatrix(); + } - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glPushMatrix(); - GL11.glTranslatef(0.5F, 1.8F, 0.5F); - GL11.glRotatef(180F, 1F, 0F, 1F); - int repeat = 15; - cubes.renderSpinningCubes(2, repeat, repeat); - GL11.glPopMatrix(); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glPushMatrix(); + GL11.glTranslatef(0.5F, 1.8F, 0.5F); + GL11.glRotatef(180F, 1F, 0F, 1F); + int repeat = 15; + cubes.renderSpinningCubes(2, repeat, repeat); + GL11.glPopMatrix(); - GL11.glTranslatef(0F, 1.2F, 2F); - float scale = altar.getTargetMana() == 0 ? 0 : (float) altar.getCurrentMana() / (float) altar.getTargetMana() / 75F; + GL11.glTranslatef(0F, 1.2F, 2F); + float scale = altar.getTargetMana() == 0 ? 0 : (float) altar.getCurrentMana() / (float) altar.getTargetMana() / 75F; - if(scale != 0) { - int seed = altar.xCoord ^ altar.yCoord ^ altar.zCoord; - GL11.glTranslatef(0.5F, 0.7F, 0.5F); - RenderHelper.renderStar(0x00E4D7, scale, scale, scale, seed); - } - GL11.glEnable(GL11.GL_ALPHA_TEST); + if(scale != 0) { + int seed = altar.xCoord ^ altar.yCoord ^ altar.zCoord; + GL11.glTranslatef(0.5F, 0.7F, 0.5F); + RenderHelper.renderStar(0x00E4D7, scale, scale, scale, seed); + } + GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } } diff --git a/MODSRC/vazkii/botania/client/render/tile/RenderTileSpreader.java b/MODSRC/vazkii/botania/client/render/tile/RenderTileSpreader.java index 511930c8f..0ba8f66bd 100644 --- a/MODSRC/vazkii/botania/client/render/tile/RenderTileSpreader.java +++ b/MODSRC/vazkii/botania/client/render/tile/RenderTileSpreader.java @@ -2,11 +2,11 @@ * This class was created by . 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 25, 2014, 9:42:31 PM (GMT)] */ package vazkii.botania.client.render.tile; @@ -17,10 +17,8 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; - import vazkii.botania.api.mana.ILens; import vazkii.botania.client.lib.LibResources; import vazkii.botania.client.model.ModelSpreader; @@ -29,42 +27,42 @@ import vazkii.botania.common.block.tile.TileSpreader; public class RenderTileSpreader extends TileEntitySpecialRenderer { - private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_SPREADER); - private static final ResourceLocation textureRs = new ResourceLocation(LibResources.MODEL_SPREADER_REDSTONE); + private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_SPREADER); + private static final ResourceLocation textureRs = new ResourceLocation(LibResources.MODEL_SPREADER_REDSTONE); - private static final ModelSpreader model = new ModelSpreader(); + private static final ModelSpreader model = new ModelSpreader(); - @Override - public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) { - TileSpreader spreader = (TileSpreader) tileentity; - GL11.glPushMatrix(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glColor4f(1F, 1F, 1F, 1F); - GL11.glTranslated(d0, d1, d2); + @Override + public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) { + TileSpreader spreader = (TileSpreader) tileentity; + GL11.glPushMatrix(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glColor4f(1F, 1F, 1F, 1F); + GL11.glTranslated(d0, d1, d2); - GL11.glTranslatef(0.5F, 1.5F, 0.5F); - GL11.glRotatef(spreader.rotationX + 90F, 0F, 1F, 0F); - GL11.glTranslatef(0F, -1F, 0F); - GL11.glRotatef(spreader.rotationY, 1F, 0F, 0F); - GL11.glTranslatef(0F, 1F, 0F); + GL11.glTranslatef(0.5F, 1.5F, 0.5F); + GL11.glRotatef(spreader.rotationX + 90F, 0F, 1F, 0F); + GL11.glTranslatef(0F, -1F, 0F); + GL11.glRotatef(spreader.rotationY, 1F, 0F, 0F); + GL11.glTranslatef(0F, 1F, 0F); - Minecraft.getMinecraft().renderEngine.bindTexture(spreader.isRedstone() ? textureRs : texture); - GL11.glScalef(1F, -1F, -1F); - model.render(); - GL11.glScalef(1F, -1F, -1F); - ItemStack stack = spreader.getStackInSlot(0); + Minecraft.getMinecraft().renderEngine.bindTexture(spreader.isRedstone() ? textureRs : texture); + GL11.glScalef(1F, -1F, -1F); + model.render(); + GL11.glScalef(1F, -1F, -1F); + ItemStack stack = spreader.getStackInSlot(0); - if(stack != null) { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); - ILens lens = (ILens) stack.getItem(); - GL11.glPushMatrix(); - GL11.glTranslatef(-0.4F, -1.4F, -0.4375F); - GL11.glScalef(0.8F, 0.8F, 0.8F); - RenderLens.render(stack, lens.getLensColor(stack)); - GL11.glPopMatrix(); - } - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glPopMatrix(); - } + if(stack != null) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); + ILens lens = (ILens) stack.getItem(); + GL11.glPushMatrix(); + GL11.glTranslatef(-0.4F, -1.4F, -0.4375F); + GL11.glScalef(0.8F, 0.8F, 0.8F); + RenderLens.render(stack, lens.getLensColor(stack)); + GL11.glPopMatrix(); + } + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } } diff --git a/MODSRC/vazkii/botania/common/Botania.java b/MODSRC/vazkii/botania/common/Botania.java index e6dcb185f..baee461d0 100644 --- a/MODSRC/vazkii/botania/common/Botania.java +++ b/MODSRC/vazkii/botania/common/Botania.java @@ -2,18 +2,15 @@ * This class was created by . 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 13, 2014, 6:32:39 PM (GMT)] */ package vazkii.botania.common; -import vazkii.botania.common.core.handler.ManaNetworkHandler; -import vazkii.botania.common.core.proxy.CommonProxy; -import vazkii.botania.common.lib.LibMisc; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; @@ -22,33 +19,36 @@ import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStoppingEvent; +import vazkii.botania.common.core.handler.ManaNetworkHandler; +import vazkii.botania.common.core.proxy.CommonProxy; +import vazkii.botania.common.lib.LibMisc; @Mod(modid = LibMisc.MOD_ID, name = LibMisc.MOD_NAME, version = LibMisc.VERSION) public class Botania { - @Instance(LibMisc.MOD_ID) - public static Botania instance; + @Instance(LibMisc.MOD_ID) + public static Botania instance; - @SidedProxy(serverSide = LibMisc.PROXY_COMMON, clientSide = LibMisc.PROXY_CLIENT) - public static CommonProxy proxy; + @SidedProxy(serverSide = LibMisc.PROXY_COMMON, clientSide = LibMisc.PROXY_CLIENT) + public static CommonProxy proxy; - @EventHandler - public void preInit(FMLPreInitializationEvent event) { - proxy.preInit(event); - } + @EventHandler + public void preInit(FMLPreInitializationEvent event) { + proxy.preInit(event); + } - @EventHandler - public void init(FMLInitializationEvent event) { - proxy.init(event); - } + @EventHandler + public void init(FMLInitializationEvent event) { + proxy.init(event); + } - @EventHandler - public void postInit(FMLPostInitializationEvent event) { - proxy.postInit(event); - } + @EventHandler + public void postInit(FMLPostInitializationEvent event) { + proxy.postInit(event); + } - @EventHandler - public void serverStopping(FMLServerStoppingEvent event) { - ManaNetworkHandler.instance.clear(); - } + @EventHandler + public void serverStopping(FMLServerStoppingEvent event) { + ManaNetworkHandler.instance.clear(); + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockAltar.java b/MODSRC/vazkii/botania/common/block/BlockAltar.java index bf6b7e730..a8d65b655 100644 --- a/MODSRC/vazkii/botania/common/block/BlockAltar.java +++ b/MODSRC/vazkii/botania/common/block/BlockAltar.java @@ -2,17 +2,15 @@ * This class was created by . 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 21, 2014, 7:48:54 PM (GMT)] */ package vazkii.botania.common.block; -import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -34,131 +32,131 @@ import vazkii.botania.common.block.tile.TileSimpleInventory; import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.lib.LibBlockNames; +import java.util.Random; + public class BlockAltar extends BlockModContainer implements ILexiconable { - Random random; + Random random; - protected BlockAltar() { - super(Material.rock); - setHardness(3.5F); - setStepSound(soundTypeStone); - setBlockName(LibBlockNames.ALTAR); + protected BlockAltar() { + super(Material.rock); + setHardness(3.5F); + setStepSound(soundTypeStone); + setBlockName(LibBlockNames.ALTAR); - float f = 1F / 16F * 2F; - setBlockBounds(f, f, f, 1F - f, 1F / 16F * 20F, 1F - f); + float f = 1F / 16F * 2F; + setBlockBounds(f, f, f, 1F - f, 1F / 16F * 20F, 1F - f); - random = new Random(); - } - - @Override - public void registerBlockIcons(IIconRegister par1IconRegister) { - // NO-OP - } + random = new Random(); + } - @Override - public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { - if(par5Entity instanceof EntityItem) { - TileAltar tile = (TileAltar) par1World.getTileEntity(par2, par3, par4); - if(tile.collideEntityItem((EntityItem) par5Entity)) - par1World.markBlockForUpdate(par2, par3, par4); - } - } + @Override + public void registerBlockIcons(IIconRegister par1IconRegister) { + // NO-OP + } - @Override - public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { - ItemStack stack = par5EntityPlayer.getCurrentEquippedItem(); - TileAltar tile = (TileAltar) par1World.getTileEntity(par2, par3, par4); - if(stack != null && stack.getItem() == Items.water_bucket) { - if(!tile.hasWater) { - if(!par5EntityPlayer.capabilities.isCreativeMode) - par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, new ItemStack(Items.bucket)); - tile.hasWater = true; - par1World.func_147453_f(par2, par3, par4, this); - par1World.markBlockForUpdate(par2, par3, par4); - } + @Override + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { + if(par5Entity instanceof EntityItem) { + TileAltar tile = (TileAltar) par1World.getTileEntity(par2, par3, par4); + if(tile.collideEntityItem((EntityItem) par5Entity)) par1World.markBlockForUpdate(par2, par3, par4); + } + } - return true; - } - return false; - } + @Override + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { + ItemStack stack = par5EntityPlayer.getCurrentEquippedItem(); + TileAltar tile = (TileAltar) par1World.getTileEntity(par2, par3, par4); + if(stack != null && stack.getItem() == Items.water_bucket) { + if(!tile.hasWater) { + if(!par5EntityPlayer.capabilities.isCreativeMode) + par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, new ItemStack(Items.bucket)); + tile.hasWater = true; + par1World.func_147453_f(par2, par3, par4, this); + par1World.markBlockForUpdate(par2, par3, par4); + } - @Override - public IIcon getIcon(int par1, int par2) { - return Blocks.cobblestone.getIcon(par1, par2); - } + return true; + } + return false; + } - @Override - public boolean isOpaqueCube() { - return false; - } + @Override + public IIcon getIcon(int par1, int par2) { + return Blocks.cobblestone.getIcon(par1, par2); + } - @Override - public boolean renderAsNormalBlock() { - return false; - } + @Override + public boolean isOpaqueCube() { + return false; + } - @Override - public int getRenderType() { - return LibRenderIDs.idAltar; - } + @Override + public boolean renderAsNormalBlock() { + return false; + } - @Override - public TileEntity createNewTileEntity(World world, int meta) { - return new TileAltar(); - } + @Override + public int getRenderType() { + return LibRenderIDs.idAltar; + } - @Override - public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) { - TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4); + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileAltar(); + } - if (inv != null) { - for (int j1 = 0; j1 < inv.getSizeInventory(); ++j1) { - ItemStack itemstack = inv.getStackInSlot(j1); + @Override + public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) { + TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4); - if (itemstack != null) { - float f = random.nextFloat() * 0.8F + 0.1F; - float f1 = random.nextFloat() * 0.8F + 0.1F; - EntityItem entityitem; + if(inv != null) { + for(int j1 = 0; j1 < inv.getSizeInventory(); ++j1) { + ItemStack itemstack = inv.getStackInSlot(j1); - for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) { - int k1 = random.nextInt(21) + 10; + if(itemstack != null) { + float f = random.nextFloat() * 0.8F + 0.1F; + float f1 = random.nextFloat() * 0.8F + 0.1F; + EntityItem entityitem; - if (k1 > itemstack.stackSize) - k1 = itemstack.stackSize; + for(float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) { + int k1 = random.nextInt(21) + 10; - itemstack.stackSize -= k1; - entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage())); - float f3 = 0.05F; - entityitem.motionX = (float)random.nextGaussian() * f3; - entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)random.nextGaussian() * f3; + if(k1 > itemstack.stackSize) k1 = itemstack.stackSize; - if (itemstack.hasTagCompound()) - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } - } - } + itemstack.stackSize -= k1; + entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage())); + float f3 = 0.05F; + entityitem.motionX = (float) random.nextGaussian() * f3; + entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) random.nextGaussian() * f3; - par1World.func_147453_f(par2, par3, par4, par5); - } + if(itemstack.hasTagCompound()) + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } + } + } - super.breakBlock(par1World, par2, par3, par4, par5, par6); - } + par1World.func_147453_f(par2, par3, par4, par5); + } - @Override - public boolean hasComparatorInputOverride() { - return true; - } + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } - @Override - public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) { - TileAltar altar = (TileAltar) par1World.getTileEntity(par2, par3, par4); - return altar.hasWater ? 15 : 0; - } + @Override + public boolean hasComparatorInputOverride() { + return true; + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - return LexiconData.apothecary; - } + @Override + public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) { + TileAltar altar = (TileAltar) par1World.getTileEntity(par2, par3, par4); + return altar.hasWater ? 15 : 0; + } + + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + return LexiconData.apothecary; + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockDistributor.java b/MODSRC/vazkii/botania/common/block/BlockDistributor.java index bee8ee134..0cdc3ca4a 100644 --- a/MODSRC/vazkii/botania/common/block/BlockDistributor.java +++ b/MODSRC/vazkii/botania/common/block/BlockDistributor.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 3, 2014, 1:44:29 AM (GMT)] */ package vazkii.botania.common.block; @@ -27,35 +27,35 @@ import vazkii.botania.common.lib.LibBlockNames; public class BlockDistributor extends BlockModContainer implements ILexiconable { - IIcon iconSide, iconTop; + IIcon iconSide, iconTop; - protected BlockDistributor() { - super(Material.rock); - setHardness(2.0F); - setResistance(10.0F); - setStepSound(soundTypeStone); - setBlockName(LibBlockNames.DISTRIBUTOR); - } + protected BlockDistributor() { + super(Material.rock); + setHardness(2.0F); + setResistance(10.0F); + setStepSound(soundTypeStone); + setBlockName(LibBlockNames.DISTRIBUTOR); + } - @Override - public void registerBlockIcons(IIconRegister par1IconRegister) { - iconTop = IconHelper.forBlock(par1IconRegister, this, 0); - iconSide = IconHelper.forBlock(par1IconRegister, this, 1); - } + @Override + public void registerBlockIcons(IIconRegister par1IconRegister) { + iconTop = IconHelper.forBlock(par1IconRegister, this, 0); + iconSide = IconHelper.forBlock(par1IconRegister, this, 1); + } - @Override - public IIcon getIcon(int par1, int par2) { - return par1 == 0 ? ModBlocks.livingrock.getIcon(0, 0) : par1 == 1 ? iconTop : iconSide; - } + @Override + public IIcon getIcon(int par1, int par2) { + return par1 == 0 ? ModBlocks.livingrock.getIcon(0, 0) : par1 == 1 ? iconTop : iconSide; + } - @Override - public TileEntity createNewTileEntity(World world, int meta) { - return new TileDistributor(); - } + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileDistributor(); + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - return LexiconData.distributor; - } + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + return LexiconData.distributor; + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockEnchanter.java b/MODSRC/vazkii/botania/common/block/BlockEnchanter.java index ad2be471b..a1ff73ff6 100644 --- a/MODSRC/vazkii/botania/common/block/BlockEnchanter.java +++ b/MODSRC/vazkii/botania/common/block/BlockEnchanter.java @@ -2,17 +2,15 @@ * This class was created by . 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 @ [Mar 15, 2014, 4:08:26 PM (GMT)] */ package vazkii.botania.common.block; -import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -35,111 +33,111 @@ import vazkii.botania.common.item.ModItems; import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.lib.LibBlockNames; +import java.util.Random; + public class BlockEnchanter extends BlockModContainer implements IWandable, ILexiconable { - Random random; - public static IIcon overlay; + Random random; + public static IIcon overlay; - public BlockEnchanter() { - super(Material.rock); - setHardness(3.0F); - setResistance(5.0F); - setLightLevel(1.0F); - setStepSound(soundTypeStone); - setBlockName(LibBlockNames.ENCHANTER); + public BlockEnchanter() { + super(Material.rock); + setHardness(3.0F); + setResistance(5.0F); + setLightLevel(1.0F); + setStepSound(soundTypeStone); + setBlockName(LibBlockNames.ENCHANTER); - random = new Random(); - } + random = new Random(); + } - @Override - public void registerBlockIcons(IIconRegister par1IconRegister) { - super.registerBlockIcons(par1IconRegister); - overlay = IconHelper.forBlock(par1IconRegister, this, "Overlay"); - } + @Override + public void registerBlockIcons(IIconRegister par1IconRegister) { + super.registerBlockIcons(par1IconRegister); + overlay = IconHelper.forBlock(par1IconRegister, this, "Overlay"); + } - @Override - public TileEntity createNewTileEntity(World world, int meta) { - return new TileEnchanter(); - } + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEnchanter(); + } - @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { - return Item.getItemFromBlock(Blocks.lapis_block); - } - - @Override - public boolean isOpaqueCube() { - return false; - } + @Override + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + return Item.getItemFromBlock(Blocks.lapis_block); + } - @Override - public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { - TileEnchanter enchanter = (TileEnchanter) par1World.getTileEntity(par2, par3, par4); - ItemStack stack = par5EntityPlayer.getCurrentEquippedItem(); - if(stack != null && stack.getItem() == ModItems.twigWand) - return false; + @Override + public boolean isOpaqueCube() { + return false; + } - boolean stackEnchantable = stack != null && stack.isItemEnchantable() && stack.stackSize == 1 && stack.getItem().getItemEnchantability() > 0; + @Override + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { + TileEnchanter enchanter = (TileEnchanter) par1World.getTileEntity(par2, par3, par4); + ItemStack stack = par5EntityPlayer.getCurrentEquippedItem(); + if(stack != null && stack.getItem() == ModItems.twigWand) return false; - if(enchanter.itemToEnchant == null) { - if(stackEnchantable) { - enchanter.itemToEnchant = stack.copy(); - par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null); - enchanter.sync(); - } - } else if(enchanter.stage == 0) { - if(par5EntityPlayer.inventory.addItemStackToInventory(enchanter.itemToEnchant.copy())) { - enchanter.itemToEnchant = null; - enchanter.sync(); - } else par5EntityPlayer.addChatMessage(new ChatComponentTranslation("botaniamisc.invFull")); - } + boolean stackEnchantable = stack != null && stack.isItemEnchantable() && stack.stackSize == 1 && stack.getItem().getItemEnchantability() > 0; - return true; - } + if(enchanter.itemToEnchant == null) { + if(stackEnchantable) { + enchanter.itemToEnchant = stack.copy(); + par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null); + enchanter.sync(); + } + } else if(enchanter.stage == 0) { + if(par5EntityPlayer.inventory.addItemStackToInventory(enchanter.itemToEnchant.copy())) { + enchanter.itemToEnchant = null; + enchanter.sync(); + } else par5EntityPlayer.addChatMessage(new ChatComponentTranslation("botaniamisc.invFull")); + } - @Override - public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) { - TileEnchanter enchanter = (TileEnchanter) par1World.getTileEntity(par2, par3, par4); + return true; + } - ItemStack itemstack = enchanter.itemToEnchant; + @Override + public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) { + TileEnchanter enchanter = (TileEnchanter) par1World.getTileEntity(par2, par3, par4); - if (itemstack != null) { - float f = random.nextFloat() * 0.8F + 0.1F; - float f1 = random.nextFloat() * 0.8F + 0.1F; - EntityItem entityitem; + ItemStack itemstack = enchanter.itemToEnchant; - for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) { - int k1 = random.nextInt(21) + 10; + if(itemstack != null) { + float f = random.nextFloat() * 0.8F + 0.1F; + float f1 = random.nextFloat() * 0.8F + 0.1F; + EntityItem entityitem; - if (k1 > itemstack.stackSize) - k1 = itemstack.stackSize; + for(float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) { + int k1 = random.nextInt(21) + 10; - itemstack.stackSize -= k1; - entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage())); - float f3 = 0.05F; - entityitem.motionX = (float)random.nextGaussian() * f3 * 0.5; - entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)random.nextGaussian() * f3 * 0.5; + if(k1 > itemstack.stackSize) k1 = itemstack.stackSize; - if (itemstack.hasTagCompound()) - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } - } + itemstack.stackSize -= k1; + entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage())); + float f3 = 0.05F; + entityitem.motionX = (float) random.nextGaussian() * f3 * 0.5; + entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) random.nextGaussian() * f3 * 0.5; - par1World.func_147453_f(par2, par3, par4, par5); + if(itemstack.hasTagCompound()) + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } + } - super.breakBlock(par1World, par2, par3, par4, par5, par6); - } + par1World.func_147453_f(par2, par3, par4, par5); - @Override - public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) { - ((TileEnchanter) world.getTileEntity(x, y, z)).onWanded(player, stack); - return true; - } + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - return LexiconData.manaEnchanting; - } + @Override + public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) { + ((TileEnchanter) world.getTileEntity(x, y, z)).onWanded(player, stack); + return true; + } + + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + return LexiconData.manaEnchanting; + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockLivingrock.java b/MODSRC/vazkii/botania/common/block/BlockLivingrock.java index c9b3fc630..38f1e7695 100644 --- a/MODSRC/vazkii/botania/common/block/BlockLivingrock.java +++ b/MODSRC/vazkii/botania/common/block/BlockLivingrock.java @@ -2,17 +2,16 @@ * This class was created by . 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 25, 2014, 10:03:04 PM (GMT)] */ package vazkii.botania.common.block; -import java.util.List; - +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -29,65 +28,66 @@ import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName; import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.lib.LibBlockNames; -import cpw.mods.fml.common.registry.GameRegistry; + +import java.util.List; public class BlockLivingrock extends BlockMod implements ILexiconable { - private static final int TYPES = 5; - IIcon[] icons; + private static final int TYPES = 5; + IIcon[] icons; - public BlockLivingrock() { - super(Material.rock); - setHardness(2.0F); - setResistance(10.0F); - setStepSound(soundTypeStone); - setBlockName(LibBlockNames.LIVING_ROCK); - } + public BlockLivingrock() { + super(Material.rock); + setHardness(2.0F); + setResistance(10.0F); + setStepSound(soundTypeStone); + setBlockName(LibBlockNames.LIVING_ROCK); + } - @Override - protected boolean shouldRegisterInNameSet() { - return false; - } + @Override + protected boolean shouldRegisterInNameSet() { + return false; + } - @Override - public int damageDropped(int par1) { - return par1; - } + @Override + public int damageDropped(int par1) { + return par1; + } - @Override - public Block setBlockName(String par1Str) { - GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str); - return super.setBlockName(par1Str); - } + @Override + public Block setBlockName(String par1Str) { + GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str); + return super.setBlockName(par1Str); + } - @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - for(int i = 0; i < TYPES; i++) - par3List.add(new ItemStack(par1, 1, i)); - } + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for(int i = 0; i < TYPES; i++) + par3List.add(new ItemStack(par1, 1, i)); + } - @Override - public void registerBlockIcons(IIconRegister par1IconRegister) { - icons = new IIcon[TYPES]; - for(int i = 0; i < TYPES; i++) - icons[i] = IconHelper.forBlock(par1IconRegister, this, i); - } + @Override + public void registerBlockIcons(IIconRegister par1IconRegister) { + icons = new IIcon[TYPES]; + for(int i = 0; i < TYPES; i++) + icons[i] = IconHelper.forBlock(par1IconRegister, this, i); + } - @Override - public IIcon getIcon(int par1, int par2) { - return icons[Math.min(TYPES - 1, par2)]; - } + @Override + public IIcon getIcon(int par1, int par2) { + return icons[Math.min(TYPES - 1, par2)]; + } - @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { - int meta = world.getBlockMetadata(x, y, z); - return new ItemStack(this, 1, meta); - } + @Override + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { + int meta = world.getBlockMetadata(x, y, z); + return new ItemStack(this, 1, meta); + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - int meta = world.getBlockMetadata(x, y, z); - return meta == 0 ? LexiconData.pureDaisy : LexiconData.decorativeBlocks; - } + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + int meta = world.getBlockMetadata(x, y, z); + return meta == 0 ? LexiconData.pureDaisy : LexiconData.decorativeBlocks; + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockLivingwood.java b/MODSRC/vazkii/botania/common/block/BlockLivingwood.java index 80ce8a3ff..e1bb5c34e 100644 --- a/MODSRC/vazkii/botania/common/block/BlockLivingwood.java +++ b/MODSRC/vazkii/botania/common/block/BlockLivingwood.java @@ -2,19 +2,16 @@ * This class was created by . 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 25, 2014, 10:04:25 PM (GMT)] */ package vazkii.botania.common.block; -import java.util.List; - -import javax.swing.Icon; - +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -32,69 +29,70 @@ import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName; import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.lib.LibBlockNames; -import cpw.mods.fml.common.registry.GameRegistry; + +import java.util.List; public class BlockLivingwood extends BlockMod implements ILexiconable { - private static final int TYPES = 6; - IIcon[] icons; + private static final int TYPES = 6; + IIcon[] icons; - public BlockLivingwood() { - super( Material.wood); - setHardness(2.0F); - setStepSound(soundTypeWood); - setBlockName(LibBlockNames.LIVING_WOOD); - } + public BlockLivingwood() { + super(Material.wood); + setHardness(2.0F); + setStepSound(soundTypeWood); + setBlockName(LibBlockNames.LIVING_WOOD); + } - @Override - protected boolean shouldRegisterInNameSet() { - return false; - } + @Override + protected boolean shouldRegisterInNameSet() { + return false; + } - @Override - public int damageDropped(int par1) { - return par1; - } + @Override + public int damageDropped(int par1) { + return par1; + } - @Override - public Block setBlockName(String par1Str) { - GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str); - return super.setBlockName(par1Str); - } + @Override + public Block setBlockName(String par1Str) { + GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str); + return super.setBlockName(par1Str); + } - @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - for(int i = 0; i < TYPES; i++) - par3List.add(new ItemStack(par1, 1, i)); - } + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for(int i = 0; i < TYPES; i++) + par3List.add(new ItemStack(par1, 1, i)); + } - @Override - public void registerBlockIcons(IIconRegister par1IconRegister) { - icons = new IIcon[TYPES]; - for(int i = 0; i < TYPES; i++) - icons[i] = IconHelper.forBlock(par1IconRegister, this, i); - } + @Override + public void registerBlockIcons(IIconRegister par1IconRegister) { + icons = new IIcon[TYPES]; + for(int i = 0; i < TYPES; i++) + icons[i] = IconHelper.forBlock(par1IconRegister, this, i); + } - @Override - public IIcon getIcon(int par1, int par2) { - return icons[Math.min(TYPES - 1, par2)]; - } + @Override + public IIcon getIcon(int par1, int par2) { + return icons[Math.min(TYPES - 1, par2)]; + } - @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { - int meta = world.getBlockMetadata(x, y, z); - return new ItemStack(this, 1, meta); - } + @Override + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { + int meta = world.getBlockMetadata(x, y, z); + return new ItemStack(this, 1, meta); + } - @Override - public int getLightValue(IBlockAccess world, int x, int y, int z) { - return world.getBlockMetadata(x, y, z) == 5 ? 12 : 0; - } + @Override + public int getLightValue(IBlockAccess world, int x, int y, int z) { + return world.getBlockMetadata(x, y, z) == 5 ? 12 : 0; + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - int meta = world.getBlockMetadata(x, y, z); - return meta == 0 ? LexiconData.pureDaisy : LexiconData.decorativeBlocks; - } + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + int meta = world.getBlockMetadata(x, y, z); + return meta == 0 ? LexiconData.pureDaisy : LexiconData.decorativeBlocks; + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockManaBeacon.java b/MODSRC/vazkii/botania/common/block/BlockManaBeacon.java index 4fab4d51e..9ef1603d6 100644 --- a/MODSRC/vazkii/botania/common/block/BlockManaBeacon.java +++ b/MODSRC/vazkii/botania/common/block/BlockManaBeacon.java @@ -2,18 +2,16 @@ * This class was created by . 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 @ [Mar 3, 2014, 4:53:59 PM (GMT)] */ package vazkii.botania.common.block; -import java.awt.Color; -import java.util.List; - +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -33,84 +31,86 @@ import vazkii.botania.common.block.tile.TileManaBeacon; import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName; import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.lib.LibBlockNames; -import cpw.mods.fml.common.registry.GameRegistry; + +import java.awt.*; +import java.util.List; public class BlockManaBeacon extends BlockModContainer implements ILexiconable { - IIcon[] icons; + IIcon[] icons; - public BlockManaBeacon() { - super(Material.iron); - setHardness(5.0F); - setResistance(10.0F); - setStepSound(soundTypeMetal); - float size = 3F / 16F; - setBlockBounds(size, size, size, 1F - size, 1F - size, 1F - size); - setBlockName(LibBlockNames.MANA_BEACON); - } + public BlockManaBeacon() { + super(Material.iron); + setHardness(5.0F); + setResistance(10.0F); + setStepSound(soundTypeMetal); + float size = 3F / 16F; + setBlockBounds(size, size, size, 1F - size, 1F - size, 1F - size); + setBlockName(LibBlockNames.MANA_BEACON); + } - @Override - public void registerBlockIcons(IIconRegister par1IconRegister) { - icons = new IIcon[2]; - for(int i = 0; i < 2; i++) - icons[i] = IconHelper.forBlock(par1IconRegister, this, i); - } + @Override + public void registerBlockIcons(IIconRegister par1IconRegister) { + icons = new IIcon[2]; + for(int i = 0; i < 2; i++) + icons[i] = IconHelper.forBlock(par1IconRegister, this, i); + } - @Override - public IIcon getIcon(int par1, int par2) { - return icons[par1 == 1 ? 1 : 0]; - } + @Override + public IIcon getIcon(int par1, int par2) { + return icons[par1 == 1 ? 1 : 0]; + } - @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - for(int i = 0; i < 16; i++) - par3List.add(new ItemStack(par1, 1, i)); - } + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for(int i = 0; i < 16; i++) + par3List.add(new ItemStack(par1, 1, i)); + } - @Override - public Block setBlockName(String par1Str) { - GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str); - return super.setBlockName(par1Str); - } + @Override + public Block setBlockName(String par1Str) { + GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str); + return super.setBlockName(par1Str); + } - @Override - protected boolean shouldRegisterInNameSet() { - return false; - } + @Override + protected boolean shouldRegisterInNameSet() { + return false; + } - @Override - public boolean renderAsNormalBlock() { - return false; - } + @Override + public boolean renderAsNormalBlock() { + return false; + } - @Override - public boolean isOpaqueCube() { - return false; - } + @Override + public boolean isOpaqueCube() { + return false; + } - @Override - public int damageDropped(int par1) { - return par1; - } + @Override + public int damageDropped(int par1) { + return par1; + } - @Override - public int getRenderColor(int par1) { - float[] color = EntitySheep.fleeceColorTable[par1]; - return new Color(color[0], color[1], color[2]).getRGB(); - } + @Override + public int getRenderColor(int par1) { + float[] color = EntitySheep.fleeceColorTable[par1]; + return new Color(color[0], color[1], color[2]).getRGB(); + } - @Override - public int colorMultiplier(IBlockAccess par1iBlockAccess, int par2, int par3, int par4) { - return getRenderColor(par1iBlockAccess.getBlockMetadata(par2, par3, par4)); - } + @Override + public int colorMultiplier(IBlockAccess par1iBlockAccess, int par2, int par3, int par4) { + return getRenderColor(par1iBlockAccess.getBlockMetadata(par2, par3, par4)); + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - return LexiconData.unstableBlocks; - } + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + return LexiconData.unstableBlocks; + } - @Override - public TileEntity createNewTileEntity(World world, int meta) { - return new TileManaBeacon(); - } + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileManaBeacon(); + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockManaDetector.java b/MODSRC/vazkii/botania/common/block/BlockManaDetector.java index 4e20b4ec6..a084e198a 100644 --- a/MODSRC/vazkii/botania/common/block/BlockManaDetector.java +++ b/MODSRC/vazkii/botania/common/block/BlockManaDetector.java @@ -2,17 +2,15 @@ * This class was created by . 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 @ [Mar 10, 2014, 7:57:38 PM (GMT)] */ package vazkii.botania.common.block; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -32,54 +30,56 @@ import vazkii.botania.common.block.tile.TileManaDetector; import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.lib.LibBlockNames; +import java.util.List; + public class BlockManaDetector extends BlockModContainer implements ILexiconable { - IIcon[] icons; + IIcon[] icons; - protected BlockManaDetector() { - super(Material.rock); - setHardness(2.0F); - setResistance(10.0F); - setStepSound(Block.soundTypeStone); - setBlockName(LibBlockNames.MANA_DETECTOR); - } + protected BlockManaDetector() { + super(Material.rock); + setHardness(2.0F); + setResistance(10.0F); + setStepSound(Block.soundTypeStone); + setBlockName(LibBlockNames.MANA_DETECTOR); + } - @Override - public void registerBlockIcons(IIconRegister par1IconRegister) { - icons = new IIcon[2]; - for(int i = 0; i < icons.length; i++) - icons[i] = IconHelper.forBlock(par1IconRegister, this, i); - } + @Override + public void registerBlockIcons(IIconRegister par1IconRegister) { + icons = new IIcon[2]; + for(int i = 0; i < icons.length; i++) + icons[i] = IconHelper.forBlock(par1IconRegister, this, i); + } - @Override - public IIcon getIcon(int par1, int par2) { - return icons[Math.min(icons.length - 1, par2)]; - } + @Override + public IIcon getIcon(int par1, int par2) { + return icons[Math.min(icons.length - 1, par2)]; + } - @Override - public boolean canProvidePower() { - return true; - } + @Override + public boolean canProvidePower() { + return true; + } - @Override - public int isProvidingWeakPower(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) { - return par1iBlockAccess.getBlockMetadata(par2, par3, par4) != 0 ? 15 : 0; - } + @Override + public int isProvidingWeakPower(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) { + return par1iBlockAccess.getBlockMetadata(par2, par3, par4) != 0 ? 15 : 0; + } - @Override - public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) { - if(par7Entity != null && !(par7Entity instanceof IManaBurst)) - super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); - } + @Override + public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) { + if(par7Entity != null && !(par7Entity instanceof IManaBurst)) + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } - @Override - public TileEntity createNewTileEntity(World world, int meta) { - return new TileManaDetector(); - } + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileManaDetector(); + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - return LexiconData.manaDetector; - } + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + return LexiconData.manaDetector; + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockManaVoid.java b/MODSRC/vazkii/botania/common/block/BlockManaVoid.java index 1ce85d32b..3bba276e7 100644 --- a/MODSRC/vazkii/botania/common/block/BlockManaVoid.java +++ b/MODSRC/vazkii/botania/common/block/BlockManaVoid.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 5, 2014, 12:55:47 AM (GMT)] */ package vazkii.botania.common.block; @@ -25,22 +25,22 @@ import vazkii.botania.common.lib.LibBlockNames; public class BlockManaVoid extends BlockModContainer implements ILexiconable { - protected BlockManaVoid() { - super(Material.rock); - setHardness(2.0F); - setResistance(2000F); - setStepSound(Block.soundTypeStone); - setBlockName(LibBlockNames.MANA_VOID); - } + protected BlockManaVoid() { + super(Material.rock); + setHardness(2.0F); + setResistance(2000F); + setStepSound(Block.soundTypeStone); + setBlockName(LibBlockNames.MANA_VOID); + } - @Override - public TileEntity createNewTileEntity(World world, int id) { - return new TileManaVoid(); - } + @Override + public TileEntity createNewTileEntity(World world, int id) { + return new TileManaVoid(); + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - return LexiconData.manaVoid; - } + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + return LexiconData.manaVoid; + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockMod.java b/MODSRC/vazkii/botania/common/block/BlockMod.java index 8bc4ab1c5..0dced34de 100644 --- a/MODSRC/vazkii/botania/common/block/BlockMod.java +++ b/MODSRC/vazkii/botania/common/block/BlockMod.java @@ -2,52 +2,50 @@ * This class was created by . 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 14, 2014, 5:31:15 PM (GMT)] */ package vazkii.botania.common.block; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.common.core.BotaniaCreativeTab; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class BlockMod extends Block { - public BlockMod(Material par2Material) { - super(par2Material); - if(registerInCreative()) - setCreativeTab(BotaniaCreativeTab.INSTANCE); - } + public BlockMod(Material par2Material) { + super(par2Material); + if(registerInCreative()) setCreativeTab(BotaniaCreativeTab.INSTANCE); + } - @Override - public Block setBlockName(String par1Str) { - if(shouldRegisterInNameSet()) - GameRegistry.registerBlock(this, par1Str); - return super.setBlockName(par1Str); - } + @Override + public Block setBlockName(String par1Str) { + if(shouldRegisterInNameSet()) GameRegistry.registerBlock(this, par1Str); + return super.setBlockName(par1Str); + } - protected boolean shouldRegisterInNameSet() { - return true; - } + protected boolean shouldRegisterInNameSet() { + return true; + } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister par1IconRegister) { - blockIcon = IconHelper.forBlock(par1IconRegister, this); - } + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) { + blockIcon = IconHelper.forBlock(par1IconRegister, this); + } - boolean registerInCreative() { - return true; - } + boolean registerInCreative() { + return true; + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockModContainer.java b/MODSRC/vazkii/botania/common/block/BlockModContainer.java index 2b87de23e..1b049e7c1 100644 --- a/MODSRC/vazkii/botania/common/block/BlockModContainer.java +++ b/MODSRC/vazkii/botania/common/block/BlockModContainer.java @@ -2,15 +2,18 @@ * This class was created by . 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 14, 2014, 5:32:55 PM (GMT)] */ package vazkii.botania.common.block; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -19,40 +22,35 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.common.core.BotaniaCreativeTab; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public abstract class BlockModContainer extends BlockContainer { - protected BlockModContainer(Material par2Material) { - super(par2Material); - if(registerInCreative()) - setCreativeTab(BotaniaCreativeTab.INSTANCE); - } + protected BlockModContainer(Material par2Material) { + super(par2Material); + if(registerInCreative()) setCreativeTab(BotaniaCreativeTab.INSTANCE); + } - @Override - public Block setBlockName(String par1Str) { - if(shouldRegisterInNameSet()) - GameRegistry.registerBlock(this, par1Str); - return super.setBlockName(par1Str); - } + @Override + public Block setBlockName(String par1Str) { + if(shouldRegisterInNameSet()) GameRegistry.registerBlock(this, par1Str); + return super.setBlockName(par1Str); + } - protected boolean shouldRegisterInNameSet() { - return true; - } + protected boolean shouldRegisterInNameSet() { + return true; + } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister par1IconRegister) { - blockIcon = IconHelper.forBlock(par1IconRegister, this); - } + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) { + blockIcon = IconHelper.forBlock(par1IconRegister, this); + } - boolean registerInCreative() { - return true; - } + boolean registerInCreative() { + return true; + } - @Override - public abstract T createNewTileEntity(World world, int meta); + @Override + public abstract T createNewTileEntity(World world, int meta); } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/common/block/BlockModFlower.java b/MODSRC/vazkii/botania/common/block/BlockModFlower.java index 350a7cd09..771f9f69a 100644 --- a/MODSRC/vazkii/botania/common/block/BlockModFlower.java +++ b/MODSRC/vazkii/botania/common/block/BlockModFlower.java @@ -2,20 +2,18 @@ * This class was created by . 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 16, 2014, 5:50:31 PM (GMT)] */ package vazkii.botania.common.block; -import java.util.List; -import java.util.Random; - -import javax.swing.Icon; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockFlower; import net.minecraft.client.renderer.texture.IIconRegister; @@ -36,70 +34,70 @@ import vazkii.botania.common.core.handler.ConfigHandler; import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName; import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.lib.LibBlockNames; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + +import java.util.List; +import java.util.Random; public class BlockModFlower extends BlockFlower implements ILexiconable { - public static IIcon[] icons; + public static IIcon[] icons; - protected BlockModFlower() { - super(0); - setBlockName(LibBlockNames.FLOWER); - setHardness(0F); - setStepSound(soundTypeGrass); - setBlockBounds(0.3F, 0.0F, 0.3F, 0.8F, 1, 0.8F); - setTickRandomly(true); - setCreativeTab(BotaniaCreativeTab.INSTANCE); - } + protected BlockModFlower() { + super(0); + setBlockName(LibBlockNames.FLOWER); + setHardness(0F); + setStepSound(soundTypeGrass); + setBlockBounds(0.3F, 0.0F, 0.3F, 0.8F, 1, 0.8F); + setTickRandomly(true); + setCreativeTab(BotaniaCreativeTab.INSTANCE); + } - @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - for(int i = 0; i < 16; i++) - par3List.add(new ItemStack(par1, 1, i)); - } + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for(int i = 0; i < 16; i++) + par3List.add(new ItemStack(par1, 1, i)); + } - @Override - public Block setBlockName(String par1Str) { - GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str); - return super.setBlockName(par1Str); - } + @Override + public Block setBlockName(String par1Str) { + GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str); + return super.setBlockName(par1Str); + } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister par1IconRegister) { - icons = new IIcon[17]; - for(int i = 0; i < icons.length; i++) - icons[i] = IconHelper.forBlock(par1IconRegister, this, i); - } + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) { + icons = new IIcon[17]; + for(int i = 0; i < icons.length; i++) + icons[i] = IconHelper.forBlock(par1IconRegister, this, i); + } - @Override - public IIcon getIcon(int par1, int par2) { - return icons[par2]; - } + @Override + public IIcon getIcon(int par1, int par2) { + return icons[par2]; + } - @Override - public int getRenderType() { - return LibRenderIDs.idSpecialFlower; - } + @Override + public int getRenderType() { + return LibRenderIDs.idSpecialFlower; + } - @Override - public int damageDropped(int par1) { - return par1; - } + @Override + public int damageDropped(int par1) { + return par1; + } - @Override - public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { - int meta = par1World.getBlockMetadata(par2, par3, par4); - float[] color = EntitySheep.fleeceColorTable[meta]; + @Override + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { + int meta = par1World.getBlockMetadata(par2, par3, par4); + float[] color = EntitySheep.fleeceColorTable[meta]; - if(par5Random.nextDouble() < ConfigHandler.flowerParticleFrequency) - Botania.proxy.sparkleFX(par1World, par2 + 0.3 + par5Random.nextFloat() * 0.5, par3 + 0.5 + par5Random.nextFloat() * 0.5, par4 + 0.3 + par5Random.nextFloat() * 0.5, color[0], color[1], color[2], par5Random.nextFloat(), 5); - } + if(par5Random.nextDouble() < ConfigHandler.flowerParticleFrequency) + Botania.proxy.sparkleFX(par1World, par2 + 0.3 + par5Random.nextFloat() * 0.5, par3 + 0.5 + par5Random.nextFloat() * 0.5, par4 + 0.3 + par5Random.nextFloat() * 0.5, color[0], color[1], color[2], par5Random.nextFloat(), 5); + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - return LexiconData.flowers; - } + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + return LexiconData.flowers; + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockPistonRelay.java b/MODSRC/vazkii/botania/common/block/BlockPistonRelay.java index 5859f964f..31306e0bf 100644 --- a/MODSRC/vazkii/botania/common/block/BlockPistonRelay.java +++ b/MODSRC/vazkii/botania/common/block/BlockPistonRelay.java @@ -2,23 +2,20 @@ * This class was created by . 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 @ [Feb 20, 2014, 4:57:36 PM (GMT)] */ package vazkii.botania.common.block; -import java.util.ArrayList; -import java.util.Collection; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; +import cpw.mods.fml.common.gameevent.TickEvent.Phase; +import cpw.mods.fml.common.gameevent.TickEvent.Type; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -39,209 +36,201 @@ import vazkii.botania.api.IWandable; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.lib.LibBlockNames; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.TickEvent; -import cpw.mods.fml.common.gameevent.TickEvent.Phase; -import cpw.mods.fml.common.gameevent.TickEvent.Type; + +import java.util.*; public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconable { - public static Map playerPositions = new HashMap(); - public static Map mappedPositions = new HashMap(); + public static Map playerPositions = new HashMap(); + public static Map mappedPositions = new HashMap(); - static List removeThese = new ArrayList(); - static Map coordsToCheck = new HashMap(); + static List removeThese = new ArrayList(); + static Map coordsToCheck = new HashMap(); - public BlockPistonRelay() { - super(Material.gourd); - setBlockName(LibBlockNames.PISTON_RELAY); - setHardness(2F); - setResistance(10F); - setStepSound(soundTypeMetal); + public BlockPistonRelay() { + super(Material.gourd); + setBlockName(LibBlockNames.PISTON_RELAY); + setHardness(2F); + setResistance(10F); + setStepSound(soundTypeMetal); - MinecraftForge.EVENT_BUS.register(this); - FMLCommonHandler.instance().bus().register(this); - } + MinecraftForge.EVENT_BUS.register(this); + FMLCommonHandler.instance().bus().register(this); + } - @Override - public int quantityDropped(int meta, int fortune, Random random) { - return 0; - } + @Override + public int quantityDropped(int meta, int fortune, Random random) { + return 0; + } - @Override - public boolean isOpaqueCube() { - return false; - } + @Override + public boolean isOpaqueCube() { + return false; + } - @Override - public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) { - mapCoords(par1World.provider.dimensionId, par2, par3, par4, 2); - } + @Override + public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) { + mapCoords(par1World.provider.dimensionId, par2, par3, par4, 2); + } - public static String getCoordsAsString(int world, int x, int y, int z) { - return world + ":" + x + ":" + y + ":" + z; - } + public static String getCoordsAsString(int world, int x, int y, int z) { + return world + ":" + x + ":" + y + ":" + z; + } - static void mapCoords(int world, int x, int y, int z, int time) { - coordsToCheck.put(getCoordsAsString(world, x, y, z), time); - } + static void mapCoords(int world, int x, int y, int z, int time) { + coordsToCheck.put(getCoordsAsString(world, x, y, z), time); + } - static void decrCoords(String key) { - int time = getTimeInCoords(key); + static void decrCoords(String key) { + int time = getTimeInCoords(key); - if(time <= 0) - removeThese.add(key); - else coordsToCheck.put(key, time - 1); - } + if(time <= 0) removeThese.add(key); + else coordsToCheck.put(key, time - 1); + } - static int getTimeInCoords(String key) { - return coordsToCheck.get(key); - } + static int getTimeInCoords(String key) { + return coordsToCheck.get(key); + } - static Block getBlockAt(String key) { - MinecraftServer server = MinecraftServer.getServer(); - if(server == null) - return Blocks.air; + static Block getBlockAt(String key) { + MinecraftServer server = MinecraftServer.getServer(); + if(server == null) return Blocks.air; - String[] tokens = key.split(":"); - int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]); - World world = server.worldServerForDimension(worldId); - return world.getBlock(x, y, z); - } + String[] tokens = key.split(":"); + int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]); + World world = server.worldServerForDimension(worldId); + return world.getBlock(x, y, z); + } - static int getBlockMetaAt(String key) { - MinecraftServer server = MinecraftServer.getServer(); - if(server == null) - return 0; + static int getBlockMetaAt(String key) { + MinecraftServer server = MinecraftServer.getServer(); + if(server == null) return 0; - String[] tokens = key.split(":"); - int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]); - World world = server.worldServerForDimension(worldId); - return world.getBlockMetadata(x, y, z); - } + String[] tokens = key.split(":"); + int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]); + World world = server.worldServerForDimension(worldId); + return world.getBlockMetadata(x, y, z); + } - @Override - public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) { - if(!player.isSneaking()) { - playerPositions.put(player.getCommandSenderName(), getCoordsAsString(world.provider.dimensionId, x, y, z)); - world.playSoundEffect(x, y, z, "random.orb", 0.5F, 1F); - } else { - dropBlockAsItem(world, x, y, z, new ItemStack(this)); - world.setBlockToAir(x, y, z); - if(!world.isRemote) - world.playAuxSFX(2001, x, y , z, Block.getIdFromBlock(this)); - } + @Override + public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) { + if(!player.isSneaking()) { + playerPositions.put(player.getCommandSenderName(), getCoordsAsString(world.provider.dimensionId, x, y, z)); + world.playSoundEffect(x, y, z, "random.orb", 0.5F, 1F); + } else { + dropBlockAsItem(world, x, y, z, new ItemStack(this)); + world.setBlockToAir(x, y, z); + if(!world.isRemote) world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(this)); + } - return true; - } + return true; + } - @SubscribeEvent - public void onWorldLoad(WorldEvent.Load event) { - WorldData.get(event.world); - } + @SubscribeEvent + public void onWorldLoad(WorldEvent.Load event) { + WorldData.get(event.world); + } - public static class WorldData extends WorldSavedData { + public static class WorldData extends WorldSavedData { - private static final String ID = "PistonRelayPairs"; + private static final String ID = "PistonRelayPairs"; - public WorldData(String id) { - super(id); - } + public WorldData(String id) { + super(id); + } - @Override - public void readFromNBT(NBTTagCompound nbttagcompound) { - mappedPositions.clear(); + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + mappedPositions.clear(); - Collection tags = nbttagcompound.func_150296_c(); - for(String key : tags) { - NBTBase tag = nbttagcompound.getTag(key); - if(tag instanceof NBTTagString) { - String value = ((NBTTagString) tag).func_150285_a_(); + Collection tags = nbttagcompound.func_150296_c(); + for(String key : tags) { + NBTBase tag = nbttagcompound.getTag(key); + if(tag instanceof NBTTagString) { + String value = ((NBTTagString) tag).func_150285_a_(); - mappedPositions.put(key, value); - } - } - } + mappedPositions.put(key, value); + } + } + } - @Override - public void writeToNBT(NBTTagCompound nbttagcompound) { - for(String s : mappedPositions.keySet()) - nbttagcompound.setString(s, mappedPositions.get(s)); - } + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + for(String s : mappedPositions.keySet()) + nbttagcompound.setString(s, mappedPositions.get(s)); + } - public static WorldData get(World world) { - WorldData data = (WorldData) world.mapStorage.loadData(WorldData.class, ID); + public static WorldData get(World world) { + WorldData data = (WorldData) world.mapStorage.loadData(WorldData.class, ID); - if (data == null) { - data = new WorldData(ID); - data.markDirty(); - world.mapStorage.setData(ID, data); - } - return data; - } - } + if(data == null) { + data = new WorldData(ID); + data.markDirty(); + world.mapStorage.setData(ID, data); + } + return data; + } + } - @SubscribeEvent - public void tickEnd(TickEvent event) { - if(event.type == Type.SERVER && event.phase == Phase.END) - for(String s : coordsToCheck.keySet()) { - Block block = getBlockAt(s); - decrCoords(s); + @SubscribeEvent + public void tickEnd(TickEvent event) { + if(event.type == Type.SERVER && event.phase == Phase.END) for(String s : coordsToCheck.keySet()) { + Block block = getBlockAt(s); + decrCoords(s); - if(block == Blocks.piston_extension) { - int meta = getBlockMetaAt(s); - ForgeDirection dir = ForgeDirection.getOrientation(meta & ~8); + if(block == Blocks.piston_extension) { + int meta = getBlockMetaAt(s); + ForgeDirection dir = ForgeDirection.getOrientation(meta & ~8); - MinecraftServer server = MinecraftServer.getServer(); + MinecraftServer server = MinecraftServer.getServer(); - if(server != null && getTimeInCoords(s) == 0) { - String newPos; + if(server != null && getTimeInCoords(s) == 0) { + String newPos; - { - String[] tokens = s.split(":"); - int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]); - World world = server.worldServerForDimension(worldId); - world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, ModBlocks.pistonRelay); - newPos = getCoordsAsString(world.provider.dimensionId, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ); - } + { + String[] tokens = s.split(":"); + int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]); + World world = server.worldServerForDimension(worldId); + world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, ModBlocks.pistonRelay); + newPos = getCoordsAsString(world.provider.dimensionId, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ); + } - if(mappedPositions.containsKey(s)) { - String pos = mappedPositions.get(s); - String[] tokens = pos.split(":"); - int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]); - World world = server.worldServerForDimension(worldId); + if(mappedPositions.containsKey(s)) { + String pos = mappedPositions.get(s); + String[] tokens = pos.split(":"); + int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]); + World world = server.worldServerForDimension(worldId); - Block srcBlock = world.getBlock(x, y, z); - int srcMeta = world.getBlockMetadata(x, y, z); - TileEntity tile = world.getTileEntity(x, y, z); - Material mat = srcBlock.getMaterial(); + Block srcBlock = world.getBlock(x, y, z); + int srcMeta = world.getBlockMetadata(x, y, z); + TileEntity tile = world.getTileEntity(x, y, z); + Material mat = srcBlock.getMaterial(); - if(tile == null && mat.getMaterialMobility() == 0 && !srcBlock.isAir(world, x, y, z)) { - Material destMat = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).getMaterial(); - if(world.isAirBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) || destMat.isReplaceable()) { - world.setBlock(x, y, z, Blocks.air); - world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, srcBlock, srcMeta, 1 | 2); - mappedPositions.put(s, getCoordsAsString(world.provider.dimensionId, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)); - } - } + if(tile == null && mat.getMaterialMobility() == 0 && !srcBlock.isAir(world, x, y, z)) { + Material destMat = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).getMaterial(); + if(world.isAirBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) || destMat.isReplaceable()) { + world.setBlock(x, y, z, Blocks.air); + world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, srcBlock, srcMeta, 1 | 2); + mappedPositions.put(s, getCoordsAsString(world.provider.dimensionId, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)); + } + } - pos = mappedPositions.get(s); - mappedPositions.remove(s); - mappedPositions.put(newPos, pos); - WorldData.get(world).markDirty(); - } - } - } - } + pos = mappedPositions.get(s); + mappedPositions.remove(s); + mappedPositions.put(newPos, pos); + WorldData.get(world).markDirty(); + } + } + } + } - for(String s : removeThese) - coordsToCheck.remove(s); - removeThese.clear(); - } + for(String s : removeThese) + coordsToCheck.remove(s); + removeThese.clear(); + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - return LexiconData.pistonRelay; - } + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + return LexiconData.pistonRelay; + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockPool.java b/MODSRC/vazkii/botania/common/block/BlockPool.java index 522162422..06d7f751b 100644 --- a/MODSRC/vazkii/botania/common/block/BlockPool.java +++ b/MODSRC/vazkii/botania/common/block/BlockPool.java @@ -2,11 +2,11 @@ * This class was created by . 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 26, 2014, 12:22:58 AM (GMT)] */ package vazkii.botania.common.block; @@ -33,82 +33,80 @@ import vazkii.botania.common.lib.LibBlockNames; public class BlockPool extends BlockModContainer implements IWandHUD, IWandable, ILexiconable { - protected BlockPool() { - super(Material.rock); - setHardness(2.0F); - setResistance(10.0F); - setStepSound(soundTypeStone); - setBlockName(LibBlockNames.POOL); - setBlockBounds(0F, 0F, 0F, 1F, 0.5F, 1F); - } - - @Override - public void registerBlockIcons(IIconRegister par1IconRegister) { - // NO-OP - } + protected BlockPool() { + super(Material.rock); + setHardness(2.0F); + setResistance(10.0F); + setStepSound(soundTypeStone); + setBlockName(LibBlockNames.POOL); + setBlockBounds(0F, 0F, 0F, 1F, 0.5F, 1F); + } - @Override - public TileEntity createNewTileEntity(World world, int meta) { - return new TilePool(); - } + @Override + public void registerBlockIcons(IIconRegister par1IconRegister) { + // NO-OP + } - @Override - public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { - if(par5Entity instanceof EntityItem) { - TilePool tile = (TilePool) par1World.getTileEntity(par2, par3, par4); - if(tile.collideEntityItem((EntityItem) par5Entity)) - par1World.markBlockForUpdate(par2, par3, par4); - } - } + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TilePool(); + } - @Override - public boolean isOpaqueCube() { - return false; - } + @Override + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { + if(par5Entity instanceof EntityItem) { + TilePool tile = (TilePool) par1World.getTileEntity(par2, par3, par4); + if(tile.collideEntityItem((EntityItem) par5Entity)) par1World.markBlockForUpdate(par2, par3, par4); + } + } - @Override - public boolean renderAsNormalBlock() { - return false; - } + @Override + public boolean isOpaqueCube() { + return false; + } - @Override - public IIcon getIcon(int par1, int par2) { - return ModBlocks.livingrock.getIcon(par1, par2); - } + @Override + public boolean renderAsNormalBlock() { + return false; + } - @Override - public int getRenderType() { - return LibRenderIDs.idPool; - } + @Override + public IIcon getIcon(int par1, int par2) { + return ModBlocks.livingrock.getIcon(par1, par2); + } - @Override - public boolean hasComparatorInputOverride() { - return true; - } + @Override + public int getRenderType() { + return LibRenderIDs.idPool; + } - @Override - public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) { - TilePool pool = (TilePool) par1World.getTileEntity(par2, par3, par4); - int val = (int) ((double) pool.getCurrentMana() / (double) TilePool.MAX_MANA * 15.0); - if(pool.getCurrentMana() > 0) - val = Math.max(val, 1); + @Override + public boolean hasComparatorInputOverride() { + return true; + } - return val; - } + @Override + public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) { + TilePool pool = (TilePool) par1World.getTileEntity(par2, par3, par4); + int val = (int) ((double) pool.getCurrentMana() / (double) TilePool.MAX_MANA * 15.0); + if(pool.getCurrentMana() > 0) val = Math.max(val, 1); - @Override - public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) { - ((TilePool) world.getTileEntity(x, y, z)).renderHUD(mc, res); - } + return val; + } - @Override - public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) { - ((TilePool) world.getTileEntity(x, y, z)).onWanded(player, stack); - return true; - } + @Override + public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) { + ((TilePool) world.getTileEntity(x, y, z)).renderHUD(mc, res); + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - return LexiconData.pool; - } + @Override + public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) { + ((TilePool) world.getTileEntity(x, y, z)).onWanded(player, stack); + return true; + } + + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + return LexiconData.pool; + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockPylon.java b/MODSRC/vazkii/botania/common/block/BlockPylon.java index 6db3290ca..e906416f1 100644 --- a/MODSRC/vazkii/botania/common/block/BlockPylon.java +++ b/MODSRC/vazkii/botania/common/block/BlockPylon.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Feb 18, 2014, 10:13:02 PM (GMT)] */ package vazkii.botania.common.block; @@ -28,53 +28,53 @@ import vazkii.botania.common.lib.LibBlockNames; public class BlockPylon extends BlockModContainer implements ILexiconable { - public BlockPylon() { - super(Material.iron); - setHardness(5.5F); - setStepSound(soundTypeMetal); - setBlockName(LibBlockNames.PYLON); + public BlockPylon() { + super(Material.iron); + setHardness(5.5F); + setStepSound(soundTypeMetal); + setBlockName(LibBlockNames.PYLON); - float f = 1F / 16F * 2F; - setBlockBounds(f, 0F, f, 1F - f, 1F / 16F * 21F, 1F - f); - } - - @Override - public void registerBlockIcons(IIconRegister par1IconRegister) { - // NO-OP - } + float f = 1F / 16F * 2F; + setBlockBounds(f, 0F, f, 1F - f, 1F / 16F * 21F, 1F - f); + } - @Override - public IIcon getIcon(int par1, int par2) { - return Blocks.diamond_block.getIcon(par1, par2); - } + @Override + public void registerBlockIcons(IIconRegister par1IconRegister) { + // NO-OP + } - @Override - public boolean isOpaqueCube() { - return false; - } + @Override + public IIcon getIcon(int par1, int par2) { + return Blocks.diamond_block.getIcon(par1, par2); + } - @Override - public boolean renderAsNormalBlock() { - return false; - } + @Override + public boolean isOpaqueCube() { + return false; + } - @Override - public int getRenderType() { - return LibRenderIDs.idPylon; - } + @Override + public boolean renderAsNormalBlock() { + return false; + } - @Override - public float getEnchantPowerBonus(World world, int x, int y, int z) { - return 8; - } + @Override + public int getRenderType() { + return LibRenderIDs.idPylon; + } - @Override - public TileEntity createNewTileEntity(World world, int meta) { - return new TilePylon(); - } + @Override + public float getEnchantPowerBonus(World world, int x, int y, int z) { + return 8; + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - return LexiconData.pylon; - } + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TilePylon(); + } + + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + return LexiconData.pylon; + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockRuneAltar.java b/MODSRC/vazkii/botania/common/block/BlockRuneAltar.java index dcf6c1d5d..6506ece45 100644 --- a/MODSRC/vazkii/botania/common/block/BlockRuneAltar.java +++ b/MODSRC/vazkii/botania/common/block/BlockRuneAltar.java @@ -2,17 +2,15 @@ * This class was created by . 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 @ [Feb 2, 2014, 2:10:14 PM (GMT)] */ package vazkii.botania.common.block; -import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -32,105 +30,106 @@ import vazkii.botania.common.block.tile.TileSimpleInventory; import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.lib.LibBlockNames; +import java.util.Random; + public class BlockRuneAltar extends BlockModContainer implements IWandable, ILexiconable { - Random random; - IIcon[] icons; + Random random; + IIcon[] icons; - public BlockRuneAltar() { - super(Material.rock); - setBlockBounds(0F, 0F, 0F, 1F, 0.75F, 1F); - setHardness(2.0F); - setResistance(10.0F); - setStepSound(soundTypeStone); - setBlockName(LibBlockNames.RUNE_ALTAR); + public BlockRuneAltar() { + super(Material.rock); + setBlockBounds(0F, 0F, 0F, 1F, 0.75F, 1F); + setHardness(2.0F); + setResistance(10.0F); + setStepSound(soundTypeStone); + setBlockName(LibBlockNames.RUNE_ALTAR); - random = new Random(); - } + random = new Random(); + } - @Override - public boolean isOpaqueCube() { - return false; - } + @Override + public boolean isOpaqueCube() { + return false; + } - @Override - public boolean renderAsNormalBlock() { - return false; - } + @Override + public boolean renderAsNormalBlock() { + return false; + } - @Override - public void registerBlockIcons(IIconRegister par1IconRegister) { - icons = new IIcon[3]; - for(int i = 0; i < icons.length; i++) - icons[i] = IconHelper.forBlock(par1IconRegister, this, i); - } + @Override + public void registerBlockIcons(IIconRegister par1IconRegister) { + icons = new IIcon[3]; + for(int i = 0; i < icons.length; i++) + icons[i] = IconHelper.forBlock(par1IconRegister, this, i); + } - @Override - public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { - ItemStack stack = par5EntityPlayer.getCurrentEquippedItem(); - if(stack != null) - return ((TileRuneAltar) par1World.getTileEntity(par2, par3, par4)).addItem(par5EntityPlayer, stack); + @Override + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { + ItemStack stack = par5EntityPlayer.getCurrentEquippedItem(); + if(stack != null) + return ((TileRuneAltar) par1World.getTileEntity(par2, par3, par4)).addItem(par5EntityPlayer, stack); - return false; - } + return false; + } - @Override - public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) { - TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4); + @Override + public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) { + TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4); - if (inv != null) { - for (int j1 = 0; j1 < inv.getSizeInventory(); ++j1) { - ItemStack itemstack = inv.getStackInSlot(j1); + if(inv != null) { + for(int j1 = 0; j1 < inv.getSizeInventory(); ++j1) { + ItemStack itemstack = inv.getStackInSlot(j1); - if (itemstack != null) { - float f = random.nextFloat() * 0.8F + 0.1F; - float f1 = random.nextFloat() * 0.8F + 0.1F; - EntityItem entityitem; + if(itemstack != null) { + float f = random.nextFloat() * 0.8F + 0.1F; + float f1 = random.nextFloat() * 0.8F + 0.1F; + EntityItem entityitem; - for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) { - int k1 = random.nextInt(21) + 10; + for(float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) { + int k1 = random.nextInt(21) + 10; - if (k1 > itemstack.stackSize) - k1 = itemstack.stackSize; + if(k1 > itemstack.stackSize) k1 = itemstack.stackSize; - itemstack.stackSize -= k1; - entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage())); - float f3 = 0.05F; - entityitem.motionX = (float)random.nextGaussian() * f3; - entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)random.nextGaussian() * f3; + itemstack.stackSize -= k1; + entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage())); + float f3 = 0.05F; + entityitem.motionX = (float) random.nextGaussian() * f3; + entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) random.nextGaussian() * f3; - if (itemstack.hasTagCompound()) - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } - } - } + if(itemstack.hasTagCompound()) + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } + } + } - par1World.func_147453_f(par2, par3, par4, par5); - } + par1World.func_147453_f(par2, par3, par4, par5); + } - super.breakBlock(par1World, par2, par3, par4, par5, par6); - } + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } - @Override - public IIcon getIcon(int par1, int par2) { - return icons[Math.min(2, par1)]; - } + @Override + public IIcon getIcon(int par1, int par2) { + return icons[Math.min(2, par1)]; + } - @Override - public TileEntity createNewTileEntity(World world, int meta) { - return new TileRuneAltar(); - } + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileRuneAltar(); + } - @Override - public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) { - ((TileRuneAltar) world.getTileEntity(x, y, z)).onWanded(player, stack); - return true; - } + @Override + public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) { + ((TileRuneAltar) world.getTileEntity(x, y, z)).onWanded(player, stack); + return true; + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - return LexiconData.runicAltar; - } + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + return LexiconData.runicAltar; + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockSpecialFlower.java b/MODSRC/vazkii/botania/common/block/BlockSpecialFlower.java index 03ade0eeb..16ccd6455 100644 --- a/MODSRC/vazkii/botania/common/block/BlockSpecialFlower.java +++ b/MODSRC/vazkii/botania/common/block/BlockSpecialFlower.java @@ -2,21 +2,16 @@ * This class was created by . 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 22, 2014, 7:06:38 PM (GMT)] */ package vazkii.botania.common.block; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.BlockFlower; import net.minecraft.block.ITileEntityProvider; @@ -43,136 +38,120 @@ import vazkii.botania.common.block.tile.TileSpecialFlower; import vazkii.botania.common.core.BotaniaCreativeTab; import vazkii.botania.common.item.block.ItemBlockSpecialFlower; import vazkii.botania.common.lib.LibBlockNames; -import cpw.mods.fml.common.registry.GameRegistry; + +import java.util.*; public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvider, ISpecialFlower, IWandable, ILexiconable, IWandHUD { - public static Map icons = new HashMap(); - - private static String[] subtypes = { - // Misc - LibBlockNames.SUBTILE_PUREDAISY, + public static Map icons = new HashMap(); - // Generating - LibBlockNames.SUBTILE_DAYBLOOM, - LibBlockNames.SUBTILE_NIGHTSHADE, - LibBlockNames.SUBTILE_ENDOFLAME, - LibBlockNames.SUBTILE_HYDROANGEAS, - LibBlockNames.SUBTILE_THERMALILY, - LibBlockNames.SUBTILE_ARCANE_ROSE, + private static String[] subtypes = { + // Misc + LibBlockNames.SUBTILE_PUREDAISY, - // Functional - LibBlockNames.SUBTILE_JADED_AMARANTHUS, - LibBlockNames.SUBTILE_BELLETHORN, - LibBlockNames.SUBTILE_HEISEI_DREAM, - LibBlockNames.SUBTILE_TIGERSEYE, - LibBlockNames.SUBTILE_ORECHID, - LibBlockNames.SUBTILE_FALLEN_KANADE, - LibBlockNames.SUBTILE_EXOFLAME, - LibBlockNames.SUBTILE_AGRICARNATION, - LibBlockNames.SUBTILE_HOPPERHOCK, - LibBlockNames.SUBTILE_TANGLEBERRIE, - LibBlockNames.SUBTILE_JIYUULIA - }; + // Generating + LibBlockNames.SUBTILE_DAYBLOOM, LibBlockNames.SUBTILE_NIGHTSHADE, LibBlockNames.SUBTILE_ENDOFLAME, LibBlockNames.SUBTILE_HYDROANGEAS, LibBlockNames.SUBTILE_THERMALILY, LibBlockNames.SUBTILE_ARCANE_ROSE, - protected BlockSpecialFlower() { - super(0); - setBlockName(LibBlockNames.SPECIAL_FLOWER); - setHardness(0F); - setStepSound(soundTypeGrass); - setTickRandomly(true); - setCreativeTab(BotaniaCreativeTab.INSTANCE); - setBlockBounds(0.3F, 0.0F, 0.3F, 0.8F, 1, 0.8F); - } + // Functional + LibBlockNames.SUBTILE_JADED_AMARANTHUS, LibBlockNames.SUBTILE_BELLETHORN, LibBlockNames.SUBTILE_HEISEI_DREAM, LibBlockNames.SUBTILE_TIGERSEYE, LibBlockNames.SUBTILE_ORECHID, LibBlockNames.SUBTILE_FALLEN_KANADE, LibBlockNames.SUBTILE_EXOFLAME, LibBlockNames.SUBTILE_AGRICARNATION, LibBlockNames.SUBTILE_HOPPERHOCK, LibBlockNames.SUBTILE_TANGLEBERRIE, LibBlockNames.SUBTILE_JIYUULIA}; - @Override - public int getRenderType() { - return LibRenderIDs.idSpecialFlower; - } + protected BlockSpecialFlower() { + super(0); + setBlockName(LibBlockNames.SPECIAL_FLOWER); + setHardness(0F); + setStepSound(soundTypeGrass); + setTickRandomly(true); + setCreativeTab(BotaniaCreativeTab.INSTANCE); + setBlockBounds(0.3F, 0.0F, 0.3F, 0.8F, 1, 0.8F); + } - @Override - public Block setBlockName(String par1Str) { - GameRegistry.registerBlock(this, ItemBlockSpecialFlower.class, par1Str); - return super.setBlockName(par1Str); - } + @Override + public int getRenderType() { + return LibRenderIDs.idSpecialFlower; + } - @Override - public int quantityDropped(Random par1Random) { - return 0; - } + @Override + public Block setBlockName(String par1Str) { + GameRegistry.registerBlock(this, ItemBlockSpecialFlower.class, par1Str); + return super.setBlockName(par1Str); + } - @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - for(String s : subtypes) - par3List.add(ItemBlockSpecialFlower.ofType(s)); - } + @Override + public int quantityDropped(Random par1Random) { + return 0; + } - @Override - public void registerBlockIcons(IIconRegister par1IconRegister) { - for(String s : subtypes) - icons.put(s, IconHelper.forName(par1IconRegister, s)); - } + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for(String s : subtypes) + par3List.add(ItemBlockSpecialFlower.ofType(s)); + } - @Override - public IIcon getIcon(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) { - return ((TileSpecialFlower) par1iBlockAccess.getTileEntity(par2, par3, par4)).getIcon(); - } + @Override + public void registerBlockIcons(IIconRegister par1IconRegister) { + for(String s : subtypes) + icons.put(s, IconHelper.forName(par1IconRegister, s)); + } - @Override - public IIcon getIcon(int par1, int par2) { - return BlockModFlower.icons[16]; - } + @Override + public IIcon getIcon(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) { + return ((TileSpecialFlower) par1iBlockAccess.getTileEntity(par2, par3, par4)).getIcon(); + } - @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { - String name = ((TileSpecialFlower) world.getTileEntity(x, y, z)).subTileName; - return ItemBlockSpecialFlower.ofType(name); - } + @Override + public IIcon getIcon(int par1, int par2) { + return BlockModFlower.icons[16]; + } - @Override - public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) { - if(!par6EntityPlayer.capabilities.isCreativeMode) - dropBlockAsItem(par1World, par2, par3, par4, par5, 0); - } + @Override + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { + String name = ((TileSpecialFlower) world.getTileEntity(x, y, z)).subTileName; + return ItemBlockSpecialFlower.ofType(name); + } - @Override - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { - ArrayList list = new ArrayList(); - TileEntity tile = world.getTileEntity(x, y, z); + @Override + public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) { + if(!par6EntityPlayer.capabilities.isCreativeMode) dropBlockAsItem(par1World, par2, par3, par4, par5, 0); + } - if(tile != null) { - String name = ((TileSpecialFlower) tile).subTileName; - list.add(ItemBlockSpecialFlower.ofType(name)); - } + @Override + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + ArrayList list = new ArrayList(); + TileEntity tile = world.getTileEntity(x, y, z); - return list; - } + if(tile != null) { + String name = ((TileSpecialFlower) tile).subTileName; + list.add(ItemBlockSpecialFlower.ofType(name)); + } - @Override - public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6) { - super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6); - TileEntity tileentity = par1World.getTileEntity(par2, par3, par4); - return tileentity != null ? tileentity.receiveClientEvent(par5, par6) : false; - } + return list; + } - @Override - public TileEntity createNewTileEntity(World world, int meta) { - return new TileSpecialFlower(); - } + @Override + public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6) { + super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6); + TileEntity tileentity = par1World.getTileEntity(par2, par3, par4); + return tileentity != null ? tileentity.receiveClientEvent(par5, par6) : false; + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - return ((TileSpecialFlower) world.getTileEntity(x, y, z)).getEntry(); - } + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileSpecialFlower(); + } - @Override - public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) { - return ((TileSpecialFlower) world.getTileEntity(x, y, z)).onWanded(stack, player); - } + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + return ((TileSpecialFlower) world.getTileEntity(x, y, z)).getEntry(); + } - @Override - public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) { - ((TileSpecialFlower) world.getTileEntity(x, y, z)).renderHUD(mc, res); - } + @Override + public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) { + return ((TileSpecialFlower) world.getTileEntity(x, y, z)).onWanded(stack, player); + } + + @Override + public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) { + ((TileSpecialFlower) world.getTileEntity(x, y, z)).renderHUD(mc, res); + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockSpreader.java b/MODSRC/vazkii/botania/common/block/BlockSpreader.java index 5b72eb599..dc060ef17 100644 --- a/MODSRC/vazkii/botania/common/block/BlockSpreader.java +++ b/MODSRC/vazkii/botania/common/block/BlockSpreader.java @@ -2,18 +2,15 @@ * This class was created by . 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 25, 2014, 9:38:23 PM (GMT)] */ package vazkii.botania.common.block; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; @@ -25,7 +22,6 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -45,178 +41,178 @@ import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName; import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.lib.LibBlockNames; +import java.util.List; +import java.util.Random; + public class BlockSpreader extends BlockModContainer implements IWandable, IWandHUD, ILexiconable { - Random random; + Random random; - protected BlockSpreader() { - super(Material.wood); - setHardness(2.0F); - setStepSound(soundTypeWood); - setBlockName(LibBlockNames.SPREADER); + protected BlockSpreader() { + super(Material.wood); + setHardness(2.0F); + setStepSound(soundTypeWood); + setBlockName(LibBlockNames.SPREADER); - random = new Random(); - } - - @Override - protected boolean shouldRegisterInNameSet() { - return false; - } + random = new Random(); + } - @Override - public Block setBlockName(String par1Str) { - GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str); - return super.setBlockName(par1Str); - } + @Override + protected boolean shouldRegisterInNameSet() { + return false; + } - @Override - public void registerBlockIcons(IIconRegister par1IconRegister) { - // NO-OP - } - - @Override - public void getSubBlocks(Item par1, CreativeTabs par2, List par3) { - for(int i = 0; i < 2; i++) - par3.add(new ItemStack(par1, 1, i)); - } - - @Override - public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) { - int orientation = BlockPistonBase.determineOrientation(par1World, par2, par3, par4, par5EntityLivingBase); - TileSpreader spreader = (TileSpreader) par1World.getTileEntity(par2, par3, par4); - par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() & 1, 1 | 2); - - switch(orientation) { - case 0: - spreader.rotationY = -90F; - break; - case 1: - spreader.rotationY = 90F; - break; - case 2: - spreader.rotationX = 270F; - break; - case 3: - spreader.rotationX = 90F; - break; - case 4: - break; - default: - spreader.rotationX = 180F; - break; - } - } - - @Override - public int damageDropped(int par1) { - return par1; - } - - @Override - public boolean isOpaqueCube() { - return false; - } + @Override + public Block setBlockName(String par1Str) { + GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str); + return super.setBlockName(par1Str); + } - @Override - public boolean renderAsNormalBlock() { - return false; - } + @Override + public void registerBlockIcons(IIconRegister par1IconRegister) { + // NO-OP + } - @Override - public IIcon getIcon(int par1, int par2) { - return ModBlocks.livingwood.getIcon(par1, par2); - } + @Override + public void getSubBlocks(Item par1, CreativeTabs par2, List par3) { + for(int i = 0; i < 2; i++) + par3.add(new ItemStack(par1, 1, i)); + } - @Override - public int getRenderType() { - return LibRenderIDs.idSpreader; - } + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) { + int orientation = BlockPistonBase.determineOrientation(par1World, par2, par3, par4, par5EntityLivingBase); + TileSpreader spreader = (TileSpreader) par1World.getTileEntity(par2, par3, par4); + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() & 1, 1 | 2); - @Override - public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { - TileSpreader spreader = (TileSpreader) par1World.getTileEntity(par2, par3, par4); - ItemStack lens = spreader.getStackInSlot(0); - ItemStack heldItem = par5EntityPlayer.getCurrentEquippedItem(); - boolean isHeldItemLens = heldItem != null && heldItem.getItem() instanceof ILens; + switch(orientation) { + case 0: + spreader.rotationY = -90F; + break; + case 1: + spreader.rotationY = 90F; + break; + case 2: + spreader.rotationX = 270F; + break; + case 3: + spreader.rotationX = 90F; + break; + case 4: + break; + default: + spreader.rotationX = 180F; + break; + } + } - if(heldItem != null) - if(heldItem.getItem() == ModItems.twigWand) - return false; + @Override + public int damageDropped(int par1) { + return par1; + } - if(lens == null && isHeldItemLens) { - par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null); - spreader.setInventorySlotContents(0, heldItem.copy()); - spreader.markDirty(); - } else if(lens != null) { - ItemStack add = lens.copy(); - if(!par5EntityPlayer.inventory.addItemStackToInventory(add)) - par5EntityPlayer.dropPlayerItemWithRandomChoice(add, false); - spreader.setInventorySlotContents(0, null); - spreader.markDirty(); - } + @Override + public boolean isOpaqueCube() { + return false; + } - return true; - } + @Override + public boolean renderAsNormalBlock() { + return false; + } - @Override - public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) { - TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4); + @Override + public IIcon getIcon(int par1, int par2) { + return ModBlocks.livingwood.getIcon(par1, par2); + } - if (inv != null) { - for (int j1 = 0; j1 < inv.getSizeInventory(); ++j1) { - ItemStack itemstack = inv.getStackInSlot(j1); + @Override + public int getRenderType() { + return LibRenderIDs.idSpreader; + } - if (itemstack != null) { - float f = random.nextFloat() * 0.8F + 0.1F; - float f1 = random.nextFloat() * 0.8F + 0.1F; - EntityItem entityitem; + @Override + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { + TileSpreader spreader = (TileSpreader) par1World.getTileEntity(par2, par3, par4); + ItemStack lens = spreader.getStackInSlot(0); + ItemStack heldItem = par5EntityPlayer.getCurrentEquippedItem(); + boolean isHeldItemLens = heldItem != null && heldItem.getItem() instanceof ILens; - for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) { - int k1 = random.nextInt(21) + 10; + if(heldItem != null) if(heldItem.getItem() == ModItems.twigWand) return false; - if (k1 > itemstack.stackSize) - k1 = itemstack.stackSize; + if(lens == null && isHeldItemLens) { + par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null); + spreader.setInventorySlotContents(0, heldItem.copy()); + spreader.markDirty(); + } else if(lens != null) { + ItemStack add = lens.copy(); + if(!par5EntityPlayer.inventory.addItemStackToInventory(add)) + par5EntityPlayer.dropPlayerItemWithRandomChoice(add, false); + spreader.setInventorySlotContents(0, null); + spreader.markDirty(); + } - itemstack.stackSize -= k1; - entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage())); - float f3 = 0.05F; - entityitem.motionX = (float)random.nextGaussian() * f3; - entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)random.nextGaussian() * f3; + return true; + } - if (itemstack.hasTagCompound()) - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } - } - } + @Override + public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) { + TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4); - par1World.func_147453_f(par2, par3, par4, par5); - } + if(inv != null) { + for(int j1 = 0; j1 < inv.getSizeInventory(); ++j1) { + ItemStack itemstack = inv.getStackInSlot(j1); - super.breakBlock(par1World, par2, par3, par4, par5, par6); - } + if(itemstack != null) { + float f = random.nextFloat() * 0.8F + 0.1F; + float f1 = random.nextFloat() * 0.8F + 0.1F; + EntityItem entityitem; + + for(float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) { + int k1 = random.nextInt(21) + 10; + + if(k1 > itemstack.stackSize) k1 = itemstack.stackSize; + + itemstack.stackSize -= k1; + entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage())); + float f3 = 0.05F; + entityitem.motionX = (float) random.nextGaussian() * f3; + entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) random.nextGaussian() * f3; + + if(itemstack.hasTagCompound()) + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } + } + } + + par1World.func_147453_f(par2, par3, par4, par5); + } + + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } - @Override - public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) { - ((TileSpreader) world.getTileEntity(x, y, z)).onWanded(player, stack); - return true; - } + @Override + public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) { + ((TileSpreader) world.getTileEntity(x, y, z)).onWanded(player, stack); + return true; + } - @Override - public TileEntity createNewTileEntity(World world, int meta) { - return new TileSpreader(); - } + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileSpreader(); + } - @Override - public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) { - ((TileSpreader) world.getTileEntity(x, y, z)).renderHUD(mc, res); - } + @Override + public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) { + ((TileSpreader) world.getTileEntity(x, y, z)).renderHUD(mc, res); + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - int meta = world.getBlockMetadata(x, y, z); - return meta == 0 ? LexiconData.spreader : LexiconData.redstoneSpreader; - } + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + int meta = world.getBlockMetadata(x, y, z); + return meta == 0 ? LexiconData.spreader : LexiconData.redstoneSpreader; + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockTurntable.java b/MODSRC/vazkii/botania/common/block/BlockTurntable.java index 15365abc2..40691f0dc 100644 --- a/MODSRC/vazkii/botania/common/block/BlockTurntable.java +++ b/MODSRC/vazkii/botania/common/block/BlockTurntable.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 16, 2014, 10:08:14 PM (GMT)] */ package vazkii.botania.common.block; @@ -31,46 +31,46 @@ import vazkii.botania.common.lib.LibBlockNames; public class BlockTurntable extends BlockModContainer implements IWandable, IWandHUD, ILexiconable { - IIcon[] icons; + IIcon[] icons; - protected BlockTurntable() { - super(Material.wood); - setHardness(2.0F); - setStepSound(soundTypeWood); - setBlockName(LibBlockNames.TURNTABLE); - } + protected BlockTurntable() { + super(Material.wood); + setHardness(2.0F); + setStepSound(soundTypeWood); + setBlockName(LibBlockNames.TURNTABLE); + } - @Override - public void registerBlockIcons(IIconRegister par1IconRegister) { - icons = new IIcon[2]; - for(int i = 0; i < icons.length; i++) - icons[i] = IconHelper.forBlock(par1IconRegister, this, i); - } + @Override + public void registerBlockIcons(IIconRegister par1IconRegister) { + icons = new IIcon[2]; + for(int i = 0; i < icons.length; i++) + icons[i] = IconHelper.forBlock(par1IconRegister, this, i); + } - @Override - public IIcon getIcon(int par1, int par2) { - return par1 == 1 ? icons[0] : icons[1]; - } + @Override + public IIcon getIcon(int par1, int par2) { + return par1 == 1 ? icons[0] : icons[1]; + } - @Override - public TileEntity createNewTileEntity(World world, int meta) { - return new TileTurntable(); - } + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileTurntable(); + } - @Override - public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) { - ((TileTurntable) world.getTileEntity(x, y, z)).renderHUD(mc, res); - } + @Override + public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) { + ((TileTurntable) world.getTileEntity(x, y, z)).renderHUD(mc, res); + } - @Override - public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) { - ((TileTurntable) world.getTileEntity(x, y, z)).onWanded(player, stack); - return true; - } + @Override + public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) { + ((TileTurntable) world.getTileEntity(x, y, z)).onWanded(player, stack); + return true; + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - return LexiconData.turntable; - } + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + return LexiconData.turntable; + } } diff --git a/MODSRC/vazkii/botania/common/block/BlockUnstable.java b/MODSRC/vazkii/botania/common/block/BlockUnstable.java index 7adab4118..c7340dfb0 100644 --- a/MODSRC/vazkii/botania/common/block/BlockUnstable.java +++ b/MODSRC/vazkii/botania/common/block/BlockUnstable.java @@ -2,19 +2,16 @@ * This class was created by . 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 @ [Feb 4, 2014, 6:00:44 PM (GMT)] */ package vazkii.botania.common.block; -import java.awt.Color; -import java.util.List; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; @@ -31,77 +28,80 @@ import vazkii.botania.common.core.helper.Vector3; import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName; import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.lib.LibBlockNames; -import cpw.mods.fml.common.registry.GameRegistry; + +import java.awt.*; +import java.util.List; +import java.util.Random; public class BlockUnstable extends BlockMod implements ILexiconable { - public BlockUnstable() { - super(Material.iron); - setHardness(5.0F); - setResistance(10.0F); - setStepSound(soundTypeMetal); - setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.75F, 0.75F); - setBlockName(LibBlockNames.UNSTABLE_BLOCK); - setTickRandomly(true); - } + public BlockUnstable() { + super(Material.iron); + setHardness(5.0F); + setResistance(10.0F); + setStepSound(soundTypeMetal); + setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.75F, 0.75F); + setBlockName(LibBlockNames.UNSTABLE_BLOCK); + setTickRandomly(true); + } - @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - for(int i = 0; i < 16; i++) - par3List.add(new ItemStack(par1, 1, i)); - } + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for(int i = 0; i < 16; i++) + par3List.add(new ItemStack(par1, 1, i)); + } - @Override - public Block setBlockName(String par1Str) { - GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str); - return super.setBlockName(par1Str); - } + @Override + public Block setBlockName(String par1Str) { + GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str); + return super.setBlockName(par1Str); + } - @Override - protected boolean shouldRegisterInNameSet() { - return false; - } + @Override + protected boolean shouldRegisterInNameSet() { + return false; + } - @Override - public boolean renderAsNormalBlock() { - return false; - } + @Override + public boolean renderAsNormalBlock() { + return false; + } - @Override - public boolean isOpaqueCube() { - return false; - } + @Override + public boolean isOpaqueCube() { + return false; + } - @Override - public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { - int color = getRenderColor(par1World.getBlockMetadata(par2, par3, par4)); - int colorBright = new Color(color).brighter().getRGB(); - int colorDark = new Color(color).darker().getRGB(); + @Override + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { + int color = getRenderColor(par1World.getBlockMetadata(par2, par3, par4)); + int colorBright = new Color(color).brighter().getRGB(); + int colorDark = new Color(color).darker().getRGB(); - Vector3 origVector = new Vector3(par2 + 0.5, par3 + 0.5, par4 + 0.5); - Vector3 endVector = origVector.copy().add(par1World.rand.nextDouble() * 2 - 1, par1World.rand.nextDouble() * 2 - 1, par1World.rand.nextDouble() * 2 - 1); - Botania.proxy.lightningFX(par1World, origVector, endVector, 5F, colorDark, colorBright); - } + Vector3 origVector = new Vector3(par2 + 0.5, par3 + 0.5, par4 + 0.5); + Vector3 endVector = origVector.copy().add(par1World.rand.nextDouble() * 2 - 1, par1World.rand.nextDouble() * 2 - 1, par1World.rand.nextDouble() * 2 - 1); + Botania.proxy.lightningFX(par1World, origVector, endVector, 5F, colorDark, colorBright); + } - @Override - public int damageDropped(int par1) { - return par1; - } + @Override + public int damageDropped(int par1) { + return par1; + } - @Override - public int getRenderColor(int par1) { - float[] color = EntitySheep.fleeceColorTable[par1]; - return new Color(color[0], color[1], color[2]).getRGB(); - } + @Override + public int getRenderColor(int par1) { + float[] color = EntitySheep.fleeceColorTable[par1]; + return new Color(color[0], color[1], color[2]).getRGB(); + } - @Override - public int colorMultiplier(IBlockAccess par1iBlockAccess, int par2, int par3, int par4) { - return getRenderColor(par1iBlockAccess.getBlockMetadata(par2, par3, par4)); - } + @Override + public int colorMultiplier(IBlockAccess par1iBlockAccess, int par2, int par3, int par4) { + return getRenderColor(par1iBlockAccess.getBlockMetadata(par2, par3, par4)); + } - @Override - public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { - return LexiconData.unstableBlocks; - } + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + return LexiconData.unstableBlocks; + } } diff --git a/MODSRC/vazkii/botania/common/block/ModBlocks.java b/MODSRC/vazkii/botania/common/block/ModBlocks.java index ebeba7865..165edb27c 100644 --- a/MODSRC/vazkii/botania/common/block/ModBlocks.java +++ b/MODSRC/vazkii/botania/common/block/ModBlocks.java @@ -2,149 +2,122 @@ * This class was created by . 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 14, 2014, 5:17:55 PM (GMT)] */ package vazkii.botania.common.block; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; import vazkii.botania.api.BotaniaAPI; import vazkii.botania.common.block.subtile.SubTilePureDaisy; -import vazkii.botania.common.block.subtile.functional.SubTileAgricarnation; -import vazkii.botania.common.block.subtile.functional.SubTileBellethorn; -import vazkii.botania.common.block.subtile.functional.SubTileExoflame; -import vazkii.botania.common.block.subtile.functional.SubTileFallenKanade; -import vazkii.botania.common.block.subtile.functional.SubTileHeiseiDream; -import vazkii.botania.common.block.subtile.functional.SubTileHopperhock; -import vazkii.botania.common.block.subtile.functional.SubTileJadedAmaranthus; -import vazkii.botania.common.block.subtile.functional.SubTileJiyuulia; -import vazkii.botania.common.block.subtile.functional.SubTileTangleberrie; -import vazkii.botania.common.block.subtile.functional.SubTileTigerseye; -import vazkii.botania.common.block.subtile.functional.SubtileOrechid; -import vazkii.botania.common.block.subtile.generating.SubTileArcaneRose; -import vazkii.botania.common.block.subtile.generating.SubTileDaybloom; -import vazkii.botania.common.block.subtile.generating.SubTileEndoflame; -import vazkii.botania.common.block.subtile.generating.SubTileHydroangeas; -import vazkii.botania.common.block.subtile.generating.SubTileNightshade; -import vazkii.botania.common.block.subtile.generating.SubTileThermalily; -import vazkii.botania.common.block.tile.TileAltar; -import vazkii.botania.common.block.tile.TileDistributor; -import vazkii.botania.common.block.tile.TileEnchanter; -import vazkii.botania.common.block.tile.TileManaBeacon; -import vazkii.botania.common.block.tile.TileManaDetector; -import vazkii.botania.common.block.tile.TileManaVoid; -import vazkii.botania.common.block.tile.TilePool; -import vazkii.botania.common.block.tile.TilePylon; -import vazkii.botania.common.block.tile.TileRuneAltar; -import vazkii.botania.common.block.tile.TileSpecialFlower; -import vazkii.botania.common.block.tile.TileSpreader; -import vazkii.botania.common.block.tile.TileTurntable; +import vazkii.botania.common.block.subtile.functional.*; +import vazkii.botania.common.block.subtile.generating.*; +import vazkii.botania.common.block.tile.*; import vazkii.botania.common.lib.LibBlockNames; import vazkii.botania.common.lib.LibOreDict; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.registry.GameRegistry; public final class ModBlocks { - public static Block flower; - public static Block altar; - public static Block livingrock; - public static Block livingwood; - public static Block specialFlower; - public static Block spreader; - public static Block pool; - public static Block runeAltar; - public static Block unstableBlock; - public static Block pylon; - public static Block pistonRelay; - public static Block distributor; - public static Block manaBeacon; - public static Block manaVoid; - public static Block manaDetector; - public static Block enchanter; - public static Block turntable; + public static Block flower; + public static Block altar; + public static Block livingrock; + public static Block livingwood; + public static Block specialFlower; + public static Block spreader; + public static Block pool; + public static Block runeAltar; + public static Block unstableBlock; + public static Block pylon; + public static Block pistonRelay; + public static Block distributor; + public static Block manaBeacon; + public static Block manaVoid; + public static Block manaDetector; + public static Block enchanter; + public static Block turntable; - public static void init() { - flower = new BlockModFlower(); - altar = new BlockAltar(); - livingrock = new BlockLivingrock(); - livingwood = new BlockLivingwood(); - specialFlower = new BlockSpecialFlower(); - spreader = new BlockSpreader(); - pool = new BlockPool(); - runeAltar = new BlockRuneAltar(); - unstableBlock = new BlockUnstable(); - pylon = new BlockPylon(); - pistonRelay = new BlockPistonRelay(); - distributor = new BlockDistributor(); - manaBeacon = new BlockManaBeacon(); - manaVoid = new BlockManaVoid(); - manaDetector = new BlockManaDetector(); - enchanter = new BlockEnchanter(); - turntable = new BlockTurntable(); + public static void init() { + flower = new BlockModFlower(); + altar = new BlockAltar(); + livingrock = new BlockLivingrock(); + livingwood = new BlockLivingwood(); + specialFlower = new BlockSpecialFlower(); + spreader = new BlockSpreader(); + pool = new BlockPool(); + runeAltar = new BlockRuneAltar(); + unstableBlock = new BlockUnstable(); + pylon = new BlockPylon(); + pistonRelay = new BlockPistonRelay(); + distributor = new BlockDistributor(); + manaBeacon = new BlockManaBeacon(); + manaVoid = new BlockManaVoid(); + manaDetector = new BlockManaDetector(); + enchanter = new BlockEnchanter(); + turntable = new BlockTurntable(); - for(int i = 0; i < 16; i++) - OreDictionary.registerOre(LibOreDict.FLOWER[i], new ItemStack(flower, 1, i)); + for(int i = 0; i < 16; i++) + OreDictionary.registerOre(LibOreDict.FLOWER[i], new ItemStack(flower, 1, i)); - OreDictionary.registerOre(LibOreDict.LIVING_ROCK, livingrock); - OreDictionary.registerOre(LibOreDict.LIVING_WOOD, livingwood); + OreDictionary.registerOre(LibOreDict.LIVING_ROCK, livingrock); + OreDictionary.registerOre(LibOreDict.LIVING_WOOD, livingwood); - initTileEntities(); - registerMultiparts(); - } + initTileEntities(); + registerMultiparts(); + } - private static void initTileEntities() { - GameRegistry.registerTileEntity(TileAltar.class, LibBlockNames.ALTAR); - GameRegistry.registerTileEntity(TileSpecialFlower.class, LibBlockNames.SPECIAL_FLOWER); - GameRegistry.registerTileEntity(TileSpreader.class, LibBlockNames.SPREADER); - GameRegistry.registerTileEntity(TilePool.class, LibBlockNames.POOL); - GameRegistry.registerTileEntity(TileRuneAltar.class, LibBlockNames.RUNE_ALTAR); - GameRegistry.registerTileEntity(TilePylon.class, LibBlockNames.PYLON); - GameRegistry.registerTileEntity(TileDistributor.class, LibBlockNames.DISTRIBUTOR); - GameRegistry.registerTileEntity(TileManaBeacon.class, LibBlockNames.MANA_BEACON); - GameRegistry.registerTileEntity(TileManaVoid.class, LibBlockNames.MANA_VOID); - GameRegistry.registerTileEntity(TileManaDetector.class, LibBlockNames.MANA_DETECTOR); - GameRegistry.registerTileEntity(TileEnchanter.class, LibBlockNames.ENCHANTER); - GameRegistry.registerTileEntity(TileTurntable.class, LibBlockNames.TURNTABLE); + private static void initTileEntities() { + GameRegistry.registerTileEntity(TileAltar.class, LibBlockNames.ALTAR); + GameRegistry.registerTileEntity(TileSpecialFlower.class, LibBlockNames.SPECIAL_FLOWER); + GameRegistry.registerTileEntity(TileSpreader.class, LibBlockNames.SPREADER); + GameRegistry.registerTileEntity(TilePool.class, LibBlockNames.POOL); + GameRegistry.registerTileEntity(TileRuneAltar.class, LibBlockNames.RUNE_ALTAR); + GameRegistry.registerTileEntity(TilePylon.class, LibBlockNames.PYLON); + GameRegistry.registerTileEntity(TileDistributor.class, LibBlockNames.DISTRIBUTOR); + GameRegistry.registerTileEntity(TileManaBeacon.class, LibBlockNames.MANA_BEACON); + GameRegistry.registerTileEntity(TileManaVoid.class, LibBlockNames.MANA_VOID); + GameRegistry.registerTileEntity(TileManaDetector.class, LibBlockNames.MANA_DETECTOR); + GameRegistry.registerTileEntity(TileEnchanter.class, LibBlockNames.ENCHANTER); + GameRegistry.registerTileEntity(TileTurntable.class, LibBlockNames.TURNTABLE); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_PUREDAISY, SubTilePureDaisy.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_PUREDAISY, SubTilePureDaisy.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_DAYBLOOM, SubTileDaybloom.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_ENDOFLAME, SubTileEndoflame.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_HYDROANGEAS, SubTileHydroangeas.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_THERMALILY, SubTileThermalily.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_NIGHTSHADE, SubTileNightshade.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_ARCANE_ROSE, SubTileArcaneRose.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_DAYBLOOM, SubTileDaybloom.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_ENDOFLAME, SubTileEndoflame.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_HYDROANGEAS, SubTileHydroangeas.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_THERMALILY, SubTileThermalily.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_NIGHTSHADE, SubTileNightshade.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_ARCANE_ROSE, SubTileArcaneRose.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_BELLETHORN, SubTileBellethorn.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_HEISEI_DREAM, SubTileHeiseiDream.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_TIGERSEYE, SubTileTigerseye.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_JADED_AMARANTHUS, SubTileJadedAmaranthus.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_ORECHID, SubtileOrechid.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_FALLEN_KANADE, SubTileFallenKanade.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_EXOFLAME, SubTileExoflame.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_AGRICARNATION, SubTileAgricarnation.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_HOPPERHOCK, SubTileHopperhock.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_TANGLEBERRIE, SubTileTangleberrie.class); - BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_JIYUULIA, SubTileJiyuulia.class); - } + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_BELLETHORN, SubTileBellethorn.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_HEISEI_DREAM, SubTileHeiseiDream.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_TIGERSEYE, SubTileTigerseye.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_JADED_AMARANTHUS, SubTileJadedAmaranthus.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_ORECHID, SubtileOrechid.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_FALLEN_KANADE, SubTileFallenKanade.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_EXOFLAME, SubTileExoflame.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_AGRICARNATION, SubTileAgricarnation.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_HOPPERHOCK, SubTileHopperhock.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_TANGLEBERRIE, SubTileTangleberrie.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_JIYUULIA, SubTileJiyuulia.class); + } - private static void registerMultiparts() { - if(Loader.isModLoaded("ForgeMultipart")) { - try { - Class clazz = Class.forName("vazkii.botania.common.block.multipart.MultipartHandler"); - clazz.newInstance(); - } catch(Throwable e) { - e.printStackTrace(); - } - } - } + private static void registerMultiparts() { + if(Loader.isModLoaded("ForgeMultipart")) { + try { + Class clazz = Class.forName("vazkii.botania.common.block.multipart.MultipartHandler"); + clazz.newInstance(); + } catch(Throwable e) { + e.printStackTrace(); + } + } + } } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/common/block/multipart/MultipartHandler.java b/MODSRC/vazkii/botania/common/block/multipart/MultipartHandler.java index 3a7649aeb..74a3f7598 100644 --- a/MODSRC/vazkii/botania/common/block/multipart/MultipartHandler.java +++ b/MODSRC/vazkii/botania/common/block/multipart/MultipartHandler.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 3, 2014, 4:37:28 PM (GMT)] */ package vazkii.botania.common.block.multipart; @@ -16,18 +16,18 @@ import vazkii.botania.common.block.ModBlocks; public final class MultipartHandler { - public MultipartHandler() { - registerMultipartMetadataLine(ModBlocks.livingrock, 4); - registerMultipartMetadataLine(ModBlocks.livingwood, 5); - } + public MultipartHandler() { + registerMultipartMetadataLine(ModBlocks.livingrock, 4); + registerMultipartMetadataLine(ModBlocks.livingwood, 5); + } - private static void registerMultipartMetadataLine(Block block, int maxMeta) { - for(int i = 0; i < maxMeta; i++) - registerMultipart(block, i); - } + private static void registerMultipartMetadataLine(Block block, int maxMeta) { + for(int i = 0; i < maxMeta; i++) + registerMultipart(block, i); + } - private static void registerMultipart(Block block, int meta) { - // MicroMaterialRegistry.registerMaterial(new BlockMicroMaterial(block, meta), block.getUnlocalizedName() + (meta == 0 ? "" : "_" + meta)); - } + private static void registerMultipart(Block block, int meta) { + // MicroMaterialRegistry.registerMaterial(new BlockMicroMaterial(block, meta), block.getUnlocalizedName() + (meta == 0 ? "" : "_" + meta)); + } } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/common/block/subtile/SubTilePureDaisy.java b/MODSRC/vazkii/botania/common/block/subtile/SubTilePureDaisy.java index b592a61e2..a8e53dc31 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/SubTilePureDaisy.java +++ b/MODSRC/vazkii/botania/common/block/subtile/SubTilePureDaisy.java @@ -2,11 +2,11 @@ * This class was created by . 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 28, 2014, 9:09:39 PM (GMT)] */ package vazkii.botania.common.block.subtile; @@ -25,79 +25,69 @@ import vazkii.botania.common.lexicon.LexiconData; public class SubTilePureDaisy extends SubTileEntity { - private static final String TAG_POSITION = "position"; - private static final String TAG_TICKS_REMAINING = "ticksRemaining"; + private static final String TAG_POSITION = "position"; + private static final String TAG_TICKS_REMAINING = "ticksRemaining"; - private static final int[][] POSITIONS = new int[][] { - { -1, 0, -1 }, - { -1, 0, 0 }, - { -1, 0, 1 }, - { 0, 0, 1 }, - { 1, 0, 1 }, - { 1, 0, 0 }, - { 1, 0, -1 }, - { 0, 0, -1 }, - }; + private static final int[][] POSITIONS = new int[][]{{-1, 0, -1}, {-1, 0, 0}, {-1, 0, 1}, {0, 0, 1}, {1, 0, 1}, {1, 0, 0}, {1, 0, -1}, {0, 0, -1},}; - int positionAt = 0; - int[] ticksRemaining = new int[] { 200, 200, 200, 200, 200, 200, 200, 200 }; + int positionAt = 0; + int[] ticksRemaining = new int[]{200, 200, 200, 200, 200, 200, 200, 200}; - @Override - public boolean canUpdate() { - return true; - } + @Override + public boolean canUpdate() { + return true; + } - @Override - public void onUpdate() { - positionAt++; - if(positionAt == POSITIONS.length) - positionAt = 0; + @Override + public void onUpdate() { + positionAt++; + if(positionAt == POSITIONS.length) positionAt = 0; - int[] acoords = POSITIONS[positionAt]; - ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord + acoords[0], supertile.yCoord + acoords[1], supertile.zCoord + acoords[2]); - Block block =supertile.getWorldObj().getBlock(coords.posX, coords.posY, coords.posZ); - if(block != Blocks.air) { - String oredict = OreDictionary.getOreName(OreDictionary.getOreID(new ItemStack(block, 1, supertile.getWorldObj().getBlockMetadata(coords.posX, coords.posY, coords.posZ)))); - Block output = oredict.equals("stone") ? ModBlocks.livingrock : oredict.endsWith("logWood") ? ModBlocks.livingwood : null; - if(output != null) { - ticksRemaining[positionAt] = ticksRemaining[positionAt] - 1; + int[] acoords = POSITIONS[positionAt]; + ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord + acoords[0], supertile.yCoord + acoords[1], supertile.zCoord + acoords[2]); + Block block = supertile.getWorldObj().getBlock(coords.posX, coords.posY, coords.posZ); + if(block != Blocks.air) { + String oredict = OreDictionary.getOreName(OreDictionary.getOreID(new ItemStack(block, 1, supertile.getWorldObj().getBlockMetadata(coords.posX, coords.posY, coords.posZ)))); + Block output = oredict.equals("stone") ? ModBlocks.livingrock : oredict.endsWith("logWood") ? ModBlocks.livingwood : null; + if(output != null) { + ticksRemaining[positionAt] = ticksRemaining[positionAt] - 1; - Botania.proxy.sparkleFX(supertile.getWorldObj(), coords.posX + Math.random(), coords.posY + Math.random(), coords.posZ + Math.random(), 1F, 1F, 1F, (float) Math.random(), 5); + Botania.proxy.sparkleFX(supertile.getWorldObj(), coords.posX + Math.random(), coords.posY + Math.random(), coords.posZ + Math.random(), 1F, 1F, 1F, (float) Math.random(), 5); - if(ticksRemaining[positionAt] <= 0) { - supertile.getWorldObj().setBlock(coords.posX, coords.posY, coords.posZ, output); - ticksRemaining[positionAt] = 200; + if(ticksRemaining[positionAt] <= 0) { + supertile.getWorldObj().setBlock(coords.posX, coords.posY, coords.posZ, output); + ticksRemaining[positionAt] = 200; - for(int i = 0; i < 25; i++) { - double x = coords.posX + Math.random(); - double y = coords.posY + Math.random() + 0.5; - double z = coords.posZ + Math.random(); + for(int i = 0; i < 25; i++) { + double x = coords.posX + Math.random(); + double y = coords.posY + Math.random() + 0.5; + double z = coords.posZ + Math.random(); - Botania.proxy.wispFX(supertile.getWorldObj(), x, y, z, 1F, 1F, 1F, (float) Math.random() / 2F); - } - } - } else ticksRemaining[positionAt] = 200; - } - } + Botania.proxy.wispFX(supertile.getWorldObj(), x, y, z, 1F, 1F, 1F, (float) Math.random() / 2F); + } + } + } else ticksRemaining[positionAt] = 200; + } + } - @Override - public void readFromPacketNBT(NBTTagCompound cmp) { - positionAt = cmp.getInteger(TAG_POSITION); + @Override + public void readFromPacketNBT(NBTTagCompound cmp) { + positionAt = cmp.getInteger(TAG_POSITION); - if(supertile.getWorldObj() != null && !supertile.getWorldObj().isRemote) - for(int i = 0; i < ticksRemaining.length; i++) - ticksRemaining[i] = cmp.getInteger(TAG_TICKS_REMAINING + i); - } + if(supertile.getWorldObj() != null && !supertile.getWorldObj().isRemote) + for(int i = 0; i < ticksRemaining.length; i++) + ticksRemaining[i] = cmp.getInteger(TAG_TICKS_REMAINING + i); + } - @Override - public void writeToPacketNBT(NBTTagCompound cmp) { - cmp.setInteger(TAG_POSITION, positionAt); - for(int i = 0; i < ticksRemaining.length; i++) - cmp.setInteger(TAG_TICKS_REMAINING + i, ticksRemaining[i]); - } + @Override + public void writeToPacketNBT(NBTTagCompound cmp) { + cmp.setInteger(TAG_POSITION, positionAt); + for(int i = 0; i < ticksRemaining.length; i++) + cmp.setInteger(TAG_TICKS_REMAINING + i, ticksRemaining[i]); + } - @Override - public LexiconEntry getEntry() { - return LexiconData.pureDaisy; - } + @Override + public LexiconEntry getEntry() { + return LexiconData.pureDaisy; + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileAgricarnation.java b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileAgricarnation.java index ed47317ad..79bbcffcd 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileAgricarnation.java +++ b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileAgricarnation.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 19, 2014, 10:16:53 PM (GMT)] */ package vazkii.botania.common.block.subtile.functional; @@ -19,47 +19,46 @@ import vazkii.botania.api.subtile.SubTileFunctional; public class SubTileAgricarnation extends SubTileFunctional { - @Override - public void onUpdate() { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - if(supertile.getWorldObj().getTotalWorldTime() % 3 == 0) { - int range = 5; - int x = supertile.xCoord + supertile.getWorldObj().rand.nextInt(range * 2 + 1) - range; - int z = supertile.zCoord + supertile.getWorldObj().rand.nextInt(range * 2 + 1) - range; + if(supertile.getWorldObj().getTotalWorldTime() % 3 == 0) { + int range = 5; + int x = supertile.xCoord + supertile.getWorldObj().rand.nextInt(range * 2 + 1) - range; + int z = supertile.zCoord + supertile.getWorldObj().rand.nextInt(range * 2 + 1) - range; - for(int i = 4; i > -2; i--) { - int y = supertile.yCoord + i; + for(int i = 4; i > -2; i--) { + int y = supertile.yCoord + i; - if(supertile.getWorldObj().isAirBlock(x, y, z)) - continue; + if(supertile.getWorldObj().isAirBlock(x, y, z)) continue; - if(isPlant(x, y, z) && mana > 5) { - Block block = supertile.getWorldObj().getBlock(x, y, z); - mana -= 5; - supertile.getWorldObj().scheduleBlockUpdate(x, y, z, block, 1); - } - } - } - } + if(isPlant(x, y, z) && mana > 5) { + Block block = supertile.getWorldObj().getBlock(x, y, z); + mana -= 5; + supertile.getWorldObj().scheduleBlockUpdate(x, y, z, block, 1); + } + } + } + } - boolean isPlant(int x, int y, int z) { - Block block = supertile.getWorldObj().getBlock(x, y, z); - if(block == Blocks.grass || block == Blocks.leaves || block == Blocks.leaves2 || block instanceof BlockBush) - return false; + boolean isPlant(int x, int y, int z) { + Block block = supertile.getWorldObj().getBlock(x, y, z); + if(block == Blocks.grass || block == Blocks.leaves || block == Blocks.leaves2 || block instanceof BlockBush) + return false; - Material mat = block.getMaterial(); - return mat != null && (mat == Material.plants || mat == Material.cactus || mat == Material.grass || mat == Material.leaves || mat == Material.vine || mat == Material.wood || mat == Material.gourd); - } + Material mat = block.getMaterial(); + return mat != null && (mat == Material.plants || mat == Material.cactus || mat == Material.grass || mat == Material.leaves || mat == Material.vine || mat == Material.wood || mat == Material.gourd); + } - @Override - public int getColor() { - return 0x8EF828; - } + @Override + public int getColor() { + return 0x8EF828; + } - @Override - public int getMaxMana() { - return 200; - } + @Override + public int getMaxMana() { + return 200; + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileBellethorn.java b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileBellethorn.java index 221b107fe..d44d57c5b 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileBellethorn.java +++ b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileBellethorn.java @@ -2,17 +2,15 @@ * This class was created by . 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 27, 2014, 2:47:40 PM (GMT)] */ package vazkii.botania.common.block.subtile.functional; -import java.util.List; - import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; @@ -21,42 +19,43 @@ import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.subtile.SubTileFunctional; import vazkii.botania.common.lexicon.LexiconData; +import java.util.List; + public class SubTileBellethorn extends SubTileFunctional { - @Override - public int getColor() { - return 0xBA3421; - } + @Override + public int getColor() { + return 0xBA3421; + } - @Override - public int getMaxMana() { - return 1000; - } + @Override + public int getMaxMana() { + return 1000; + } - @Override - public void onUpdate() { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - final int range = 6; - final int manaToUse = 16; + final int range = 6; + final int manaToUse = 16; - if(supertile.getWorldObj().getTotalWorldTime() % 15 == 0) { - List entities = supertile.getWorldObj().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + 1, supertile.zCoord + range)); - for(EntityLivingBase entity : entities) { - if(entity instanceof EntityPlayer) - continue; + if(supertile.getWorldObj().getTotalWorldTime() % 15 == 0) { + List entities = supertile.getWorldObj().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + 1, supertile.zCoord + range)); + for(EntityLivingBase entity : entities) { + if(entity instanceof EntityPlayer) continue; - if(entity.hurtTime == 0 && mana >= manaToUse) { - entity.attackEntityFrom(DamageSource.magic, 1); - mana -= manaToUse; - } - } - } - } + if(entity.hurtTime == 0 && mana >= manaToUse) { + entity.attackEntityFrom(DamageSource.magic, 1); + mana -= manaToUse; + } + } + } + } - @Override - public LexiconEntry getEntry() { - return LexiconData.bellethorne; - } + @Override + public LexiconEntry getEntry() { + return LexiconData.bellethorne; + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileExoflame.java b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileExoflame.java index ec3276d5b..93ead871e 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileExoflame.java +++ b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileExoflame.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 19, 2014, 3:42:32 PM (GMT)] */ package vazkii.botania.common.block.subtile.functional; @@ -20,73 +20,69 @@ import vazkii.botania.api.subtile.SubTileFunctional; public class SubTileExoflame extends SubTileFunctional { - @Override - public void onUpdate() { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - int range = 5; - int rangeY = 2; + int range = 5; + int rangeY = 2; - fireFurnaces : { - for(int i = -range + 1; i < range; i++) - for(int j = -rangeY; j < rangeY; j++) - for(int k = -range + 1; k < range; k++) { - int x = supertile.xCoord + i; - int y = supertile.yCoord + j; - int z = supertile.zCoord + k; + fireFurnaces: + { + for(int i = -range + 1; i < range; i++) + for(int j = -rangeY; j < rangeY; j++) + for(int k = -range + 1; k < range; k++) { + int x = supertile.xCoord + i; + int y = supertile.yCoord + j; + int z = supertile.zCoord + k; - TileEntity tile = supertile.getWorldObj().getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityFurnace) { - TileEntityFurnace furnace = (TileEntityFurnace) tile; - boolean canSmelt = canFurnaceSmelt(furnace); - if(canSmelt && mana > 2) { - if(furnace.furnaceBurnTime < 2) { - if(furnace.furnaceBurnTime == 0) - BlockFurnace.updateFurnaceBlockState(true, supertile.getWorldObj(), x, y, z); - furnace.furnaceBurnTime = 200; - } - if(supertile.getWorldObj().getTotalWorldTime() % 2 == 0) - furnace.furnaceCookTime = Math.min(199, furnace.furnaceCookTime + 1); + TileEntity tile = supertile.getWorldObj().getTileEntity(x, y, z); + if(tile != null && tile instanceof TileEntityFurnace) { + TileEntityFurnace furnace = (TileEntityFurnace) tile; + boolean canSmelt = canFurnaceSmelt(furnace); + if(canSmelt && mana > 2) { + if(furnace.furnaceBurnTime < 2) { + if(furnace.furnaceBurnTime == 0) + BlockFurnace.updateFurnaceBlockState(true, supertile.getWorldObj(), x, y, z); + furnace.furnaceBurnTime = 200; + } + if(supertile.getWorldObj().getTotalWorldTime() % 2 == 0) + furnace.furnaceCookTime = Math.min(199, furnace.furnaceCookTime + 1); - mana -= 2; + mana -= 2; - if(mana == 0) - break fireFurnaces; - } - } - } - } - } + if(mana == 0) break fireFurnaces; + } + } + } + } + } - public boolean canFurnaceSmelt(TileEntityFurnace furnace){ - if(furnace.getStackInSlot(0) == null) - return false; - else { - ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnace.getStackInSlot(0)); + public boolean canFurnaceSmelt(TileEntityFurnace furnace) { + if(furnace.getStackInSlot(0) == null) return false; + else { + ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnace.getStackInSlot(0)); - if(itemstack == null) - return false; + if(itemstack == null) return false; - if(furnace.getStackInSlot(2) == null) - return true; + if(furnace.getStackInSlot(2) == null) return true; - if(!furnace.getStackInSlot(2).isItemEqual(itemstack)) - return false; + if(!furnace.getStackInSlot(2).isItemEqual(itemstack)) return false; - int result = furnace.getStackInSlot(2).stackSize + itemstack.stackSize; - return result <= 64 && result <= itemstack.getMaxStackSize(); - } - } + int result = furnace.getStackInSlot(2).stackSize + itemstack.stackSize; + return result <= 64 && result <= itemstack.getMaxStackSize(); + } + } - @Override - public int getMaxMana() { - return 300; - } + @Override + public int getMaxMana() { + return 300; + } - @Override - public int getColor() { - return 0x661600; - } + @Override + public int getColor() { + return 0x661600; + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileFallenKanade.java b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileFallenKanade.java index b16f18abe..85689a1c1 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileFallenKanade.java +++ b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileFallenKanade.java @@ -2,17 +2,15 @@ * This class was created by . 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 @ [Mar 14, 2014, 8:54:11 PM (GMT)] */ package vazkii.botania.common.block.subtile.functional; -import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; @@ -21,38 +19,40 @@ import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.subtile.SubTileFunctional; import vazkii.botania.common.lexicon.LexiconData; +import java.util.List; + public class SubTileFallenKanade extends SubTileFunctional { - @Override - public void onUpdate() { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - final int range = 5; - final int cost = 20; + final int range = 5; + final int cost = 20; - List players = supertile.getWorldObj().getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + range, supertile.zCoord + range)); - for(EntityPlayer player : players) { - if(player.getActivePotionEffect(Potion.regeneration) == null && mana >= cost) { - player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 100, 1)); - mana -= cost; - sync(); - } - } - } + List players = supertile.getWorldObj().getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + range, supertile.zCoord + range)); + for(EntityPlayer player : players) { + if(player.getActivePotionEffect(Potion.regeneration) == null && mana >= cost) { + player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 100, 1)); + mana -= cost; + sync(); + } + } + } - @Override - public int getColor() { - return 0xFFFF00; - } + @Override + public int getColor() { + return 0xFFFF00; + } - @Override - public int getMaxMana() { - return 60; - } + @Override + public int getMaxMana() { + return 60; + } - @Override - public LexiconEntry getEntry() { - return LexiconData.fallenKanade; - } + @Override + public LexiconEntry getEntry() { + return LexiconData.fallenKanade; + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileHeiseiDream.java b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileHeiseiDream.java index e609044db..0d1dad150 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileHeiseiDream.java +++ b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileHeiseiDream.java @@ -2,18 +2,16 @@ * This class was created by . 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 @ [Feb 16, 2014, 12:37:40 AM (GMT)] */ package vazkii.botania.common.block.subtile.functional; -import java.util.ArrayList; -import java.util.List; - +import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.EntityAIAttackOnCollide; @@ -25,70 +23,70 @@ import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.subtile.SubTileFunctional; import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.lib.LibObfuscation; -import cpw.mods.fml.relauncher.ReflectionHelper; + +import java.util.ArrayList; +import java.util.List; public class SubTileHeiseiDream extends SubTileFunctional { - @Override - public void onUpdate() { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - final int range = 5; - final int cost = 100; + final int range = 5; + final int cost = 100; - List mobs = supertile.getWorldObj().getEntitiesWithinAABB(IMob.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + range, supertile.zCoord + range)); - if(mobs.size() > 1 && mana >= cost) - for(IMob mob : mobs) { - if(mob instanceof EntityLiving) { - EntityLiving entity = (EntityLiving) mob; - EntityLivingBase target = entity.getAttackTarget(); - if(target == null || !(target instanceof IMob)) { - IMob newTarget; - do newTarget = mobs.get(supertile.getWorldObj().rand.nextInt(mobs.size())); - while(newTarget == mob); + List mobs = supertile.getWorldObj().getEntitiesWithinAABB(IMob.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + range, supertile.zCoord + range)); + if(mobs.size() > 1 && mana >= cost) for(IMob mob : mobs) { + if(mob instanceof EntityLiving) { + EntityLiving entity = (EntityLiving) mob; + EntityLivingBase target = entity.getAttackTarget(); + if(target == null || !(target instanceof IMob)) { + IMob newTarget; + do newTarget = mobs.get(supertile.getWorldObj().rand.nextInt(mobs.size())); while(newTarget == mob); - if(newTarget instanceof EntityLivingBase) { - entity.setAttackTarget((EntityLivingBase) newTarget); + if(newTarget instanceof EntityLivingBase) { + entity.setAttackTarget((EntityLivingBase) newTarget); - List entries = new ArrayList(entity.tasks.taskEntries); - entries.addAll(new ArrayList(entity.targetTasks.taskEntries)); + List entries = new ArrayList(entity.tasks.taskEntries); + entries.addAll(new ArrayList(entity.targetTasks.taskEntries)); - for(EntityAITaskEntry entry : entries) - if(entry.action instanceof EntityAINearestAttackableTarget) - messWithGetTargetAI((EntityAINearestAttackableTarget) entry.action); - else if(entry.action instanceof EntityAIAttackOnCollide) - messWithAttackOnCollideAI((EntityAIAttackOnCollide) entry.action); + for(EntityAITaskEntry entry : entries) + if(entry.action instanceof EntityAINearestAttackableTarget) + messWithGetTargetAI((EntityAINearestAttackableTarget) entry.action); + else if(entry.action instanceof EntityAIAttackOnCollide) + messWithAttackOnCollideAI((EntityAIAttackOnCollide) entry.action); - mana -= cost; - sync(); - break; - } - } - } - } - } + mana -= cost; + sync(); + break; + } + } + } + } + } - private void messWithGetTargetAI(EntityAINearestAttackableTarget aiEntry) { - ReflectionHelper.setPrivateValue(EntityAINearestAttackableTarget.class, aiEntry, IMob.class, LibObfuscation.TARGET_CLASS); - } + private void messWithGetTargetAI(EntityAINearestAttackableTarget aiEntry) { + ReflectionHelper.setPrivateValue(EntityAINearestAttackableTarget.class, aiEntry, IMob.class, LibObfuscation.TARGET_CLASS); + } - private void messWithAttackOnCollideAI(EntityAIAttackOnCollide aiEntry) { - ReflectionHelper.setPrivateValue(EntityAIAttackOnCollide.class, aiEntry, IMob.class, LibObfuscation.CLASS_TARGET); - } + private void messWithAttackOnCollideAI(EntityAIAttackOnCollide aiEntry) { + ReflectionHelper.setPrivateValue(EntityAIAttackOnCollide.class, aiEntry, IMob.class, LibObfuscation.CLASS_TARGET); + } - @Override - public int getColor() { - return 0xFF219D; - } + @Override + public int getColor() { + return 0xFF219D; + } - @Override - public int getMaxMana() { - return 1000; - } + @Override + public int getMaxMana() { + return 1000; + } - @Override - public LexiconEntry getEntry() { - return LexiconData.heiseiDream; - } + @Override + public LexiconEntry getEntry() { + return LexiconData.heiseiDream; + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileHopperhock.java b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileHopperhock.java index 86356187c..155240527 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileHopperhock.java +++ b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileHopperhock.java @@ -2,18 +2,15 @@ * This class was created by . 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 @ [Mar 20, 2014, 5:54:39 PM (GMT)] */ package vazkii.botania.common.block.subtile.functional; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; @@ -28,193 +25,183 @@ import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; - import org.lwjgl.opengl.GL11; - import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.subtile.SubTileFunctional; import vazkii.botania.common.core.helper.InventoryHelper; import vazkii.botania.common.lexicon.LexiconData; +import java.util.ArrayList; +import java.util.List; + public class SubTileHopperhock extends SubTileFunctional { - private static final String TAG_FILTER_TYPE = "filterType"; + private static final String TAG_FILTER_TYPE = "filterType"; - int filterType = 0; + int filterType = 0; - private static final ForgeDirection[] VALID_DIRS = new ForgeDirection[] { - ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST - }; + private static final ForgeDirection[] VALID_DIRS = new ForgeDirection[]{ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST}; - @Override - public void onUpdate() { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - boolean pulledAny = false; - int range = mana > 0 ? 6 : 3; + boolean pulledAny = false; + int range = mana > 0 ? 6 : 3; - int x = supertile.xCoord; - int y = supertile.yCoord; - int z = supertile.zCoord; + int x = supertile.xCoord; + int y = supertile.yCoord; + int z = supertile.zCoord; - List items = supertile.getWorldObj().getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x - range, y - 3, z - range, x + range + 1, y + 3, z + range + 1)); - for(EntityItem item : items) { - if(item.age < 60) - continue; + List items = supertile.getWorldObj().getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x - range, y - 3, z - range, x + range + 1, y + 3, z + range + 1)); + for(EntityItem item : items) { + if(item.age < 60) continue; - ItemStack stack = item.getEntityItem(); + ItemStack stack = item.getEntityItem(); - IInventory invToPutItemIn = null; - ForgeDirection sideToPutItemIn = ForgeDirection.UNKNOWN; - boolean priorityInv = false; + IInventory invToPutItemIn = null; + ForgeDirection sideToPutItemIn = ForgeDirection.UNKNOWN; + boolean priorityInv = false; - for(ForgeDirection dir : VALID_DIRS) { - int x_ = x + dir.offsetX; - int y_ = y + dir.offsetY; - int z_ = z + dir.offsetZ; + for(ForgeDirection dir : VALID_DIRS) { + int x_ = x + dir.offsetX; + int y_ = y + dir.offsetY; + int z_ = z + dir.offsetZ; - IInventory inv = InventoryHelper.getInventory(supertile.getWorldObj(), x_, y_, z_); - if(inv != null) { - List filter = getFilterForInventory(inv, x_, y_, z_, true); - boolean canAccept = canAcceptItem(stack, filter, filterType); - int stackSize = InventoryHelper.testInventoryInsertion(inv, stack, dir); - canAccept &= stackSize == stack.stackSize; + IInventory inv = InventoryHelper.getInventory(supertile.getWorldObj(), x_, y_, z_); + if(inv != null) { + List filter = getFilterForInventory(inv, x_, y_, z_, true); + boolean canAccept = canAcceptItem(stack, filter, filterType); + int stackSize = InventoryHelper.testInventoryInsertion(inv, stack, dir); + canAccept &= stackSize == stack.stackSize; - if(canAccept) { - boolean priority = !filter.isEmpty(); + if(canAccept) { + boolean priority = !filter.isEmpty(); - setInv : { - if(priorityInv && !priority) - break setInv; + setInv: + { + if(priorityInv && !priority) break setInv; - invToPutItemIn = inv; - priorityInv = priority; - sideToPutItemIn = dir.getOpposite(); - } - } - } - } + invToPutItemIn = inv; + priorityInv = priority; + sideToPutItemIn = dir.getOpposite(); + } + } + } + } - if(invToPutItemIn != null) { - InventoryHelper.insertItemIntoInventory(invToPutItemIn, stack.copy(), sideToPutItemIn, -1); - if(!supertile.getWorldObj().isRemote) - item.setDead(); - pulledAny = true; - break; - } - } + if(invToPutItemIn != null) { + InventoryHelper.insertItemIntoInventory(invToPutItemIn, stack.copy(), sideToPutItemIn, -1); + if(!supertile.getWorldObj().isRemote) item.setDead(); + pulledAny = true; + break; + } + } - if(pulledAny && mana > 1) - mana--; - } + if(pulledAny && mana > 1) mana--; + } - public boolean canAcceptItem(ItemStack stack, List filter, int filterType) { - if(stack == null) - return false; + public boolean canAcceptItem(ItemStack stack, List filter, int filterType) { + if(stack == null) return false; - if(filter.isEmpty()) - return true; + if(filter.isEmpty()) return true; - switch(filterType) { - case 0 : { // Accept items in frames only - for(ItemStack filterEntry : filter) { - if(filterEntry == null) - continue; + switch(filterType) { + case 0: { // Accept items in frames only + for(ItemStack filterEntry : filter) { + if(filterEntry == null) continue; - if(stack.isItemEqual(filterEntry) && ItemStack.areItemStackTagsEqual(filterEntry, stack)) - return true; - } + if(stack.isItemEqual(filterEntry) && ItemStack.areItemStackTagsEqual(filterEntry, stack)) + return true; + } - return false; - } - case 1 : return !canAcceptItem(stack, filter, 0); // Accept items not in frames only - default : return true; // Accept all items - } - } + return false; + } + case 1: + return !canAcceptItem(stack, filter, 0); // Accept items not in frames only + default: + return true; // Accept all items + } + } - public List getFilterForInventory(IInventory inv, int x, int y, int z, boolean recursiveForDoubleChests) { - List filter = new ArrayList(); + public List getFilterForInventory(IInventory inv, int x, int y, int z, boolean recursiveForDoubleChests) { + List filter = new ArrayList(); - if(recursiveForDoubleChests) { - TileEntity tileEntity = supertile.getWorldObj().getTileEntity(x, y, z); - Block chest = supertile.getWorldObj().getBlock(x, y, z); + if(recursiveForDoubleChests) { + TileEntity tileEntity = supertile.getWorldObj().getTileEntity(x, y, z); + Block chest = supertile.getWorldObj().getBlock(x, y, z); - if(tileEntity instanceof TileEntityChest) - for(ForgeDirection dir : VALID_DIRS) - if(supertile.getWorldObj().getBlock(x + dir.offsetX, y, z + dir.offsetZ) == chest) { - filter.addAll(getFilterForInventory((IInventory) supertile.getWorldObj().getTileEntity(x + dir.offsetX, y, z + dir.offsetZ), x + dir.offsetX, y, z + dir.offsetZ, false)); - break; - } - } + if(tileEntity instanceof TileEntityChest) for(ForgeDirection dir : VALID_DIRS) + if(supertile.getWorldObj().getBlock(x + dir.offsetX, y, z + dir.offsetZ) == chest) { + filter.addAll(getFilterForInventory((IInventory) supertile.getWorldObj().getTileEntity(x + dir.offsetX, y, z + dir.offsetZ), x + dir.offsetX, y, z + dir.offsetZ, false)); + break; + } + } - final int[] orientationToDir = new int[] { - 3, 4, 2, 5 - }; + final int[] orientationToDir = new int[]{3, 4, 2, 5}; - for(ForgeDirection dir : VALID_DIRS) { - List frames = supertile.getWorldObj().getEntitiesWithinAABB(EntityItemFrame.class, AxisAlignedBB.getBoundingBox(x+ dir.offsetX, y + dir.offsetY, z + dir.offsetZ, x + dir.offsetX + 1, y + dir.offsetY + 1, z + dir.offsetZ + 1)); - for(EntityItemFrame frame : frames) { - int orientation = frame.hangingDirection; - if(orientationToDir[orientation] == dir.ordinal()) - filter.add(frame.getDisplayedItem()); - } - } + for(ForgeDirection dir : VALID_DIRS) { + List frames = supertile.getWorldObj().getEntitiesWithinAABB(EntityItemFrame.class, AxisAlignedBB.getBoundingBox(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, x + dir.offsetX + 1, y + dir.offsetY + 1, z + dir.offsetZ + 1)); + for(EntityItemFrame frame : frames) { + int orientation = frame.hangingDirection; + if(orientationToDir[orientation] == dir.ordinal()) filter.add(frame.getDisplayedItem()); + } + } - return filter; - } + return filter; + } - @Override - public boolean onWanded(EntityPlayer player, ItemStack wand) { - if(player.isSneaking()) { - filterType = filterType == 2 ? 0 : filterType + 1; - sync(); - - return true; - } - else return super.onWanded(player, wand); - } + @Override + public boolean onWanded(EntityPlayer player, ItemStack wand) { + if(player.isSneaking()) { + filterType = filterType == 2 ? 0 : filterType + 1; + sync(); - @Override - public void writeToPacketNBT(NBTTagCompound cmp) { - super.writeToPacketNBT(cmp); + return true; + } else return super.onWanded(player, wand); + } - cmp.setInteger(TAG_FILTER_TYPE, filterType); - } + @Override + public void writeToPacketNBT(NBTTagCompound cmp) { + super.writeToPacketNBT(cmp); - @Override - public void readFromPacketNBT(NBTTagCompound cmp) { - super.readFromPacketNBT(cmp); + cmp.setInteger(TAG_FILTER_TYPE, filterType); + } - filterType = cmp.getInteger(TAG_FILTER_TYPE); - } + @Override + public void readFromPacketNBT(NBTTagCompound cmp) { + super.readFromPacketNBT(cmp); - @Override - public void renderHUD(Minecraft mc, ScaledResolution res) { - super.renderHUD(mc, res); + filterType = cmp.getInteger(TAG_FILTER_TYPE); + } - int color = 0x66000000 | getColor(); - String filter = StatCollector.translateToLocal("botaniamisc.filter" + filterType); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - int x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(filter) / 2; - int y = res.getScaledHeight() / 2 + 30; + @Override + public void renderHUD(Minecraft mc, ScaledResolution res) { + super.renderHUD(mc, res); - mc.fontRenderer.drawStringWithShadow(filter, x, y, color); - GL11.glDisable(GL11.GL_BLEND); - } + int color = 0x66000000 | getColor(); + String filter = StatCollector.translateToLocal("botaniamisc.filter" + filterType); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + int x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(filter) / 2; + int y = res.getScaledHeight() / 2 + 30; - @Override - public LexiconEntry getEntry() { - return LexiconData.hopperhock; - } + mc.fontRenderer.drawStringWithShadow(filter, x, y, color); + GL11.glDisable(GL11.GL_BLEND); + } - @Override - public int getMaxMana() { - return 20; - } + @Override + public LexiconEntry getEntry() { + return LexiconData.hopperhock; + } - @Override - public int getColor() { - return 0x3F3F3F; - } + @Override + public int getMaxMana() { + return 20; + } + + @Override + public int getColor() { + return 0x3F3F3F; + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileJadedAmaranthus.java b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileJadedAmaranthus.java index 1b1f1a742..5b5368666 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileJadedAmaranthus.java +++ b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileJadedAmaranthus.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 3, 2014, 10:31:29 PM (GMT)] */ package vazkii.botania.common.block.subtile.functional; @@ -20,56 +20,56 @@ import vazkii.botania.common.lexicon.LexiconData; public class SubTileJadedAmaranthus extends SubTileFunctional { - private static final int COST = 100; - int cooldown = 0; + private static final int COST = 100; + int cooldown = 0; - @Override - public void onUpdate() { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - if(cooldown > 0) { - cooldown--; - return; - } + if(cooldown > 0) { + cooldown--; + return; + } - if(mana >= COST && !supertile.getWorldObj().isRemote) { - int range = 4; - int x = supertile.xCoord - range + supertile.getWorldObj().rand.nextInt(range * 2 + 1); - int y = supertile.yCoord + range; - int z = supertile.zCoord - range + supertile.getWorldObj().rand.nextInt(range * 2 + 1); + if(mana >= COST && !supertile.getWorldObj().isRemote) { + int range = 4; + int x = supertile.xCoord - range + supertile.getWorldObj().rand.nextInt(range * 2 + 1); + int y = supertile.yCoord + range; + int z = supertile.zCoord - range + supertile.getWorldObj().rand.nextInt(range * 2 + 1); - for(int i = 0; i < range * 2; i++) { - Block block = supertile.getWorldObj().getBlock(x, y, z); - if((block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland) && supertile.getWorldObj().isAirBlock(x, y + 1, z)) { - int color = supertile.getWorldObj().rand.nextInt(16); - if(ModBlocks.flower.canBlockStay(supertile.getWorldObj(), x, y + 1, z)) - supertile.getWorldObj().setBlock(x, y + 1, z, ModBlocks.flower, color, 1 | 2); + for(int i = 0; i < range * 2; i++) { + Block block = supertile.getWorldObj().getBlock(x, y, z); + if((block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland) && supertile.getWorldObj().isAirBlock(x, y + 1, z)) { + int color = supertile.getWorldObj().rand.nextInt(16); + if(ModBlocks.flower.canBlockStay(supertile.getWorldObj(), x, y + 1, z)) + supertile.getWorldObj().setBlock(x, y + 1, z, ModBlocks.flower, color, 1 | 2); - mana -= COST; - sync(); - - cooldown = 30; - break; - } + mana -= COST; + sync(); - y--; - } - } - } + cooldown = 30; + break; + } - @Override - public int getColor() { - return 0x961283; - } + y--; + } + } + } - @Override - public LexiconEntry getEntry() { - return LexiconData.jadedAmaranthus; - } + @Override + public int getColor() { + return 0x961283; + } - @Override - public int getMaxMana() { - return COST; - } + @Override + public LexiconEntry getEntry() { + return LexiconData.jadedAmaranthus; + } + + @Override + public int getMaxMana() { + return COST; + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileJiyuulia.java b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileJiyuulia.java index 76059edb8..4b0900dca 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileJiyuulia.java +++ b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileJiyuulia.java @@ -2,53 +2,43 @@ * This class was created by . 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 @ [Apr 14, 2014, 11:40:51 PM (GMT)] */ package vazkii.botania.common.block.subtile.functional; -import java.util.List; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.IIcon; import vazkii.botania.api.lexicon.LexiconEntry; -import vazkii.botania.api.subtile.SubTileFunctional; -import vazkii.botania.common.Botania; -import vazkii.botania.common.core.helper.MathHelper; -import vazkii.botania.common.core.helper.Vector3; import vazkii.botania.common.lexicon.LexiconData; public class SubTileJiyuulia extends SubTileTangleberrie { - @Override - double getMaxDistance() { - return 0; - } - - @Override - double getRange() { - return 8; - } - - @Override - float getMotionVelocity() { - return -super.getMotionVelocity() * 2; - } - - @Override - public int getColor() { - return 0xBD9ACA; - } - - @Override - public LexiconEntry getEntry() { - return LexiconData.jiyuulia; - } - + @Override + double getMaxDistance() { + return 0; + } + + @Override + double getRange() { + return 8; + } + + @Override + float getMotionVelocity() { + return -super.getMotionVelocity() * 2; + } + + @Override + public int getColor() { + return 0xBD9ACA; + } + + @Override + public LexiconEntry getEntry() { + return LexiconData.jiyuulia; + } + } diff --git a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileTangleberrie.java b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileTangleberrie.java index 73c51552f..2a3d0c5a4 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileTangleberrie.java +++ b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileTangleberrie.java @@ -2,21 +2,18 @@ * This class was created by . 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 @ [Apr 14, 2014, 11:40:59 PM (GMT)] */ package vazkii.botania.common.block.subtile.functional; -import java.util.List; - import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.World; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.subtile.SubTileFunctional; import vazkii.botania.common.Botania; @@ -24,72 +21,73 @@ import vazkii.botania.common.core.helper.MathHelper; import vazkii.botania.common.core.helper.Vector3; import vazkii.botania.common.lexicon.LexiconData; +import java.util.List; + public class SubTileTangleberrie extends SubTileFunctional { - @Override - public void onUpdate() { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - if(mana > 0) { - double x1 = supertile.xCoord + 0.5; - double y1 = supertile.yCoord + 0.5; - double z1 = supertile.zCoord + 0.5; + if(mana > 0) { + double x1 = supertile.xCoord + 0.5; + double y1 = supertile.yCoord + 0.5; + double z1 = supertile.zCoord + 0.5; - double maxDist = getMaxDistance(); - double range = getRange(); - - AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(x1 - range, y1 - range, z1 - range, x1 + range, y1 + range, z1 + range); - List entities = supertile.getWorldObj().getEntitiesWithinAABB(EntityLivingBase.class, boundingBox); + double maxDist = getMaxDistance(); + double range = getRange(); - for(EntityLivingBase entity : entities) { - if(entity instanceof EntityPlayer) - continue; - - double x2 = entity.posX; - double y2 = entity.posY; - double z2 = entity.posZ; + AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(x1 - range, y1 - range, z1 - range, x1 + range, y1 + range, z1 + range); + List entities = supertile.getWorldObj().getEntitiesWithinAABB(EntityLivingBase.class, boundingBox); - float distance = MathHelper.pointDistanceSpace(x1, y1, z1, x2, y2, z2); - - if(distance > maxDist && distance < range) { - MathHelper.setEntityMotionFromVector(entity, new Vector3(x1, y1, z1), getMotionVelocity()); - if(supertile.getWorldObj().rand.nextInt(3) == 0) - Botania.proxy.sparkleFX(supertile.getWorldObj(), x2 + Math.random() * entity.width, y2 + Math.random() * entity.height, z2 + Math.random() * entity.width, 0.5F, 0.5F, 0.5F, 1F, 3); - } - } - - if(supertile.getWorldObj().getTotalWorldTime() % 4 == 0) { - mana--; - sync(); - } - } - } - - double getMaxDistance() { - return 6; - } - - double getRange() { - return 7; - } - - float getMotionVelocity() { - return 0.05F; - } - - @Override - public int getColor() { - return 0x4B797C; - } - - @Override - public int getMaxMana() { - return 20; - } - - @Override - public LexiconEntry getEntry() { - return LexiconData.tangleberrie; - } + for(EntityLivingBase entity : entities) { + if(entity instanceof EntityPlayer) continue; + + double x2 = entity.posX; + double y2 = entity.posY; + double z2 = entity.posZ; + + float distance = MathHelper.pointDistanceSpace(x1, y1, z1, x2, y2, z2); + + if(distance > maxDist && distance < range) { + MathHelper.setEntityMotionFromVector(entity, new Vector3(x1, y1, z1), getMotionVelocity()); + if(supertile.getWorldObj().rand.nextInt(3) == 0) + Botania.proxy.sparkleFX(supertile.getWorldObj(), x2 + Math.random() * entity.width, y2 + Math.random() * entity.height, z2 + Math.random() * entity.width, 0.5F, 0.5F, 0.5F, 1F, 3); + } + } + + if(supertile.getWorldObj().getTotalWorldTime() % 4 == 0) { + mana--; + sync(); + } + } + } + + double getMaxDistance() { + return 6; + } + + double getRange() { + return 7; + } + + float getMotionVelocity() { + return 0.05F; + } + + @Override + public int getColor() { + return 0x4B797C; + } + + @Override + public int getMaxMana() { + return 20; + } + + @Override + public LexiconEntry getEntry() { + return LexiconData.tangleberrie; + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileTigerseye.java b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileTigerseye.java index e14a5bcc8..572209734 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileTigerseye.java +++ b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileTigerseye.java @@ -2,18 +2,16 @@ * This class was created by . 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 @ [Feb 16, 2014, 3:36:26 PM (GMT)] */ package vazkii.botania.common.block.subtile.functional; -import java.util.ArrayList; -import java.util.List; - +import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.ai.EntityAIAvoidEntity; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; @@ -27,75 +25,76 @@ import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.subtile.SubTileFunctional; import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.lib.LibObfuscation; -import cpw.mods.fml.relauncher.ReflectionHelper; + +import java.util.ArrayList; +import java.util.List; public class SubTileTigerseye extends SubTileFunctional { - @Override - public void onUpdate() { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - final int range = 10; - final int rangeY = 4; - final int cost = 70; + final int range = 10; + final int rangeY = 4; + final int cost = 70; - boolean shouldAfffect = mana >= cost; + boolean shouldAfffect = mana >= cost; - List entities = supertile.getWorldObj().getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - rangeY, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + rangeY, supertile.zCoord + range)); + List entities = supertile.getWorldObj().getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - rangeY, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + rangeY, supertile.zCoord + range)); - for(EntityLiving entity : entities) { - List entries = new ArrayList(entity.tasks.taskEntries); - entries.addAll(new ArrayList(entity.targetTasks.taskEntries)); + for(EntityLiving entity : entities) { + List entries = new ArrayList(entity.tasks.taskEntries); + entries.addAll(new ArrayList(entity.targetTasks.taskEntries)); - boolean avoidsOcelots = false; - if(shouldAfffect) - for(EntityAITaskEntry entry : entries) { - if(entry.action instanceof EntityAIAvoidEntity) - avoidsOcelots = messWithRunAwayAI((EntityAIAvoidEntity) entry.action) || avoidsOcelots; + boolean avoidsOcelots = false; + if(shouldAfffect) for(EntityAITaskEntry entry : entries) { + if(entry.action instanceof EntityAIAvoidEntity) + avoidsOcelots = messWithRunAwayAI((EntityAIAvoidEntity) entry.action) || avoidsOcelots; - if(entry.action instanceof EntityAINearestAttackableTarget) - messWithGetTargetAI((EntityAINearestAttackableTarget) entry.action); - } + if(entry.action instanceof EntityAINearestAttackableTarget) + messWithGetTargetAI((EntityAINearestAttackableTarget) entry.action); + } - if(entity instanceof EntityCreeper) { - ReflectionHelper.setPrivateValue(EntityCreeper.class, (EntityCreeper) entity, 2, LibObfuscation.TIME_SINCE_IGNITED); - entity.setAttackTarget(null); - } + if(entity instanceof EntityCreeper) { + ReflectionHelper.setPrivateValue(EntityCreeper.class, (EntityCreeper) entity, 2, LibObfuscation.TIME_SINCE_IGNITED); + entity.setAttackTarget(null); + } - if(avoidsOcelots) { - mana -= cost; - sync(); - shouldAfffect = false; - } - } - } + if(avoidsOcelots) { + mana -= cost; + sync(); + shouldAfffect = false; + } + } + } - private boolean messWithRunAwayAI(EntityAIAvoidEntity aiEntry) { - if(ReflectionHelper.getPrivateValue(EntityAIAvoidEntity.class, aiEntry, LibObfuscation.TARGET_ENTITY_CLASS) == EntityOcelot.class) { - ReflectionHelper.setPrivateValue(EntityAIAvoidEntity.class, aiEntry, EntityPlayer.class, LibObfuscation.TARGET_ENTITY_CLASS); - return true; - } - return false; - } + private boolean messWithRunAwayAI(EntityAIAvoidEntity aiEntry) { + if(ReflectionHelper.getPrivateValue(EntityAIAvoidEntity.class, aiEntry, LibObfuscation.TARGET_ENTITY_CLASS) == EntityOcelot.class) { + ReflectionHelper.setPrivateValue(EntityAIAvoidEntity.class, aiEntry, EntityPlayer.class, LibObfuscation.TARGET_ENTITY_CLASS); + return true; + } + return false; + } - private void messWithGetTargetAI(EntityAINearestAttackableTarget aiEntry) { - if(ReflectionHelper.getPrivateValue(EntityAINearestAttackableTarget.class, aiEntry, LibObfuscation.TARGET_CLASS) == EntityPlayer.class) - ReflectionHelper.setPrivateValue(EntityAINearestAttackableTarget.class, aiEntry, EntityEnderCrystal.class, LibObfuscation.TARGET_CLASS); // Something random that won't be around - } + private void messWithGetTargetAI(EntityAINearestAttackableTarget aiEntry) { + if(ReflectionHelper.getPrivateValue(EntityAINearestAttackableTarget.class, aiEntry, LibObfuscation.TARGET_CLASS) == EntityPlayer.class) + ReflectionHelper.setPrivateValue(EntityAINearestAttackableTarget.class, aiEntry, EntityEnderCrystal.class, LibObfuscation.TARGET_CLASS); // Something random that won't be around + } - @Override - public int getColor() { - return 0xB1A618; - } + @Override + public int getColor() { + return 0xB1A618; + } - @Override - public int getMaxMana() { - return 1000; - } + @Override + public int getMaxMana() { + return 1000; + } - @Override - public LexiconEntry getEntry() { - return LexiconData.tigerseye; - } + @Override + public LexiconEntry getEntry() { + return LexiconData.tigerseye; + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/functional/SubtileOrechid.java b/MODSRC/vazkii/botania/common/block/subtile/functional/SubtileOrechid.java index 0c29b41bb..8d454f1e3 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/functional/SubtileOrechid.java +++ b/MODSRC/vazkii/botania/common/block/subtile/functional/SubtileOrechid.java @@ -2,19 +2,15 @@ * This class was created by . 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 @ [Mar 11, 2014, 5:40:55 PM (GMT)] */ package vazkii.botania.common.block.subtile.functional; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -26,86 +22,88 @@ import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.subtile.SubTileFunctional; import vazkii.botania.common.lexicon.LexiconData; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + public class SubtileOrechid extends SubTileFunctional { - private static final int COST = 17500; + private static final int COST = 17500; - @Override - public void onUpdate() { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - if(!supertile.getWorldObj().isRemote && mana >= COST && supertile.getWorldObj().getTotalWorldTime() % 100 == 0) { - ChunkCoordinates coords = getCoordsToPut(); - if(coords != null) { - ItemStack stack = getOreToPut(); - if(stack != null) { - supertile.getWorldObj().setBlock(coords.posX, coords.posY, coords.posZ, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 1 | 2); + if(!supertile.getWorldObj().isRemote && mana >= COST && supertile.getWorldObj().getTotalWorldTime() % 100 == 0) { + ChunkCoordinates coords = getCoordsToPut(); + if(coords != null) { + ItemStack stack = getOreToPut(); + if(stack != null) { + supertile.getWorldObj().setBlock(coords.posX, coords.posY, coords.posZ, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 1 | 2); - mana -= COST; - sync(); - } - } - } - } + mana -= COST; + sync(); + } + } + } + } - public ItemStack getOreToPut() { - Collection values = new ArrayList(); - for(String s : BotaniaAPI.oreWeights.keySet()) - values.add(new StringRandomItem(BotaniaAPI.oreWeights.get(s), s)); + public ItemStack getOreToPut() { + Collection values = new ArrayList(); + for(String s : BotaniaAPI.oreWeights.keySet()) + values.add(new StringRandomItem(BotaniaAPI.oreWeights.get(s), s)); - String ore = ((StringRandomItem) WeightedRandom.getRandomItem(supertile.getWorldObj().rand, values)).s; + String ore = ((StringRandomItem) WeightedRandom.getRandomItem(supertile.getWorldObj().rand, values)).s; - List ores = OreDictionary.getOres(ore); - if(ores.isEmpty()) - return getOreToPut(); + List ores = OreDictionary.getOres(ore); + if(ores.isEmpty()) return getOreToPut(); - return ores.get(0); - } + return ores.get(0); + } - public ChunkCoordinates getCoordsToPut() { - List possibleCoords = new ArrayList(); - int range = 5; - int rangeY = 3; + public ChunkCoordinates getCoordsToPut() { + List possibleCoords = new ArrayList(); + int range = 5; + int rangeY = 3; - for(int i = -range; i < range; i++) - for(int j = -rangeY; j < rangeY; j++) - for(int k = -range; k < range; k++) { - int x = supertile.xCoord + i; - int y = supertile.yCoord + j; - int z = supertile.zCoord + k; - Block block = supertile.getWorldObj().getBlock(x, y, z); - if(block != null && block.isReplaceableOreGen(supertile.getWorldObj(), x, y, z, Blocks.stone)) - possibleCoords.add(new ChunkCoordinates(x, y, z)); - } + for(int i = -range; i < range; i++) + for(int j = -rangeY; j < rangeY; j++) + for(int k = -range; k < range; k++) { + int x = supertile.xCoord + i; + int y = supertile.yCoord + j; + int z = supertile.zCoord + k; + Block block = supertile.getWorldObj().getBlock(x, y, z); + if(block != null && block.isReplaceableOreGen(supertile.getWorldObj(), x, y, z, Blocks.stone)) + possibleCoords.add(new ChunkCoordinates(x, y, z)); + } - if(possibleCoords.isEmpty()) - return null; - return possibleCoords.get(supertile.getWorldObj().rand.nextInt(possibleCoords.size())); - } + if(possibleCoords.isEmpty()) return null; + return possibleCoords.get(supertile.getWorldObj().rand.nextInt(possibleCoords.size())); + } - @Override - public int getColor() { - return 0x818181; - } + @Override + public int getColor() { + return 0x818181; + } - @Override - public int getMaxMana() { - return COST; - } + @Override + public int getMaxMana() { + return COST; + } - @Override - public LexiconEntry getEntry() { - return LexiconData.orechid; - } + @Override + public LexiconEntry getEntry() { + return LexiconData.orechid; + } - private static class StringRandomItem extends WeightedRandom.Item { + private static class StringRandomItem extends WeightedRandom.Item { - public String s; + public String s; - public StringRandomItem(int par1, String s) { - super(par1); - this.s = s; - } + public StringRandomItem(int par1, String s) { + super(par1); + this.s = s; + } - } + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileArcaneRose.java b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileArcaneRose.java index f84aebf65..af884fd28 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileArcaneRose.java +++ b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileArcaneRose.java @@ -2,17 +2,15 @@ * This class was created by . 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 @ [Mar 18, 2014, 8:45:25 PM (GMT)] */ package vazkii.botania.common.block.subtile.generating; -import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; import vazkii.botania.api.lexicon.LexiconEntry; @@ -20,38 +18,39 @@ import vazkii.botania.api.subtile.SubTileGenerating; import vazkii.botania.common.core.helper.ExperienceHelper; import vazkii.botania.common.lexicon.LexiconData; +import java.util.List; + public class SubTileArcaneRose extends SubTileGenerating { - @Override - public void onUpdate() { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - if(mana >= getMaxMana()) - return; + if(mana >= getMaxMana()) return; - List players = supertile.getWorldObj().getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - 1, supertile.yCoord, supertile.zCoord - 1, supertile.xCoord + 2, supertile.yCoord + 1, supertile.zCoord + 2)); - for(EntityPlayer player : players) - if(ExperienceHelper.getPlayerXP(player) >= 1 && player.onGround) { - ExperienceHelper.drainPlayerXP(player, 1); - mana += 10; - sync(); - return; - } - } + List players = supertile.getWorldObj().getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - 1, supertile.yCoord, supertile.zCoord - 1, supertile.xCoord + 2, supertile.yCoord + 1, supertile.zCoord + 2)); + for(EntityPlayer player : players) + if(ExperienceHelper.getPlayerXP(player) >= 1 && player.onGround) { + ExperienceHelper.drainPlayerXP(player, 1); + mana += 10; + sync(); + return; + } + } - @Override - public int getColor() { - return 0xFF8EF8; - } + @Override + public int getColor() { + return 0xFF8EF8; + } - @Override - public int getMaxMana() { - return 200; - } + @Override + public int getMaxMana() { + return 200; + } - @Override - public LexiconEntry getEntry() { - return LexiconData.arcaneRose; - } + @Override + public LexiconEntry getEntry() { + return LexiconData.arcaneRose; + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileDaybloom.java b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileDaybloom.java index 40314bbab..3962011fd 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileDaybloom.java +++ b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileDaybloom.java @@ -2,11 +2,11 @@ * This class was created by . 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 25, 2014, 3:09:35 PM (GMT)] */ package vazkii.botania.common.block.subtile.generating; @@ -17,19 +17,19 @@ import vazkii.botania.common.lexicon.LexiconData; public class SubTileDaybloom extends SubTileGenerating { - @Override - public int getColor() { - return 0xFFFF00; - } + @Override + public int getColor() { + return 0xFFFF00; + } - @Override - public boolean shouldSyncPassiveGeneration() { - return true; - } + @Override + public boolean shouldSyncPassiveGeneration() { + return true; + } - @Override - public LexiconEntry getEntry() { - return LexiconData.daybloom; - } + @Override + public LexiconEntry getEntry() { + return LexiconData.daybloom; + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileEndoflame.java b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileEndoflame.java index 2b408e041..4285d55e3 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileEndoflame.java +++ b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileEndoflame.java @@ -2,17 +2,15 @@ * This class was created by . 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 @ [Feb 15, 2014, 9:47:56 PM (GMT)] */ package vazkii.botania.common.block.subtile.generating; -import java.util.List; - import net.minecraft.entity.item.EntityItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -25,98 +23,97 @@ import vazkii.botania.common.Botania; import vazkii.botania.common.block.ModBlocks; import vazkii.botania.common.lexicon.LexiconData; +import java.util.List; + public class SubTileEndoflame extends SubTileGenerating { - private static final String TAG_BURN_TIME = "burnTime"; - int burnTime = 0; + private static final String TAG_BURN_TIME = "burnTime"; + int burnTime = 0; - @Override - public void onUpdate() { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - if(linkedCollector != null) { - if(burnTime == 0) { - if(mana < getMaxMana() && !supertile.getWorldObj().isRemote) { - final int range = 3; - boolean didSomething = false; + if(linkedCollector != null) { + if(burnTime == 0) { + if(mana < getMaxMana() && !supertile.getWorldObj().isRemote) { + final int range = 3; + boolean didSomething = false; - List items = supertile.getWorldObj().getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + range, supertile.zCoord + range)); - for(EntityItem item : items) { - if(item.age >= 60 && !item.isDead) { - ItemStack stack = item.getEntityItem(); - if(stack.getItem().hasContainerItem(stack)) - continue; + List items = supertile.getWorldObj().getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + range, supertile.zCoord + range)); + for(EntityItem item : items) { + if(item.age >= 60 && !item.isDead) { + ItemStack stack = item.getEntityItem(); + if(stack.getItem().hasContainerItem(stack)) continue; - int burnTime = stack == null || stack.getItem() == Item.getItemFromBlock(ModBlocks.spreader) ? 0 : TileEntityFurnace.getItemBurnTime(stack); - if(burnTime > 0 && stack.stackSize > 0) { - this.burnTime = burnTime / 2; + int burnTime = stack == null || stack.getItem() == Item.getItemFromBlock(ModBlocks.spreader) ? 0 : TileEntityFurnace.getItemBurnTime(stack); + if(burnTime > 0 && stack.stackSize > 0) { + this.burnTime = burnTime / 2; - stack.stackSize--; + stack.stackSize--; - if(stack.stackSize == 0) - item.setDead(); + if(stack.stackSize == 0) item.setDead(); - didSomething = true; + didSomething = true; - break; - } - } - } + break; + } + } + } - if(didSomething) - sync(); - } - } else { - if(supertile.getWorldObj().rand.nextInt(8) == 0) - Botania.proxy.wispFX(supertile.getWorldObj(), supertile.xCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.yCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.zCoord + 0.5, 0.7F, 0.05F, 0.05F, (float) Math.random() / 6, (float) -Math.random() / 60); + if(didSomething) sync(); + } + } else { + if(supertile.getWorldObj().rand.nextInt(8) == 0) + Botania.proxy.wispFX(supertile.getWorldObj(), supertile.xCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.yCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.zCoord + 0.5, 0.7F, 0.05F, 0.05F, (float) Math.random() / 6, (float) -Math.random() / 60); - burnTime--; - } - } - } + burnTime--; + } + } + } - @Override - public int getMaxMana() { - return 300; - } + @Override + public int getMaxMana() { + return 300; + } - @Override - public int getValueForPassiveGeneration() { - return 2; - } + @Override + public int getValueForPassiveGeneration() { + return 2; + } - @Override - public int getColor() { - return 0x785000; - } + @Override + public int getColor() { + return 0x785000; + } - @Override - public LexiconEntry getEntry() { - return LexiconData.endoflame; - } + @Override + public LexiconEntry getEntry() { + return LexiconData.endoflame; + } - @Override - public void writeToPacketNBT(NBTTagCompound cmp) { - super.writeToPacketNBT(cmp); + @Override + public void writeToPacketNBT(NBTTagCompound cmp) { + super.writeToPacketNBT(cmp); - cmp.setInteger(TAG_BURN_TIME, burnTime); - } + cmp.setInteger(TAG_BURN_TIME, burnTime); + } - @Override - public void readFromPacketNBT(NBTTagCompound cmp) { - super.readFromPacketNBT(cmp); + @Override + public void readFromPacketNBT(NBTTagCompound cmp) { + super.readFromPacketNBT(cmp); - burnTime = cmp.getInteger(TAG_BURN_TIME); - } + burnTime = cmp.getInteger(TAG_BURN_TIME); + } - @Override - public boolean canGeneratePassively() { - return burnTime > 0; - } + @Override + public boolean canGeneratePassively() { + return burnTime > 0; + } - @Override - public int getDelayBetweenPassiveGeneration() { - return 1; - } + @Override + public int getDelayBetweenPassiveGeneration() { + return 1; + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java index 6b4db028f..06148f57f 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java +++ b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileHydroangeas.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [? (GMT)] */ package vazkii.botania.common.block.subtile.generating; @@ -21,92 +21,89 @@ import vazkii.botania.common.lexicon.LexiconData; public class SubTileHydroangeas extends SubTileGenerating { - private static final String TAG_BURN_TIME = "burnTime"; - int burnTime = 0; - int currentTime = 0; + private static final String TAG_BURN_TIME = "burnTime"; + int burnTime = 0; + int currentTime = 0; - @Override - public void onUpdate(){ - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - int range = 1; + int range = 1; - boolean didSomething = false; + boolean didSomething = false; - if(burnTime == 0) { - if(supertile.getWorldObj().getWorldTime() % 40L == 0) { - if(mana < getMaxMana() && !supertile.getWorldObj().isRemote) - for(int i = -range; i <= range; i++) - for(int j = -range; j <= range; j++) { - if(supertile.getWorldObj().getBlock(supertile.xCoord + i, supertile.yCoord, supertile.zCoord + j) == getBlockToSearchFor() && supertile.getWorldObj().getBlockMetadata(supertile.xCoord + i, supertile.yCoord, supertile.zCoord + j) == 0) { - supertile.getWorldObj().setBlockToAir(supertile.xCoord + i, supertile.yCoord, supertile.zCoord + j); - didSomething = true; - burnTime += getBurnTime(); + if(burnTime == 0) { + if(supertile.getWorldObj().getWorldTime() % 40L == 0) { + if(mana < getMaxMana() && !supertile.getWorldObj().isRemote) for(int i = -range; i <= range; i++) + for(int j = -range; j <= range; j++) { + if(supertile.getWorldObj().getBlock(supertile.xCoord + i, supertile.yCoord, supertile.zCoord + j) == getBlockToSearchFor() && supertile.getWorldObj().getBlockMetadata(supertile.xCoord + i, supertile.yCoord, supertile.zCoord + j) == 0) { + supertile.getWorldObj().setBlockToAir(supertile.xCoord + i, supertile.yCoord, supertile.zCoord + j); + didSomething = true; + burnTime += getBurnTime(); - break; + break; - } - } + } + } - if(didSomething) - sync(); - } - } else { - if(supertile.getWorldObj().rand.nextInt(8) == 0) - doBurnParticles(); - burnTime--; - } - } + if(didSomething) sync(); + } + } else { + if(supertile.getWorldObj().rand.nextInt(8) == 0) doBurnParticles(); + burnTime--; + } + } - public void doBurnParticles() { - Botania.proxy.wispFX(supertile.getWorldObj(), supertile.xCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.yCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.zCoord + 0.5, 0.05F, 0.05F, 0.7F, (float) Math.random() / 6, (float) -Math.random() / 60); - } + public void doBurnParticles() { + Botania.proxy.wispFX(supertile.getWorldObj(), supertile.xCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.yCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.zCoord + 0.5, 0.05F, 0.05F, 0.7F, (float) Math.random() / 6, (float) -Math.random() / 60); + } - public Block getBlockToSearchFor() { - return Blocks.water; - } + public Block getBlockToSearchFor() { + return Blocks.water; + } - public int getBurnTime() { - return 10; - } + public int getBurnTime() { + return 10; + } - @Override - public int getMaxMana() { - return 150; - } + @Override + public int getMaxMana() { + return 150; + } - @Override - public int getColor(){ - return 0x532FE0; - } + @Override + public int getColor() { + return 0x532FE0; + } - @Override - public LexiconEntry getEntry() { - return LexiconData.hydroangeas; - } + @Override + public LexiconEntry getEntry() { + return LexiconData.hydroangeas; + } - @Override - public void writeToPacketNBT(NBTTagCompound cmp) { - super.writeToPacketNBT(cmp); + @Override + public void writeToPacketNBT(NBTTagCompound cmp) { + super.writeToPacketNBT(cmp); - cmp.setInteger(TAG_BURN_TIME, burnTime); - } + cmp.setInteger(TAG_BURN_TIME, burnTime); + } - @Override - public void readFromPacketNBT(NBTTagCompound cmp) { - super.readFromPacketNBT(cmp); + @Override + public void readFromPacketNBT(NBTTagCompound cmp) { + super.readFromPacketNBT(cmp); - burnTime = cmp.getInteger(TAG_BURN_TIME); - } + burnTime = cmp.getInteger(TAG_BURN_TIME); + } - @Override - public boolean canGeneratePassively() { - return burnTime > 0; - } + @Override + public boolean canGeneratePassively() { + return burnTime > 0; + } - @Override - public int getDelayBetweenPassiveGeneration() { - return 4; - } + @Override + public int getDelayBetweenPassiveGeneration() { + return 4; + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileNightshade.java b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileNightshade.java index 448be9a53..d16d7d493 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileNightshade.java +++ b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileNightshade.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 16, 2014, 11:15:42 PM (GMT)] */ package vazkii.botania.common.block.subtile.generating; @@ -16,24 +16,24 @@ import vazkii.botania.common.lexicon.LexiconData; public class SubTileNightshade extends SubTileDaybloom { - @Override - public int getDelayBetweenPassiveGeneration() { - return super.getDelayBetweenPassiveGeneration() * 2; - } + @Override + public int getDelayBetweenPassiveGeneration() { + return super.getDelayBetweenPassiveGeneration() * 2; + } - @Override - public boolean canGeneratePassively() { - return !super.canGeneratePassively(); - } + @Override + public boolean canGeneratePassively() { + return !super.canGeneratePassively(); + } - @Override - public int getColor() { - return 0x3D2A90; - } + @Override + public int getColor() { + return 0x3D2A90; + } - @Override - public LexiconEntry getEntry() { - return LexiconData.nightshade; - } + @Override + public LexiconEntry getEntry() { + return LexiconData.nightshade; + } } diff --git a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileThermalily.java b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileThermalily.java index a2a852007..9bb77a48c 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileThermalily.java +++ b/MODSRC/vazkii/botania/common/block/subtile/generating/SubTileThermalily.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 10, 2014, 9:44:02 PM (GMT)] */ package vazkii.botania.common.block.subtile.generating; @@ -19,44 +19,44 @@ import vazkii.botania.common.lexicon.LexiconData; public class SubTileThermalily extends SubTileHydroangeas { - @Override - public int getColor(){ - return 0xD03C00; - } + @Override + public int getColor() { + return 0xD03C00; + } - @Override - public LexiconEntry getEntry() { - return LexiconData.thermalily; - } + @Override + public LexiconEntry getEntry() { + return LexiconData.thermalily; + } - @Override - public void doBurnParticles() { - Botania.proxy.wispFX(supertile.getWorldObj(), supertile.xCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.yCoord + 0.9 + Math.random() * 0.2 - 0.1, supertile.zCoord + 0.5, 0.7F, 0.05F, 0.05F, (float) Math.random() / 6, (float) -Math.random() / 60); - } + @Override + public void doBurnParticles() { + Botania.proxy.wispFX(supertile.getWorldObj(), supertile.xCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.yCoord + 0.9 + Math.random() * 0.2 - 0.1, supertile.zCoord + 0.5, 0.7F, 0.05F, 0.05F, (float) Math.random() / 6, (float) -Math.random() / 60); + } - @Override - public Block getBlockToSearchFor() { - return Blocks.lava; - } + @Override + public Block getBlockToSearchFor() { + return Blocks.lava; + } - @Override - public int getDelayBetweenPassiveGeneration() { - return 1; - } + @Override + public int getDelayBetweenPassiveGeneration() { + return 1; + } - @Override - public int getBurnTime() { - return 3500; - } + @Override + public int getBurnTime() { + return 3500; + } - @Override - public int getValueForPassiveGeneration() { - return 5; - } + @Override + public int getValueForPassiveGeneration() { + return 5; + } - @Override - public int getMaxMana() { - return 250; - } + @Override + public int getMaxMana() { + return 250; + } } diff --git a/MODSRC/vazkii/botania/common/block/tile/TileAltar.java b/MODSRC/vazkii/botania/common/block/tile/TileAltar.java index 0195462ad..b107dfc4d 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TileAltar.java +++ b/MODSRC/vazkii/botania/common/block/tile/TileAltar.java @@ -2,22 +2,18 @@ * This class was created by . 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 21, 2014, 7:51:36 PM (GMT)] */ package vazkii.botania.common.block.tile; -import java.awt.Color; -import java.util.List; - import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Items; import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; @@ -27,158 +23,155 @@ import vazkii.botania.api.recipe.RecipePetals; import vazkii.botania.common.Botania; import vazkii.botania.common.lib.LibBlockNames; +import java.awt.*; +import java.util.List; + public class TileAltar extends TileSimpleInventory implements ISidedInventory { - public static final String TAG_HAS_WATER = "hasWater"; + public static final String TAG_HAS_WATER = "hasWater"; - public boolean hasWater = false; + public boolean hasWater = false; - public boolean collideEntityItem(EntityItem item) { - ItemStack stack = item.getEntityItem(); - if(stack == null) - return false; + public boolean collideEntityItem(EntityItem item) { + ItemStack stack = item.getEntityItem(); + if(stack == null) return false; - if(!hasWater) { - if(stack.getItem() == Items.water_bucket) { - hasWater = true; - worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); - stack.func_150996_a(Items.bucket); // Set item - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } else return false; - } + if(!hasWater) { + if(stack.getItem() == Items.water_bucket) { + hasWater = true; + worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + stack.func_150996_a(Items.bucket); // Set item + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } else return false; + } - boolean didChange = false; + boolean didChange = false; - if(stack.getItem() instanceof IFlowerComponent) { - if(getStackInSlot(getSizeInventory() - 1) != null) - return false; + if(stack.getItem() instanceof IFlowerComponent) { + if(getStackInSlot(getSizeInventory() - 1) != null) return false; - if(!worldObj.isRemote) { - stack.stackSize--; - if(stack.stackSize == 0) - item.setDead(); + if(!worldObj.isRemote) { + stack.stackSize--; + if(stack.stackSize == 0) item.setDead(); - for(int i = 0; i < getSizeInventory(); i++) - if(getStackInSlot(i) == null) { - ItemStack stackToPut = stack.copy(); - stackToPut.stackSize = 1; - setInventorySlotContents(i, stackToPut); - didChange = true; - break; - } - } - } else if(stack.getItem() == Items.wheat_seeds) { - for(RecipePetals recipe : BotaniaAPI.petalRecipes) { - if(recipe.matches(this)) { - for(int i = 0; i < getSizeInventory(); i++) - setInventorySlotContents(i, null); + for(int i = 0; i < getSizeInventory(); i++) + if(getStackInSlot(i) == null) { + ItemStack stackToPut = stack.copy(); + stackToPut.stackSize = 1; + setInventorySlotContents(i, stackToPut); + didChange = true; + break; + } + } + } else if(stack.getItem() == Items.wheat_seeds) { + for(RecipePetals recipe : BotaniaAPI.petalRecipes) { + if(recipe.matches(this)) { + for(int i = 0; i < getSizeInventory(); i++) + setInventorySlotContents(i, null); - if(!worldObj.isRemote) { - stack.stackSize--; - if(stack.stackSize == 0) - item.setDead(); + if(!worldObj.isRemote) { + stack.stackSize--; + if(stack.stackSize == 0) item.setDead(); - ItemStack output = recipe.getOutput().copy(); - EntityItem outputItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, output); - worldObj.spawnEntityInWorld(outputItem); - } + ItemStack output = recipe.getOutput().copy(); + EntityItem outputItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, output); + worldObj.spawnEntityInWorld(outputItem); + } - craftingFanciness(); - hasWater = false; - worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); - didChange = true; - break; - } - } - } + craftingFanciness(); + hasWater = false; + worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + didChange = true; + break; + } + } + } - return didChange; - } + return didChange; + } - public void craftingFanciness() { - worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.levelup", 1F, 1F); - for(int i = 0; i < 25; i++) { - float red = (float) Math.random(); - float green = (float) Math.random(); - float blue = (float) Math.random(); - Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10); - } - } + public void craftingFanciness() { + worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.levelup", 1F, 1F); + for(int i = 0; i < 25; i++) { + float red = (float) Math.random(); + float green = (float) Math.random(); + float blue = (float) Math.random(); + Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10); + } + } - @Override - public void updateEntity() { - List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1D / 16D * 20D, zCoord, xCoord + 1, yCoord + 1D / 16D * 21D, zCoord + 1)); + @Override + public void updateEntity() { + List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1D / 16D * 20D, zCoord, xCoord + 1, yCoord + 1D / 16D * 21D, zCoord + 1)); - boolean didChange = false; + boolean didChange = false; - for(EntityItem item : items) - didChange = collideEntityItem(item) || didChange; + for(EntityItem item : items) + didChange = collideEntityItem(item) || didChange; - if(didChange) - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + if(didChange) worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - for(int i = 0; i < getSizeInventory(); i++) { - ItemStack stackAt = getStackInSlot(i); - if(stackAt == null) - break; + for(int i = 0; i < getSizeInventory(); i++) { + ItemStack stackAt = getStackInSlot(i); + if(stackAt == null) break; - if(Math.random() >= 0.97) { - Color color = new Color(((IFlowerComponent) stackAt.getItem()).getParticleColor(stackAt)); - float red = color.getRed() / 255F; - float green = color.getGreen() / 255F; - float blue = color.getBlue() / 255F; - Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10); - } - } - } + if(Math.random() >= 0.97) { + Color color = new Color(((IFlowerComponent) stackAt.getItem()).getParticleColor(stackAt)); + float red = color.getRed() / 255F; + float green = color.getGreen() / 255F; + float blue = color.getBlue() / 255F; + Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10); + } + } + } - @Override - public void writeCustomNBT(NBTTagCompound cmp) { - super.writeCustomNBT(cmp); + @Override + public void writeCustomNBT(NBTTagCompound cmp) { + super.writeCustomNBT(cmp); - cmp.setBoolean(TAG_HAS_WATER, hasWater); - } + cmp.setBoolean(TAG_HAS_WATER, hasWater); + } - @Override - public void readCustomNBT(NBTTagCompound cmp) { - super.readCustomNBT(cmp); + @Override + public void readCustomNBT(NBTTagCompound cmp) { + super.readCustomNBT(cmp); - hasWater = cmp.getBoolean(TAG_HAS_WATER); - } + hasWater = cmp.getBoolean(TAG_HAS_WATER); + } - @Override - public String getInventoryName() { - return LibBlockNames.ALTAR; - } + @Override + public String getInventoryName() { + return LibBlockNames.ALTAR; + } - @Override - public int getSizeInventory() { - return 16; - } + @Override + public int getSizeInventory() { + return 16; + } - @Override - public int getInventoryStackLimit() { - return 1; - } + @Override + public int getInventoryStackLimit() { + return 1; + } - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return false; - } + @Override + public boolean isItemValidForSlot(int i, ItemStack itemstack) { + return false; + } - @Override - public int[] getAccessibleSlotsFromSide(int var1) { - return new int[0]; - } + @Override + public int[] getAccessibleSlotsFromSide(int var1) { + return new int[0]; + } - @Override - public boolean canInsertItem(int i, ItemStack itemstack, int j) { - return false; - } + @Override + public boolean canInsertItem(int i, ItemStack itemstack, int j) { + return false; + } - @Override - public boolean canExtractItem(int i, ItemStack itemstack, int j) { - return false; - } + @Override + public boolean canExtractItem(int i, ItemStack itemstack, int j) { + return false; + } } diff --git a/MODSRC/vazkii/botania/common/block/tile/TileDistributor.java b/MODSRC/vazkii/botania/common/block/tile/TileDistributor.java index fb4f8d8a1..73bfbc6b4 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TileDistributor.java +++ b/MODSRC/vazkii/botania/common/block/tile/TileDistributor.java @@ -2,69 +2,66 @@ * This class was created by . 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 @ [Mar 3, 2014, 1:51:34 AM (GMT)] */ package vazkii.botania.common.block.tile; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; import vazkii.botania.api.mana.IManaPool; import vazkii.botania.api.mana.IManaReceiver; +import java.util.ArrayList; +import java.util.List; + public class TileDistributor extends TileMod implements IManaReceiver { - List validPools = new ArrayList(); + List validPools = new ArrayList(); - static final ForgeDirection[] DIRECTIONS = new ForgeDirection[] { - ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST - }; + static final ForgeDirection[] DIRECTIONS = new ForgeDirection[]{ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST}; - @Override - public void updateEntity() { - validPools.clear(); - for(ForgeDirection dir : DIRECTIONS) { - TileEntity tileAt = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ); - if(tileAt != null && tileAt instanceof IManaPool) { - IManaReceiver receiver = (IManaReceiver) tileAt; - if(!receiver.isFull()) - validPools.add(receiver); - } - } - } + @Override + public void updateEntity() { + validPools.clear(); + for(ForgeDirection dir : DIRECTIONS) { + TileEntity tileAt = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ); + if(tileAt != null && tileAt instanceof IManaPool) { + IManaReceiver receiver = (IManaReceiver) tileAt; + if(!receiver.isFull()) validPools.add(receiver); + } + } + } - @Override - public int getCurrentMana() { - return 0; - } + @Override + public int getCurrentMana() { + return 0; + } - @Override - public boolean isFull() { - return validPools.isEmpty(); - } + @Override + public boolean isFull() { + return validPools.isEmpty(); + } - @Override - public void recieveMana(int mana) { - int tiles = validPools.size(); - if(tiles != 0) { - int manaForEach = mana / tiles; - for(IManaReceiver pool : validPools) { - pool.recieveMana(manaForEach); - TileEntity tile = (TileEntity) pool; - worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord); - } - } - } + @Override + public void recieveMana(int mana) { + int tiles = validPools.size(); + if(tiles != 0) { + int manaForEach = mana / tiles; + for(IManaReceiver pool : validPools) { + pool.recieveMana(manaForEach); + TileEntity tile = (TileEntity) pool; + worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord); + } + } + } - @Override - public boolean canRecieveManaFromBursts() { - return !isFull(); - } + @Override + public boolean canRecieveManaFromBursts() { + return !isFull(); + } } diff --git a/MODSRC/vazkii/botania/common/block/tile/TileEnchanter.java b/MODSRC/vazkii/botania/common/block/tile/TileEnchanter.java index 4cf2d7090..470965578 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TileEnchanter.java +++ b/MODSRC/vazkii/botania/common/block/tile/TileEnchanter.java @@ -2,18 +2,15 @@ * This class was created by . 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 @ [Mar 15, 2014, 4:57:52 PM (GMT)] */ package vazkii.botania.common.block.tile; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -30,333 +27,311 @@ import vazkii.botania.api.mana.IManaReceiver; import vazkii.botania.common.Botania; import vazkii.botania.common.block.ModBlocks; +import java.util.ArrayList; +import java.util.List; + public class TileEnchanter extends TileMod implements IManaReceiver { - private static final String TAG_STAGE = "stage"; - private static final String TAG_STAGE_TICKS = "stageTicks"; - private static final String TAG_STAGE_3_END_TICKS = "stage3EndTicks"; - private static final String TAG_MANA_REQUIRED = "manaRequired"; - private static final String TAG_MANA = "mana"; - private static final String TAG_ITEM = "item"; - private static final String TAG_ENCHANTS = "enchantsToApply"; + private static final String TAG_STAGE = "stage"; + private static final String TAG_STAGE_TICKS = "stageTicks"; + private static final String TAG_STAGE_3_END_TICKS = "stage3EndTicks"; + private static final String TAG_MANA_REQUIRED = "manaRequired"; + private static final String TAG_MANA = "mana"; + private static final String TAG_ITEM = "item"; + private static final String TAG_ENCHANTS = "enchantsToApply"; - public int stage = 0; - public int stageTicks = 0; + public int stage = 0; + public int stageTicks = 0; - public int stage3EndTicks = 0; + public int stage3EndTicks = 0; - int manaRequired = -1; - int mana = 0; + int manaRequired = -1; + int mana = 0; - public ItemStack itemToEnchant = null; - List enchants = new ArrayList(); + public ItemStack itemToEnchant = null; + List enchants = new ArrayList(); - private static final int[][] OBSIDIAN_LOCATIONS = new int[][] { - { 0, -1, 0 }, - { 0, -1, 1 }, { 0, -1, -1 }, { 1, -1, 0 }, { -1, -1, 0 }, - { 0, -1, 2 }, { -1, -1, 2 }, { 1, -1, 2 }, - { 0, -1, -2 }, { -1, -1, -2 }, { 1, -1, -2 }, - { 2, -1, 0 }, { 2, -1, 1 }, { 2, -1, -1 }, - { -2, -1, 0 }, { -2, -1, 1 }, { -2, -1, -1 } - }; + private static final int[][] OBSIDIAN_LOCATIONS = new int[][]{{0, -1, 0}, {0, -1, 1}, {0, -1, -1}, {1, -1, 0}, {-1, -1, 0}, {0, -1, 2}, {-1, -1, 2}, {1, -1, 2}, {0, -1, -2}, {-1, -1, -2}, {1, -1, -2}, {2, -1, 0}, {2, -1, 1}, {2, -1, -1}, {-2, -1, 0}, {-2, -1, 1}, {-2, -1, -1}}; - private static final int[][][] PYLON_LOCATIONS = new int[][][] { - { { -5, 1, 0 }, { 5, 1, 0 }, { -4, 1, 3 }, { 4, 1, 3 }, { -4, 1, -3 }, { 4, 1, -3 } }, - { { 0, 1, -5 }, { 0, 1, 5 }, { 3, 1, -4 }, { 3, 1, 4 }, { -3, 1, -4 }, { -3, 1, 4 } } - }; + private static final int[][][] PYLON_LOCATIONS = new int[][][]{{{-5, 1, 0}, {5, 1, 0}, {-4, 1, 3}, {4, 1, 3}, {-4, 1, -3}, {4, 1, -3}}, {{0, 1, -5}, {0, 1, 5}, {3, 1, -4}, {3, 1, 4}, {-3, 1, -4}, {-3, 1, 4}}}; - private static final int[][] FLOWER_LOCATIONS = new int[][] { - { -1, 0, -1 }, { 1, 0, -1 }, { -1, 0, 1 }, { 1, 0, 1 } - }; + private static final int[][] FLOWER_LOCATIONS = new int[][]{{-1, 0, -1}, {1, 0, -1}, {-1, 0, 1}, {1, 0, 1}}; - public void onWanded(EntityPlayer player, ItemStack wand) { - if(stage != 0 || itemToEnchant == null || !itemToEnchant.isItemEnchantable()) - return; + public void onWanded(EntityPlayer player, ItemStack wand) { + if(stage != 0 || itemToEnchant == null || !itemToEnchant.isItemEnchantable()) return; - List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord - 2, yCoord, zCoord - 2, xCoord + 3, yCoord + 1, zCoord + 3)); - int count = items.size(); + List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord - 2, yCoord, zCoord - 2, xCoord + 3, yCoord + 1, zCoord + 3)); + int count = items.size(); - if(count > 0 && !worldObj.isRemote) { - for(EntityItem entity : items) { - ItemStack item = entity.getEntityItem(); - if(item.getItem() == Items.enchanted_book) { - NBTTagList enchants = Items.enchanted_book.func_92110_g(item); - if(enchants != null && enchants.tagCount() > 0) { - NBTTagCompound enchant = (NBTTagCompound) enchants.getCompoundTagAt(0); - short id = enchant.getShort("id"); - if(isEnchantmentValid(id)) { - advanceStage(); - return; - } - } - } - } - } - } + if(count > 0 && !worldObj.isRemote) { + for(EntityItem entity : items) { + ItemStack item = entity.getEntityItem(); + if(item.getItem() == Items.enchanted_book) { + NBTTagList enchants = Items.enchanted_book.func_92110_g(item); + if(enchants != null && enchants.tagCount() > 0) { + NBTTagCompound enchant = (NBTTagCompound) enchants.getCompoundTagAt(0); + short id = enchant.getShort("id"); + if(isEnchantmentValid(id)) { + advanceStage(); + return; + } + } + } + } + } + } - @Override - public void updateEntity() { - if(!canEnchanterExist(worldObj, xCoord, yCoord, zCoord, getBlockMetadata())) { - for(int[] pylon : PYLON_LOCATIONS[getBlockMetadata()]) { - TilePylon pylonTile = (TilePylon) worldObj.getTileEntity(xCoord + pylon[0], yCoord + pylon[1], zCoord + pylon[2]); - if(pylonTile != null) - pylonTile.activated = false; - } - worldObj.setBlock(xCoord, yCoord, zCoord, Blocks.lapis_block, 0, 1 | 2); - for(int i = 0; i < 50; i++) { - float red = (float) Math.random(); - float green = (float) Math.random(); - float blue = (float) Math.random(); - Botania.proxy.wispFX(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, red, green, blue, (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.25F, (float) (Math.random() - 0.5F) * 0.25F, (float) (Math.random() - 0.5F) * 0.25F); - } - worldObj.playSoundEffect(xCoord, yCoord, zCoord, "mob.blaze.breathe", 0.5F, 10F); - } + @Override + public void updateEntity() { + if(!canEnchanterExist(worldObj, xCoord, yCoord, zCoord, getBlockMetadata())) { + for(int[] pylon : PYLON_LOCATIONS[getBlockMetadata()]) { + TilePylon pylonTile = (TilePylon) worldObj.getTileEntity(xCoord + pylon[0], yCoord + pylon[1], zCoord + pylon[2]); + if(pylonTile != null) pylonTile.activated = false; + } + worldObj.setBlock(xCoord, yCoord, zCoord, Blocks.lapis_block, 0, 1 | 2); + for(int i = 0; i < 50; i++) { + float red = (float) Math.random(); + float green = (float) Math.random(); + float blue = (float) Math.random(); + Botania.proxy.wispFX(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, red, green, blue, (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.25F, (float) (Math.random() - 0.5F) * 0.25F, (float) (Math.random() - 0.5F) * 0.25F); + } + worldObj.playSoundEffect(xCoord, yCoord, zCoord, "mob.blaze.breathe", 0.5F, 10F); + } - switch(stage) { - case 1 : { // Get books - if(stageTicks % 20 == 0) { - List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord - 2, yCoord, zCoord - 2, xCoord + 3, yCoord + 1, zCoord + 3)); - int count = items.size(); - boolean addedEnch = false; + switch(stage) { + case 1: { // Get books + if(stageTicks % 20 == 0) { + List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord - 2, yCoord, zCoord - 2, xCoord + 3, yCoord + 1, zCoord + 3)); + int count = items.size(); + boolean addedEnch = false; - if(count > 0 && !worldObj.isRemote) { - for(EntityItem entity : items) { - ItemStack item = entity.getEntityItem(); - if(item.getItem() == Items.enchanted_book) { - NBTTagList enchants = Items.enchanted_book.func_92110_g(item); - if(enchants != null && enchants.tagCount() > 0) { - NBTTagCompound enchant = (NBTTagCompound) enchants.getCompoundTagAt(0); - short enchantId = enchant.getShort("id"); - short enchantLvl = enchant.getShort("lvl"); - if(!hasEnchantAlready(enchantId)) { - this.enchants.add(new EnchantmentData(enchantId, enchantLvl)); - worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.orb", 1F, 1F); - addedEnch = true; - break; - } - } - } - } - } + if(count > 0 && !worldObj.isRemote) { + for(EntityItem entity : items) { + ItemStack item = entity.getEntityItem(); + if(item.getItem() == Items.enchanted_book) { + NBTTagList enchants = Items.enchanted_book.func_92110_g(item); + if(enchants != null && enchants.tagCount() > 0) { + NBTTagCompound enchant = (NBTTagCompound) enchants.getCompoundTagAt(0); + short enchantId = enchant.getShort("id"); + short enchantLvl = enchant.getShort("lvl"); + if(!hasEnchantAlready(enchantId)) { + this.enchants.add(new EnchantmentData(enchantId, enchantLvl)); + worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.orb", 1F, 1F); + addedEnch = true; + break; + } + } + } + } + } - if(!addedEnch) { - if(enchants.isEmpty()) - stage = 0; - else advanceStage(); - } - } - break; - } - case 2 : { // Get Mana - for(int[] pylon : PYLON_LOCATIONS[getBlockMetadata()]) { - TilePylon pylonTile = (TilePylon) worldObj.getTileEntity(xCoord + pylon[0], yCoord + pylon[1], zCoord + pylon[2]); - if(pylonTile != null) { - pylonTile.activated = true; - pylonTile.centerX = xCoord; - pylonTile.centerY = yCoord; - pylonTile.centerZ = zCoord; - } - } + if(!addedEnch) { + if(enchants.isEmpty()) stage = 0; + else advanceStage(); + } + } + break; + } + case 2: { // Get Mana + for(int[] pylon : PYLON_LOCATIONS[getBlockMetadata()]) { + TilePylon pylonTile = (TilePylon) worldObj.getTileEntity(xCoord + pylon[0], yCoord + pylon[1], zCoord + pylon[2]); + if(pylonTile != null) { + pylonTile.activated = true; + pylonTile.centerX = xCoord; + pylonTile.centerY = yCoord; + pylonTile.centerZ = zCoord; + } + } - if(manaRequired == -1) { - manaRequired = 0; - for(EnchantmentData data : enchants) { - Enchantment ench = Enchantment.enchantmentsList[data.enchant]; - manaRequired += (int) (3000F * ((15 - ench.getWeight()) * 1.45F) * ((3F + data.level * data.level) * 0.25F) * (0.9F + enchants.size() * 0.05F)); - } - } else if(mana >= manaRequired) { - manaRequired = 0; - for(int[] pylon : PYLON_LOCATIONS[getBlockMetadata()]) - ((TilePylon) worldObj.getTileEntity(xCoord + pylon[0], yCoord + pylon[1], zCoord + pylon[2])).activated = false; + if(manaRequired == -1) { + manaRequired = 0; + for(EnchantmentData data : enchants) { + Enchantment ench = Enchantment.enchantmentsList[data.enchant]; + manaRequired += (int) (3000F * ((15 - ench.getWeight()) * 1.45F) * ((3F + data.level * data.level) * 0.25F) * (0.9F + enchants.size() * 0.05F)); + } + } else if(mana >= manaRequired) { + manaRequired = 0; + for(int[] pylon : PYLON_LOCATIONS[getBlockMetadata()]) + ((TilePylon) worldObj.getTileEntity(xCoord + pylon[0], yCoord + pylon[1], zCoord + pylon[2])).activated = false; - advanceStage(); - } else { - getManaFromPools : { - for(int i = -4; i < 5; i++) - for(int j = -4; j < 5; j++) { - TileEntity tile = worldObj.getTileEntity(xCoord + i, yCoord, zCoord + j); - if(tile instanceof IManaPool) { - IManaPool pool = (IManaPool) tile; - int manaToRemove = Math.min(pool.getCurrentMana(), Math.min(1000, manaRequired - mana + 1)); - if(!worldObj.isRemote) { - pool.recieveMana(-manaToRemove); - recieveMana((int) (manaToRemove * 0.9)); - sync(); - } + advanceStage(); + } else { + getManaFromPools: + { + for(int i = -4; i < 5; i++) + for(int j = -4; j < 5; j++) { + TileEntity tile = worldObj.getTileEntity(xCoord + i, yCoord, zCoord + j); + if(tile instanceof IManaPool) { + IManaPool pool = (IManaPool) tile; + int manaToRemove = Math.min(pool.getCurrentMana(), Math.min(1000, manaRequired - mana + 1)); + if(!worldObj.isRemote) { + pool.recieveMana(-manaToRemove); + recieveMana((int) (manaToRemove * 0.9)); + sync(); + } - if(mana >= manaRequired) - break getManaFromPools; - } - } - } - } + if(mana >= manaRequired) break getManaFromPools; + } + } + } + } - break; - } - case 3 : { // Enchant - if(stageTicks >= 100) { - for(EnchantmentData data : enchants) - itemToEnchant.addEnchantment(Enchantment.enchantmentsList[data.enchant], data.level); + break; + } + case 3: { // Enchant + if(stageTicks >= 100) { + for(EnchantmentData data : enchants) + itemToEnchant.addEnchantment(Enchantment.enchantmentsList[data.enchant], data.level); - enchants.clear(); - manaRequired = -1; - mana = 0; + enchants.clear(); + manaRequired = -1; + mana = 0; - craftingFanciness(); - advanceStage(); - } - break; - } - case 4 : { // Reset - if(stageTicks >= 20) - advanceStage(); + craftingFanciness(); + advanceStage(); + } + break; + } + case 4: { // Reset + if(stageTicks >= 20) advanceStage(); - break; - } - } + break; + } + } - if(stage != 0) - stageTicks++; - } + if(stage != 0) stageTicks++; + } - public void advanceStage() { - stage++; + public void advanceStage() { + stage++; - if(stage == 4) - stage3EndTicks = stageTicks; - else if(stage == 5) { - stage = 0; - stage3EndTicks = 0; - } + if(stage == 4) stage3EndTicks = stageTicks; + else if(stage == 5) { + stage = 0; + stage3EndTicks = 0; + } - stageTicks = 0; - sync(); - } + stageTicks = 0; + sync(); + } - public void craftingFanciness() { - worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.levelup", 1F, 1F); - for(int i = 0; i < 25; i++) { - float red = (float) Math.random(); - float green = (float) Math.random(); - float blue = (float) Math.random(); - Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10); - } - } + public void craftingFanciness() { + worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.levelup", 1F, 1F); + for(int i = 0; i < 25; i++) { + float red = (float) Math.random(); + float green = (float) Math.random(); + float blue = (float) Math.random(); + Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10); + } + } - @Override - public int getCurrentMana() { - return mana; - } + @Override + public int getCurrentMana() { + return mana; + } - @Override - public boolean isFull() { - return mana >= manaRequired; - } + @Override + public boolean isFull() { + return mana >= manaRequired; + } - @Override - public void recieveMana(int mana) { - this.mana = Math.min(manaRequired, this.mana + mana); - } + @Override + public void recieveMana(int mana) { + this.mana = Math.min(manaRequired, this.mana + mana); + } - @Override - public boolean canRecieveManaFromBursts() { - return manaRequired > 0; - } + @Override + public boolean canRecieveManaFromBursts() { + return manaRequired > 0; + } - public void sync() { - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } + public void sync() { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } - @Override - public void writeCustomNBT(NBTTagCompound cmp) { - cmp.setInteger(TAG_MANA, mana); - cmp.setInteger(TAG_MANA_REQUIRED, manaRequired); - cmp.setInteger(TAG_STAGE, stage); - cmp.setInteger(TAG_STAGE_TICKS, stageTicks); - cmp.setInteger(TAG_STAGE_3_END_TICKS, stage3EndTicks); + @Override + public void writeCustomNBT(NBTTagCompound cmp) { + cmp.setInteger(TAG_MANA, mana); + cmp.setInteger(TAG_MANA_REQUIRED, manaRequired); + cmp.setInteger(TAG_STAGE, stage); + cmp.setInteger(TAG_STAGE_TICKS, stageTicks); + cmp.setInteger(TAG_STAGE_3_END_TICKS, stage3EndTicks); - NBTTagCompound itemCmp = new NBTTagCompound(); - if(itemToEnchant != null) - itemToEnchant.writeToNBT(itemCmp); - cmp.setTag(TAG_ITEM, itemCmp); + NBTTagCompound itemCmp = new NBTTagCompound(); + if(itemToEnchant != null) itemToEnchant.writeToNBT(itemCmp); + cmp.setTag(TAG_ITEM, itemCmp); - String enchStr = ""; - for(EnchantmentData data : enchants) - enchStr = enchStr + data.enchant + ":" + data.level + ","; - cmp.setString(TAG_ENCHANTS, enchStr.isEmpty() ? enchStr : enchStr.substring(0, enchStr.length() - 1)); - } + String enchStr = ""; + for(EnchantmentData data : enchants) + enchStr = enchStr + data.enchant + ":" + data.level + ","; + cmp.setString(TAG_ENCHANTS, enchStr.isEmpty() ? enchStr : enchStr.substring(0, enchStr.length() - 1)); + } - @Override - public void readCustomNBT(NBTTagCompound cmp) { - mana = cmp.getInteger(TAG_MANA); - manaRequired = cmp.getInteger(TAG_MANA_REQUIRED); - stage = cmp.getInteger(TAG_STAGE); - stageTicks = cmp.getInteger(TAG_STAGE_TICKS); - stage3EndTicks = cmp.getInteger(TAG_STAGE_3_END_TICKS); + @Override + public void readCustomNBT(NBTTagCompound cmp) { + mana = cmp.getInteger(TAG_MANA); + manaRequired = cmp.getInteger(TAG_MANA_REQUIRED); + stage = cmp.getInteger(TAG_STAGE); + stageTicks = cmp.getInteger(TAG_STAGE_TICKS); + stage3EndTicks = cmp.getInteger(TAG_STAGE_3_END_TICKS); - NBTTagCompound itemCmp = cmp.getCompoundTag(TAG_ITEM); - itemToEnchant = ItemStack.loadItemStackFromNBT(itemCmp); + NBTTagCompound itemCmp = cmp.getCompoundTag(TAG_ITEM); + itemToEnchant = ItemStack.loadItemStackFromNBT(itemCmp); - enchants.clear(); - String enchStr = cmp.getString(TAG_ENCHANTS); - if(!enchStr.isEmpty()) { - String[] enchTokens = enchStr.split(","); - for(String token : enchTokens) { - String[] entryTokens = token.split(":"); - int id = Integer.parseInt(entryTokens[0]); - int lvl = Integer.parseInt(entryTokens[1]); - enchants.add(new EnchantmentData(id, lvl)); - } - } - } + enchants.clear(); + String enchStr = cmp.getString(TAG_ENCHANTS); + if(!enchStr.isEmpty()) { + String[] enchTokens = enchStr.split(","); + for(String token : enchTokens) { + String[] entryTokens = token.split(":"); + int id = Integer.parseInt(entryTokens[0]); + int lvl = Integer.parseInt(entryTokens[1]); + enchants.add(new EnchantmentData(id, lvl)); + } + } + } - private boolean hasEnchantAlready(int enchant) { - for(EnchantmentData data : enchants) - if(data.enchant == enchant) - return true; + private boolean hasEnchantAlready(int enchant) { + for(EnchantmentData data : enchants) + if(data.enchant == enchant) return true; - return false; - } + return false; + } - public boolean isEnchantmentValid(short id) { - Enchantment ench = Enchantment.enchantmentsList[id]; - if(!ench.canApply(itemToEnchant) || !ench.type.canEnchantItem(itemToEnchant.getItem())) - return false; + public boolean isEnchantmentValid(short id) { + Enchantment ench = Enchantment.enchantmentsList[id]; + if(!ench.canApply(itemToEnchant) || !ench.type.canEnchantItem(itemToEnchant.getItem())) return false; - for(EnchantmentData data : enchants) { - Enchantment otherEnch = Enchantment.enchantmentsList[data.enchant]; - if(!otherEnch.canApplyTogether(ench) || !ench.canApplyTogether(otherEnch)) - return false; - } + for(EnchantmentData data : enchants) { + Enchantment otherEnch = Enchantment.enchantmentsList[data.enchant]; + if(!otherEnch.canApplyTogether(ench) || !ench.canApplyTogether(otherEnch)) return false; + } - return true; - } + return true; + } - public static boolean canEnchanterExist(World world, int x, int y, int z, int meta) { - for(int[] obsidian : OBSIDIAN_LOCATIONS) - if(world.getBlock(obsidian[0] + x, obsidian[1] + y, obsidian[2] + z) != Blocks.obsidian) - return false; + public static boolean canEnchanterExist(World world, int x, int y, int z, int meta) { + for(int[] obsidian : OBSIDIAN_LOCATIONS) + if(world.getBlock(obsidian[0] + x, obsidian[1] + y, obsidian[2] + z) != Blocks.obsidian) return false; - for(int[] pylon : PYLON_LOCATIONS[meta]) - if(world.getBlock(pylon[0] + x, pylon[1] + y, pylon[2] + z) != ModBlocks.pylon || - world.getBlock(pylon[0] + x, pylon[1] + y - 1, pylon[2] + z) != ModBlocks.flower) - return false; + for(int[] pylon : PYLON_LOCATIONS[meta]) + if(world.getBlock(pylon[0] + x, pylon[1] + y, pylon[2] + z) != ModBlocks.pylon || world.getBlock(pylon[0] + x, pylon[1] + y - 1, pylon[2] + z) != ModBlocks.flower) + return false; - for(int[] flower : FLOWER_LOCATIONS) - if(world.getBlock(flower[0] + x, flower[1] + y, flower[2] + z) != ModBlocks.flower) - return false; + for(int[] flower : FLOWER_LOCATIONS) + if(world.getBlock(flower[0] + x, flower[1] + y, flower[2] + z) != ModBlocks.flower) return false; - return true; - } + return true; + } - private static class EnchantmentData { + private static class EnchantmentData { - public int enchant, level; + public int enchant, level; - public EnchantmentData(int enchant, int level) { - this.enchant = enchant; - this.level = level; - } - } + public EnchantmentData(int enchant, int level) { + this.enchant = enchant; + this.level = level; + } + } } diff --git a/MODSRC/vazkii/botania/common/block/tile/TileManaBeacon.java b/MODSRC/vazkii/botania/common/block/tile/TileManaBeacon.java index 4c5f5e09e..36d3c46c3 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TileManaBeacon.java +++ b/MODSRC/vazkii/botania/common/block/tile/TileManaBeacon.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 3, 2014, 5:09:30 PM (GMT)] */ package vazkii.botania.common.block.tile; @@ -17,25 +17,24 @@ import vazkii.botania.common.Botania; public class TileManaBeacon extends TileMod { - @Override - public void updateEntity() { - boolean redstone = false; - for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - int redstoneSide = worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal()); - if(redstoneSide > 0) - redstone = true; - } + @Override + public void updateEntity() { + boolean redstone = false; + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + int redstoneSide = worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal()); + if(redstoneSide > 0) redstone = true; + } - if(!redstone) { - float[] color = EntitySheep.fleeceColorTable[worldObj.getBlockMetadata(xCoord, yCoord, zCoord)]; + if(!redstone) { + float[] color = EntitySheep.fleeceColorTable[worldObj.getBlockMetadata(xCoord, yCoord, zCoord)]; - Botania.proxy.setWispFXDistanceLimit(false); - for(int i = 0; i < 3; i++) - Botania.proxy.wispFX(worldObj, xCoord + 0.5, yCoord, zCoord + 0.5, color[0], color[1], color[2], (float) Math.random() * 5 + 1F, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt(256F / (256F - yCoord)), (float) (Math.random() - 0.5F)); + Botania.proxy.setWispFXDistanceLimit(false); + for(int i = 0; i < 3; i++) + Botania.proxy.wispFX(worldObj, xCoord + 0.5, yCoord, zCoord + 0.5, color[0], color[1], color[2], (float) Math.random() * 5 + 1F, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt(256F / (256F - yCoord)), (float) (Math.random() - 0.5F)); - for(int i = 0; i < 4; i++) - Botania.proxy.wispFX(worldObj, xCoord + 0.5, 256, zCoord + 0.5, color[0], color[1], color[2], (float) Math.random() * 15 + 8F, (float) (Math.random() - 0.5F) * 8F, 0F, (float) (Math.random() - 0.5F) * 8F); - Botania.proxy.setWispFXDistanceLimit(true); - } - } + for(int i = 0; i < 4; i++) + Botania.proxy.wispFX(worldObj, xCoord + 0.5, 256, zCoord + 0.5, color[0], color[1], color[2], (float) Math.random() * 15 + 8F, (float) (Math.random() - 0.5F) * 8F, 0F, (float) (Math.random() - 0.5F) * 8F); + Botania.proxy.setWispFXDistanceLimit(true); + } + } } diff --git a/MODSRC/vazkii/botania/common/block/tile/TileManaDetector.java b/MODSRC/vazkii/botania/common/block/tile/TileManaDetector.java index 1f0d06fb9..dd1726ab6 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TileManaDetector.java +++ b/MODSRC/vazkii/botania/common/block/tile/TileManaDetector.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 10, 2014, 7:55:12 PM (GMT)] */ package vazkii.botania.common.block.tile; @@ -17,19 +17,18 @@ import vazkii.botania.api.mana.IManaCollisionGhost; public class TileManaDetector extends TileMod implements IManaCollisionGhost { - @Override - public void updateEntity() { - if(!worldObj.isRemote) { - int meta = getBlockMetadata(); - int expectedMeta = worldObj.getEntitiesWithinAABB(IManaBurst.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1)).size() != 0 ? 1 : 0; - if(meta != expectedMeta) - worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, expectedMeta, 1 | 2); - } - } + @Override + public void updateEntity() { + if(!worldObj.isRemote) { + int meta = getBlockMetadata(); + int expectedMeta = worldObj.getEntitiesWithinAABB(IManaBurst.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1)).size() != 0 ? 1 : 0; + if(meta != expectedMeta) worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, expectedMeta, 1 | 2); + } + } - @Override - public boolean isGhost() { - return true; - } + @Override + public boolean isGhost() { + return true; + } } diff --git a/MODSRC/vazkii/botania/common/block/tile/TileManaVoid.java b/MODSRC/vazkii/botania/common/block/tile/TileManaVoid.java index 4ce49bdb6..749bb4e1e 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TileManaVoid.java +++ b/MODSRC/vazkii/botania/common/block/tile/TileManaVoid.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 5, 2014, 12:59:27 AM (GMT)] */ package vazkii.botania.common.block.tile; @@ -15,24 +15,24 @@ import vazkii.botania.api.mana.IManaReceiver; public class TileManaVoid extends TileMod implements IManaReceiver { - @Override - public int getCurrentMana() { - return 0; - } + @Override + public int getCurrentMana() { + return 0; + } - @Override - public boolean isFull() { - return false; - } + @Override + public boolean isFull() { + return false; + } - @Override - public void recieveMana(int mana) { - // All your mana is belong to the void - } + @Override + public void recieveMana(int mana) { + // All your mana is belong to the void + } - @Override - public boolean canRecieveManaFromBursts() { - return true; - } + @Override + public boolean canRecieveManaFromBursts() { + return true; + } } diff --git a/MODSRC/vazkii/botania/common/block/tile/TileMod.java b/MODSRC/vazkii/botania/common/block/tile/TileMod.java index 6dfd8d6f0..04079a235 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TileMod.java +++ b/MODSRC/vazkii/botania/common/block/tile/TileMod.java @@ -2,11 +2,11 @@ * This class was created by . 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 21, 2014, 9:18:28 PM (GMT)] */ package vazkii.botania.common.block.tile; @@ -19,40 +19,40 @@ import net.minecraft.tileentity.TileEntity; public class TileMod extends TileEntity { - @Override - public void writeToNBT(NBTTagCompound par1nbtTagCompound) { - super.writeToNBT(par1nbtTagCompound); + @Override + public void writeToNBT(NBTTagCompound par1nbtTagCompound) { + super.writeToNBT(par1nbtTagCompound); - writeCustomNBT(par1nbtTagCompound); - } + writeCustomNBT(par1nbtTagCompound); + } - @Override - public void readFromNBT(NBTTagCompound par1nbtTagCompound) { - super.readFromNBT(par1nbtTagCompound); + @Override + public void readFromNBT(NBTTagCompound par1nbtTagCompound) { + super.readFromNBT(par1nbtTagCompound); - readCustomNBT(par1nbtTagCompound); - } + readCustomNBT(par1nbtTagCompound); + } - public void writeCustomNBT(NBTTagCompound cmp) { - // NO-OP - } + public void writeCustomNBT(NBTTagCompound cmp) { + // NO-OP + } - public void readCustomNBT(NBTTagCompound cmp) { - // NO-OP - } + public void readCustomNBT(NBTTagCompound cmp) { + // NO-OP + } - @Override - public Packet getDescriptionPacket() { - NBTTagCompound nbttagcompound = new NBTTagCompound(); - writeCustomNBT(nbttagcompound); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound); - } + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + writeCustomNBT(nbttagcompound); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound); + } - @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { - super.onDataPacket(net, packet); - readCustomNBT(packet.func_148857_g()); - worldObj.func_147479_m(xCoord, yCoord, zCoord); // Mark block for render update - } + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { + super.onDataPacket(net, packet); + readCustomNBT(packet.func_148857_g()); + worldObj.func_147479_m(xCoord, yCoord, zCoord); // Mark block for render update + } } diff --git a/MODSRC/vazkii/botania/common/block/tile/TilePool.java b/MODSRC/vazkii/botania/common/block/tile/TilePool.java index e89e2de14..52a31032b 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TilePool.java +++ b/MODSRC/vazkii/botania/common/block/tile/TilePool.java @@ -2,20 +2,15 @@ * This class was created by . 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 26, 2014, 12:23:55 AM (GMT)] */ package vazkii.botania.common.block.tile; -import ibxm.Player; - -import java.awt.Color; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; @@ -27,9 +22,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; - import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.mana.IManaItem; import vazkii.botania.api.mana.IManaPool; @@ -39,196 +32,193 @@ import vazkii.botania.client.core.handler.HUDHandler; import vazkii.botania.common.Botania; import vazkii.botania.common.block.ModBlocks; +import java.awt.*; +import java.util.List; + public class TilePool extends TileMod implements IManaPool { - public static final int MAX_MANA = 1000000; + public static final int MAX_MANA = 1000000; - private static final String TAG_MANA = "mana"; - private static final String TAG_KNOWN_MANA = "knownMana"; - private static final String TAG_OUTPUTTING = "outputting"; + private static final String TAG_MANA = "mana"; + private static final String TAG_KNOWN_MANA = "knownMana"; + private static final String TAG_OUTPUTTING = "outputting"; - boolean outputting = false; + boolean outputting = false; - int mana; - int knownMana = -1; - boolean added = false; + int mana; + int knownMana = -1; + boolean added = false; - @Override - public boolean isFull() { - Block blockBelow = worldObj.getBlock(xCoord, yCoord - 1, zCoord); - return blockBelow != ModBlocks.manaVoid && mana >= MAX_MANA; - } + @Override + public boolean isFull() { + Block blockBelow = worldObj.getBlock(xCoord, yCoord - 1, zCoord); + return blockBelow != ModBlocks.manaVoid && mana >= MAX_MANA; + } - @Override - public void recieveMana(int mana) { - boolean full = this.mana >= MAX_MANA; + @Override + public void recieveMana(int mana) { + boolean full = this.mana >= MAX_MANA; - this.mana = Math.min(this.mana + mana, MAX_MANA); - if(!full) - worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); - } + this.mana = Math.min(this.mana + mana, MAX_MANA); + if(!full) worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + } - @Override - public void invalidate() { - super.invalidate(); - ManaNetworkEvent.removePool(this); - } + @Override + public void invalidate() { + super.invalidate(); + ManaNetworkEvent.removePool(this); + } - @Override - public void onChunkUnload() { - super.onChunkUnload(); - ManaNetworkEvent.removePool(this); - } + @Override + public void onChunkUnload() { + super.onChunkUnload(); + ManaNetworkEvent.removePool(this); + } - public boolean collideEntityItem(EntityItem item) { - boolean didChange = false; - ItemStack stack = item.getEntityItem(); - if(stack == null) - return false; + public boolean collideEntityItem(EntityItem item) { + boolean didChange = false; + ItemStack stack = item.getEntityItem(); + if(stack == null) return false; - for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) { - if(recipe.matches(stack)) { - int mana = recipe.getManaToConsume(); - if(getCurrentMana() >= mana) { - recieveMana(-mana); + for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) { + if(recipe.matches(stack)) { + int mana = recipe.getManaToConsume(); + if(getCurrentMana() >= mana) { + recieveMana(-mana); - if(!worldObj.isRemote) { - stack.stackSize--; - if(stack.stackSize == 0) - item.setDead(); + if(!worldObj.isRemote) { + stack.stackSize--; + if(stack.stackSize == 0) item.setDead(); - ItemStack output = recipe.getOutput().copy(); - EntityItem outputItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, output); - worldObj.spawnEntityInWorld(outputItem); - } - craftingFanciness(); - didChange = true; - } + ItemStack output = recipe.getOutput().copy(); + EntityItem outputItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, output); + worldObj.spawnEntityInWorld(outputItem); + } + craftingFanciness(); + didChange = true; + } - break; - } - } + break; + } + } - return didChange; - } + return didChange; + } - public void craftingFanciness() { - worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.levelup", 1F, 1F); - for(int i = 0; i < 25; i++) { - float red = (float) Math.random(); - float green = (float) Math.random(); - float blue = (float) Math.random(); - Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10); - } - } + public void craftingFanciness() { + worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.levelup", 1F, 1F); + for(int i = 0; i < 25; i++) { + float red = (float) Math.random(); + float green = (float) Math.random(); + float blue = (float) Math.random(); + Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10); + } + } - @Override - public void updateEntity() { - if(!added) { - ManaNetworkEvent.addPool(this); - added = true; - } - if(worldObj.isRemote) { - double particleChance = 1F - (double) getCurrentMana() / (double) MAX_MANA * 0.1; - Color color = new Color(0x00C6FF); - if(Math.random() > particleChance) - Botania.proxy.wispFX(worldObj, xCoord + 0.3 + Math.random() * 0.5, yCoord + 0.6 + Math.random() * 0.25, zCoord + Math.random(), color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random() / 3F, (float) -Math.random() / 25F); - } + @Override + public void updateEntity() { + if(!added) { + ManaNetworkEvent.addPool(this); + added = true; + } + if(worldObj.isRemote) { + double particleChance = 1F - (double) getCurrentMana() / (double) MAX_MANA * 0.1; + Color color = new Color(0x00C6FF); + if(Math.random() > particleChance) + Botania.proxy.wispFX(worldObj, xCoord + 0.3 + Math.random() * 0.5, yCoord + 0.6 + Math.random() * 0.25, zCoord + Math.random(), color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random() / 3F, (float) -Math.random() / 25F); + } - List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1)); - for(EntityItem item : items) { - ItemStack stack = item.getEntityItem(); - if(stack != null && stack.getItem() instanceof IManaItem) { - IManaItem mana = (IManaItem) stack.getItem(); - if(outputting && mana.canReceiveManaFromPool(stack, this) || !outputting && mana.canExportManaToPool(stack, this)) { - boolean didSomething = false; + List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1)); + for(EntityItem item : items) { + ItemStack stack = item.getEntityItem(); + if(stack != null && stack.getItem() instanceof IManaItem) { + IManaItem mana = (IManaItem) stack.getItem(); + if(outputting && mana.canReceiveManaFromPool(stack, this) || !outputting && mana.canExportManaToPool(stack, this)) { + boolean didSomething = false; - if(outputting) { - if(this.mana > 0) - didSomething = true; + if(outputting) { + if(this.mana > 0) didSomething = true; - int manaVal = Math.min(1000, Math.min(this.mana, mana.getMaxMana(stack) - mana.getMana(stack))); - mana.addMana(stack, manaVal); - recieveMana(-manaVal); - } else { - if(mana.getMana(stack) > 0) - didSomething = true; + int manaVal = Math.min(1000, Math.min(this.mana, mana.getMaxMana(stack) - mana.getMana(stack))); + mana.addMana(stack, manaVal); + recieveMana(-manaVal); + } else { + if(mana.getMana(stack) > 0) didSomething = true; - int manaVal = Math.min(1000, Math.min(MAX_MANA - this.mana, mana.getMana(stack))); - mana.addMana(stack, -manaVal); - recieveMana(manaVal); - } + int manaVal = Math.min(1000, Math.min(MAX_MANA - this.mana, mana.getMana(stack))); + mana.addMana(stack, -manaVal); + recieveMana(manaVal); + } - if(didSomething) { - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - if(worldObj.isRemote) { - Color color = new Color(0x00C6FF); - Botania.proxy.wispFX(worldObj, item.posX + Math.random() * 0.5 - 0.25, item.posY + Math.random() * 0.5 - (outputting ? 0.65 : 0.25), item.posZ + Math.random() * 0.5 - 0.25, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random() / 15F, (outputting ? -1F : 1) * (float) Math.random() / 25F); - } - } - } - } - } - } + if(didSomething) { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + if(worldObj.isRemote) { + Color color = new Color(0x00C6FF); + Botania.proxy.wispFX(worldObj, item.posX + Math.random() * 0.5 - 0.25, item.posY + Math.random() * 0.5 - (outputting ? 0.65 : 0.25), item.posZ + Math.random() * 0.5 - 0.25, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random() / 15F, (outputting ? -1F : 1) * (float) Math.random() / 25F); + } + } + } + } + } + } - @Override - public void writeCustomNBT(NBTTagCompound cmp) { - cmp.setInteger(TAG_MANA, mana); - cmp.setBoolean(TAG_OUTPUTTING, outputting); - } + @Override + public void writeCustomNBT(NBTTagCompound cmp) { + cmp.setInteger(TAG_MANA, mana); + cmp.setBoolean(TAG_OUTPUTTING, outputting); + } - @Override - public void readCustomNBT(NBTTagCompound cmp) { - mana = cmp.getInteger(TAG_MANA); - outputting = cmp.getBoolean(TAG_OUTPUTTING); + @Override + public void readCustomNBT(NBTTagCompound cmp) { + mana = cmp.getInteger(TAG_MANA); + outputting = cmp.getBoolean(TAG_OUTPUTTING); - if(cmp.hasKey(TAG_KNOWN_MANA)) - knownMana = cmp.getInteger(TAG_KNOWN_MANA); - } + if(cmp.hasKey(TAG_KNOWN_MANA)) knownMana = cmp.getInteger(TAG_KNOWN_MANA); + } - public void onWanded(EntityPlayer player, ItemStack wand) { - if(player.isSneaking()) { - outputting = !outputting; - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } + public void onWanded(EntityPlayer player, ItemStack wand) { + if(player.isSneaking()) { + outputting = !outputting; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } - if(!worldObj.isRemote) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); - writeCustomNBT(nbttagcompound); - nbttagcompound.setInteger(TAG_KNOWN_MANA, getCurrentMana()); - if(player instanceof EntityPlayerMP) - ((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound)); - } + if(!worldObj.isRemote) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + writeCustomNBT(nbttagcompound); + nbttagcompound.setInteger(TAG_KNOWN_MANA, getCurrentMana()); + if(player instanceof EntityPlayerMP) + ((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound)); + } - worldObj.playSoundAtEntity(player, "random.orb", 0.11F, 1F); - } + worldObj.playSoundAtEntity(player, "random.orb", 0.11F, 1F); + } - public void renderHUD(Minecraft mc, ScaledResolution res) { - String name = ModBlocks.pool.getLocalizedName(); - int color = 0x660000FF; - HUDHandler.drawSimpleManaHUD(color, knownMana, MAX_MANA, name, res); + public void renderHUD(Minecraft mc, ScaledResolution res) { + String name = ModBlocks.pool.getLocalizedName(); + int color = 0x660000FF; + HUDHandler.drawSimpleManaHUD(color, knownMana, MAX_MANA, name, res); - String power = StatCollector.translateToLocal("botaniamisc." + (outputting ? "outputtingPower" : "inputtingPower")); - int x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(power) / 2; - int y = res.getScaledHeight() / 2 + 30; - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - mc.fontRenderer.drawStringWithShadow(power, x, y, color); - GL11.glDisable(GL11.GL_BLEND); - } + String power = StatCollector.translateToLocal("botaniamisc." + (outputting ? "outputtingPower" : "inputtingPower")); + int x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(power) / 2; + int y = res.getScaledHeight() / 2 + 30; + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + mc.fontRenderer.drawStringWithShadow(power, x, y, color); + GL11.glDisable(GL11.GL_BLEND); + } - @Override - public boolean canRecieveManaFromBursts() { - return true; - } + @Override + public boolean canRecieveManaFromBursts() { + return true; + } - @Override - public boolean isOutputtingPower() { - return outputting; - } + @Override + public boolean isOutputtingPower() { + return outputting; + } - @Override - public int getCurrentMana() { - return mana; - } + @Override + public int getCurrentMana() { + return mana; + } } diff --git a/MODSRC/vazkii/botania/common/block/tile/TilePylon.java b/MODSRC/vazkii/botania/common/block/tile/TilePylon.java index c101924f1..84694019c 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TilePylon.java +++ b/MODSRC/vazkii/botania/common/block/tile/TilePylon.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Feb 18, 2014, 10:15:50 PM (GMT)] */ package vazkii.botania.common.block.tile; @@ -20,38 +20,38 @@ import vazkii.botania.common.core.helper.Vector3; public class TilePylon extends TileEntity { - boolean activated = false; - int centerX, centerY, centerZ; + boolean activated = false; + int centerX, centerY, centerZ; - @Override - public void updateEntity() { - if(activated && worldObj.isRemote) { - if(worldObj.getBlock(centerX, centerY, centerZ) != ModBlocks.enchanter) { - activated = false; - return; - } + @Override + public void updateEntity() { + if(activated && worldObj.isRemote) { + if(worldObj.getBlock(centerX, centerY, centerZ) != ModBlocks.enchanter) { + activated = false; + return; + } - Vector3 centerBlock = new Vector3(centerX + 0.5, centerY + 0.75 + (Math.random() - 0.5 * 0.25), centerZ + 0.5); + Vector3 centerBlock = new Vector3(centerX + 0.5, centerY + 0.75 + (Math.random() - 0.5 * 0.25), centerZ + 0.5); - Block block = worldObj.getBlock(xCoord, yCoord - 1, zCoord); - if(block == ModBlocks.flower) { - int meta = worldObj.getBlockMetadata(xCoord, yCoord - 1, zCoord); - float[] color = EntitySheep.fleeceColorTable[meta]; + Block block = worldObj.getBlock(xCoord, yCoord - 1, zCoord); + if(block == ModBlocks.flower) { + int meta = worldObj.getBlockMetadata(xCoord, yCoord - 1, zCoord); + float[] color = EntitySheep.fleeceColorTable[meta]; - if(worldObj.rand.nextInt(4) == 0) - Botania.proxy.sparkleFX(worldObj, centerBlock.x + (Math.random() - 0.5) * 0.5, centerBlock.y, centerBlock.z + (Math.random() - 0.5) * 0.5, color[0], color[1], color[2], (float) Math.random(), 8); + if(worldObj.rand.nextInt(4) == 0) + Botania.proxy.sparkleFX(worldObj, centerBlock.x + (Math.random() - 0.5) * 0.5, centerBlock.y, centerBlock.z + (Math.random() - 0.5) * 0.5, color[0], color[1], color[2], (float) Math.random(), 8); - Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.25, yCoord - 0.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 3F, -0.04F); - Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.125, yCoord + 1.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.125, color[0], color[1], color[2], (float) Math.random() / 5F, -0.001F); + Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.25, yCoord - 0.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 3F, -0.04F); + Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.125, yCoord + 1.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.125, color[0], color[1], color[2], (float) Math.random() / 5F, -0.001F); - Vector3 ourCoords = Vector3.fromTileEntityCenter(this).add(0, 1 + (Math.random() - 0.5 * 0.25), 0); - Vector3 movementVector = centerBlock.sub(ourCoords).normalize().multiply(0.2); - Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.25, yCoord + 1.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 8F, (float) movementVector.x, (float) movementVector.y, (float) movementVector.z); - } - } + Vector3 ourCoords = Vector3.fromTileEntityCenter(this).add(0, 1 + (Math.random() - 0.5 * 0.25), 0); + Vector3 movementVector = centerBlock.sub(ourCoords).normalize().multiply(0.2); + Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.25, yCoord + 1.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 8F, (float) movementVector.x, (float) movementVector.y, (float) movementVector.z); + } + } - if(worldObj.rand.nextBoolean() && worldObj.isRemote) - Botania.proxy.sparkleFX(worldObj, xCoord + Math.random(), yCoord + Math.random() * 1.5, zCoord + Math.random(), 0.5F, 0.5F, 1F, (float) Math.random(), 2); - } + if(worldObj.rand.nextBoolean() && worldObj.isRemote) + Botania.proxy.sparkleFX(worldObj, xCoord + Math.random(), yCoord + Math.random() * 1.5, zCoord + Math.random(), 0.5F, 0.5F, 1F, (float) Math.random(), 2); + } } diff --git a/MODSRC/vazkii/botania/common/block/tile/TileRuneAltar.java b/MODSRC/vazkii/botania/common/block/tile/TileRuneAltar.java index 0e695be80..f7257863d 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TileRuneAltar.java +++ b/MODSRC/vazkii/botania/common/block/tile/TileRuneAltar.java @@ -2,18 +2,15 @@ * This class was created by . 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 @ [Feb 2, 2014, 6:31:19 PM (GMT)] */ package vazkii.botania.common.block.tile; -import java.util.List; -import java.util.concurrent.Callable; - import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; @@ -30,206 +27,205 @@ import vazkii.botania.common.core.helper.Vector3; import vazkii.botania.common.item.ModItems; import vazkii.botania.common.lib.LibBlockNames; +import java.util.List; + public class TileRuneAltar extends TileSimpleInventory implements ISidedInventory, IManaReceiver { - private static final String TAG_MANA = "mana"; + private static final String TAG_MANA = "mana"; - int manaToGet = 0; - int mana = 0; - - public boolean addItem(EntityPlayer player, ItemStack stack) { - if(stack.getItem() == ModItems.twigWand || stack.getItem() == ModItems.lexicon || manaToGet != 0) - return false; + int manaToGet = 0; + int mana = 0; - boolean did = false; + public boolean addItem(EntityPlayer player, ItemStack stack) { + if(stack.getItem() == ModItems.twigWand || stack.getItem() == ModItems.lexicon || manaToGet != 0) return false; - for(int i = 0; i < getSizeInventory(); i++) - if(getStackInSlot(i) == null) { - did = true; - ItemStack stackToAdd = stack.copy(); - stackToAdd.stackSize = 1; - setInventorySlotContents(i, stackToAdd); + boolean did = false; - if(!player.capabilities.isCreativeMode) { - stack.stackSize--; - if(stack.stackSize == 0) - player.inventory.setInventorySlotContents(player.inventory.currentItem, null); - } + for(int i = 0; i < getSizeInventory(); i++) + if(getStackInSlot(i) == null) { + did = true; + ItemStack stackToAdd = stack.copy(); + stackToAdd.stackSize = 1; + setInventorySlotContents(i, stackToAdd); - break; - } + if(!player.capabilities.isCreativeMode) { + stack.stackSize--; + if(stack.stackSize == 0) + player.inventory.setInventorySlotContents(player.inventory.currentItem, null); + } - if(did) - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + break; + } - return true; - } + if(did) worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - @Override - public void updateEntity() { - super.updateEntity(); + return true; + } - // Update every tick. - recieveMana(0); + @Override + public void updateEntity() { + super.updateEntity(); - if(worldObj.isRemote && manaToGet > 0 && mana >= manaToGet) { - if(worldObj.rand.nextInt(20) == 0) { - worldObj.playSoundEffect(xCoord, yCoord, zCoord, "mob.creeper.live", 1F, 1F); + // Update every tick. + recieveMana(0); - Vector3 vec = Vector3.fromTileEntityCenter(this); - Vector3 endVec = vec.copy().add(0, 2.5, 0); - Botania.proxy.lightningFX(worldObj, vec, endVec, 2F, 0x00948B, 0x00E4D7); - } - } + if(worldObj.isRemote && manaToGet > 0 && mana >= manaToGet) { + if(worldObj.rand.nextInt(20) == 0) { + worldObj.playSoundEffect(xCoord, yCoord, zCoord, "mob.creeper.live", 1F, 1F); - } + Vector3 vec = Vector3.fromTileEntityCenter(this); + Vector3 endVec = vec.copy().add(0, 2.5, 0); + Botania.proxy.lightningFX(worldObj, vec, endVec, 2F, 0x00948B, 0x00E4D7); + } + } - public void updateRecipe() { - int manaToGet = this.manaToGet; + } - getMana : { - for(RecipeRuneAltar recipe : BotaniaAPI.runeAltarRecipes) - if(recipe.matches(this)) { - this.manaToGet = recipe.getManaUsage(); - break getMana; - } - this.manaToGet = 0; - } + public void updateRecipe() { + int manaToGet = this.manaToGet; - if(manaToGet != this.manaToGet) { - worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.orb", 1F, 1F); - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } - } + getMana: + { + for(RecipeRuneAltar recipe : BotaniaAPI.runeAltarRecipes) + if(recipe.matches(this)) { + this.manaToGet = recipe.getManaUsage(); + break getMana; + } + this.manaToGet = 0; + } - public void onWanded(EntityPlayer player, ItemStack wand) { - updateRecipe(); + if(manaToGet != this.manaToGet) { + worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.orb", 1F, 1F); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + } - RecipeRuneAltar recipe = null; + public void onWanded(EntityPlayer player, ItemStack wand) { + updateRecipe(); - for(RecipeRuneAltar recipe_ : BotaniaAPI.runeAltarRecipes) { - if(recipe_.matches(this)) { - recipe = recipe_; - break; - } - } + RecipeRuneAltar recipe = null; - if(manaToGet > 0 && mana >= manaToGet) { - List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1)); - EntityItem livingrock = null; - for(EntityItem item : items) - if(item.getEntityItem() != null && item.getEntityItem().getItem() == Item.getItemFromBlock(ModBlocks.livingrock)) { - livingrock = item; - break; - } + for(RecipeRuneAltar recipe_ : BotaniaAPI.runeAltarRecipes) { + if(recipe_.matches(this)) { + recipe = recipe_; + break; + } + } - if(livingrock != null) { - int mana = recipe.getManaUsage(); - recieveMana(-mana); - if(!worldObj.isRemote) { - ItemStack output = recipe.getOutput().copy(); - EntityItem outputItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, output); - worldObj.spawnEntityInWorld(outputItem); - } + if(manaToGet > 0 && mana >= manaToGet) { + List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1)); + EntityItem livingrock = null; + for(EntityItem item : items) + if(item.getEntityItem() != null && item.getEntityItem().getItem() == Item.getItemFromBlock(ModBlocks.livingrock)) { + livingrock = item; + break; + } - for(int i = 0; i < getSizeInventory(); i++) - setInventorySlotContents(i, null); + if(livingrock != null) { + int mana = recipe.getManaUsage(); + recieveMana(-mana); + if(!worldObj.isRemote) { + ItemStack output = recipe.getOutput().copy(); + EntityItem outputItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, output); + worldObj.spawnEntityInWorld(outputItem); + } - if(!worldObj.isRemote) { - ItemStack livingrockItem = livingrock.getEntityItem(); - livingrockItem.stackSize--; - if(livingrockItem.stackSize == 0) - livingrock.setDead(); - } + for(int i = 0; i < getSizeInventory(); i++) + setInventorySlotContents(i, null); - craftingFanciness(); - } - } + if(!worldObj.isRemote) { + ItemStack livingrockItem = livingrock.getEntityItem(); + livingrockItem.stackSize--; + if(livingrockItem.stackSize == 0) livingrock.setDead(); + } - updateRecipe(); - } + craftingFanciness(); + } + } - public void craftingFanciness() { - worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.levelup", 1F, 1F); - for(int i = 0; i < 25; i++) { - float red = (float) Math.random(); - float green = (float) Math.random(); - float blue = (float) Math.random(); - Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10); - } - } + updateRecipe(); + } - @Override - public void writeCustomNBT(NBTTagCompound par1nbtTagCompound) { - super.writeCustomNBT(par1nbtTagCompound); + public void craftingFanciness() { + worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.levelup", 1F, 1F); + for(int i = 0; i < 25; i++) { + float red = (float) Math.random(); + float green = (float) Math.random(); + float blue = (float) Math.random(); + Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10); + } + } - par1nbtTagCompound.setInteger(TAG_MANA, mana); - } + @Override + public void writeCustomNBT(NBTTagCompound par1nbtTagCompound) { + super.writeCustomNBT(par1nbtTagCompound); - @Override - public void readCustomNBT(NBTTagCompound par1nbtTagCompound) { - super.readCustomNBT(par1nbtTagCompound); + par1nbtTagCompound.setInteger(TAG_MANA, mana); + } - mana = par1nbtTagCompound.getInteger(TAG_MANA); - } + @Override + public void readCustomNBT(NBTTagCompound par1nbtTagCompound) { + super.readCustomNBT(par1nbtTagCompound); - @Override - public int getSizeInventory() { - return 16; - } + mana = par1nbtTagCompound.getInteger(TAG_MANA); + } - @Override - public String getInventoryName() { - return LibBlockNames.RUNE_ALTAR; - } + @Override + public int getSizeInventory() { + return 16; + } - @Override - public int getInventoryStackLimit() { - return 1; - } + @Override + public String getInventoryName() { + return LibBlockNames.RUNE_ALTAR; + } - @Override - public int[] getAccessibleSlotsFromSide(int var1) { - int accessibleSlot = -1; - for(int i = 0; i < getSizeInventory(); i++) - if(getStackInSlot(i) != null) - accessibleSlot = i; + @Override + public int getInventoryStackLimit() { + return 1; + } - return accessibleSlot == -1 ? new int[0] : new int[] { accessibleSlot }; - } + @Override + public int[] getAccessibleSlotsFromSide(int var1) { + int accessibleSlot = -1; + for(int i = 0; i < getSizeInventory(); i++) + if(getStackInSlot(i) != null) accessibleSlot = i; - @Override - public boolean canInsertItem(int i, ItemStack itemstack, int j) { - return true; - } + return accessibleSlot == -1 ? new int[0] : new int[]{accessibleSlot}; + } - @Override - public boolean canExtractItem(int i, ItemStack itemstack, int j) { - return false; - } + @Override + public boolean canInsertItem(int i, ItemStack itemstack, int j) { + return true; + } - @Override - public int getCurrentMana() { - return mana; - } + @Override + public boolean canExtractItem(int i, ItemStack itemstack, int j) { + return false; + } - @Override - public boolean isFull() { - return mana >= manaToGet; - } + @Override + public int getCurrentMana() { + return mana; + } - @Override - public void recieveMana(int mana) { - this.mana = Math.min(this.mana + mana, manaToGet); - } + @Override + public boolean isFull() { + return mana >= manaToGet; + } - @Override - public boolean canRecieveManaFromBursts() { - return !isFull(); - } + @Override + public void recieveMana(int mana) { + this.mana = Math.min(this.mana + mana, manaToGet); + } - public int getTargetMana() { - return manaToGet; - } + @Override + public boolean canRecieveManaFromBursts() { + return !isFull(); + } + + public int getTargetMana() { + return manaToGet; + } } diff --git a/MODSRC/vazkii/botania/common/block/tile/TileSimpleInventory.java b/MODSRC/vazkii/botania/common/block/tile/TileSimpleInventory.java index 5ed12d885..431e7e623 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TileSimpleInventory.java +++ b/MODSRC/vazkii/botania/common/block/tile/TileSimpleInventory.java @@ -2,11 +2,11 @@ * This class was created by . 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 21, 2014, 9:56:24 PM (GMT)] */ package vazkii.botania.common.block.tile; @@ -19,98 +19,96 @@ import net.minecraft.nbt.NBTTagList; public abstract class TileSimpleInventory extends TileMod implements IInventory { - ItemStack[] inventorySlots = new ItemStack[getSizeInventory()]; + ItemStack[] inventorySlots = new ItemStack[getSizeInventory()]; - @Override - public void readCustomNBT(NBTTagCompound par1NBTTagCompound) { - NBTTagList var2 = par1NBTTagCompound.getTagList("Items", 10); - inventorySlots = new ItemStack[getSizeInventory()]; - for (int var3 = 0; var3 < var2.tagCount(); ++var3) { - NBTTagCompound var4 = (NBTTagCompound) var2.getCompoundTagAt(var3); - byte var5 = var4.getByte("Slot"); - if (var5 >= 0 && var5 < inventorySlots.length) - inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4); - } - } + @Override + public void readCustomNBT(NBTTagCompound par1NBTTagCompound) { + NBTTagList var2 = par1NBTTagCompound.getTagList("Items", 10); + inventorySlots = new ItemStack[getSizeInventory()]; + for(int var3 = 0; var3 < var2.tagCount(); ++var3) { + NBTTagCompound var4 = (NBTTagCompound) var2.getCompoundTagAt(var3); + byte var5 = var4.getByte("Slot"); + if(var5 >= 0 && var5 < inventorySlots.length) inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4); + } + } - @Override - public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) { - NBTTagList var2 = new NBTTagList(); - for (int var3 = 0; var3 < inventorySlots.length; ++var3) { - if (inventorySlots[var3] != null) { - NBTTagCompound var4 = new NBTTagCompound(); - var4.setByte("Slot", (byte)var3); - inventorySlots[var3].writeToNBT(var4); - var2.appendTag(var4); - } - } - par1NBTTagCompound.setTag("Items", var2); - } + @Override + public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) { + NBTTagList var2 = new NBTTagList(); + for(int var3 = 0; var3 < inventorySlots.length; ++var3) { + if(inventorySlots[var3] != null) { + NBTTagCompound var4 = new NBTTagCompound(); + var4.setByte("Slot", (byte) var3); + inventorySlots[var3].writeToNBT(var4); + var2.appendTag(var4); + } + } + par1NBTTagCompound.setTag("Items", var2); + } - @Override - public ItemStack getStackInSlot(int i) { - return inventorySlots[i]; - } + @Override + public ItemStack getStackInSlot(int i) { + return inventorySlots[i]; + } - @Override - public ItemStack decrStackSize(int i, int j) { - if (inventorySlots[i] != null) { - ItemStack stackAt; + @Override + public ItemStack decrStackSize(int i, int j) { + if(inventorySlots[i] != null) { + ItemStack stackAt; - if (inventorySlots[i].stackSize <= j) { - stackAt = inventorySlots[i]; - inventorySlots[i] = null; - return stackAt; - } else { - stackAt = inventorySlots[i].splitStack(j); + if(inventorySlots[i].stackSize <= j) { + stackAt = inventorySlots[i]; + inventorySlots[i] = null; + return stackAt; + } else { + stackAt = inventorySlots[i].splitStack(j); - if (inventorySlots[i].stackSize == 0) - inventorySlots[i] = null; + if(inventorySlots[i].stackSize == 0) inventorySlots[i] = null; - return stackAt; - } - } + return stackAt; + } + } - return null; - } + return null; + } - @Override - public ItemStack getStackInSlotOnClosing(int i) { - return getStackInSlot(i); - } + @Override + public ItemStack getStackInSlotOnClosing(int i) { + return getStackInSlot(i); + } - @Override - public void setInventorySlotContents(int i, ItemStack itemstack) { - inventorySlots[i] = itemstack; - } + @Override + public void setInventorySlotContents(int i, ItemStack itemstack) { + inventorySlots[i] = itemstack; + } - @Override - public int getInventoryStackLimit() { - return 64; - } + @Override + public int getInventoryStackLimit() { + return 64; + } - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) { - return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64; - } + @Override + public boolean isUseableByPlayer(EntityPlayer entityplayer) { + return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64; + } - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return true; - } + @Override + public boolean isItemValidForSlot(int i, ItemStack itemstack) { + return true; + } - @Override - public boolean hasCustomInventoryName() { - return false; - } + @Override + public boolean hasCustomInventoryName() { + return false; + } - @Override - public void openInventory() { - // NO-OP - } + @Override + public void openInventory() { + // NO-OP + } - @Override - public void closeInventory() { - // NO-OP - } + @Override + public void closeInventory() { + // NO-OP + } } diff --git a/MODSRC/vazkii/botania/common/block/tile/TileSpecialFlower.java b/MODSRC/vazkii/botania/common/block/tile/TileSpecialFlower.java index 323f9c24d..c24b504fa 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TileSpecialFlower.java +++ b/MODSRC/vazkii/botania/common/block/tile/TileSpecialFlower.java @@ -2,16 +2,15 @@ * This class was created by . 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 22, 2014, 7:21:51 PM (GMT)] */ package vazkii.botania.common.block.tile; -import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.player.EntityPlayer; @@ -27,89 +26,86 @@ import vazkii.botania.api.subtile.SubTileEntity; public class TileSpecialFlower extends TileMod implements ITileBound { - private static final String TAG_SUBTILE_NAME = "subTileName"; - private static final String TAG_SUBTILE_CMP = "subTileCmp"; + private static final String TAG_SUBTILE_NAME = "subTileName"; + private static final String TAG_SUBTILE_CMP = "subTileCmp"; - public String subTileName = ""; - SubTileEntity subTile; + public String subTileName = ""; + SubTileEntity subTile; - public void setSubTile(String name) { - subTileName = name; - provideSubTile(subTileName); - } + public void setSubTile(String name) { + subTileName = name; + provideSubTile(subTileName); + } - public void setSubTile(SubTileEntity tile) { - subTile = tile; - subTile.setSupertile(this); - } + public void setSubTile(SubTileEntity tile) { + subTile = tile; + subTile.setSupertile(this); + } - private void provideSubTile(String name) { - subTileName = name; + private void provideSubTile(String name) { + subTileName = name; - Class tileClass = BotaniaAPI.getSubTileMapping(name); - try { - SubTileEntity tile = tileClass.newInstance(); - setSubTile(tile); - } catch (Exception e) { - e.printStackTrace(); - } - } + Class tileClass = BotaniaAPI.getSubTileMapping(name); + try { + SubTileEntity tile = tileClass.newInstance(); + setSubTile(tile); + } catch(Exception e) { + e.printStackTrace(); + } + } - @Override - public void updateEntity() { - if(subTile != null) - subTile.onUpdate(); - } + @Override + public void updateEntity() { + if(subTile != null) subTile.onUpdate(); + } - @Override - public boolean canUpdate() { - return subTile == null || subTile.canUpdate(); - } + @Override + public boolean canUpdate() { + return subTile == null || subTile.canUpdate(); + } - @Override - public void writeCustomNBT(NBTTagCompound cmp) { - super.writeCustomNBT(cmp); + @Override + public void writeCustomNBT(NBTTagCompound cmp) { + super.writeCustomNBT(cmp); - cmp.setString(TAG_SUBTILE_NAME, subTileName); - NBTTagCompound subCmp = new NBTTagCompound(); - cmp.setTag(TAG_SUBTILE_CMP, subCmp); - subTile.writeToPacketNBT(subCmp); - } + cmp.setString(TAG_SUBTILE_NAME, subTileName); + NBTTagCompound subCmp = new NBTTagCompound(); + cmp.setTag(TAG_SUBTILE_CMP, subCmp); + subTile.writeToPacketNBT(subCmp); + } - @Override - public void readCustomNBT(NBTTagCompound cmp) { - super.readCustomNBT(cmp); + @Override + public void readCustomNBT(NBTTagCompound cmp) { + super.readCustomNBT(cmp); - subTileName = cmp.getString(TAG_SUBTILE_NAME); - NBTTagCompound subCmp = cmp.getCompoundTag(TAG_SUBTILE_CMP); + subTileName = cmp.getString(TAG_SUBTILE_NAME); + NBTTagCompound subCmp = cmp.getCompoundTag(TAG_SUBTILE_CMP); - if(subTile == null || !BotaniaAPI.getSubTileStringMapping(subTile.getClass()).equals(subTileName)) - provideSubTile(subTileName); + if(subTile == null || !BotaniaAPI.getSubTileStringMapping(subTile.getClass()).equals(subTileName)) + provideSubTile(subTileName); - subTile.readFromPacketNBT(subCmp); - } + subTile.readFromPacketNBT(subCmp); + } - public IIcon getIcon() { - return subTile == null ? Blocks.red_flower.getIcon(0, 0) : subTile.getIcon(); - } + public IIcon getIcon() { + return subTile == null ? Blocks.red_flower.getIcon(0, 0) : subTile.getIcon(); + } - public LexiconEntry getEntry() { - return subTile.getEntry(); - } + public LexiconEntry getEntry() { + return subTile.getEntry(); + } - public boolean onWanded(ItemStack wand, EntityPlayer player) { - return subTile.onWanded(player, wand); - } + public boolean onWanded(ItemStack wand, EntityPlayer player) { + return subTile.onWanded(player, wand); + } - public void renderHUD(Minecraft mc, ScaledResolution res) { - if(subTile != null) - subTile.renderHUD(mc, res); - } + public void renderHUD(Minecraft mc, ScaledResolution res) { + if(subTile != null) subTile.renderHUD(mc, res); + } - @Override - public ChunkCoordinates getBinding() { - if(subTile == null) - return null; - return subTile.getBinding(); - } + @Override + public ChunkCoordinates getBinding() { + if(subTile == null) return null; + return subTile.getBinding(); + } } diff --git a/MODSRC/vazkii/botania/common/block/tile/TileSpiritShrine.java b/MODSRC/vazkii/botania/common/block/tile/TileSpiritShrine.java index cfcdd336b..7033cc211 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TileSpiritShrine.java +++ b/MODSRC/vazkii/botania/common/block/tile/TileSpiritShrine.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Apr 1, 2014, 1:55:57 PM (GMT)] */ package vazkii.botania.common.block.tile; @@ -15,49 +15,42 @@ import vazkii.botania.common.Botania; public class TileSpiritShrine extends TileMod { - int ticks; - - @Override - public void updateEntity() { - if(worldObj.isRemote) { - if(ticks >= 40) { - float[][] colors = new float[][] { - { 0F, 0.25F, 1F }, - { 1F, 0F, 0.2F }, - { 0F, 1F, 0.25F }, - { 1F, 1F, 0.25F }, - { 1F, 0.25F, 1F }, - { 0.25F, 1F, 1F } - }; - - int totalSpiritCount = 6; - double tickIncrement = 360D / totalSpiritCount; - - int liftTicks = 40 * (totalSpiritCount + 1); - int existTicks = liftTicks * 2; - int lowerTicks = existTicks + liftTicks; - - if(ticks < lowerTicks) { - int speed = 5; - double wticks = ticks * speed - tickIncrement; - double r = Math.sin((ticks >= liftTicks ? (ticks - liftTicks) * speed - tickIncrement : -tickIncrement) * Math.PI / 180 * 0.75) + 1 * 1.25 + 0.5; - double g = Math.sin(wticks * Math.PI / 180 * 0.55); + int ticks; - for(int i = 0; i < totalSpiritCount; i++) { - double x = xCoord + Math.sin(wticks * Math.PI / 180) * r + 0.5; - double y = yCoord + ((ticks > existTicks ? 40 - (double) (ticks - existTicks) : Math.min(80 + 40 * i, ticks) - 40 * (i + 1)) * 0.1); - double z = zCoord + Math.cos(wticks * Math.PI / 180) * r + 0.5; + @Override + public void updateEntity() { + if(worldObj.isRemote) { + if(ticks >= 40) { + float[][] colors = new float[][]{{0F, 0.25F, 1F}, {1F, 0F, 0.2F}, {0F, 1F, 0.25F}, {1F, 1F, 0.25F}, {1F, 0.25F, 1F}, {0.25F, 1F, 1F}}; + + int totalSpiritCount = 6; + double tickIncrement = 360D / totalSpiritCount; + + int liftTicks = 40 * (totalSpiritCount + 1); + int existTicks = liftTicks * 2; + int lowerTicks = existTicks + liftTicks; + + if(ticks < lowerTicks) { + int speed = 5; + double wticks = ticks * speed - tickIncrement; + double r = Math.sin((ticks >= liftTicks ? (ticks - liftTicks) * speed - tickIncrement : -tickIncrement) * Math.PI / 180 * 0.75) + 1 * 1.25 + 0.5; + double g = Math.sin(wticks * Math.PI / 180 * 0.55); + + for(int i = 0; i < totalSpiritCount; i++) { + double x = xCoord + Math.sin(wticks * Math.PI / 180) * r + 0.5; + double y = yCoord + ((ticks > existTicks ? 40 - (double) (ticks - existTicks) : Math.min(80 + 40 * i, ticks) - 40 * (i + 1)) * 0.1); + double z = zCoord + Math.cos(wticks * Math.PI / 180) * r + 0.5; + + wticks += tickIncrement; + float[] colorsfx = colors[i >= colors.length ? 0 : i]; + Botania.proxy.wispFX(worldObj, x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F, (float) g * 0.05F, 0.25F); + Botania.proxy.wispFX(worldObj, x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.1F + 0.1F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, 0.9F); + } + } + } + + ++ticks; + } + } - wticks += tickIncrement; - float[] colorsfx = colors[i >= colors.length ? 0 : i]; - Botania.proxy.wispFX(worldObj, x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F, (float)g * 0.05F, 0.25F); - Botania.proxy.wispFX(worldObj, x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.1F + 0.1F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, 0.9F); - } - } - } - - ++ticks; - } - } - } diff --git a/MODSRC/vazkii/botania/common/block/tile/TileSpreader.java b/MODSRC/vazkii/botania/common/block/tile/TileSpreader.java index dc11a6683..4a951596e 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TileSpreader.java +++ b/MODSRC/vazkii/botania/common/block/tile/TileSpreader.java @@ -2,17 +2,15 @@ * This class was created by . 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 25, 2014, 9:40:57 PM (GMT)] */ package vazkii.botania.common.block.tile; -import java.util.List; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.entity.RenderItem; @@ -23,24 +21,13 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.StatCollector; -import net.minecraft.util.Vec3; +import net.minecraft.util.*; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; - import org.lwjgl.opengl.GL11; - import vazkii.botania.api.ITileBound; import vazkii.botania.api.internal.IManaBurst; -import vazkii.botania.api.mana.BurstProperties; -import vazkii.botania.api.mana.ILens; -import vazkii.botania.api.mana.IManaCollector; -import vazkii.botania.api.mana.IManaPool; -import vazkii.botania.api.mana.IManaReceiver; -import vazkii.botania.api.mana.ManaNetworkEvent; +import vazkii.botania.api.mana.*; import vazkii.botania.client.core.handler.HUDHandler; import vazkii.botania.common.block.ModBlocks; import vazkii.botania.common.core.helper.Vector3; @@ -48,361 +35,349 @@ import vazkii.botania.common.entity.EntityManaBurst; import vazkii.botania.common.entity.EntityManaBurst.PositionProperties; import vazkii.botania.common.lib.LibBlockNames; +import java.util.List; + public class TileSpreader extends TileSimpleInventory implements IManaCollector, ITileBound { - private static final int MAX_MANA = 1000; - private static final String TAG_MANA = "mana"; - private static final String TAG_KNOWN_MANA = "knownMana"; - private static final String TAG_REQUEST_UPDATE = "requestUpdate"; - private static final String TAG_ROTATION_X = "rotationX"; - private static final String TAG_ROTATION_Y = "rotationY"; + private static final int MAX_MANA = 1000; + private static final String TAG_MANA = "mana"; + private static final String TAG_KNOWN_MANA = "knownMana"; + private static final String TAG_REQUEST_UPDATE = "requestUpdate"; + private static final String TAG_ROTATION_X = "rotationX"; + private static final String TAG_ROTATION_Y = "rotationY"; - public static boolean staticRedstone = false; - - int mana; - int knownMana = -1; - public float rotationX, rotationY; - boolean added = false; - boolean requestsClientUpdate = false; - boolean hasReceivedInitialPacket = false; + public static boolean staticRedstone = false; - IManaReceiver receiver = null; + int mana; + int knownMana = -1; + public float rotationX, rotationY; + boolean added = false; + boolean requestsClientUpdate = false; + boolean hasReceivedInitialPacket = false; - boolean redstoneLastTick = false; - public boolean canShootBurst = true; - public int lastBurstDeathTick = -1; - public int burstParticleTick = 0; + IManaReceiver receiver = null; - List lastTentativeBurst; - - @Override - public boolean isFull() { - return mana >= MAX_MANA; - } + boolean redstoneLastTick = false; + public boolean canShootBurst = true; + public int lastBurstDeathTick = -1; + public int burstParticleTick = 0; - @Override - public void recieveMana(int mana) { - this.mana = Math.min(this.mana + mana, MAX_MANA); - } + List lastTentativeBurst; - @Override - public void invalidate() { - super.invalidate(); - ManaNetworkEvent.removeCollector(this); - } + @Override + public boolean isFull() { + return mana >= MAX_MANA; + } - @Override - public void onChunkUnload() { - super.onChunkUnload(); - ManaNetworkEvent.removeCollector(this); - } + @Override + public void recieveMana(int mana) { + this.mana = Math.min(this.mana + mana, MAX_MANA); + } - @Override - public void updateEntity() { - if(!added) { - ManaNetworkEvent.addCollector(this); - added = true; - } + @Override + public void invalidate() { + super.invalidate(); + ManaNetworkEvent.removeCollector(this); + } - boolean redstone = false; + @Override + public void onChunkUnload() { + super.onChunkUnload(); + ManaNetworkEvent.removeCollector(this); + } - for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - TileEntity tileAt = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ); - if(tileAt instanceof IManaPool) { - IManaPool pool = (IManaPool) tileAt; - int manaInPool = pool.getCurrentMana(); - if(manaInPool > 0 && !isFull()) { - int manaMissing = MAX_MANA - mana; - int manaToRemove = Math.min(manaInPool, manaMissing); - pool.recieveMana(-manaToRemove); - recieveMana(manaToRemove); - } - } + @Override + public void updateEntity() { + if(!added) { + ManaNetworkEvent.addCollector(this); + added = true; + } - int redstoneSide = worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal()); - if(redstoneSide > 0) - redstone = true; - } + boolean redstone = false; - if(needsNewBurstSimulation()) - checkForReceiver(); + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + TileEntity tileAt = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ); + if(tileAt instanceof IManaPool) { + IManaPool pool = (IManaPool) tileAt; + int manaInPool = pool.getCurrentMana(); + if(manaInPool > 0 && !isFull()) { + int manaMissing = MAX_MANA - mana; + int manaToRemove = Math.min(manaInPool, manaMissing); + pool.recieveMana(-manaToRemove); + recieveMana(manaToRemove); + } + } - boolean shouldShoot = !redstone; - - if(isRedstone()) - shouldShoot = redstone && !redstoneLastTick; - - if(shouldShoot) - tryShootBurst(); - - redstoneLastTick = redstone; - } + int redstoneSide = worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal()); + if(redstoneSide > 0) redstone = true; + } - @Override - public void writeCustomNBT(NBTTagCompound cmp) { - super.writeCustomNBT(cmp); - cmp.setInteger(TAG_MANA, mana); - cmp.setFloat(TAG_ROTATION_X, rotationX); - cmp.setFloat(TAG_ROTATION_Y, rotationY); - cmp.setBoolean(TAG_REQUEST_UPDATE, requestsClientUpdate); - requestsClientUpdate = false; - } + if(needsNewBurstSimulation()) checkForReceiver(); - @Override - public void readCustomNBT(NBTTagCompound cmp) { - super.readCustomNBT(cmp); - mana = cmp.getInteger(TAG_MANA); - rotationX = cmp.getFloat(TAG_ROTATION_X); - rotationY = cmp.getFloat(TAG_ROTATION_Y); - requestsClientUpdate = cmp.getBoolean(TAG_REQUEST_UPDATE); + boolean shouldShoot = !redstone; - if(cmp.hasKey(TAG_KNOWN_MANA)) - knownMana = cmp.getInteger(TAG_KNOWN_MANA); - - if(worldObj != null && worldObj.isRemote) - hasReceivedInitialPacket = true; - } + if(isRedstone()) shouldShoot = redstone && !redstoneLastTick; - @Override - public boolean canRecieveManaFromBursts() { - return !isFull(); - } + if(shouldShoot) tryShootBurst(); - @Override - public int getCurrentMana() { - return mana; - } + redstoneLastTick = redstone; + } - public void onWanded(EntityPlayer player, ItemStack wand) { - if(!player.isSneaking()) { - if(!worldObj.isRemote) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); - writeCustomNBT(nbttagcompound); - nbttagcompound.setInteger(TAG_KNOWN_MANA, mana); - if(player instanceof EntityPlayerMP) - ((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound)); - } - worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 1F); - } else { - MovingObjectPosition pos = raytraceFromEntity(worldObj, player, true, 5); - if(pos != null && pos.hitVec != null && !worldObj.isRemote) { - double x = pos.hitVec.xCoord - xCoord - 0.5; - double y = pos.hitVec.yCoord - yCoord - 0.5; - double z = pos.hitVec.zCoord - zCoord - 0.5; + @Override + public void writeCustomNBT(NBTTagCompound cmp) { + super.writeCustomNBT(cmp); + cmp.setInteger(TAG_MANA, mana); + cmp.setFloat(TAG_ROTATION_X, rotationX); + cmp.setFloat(TAG_ROTATION_Y, rotationY); + cmp.setBoolean(TAG_REQUEST_UPDATE, requestsClientUpdate); + requestsClientUpdate = false; + } - if(pos.sideHit != 0 && pos.sideHit != 1) { - Vector3 clickVector = new Vector3(x, 0, z); - Vector3 relative = new Vector3(-0.5, 0, 0); - double angle = Math.acos(clickVector.dotProduct(relative) / (relative.mag() * clickVector.mag())) * 180D / Math.PI; + @Override + public void readCustomNBT(NBTTagCompound cmp) { + super.readCustomNBT(cmp); + mana = cmp.getInteger(TAG_MANA); + rotationX = cmp.getFloat(TAG_ROTATION_X); + rotationY = cmp.getFloat(TAG_ROTATION_Y); + requestsClientUpdate = cmp.getBoolean(TAG_REQUEST_UPDATE); - rotationX = (float) angle + 180F; - if(clickVector.z < 0) - rotationX = 360 - rotationX; - } + if(cmp.hasKey(TAG_KNOWN_MANA)) knownMana = cmp.getInteger(TAG_KNOWN_MANA); - double angle = y * 180; - rotationY = -(float) angle; + if(worldObj != null && worldObj.isRemote) hasReceivedInitialPacket = true; + } - checkForReceiver(); - requestsClientUpdate = true; - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } - } - } + @Override + public boolean canRecieveManaFromBursts() { + return !isFull(); + } - private boolean needsNewBurstSimulation() { - if(worldObj.isRemote && !hasReceivedInitialPacket) - return false; - - if(lastTentativeBurst == null) - return true; + @Override + public int getCurrentMana() { + return mana; + } - if(requestsClientUpdate) { - requestsClientUpdate = false; - return true; - } + public void onWanded(EntityPlayer player, ItemStack wand) { + if(!player.isSneaking()) { + if(!worldObj.isRemote) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + writeCustomNBT(nbttagcompound); + nbttagcompound.setInteger(TAG_KNOWN_MANA, mana); + if(player instanceof EntityPlayerMP) + ((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound)); + } + worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 1F); + } else { + MovingObjectPosition pos = raytraceFromEntity(worldObj, player, true, 5); + if(pos != null && pos.hitVec != null && !worldObj.isRemote) { + double x = pos.hitVec.xCoord - xCoord - 0.5; + double y = pos.hitVec.yCoord - yCoord - 0.5; + double z = pos.hitVec.zCoord - zCoord - 0.5; - for(PositionProperties props : lastTentativeBurst) - if(!props.contentsEqual(worldObj)) - return true; + if(pos.sideHit != 0 && pos.sideHit != 1) { + Vector3 clickVector = new Vector3(x, 0, z); + Vector3 relative = new Vector3(-0.5, 0, 0); + double angle = Math.acos(clickVector.dotProduct(relative) / (relative.mag() * clickVector.mag())) * 180D / Math.PI; - return false; - } + rotationX = (float) angle + 180F; + if(clickVector.z < 0) rotationX = 360 - rotationX; + } - public void tryShootBurst() { - if(receiver != null || isRedstone()) { - if(canShootBurst && (isRedstone() || (receiver.canRecieveManaFromBursts() && !receiver.isFull()))) { - EntityManaBurst burst = getBurst(false); - if(burst != null) { - if(!worldObj.isRemote) { - mana -= burst.getStartingMana(); - worldObj.spawnEntityInWorld(burst); - } + double angle = y * 180; + rotationY = -(float) angle; - canShootBurst = false; - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } - } - } - } - - public boolean isRedstone() { - return worldObj == null ? staticRedstone : (getBlockMetadata() & 1) == 1; - } + checkForReceiver(); + requestsClientUpdate = true; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + } + } - public void checkForReceiver() { - EntityManaBurst fakeBurst = getBurst(true); - fakeBurst.setScanBeam(); - TileEntity receiver = fakeBurst.getCollidedTile(true); + private boolean needsNewBurstSimulation() { + if(worldObj.isRemote && !hasReceivedInitialPacket) return false; - if(receiver != null && receiver instanceof IManaReceiver) - this.receiver = (IManaReceiver) receiver; - else this.receiver = null; - lastTentativeBurst = fakeBurst.propsList; - } + if(lastTentativeBurst == null) return true; - public EntityManaBurst getBurst(boolean fake) { - EntityManaBurst burst = new EntityManaBurst(this, fake); + if(requestsClientUpdate) { + requestsClientUpdate = false; + return true; + } - int maxMana = 160; - int color = isRedstone() ? 0xFF2020 : 0x20FF20; - int ticksBeforeManaLoss = 60; - float manaLossPerTick = 4F; - float motionModifier = 1F; - float gravity = 0F; - BurstProperties props = new BurstProperties(maxMana, ticksBeforeManaLoss, manaLossPerTick, gravity, motionModifier, color); + for(PositionProperties props : lastTentativeBurst) + if(!props.contentsEqual(worldObj)) return true; - ItemStack lens = getStackInSlot(0); - if(lens != null) - ((ILens) lens.getItem()).apply(lens, props); + return false; + } - burst.setSourceLens(lens); - if(getCurrentMana() >= props.maxMana || fake) { - burst.setColor(props.color); - burst.setMana(props.maxMana); - burst.setStartingMana(props.maxMana); - burst.setMinManaLoss(props.ticksBeforeManaLoss); - burst.setManaLossPerTick(props.manaLossPerTick); - burst.setGravity(props.gravity); - burst.setMotion(burst.motionX * props.motionModifier, burst.motionY * props.motionModifier, burst.motionZ * props.motionModifier); + public void tryShootBurst() { + if(receiver != null || isRedstone()) { + if(canShootBurst && (isRedstone() || (receiver.canRecieveManaFromBursts() && !receiver.isFull()))) { + EntityManaBurst burst = getBurst(false); + if(burst != null) { + if(!worldObj.isRemote) { + mana -= burst.getStartingMana(); + worldObj.spawnEntityInWorld(burst); + } - return burst; - } - return null; - } + canShootBurst = false; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + } + } + } - public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range) { - float f = 1.0F; - float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f; - float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f; - double d0 = player.prevPosX + (player.posX - player.prevPosX) * f; - double d1 = player.prevPosY + (player.posY - player.prevPosY) * f; - if (!world.isRemote && player instanceof EntityPlayer) - d1 += 1.62D; - double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * f; - Vec3 vec3 = world.getWorldVec3Pool().getVecFromPool(d0, d1, d2); - float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI); - float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI); - float f5 = -MathHelper.cos(-f1 * 0.017453292F); - float f6 = MathHelper.sin(-f1 * 0.017453292F); - float f7 = f4 * f5; - float f8 = f3 * f5; - double d3 = range; - if (player instanceof EntityPlayerMP) - d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance(); - Vec3 vec31 = vec3.addVector(f7 * d3, f6 * d3, f8 * d3); - return world.func_147447_a(vec3, vec31, par3, !par3, par3); - } + public boolean isRedstone() { + return worldObj == null ? staticRedstone : (getBlockMetadata() & 1) == 1; + } - public void renderHUD(Minecraft mc, ScaledResolution res) { - String name = StatCollector.translateToLocal(new ItemStack(ModBlocks.spreader, 1, getBlockMetadata()).getUnlocalizedName() + ".name"); - int color = isRedstone() ? 0x66FF0000 : 0x6600FF00; - HUDHandler.drawSimpleManaHUD(color, knownMana, MAX_MANA, name, res); + public void checkForReceiver() { + EntityManaBurst fakeBurst = getBurst(true); + fakeBurst.setScanBeam(); + TileEntity receiver = fakeBurst.getCollidedTile(true); - ItemStack lens = getStackInSlot(0); - if(lens != null) { - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - String lensName = lens.getDisplayName(); - int width = 16 + mc.fontRenderer.getStringWidth(lensName) / 2; - int x = res.getScaledWidth() / 2 - width; - int y = res.getScaledHeight() / 2 + 50; + if(receiver != null && receiver instanceof IManaReceiver) this.receiver = (IManaReceiver) receiver; + else this.receiver = null; + lastTentativeBurst = fakeBurst.propsList; + } - mc.fontRenderer.drawStringWithShadow(lensName, x + 20, y + 5, color); - GL11.glDisable(GL11.GL_DEPTH_TEST); - new RenderItem().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, lens, x, y); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_BLEND); - } + public EntityManaBurst getBurst(boolean fake) { + EntityManaBurst burst = new EntityManaBurst(this, fake); - if(receiver != null) { - TileEntity receiverTile = (TileEntity) receiver; - ItemStack recieverStack = new ItemStack(worldObj.getBlock(receiverTile.xCoord, receiverTile.yCoord, receiverTile.zCoord), 1, receiverTile.getBlockMetadata()); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - if(recieverStack != null && recieverStack.getItem() != null) { - String stackName = recieverStack.getDisplayName(); - int width = 16 + mc.fontRenderer.getStringWidth(stackName) / 2; - int x = res.getScaledWidth() / 2 - width; - int y = res.getScaledHeight() / 2 + 30; + int maxMana = 160; + int color = isRedstone() ? 0xFF2020 : 0x20FF20; + int ticksBeforeManaLoss = 60; + float manaLossPerTick = 4F; + float motionModifier = 1F; + float gravity = 0F; + BurstProperties props = new BurstProperties(maxMana, ticksBeforeManaLoss, manaLossPerTick, gravity, motionModifier, color); - mc.fontRenderer.drawStringWithShadow(stackName, x + 20, y + 5, color); - new RenderItem().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, recieverStack, x, y); - } + ItemStack lens = getStackInSlot(0); + if(lens != null) ((ILens) lens.getItem()).apply(lens, props); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_BLEND); - } + burst.setSourceLens(lens); + if(getCurrentMana() >= props.maxMana || fake) { + burst.setColor(props.color); + burst.setMana(props.maxMana); + burst.setStartingMana(props.maxMana); + burst.setMinManaLoss(props.ticksBeforeManaLoss); + burst.setManaLossPerTick(props.manaLossPerTick); + burst.setGravity(props.gravity); + burst.setMotion(burst.motionX * props.motionModifier, burst.motionY * props.motionModifier, burst.motionZ * props.motionModifier); - GL11.glColor4f(1F, 1F, 1F, 1F); - } + return burst; + } + return null; + } - @Override - public void onClientDisplayTick() { - if(worldObj != null) { - EntityManaBurst burst = getBurst(true); - burst.getCollidedTile(false); - } - } + public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range) { + float f = 1.0F; + float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f; + float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f; + double d0 = player.prevPosX + (player.posX - player.prevPosX) * f; + double d1 = player.prevPosY + (player.posY - player.prevPosY) * f; + if(!world.isRemote && player instanceof EntityPlayer) d1 += 1.62D; + double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * f; + Vec3 vec3 = world.getWorldVec3Pool().getVecFromPool(d0, d1, d2); + float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI); + float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI); + float f5 = -MathHelper.cos(-f1 * 0.017453292F); + float f6 = MathHelper.sin(-f1 * 0.017453292F); + float f7 = f4 * f5; + float f8 = f3 * f5; + double d3 = range; + if(player instanceof EntityPlayerMP) + d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance(); + Vec3 vec31 = vec3.addVector(f7 * d3, f6 * d3, f8 * d3); + return world.func_147447_a(vec3, vec31, par3, !par3, par3); + } - @Override - public float getManaYieldMultiplier(IManaBurst burst) { - return burst.getMana() < 16 ? 0F : 0.95F; - } + public void renderHUD(Minecraft mc, ScaledResolution res) { + String name = StatCollector.translateToLocal(new ItemStack(ModBlocks.spreader, 1, getBlockMetadata()).getUnlocalizedName() + ".name"); + int color = isRedstone() ? 0x66FF0000 : 0x6600FF00; + HUDHandler.drawSimpleManaHUD(color, knownMana, MAX_MANA, name, res); - @Override - public int getSizeInventory() { - return 1; - } + ItemStack lens = getStackInSlot(0); + if(lens != null) { + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + String lensName = lens.getDisplayName(); + int width = 16 + mc.fontRenderer.getStringWidth(lensName) / 2; + int x = res.getScaledWidth() / 2 - width; + int y = res.getScaledHeight() / 2 + 50; - @Override - public String getInventoryName() { - return LibBlockNames.SPREADER; - } + mc.fontRenderer.drawStringWithShadow(lensName, x + 20, y + 5, color); + GL11.glDisable(GL11.GL_DEPTH_TEST); + new RenderItem().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, lens, x, y); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_BLEND); + } - @Override - public int getInventoryStackLimit() { - return 1; - } + if(receiver != null) { + TileEntity receiverTile = (TileEntity) receiver; + ItemStack recieverStack = new ItemStack(worldObj.getBlock(receiverTile.xCoord, receiverTile.yCoord, receiverTile.zCoord), 1, receiverTile.getBlockMetadata()); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + if(recieverStack != null && recieverStack.getItem() != null) { + String stackName = recieverStack.getDisplayName(); + int width = 16 + mc.fontRenderer.getStringWidth(stackName) / 2; + int x = res.getScaledWidth() / 2 - width; + int y = res.getScaledHeight() / 2 + 30; - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return itemstack.getItem() instanceof ILens; - } + mc.fontRenderer.drawStringWithShadow(stackName, x + 20, y + 5, color); + new RenderItem().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, recieverStack, x, y); + } - @Override - public void markDirty() { - checkForReceiver(); - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_BLEND); + } - @Override - public ChunkCoordinates getBinding() { - if(receiver == null) - return null; + GL11.glColor4f(1F, 1F, 1F, 1F); + } - TileEntity tile = (TileEntity) receiver; - return new ChunkCoordinates(tile.xCoord, tile.yCoord, tile.zCoord); - } + @Override + public void onClientDisplayTick() { + if(worldObj != null) { + EntityManaBurst burst = getBurst(true); + burst.getCollidedTile(false); + } + } + + @Override + public float getManaYieldMultiplier(IManaBurst burst) { + return burst.getMana() < 16 ? 0F : 0.95F; + } + + @Override + public int getSizeInventory() { + return 1; + } + + @Override + public String getInventoryName() { + return LibBlockNames.SPREADER; + } + + @Override + public int getInventoryStackLimit() { + return 1; + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemstack) { + return itemstack.getItem() instanceof ILens; + } + + @Override + public void markDirty() { + checkForReceiver(); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + + @Override + public ChunkCoordinates getBinding() { + if(receiver == null) return null; + + TileEntity tile = (TileEntity) receiver; + return new ChunkCoordinates(tile.xCoord, tile.yCoord, tile.zCoord); + } } diff --git a/MODSRC/vazkii/botania/common/block/tile/TileTurntable.java b/MODSRC/vazkii/botania/common/block/tile/TileTurntable.java index 705bb75a8..3a43cc1b2 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TileTurntable.java +++ b/MODSRC/vazkii/botania/common/block/tile/TileTurntable.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 16, 2014, 10:15:05 PM (GMT)] */ package vazkii.botania.common.block.tile; @@ -19,72 +19,68 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; - import org.lwjgl.opengl.GL11; public class TileTurntable extends TileMod { - private static final String TAG_SPEED = "speed"; - private static final String TAG_BACKWARDS = "backwards"; + private static final String TAG_SPEED = "speed"; + private static final String TAG_BACKWARDS = "backwards"; - int speed = 1; - boolean backwards = false; + int speed = 1; + boolean backwards = false; - @Override - public void updateEntity() { - boolean redstone = false; + @Override + public void updateEntity() { + boolean redstone = false; - for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - int redstoneSide = worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal()); - if(redstoneSide > 0) - redstone = true; - } + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + int redstoneSide = worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal()); + if(redstoneSide > 0) redstone = true; + } - if(!redstone) { - TileEntity tile = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord); - if(tile instanceof TileSpreader) { - TileSpreader spreader = (TileSpreader) tile; - spreader.rotationX += speed * (backwards ? -1 : 1); - if(spreader.rotationX >= 360F) - spreader.rotationX -= 360F; - spreader.checkForReceiver(); - } - } - } + if(!redstone) { + TileEntity tile = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord); + if(tile instanceof TileSpreader) { + TileSpreader spreader = (TileSpreader) tile; + spreader.rotationX += speed * (backwards ? -1 : 1); + if(spreader.rotationX >= 360F) spreader.rotationX -= 360F; + spreader.checkForReceiver(); + } + } + } - @Override - public void writeCustomNBT(NBTTagCompound cmp) { - cmp.setInteger(TAG_SPEED, speed); - cmp.setBoolean(TAG_BACKWARDS, backwards); - } + @Override + public void writeCustomNBT(NBTTagCompound cmp) { + cmp.setInteger(TAG_SPEED, speed); + cmp.setBoolean(TAG_BACKWARDS, backwards); + } - @Override - public void readCustomNBT(NBTTagCompound cmp) { - speed = cmp.getInteger(TAG_SPEED); - backwards = cmp.getBoolean(TAG_BACKWARDS); - } + @Override + public void readCustomNBT(NBTTagCompound cmp) { + speed = cmp.getInteger(TAG_SPEED); + backwards = cmp.getBoolean(TAG_BACKWARDS); + } - public void onWanded(EntityPlayer player, ItemStack wand) { - if(player.isSneaking()) - backwards = !backwards; - else speed = speed == 6 ? 1 : speed + 1; - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } + public void onWanded(EntityPlayer player, ItemStack wand) { + if(player.isSneaking()) backwards = !backwards; + else speed = speed == 6 ? 1 : speed + 1; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } - public void renderHUD(Minecraft mc, ScaledResolution res) { - int color = 0xAA006600; + public void renderHUD(Minecraft mc, ScaledResolution res) { + int color = 0xAA006600; - char motion = backwards ? '<' : '>'; - String speed = EnumChatFormatting.BOLD + ""; - for(int i = 0; i < this.speed; i++) - speed = speed + motion; + char motion = backwards ? '<' : '>'; + String speed = EnumChatFormatting.BOLD + ""; + for(int i = 0; i < this.speed; i++) + speed = speed + motion; - int x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(speed) / 2; - int y = res.getScaledHeight() / 2 - 15; - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - mc.fontRenderer.drawStringWithShadow(speed, x, y, color); - GL11.glDisable(GL11.GL_BLEND); - } + int x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(speed) / 2; + int y = res.getScaledHeight() / 2 - 15; + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + mc.fontRenderer.drawStringWithShadow(speed, x, y, color); + GL11.glDisable(GL11.GL_BLEND); + } } diff --git a/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java b/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java index d9e86234b..7e82ec699 100644 --- a/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java +++ b/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java @@ -2,17 +2,15 @@ * This class was created by . 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 14, 2014, 5:20:53 PM (GMT)] */ package vazkii.botania.common.core; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -21,92 +19,95 @@ import vazkii.botania.common.block.ModBlocks; import vazkii.botania.common.item.ModItems; import vazkii.botania.common.lib.LibMisc; +import java.util.List; + public final class BotaniaCreativeTab extends CreativeTabs { - public static BotaniaCreativeTab INSTANCE = new BotaniaCreativeTab(); - List list; + public static BotaniaCreativeTab INSTANCE = new BotaniaCreativeTab(); + List list; - public BotaniaCreativeTab() { - super(LibMisc.MOD_ID); - } + public BotaniaCreativeTab() { + super(LibMisc.MOD_ID); + } - @Override - public ItemStack getIconItemStack() { - return new ItemStack(ModBlocks.flower); - } - - @Override - public Item getTabIconItem() { - return getIconItemStack().getItem(); - } + @Override + public ItemStack getIconItemStack() { + return new ItemStack(ModBlocks.flower); + } - @Override - public void displayAllReleventItems(List list) { - this.list = list; + @Override + public Item getTabIconItem() { + return getIconItemStack().getItem(); + } - addItem(ModItems.lexicon); + @Override + public void displayAllReleventItems(List list) { + this.list = list; - addBlock(ModBlocks.flower); - addBlock(ModBlocks.specialFlower); - addItem(ModItems.petal); - addItem(ModItems.manaPetal); - addItem(ModItems.pestleAndMortar); - addItem(ModItems.dye); - addItem(ModItems.fertilizer); - addItem(ModItems.grassSeeds); - addItem(ModItems.twigWand); - addItem(ModItems.manaResource); - addItem(ModItems.manaCookie); - addItem(ModItems.rune); + addItem(ModItems.lexicon); + addItem(ModItems.test); - addItem(ModItems.dirtRod); - addItem(ModItems.terraformRod); - addItem(ModItems.grassHorn); + addBlock(ModBlocks.flower); + addBlock(ModBlocks.specialFlower); + addItem(ModItems.petal); + addItem(ModItems.manaPetal); + addItem(ModItems.pestleAndMortar); + addItem(ModItems.dye); + addItem(ModItems.fertilizer); + addItem(ModItems.grassSeeds); + addItem(ModItems.twigWand); + addItem(ModItems.manaResource); + addItem(ModItems.manaCookie); + addItem(ModItems.rune); - addBlock(ModBlocks.livingrock); - addBlock(ModBlocks.livingwood); - addBlock(ModBlocks.altar); - addBlock(ModBlocks.runeAltar); - addBlock(ModBlocks.pylon); - addBlock(ModBlocks.pistonRelay); - addBlock(ModBlocks.unstableBlock); - addBlock(ModBlocks.manaBeacon); - addItem(ModItems.signalFlare); - - addItem(ModItems.manasteelPick); - addItem(ModItems.manasteelShovel); - addItem(ModItems.manasteelAxe); - addItem(ModItems.manasteelShears); - addItem(ModItems.manasteelSword); - addItem(ModItems.manasteelHelm); - addItem(ModItems.manasteelChest); - addItem(ModItems.manasteelLegs); - addItem(ModItems.manasteelBoots); - addItem(ModItems.terraSword); - addItem(ModItems.terrasteelHelm); - addItem(ModItems.terrasteelChest); - addItem(ModItems.terrasteelLegs); - addItem(ModItems.terrasteelBoots); - - addItem(ModItems.manaTablet); - addItem(ModItems.manaMirror); - addBlock(ModBlocks.pool); - addBlock(ModBlocks.distributor); - addBlock(ModBlocks.manaVoid); - addBlock(ModBlocks.manaDetector); - addBlock(ModBlocks.spreader); - addBlock(ModBlocks.turntable); - addItem(ModItems.manaGun); - addItem(ModItems.lens); - } + addItem(ModItems.dirtRod); + addItem(ModItems.terraformRod); + addItem(ModItems.grassHorn); - private void addItem(Item item) { - item.getSubItems(item, this, list); - } + addBlock(ModBlocks.livingrock); + addBlock(ModBlocks.livingwood); + addBlock(ModBlocks.altar); + addBlock(ModBlocks.runeAltar); + addBlock(ModBlocks.pylon); + addBlock(ModBlocks.pistonRelay); + addBlock(ModBlocks.unstableBlock); + addBlock(ModBlocks.manaBeacon); + addItem(ModItems.signalFlare); - private void addBlock(Block block) { - ItemStack stack = new ItemStack(block); - block.getSubBlocks(stack.getItem(), this, list); - } + addItem(ModItems.manasteelPick); + addItem(ModItems.manasteelShovel); + addItem(ModItems.manasteelAxe); + addItem(ModItems.manasteelShears); + addItem(ModItems.manasteelSword); + addItem(ModItems.manasteelHelm); + addItem(ModItems.manasteelChest); + addItem(ModItems.manasteelLegs); + addItem(ModItems.manasteelBoots); + addItem(ModItems.terraSword); + addItem(ModItems.terrasteelHelm); + addItem(ModItems.terrasteelChest); + addItem(ModItems.terrasteelLegs); + addItem(ModItems.terrasteelBoots); + + addItem(ModItems.manaTablet); + addItem(ModItems.manaMirror); + addBlock(ModBlocks.pool); + addBlock(ModBlocks.distributor); + addBlock(ModBlocks.manaVoid); + addBlock(ModBlocks.manaDetector); + addBlock(ModBlocks.spreader); + addBlock(ModBlocks.turntable); + addItem(ModItems.manaGun); + addItem(ModItems.lens); + } + + private void addItem(Item item) { + item.getSubItems(item, this, list); + } + + private void addBlock(Block block) { + ItemStack stack = new ItemStack(block); + block.getSubBlocks(stack.getItem(), this, list); + } } diff --git a/MODSRC/vazkii/botania/common/core/handler/BiomeDecorationHandler.java b/MODSRC/vazkii/botania/common/core/handler/BiomeDecorationHandler.java index eda77b020..a4c053f63 100644 --- a/MODSRC/vazkii/botania/common/core/handler/BiomeDecorationHandler.java +++ b/MODSRC/vazkii/botania/common/core/handler/BiomeDecorationHandler.java @@ -2,41 +2,40 @@ * This class was created by . 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 19, 2014, 10:16:49 PM (GMT)] */ package vazkii.botania.common.core.handler; -import net.minecraft.block.Block; -import net.minecraftforge.event.terraingen.DecorateBiomeEvent; -import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType; -import vazkii.botania.common.block.ModBlocks; import cpw.mods.fml.common.eventhandler.Event.Result; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.event.terraingen.DecorateBiomeEvent; +import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType; +import vazkii.botania.common.block.ModBlocks; public class BiomeDecorationHandler { - @SubscribeEvent(priority = EventPriority.LOWEST) - public void onWorldDecoration(DecorateBiomeEvent.Decorate event) { - if((event.getResult() == Result.ALLOW || event.getResult() == Result.DEFAULT) && event.type == EventType.FLOWERS) - for(int i = 0; i < ConfigHandler.flowerQuantity; i++) { - int x = event.chunkX + event.rand.nextInt(16) + 8; - int z = event.chunkZ + event.rand.nextInt(16) + 8; - int y = event.world.getTopSolidOrLiquidBlock(x, z); + @SubscribeEvent(priority = EventPriority.LOWEST) + public void onWorldDecoration(DecorateBiomeEvent.Decorate event) { + if((event.getResult() == Result.ALLOW || event.getResult() == Result.DEFAULT) && event.type == EventType.FLOWERS) + for(int i = 0; i < ConfigHandler.flowerQuantity; i++) { + int x = event.chunkX + event.rand.nextInt(16) + 8; + int z = event.chunkZ + event.rand.nextInt(16) + 8; + int y = event.world.getTopSolidOrLiquidBlock(x, z); - for(int j = 0; j < ConfigHandler.flowerDensity; j++) { - int x1 = x + event.rand.nextInt(8) - event.rand.nextInt(8); - int y1 = y + event.rand.nextInt(4) - event.rand.nextInt(4); - int z1 = z + event.rand.nextInt(8) - event.rand.nextInt(8); + for(int j = 0; j < ConfigHandler.flowerDensity; j++) { + int x1 = x + event.rand.nextInt(8) - event.rand.nextInt(8); + int y1 = y + event.rand.nextInt(4) - event.rand.nextInt(4); + int z1 = z + event.rand.nextInt(8) - event.rand.nextInt(8); - if(event.world.isAirBlock(x1, y1, z1) && (!event.world.provider.hasNoSky || y1 < 127) && ModBlocks.flower.canBlockStay(event.world, x1, y1, z1)) - event.world.setBlock(x1, y1, z1, ModBlocks.flower, event.rand.nextInt(16), 2); - } - } - } + if(event.world.isAirBlock(x1, y1, z1) && (!event.world.provider.hasNoSky || y1 < 127) && ModBlocks.flower.canBlockStay(event.world, x1, y1, z1)) + event.world.setBlock(x1, y1, z1, ModBlocks.flower, event.rand.nextInt(16), 2); + } + } + } } diff --git a/MODSRC/vazkii/botania/common/core/handler/CommonTickHandler.java b/MODSRC/vazkii/botania/common/core/handler/CommonTickHandler.java index 52f5e257a..72298272a 100644 --- a/MODSRC/vazkii/botania/common/core/handler/CommonTickHandler.java +++ b/MODSRC/vazkii/botania/common/core/handler/CommonTickHandler.java @@ -2,54 +2,52 @@ * This class was created by . 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 @ [Apr 14, 2014, 5:10:16 PM (GMT)] */ package vazkii.botania.common.core.handler; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.world.World; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent; import cpw.mods.fml.common.gameevent.TickEvent.Phase; import cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.world.World; + +import java.util.ArrayList; +import java.util.List; public final class CommonTickHandler { - @SubscribeEvent - public void onTick(WorldTickEvent event) { - if(event.phase == Phase.END) { - List entities = new ArrayList(event.world.loadedEntityList); - for(Entity entity : entities) - if(entity instanceof EntityItem) - TerrasteelCraftingHandler.onEntityUpdate((EntityItem) entity); - } - } - - @SideOnly(Side.CLIENT) - @SubscribeEvent - public void onTick(ClientTickEvent event) { - if(event.phase == Phase.END) { - World world = Minecraft.getMinecraft().theWorld; - if(world != null) { - List entities = new ArrayList(world.loadedEntityList); - for(Entity entity : entities) - if(entity instanceof EntityItem) - TerrasteelCraftingHandler.onEntityUpdate((EntityItem) entity); - } + @SubscribeEvent + public void onTick(WorldTickEvent event) { + if(event.phase == Phase.END) { + List entities = new ArrayList(event.world.loadedEntityList); + for(Entity entity : entities) + if(entity instanceof EntityItem) TerrasteelCraftingHandler.onEntityUpdate((EntityItem) entity); + } + } + + @SideOnly(Side.CLIENT) + @SubscribeEvent + public void onTick(ClientTickEvent event) { + if(event.phase == Phase.END) { + World world = Minecraft.getMinecraft().theWorld; + if(world != null) { + List entities = new ArrayList(world.loadedEntityList); + for(Entity entity : entities) + if(entity instanceof EntityItem) TerrasteelCraftingHandler.onEntityUpdate((EntityItem) entity); + } + + } + } - } - } - } diff --git a/MODSRC/vazkii/botania/common/core/handler/ConfigHandler.java b/MODSRC/vazkii/botania/common/core/handler/ConfigHandler.java index 9f79952cd..d65123d3a 100644 --- a/MODSRC/vazkii/botania/common/core/handler/ConfigHandler.java +++ b/MODSRC/vazkii/botania/common/core/handler/ConfigHandler.java @@ -2,87 +2,87 @@ * This class was created by . 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 13, 2014, 9:01:32 PM (GMT)] */ package vazkii.botania.common.core.handler; -import java.io.File; - import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; +import java.io.File; + public final class ConfigHandler { - private static Configuration config; + private static Configuration config; - public static boolean useShaders = true; - public static boolean lexiconRotatingItems = true; - public static boolean subtlePowerSystem = false; - public static boolean staticWandBeam = false; - public static boolean boundBlockWireframe = true; - public static boolean lexicon3dModel = true; - public static boolean oldPylonModel = false; - public static double flowerParticleFrequency = 0.75F; + public static boolean useShaders = true; + public static boolean lexiconRotatingItems = true; + public static boolean subtlePowerSystem = false; + public static boolean staticWandBeam = false; + public static boolean boundBlockWireframe = true; + public static boolean lexicon3dModel = true; + public static boolean oldPylonModel = false; + public static double flowerParticleFrequency = 0.75F; - public static int flowerQuantity = 3; - public static int flowerDensity = 32; + public static int flowerQuantity = 3; + public static int flowerDensity = 32; - public static void loadConfig(File configFile) { - config = new Configuration(configFile); + public static void loadConfig(File configFile) { + config = new Configuration(configFile); - config.load(); - String desc; - - desc = "Set to false to disable the use of shaders for some of the mod's renders."; - useShaders = loadPropBool("shaders.enabled", desc, useShaders); - - desc = "Set to false to disable the rotating items in the petal and rune entries in the Lexica Botania."; - lexiconRotatingItems = loadPropBool("lexicon.enable.rotatingItems", desc, lexiconRotatingItems); - - desc = "Set to true to set the power system's particles to be a lot more subtle. Good for low-end systems, if the particles are causing lag."; - subtlePowerSystem = loadPropBool("powerSystem.subtle", desc, subtlePowerSystem); + config.load(); + String desc; - desc = "Set to true to use a static wand beam that shows every single position of the burst, similar to the way it used to work on old botania versions. Warning: Disabled by default because it may be laggy."; - staticWandBeam = loadPropBool("wandBeam.static", desc, staticWandBeam); + desc = "Set to false to disable the use of shaders for some of the mod's renders."; + useShaders = loadPropBool("shaders.enabled", desc, useShaders); - desc = "Set to false to disable the wireframe when looking a block bound to something (spreaders, flowers, etc)."; - boundBlockWireframe = loadPropBool("boundBlock.wireframe.enabled", desc, boundBlockWireframe); + desc = "Set to false to disable the rotating items in the petal and rune entries in the Lexica Botania."; + lexiconRotatingItems = loadPropBool("lexicon.enable.rotatingItems", desc, lexiconRotatingItems); - desc = "Set to false to disabled the animated 3D render for the lexica botania"; - lexicon3dModel = loadPropBool("lexicon.render.3D", desc, lexicon3dModel); + desc = "Set to true to set the power system's particles to be a lot more subtle. Good for low-end systems, if the particles are causing lag."; + subtlePowerSystem = loadPropBool("powerSystem.subtle", desc, subtlePowerSystem); - desc = "Set to true to use the old (non-.obj, pre beta18) pylon model"; - oldPylonModel = loadPropBool("pylonModel.old", desc, oldPylonModel); - - desc = "The frequency in which particles spawn from normal (worldgen) mystical flowers"; - flowerParticleFrequency = loadPropDouble("flowerParticles.frequency", desc, flowerParticleFrequency); - - flowerQuantity = loadPropInt("worldgen.flower.quantity", null, 3); - flowerDensity = loadPropInt("worldgen.flower.density", null, 32); - - config.save(); - } + desc = "Set to true to use a static wand beam that shows every single position of the burst, similar to the way it used to work on old botania versions. Warning: Disabled by default because it may be laggy."; + staticWandBeam = loadPropBool("wandBeam.static", desc, staticWandBeam); - public static int loadPropInt(String propName, String desc, int default_) { - Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_); - prop.comment = desc; - return prop.getInt(default_); - } - - public static double loadPropDouble(String propName, String desc, double default_) { - Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_); - prop.comment = desc; - return prop.getDouble(default_); - } - - public static boolean loadPropBool(String propName, String desc, boolean default_) { - Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_); - prop.comment = desc; - return prop.getBoolean(default_); - } + desc = "Set to false to disable the wireframe when looking a block bound to something (spreaders, flowers, etc)."; + boundBlockWireframe = loadPropBool("boundBlock.wireframe.enabled", desc, boundBlockWireframe); + + desc = "Set to false to disabled the animated 3D render for the lexica botania"; + lexicon3dModel = loadPropBool("lexicon.render.3D", desc, lexicon3dModel); + + desc = "Set to true to use the old (non-.obj, pre beta18) pylon model"; + oldPylonModel = loadPropBool("pylonModel.old", desc, oldPylonModel); + + desc = "The frequency in which particles spawn from normal (worldgen) mystical flowers"; + flowerParticleFrequency = loadPropDouble("flowerParticles.frequency", desc, flowerParticleFrequency); + + flowerQuantity = loadPropInt("worldgen.flower.quantity", null, 3); + flowerDensity = loadPropInt("worldgen.flower.density", null, 32); + + config.save(); + } + + public static int loadPropInt(String propName, String desc, int default_) { + Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_); + prop.comment = desc; + return prop.getInt(default_); + } + + public static double loadPropDouble(String propName, String desc, double default_) { + Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_); + prop.comment = desc; + return prop.getDouble(default_); + } + + public static boolean loadPropBool(String propName, String desc, boolean default_) { + Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_); + prop.comment = desc; + return prop.getBoolean(default_); + } } diff --git a/MODSRC/vazkii/botania/common/core/handler/InternalMethodHandler.java b/MODSRC/vazkii/botania/common/core/handler/InternalMethodHandler.java index 7082903d6..ab1582c48 100644 --- a/MODSRC/vazkii/botania/common/core/handler/InternalMethodHandler.java +++ b/MODSRC/vazkii/botania/common/core/handler/InternalMethodHandler.java @@ -2,17 +2,15 @@ * This class was created by . 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 14, 2014, 6:44:59 PM (GMT)] */ package vazkii.botania.common.core.handler; -import java.util.List; - import net.minecraft.client.gui.ScaledResolution; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -29,90 +27,87 @@ import vazkii.botania.client.core.handler.HUDHandler; import vazkii.botania.common.Botania; import vazkii.botania.common.block.BlockSpecialFlower; import vazkii.botania.common.item.block.ItemBlockSpecialFlower; -import vazkii.botania.common.lexicon.page.PageCraftingRecipe; -import vazkii.botania.common.lexicon.page.PageImage; -import vazkii.botania.common.lexicon.page.PageManaInfusionRecipe; -import vazkii.botania.common.lexicon.page.PagePetalRecipe; -import vazkii.botania.common.lexicon.page.PageRuneRecipe; -import vazkii.botania.common.lexicon.page.PageText; +import vazkii.botania.common.lexicon.page.*; + +import java.util.List; public class InternalMethodHandler implements IInternalMethodHandler { - @Override - public LexiconPage textPage(String key) { - return new PageText(key); - } + @Override + public LexiconPage textPage(String key) { + return new PageText(key); + } - @Override - public LexiconPage imagePage(String key, String resource) { - return new PageImage(key, resource); - } + @Override + public LexiconPage imagePage(String key, String resource) { + return new PageImage(key, resource); + } - @Override - public LexiconPage craftingRecipesPage(String key, List recipes) { - return new PageCraftingRecipe(key, recipes); - } + @Override + public LexiconPage craftingRecipesPage(String key, List recipes) { + return new PageCraftingRecipe(key, recipes); + } - @Override - public LexiconPage craftingRecipePage(String key, IRecipe recipe) { - return new PageCraftingRecipe(key, recipe); - } + @Override + public LexiconPage craftingRecipePage(String key, IRecipe recipe) { + return new PageCraftingRecipe(key, recipe); + } - @Override - public IIcon getSubTileIconForName(String name) { - IIcon icon = BlockSpecialFlower.icons.get(name); - return icon == null ? Blocks.red_flower.getIcon(0, 0) : icon; - } + @Override + public IIcon getSubTileIconForName(String name) { + IIcon icon = BlockSpecialFlower.icons.get(name); + return icon == null ? Blocks.red_flower.getIcon(0, 0) : icon; + } - @Override - public LexiconPage petalRecipesPage(String key, List recipes) { - return new PagePetalRecipe(key, recipes); - } + @Override + public LexiconPage petalRecipesPage(String key, List recipes) { + return new PagePetalRecipe(key, recipes); + } - @Override - public LexiconPage petalRecipePage(String key, RecipePetals recipe) { - return new PagePetalRecipe(key, recipe); - } + @Override + public LexiconPage petalRecipePage(String key, RecipePetals recipe) { + return new PagePetalRecipe(key, recipe); + } - @Override - public LexiconPage runeRecipesPage(String key, List recipes) { - return new PageRuneRecipe(key, recipes); - } + @Override + public LexiconPage runeRecipesPage(String key, List recipes) { + return new PageRuneRecipe(key, recipes); + } - @Override - public LexiconPage runeRecipePage(String key, RecipeRuneAltar recipe) { - return new PageRuneRecipe(key, recipe); - } + @Override + public LexiconPage runeRecipePage(String key, RecipeRuneAltar recipe) { + return new PageRuneRecipe(key, recipe); + } - @Override - public LexiconPage manaInfusionRecipesPage(String key, List recipes) { - return new PageManaInfusionRecipe(key, recipes); - } + @Override + public LexiconPage manaInfusionRecipesPage(String key, List recipes) { + return new PageManaInfusionRecipe(key, recipes); + } - @Override - public LexiconPage manaInfusionRecipePage(String key, RecipeManaInfusion recipe) { - return new PageManaInfusionRecipe(key, recipe); - } + @Override + public LexiconPage manaInfusionRecipePage(String key, RecipeManaInfusion recipe) { + return new PageManaInfusionRecipe(key, recipe); + } - @Override - public ItemStack getSubTileAsStack(String subTile) { - return ItemBlockSpecialFlower.ofType(subTile); - } + @Override + public ItemStack getSubTileAsStack(String subTile) { + return ItemBlockSpecialFlower.ofType(subTile); + } - @Override - public IManaNetwork getManaNetworkInstance() { - return ManaNetworkHandler.instance; - } + @Override + public IManaNetwork getManaNetworkInstance() { + return ManaNetworkHandler.instance; + } - @Override - public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) { - HUDHandler.drawSimpleManaHUD(color, mana, maxMana, name, res); - } + @Override + public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) { + HUDHandler.drawSimpleManaHUD(color, mana, maxMana, name, res); + } - @Override - public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) { - Botania.proxy.sparkleFX(world, x, y, z, r, g, b, size, m); - } + @Override + public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) { + Botania.proxy.sparkleFX(world, x, y, z, r, g, b, size, m); + } } diff --git a/MODSRC/vazkii/botania/common/core/handler/ManaNetworkHandler.java b/MODSRC/vazkii/botania/common/core/handler/ManaNetworkHandler.java index dabe6c9a3..f50641af4 100644 --- a/MODSRC/vazkii/botania/common/core/handler/ManaNetworkHandler.java +++ b/MODSRC/vazkii/botania/common/core/handler/ManaNetworkHandler.java @@ -2,20 +2,16 @@ * This class was created by . 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 22, 2014, 5:35:10 PM (GMT)] */ package vazkii.botania.common.core.handler; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; import vazkii.botania.api.internal.IManaNetwork; @@ -23,97 +19,93 @@ import vazkii.botania.api.mana.ManaNetworkEvent; import vazkii.botania.api.mana.ManaNetworkEvent.Action; import vazkii.botania.api.mana.ManaNetworkEvent.ManaBlockType; import vazkii.botania.common.core.helper.MathHelper; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public final class ManaNetworkHandler implements IManaNetwork { - public static final ManaNetworkHandler instance = new ManaNetworkHandler(); + public static final ManaNetworkHandler instance = new ManaNetworkHandler(); - public Map> manaPools = new HashMap(); - public Map> manaCollectors = new HashMap(); + public Map> manaPools = new HashMap(); + public Map> manaCollectors = new HashMap(); - @SubscribeEvent - public void onNetworkEvent(ManaNetworkEvent event) { - Map> map = event.type == ManaBlockType.COLLECTOR ? manaCollectors : manaPools; - if(event.action == Action.ADD) - add(map, event.tile); - else remove(map, event.tile); - } + @SubscribeEvent + public void onNetworkEvent(ManaNetworkEvent event) { + Map> map = event.type == ManaBlockType.COLLECTOR ? manaCollectors : manaPools; + if(event.action == Action.ADD) add(map, event.tile); + else remove(map, event.tile); + } - @Override - public void clear() { - manaPools.clear(); - manaCollectors.clear(); - } + @Override + public void clear() { + manaPools.clear(); + manaCollectors.clear(); + } - @Override - public TileEntity getClosestPool(ChunkCoordinates pos, int dimension, int limit) { - if(manaPools.containsKey(dimension)) - return getClosest(manaPools.get(dimension), pos, limit); - return null; - } + @Override + public TileEntity getClosestPool(ChunkCoordinates pos, int dimension, int limit) { + if(manaPools.containsKey(dimension)) return getClosest(manaPools.get(dimension), pos, limit); + return null; + } - @Override - public TileEntity getClosestCollector(ChunkCoordinates pos, int dimension, int limit) { - if(manaCollectors.containsKey(dimension)) - return getClosest(manaCollectors.get(dimension), pos, limit); - return null; - } + @Override + public TileEntity getClosestCollector(ChunkCoordinates pos, int dimension, int limit) { + if(manaCollectors.containsKey(dimension)) return getClosest(manaCollectors.get(dimension), pos, limit); + return null; + } - private synchronized TileEntity getClosest(List tiles, ChunkCoordinates pos, int limit) { - float closest = Float.MAX_VALUE; - TileEntity closestTile = null; + private synchronized TileEntity getClosest(List tiles, ChunkCoordinates pos, int limit) { + float closest = Float.MAX_VALUE; + TileEntity closestTile = null; - for(TileEntity tile : tiles) { - float distance = MathHelper.pointDistanceSpace(tile.xCoord, tile.yCoord, tile.zCoord, pos.posX, pos.posY, pos.posZ); - if(distance > limit) - continue; + for(TileEntity tile : tiles) { + float distance = MathHelper.pointDistanceSpace(tile.xCoord, tile.yCoord, tile.zCoord, pos.posX, pos.posY, pos.posZ); + if(distance > limit) continue; - if(distance < closest) { - closest = distance; - closestTile = tile; - } - } + if(distance < closest) { + closest = distance; + closestTile = tile; + } + } - return closestTile; - } + return closestTile; + } - private synchronized void remove(Map> map, TileEntity tile) { - int dim = tile.getWorldObj().provider.dimensionId; + private synchronized void remove(Map> map, TileEntity tile) { + int dim = tile.getWorldObj().provider.dimensionId; - if(!map.containsKey(dim)) - return; + if(!map.containsKey(dim)) return; - List tiles = map.get(dim); - tiles.remove(tile); - } + List tiles = map.get(dim); + tiles.remove(tile); + } - private synchronized void add(Map> map, TileEntity tile) { - int dim = tile.getWorldObj().provider.dimensionId; + private synchronized void add(Map> map, TileEntity tile) { + int dim = tile.getWorldObj().provider.dimensionId; - List tiles; - if(!map.containsKey(dim)) - map.put(dim, new ArrayList()); + List tiles; + if(!map.containsKey(dim)) map.put(dim, new ArrayList()); - tiles = map.get(dim); + tiles = map.get(dim); - if(!tiles.contains(tile)) - tiles.add(tile); - } + if(!tiles.contains(tile)) tiles.add(tile); + } - @Override - public List getAllCollectorsInWorld(int dim) { - return getAllInWorld(manaCollectors, dim); - } + @Override + public List getAllCollectorsInWorld(int dim) { + return getAllInWorld(manaCollectors, dim); + } - @Override - public List getAllPoolsInWorld(int dim) { - return getAllInWorld(manaPools, dim); - } + @Override + public List getAllPoolsInWorld(int dim) { + return getAllInWorld(manaPools, dim); + } - private List getAllInWorld(Map> map, int dim) { - if(!map.containsKey(dim)) - return new ArrayList(); - return map.get(dim); - } + private List getAllInWorld(Map> map, int dim) { + if(!map.containsKey(dim)) return new ArrayList(); + return map.get(dim); + } } diff --git a/MODSRC/vazkii/botania/common/core/handler/TerrasteelCraftingHandler.java b/MODSRC/vazkii/botania/common/core/handler/TerrasteelCraftingHandler.java index 042824907..e6fe84047 100644 --- a/MODSRC/vazkii/botania/common/core/handler/TerrasteelCraftingHandler.java +++ b/MODSRC/vazkii/botania/common/core/handler/TerrasteelCraftingHandler.java @@ -2,188 +2,174 @@ * This class was created by . 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 @ [Apr 14, 2014, 4:30:40 PM (GMT)] */ package vazkii.botania.common.core.handler; -import java.util.List; - import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityBeacon; import net.minecraft.util.AxisAlignedBB; -import net.minecraftforge.event.entity.EntityEvent; import vazkii.botania.api.mana.IManaPool; import vazkii.botania.common.Botania; import vazkii.botania.common.block.tile.TilePool; import vazkii.botania.common.core.helper.ItemNBTHelper; import vazkii.botania.common.item.ModItems; -import cpw.mods.fml.common.eventhandler.EventPriority; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +import java.util.List; public final class TerrasteelCraftingHandler { - private static final String TAG_TIME = "Botania-CraftingTime"; - private static final int TIME = 100; - private static final int MANA_PER_TICK = (int) ((TilePool.MAX_MANA / 2 / TIME) * 0.9); + private static final String TAG_TIME = "Botania-CraftingTime"; + private static final int TIME = 100; + private static final int MANA_PER_TICK = (int) ((TilePool.MAX_MANA / 2 / TIME) * 0.9); - public static void onEntityUpdate(EntityItem item) { - ItemStack stack = item.getEntityItem(); - if(stack != null && stack.getItem() == ModItems.manaResource && stack.getItemDamage() == 0) { - int time = validateCraftingItem(item); + public static void onEntityUpdate(EntityItem item) { + ItemStack stack = item.getEntityItem(); + if(stack != null && stack.getItem() == ModItems.manaResource && stack.getItemDamage() == 0) { + int time = validateCraftingItem(item); - if(time != -1) { - doParticles(item, time); + if(time != -1) { + doParticles(item, time); - getManaFromPools : { - int x = (int) item.posX; - int y = (int) item.posY; - int z = (int) item.posZ; + getManaFromPools: + { + int x = (int) item.posX; + int y = (int) item.posY; + int z = (int) item.posZ; - for(int i = -4; i < 5; i++) - for(int j = -4; j < 5; j++) - for(int k = - 4; k < 5; k++) { - TileEntity tile = item.worldObj.getTileEntity(x + i, y + j, z + k); + for(int i = -4; i < 5; i++) + for(int j = -4; j < 5; j++) + for(int k = -4; k < 5; k++) { + TileEntity tile = item.worldObj.getTileEntity(x + i, y + j, z + k); - if(tile instanceof IManaPool) { - IManaPool pool = (IManaPool) tile; + if(tile instanceof IManaPool) { + IManaPool pool = (IManaPool) tile; - if(!item.worldObj.isRemote && pool.getCurrentMana() >= MANA_PER_TICK) { - pool.recieveMana(-MANA_PER_TICK); - item.worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord); - incrementCraftingTime(item, time); - break getManaFromPools; - } - } - } - } - } - } - } + if(!item.worldObj.isRemote && pool.getCurrentMana() >= MANA_PER_TICK) { + pool.recieveMana(-MANA_PER_TICK); + item.worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord); + incrementCraftingTime(item, time); + break getManaFromPools; + } + } + } + } + } + } + } - static int validateCraftingItem(EntityItem item) { - int x = (int) item.posX; - int y = (int) item.posY; - int z = (int) item.posZ; + static int validateCraftingItem(EntityItem item) { + int x = (int) item.posX; + int y = (int) item.posY; + int z = (int) item.posZ; - if(item.worldObj.getBlock(x, y - 1, z) != Blocks.beacon) - return -1; + if(item.worldObj.getBlock(x, y - 1, z) != Blocks.beacon) return -1; - TileEntityBeacon beacon = (TileEntityBeacon) item.worldObj.getTileEntity(x, y - 1, z); - if(beacon.getLevels() <= 0) - return -1; + TileEntityBeacon beacon = (TileEntityBeacon) item.worldObj.getTileEntity(x, y - 1, z); + if(beacon.getLevels() <= 0) return -1; - List items = item.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1)); + List items = item.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1)); - EntityItem diamond = null; - EntityItem pearl = null; + EntityItem diamond = null; + EntityItem pearl = null; - for(EntityItem otherItem : items) { - if(otherItem == item) - continue; + for(EntityItem otherItem : items) { + if(otherItem == item) continue; - ItemStack stack = otherItem.getEntityItem(); - if(stack.getItem() == ModItems.manaResource) { - int meta = stack.getItemDamage(); - if(meta == 1) { - if(pearl == null) { - pearl = otherItem; - continue; - } else return -1; - } else if(meta == 2) { - if(diamond == null) { - diamond = otherItem; - continue; - } else return -1; - } else return -1; - } else return -1; - } + ItemStack stack = otherItem.getEntityItem(); + if(stack.getItem() == ModItems.manaResource) { + int meta = stack.getItemDamage(); + if(meta == 1) { + if(pearl == null) { + pearl = otherItem; + continue; + } else return -1; + } else if(meta == 2) { + if(diamond == null) { + diamond = otherItem; + continue; + } else return -1; + } else return -1; + } else return -1; + } - if(diamond != null && pearl != null) { - int time = getTimeInCrafting(item); - if(time > 0) { - diamond.delayBeforeCanPickup = 1; - diamond.age = 0; - pearl.delayBeforeCanPickup = 1; - pearl.age = 0; - item.delayBeforeCanPickup = 1; - item.age = 0; - } + if(diamond != null && pearl != null) { + int time = getTimeInCrafting(item); + if(time > 0) { + diamond.delayBeforeCanPickup = 1; + diamond.age = 0; + pearl.delayBeforeCanPickup = 1; + pearl.age = 0; + item.delayBeforeCanPickup = 1; + item.age = 0; + } - return time; - } - return -1; - } + return time; + } + return -1; + } - static int getTimeInCrafting(EntityItem item) { - ItemStack stack = item.getEntityItem(); - return ItemNBTHelper.getInt(stack, TAG_TIME, 0); - } + static int getTimeInCrafting(EntityItem item) { + ItemStack stack = item.getEntityItem(); + return ItemNBTHelper.getInt(stack, TAG_TIME, 0); + } - static void doParticles(EntityItem item, int ticks) { - if(item.worldObj.isRemote) { - float[][] colors = new float[][] { - { 0F, 0F, 1F }, - { 0F, 0.5F, 0.5F }, - { 0F, 1F, 0F }, - }; + static void doParticles(EntityItem item, int ticks) { + if(item.worldObj.isRemote) { + float[][] colors = new float[][]{{0F, 0F, 1F}, {0F, 0.5F, 0.5F}, {0F, 1F, 0F},}; - int totalSpiritCount = 3; - double tickIncrement = 360D / totalSpiritCount; + int totalSpiritCount = 3; + double tickIncrement = 360D / totalSpiritCount; - int speed = 5; - double wticks = ticks * speed - tickIncrement; + int speed = 5; + double wticks = ticks * speed - tickIncrement; - double r = Math.sin((double) (ticks - TIME) / 10D) * 2; - double g = Math.sin(wticks * Math.PI / 180 * 0.55); + double r = Math.sin((double) (ticks - TIME) / 10D) * 2; + double g = Math.sin(wticks * Math.PI / 180 * 0.55); - for(int i = 0; i < totalSpiritCount; i++) { - double x = (int) item.posX + Math.sin(wticks * Math.PI / 180) * r + 0.5; - double y = (int) item.posY + 0.25; - double z = (int) item.posZ + Math.cos(wticks * Math.PI / 180) * r + 0.5; + for(int i = 0; i < totalSpiritCount; i++) { + double x = (int) item.posX + Math.sin(wticks * Math.PI / 180) * r + 0.5; + double y = (int) item.posY + 0.25; + double z = (int) item.posZ + Math.cos(wticks * Math.PI / 180) * r + 0.5; - wticks += tickIncrement; - float[] colorsfx = colors[i >= colors.length ? 0 : i]; - Botania.proxy.wispFX(item.worldObj, x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F, (float)g * 0.05F, 0.25F); - Botania.proxy.wispFX(item.worldObj, x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.1F + 0.1F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, 0.9F); + wticks += tickIncrement; + float[] colorsfx = colors[i >= colors.length ? 0 : i]; + Botania.proxy.wispFX(item.worldObj, x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F, (float) g * 0.05F, 0.25F); + Botania.proxy.wispFX(item.worldObj, x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.1F + 0.1F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, 0.9F); - if(ticks == TIME) - for(int j = 0; j < 15; j++) - Botania.proxy.wispFX(item.worldObj, item.posX, item.posY, item.posZ, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F); - } - if(ticks == TIME) - item.worldObj.playSoundAtEntity(item, "random.levelup", 1F, 1F); - } - } + if(ticks == TIME) for(int j = 0; j < 15; j++) + Botania.proxy.wispFX(item.worldObj, item.posX, item.posY, item.posZ, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F); + } + if(ticks == TIME) item.worldObj.playSoundAtEntity(item, "random.levelup", 1F, 1F); + } + } - static void incrementCraftingTime(EntityItem item, int time) { - if(time >= TIME) - finalizeCraftingRecipe(item); + static void incrementCraftingTime(EntityItem item, int time) { + if(time >= TIME) finalizeCraftingRecipe(item); - else { - ItemStack stack = item.getEntityItem(); - ItemNBTHelper.setInt(stack, TAG_TIME, time + 1); - } - } + else { + ItemStack stack = item.getEntityItem(); + ItemNBTHelper.setInt(stack, TAG_TIME, time + 1); + } + } - static void finalizeCraftingRecipe(EntityItem item) { - int x = (int) item.posX; - int y = (int) item.posY; - int z = (int) item.posZ; + static void finalizeCraftingRecipe(EntityItem item) { + int x = (int) item.posX; + int y = (int) item.posY; + int z = (int) item.posZ; - List items = item.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1)); - for(EntityItem otherItem : items) - if(otherItem != item) - otherItem.setDead(); - else item.setEntityItemStack(new ItemStack(ModItems.manaResource, 1, 4)); - } + List items = item.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1)); + for(EntityItem otherItem : items) + if(otherItem != item) otherItem.setDead(); + else item.setEntityItemStack(new ItemStack(ModItems.manaResource, 1, 4)); + } } diff --git a/MODSRC/vazkii/botania/common/core/handler/WorldTreeGenerator.java b/MODSRC/vazkii/botania/common/core/handler/WorldTreeGenerator.java index 38569d8f4..72ac25d2c 100644 --- a/MODSRC/vazkii/botania/common/core/handler/WorldTreeGenerator.java +++ b/MODSRC/vazkii/botania/common/core/handler/WorldTreeGenerator.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 22, 2014, 4:43:32 PM (GMT)] */ package vazkii.botania.common.core.handler; @@ -17,74 +17,73 @@ import vazkii.botania.common.block.ModBlocks; public class WorldTreeGenerator { - World world; - int srcx, srcy, srcz; + World world; + int srcx, srcy, srcz; - int x, y, z; + int x, y, z; - int blocksPlaced; + int blocksPlaced; - public WorldTreeGenerator(World world, int srcx, int srcy, int srcz) { - this.world = world; - this.srcx = srcx; - this.srcy = srcy; - this.srcz = srcz; - } + public WorldTreeGenerator(World world, int srcx, int srcy, int srcz) { + this.world = world; + this.srcx = srcx; + this.srcy = srcy; + this.srcz = srcz; + } - public void generate() { - for(int i = 0; i < 116; i++) - generateRing(i, (int) Math.sqrt(256 - (Math.min(i, 64) - 5) * 2)); + public void generate() { + for(int i = 0; i < 116; i++) + generateRing(i, (int) Math.sqrt(256 - (Math.min(i, 64) - 5) * 2)); - System.out.println("Blocks Placed: " + blocksPlaced); - } + System.out.println("Blocks Placed: " + blocksPlaced); + } - public void generateRing(int yoff, int radius) { - Block block = ModBlocks.livingwood; - y = yoff; + public void generateRing(int yoff, int radius) { + Block block = ModBlocks.livingwood; + y = yoff; - for(int i = 0; i < 360; i++) { - if(i % 90 == 0) - continue; + for(int i = 0; i < 360; i++) { + if(i % 90 == 0) continue; - int meta = world.rand.nextInt(200) == 0 ? 5 : 0; - generateRingVal(radius, i, block, meta); - } + int meta = world.rand.nextInt(200) == 0 ? 5 : 0; + generateRingVal(radius, i, block, meta); + } - int mul = 4; - for(int i = 0; i < mul; i++) - for(int j = 0; j < mul; j++) { - int meta = world.rand.nextInt(4) == 0 ? 5 : 0; - int angle = (y - j) * mul % 360; + int mul = 4; + for(int i = 0; i < mul; i++) + for(int j = 0; j < mul; j++) { + int meta = world.rand.nextInt(4) == 0 ? 5 : 0; + int angle = (y - j) * mul % 360; - generateRingVal(radius - i - 3, angle, block, meta); - generateRingVal(radius - i - 3, angle + 180, block, meta); - } + generateRingVal(radius - i - 3, angle, block, meta); + generateRingVal(radius - i - 3, angle + 180, block, meta); + } - mul = 3; + mul = 3; - for(int i = 0; i < mul; i++) - for(int j = 0; j < mul; j++) { - int meta = world.rand.nextInt(20) == 0 ? 5 : 0; - int angle = (y - j) * mul % 360; - generateRingVal(radius + i - 1, angle + 90, block, meta); - generateRingVal(radius + i - 1, angle + 270, block, meta); - } - } + for(int i = 0; i < mul; i++) + for(int j = 0; j < mul; j++) { + int meta = world.rand.nextInt(20) == 0 ? 5 : 0; + int angle = (y - j) * mul % 360; + generateRingVal(radius + i - 1, angle + 90, block, meta); + generateRingVal(radius + i - 1, angle + 270, block, meta); + } + } - public void generateRingVal(int radius, int angle, Block block, int meta) { - int nx = (int) (Math.cos(angle * Math.PI / 180D) * radius); - int nz = (int) (Math.sin(angle * Math.PI / 180D) * radius); + public void generateRingVal(int radius, int angle, Block block, int meta) { + int nx = (int) (Math.cos(angle * Math.PI / 180D) * radius); + int nz = (int) (Math.sin(angle * Math.PI / 180D) * radius); - if(x != nx || z != nz) { - x = nx; - z = nz; - place(srcx + x, srcy + y, srcz + z, block, meta); - } - } + if(x != nx || z != nz) { + x = nx; + z = nz; + place(srcx + x, srcy + y, srcz + z, block, meta); + } + } - public void place(int x, int y, int z, Block block, int meta) { - world.setBlock(x, y, z, block, meta, 2); - blocksPlaced++; - } + public void place(int x, int y, int z, Block block, int meta) { + world.setBlock(x, y, z, block, meta, 2); + blocksPlaced++; + } } diff --git a/MODSRC/vazkii/botania/common/core/helper/ExperienceHelper.java b/MODSRC/vazkii/botania/common/core/helper/ExperienceHelper.java index c34cabadc..840f6473a 100644 --- a/MODSRC/vazkii/botania/common/core/helper/ExperienceHelper.java +++ b/MODSRC/vazkii/botania/common/core/helper/ExperienceHelper.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [? (GMT)] */ package vazkii.botania.common.core.helper; @@ -16,40 +16,36 @@ import net.minecraft.entity.player.EntityPlayer; // From OpenBlocksLib: https://github.com/OpenMods/OpenModsLib public class ExperienceHelper { - public static int getPlayerXP(EntityPlayer player) { - return (int)(getExperienceForLevel(player.experienceLevel) + player.experience * player.xpBarCap()); - } + public static int getPlayerXP(EntityPlayer player) { + return (int) (getExperienceForLevel(player.experienceLevel) + player.experience * player.xpBarCap()); + } - public static void drainPlayerXP(EntityPlayer player, int amount) { - addPlayerXP(player, -amount); - } + public static void drainPlayerXP(EntityPlayer player, int amount) { + addPlayerXP(player, -amount); + } - public static void addPlayerXP(EntityPlayer player, int amount) { - int experience = getPlayerXP(player) + amount; - player.experienceTotal = experience; - player.experienceLevel = getLevelForExperience(experience); - int expForLevel = getExperienceForLevel(player.experienceLevel); - player.experience = (float)(experience - expForLevel) / (float)player.xpBarCap(); - } + public static void addPlayerXP(EntityPlayer player, int amount) { + int experience = getPlayerXP(player) + amount; + player.experienceTotal = experience; + player.experienceLevel = getLevelForExperience(experience); + int expForLevel = getExperienceForLevel(player.experienceLevel); + player.experience = (float) (experience - expForLevel) / (float) player.xpBarCap(); + } - public static int getExperienceForLevel(int level) { - if (level == 0) - return 0; + public static int getExperienceForLevel(int level) { + if(level == 0) return 0; - if (level > 0 && level < 16) - return level * 17; - else if (level > 15 && level < 31) - return (int) (1.5 * level * level - 29.5 * level + 360); - else - return (int) (3.5 * level * level - 151.5 * level + 2220); - } + if(level > 0 && level < 16) return level * 17; + else if(level > 15 && level < 31) return (int) (1.5 * level * level - 29.5 * level + 360); + else return (int) (3.5 * level * level - 151.5 * level + 2220); + } - public static int getLevelForExperience(int experience) { - int i = 0; - while (getExperienceForLevel(i) <= experience) { - i++; - } - return i - 1; - } + public static int getLevelForExperience(int experience) { + int i = 0; + while(getExperienceForLevel(i) <= experience) { + i++; + } + return i - 1; + } } diff --git a/MODSRC/vazkii/botania/common/core/helper/InventoryHelper.java b/MODSRC/vazkii/botania/common/core/helper/InventoryHelper.java index 6f0124187..8496d6cde 100644 --- a/MODSRC/vazkii/botania/common/core/helper/InventoryHelper.java +++ b/MODSRC/vazkii/botania/common/core/helper/InventoryHelper.java @@ -2,20 +2,15 @@ * This class was created by . 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 @ [? (GMT)] */ package vazkii.botania.common.core.helper; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -30,309 +25,307 @@ import net.minecraft.tileentity.TileEntityChest; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + //From OpenBlocksLib: https://github.com/OpenMods/OpenModsLib public class InventoryHelper { - public static void tryInsertStack(IInventory targetInventory, int slot, ItemStack stack, boolean canMerge) { - if(targetInventory.isItemValidForSlot(slot, stack)) { - ItemStack targetStack = targetInventory.getStackInSlot(slot); - if(targetStack == null) { - targetInventory.setInventorySlotContents(slot, stack.copy()); - stack.stackSize = 0; - } else if(canMerge) { - if(targetInventory.isItemValidForSlot(slot, stack) && areMergeCandidates(stack, targetStack)) { - int space = targetStack.getMaxStackSize() - targetStack.stackSize; - int mergeAmount = Math.min(space, stack.stackSize); - ItemStack copy = targetStack.copy(); - copy.stackSize += mergeAmount; - targetInventory.setInventorySlotContents(slot, copy); - stack.stackSize -= mergeAmount; - } - } - } - } + public static void tryInsertStack(IInventory targetInventory, int slot, ItemStack stack, boolean canMerge) { + if(targetInventory.isItemValidForSlot(slot, stack)) { + ItemStack targetStack = targetInventory.getStackInSlot(slot); + if(targetStack == null) { + targetInventory.setInventorySlotContents(slot, stack.copy()); + stack.stackSize = 0; + } else if(canMerge) { + if(targetInventory.isItemValidForSlot(slot, stack) && areMergeCandidates(stack, targetStack)) { + int space = targetStack.getMaxStackSize() - targetStack.stackSize; + int mergeAmount = Math.min(space, stack.stackSize); + ItemStack copy = targetStack.copy(); + copy.stackSize += mergeAmount; + targetInventory.setInventorySlotContents(slot, copy); + stack.stackSize -= mergeAmount; + } + } + } + } - protected static boolean areMergeCandidates(ItemStack source, ItemStack target) { - return source.isItemEqual(target) && ItemStack.areItemStackTagsEqual(source, target) && target.stackSize < target.getMaxStackSize(); - } + protected static boolean areMergeCandidates(ItemStack source, ItemStack target) { + return source.isItemEqual(target) && ItemStack.areItemStackTagsEqual(source, target) && target.stackSize < target.getMaxStackSize(); + } - public static void insertItemIntoInventory(IInventory inventory, ItemStack stack) { - insertItemIntoInventory(inventory, stack, ForgeDirection.UNKNOWN, -1); - } + public static void insertItemIntoInventory(IInventory inventory, ItemStack stack) { + insertItemIntoInventory(inventory, stack, ForgeDirection.UNKNOWN, -1); + } - public static void insertItemIntoInventory(IInventory inventory, ItemStack stack, ForgeDirection side, int intoSlot) { - insertItemIntoInventory(inventory, stack, side, intoSlot, true); - } + public static void insertItemIntoInventory(IInventory inventory, ItemStack stack, ForgeDirection side, int intoSlot) { + insertItemIntoInventory(inventory, stack, side, intoSlot, true); + } - public static void insertItemIntoInventory(IInventory inventory, ItemStack stack, ForgeDirection side, int intoSlot, boolean doMove) { - insertItemIntoInventory(inventory, stack, side, intoSlot, doMove, true); - } + public static void insertItemIntoInventory(IInventory inventory, ItemStack stack, ForgeDirection side, int intoSlot, boolean doMove) { + insertItemIntoInventory(inventory, stack, side, intoSlot, doMove, true); + } - public static void insertItemIntoInventory(IInventory inventory, ItemStack stack, ForgeDirection side, int intoSlot, boolean doMove, boolean canStack) { - if(stack == null) return; + public static void insertItemIntoInventory(IInventory inventory, ItemStack stack, ForgeDirection side, int intoSlot, boolean doMove, boolean canStack) { + if(stack == null) return; - IInventory targetInventory = inventory; + IInventory targetInventory = inventory; - if(!doMove) { - targetInventory = new GenericInventory("temporary.inventory", false, targetInventory.getSizeInventory()); - ((GenericInventory)targetInventory).copyFrom(inventory); - } + if(!doMove) { + targetInventory = new GenericInventory("temporary.inventory", false, targetInventory.getSizeInventory()); + ((GenericInventory) targetInventory).copyFrom(inventory); + } - int i = 0; - int[] attemptSlots = new int[0]; + int i = 0; + int[] attemptSlots = new int[0]; - if(inventory instanceof ISidedInventory && side != ForgeDirection.UNKNOWN) { - attemptSlots = ((ISidedInventory)inventory).getAccessibleSlotsFromSide(side.ordinal()); - if(attemptSlots == null) - attemptSlots = new int[0]; - } else { - attemptSlots = new int[inventory.getSizeInventory()]; - for(int a = 0; a < inventory.getSizeInventory(); a++) - attemptSlots[a] = a; - } - if(intoSlot > -1) { - Set x = new HashSet(); - for(int attemptedSlot : attemptSlots) - x.add(attemptedSlot); + if(inventory instanceof ISidedInventory && side != ForgeDirection.UNKNOWN) { + attemptSlots = ((ISidedInventory) inventory).getAccessibleSlotsFromSide(side.ordinal()); + if(attemptSlots == null) attemptSlots = new int[0]; + } else { + attemptSlots = new int[inventory.getSizeInventory()]; + for(int a = 0; a < inventory.getSizeInventory(); a++) + attemptSlots[a] = a; + } + if(intoSlot > -1) { + Set x = new HashSet(); + for(int attemptedSlot : attemptSlots) + x.add(attemptedSlot); - if(x.contains(intoSlot)) - attemptSlots = new int[] { intoSlot }; - else attemptSlots = new int[0]; - } - while(stack.stackSize > 0 && i < attemptSlots.length) { - if(side != ForgeDirection.UNKNOWN && inventory instanceof ISidedInventory) - if(!((ISidedInventory)inventory).canInsertItem(intoSlot, stack, side.ordinal())) { - i++; - continue; - } + if(x.contains(intoSlot)) attemptSlots = new int[]{intoSlot}; + else attemptSlots = new int[0]; + } + while(stack.stackSize > 0 && i < attemptSlots.length) { + if(side != ForgeDirection.UNKNOWN && inventory instanceof ISidedInventory) + if(!((ISidedInventory) inventory).canInsertItem(intoSlot, stack, side.ordinal())) { + i++; + continue; + } - tryInsertStack(targetInventory, attemptSlots[i], stack, canStack); - i++; - } - } + tryInsertStack(targetInventory, attemptSlots[i], stack, canStack); + i++; + } + } - public static int testInventoryInsertion(IInventory inventory, ItemStack item, ForgeDirection side) { - if (item == null || item.stackSize == 0) - return 0; - item = item.copy(); + public static int testInventoryInsertion(IInventory inventory, ItemStack item, ForgeDirection side) { + if(item == null || item.stackSize == 0) return 0; + item = item.copy(); - if (inventory == null) - return 0; + if(inventory == null) return 0; - int slotCount = inventory.getSizeInventory(); + int slotCount = inventory.getSizeInventory(); - int itemSizeCounter = item.stackSize; - for (int i = 0; i < slotCount && itemSizeCounter > 0; i++) { - if (!inventory.isItemValidForSlot(i, item)) - continue; + int itemSizeCounter = item.stackSize; + for(int i = 0; i < slotCount && itemSizeCounter > 0; i++) { + if(!inventory.isItemValidForSlot(i, item)) continue; - if(side != ForgeDirection.UNKNOWN && inventory instanceof ISidedInventory) - if(!((ISidedInventory)inventory).canInsertItem(i, item, side.ordinal())) - continue; + if(side != ForgeDirection.UNKNOWN && inventory instanceof ISidedInventory) + if(!((ISidedInventory) inventory).canInsertItem(i, item, side.ordinal())) continue; - ItemStack inventorySlot = inventory.getStackInSlot(i); - if (inventorySlot == null) - itemSizeCounter -= Math.min(Math.min(itemSizeCounter, inventory.getInventoryStackLimit()), item.getMaxStackSize()); - else if (areMergeCandidates(item, inventorySlot)) { - int space = inventorySlot.getMaxStackSize() - inventorySlot.stackSize; - itemSizeCounter -= Math.min(itemSizeCounter, space); - } - } - if (itemSizeCounter != item.stackSize) { - itemSizeCounter = Math.max(itemSizeCounter, 0); - return item.stackSize - itemSizeCounter; - } + ItemStack inventorySlot = inventory.getStackInSlot(i); + if(inventorySlot == null) + itemSizeCounter -= Math.min(Math.min(itemSizeCounter, inventory.getInventoryStackLimit()), item.getMaxStackSize()); + else if(areMergeCandidates(item, inventorySlot)) { + int space = inventorySlot.getMaxStackSize() - inventorySlot.stackSize; + itemSizeCounter -= Math.min(itemSizeCounter, space); + } + } + if(itemSizeCounter != item.stackSize) { + itemSizeCounter = Math.max(itemSizeCounter, 0); + return item.stackSize - itemSizeCounter; + } - return 0; - } + return 0; + } - public static IInventory getInventory(World world, int x, int y, int z) { - TileEntity tileEntity = world.getTileEntity(x, y, z); - if(tileEntity instanceof TileEntityChest) { - Block chestBlock = world.getBlock(x, y, z); - if(world.getBlock(x - 1, y, z) == chestBlock) - return new InventoryLargeChest("Large chest", (IInventory)world.getTileEntity(x - 1, y, z), (IInventory)tileEntity); - if(world.getBlock(x + 1, y, z) == chestBlock) - return new InventoryLargeChest("Large chest", (IInventory)tileEntity, (IInventory)world.getTileEntity(x + 1, y, z)); - if(world.getBlock(x, y, z - 1) == chestBlock) - return new InventoryLargeChest("Large chest", (IInventory)world.getTileEntity(x, y, z - 1), (IInventory)tileEntity); - if(world.getBlock(x, y, z + 1) == chestBlock) - return new InventoryLargeChest("Large chest", (IInventory)tileEntity, (IInventory)world.getTileEntity(x, y, z + 1)); - } - return tileEntity instanceof IInventory ? (IInventory)tileEntity : null; - } + public static IInventory getInventory(World world, int x, int y, int z) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + if(tileEntity instanceof TileEntityChest) { + Block chestBlock = world.getBlock(x, y, z); + if(world.getBlock(x - 1, y, z) == chestBlock) + return new InventoryLargeChest("Large chest", (IInventory) world.getTileEntity(x - 1, y, z), (IInventory) tileEntity); + if(world.getBlock(x + 1, y, z) == chestBlock) + return new InventoryLargeChest("Large chest", (IInventory) tileEntity, (IInventory) world.getTileEntity(x + 1, y, z)); + if(world.getBlock(x, y, z - 1) == chestBlock) + return new InventoryLargeChest("Large chest", (IInventory) world.getTileEntity(x, y, z - 1), (IInventory) tileEntity); + if(world.getBlock(x, y, z + 1) == chestBlock) + return new InventoryLargeChest("Large chest", (IInventory) tileEntity, (IInventory) world.getTileEntity(x, y, z + 1)); + } + return tileEntity instanceof IInventory ? (IInventory) tileEntity : null; + } - public static IInventory getInventory(World world, int x, int y, int z, ForgeDirection direction) { - if(direction != null && direction != ForgeDirection.UNKNOWN) { - x += direction.offsetX; - y += direction.offsetY; - z += direction.offsetZ; - } - return getInventory(world, x, y, z); + public static IInventory getInventory(World world, int x, int y, int z, ForgeDirection direction) { + if(direction != null && direction != ForgeDirection.UNKNOWN) { + x += direction.offsetX; + y += direction.offsetY; + z += direction.offsetZ; + } + return getInventory(world, x, y, z); - } + } - public static IInventory getInventory(IInventory inventory) { - if(inventory instanceof TileEntityChest) { - TileEntity te = (TileEntity)inventory; - return getInventory(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord); - } - return inventory; - } + public static IInventory getInventory(IInventory inventory) { + if(inventory instanceof TileEntityChest) { + TileEntity te = (TileEntity) inventory; + return getInventory(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord); + } + return inventory; + } - public static class GenericInventory implements IInventory { + public static class GenericInventory implements IInventory { - protected String inventoryTitle; - protected int slotsCount; - protected ItemStack[] inventoryContents; - protected boolean isInvNameLocalized; + protected String inventoryTitle; + protected int slotsCount; + protected ItemStack[] inventoryContents; + protected boolean isInvNameLocalized; - public GenericInventory(String name, boolean isInvNameLocalized, int size) { - this.isInvNameLocalized = isInvNameLocalized; - slotsCount = size; - inventoryTitle = name; - inventoryContents = new ItemStack[size]; - } + public GenericInventory(String name, boolean isInvNameLocalized, int size) { + this.isInvNameLocalized = isInvNameLocalized; + slotsCount = size; + inventoryTitle = name; + inventoryContents = new ItemStack[size]; + } - @Override - public ItemStack decrStackSize(int par1, int par2) { - if(inventoryContents[par1] != null) { - ItemStack itemstack; + @Override + public ItemStack decrStackSize(int par1, int par2) { + if(inventoryContents[par1] != null) { + ItemStack itemstack; - if(inventoryContents[par1].stackSize <= par2) { - itemstack = inventoryContents[par1]; - inventoryContents[par1] = null; - return itemstack; - } + if(inventoryContents[par1].stackSize <= par2) { + itemstack = inventoryContents[par1]; + inventoryContents[par1] = null; + return itemstack; + } - itemstack = inventoryContents[par1].splitStack(par2); - if(inventoryContents[par1].stackSize == 0) - inventoryContents[par1] = null; + itemstack = inventoryContents[par1].splitStack(par2); + if(inventoryContents[par1].stackSize == 0) inventoryContents[par1] = null; - return itemstack; - } - return null; - } + return itemstack; + } + return null; + } - @Override - public int getInventoryStackLimit() { - return 64; - } + @Override + public int getInventoryStackLimit() { + return 64; + } - @Override - public int getSizeInventory() { - return slotsCount; - } + @Override + public int getSizeInventory() { + return slotsCount; + } - @Override - public ItemStack getStackInSlot(int i) { - return inventoryContents[i]; - } + @Override + public ItemStack getStackInSlot(int i) { + return inventoryContents[i]; + } - public ItemStack getStackInSlot(Enum i) { - return getStackInSlot(i.ordinal()); - } + public ItemStack getStackInSlot(Enum i) { + return getStackInSlot(i.ordinal()); + } - @Override - public ItemStack getStackInSlotOnClosing(int i) { - if(i >= inventoryContents.length) - return null; + @Override + public ItemStack getStackInSlotOnClosing(int i) { + if(i >= inventoryContents.length) return null; - if(inventoryContents[i] != null) { - ItemStack itemstack = inventoryContents[i]; - inventoryContents[i] = null; - return itemstack; - } + if(inventoryContents[i] != null) { + ItemStack itemstack = inventoryContents[i]; + inventoryContents[i] = null; + return itemstack; + } - return null; - } + return null; + } - public boolean isItem(int slot, Item item) { - return inventoryContents[slot] != null && inventoryContents[slot].getItem() == item; - } + public boolean isItem(int slot, Item item) { + return inventoryContents[slot] != null && inventoryContents[slot].getItem() == item; + } - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return true; - } + @Override + public boolean isItemValidForSlot(int i, ItemStack itemstack) { + return true; + } - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) { - return true; - } + @Override + public boolean isUseableByPlayer(EntityPlayer entityplayer) { + return true; + } - public void clearAndSetSlotCount(int amount) { - slotsCount = amount; - inventoryContents = new ItemStack[amount]; - } + public void clearAndSetSlotCount(int amount) { + slotsCount = amount; + inventoryContents = new ItemStack[amount]; + } - public void readFromNBT(NBTTagCompound tag) { - if(tag.hasKey("size")) - slotsCount = tag.getInteger("size"); + public void readFromNBT(NBTTagCompound tag) { + if(tag.hasKey("size")) slotsCount = tag.getInteger("size"); - NBTTagList nbttaglist = tag.getTagList("Items", 10); - inventoryContents = new ItemStack[slotsCount]; - for(int i = 0; i < nbttaglist.tagCount(); i++) { - NBTTagCompound stacktag = (NBTTagCompound)nbttaglist.getCompoundTagAt(i); - int j = stacktag.getByte("Slot"); - if(j >= 0 && j < inventoryContents.length) - inventoryContents[j] = ItemStack.loadItemStackFromNBT(stacktag); - } - } + NBTTagList nbttaglist = tag.getTagList("Items", 10); + inventoryContents = new ItemStack[slotsCount]; + for(int i = 0; i < nbttaglist.tagCount(); i++) { + NBTTagCompound stacktag = (NBTTagCompound) nbttaglist.getCompoundTagAt(i); + int j = stacktag.getByte("Slot"); + if(j >= 0 && j < inventoryContents.length) + inventoryContents[j] = ItemStack.loadItemStackFromNBT(stacktag); + } + } - @Override - public void setInventorySlotContents(int i, ItemStack itemstack) { - inventoryContents[i] = itemstack; + @Override + public void setInventorySlotContents(int i, ItemStack itemstack) { + inventoryContents[i] = itemstack; - if(itemstack != null && itemstack.stackSize > getInventoryStackLimit()) - itemstack.stackSize = getInventoryStackLimit(); - } + if(itemstack != null && itemstack.stackSize > getInventoryStackLimit()) + itemstack.stackSize = getInventoryStackLimit(); + } - public void writeToNBT(NBTTagCompound tag) { - tag.setInteger("size", getSizeInventory()); - NBTTagList nbttaglist = new NBTTagList(); - for(int i = 0; i < inventoryContents.length; i++) { - if(inventoryContents[i] != null) { - NBTTagCompound stacktag = new NBTTagCompound(); - stacktag.setByte("Slot", (byte)i); - inventoryContents[i].writeToNBT(stacktag); - nbttaglist.appendTag(stacktag); - } - } - tag.setTag("Items", nbttaglist); - } + public void writeToNBT(NBTTagCompound tag) { + tag.setInteger("size", getSizeInventory()); + NBTTagList nbttaglist = new NBTTagList(); + for(int i = 0; i < inventoryContents.length; i++) { + if(inventoryContents[i] != null) { + NBTTagCompound stacktag = new NBTTagCompound(); + stacktag.setByte("Slot", (byte) i); + inventoryContents[i].writeToNBT(stacktag); + nbttaglist.appendTag(stacktag); + } + } + tag.setTag("Items", nbttaglist); + } - public void copyFrom(IInventory inventory) { - for(int i = 0; i < inventory.getSizeInventory(); i++) - if(i < getSizeInventory()) { - ItemStack stack = inventory.getStackInSlot(i); - if(stack != null) - setInventorySlotContents(i, stack.copy()); - else setInventorySlotContents(i, null); - } - } + public void copyFrom(IInventory inventory) { + for(int i = 0; i < inventory.getSizeInventory(); i++) + if(i < getSizeInventory()) { + ItemStack stack = inventory.getStackInSlot(i); + if(stack != null) setInventorySlotContents(i, stack.copy()); + else setInventorySlotContents(i, null); + } + } - public List contents() { - return Arrays.asList(inventoryContents); - } + public List contents() { + return Arrays.asList(inventoryContents); + } - @Override - public String getInventoryName() { - return null; - } + @Override + public String getInventoryName() { + return null; + } - @Override - public boolean hasCustomInventoryName() { - return false; - } + @Override + public boolean hasCustomInventoryName() { + return false; + } - @Override - public void markDirty() { } + @Override + public void markDirty() { + } - @Override - public void openInventory() { } + @Override + public void openInventory() { + } - @Override - public void closeInventory() { } - } + @Override + public void closeInventory() { + } + } } diff --git a/MODSRC/vazkii/botania/common/core/helper/ItemNBTHelper.java b/MODSRC/vazkii/botania/common/core/helper/ItemNBTHelper.java index ecba266a6..878f9bd63 100644 --- a/MODSRC/vazkii/botania/common/core/helper/ItemNBTHelper.java +++ b/MODSRC/vazkii/botania/common/core/helper/ItemNBTHelper.java @@ -19,113 +19,122 @@ 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(); - } + /** + * 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()); - } + /** + * 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); - } + /** + * 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(); - } + /** + * 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 /////////////////////////////////////////////////////////////////// + // SETTERS /////////////////////////////////////////////////////////////////// - public static void setBoolean(ItemStack stack, String tag, boolean b) { - getNBT(stack).setBoolean(tag, b); - } + 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 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 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 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 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 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 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).setTag(tag, cmp); - } + public static void setCompound(ItemStack stack, String tag, NBTTagCompound cmp) { + if(!tag.equalsIgnoreCase("ench")) // not override the enchantments + getNBT(stack).setTag(tag, cmp); + } - public static void setString(ItemStack stack, String tag, String s) { - getNBT(stack).setString(tag, s); - } + public static void setString(ItemStack stack, String tag, String s) { + getNBT(stack).setString(tag, s); + } - // GETTERS /////////////////////////////////////////////////////////////////// + // GETTERS /////////////////////////////////////////////////////////////////// - public static boolean verifyExistance(ItemStack stack, String tag) { - return getNBT(stack).hasKey(tag); - } + 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 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 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 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 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 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 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; - } + 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(); - } + /** + * 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; - } + public static String getString(ItemStack stack, String tag, String defaultExpected) { + return verifyExistance(stack, tag) ? getNBT(stack).getString(tag) : defaultExpected; + } } diff --git a/MODSRC/vazkii/botania/common/core/helper/MathHelper.java b/MODSRC/vazkii/botania/common/core/helper/MathHelper.java index a6ce2ef19..31654125b 100644 --- a/MODSRC/vazkii/botania/common/core/helper/MathHelper.java +++ b/MODSRC/vazkii/botania/common/core/helper/MathHelper.java @@ -2,11 +2,11 @@ * This class was created by . 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 22, 2014, 5:49:50 PM (GMT)] */ package vazkii.botania.common.core.helper; @@ -15,20 +15,19 @@ import net.minecraft.entity.Entity; public final class MathHelper { - public static float pointDistanceSpace(double x1, double y1, double z1, double x2, double y2, double z2) { - return (float) Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2) + Math.pow(z1 - z2, 2)); - } + public static float pointDistanceSpace(double x1, double y1, double z1, double x2, double y2, double z2) { + return (float) Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2) + Math.pow(z1 - z2, 2)); + } - public static void setEntityMotionFromVector(Entity entity, Vector3 originalPosVector, float modifier) { - Vector3 entityVector = Vector3.fromEntityCenter(entity); - Vector3 finalVector = originalPosVector.copy().subtract(entityVector); + public static void setEntityMotionFromVector(Entity entity, Vector3 originalPosVector, float modifier) { + Vector3 entityVector = Vector3.fromEntityCenter(entity); + Vector3 finalVector = originalPosVector.copy().subtract(entityVector); - if(finalVector.mag() > 1) - finalVector.normalize(); + if(finalVector.mag() > 1) finalVector.normalize(); + + entity.motionX = finalVector.x * modifier; + entity.motionY = finalVector.y * modifier; + entity.motionZ = finalVector.z * modifier; + } - entity.motionX = finalVector.x * modifier; - entity.motionY = finalVector.y * modifier; - entity.motionZ = finalVector.z * modifier; - } - } diff --git a/MODSRC/vazkii/botania/common/core/helper/ObfuscationHelper.java b/MODSRC/vazkii/botania/common/core/helper/ObfuscationHelper.java index f158a2443..d4bbf92ac 100644 --- a/MODSRC/vazkii/botania/common/core/helper/ObfuscationHelper.java +++ b/MODSRC/vazkii/botania/common/core/helper/ObfuscationHelper.java @@ -2,23 +2,23 @@ * This class was created by . 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 17, 2014, 4:52:37 PM (GMT)] */ package vazkii.botania.common.core.helper; +import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.client.particle.EffectRenderer; import net.minecraft.util.ResourceLocation; import vazkii.botania.common.lib.LibObfuscation; -import cpw.mods.fml.relauncher.ReflectionHelper; public class ObfuscationHelper { - public static ResourceLocation getParticleTexture() { - return ReflectionHelper.getPrivateValue(EffectRenderer.class, null, LibObfuscation.PARTICLE_TEXTURES); - } + public static ResourceLocation getParticleTexture() { + return ReflectionHelper.getPrivateValue(EffectRenderer.class, null, LibObfuscation.PARTICLE_TEXTURES); + } } diff --git a/MODSRC/vazkii/botania/common/core/helper/Quat.java b/MODSRC/vazkii/botania/common/core/helper/Quat.java index d17bba0a4..184eb179f 100644 --- a/MODSRC/vazkii/botania/common/core/helper/Quat.java +++ b/MODSRC/vazkii/botania/common/core/helper/Quat.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [? (GMT)] */ package vazkii.botania.common.core.helper; @@ -16,107 +16,107 @@ import java.util.Locale; public class Quat { - public double x; - public double y; - public double z; - public double s; + public double x; + public double y; + public double z; + public double s; - public Quat() { - s = 1.0D; - x = 0.0D; - y = 0.0D; - z = 0.0D; - } + public Quat() { + s = 1.0D; + x = 0.0D; + y = 0.0D; + z = 0.0D; + } - public Quat(Quat quat) { - x = quat.x; - y = quat.y; - z = quat.z; - s = quat.s; - } + public Quat(Quat quat) { + x = quat.x; + y = quat.y; + z = quat.z; + s = quat.s; + } - public Quat(double d, double d1, double d2, double d3) { - x = d1; - y = d2; - z = d3; - s = d; - } + public Quat(double d, double d1, double d2, double d3) { + x = d1; + y = d2; + z = d3; + s = d; + } - public void set(Quat quat) { - x = quat.x; - y = quat.y; - z = quat.z; - s = quat.s; - } + public void set(Quat quat) { + x = quat.x; + y = quat.y; + z = quat.z; + s = quat.s; + } - public static Quat aroundAxis(double ax, double ay, double az, double angle) { - angle *= 0.5D; - double d4 = Math.sin(angle); - return new Quat(Math.cos(angle), ax * d4, ay * d4, az * d4); - } + public static Quat aroundAxis(double ax, double ay, double az, double angle) { + angle *= 0.5D; + double d4 = Math.sin(angle); + return new Quat(Math.cos(angle), ax * d4, ay * d4, az * d4); + } - public void multiply(Quat quat) { - double d = s * quat.s - x * quat.x - y * quat.y - z * quat.z; - double d1 = s * quat.x + x * quat.s - y * quat.z + z * quat.y; - double d2 = s * quat.y + x * quat.z + y * quat.s - z * quat.x; - double d3 = s * quat.z - x * quat.y + y * quat.x + z * quat.s; - s = d; - x = d1; - y = d2; - z = d3; - } + public void multiply(Quat quat) { + double d = s * quat.s - x * quat.x - y * quat.y - z * quat.z; + double d1 = s * quat.x + x * quat.s - y * quat.z + z * quat.y; + double d2 = s * quat.y + x * quat.z + y * quat.s - z * quat.x; + double d3 = s * quat.z - x * quat.y + y * quat.x + z * quat.s; + s = d; + x = d1; + y = d2; + z = d3; + } - public void rightMultiply(Quat quat) { - double d = s * quat.s - x * quat.x - y * quat.y - z * quat.z; - double d1 = s * quat.x + x * quat.s + y * quat.z - z * quat.y; - double d2 = s * quat.y - x * quat.z + y * quat.s + z * quat.x; - double d3 = s * quat.z + x * quat.y - y * quat.x + z * quat.s; - s = d; - x = d1; - y = d2; - z = d3; - } + public void rightMultiply(Quat quat) { + double d = s * quat.s - x * quat.x - y * quat.y - z * quat.z; + double d1 = s * quat.x + x * quat.s + y * quat.z - z * quat.y; + double d2 = s * quat.y - x * quat.z + y * quat.s + z * quat.x; + double d3 = s * quat.z + x * quat.y - y * quat.x + z * quat.s; + s = d; + x = d1; + y = d2; + z = d3; + } - public double mag() { - return Math.sqrt(x * x + y * y + z * z + s * s); - } + public double mag() { + return Math.sqrt(x * x + y * y + z * z + s * s); + } - public void normalize() { - double d = mag(); - if (d == 0.0D) { - return; - } else { - d = 1.0D / d; - x *= d; - y *= d; - z *= d; - s *= d; - return; - } - } + public void normalize() { + double d = mag(); + if(d == 0.0D) { + return; + } else { + d = 1.0D / d; + x *= d; + y *= d; + z *= d; + s *= d; + return; + } + } - public void rotate(Vector3 vec) { - double d = -x * vec.x - y * vec.y - z * vec.z; - double d1 = s * vec.x + y * vec.z - z * vec.y; - double d2 = s * vec.y - x * vec.z + z * vec.x; - double d3 = s * vec.z + x * vec.y - y * vec.x; - vec.x = d1 * s - d * x - d2 * z + d3 * y; - vec.y = d2 * s - d * y + d1 * z - d3 * x; - vec.z = d3 * s - d * z - d1 * y + d2 * x; - } + public void rotate(Vector3 vec) { + double d = -x * vec.x - y * vec.y - z * vec.z; + double d1 = s * vec.x + y * vec.z - z * vec.y; + double d2 = s * vec.y - x * vec.z + z * vec.x; + double d3 = s * vec.z + x * vec.y - y * vec.x; + vec.x = d1 * s - d * x - d2 * z + d3 * y; + vec.y = d2 * s - d * y + d1 * z - d3 * x; + vec.z = d3 * s - d * z - d1 * y + d2 * x; + } - @Override - public String toString() { - StringBuilder stringbuilder = new StringBuilder(); - Formatter formatter = new Formatter(stringbuilder, Locale.US); - formatter.format("Quaternion:\n", new Object[0]); - formatter.format(" < %f %f %f %f >\n", Double.valueOf(s), Double.valueOf(x), Double.valueOf(y), Double.valueOf(z)); - formatter.close(); - return stringbuilder.toString(); - } + @Override + public String toString() { + StringBuilder stringbuilder = new StringBuilder(); + Formatter formatter = new Formatter(stringbuilder, Locale.US); + formatter.format("Quaternion:\n", new Object[0]); + formatter.format(" < %f %f %f %f >\n", Double.valueOf(s), Double.valueOf(x), Double.valueOf(y), Double.valueOf(z)); + formatter.close(); + return stringbuilder.toString(); + } - public static Quat aroundAxis(Vector3 axis, double angle) { - return aroundAxis(axis.x, axis.y, axis.z, angle); - } + public static Quat aroundAxis(Vector3 axis, double angle) { + return aroundAxis(axis.x, axis.y, axis.z, angle); + } } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/common/core/helper/Vector3.java b/MODSRC/vazkii/botania/common/core/helper/Vector3.java index ac9ec6da7..0195e2ba1 100644 --- a/MODSRC/vazkii/botania/common/core/helper/Vector3.java +++ b/MODSRC/vazkii/botania/common/core/helper/Vector3.java @@ -2,297 +2,289 @@ * This class was created by . 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 @ [? (GMT)] */ package vazkii.botania.common.core.helper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.entity.Entity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Vec3; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.vector.Vector3f; +import org.lwjgl.util.vector.Vector4f; + import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Vec3; +public class Vector3 { + public static Vector3 zero = new Vector3(); + public static Vector3 one = new Vector3(1, 1, 1); + public static Vector3 center = new Vector3(0.5, 0.5, 0.5); -import org.lwjgl.opengl.GL11; -import org.lwjgl.util.vector.Vector3f; -import org.lwjgl.util.vector.Vector4f; + public double x; + public double y; + public double z; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + public Vector3() { + } -public class Vector3 -{ - public static Vector3 zero = new Vector3(); - public static Vector3 one = new Vector3(1, 1, 1); - public static Vector3 center = new Vector3(0.5, 0.5, 0.5); + public Vector3(double d, double d1, double d2) { + x = d; + y = d1; + z = d2; + } - public double x; - public double y; - public double z; + public Vector3(Vector3 vec) { + x = vec.x; + y = vec.y; + z = vec.z; + } - public Vector3() { - } + public Vector3(Vec3 vec) { + x = vec.xCoord; + y = vec.yCoord; + z = vec.zCoord; + } - public Vector3(double d, double d1, double d2) { - x = d; - y = d1; - z = d2; - } + public Vector3 copy() { + return new Vector3(this); + } - public Vector3(Vector3 vec) { - x = vec.x; - y = vec.y; - z = vec.z; - } + public static Vector3 fromEntity(Entity e) { + return new Vector3(e.posX, e.posY, e.posZ); + } - public Vector3(Vec3 vec) { - x = vec.xCoord; - y = vec.yCoord; - z = vec.zCoord; - } + public static Vector3 fromEntityCenter(Entity e) { + return new Vector3(e.posX, e.posY - e.yOffset + e.height / 2, e.posZ); + } - public Vector3 copy() { - return new Vector3(this); - } + public static Vector3 fromTileEntity(TileEntity e) { + return new Vector3(e.xCoord, e.yCoord, e.zCoord); + } - public static Vector3 fromEntity(Entity e) { - return new Vector3(e.posX, e.posY, e.posZ); - } + public static Vector3 fromTileEntityCenter(TileEntity e) { + return new Vector3(e.xCoord + 0.5, e.yCoord + 0.5, e.zCoord + 0.5); + } - public static Vector3 fromEntityCenter(Entity e) { - return new Vector3(e.posX, e.posY - e.yOffset + e.height / 2, e.posZ); - } + public Vector3 set(double d, double d1, double d2) { + x = d; + y = d1; + z = d2; + return this; + } - public static Vector3 fromTileEntity(TileEntity e) { - return new Vector3(e.xCoord, e.yCoord, e.zCoord); - } + public Vector3 set(Vector3 vec) { + x = vec.x; + y = vec.y; + z = vec.z; + return this; + } - public static Vector3 fromTileEntityCenter(TileEntity e) { - return new Vector3(e.xCoord + 0.5, e.yCoord + 0.5, e.zCoord + 0.5); - } + public double dotProduct(Vector3 vec) { + double d = vec.x * x + vec.y * y + vec.z * z; - public Vector3 set(double d, double d1, double d2) { - x = d; - y = d1; - z = d2; - return this; - } + if(d > 1 && d < 1.00001) d = 1; + else if(d < -1 && d > -1.00001) d = -1; + return d; + } - public Vector3 set(Vector3 vec) { - x = vec.x; - y = vec.y; - z = vec.z; - return this; - } + public double dotProduct(double d, double d1, double d2) { + return d * x + d1 * y + d2 * z; + } - public double dotProduct(Vector3 vec) { - double d = vec.x * x + vec.y * y + vec.z * z; + public Vector3 crossProduct(Vector3 vec) { + double d = y * vec.z - z * vec.y; + double d1 = z * vec.x - x * vec.z; + double d2 = x * vec.y - y * vec.x; + x = d; + y = d1; + z = d2; + return this; + } - if(d > 1 && d < 1.00001) - d = 1; - else if(d < -1 && d > -1.00001) - d = -1; - return d; - } + public Vector3 add(double d, double d1, double d2) { + x += d; + y += d1; + z += d2; + return this; + } - public double dotProduct(double d, double d1, double d2) { - return d * x + d1 * y + d2 * z; - } + public Vector3 add(Vector3 vec) { + x += vec.x; + y += vec.y; + z += vec.z; + return this; + } - public Vector3 crossProduct(Vector3 vec) { - double d = y * vec.z - z * vec.y; - double d1 = z * vec.x - x * vec.z; - double d2 = x * vec.y - y * vec.x; - x = d; - y = d1; - z = d2; - return this; - } + public Vector3 add(double d) { + return add(d, d, d); + } - public Vector3 add(double d, double d1, double d2) { - x += d; - y += d1; - z += d2; - return this; - } + public Vector3 sub(Vector3 vec) { + return subtract(vec); + } - public Vector3 add(Vector3 vec) { - x += vec.x; - y += vec.y; - z += vec.z; - return this; - } + public Vector3 subtract(Vector3 vec) { + x -= vec.x; + y -= vec.y; + z -= vec.z; + return this; + } - public Vector3 add(double d) { - return add(d, d, d); - } + public Vector3 negate(Vector3 vec) { + x = -x; + y = -y; + z = -z; + return this; + } - public Vector3 sub(Vector3 vec) { - return subtract(vec); - } + public Vector3 multiply(double d) { + x *= d; + y *= d; + z *= d; + return this; + } - public Vector3 subtract(Vector3 vec) { - x -= vec.x; - y -= vec.y; - z -= vec.z; - return this; - } + public Vector3 multiply(Vector3 f) { + x *= f.x; + y *= f.y; + z *= f.z; + return this; + } - public Vector3 negate(Vector3 vec) { - x = -x; - y = -y; - z = -z; - return this; - } + public Vector3 multiply(double fx, double fy, double fz) { + x *= fx; + y *= fy; + z *= fz; + return this; + } - public Vector3 multiply(double d) { - x *= d; - y *= d; - z *= d; - return this; - } + public double mag() { + return Math.sqrt(x * x + y * y + z * z); + } - public Vector3 multiply(Vector3 f) { - x *= f.x; - y *= f.y; - z *= f.z; - return this; - } + public double magSquared() { + return x * x + y * y + z * z; + } - public Vector3 multiply(double fx, double fy, double fz) { - x *= fx; - y *= fy; - z *= fz; - return this; - } + public Vector3 normalize() { + double d = mag(); + if(d != 0) multiply(1 / d); - public double mag() { - return Math.sqrt(x * x + y * y + z * z); - } + return this; + } - public double magSquared() { - return x * x + y * y + z * z; - } + @Override + public String toString() { + MathContext cont = new MathContext(4, RoundingMode.HALF_UP); + return "Vector3(" + new BigDecimal(x, cont) + ", " + new BigDecimal(y, cont) + ", " + new BigDecimal(z, cont) + ")"; + } - public Vector3 normalize() { - double d = mag(); - if(d != 0) - multiply(1 / d); + public Vector3 perpendicular() { + if(z == 0) return zCrossProduct(); + return xCrossProduct(); + } - return this; - } + public Vector3 xCrossProduct() { + double d = z; + double d1 = -y; + x = 0; + y = d; + z = d1; + return this; + } - @Override - public String toString() { - MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "Vector3(" + new BigDecimal(x, cont) + ", " +new BigDecimal(y, cont) + ", " + new BigDecimal(z, cont) + ")"; - } + public Vector3 zCrossProduct() { + double d = y; + double d1 = -x; + x = d; + y = d1; + z = 0; + return this; + } - public Vector3 perpendicular() { - if(z == 0) - return zCrossProduct(); - return xCrossProduct(); - } + public Vector3 yCrossProduct() { + double d = -z; + double d1 = x; + x = d; + y = 0; + z = d1; + return this; + } - public Vector3 xCrossProduct() { - double d = z; - double d1 = -y; - x = 0; - y = d; - z = d1; - return this; - } + public Vec3 toVec3D() { + return Vec3.createVectorHelper(x, y, z); + } - public Vector3 zCrossProduct() { - double d = y; - double d1 = -x; - x = d; - y = d1; - z = 0; - return this; - } + public double angle(Vector3 vec) { + return Math.acos(copy().normalize().dotProduct(vec.copy().normalize())); + } - public Vector3 yCrossProduct() { - double d = -z; - double d1 = x; - x = d; - y = 0; - z = d1; - return this; - } + public boolean isZero() { + return x == 0 && y == 0 && z == 0; + } - public Vec3 toVec3D() { - return Vec3.createVectorHelper(x, y, z); - } + public boolean isAxial() { + return x == 0 ? y == 0 || z == 0 : y == 0 && z == 0; + } - public double angle(Vector3 vec) { - return Math.acos(copy().normalize().dotProduct(vec.copy().normalize())); - } + @SideOnly(Side.CLIENT) + public Vector3f vector3f() { + return new Vector3f((float) x, (float) y, (float) z); + } - public boolean isZero() { - return x == 0 && y == 0 && z == 0; - } + @SideOnly(Side.CLIENT) + public Vector4f vector4f() { + return new Vector4f((float) x, (float) y, (float) z, 1); + } - public boolean isAxial() { - return x == 0 ? y == 0 || z == 0 : y == 0 && z == 0; - } + @SideOnly(Side.CLIENT) + public void glVertex() { + GL11.glVertex3d(x, y, z); + } - @SideOnly(Side.CLIENT) - public Vector3f vector3f() { - return new Vector3f((float)x, (float)y, (float)z); - } + public Vector3 negate() { + x = -x; + y = -y; + z = -z; + return this; + } - @SideOnly(Side.CLIENT) - public Vector4f vector4f() { - return new Vector4f((float)x, (float)y, (float)z, 1); - } + public double scalarProject(Vector3 b) { + double l = b.mag(); + return l == 0 ? 0 : dotProduct(b) / l; + } - @SideOnly(Side.CLIENT) - public void glVertex() { - GL11.glVertex3d(x, y, z); - } + public Vector3 project(Vector3 b) { + double l = b.magSquared(); + if(l == 0) { + set(0, 0, 0); + return this; + } - public Vector3 negate() { - x = -x; - y = -y; - z = -z; - return this; - } + double m = dotProduct(b) / l; + set(b).multiply(m); + return this; + } - public double scalarProject(Vector3 b) { - double l = b.mag(); - return l == 0 ? 0 : dotProduct(b)/l; - } + public Vector3 rotate(double angle, Vector3 axis) { + Quat.aroundAxis(axis.copy().normalize(), angle).rotate(this); + return this; + } - public Vector3 project(Vector3 b) { - double l = b.magSquared(); - if(l == 0) { - set(0, 0, 0); - return this; - } + @Override + public boolean equals(Object o) { + if(!(o instanceof Vector3)) return false; - double m = dotProduct(b)/l; - set(b).multiply(m); - return this; - } - - public Vector3 rotate(double angle, Vector3 axis) { - Quat.aroundAxis(axis.copy().normalize(), angle).rotate(this); - return this; - } - - @Override - public boolean equals(Object o) { - if(!(o instanceof Vector3)) - return false; - - Vector3 v = (Vector3)o; - return x == v.x && y == v.y && z == v.z; - } + Vector3 v = (Vector3) o; + return x == v.x && y == v.y && z == v.z; + } } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java b/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java index 107aa2217..5b449e397 100644 --- a/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java +++ b/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java @@ -2,15 +2,20 @@ * This class was created by . 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 13, 2014, 7:45:37 PM (GMT)] */ package vazkii.botania.common.core.proxy; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.network.NetworkRegistry; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; @@ -18,12 +23,7 @@ import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.common.Botania; import vazkii.botania.common.block.ModBlocks; -import vazkii.botania.common.core.handler.BiomeDecorationHandler; -import vazkii.botania.common.core.handler.CommonTickHandler; -import vazkii.botania.common.core.handler.ConfigHandler; -import vazkii.botania.common.core.handler.InternalMethodHandler; -import vazkii.botania.common.core.handler.ManaNetworkHandler; -import vazkii.botania.common.core.handler.TerrasteelCraftingHandler; +import vazkii.botania.common.core.handler.*; import vazkii.botania.common.core.helper.Vector3; import vazkii.botania.common.crafting.ModCrafingRecipes; import vazkii.botania.common.crafting.ModManaInfusionRecipes; @@ -33,90 +33,85 @@ import vazkii.botania.common.entity.ModEntities; import vazkii.botania.common.item.ModItems; import vazkii.botania.common.lexicon.LexiconData; import vazkii.botania.common.network.GuiHandler; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.network.NetworkRegistry; public class CommonProxy { - public void preInit(FMLPreInitializationEvent event) { - BotaniaAPI.internalHandler = new InternalMethodHandler(); + public void preInit(FMLPreInitializationEvent event) { + BotaniaAPI.internalHandler = new InternalMethodHandler(); - ConfigHandler.loadConfig(event.getSuggestedConfigurationFile()); + ConfigHandler.loadConfig(event.getSuggestedConfigurationFile()); - ModBlocks.init(); - ModItems.init(); - ModEntities.init(); + ModBlocks.init(); + ModItems.init(); + ModEntities.init(); - ModCrafingRecipes.init(); - ModPetalRecipes.init(); - ModRuneRecipes.init(); - ModManaInfusionRecipes.init(); + ModCrafingRecipes.init(); + ModPetalRecipes.init(); + ModRuneRecipes.init(); + ModManaInfusionRecipes.init(); - LexiconData.init(); - } + LexiconData.init(); + } - public void init(FMLInitializationEvent event) { - NetworkRegistry.INSTANCE.registerGuiHandler(Botania.instance, new GuiHandler()); + public void init(FMLInitializationEvent event) { + NetworkRegistry.INSTANCE.registerGuiHandler(Botania.instance, new GuiHandler()); - MinecraftForge.TERRAIN_GEN_BUS.register(new BiomeDecorationHandler()); - MinecraftForge.EVENT_BUS.register(ManaNetworkHandler.instance); - - FMLCommonHandler.instance().bus().register(new CommonTickHandler()); - } + MinecraftForge.TERRAIN_GEN_BUS.register(new BiomeDecorationHandler()); + MinecraftForge.EVENT_BUS.register(ManaNetworkHandler.instance); - public void postInit(FMLPostInitializationEvent event) { + FMLCommonHandler.instance().bus().register(new CommonTickHandler()); + } - } + public void postInit(FMLPostInitializationEvent event) { - public void setEntryToOpen(LexiconEntry entry) { - // NO-OP - } + } - public long getWorldElapsedTicks() { - return MinecraftServer.getServer().worldServers[0].getTotalWorldTime(); - } + public void setEntryToOpen(LexiconEntry entry) { + // NO-OP + } - public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) { - sparkleFX(world, x, y, z, r, g, b, size, m, false); - } + public long getWorldElapsedTicks() { + return MinecraftServer.getServer().worldServers[0].getTotalWorldTime(); + } - public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) { - // NO-OP - } + public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) { + sparkleFX(world, x, y, z, r, g, b, size, m, false); + } - public void setWispFXDistanceLimit(boolean limit) { - // NO-OP - } + public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) { + // NO-OP + } - public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size) { - wispFX(world, x, y, z, r, g, b, size, 0F); - } + public void setWispFXDistanceLimit(boolean limit) { + // NO-OP + } - public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float gravity) { - wispFX(world, x, y, z, r, gravity, b, size, gravity, 1F); - } - - public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float gravity, float maxAgeMul) { - wispFX(world, x, y, z, r, g, b, size, 0, -gravity, 0, maxAgeMul); - } + public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size) { + wispFX(world, x, y, z, r, g, b, size, 0F); + } - public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz) { - wispFX(world, x, y, z, r, g, b, size, motionx, motiony, motionz, 1F); - } - - public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz, float maxAgeMul) { - // NO-OP - } + public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float gravity) { + wispFX(world, x, y, z, r, gravity, b, size, gravity, 1F); + } - public void lightningFX(World world, Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, int colorOuter, int colorInner) { - lightningFX(world, vectorStart, vectorEnd, ticksPerMeter, System.nanoTime(), colorOuter, colorInner); - } + public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float gravity, float maxAgeMul) { + wispFX(world, x, y, z, r, g, b, size, 0, -gravity, 0, maxAgeMul); + } - public void lightningFX(World world, Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) { - // NO-OP - } + public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz) { + wispFX(world, x, y, z, r, g, b, size, motionx, motiony, motionz, 1F); + } + + public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz, float maxAgeMul) { + // NO-OP + } + + public void lightningFX(World world, Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, int colorOuter, int colorInner) { + lightningFX(world, vectorStart, vectorEnd, ticksPerMeter, System.nanoTime(), colorOuter, colorInner); + } + + public void lightningFX(World world, Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) { + // NO-OP + } } diff --git a/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java b/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java index bfc4fb511..0f02c380c 100644 --- a/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java +++ b/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java @@ -2,22 +2,18 @@ * This class was created by . 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 19, 2014, 3:54:48 PM (GMT)] */ package vazkii.botania.common.crafting; -import java.util.List; - import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; @@ -31,439 +27,308 @@ import vazkii.botania.common.item.ItemTwigWand; import vazkii.botania.common.item.ModItems; import vazkii.botania.common.lib.LibOreDict; +import java.util.List; + public final class ModCrafingRecipes { - public static IRecipe recipeLexicon; - public static List recipesPetals; - public static List recipesDyes; - public static IRecipe recipePestleAndMortar; - public static List recipesTwigWand; - public static List recipesApothecary; - public static List recipesSpreader; - public static IRecipe recipeManaLens; - public static List recipesLensDying; - public static IRecipe recipeRainbowLens; - public static IRecipe recipePool; - public static List recipesRuneAltar; - public static IRecipe recipeLensVelocity; - public static IRecipe recipeLensPotency; - public static IRecipe recipeLensResistance; - public static IRecipe recipeLensEfficiency; - public static IRecipe recipeLensBounce; - public static IRecipe recipeLensGravity; - public static IRecipe recipeLensBore; - public static IRecipe recipeLensDamaging; - public static IRecipe recipeLensPhantom; - public static IRecipe recipeLensMagnet; - public static IRecipe recipeLensExplosive; - public static List recipesUnstableBlocks; - public static IRecipe recipePylon; - public static IRecipe recipeDistributor; - public static IRecipe recipeLivingrockDecor1; - public static IRecipe recipeLivingrockDecor2; - public static IRecipe recipeLivingrockDecor3; - public static IRecipe recipeLivingrockDecor4; - public static IRecipe recipeLivingwoodDecor1; - public static IRecipe recipeLivingwoodDecor2; - public static IRecipe recipeLivingwoodDecor3; - public static IRecipe recipeLivingwoodDecor4; - public static IRecipe recipeLivingwoodDecor5; - public static List recipesManaBeacons; - public static List recipesSignalFlares; - public static IRecipe recipeManaVoid; - public static List recipesManaTablet; - public static IRecipe recipeManaDetector; - public static IRecipe recipeManaBlaster; - public static IRecipe recipeTurntable; - public static IRecipe recipeFertilizerPowder; - public static IRecipe recipeFerilizerDye; - public static IRecipe recipeLivingwoodTwig; - public static IRecipe recipeDirtRod; - public static IRecipe recipeTerraformRod; - public static IRecipe recipeRedstoneSpreader; - public static IRecipe recipeManaMirror; - public static IRecipe recipeManasteelHelm; - public static IRecipe recipeManasteelChest; - public static IRecipe recipeManasteelLegs; - public static IRecipe recipeManasteelBoots; - public static IRecipe recipeManasteelPick; - public static IRecipe recipeManasteelShovel; - public static IRecipe recipeManasteelAxe; - public static IRecipe recipeManasteelShears; - public static IRecipe recipeManasteelSword; - public static IRecipe recipeGrassHorn; - public static IRecipe recipeTerrasteelHelm; - public static IRecipe recipeTerrasteelChest; - public static IRecipe recipeTerrasteelLegs; - public static IRecipe recipeTerrasteelBoots; - public static IRecipe recipeTerraSword; + public static IRecipe recipeLexicon; + public static List recipesPetals; + public static List recipesDyes; + public static IRecipe recipePestleAndMortar; + public static List recipesTwigWand; + public static List recipesApothecary; + public static List recipesSpreader; + public static IRecipe recipeManaLens; + public static List recipesLensDying; + public static IRecipe recipeRainbowLens; + public static IRecipe recipePool; + public static List recipesRuneAltar; + public static IRecipe recipeLensVelocity; + public static IRecipe recipeLensPotency; + public static IRecipe recipeLensResistance; + public static IRecipe recipeLensEfficiency; + public static IRecipe recipeLensBounce; + public static IRecipe recipeLensGravity; + public static IRecipe recipeLensBore; + public static IRecipe recipeLensDamaging; + public static IRecipe recipeLensPhantom; + public static IRecipe recipeLensMagnet; + public static IRecipe recipeLensExplosive; + public static List recipesUnstableBlocks; + public static IRecipe recipePylon; + public static IRecipe recipeDistributor; + public static IRecipe recipeLivingrockDecor1; + public static IRecipe recipeLivingrockDecor2; + public static IRecipe recipeLivingrockDecor3; + public static IRecipe recipeLivingrockDecor4; + public static IRecipe recipeLivingwoodDecor1; + public static IRecipe recipeLivingwoodDecor2; + public static IRecipe recipeLivingwoodDecor3; + public static IRecipe recipeLivingwoodDecor4; + public static IRecipe recipeLivingwoodDecor5; + public static List recipesManaBeacons; + public static List recipesSignalFlares; + public static IRecipe recipeManaVoid; + public static List recipesManaTablet; + public static IRecipe recipeManaDetector; + public static IRecipe recipeManaBlaster; + public static IRecipe recipeTurntable; + public static IRecipe recipeFertilizerPowder; + public static IRecipe recipeFerilizerDye; + public static IRecipe recipeLivingwoodTwig; + public static IRecipe recipeDirtRod; + public static IRecipe recipeTerraformRod; + public static IRecipe recipeRedstoneSpreader; + public static IRecipe recipeManaMirror; + public static IRecipe recipeManasteelHelm; + public static IRecipe recipeManasteelChest; + public static IRecipe recipeManasteelLegs; + public static IRecipe recipeManasteelBoots; + public static IRecipe recipeManasteelPick; + public static IRecipe recipeManasteelShovel; + public static IRecipe recipeManasteelAxe; + public static IRecipe recipeManasteelShears; + public static IRecipe recipeManasteelSword; + public static IRecipe recipeGrassHorn; + public static IRecipe recipeTerrasteelHelm; + public static IRecipe recipeTerrasteelChest; + public static IRecipe recipeTerrasteelLegs; + public static IRecipe recipeTerrasteelBoots; + public static IRecipe recipeTerraSword; - public static void init() { - // Lexicon Recipe - addShapelessOreDictRecipe(new ItemStack(ModItems.lexicon), "treeSapling", Items.book); - recipeLexicon = BotaniaAPI.getLatestAddedRecipe(); + public static void init() { + // Lexicon Recipe + addShapelessOreDictRecipe(new ItemStack(ModItems.lexicon), "treeSapling", Items.book); + recipeLexicon = BotaniaAPI.getLatestAddedRecipe(); - // Petal/Dye Recipes - for(int i = 0; i < 16; i++) - addShapelessOreDictRecipe(new ItemStack(ModItems.petal, 2, i), LibOreDict.FLOWER[i]); - recipesPetals = BotaniaAPI.getLatestAddedRecipes(16); + // Petal/Dye Recipes + for(int i = 0; i < 16; i++) + addShapelessOreDictRecipe(new ItemStack(ModItems.petal, 2, i), LibOreDict.FLOWER[i]); + recipesPetals = BotaniaAPI.getLatestAddedRecipes(16); - for(int i = 0; i < 16; i++) - addShapelessOreDictRecipe(new ItemStack(ModItems.dye, 1, i), LibOreDict.PETAL[i], LibOreDict.PESTLE_AND_MORTAR); - recipesDyes = BotaniaAPI.getLatestAddedRecipes(16); + for(int i = 0; i < 16; i++) + addShapelessOreDictRecipe(new ItemStack(ModItems.dye, 1, i), LibOreDict.PETAL[i], LibOreDict.PESTLE_AND_MORTAR); + recipesDyes = BotaniaAPI.getLatestAddedRecipes(16); - // Pestle and Mortar Recipe - addOreDictRecipe(new ItemStack(ModItems.pestleAndMortar), - " S", "W ", "B ", - 'S', "stickWood", - 'W', "plankWood", - 'B', Items.bowl); - recipePestleAndMortar = BotaniaAPI.getLatestAddedRecipe(); + // Pestle and Mortar Recipe + addOreDictRecipe(new ItemStack(ModItems.pestleAndMortar), " S", "W ", "B ", 'S', "stickWood", 'W', "plankWood", 'B', Items.bowl); + 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); + // 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); - // Petal Apothecary Recipes - for(int i = 0; i < 16; i++) - addOreDictRecipe(new ItemStack(ModBlocks.altar), - "SPS", " C ", "CCC", - 'S', new ItemStack(Blocks.stone_slab, 1, 3), - 'P', LibOreDict.PETAL[i], - 'C', "cobblestone"); - recipesApothecary = BotaniaAPI.getLatestAddedRecipes(16); + // Petal Apothecary Recipes + for(int i = 0; i < 16; i++) + addOreDictRecipe(new ItemStack(ModBlocks.altar), "SPS", " C ", "CCC", 'S', new ItemStack(Blocks.stone_slab, 1, 3), 'P', LibOreDict.PETAL[i], 'C', "cobblestone"); + recipesApothecary = BotaniaAPI.getLatestAddedRecipes(16); - // Mana Spreader Recipes - for(int i = 0; i < 16; i++) - addOreDictRecipe(new ItemStack(ModBlocks.spreader), - "WWW", "GP ", "WWW", - 'W', LibOreDict.LIVING_WOOD, - 'P', LibOreDict.PETAL[i], - 'G', "ingotGold"); - recipesSpreader = BotaniaAPI.getLatestAddedRecipes(16); + // Mana Spreader Recipes + for(int i = 0; i < 16; i++) + addOreDictRecipe(new ItemStack(ModBlocks.spreader), "WWW", "GP ", "WWW", 'W', LibOreDict.LIVING_WOOD, 'P', LibOreDict.PETAL[i], 'G', "ingotGold"); + recipesSpreader = BotaniaAPI.getLatestAddedRecipes(16); - // Mana Lens Recipe - addOreDictRecipe(new ItemStack(ModItems.lens), - " S ", "SGS", " S ", - 'S', LibOreDict.MANA_STEEL, - 'G', new ItemStack(Blocks.glass_pane)); - recipeManaLens = BotaniaAPI.getLatestAddedRecipe(); + // Mana Lens Recipe + addOreDictRecipe(new ItemStack(ModItems.lens), " S ", "SGS", " S ", 'S', LibOreDict.MANA_STEEL, 'G', new ItemStack(Blocks.glass_pane)); + recipeManaLens = BotaniaAPI.getLatestAddedRecipe(); - // Mana Lens Dying Recipes - for(int j = 0; j < 16; j++) - addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens), j), new ItemStack(ModItems.lens), LibOreDict.DYE[j]); - recipesLensDying = BotaniaAPI.getLatestAddedRecipes(16); + // Mana Lens Dying Recipes + for(int j = 0; j < 16; j++) + addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens), j), new ItemStack(ModItems.lens), LibOreDict.DYE[j]); + recipesLensDying = BotaniaAPI.getLatestAddedRecipes(16); - for(int i = 1; i < ItemLens.SUBTYPES; i++) - for(int j = 0; j < 16; j++) - addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens, 1, i), j), new ItemStack(ModItems.lens, 1, i), LibOreDict.DYE[j]); + for(int i = 1; i < ItemLens.SUBTYPES; i++) + for(int j = 0; j < 16; j++) + addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens, 1, i), j), new ItemStack(ModItems.lens, 1, i), LibOreDict.DYE[j]); - // Rainbow Lens Recipe - addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens), 16), new ItemStack(ModItems.lens), LibOreDict.MANA_PEARL); - recipeRainbowLens = BotaniaAPI.getLatestAddedRecipe(); - for(int i = 1; i < ItemLens.SUBTYPES; i++) - addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens, 1, i), 16), new ItemStack(ModItems.lens, 1, i), LibOreDict.MANA_PEARL); + // Rainbow Lens Recipe + addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens), 16), new ItemStack(ModItems.lens), LibOreDict.MANA_PEARL); + recipeRainbowLens = BotaniaAPI.getLatestAddedRecipe(); + for(int i = 1; i < ItemLens.SUBTYPES; i++) + addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens, 1, i), 16), new ItemStack(ModItems.lens, 1, i), LibOreDict.MANA_PEARL); - // Mana Pool Recipe - addOreDictRecipe(new ItemStack(ModBlocks.pool), - "R R", "RRR", - 'R', LibOreDict.LIVING_ROCK); - recipePool = BotaniaAPI.getLatestAddedRecipe(); + // Mana Pool Recipe + addOreDictRecipe(new ItemStack(ModBlocks.pool), "R R", "RRR", 'R', LibOreDict.LIVING_ROCK); + recipePool = BotaniaAPI.getLatestAddedRecipe(); - // Runic Altar Recipe - addOreDictRecipe(new ItemStack(ModBlocks.runeAltar), - "SSS", "SPS", - 'S', LibOreDict.LIVING_ROCK, - 'P', LibOreDict.MANA_PEARL); - addOreDictRecipe(new ItemStack(ModBlocks.runeAltar), - "SSS", "SDS", - 'S', LibOreDict.LIVING_ROCK, - 'D', LibOreDict.MANA_DIAMOND); - recipesRuneAltar = BotaniaAPI.getLatestAddedRecipes(2); + // Runic Altar Recipe + addOreDictRecipe(new ItemStack(ModBlocks.runeAltar), "SSS", "SPS", 'S', LibOreDict.LIVING_ROCK, 'P', LibOreDict.MANA_PEARL); + addOreDictRecipe(new ItemStack(ModBlocks.runeAltar), "SSS", "SDS", 'S', LibOreDict.LIVING_ROCK, 'D', LibOreDict.MANA_DIAMOND); + recipesRuneAltar = BotaniaAPI.getLatestAddedRecipes(2); - // Lens Recipes - addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 1), new ItemStack(ModItems.lens), LibOreDict.RUNE[3]); - recipeLensVelocity = BotaniaAPI.getLatestAddedRecipe(); + // Lens Recipes + addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 1), new ItemStack(ModItems.lens), LibOreDict.RUNE[3]); + recipeLensVelocity = BotaniaAPI.getLatestAddedRecipe(); - addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 2), new ItemStack(ModItems.lens), LibOreDict.RUNE[1]); - recipeLensPotency = BotaniaAPI.getLatestAddedRecipe(); + addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 2), new ItemStack(ModItems.lens), LibOreDict.RUNE[1]); + recipeLensPotency = BotaniaAPI.getLatestAddedRecipe(); - addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 3), new ItemStack(ModItems.lens), LibOreDict.RUNE[2]); - recipeLensResistance = BotaniaAPI.getLatestAddedRecipe(); + addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 3), new ItemStack(ModItems.lens), LibOreDict.RUNE[2]); + recipeLensResistance = BotaniaAPI.getLatestAddedRecipe(); - addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 4), new ItemStack(ModItems.lens), LibOreDict.RUNE[0]); - recipeLensEfficiency = BotaniaAPI.getLatestAddedRecipe(); + addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 4), new ItemStack(ModItems.lens), LibOreDict.RUNE[0]); + recipeLensEfficiency = BotaniaAPI.getLatestAddedRecipe(); - addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 5), new ItemStack(ModItems.lens), LibOreDict.RUNE[5]); - recipeLensBounce = BotaniaAPI.getLatestAddedRecipe(); + addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 5), new ItemStack(ModItems.lens), LibOreDict.RUNE[5]); + recipeLensBounce = BotaniaAPI.getLatestAddedRecipe(); - addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 6), new ItemStack(ModItems.lens), LibOreDict.RUNE[7]); - recipeLensGravity = BotaniaAPI.getLatestAddedRecipe(); + addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 6), new ItemStack(ModItems.lens), LibOreDict.RUNE[7]); + recipeLensGravity = BotaniaAPI.getLatestAddedRecipe(); - addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 7), new ItemStack(ModItems.lens), LibOreDict.RUNE[11]); - recipeLensBore = BotaniaAPI.getLatestAddedRecipe(); + addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 7), new ItemStack(ModItems.lens), LibOreDict.RUNE[11]); + recipeLensBore = BotaniaAPI.getLatestAddedRecipe(); - addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 8), new ItemStack(ModItems.lens), LibOreDict.RUNE[13]); - recipeLensDamaging = BotaniaAPI.getLatestAddedRecipe(); + addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 8), new ItemStack(ModItems.lens), LibOreDict.RUNE[13]); + recipeLensDamaging = BotaniaAPI.getLatestAddedRecipe(); - addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 9), new ItemStack(ModItems.lens), new ItemStack(ModBlocks.pistonRelay)); - recipeLensPhantom = BotaniaAPI.getLatestAddedRecipe(); + addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 9), new ItemStack(ModItems.lens), new ItemStack(ModBlocks.pistonRelay)); + recipeLensPhantom = BotaniaAPI.getLatestAddedRecipe(); - addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 10), new ItemStack(ModItems.lens), "ingotIron", "ingotGold"); - recipeLensMagnet = BotaniaAPI.getLatestAddedRecipe(); + addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 10), new ItemStack(ModItems.lens), "ingotIron", "ingotGold"); + recipeLensMagnet = BotaniaAPI.getLatestAddedRecipe(); - addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 11), new ItemStack(ModItems.lens), LibOreDict.RUNE[14]); - recipeLensExplosive = BotaniaAPI.getLatestAddedRecipe(); + addShapelessOreDictRecipe(new ItemStack(ModItems.lens, 1, 11), new ItemStack(ModItems.lens), LibOreDict.RUNE[14]); + recipeLensExplosive = BotaniaAPI.getLatestAddedRecipe(); - // Unstable Block Recipes - for(int i = 0; i < 16; i++) - addOreDictRecipe(new ItemStack(ModBlocks.unstableBlock, 2, i), - "OPO", "PMP", "OPO", - 'O', new ItemStack(Blocks.obsidian), - 'P', LibOreDict.PETAL[i], - 'M', new ItemStack(Items.ender_pearl)); - recipesUnstableBlocks = BotaniaAPI.getLatestAddedRecipes(16); + // Unstable Block Recipes + for(int i = 0; i < 16; i++) + addOreDictRecipe(new ItemStack(ModBlocks.unstableBlock, 2, i), "OPO", "PMP", "OPO", 'O', new ItemStack(Blocks.obsidian), 'P', LibOreDict.PETAL[i], 'M', new ItemStack(Items.ender_pearl)); + recipesUnstableBlocks = BotaniaAPI.getLatestAddedRecipes(16); - // Mana Pylon Recipe - addOreDictRecipe(new ItemStack(ModBlocks.pylon), - " G ", "MDM", " G ", - 'G', "ingotGold", - 'M', LibOreDict.MANA_STEEL, - 'D', LibOreDict.MANA_DIAMOND); - recipePylon = BotaniaAPI.getLatestAddedRecipe(); + // Mana Pylon Recipe + addOreDictRecipe(new ItemStack(ModBlocks.pylon), " G ", "MDM", " G ", 'G', "ingotGold", 'M', LibOreDict.MANA_STEEL, 'D', LibOreDict.MANA_DIAMOND); + recipePylon = BotaniaAPI.getLatestAddedRecipe(); - // Mana Distributor - addOreDictRecipe(new ItemStack(ModBlocks.distributor), - "RRR", "S S", "RRR", - 'R', LibOreDict.LIVING_ROCK, - 'S', LibOreDict.MANA_STEEL); - recipeDistributor = BotaniaAPI.getLatestAddedRecipe(); + // Mana Distributor + addOreDictRecipe(new ItemStack(ModBlocks.distributor), "RRR", "S S", "RRR", 'R', LibOreDict.LIVING_ROCK, 'S', LibOreDict.MANA_STEEL); + recipeDistributor = BotaniaAPI.getLatestAddedRecipe(); - // Livingrock Decorative Blocks - addOreDictRecipe(new ItemStack(ModBlocks.livingrock, 4, 1), - "RR", "RR", - 'R', LibOreDict.LIVING_ROCK); - recipeLivingrockDecor1 = BotaniaAPI.getLatestAddedRecipe(); - addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingrock, 1, 2), new ItemStack(ModBlocks.livingrock, 1, 1), new ItemStack(Items.wheat_seeds)); - recipeLivingrockDecor2 = BotaniaAPI.getLatestAddedRecipe(); - addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingrock, 2, 3), new ItemStack(ModBlocks.livingrock, 1, 1), "cobblestone"); - recipeLivingrockDecor3 = BotaniaAPI.getLatestAddedRecipe(); - addOreDictRecipe(new ItemStack(ModBlocks.livingrock, 4, 4), - "RR", "RR", - 'R', new ItemStack(ModBlocks.livingrock, 1, 1)); - recipeLivingrockDecor4 = BotaniaAPI.getLatestAddedRecipe(); + // Livingrock Decorative Blocks + addOreDictRecipe(new ItemStack(ModBlocks.livingrock, 4, 1), "RR", "RR", 'R', LibOreDict.LIVING_ROCK); + recipeLivingrockDecor1 = BotaniaAPI.getLatestAddedRecipe(); + addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingrock, 1, 2), new ItemStack(ModBlocks.livingrock, 1, 1), new ItemStack(Items.wheat_seeds)); + recipeLivingrockDecor2 = BotaniaAPI.getLatestAddedRecipe(); + addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingrock, 2, 3), new ItemStack(ModBlocks.livingrock, 1, 1), "cobblestone"); + recipeLivingrockDecor3 = BotaniaAPI.getLatestAddedRecipe(); + addOreDictRecipe(new ItemStack(ModBlocks.livingrock, 4, 4), "RR", "RR", 'R', new ItemStack(ModBlocks.livingrock, 1, 1)); + recipeLivingrockDecor4 = BotaniaAPI.getLatestAddedRecipe(); - // Livingwood Decorative Blocks - addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingwood, 4, 1), LibOreDict.LIVING_WOOD); - recipeLivingwoodDecor1 = BotaniaAPI.getLatestAddedRecipe(); - addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingwood, 1, 2), new ItemStack(ModBlocks.livingwood, 1, 1), new ItemStack(Items.wheat_seeds)); - recipeLivingwoodDecor2 = BotaniaAPI.getLatestAddedRecipe(); - addOreDictRecipe(new ItemStack(ModBlocks.livingwood, 4, 3), - "WW", "WW", - 'W', new ItemStack(ModBlocks.livingwood, 1, 1)); - recipeLivingwoodDecor3 = BotaniaAPI.getLatestAddedRecipe(); - addOreDictRecipe(new ItemStack(ModBlocks.livingwood, 4, 4), - " W ", "W W", " W ", - 'W', new ItemStack(ModBlocks.livingwood, 1, 1)); - recipeLivingwoodDecor4 = BotaniaAPI.getLatestAddedRecipe(); - addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingwood, 1, 5), - LibOreDict.LIVING_WOOD, new ItemStack(Items.glowstone_dust)); - recipeLivingwoodDecor5 = BotaniaAPI.getLatestAddedRecipe(); + // Livingwood Decorative Blocks + addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingwood, 4, 1), LibOreDict.LIVING_WOOD); + recipeLivingwoodDecor1 = BotaniaAPI.getLatestAddedRecipe(); + addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingwood, 1, 2), new ItemStack(ModBlocks.livingwood, 1, 1), new ItemStack(Items.wheat_seeds)); + recipeLivingwoodDecor2 = BotaniaAPI.getLatestAddedRecipe(); + addOreDictRecipe(new ItemStack(ModBlocks.livingwood, 4, 3), "WW", "WW", 'W', new ItemStack(ModBlocks.livingwood, 1, 1)); + recipeLivingwoodDecor3 = BotaniaAPI.getLatestAddedRecipe(); + addOreDictRecipe(new ItemStack(ModBlocks.livingwood, 4, 4), " W ", "W W", " W ", 'W', new ItemStack(ModBlocks.livingwood, 1, 1)); + recipeLivingwoodDecor4 = BotaniaAPI.getLatestAddedRecipe(); + addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingwood, 1, 5), LibOreDict.LIVING_WOOD, new ItemStack(Items.glowstone_dust)); + recipeLivingwoodDecor5 = BotaniaAPI.getLatestAddedRecipe(); - // Mana Beacon Recipe - for(int i = 0; i < 16; i++) - addOreDictRecipe(new ItemStack(ModBlocks.manaBeacon, 1, i), - " B ", "BPB", " B ", - 'B', new ItemStack(ModBlocks.unstableBlock, 1, i), - 'P', LibOreDict.MANA_PEARL); - recipesManaBeacons = BotaniaAPI.getLatestAddedRecipes(16); + // Mana Beacon Recipe + for(int i = 0; i < 16; i++) + addOreDictRecipe(new ItemStack(ModBlocks.manaBeacon, 1, i), " B ", "BPB", " B ", 'B', new ItemStack(ModBlocks.unstableBlock, 1, i), 'P', LibOreDict.MANA_PEARL); + recipesManaBeacons = BotaniaAPI.getLatestAddedRecipes(16); - // Signal Flare Recipe - for(int i = 0; i < 16; i++) - addOreDictRecipe(ItemSignalFlare.forColor(i), - "I ", " B", "W ", - 'B', new ItemStack(ModBlocks.manaBeacon, 1, i), - 'I', "ingotIron", - 'W', LibOreDict.LIVING_WOOD); - recipesSignalFlares = BotaniaAPI.getLatestAddedRecipes(16); + // Signal Flare Recipe + for(int i = 0; i < 16; i++) + addOreDictRecipe(ItemSignalFlare.forColor(i), "I ", " B", "W ", 'B', new ItemStack(ModBlocks.manaBeacon, 1, i), 'I', "ingotIron", 'W', LibOreDict.LIVING_WOOD); + recipesSignalFlares = BotaniaAPI.getLatestAddedRecipes(16); - // Mana Void Recipe - addOreDictRecipe(new ItemStack(ModBlocks.manaVoid), - "SSS", "O O", "SSS", - 'S', LibOreDict.LIVING_ROCK, - 'O', new ItemStack(Blocks.obsidian)); - recipeManaVoid = BotaniaAPI.getLatestAddedRecipe(); + // Mana Void Recipe + addOreDictRecipe(new ItemStack(ModBlocks.manaVoid), "SSS", "O O", "SSS", 'S', LibOreDict.LIVING_ROCK, 'O', new ItemStack(Blocks.obsidian)); + recipeManaVoid = BotaniaAPI.getLatestAddedRecipe(); - // Mana Tablet Recipe - addOreDictRecipe(new ItemStack(ModItems.manaTablet, 1, 10000), - "SSS", "SPS", "SSS", - 'S', LibOreDict.LIVING_ROCK, - 'P', LibOreDict.MANA_PEARL); - addOreDictRecipe(new ItemStack(ModItems.manaTablet, 1, 10000), - "SSS", "SDS", "SSS", - 'S', LibOreDict.LIVING_ROCK, - 'D', LibOreDict.MANA_DIAMOND); - recipesManaTablet = BotaniaAPI.getLatestAddedRecipes(2); + // Mana Tablet Recipe + addOreDictRecipe(new ItemStack(ModItems.manaTablet, 1, 10000), "SSS", "SPS", "SSS", 'S', LibOreDict.LIVING_ROCK, 'P', LibOreDict.MANA_PEARL); + addOreDictRecipe(new ItemStack(ModItems.manaTablet, 1, 10000), "SSS", "SDS", "SSS", 'S', LibOreDict.LIVING_ROCK, 'D', LibOreDict.MANA_DIAMOND); + recipesManaTablet = BotaniaAPI.getLatestAddedRecipes(2); - // Mana Detector Recipe - addOreDictRecipe(new ItemStack(ModBlocks.manaDetector), - "RSR", "SCS", "RSR", - 'R', new ItemStack(Items.redstone), - 'C', new ItemStack(Items.comparator), - 'S', LibOreDict.LIVING_ROCK); - recipeManaDetector = BotaniaAPI.getLatestAddedRecipe(); + // Mana Detector Recipe + addOreDictRecipe(new ItemStack(ModBlocks.manaDetector), "RSR", "SCS", "RSR", 'R', new ItemStack(Items.redstone), 'C', new ItemStack(Items.comparator), 'S', LibOreDict.LIVING_ROCK); + recipeManaDetector = BotaniaAPI.getLatestAddedRecipe(); - // Mana Blaster Recipe - addOreDictRecipe(new ItemStack(ModItems.manaGun), - "SMD", " WT", " W", - 'S', new ItemStack(ModBlocks.spreader, 1, 1), - 'M', LibOreDict.RUNE[8], - 'D', LibOreDict.MANA_DIAMOND, - 'T', new ItemStack(Blocks.tnt), - 'W', LibOreDict.LIVING_WOOD); - recipeManaBlaster = BotaniaAPI.getLatestAddedRecipe(); + // Mana Blaster Recipe + addOreDictRecipe(new ItemStack(ModItems.manaGun), "SMD", " WT", " W", 'S', new ItemStack(ModBlocks.spreader, 1, 1), 'M', LibOreDict.RUNE[8], 'D', LibOreDict.MANA_DIAMOND, 'T', new ItemStack(Blocks.tnt), 'W', LibOreDict.LIVING_WOOD); + recipeManaBlaster = BotaniaAPI.getLatestAddedRecipe(); - // Spreader Turntable Recipe - addOreDictRecipe(new ItemStack(ModBlocks.turntable), - "WWW", "WPW", "WWW", - 'W', LibOreDict.LIVING_WOOD, - 'P', Blocks.sticky_piston); - recipeTurntable = BotaniaAPI.getLatestAddedRecipe(); - - // Fertilizer Recipes - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.fertilizer), new ItemStack(Items.dye, 1, 15), new ItemStack(ModItems.dye, 1, -1), new ItemStack(ModItems.dye, 1, -1), new ItemStack(ModItems.dye, 1, -1), new ItemStack(ModItems.dye, 1, -1)); - recipeFertilizerPowder = BotaniaAPI.getLatestAddedRecipe(); - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.fertilizer), new ItemStack(Items.dye, 1, 15), new ItemStack(Items.dye, 1, 11), new ItemStack(Items.dye, 1, 11), new ItemStack(Items.dye, 1, 1), new ItemStack(Items.dye, 1, 1)); - recipeFerilizerDye = BotaniaAPI.getLatestAddedRecipe(); - - // Livingwood Twig Recipe - addOreDictRecipe(new ItemStack(ModItems.manaResource, 1, 3), - "W", "W", - 'W', LibOreDict.LIVING_WOOD); - recipeLivingwoodTwig = BotaniaAPI.getLatestAddedRecipe(); - - // Rod of the Lands Recipe - addOreDictRecipe(new ItemStack(ModItems.dirtRod), - " D", " T ", "E ", - 'D', new ItemStack(Blocks.dirt), - 'T', LibOreDict.LIVINGWOOD_TWIG, - 'E', LibOreDict.RUNE[2]); - recipeDirtRod = BotaniaAPI.getLatestAddedRecipe(); - - // Terra Firma Rod Recipe - addOreDictRecipe(new ItemStack(ModItems.terraformRod), - " WT", "ARS", "GM ", - 'T', LibOreDict.TERRA_STEEL, - 'R', new ItemStack(ModItems.dirtRod), - 'G', new ItemStack(ModItems.grassSeeds), - 'W', LibOreDict.RUNE[7], - 'S', LibOreDict.RUNE[4], - 'M', LibOreDict.RUNE[5], - 'A', LibOreDict.RUNE[6]); - recipeTerraformRod = BotaniaAPI.getLatestAddedRecipe(); - - // Redstone Mana Spreader Recipe - GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.spreader, 1, 1), - new ItemStack(ModBlocks.spreader), new ItemStack(Items.redstone)); - recipeRedstoneSpreader = BotaniaAPI.getLatestAddedRecipe(); - - // Mana Miror Recipe - addOreDictRecipe(new ItemStack(ModItems.manaMirror), - " PR", " SI", "T ", - 'P', LibOreDict.MANA_PEARL, - 'R', LibOreDict.LIVING_ROCK, - 'S', LibOreDict.LIVINGWOOD_TWIG, - 'I', LibOreDict.TERRA_STEEL, - 'T', new ItemStack(ModItems.manaTablet, 1, -1)); - recipeManaMirror = BotaniaAPI.getLatestAddedRecipe(); - - // Mana Armor & Tools Recipes - addOreDictRecipe(new ItemStack(ModItems.manasteelHelm), - "SSS", "S S", - 'S', LibOreDict.MANA_STEEL); - recipeManasteelHelm = BotaniaAPI.getLatestAddedRecipe(); - addOreDictRecipe(new ItemStack(ModItems.manasteelChest), - "S S", "SSS", "SSS", - 'S', LibOreDict.MANA_STEEL); - recipeManasteelChest = BotaniaAPI.getLatestAddedRecipe(); - addOreDictRecipe(new ItemStack(ModItems.manasteelLegs), - "SSS", "S S", "S S", - 'S', LibOreDict.MANA_STEEL); - recipeManasteelLegs = BotaniaAPI.getLatestAddedRecipe(); - addOreDictRecipe(new ItemStack(ModItems.manasteelBoots), - "S S", "S S", - 'S', LibOreDict.MANA_STEEL); - recipeManasteelBoots = BotaniaAPI.getLatestAddedRecipe(); - addOreDictRecipe(new ItemStack(ModItems.manasteelPick), - "SSS", " T ", " T ", - 'S', LibOreDict.MANA_STEEL, - 'T', LibOreDict.LIVINGWOOD_TWIG); - recipeManasteelPick = BotaniaAPI.getLatestAddedRecipe(); - addOreDictRecipe(new ItemStack(ModItems.manasteelShovel), - "S", "T", "T", - 'S', LibOreDict.MANA_STEEL, - 'T', LibOreDict.LIVINGWOOD_TWIG); - recipeManasteelShovel = BotaniaAPI.getLatestAddedRecipe(); - addOreDictRecipe(new ItemStack(ModItems.manasteelAxe), - "SS", "TS", "T ", - 'S', LibOreDict.MANA_STEEL, - 'T', LibOreDict.LIVINGWOOD_TWIG); - recipeManasteelAxe = BotaniaAPI.getLatestAddedRecipe(); - addOreDictRecipe(new ItemStack(ModItems.manasteelSword), - "S", "S", "T", - 'S', LibOreDict.MANA_STEEL, - 'T', LibOreDict.LIVINGWOOD_TWIG); - recipeManasteelSword = BotaniaAPI.getLatestAddedRecipe(); - addOreDictRecipe(new ItemStack(ModItems.manasteelShears), - "S ", " S", - 'S', LibOreDict.MANA_STEEL); - recipeManasteelShears = BotaniaAPI.getLatestAddedRecipe(); - - // Horn of the Wild Recipe - addOreDictRecipe(new ItemStack(ModItems.grassHorn), - " W ", "WSW", "WW ", - 'W', LibOreDict.LIVING_WOOD, - 'S', new ItemStack(ModItems.grassSeeds)); - recipeGrassHorn = BotaniaAPI.getLatestAddedRecipe(); - - // Terrasteel Armor Recipes - addOreDictRecipe(new ItemStack(ModItems.terrasteelHelm), - "SSS", "S S", - 'S', LibOreDict.TERRA_STEEL); - recipeTerrasteelHelm = BotaniaAPI.getLatestAddedRecipe(); - addOreDictRecipe(new ItemStack(ModItems.terrasteelChest), - "S S", "SSS", "SSS", - 'S', LibOreDict.TERRA_STEEL); - recipeTerrasteelChest = BotaniaAPI.getLatestAddedRecipe(); - addOreDictRecipe(new ItemStack(ModItems.terrasteelLegs), - "SSS", "S S", "S S", - 'S', LibOreDict.TERRA_STEEL); - recipeTerrasteelLegs = BotaniaAPI.getLatestAddedRecipe(); - addOreDictRecipe(new ItemStack(ModItems.terrasteelBoots), - "S S", "S S", - 'S', LibOreDict.TERRA_STEEL); - recipeTerrasteelBoots = BotaniaAPI.getLatestAddedRecipe(); - - // Terra Blade Recipe - addOreDictRecipe(new ItemStack(ModItems.terraSword), - "I", "I", "S", - 'I', LibOreDict.TERRA_STEEL, - 'S', LibOreDict.LIVINGWOOD_TWIG); - recipeTerraSword = BotaniaAPI.getLatestAddedRecipe(); - } + // Spreader Turntable Recipe + addOreDictRecipe(new ItemStack(ModBlocks.turntable), "WWW", "WPW", "WWW", 'W', LibOreDict.LIVING_WOOD, 'P', Blocks.sticky_piston); + recipeTurntable = BotaniaAPI.getLatestAddedRecipe(); - private static void addOreDictRecipe(ItemStack output, Object... recipe) { - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(output, recipe)); - } + // Fertilizer Recipes + GameRegistry.addShapelessRecipe(new ItemStack(ModItems.fertilizer), new ItemStack(Items.dye, 1, 15), new ItemStack(ModItems.dye, 1, -1), new ItemStack(ModItems.dye, 1, -1), new ItemStack(ModItems.dye, 1, -1), new ItemStack(ModItems.dye, 1, -1)); + recipeFertilizerPowder = BotaniaAPI.getLatestAddedRecipe(); + GameRegistry.addShapelessRecipe(new ItemStack(ModItems.fertilizer), new ItemStack(Items.dye, 1, 15), new ItemStack(Items.dye, 1, 11), new ItemStack(Items.dye, 1, 11), new ItemStack(Items.dye, 1, 1), new ItemStack(Items.dye, 1, 1)); + recipeFerilizerDye = BotaniaAPI.getLatestAddedRecipe(); - private static void addShapelessOreDictRecipe(ItemStack output, Object... recipe) { - CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(output, recipe)); - } + // Livingwood Twig Recipe + addOreDictRecipe(new ItemStack(ModItems.manaResource, 1, 3), "W", "W", 'W', LibOreDict.LIVING_WOOD); + recipeLivingwoodTwig = BotaniaAPI.getLatestAddedRecipe(); + + // Rod of the Lands Recipe + addOreDictRecipe(new ItemStack(ModItems.dirtRod), " D", " T ", "E ", 'D', new ItemStack(Blocks.dirt), 'T', LibOreDict.LIVINGWOOD_TWIG, 'E', LibOreDict.RUNE[2]); + recipeDirtRod = BotaniaAPI.getLatestAddedRecipe(); + + // Terra Firma Rod Recipe + addOreDictRecipe(new ItemStack(ModItems.terraformRod), " WT", "ARS", "GM ", 'T', LibOreDict.TERRA_STEEL, 'R', new ItemStack(ModItems.dirtRod), 'G', new ItemStack(ModItems.grassSeeds), 'W', LibOreDict.RUNE[7], 'S', LibOreDict.RUNE[4], 'M', LibOreDict.RUNE[5], 'A', LibOreDict.RUNE[6]); + recipeTerraformRod = BotaniaAPI.getLatestAddedRecipe(); + + // Redstone Mana Spreader Recipe + GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.spreader, 1, 1), new ItemStack(ModBlocks.spreader), new ItemStack(Items.redstone)); + recipeRedstoneSpreader = BotaniaAPI.getLatestAddedRecipe(); + + // Mana Miror Recipe + addOreDictRecipe(new ItemStack(ModItems.manaMirror), " PR", " SI", "T ", 'P', LibOreDict.MANA_PEARL, 'R', LibOreDict.LIVING_ROCK, 'S', LibOreDict.LIVINGWOOD_TWIG, 'I', LibOreDict.TERRA_STEEL, 'T', new ItemStack(ModItems.manaTablet, 1, -1)); + recipeManaMirror = BotaniaAPI.getLatestAddedRecipe(); + + // Mana Armor & Tools Recipes + addOreDictRecipe(new ItemStack(ModItems.manasteelHelm), "SSS", "S S", 'S', LibOreDict.MANA_STEEL); + recipeManasteelHelm = BotaniaAPI.getLatestAddedRecipe(); + addOreDictRecipe(new ItemStack(ModItems.manasteelChest), "S S", "SSS", "SSS", 'S', LibOreDict.MANA_STEEL); + recipeManasteelChest = BotaniaAPI.getLatestAddedRecipe(); + addOreDictRecipe(new ItemStack(ModItems.manasteelLegs), "SSS", "S S", "S S", 'S', LibOreDict.MANA_STEEL); + recipeManasteelLegs = BotaniaAPI.getLatestAddedRecipe(); + addOreDictRecipe(new ItemStack(ModItems.manasteelBoots), "S S", "S S", 'S', LibOreDict.MANA_STEEL); + recipeManasteelBoots = BotaniaAPI.getLatestAddedRecipe(); + addOreDictRecipe(new ItemStack(ModItems.manasteelPick), "SSS", " T ", " T ", 'S', LibOreDict.MANA_STEEL, 'T', LibOreDict.LIVINGWOOD_TWIG); + recipeManasteelPick = BotaniaAPI.getLatestAddedRecipe(); + addOreDictRecipe(new ItemStack(ModItems.manasteelShovel), "S", "T", "T", 'S', LibOreDict.MANA_STEEL, 'T', LibOreDict.LIVINGWOOD_TWIG); + recipeManasteelShovel = BotaniaAPI.getLatestAddedRecipe(); + addOreDictRecipe(new ItemStack(ModItems.manasteelAxe), "SS", "TS", "T ", 'S', LibOreDict.MANA_STEEL, 'T', LibOreDict.LIVINGWOOD_TWIG); + recipeManasteelAxe = BotaniaAPI.getLatestAddedRecipe(); + addOreDictRecipe(new ItemStack(ModItems.manasteelSword), "S", "S", "T", 'S', LibOreDict.MANA_STEEL, 'T', LibOreDict.LIVINGWOOD_TWIG); + recipeManasteelSword = BotaniaAPI.getLatestAddedRecipe(); + addOreDictRecipe(new ItemStack(ModItems.manasteelShears), "S ", " S", 'S', LibOreDict.MANA_STEEL); + recipeManasteelShears = BotaniaAPI.getLatestAddedRecipe(); + + // Horn of the Wild Recipe + addOreDictRecipe(new ItemStack(ModItems.grassHorn), " W ", "WSW", "WW ", 'W', LibOreDict.LIVING_WOOD, 'S', new ItemStack(ModItems.grassSeeds)); + recipeGrassHorn = BotaniaAPI.getLatestAddedRecipe(); + + // Terrasteel Armor Recipes + addOreDictRecipe(new ItemStack(ModItems.terrasteelHelm), "SSS", "S S", 'S', LibOreDict.TERRA_STEEL); + recipeTerrasteelHelm = BotaniaAPI.getLatestAddedRecipe(); + addOreDictRecipe(new ItemStack(ModItems.terrasteelChest), "S S", "SSS", "SSS", 'S', LibOreDict.TERRA_STEEL); + recipeTerrasteelChest = BotaniaAPI.getLatestAddedRecipe(); + addOreDictRecipe(new ItemStack(ModItems.terrasteelLegs), "SSS", "S S", "S S", 'S', LibOreDict.TERRA_STEEL); + recipeTerrasteelLegs = BotaniaAPI.getLatestAddedRecipe(); + addOreDictRecipe(new ItemStack(ModItems.terrasteelBoots), "S S", "S S", 'S', LibOreDict.TERRA_STEEL); + recipeTerrasteelBoots = BotaniaAPI.getLatestAddedRecipe(); + + // Terra Blade Recipe + addOreDictRecipe(new ItemStack(ModItems.terraSword), "I", "I", "S", 'I', LibOreDict.TERRA_STEEL, 'S', LibOreDict.LIVINGWOOD_TWIG); + recipeTerraSword = BotaniaAPI.getLatestAddedRecipe(); + } + + private static void addOreDictRecipe(ItemStack output, Object... recipe) { + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(output, recipe)); + } + + private static void addShapelessOreDictRecipe(ItemStack output, Object... recipe) { + CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(output, recipe)); + } } diff --git a/MODSRC/vazkii/botania/common/crafting/ModManaInfusionRecipes.java b/MODSRC/vazkii/botania/common/crafting/ModManaInfusionRecipes.java index 071d61519..8668232ee 100644 --- a/MODSRC/vazkii/botania/common/crafting/ModManaInfusionRecipes.java +++ b/MODSRC/vazkii/botania/common/crafting/ModManaInfusionRecipes.java @@ -2,21 +2,17 @@ * This class was created by . 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 30, 2014, 6:10:48 PM (GMT)] */ package vazkii.botania.common.crafting; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.recipe.RecipeManaInfusion; @@ -24,34 +20,37 @@ import vazkii.botania.common.block.ModBlocks; import vazkii.botania.common.item.ModItems; import vazkii.botania.common.lib.LibOreDict; +import java.util.ArrayList; +import java.util.List; + public final class ModManaInfusionRecipes { - public static List manaPetalRecipes; - public static RecipeManaInfusion manasteelRecipe; - public static RecipeManaInfusion manaPearlRecipe; - public static RecipeManaInfusion manaDiamondRecipe; - public static RecipeManaInfusion pistonRelayRecipe; - public static RecipeManaInfusion manaCookieRecipe; - public static RecipeManaInfusion grassSeedsRecipe; - public static RecipeManaInfusion podzolSeedsRecipe; - public static List mycelSeedsRecipes; + public static List manaPetalRecipes; + public static RecipeManaInfusion manasteelRecipe; + public static RecipeManaInfusion manaPearlRecipe; + public static RecipeManaInfusion manaDiamondRecipe; + public static RecipeManaInfusion pistonRelayRecipe; + public static RecipeManaInfusion manaCookieRecipe; + public static RecipeManaInfusion grassSeedsRecipe; + public static RecipeManaInfusion podzolSeedsRecipe; + public static List mycelSeedsRecipes; - public static void init() { - manaPetalRecipes = new ArrayList(); - for(int i = 0; i < 16; i++) - manaPetalRecipes.add(BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaPetal, 1, i), LibOreDict.PETAL[i], 1000)); + public static void init() { + manaPetalRecipes = new ArrayList(); + for(int i = 0; i < 16; i++) + manaPetalRecipes.add(BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaPetal, 1, i), LibOreDict.PETAL[i], 1000)); - manasteelRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaResource, 1, 0), "ingotIron", 3000); - manaPearlRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaResource, 1, 1), new ItemStack(Items.ender_pearl), 6000); - manaDiamondRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaResource, 1, 2), "gemDiamond", 10000); - pistonRelayRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModBlocks.pistonRelay), new ItemStack(Blocks.piston), 15000); - manaCookieRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaCookie), new ItemStack(Items.cookie), 20000); - grassSeedsRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.grassSeeds), new ItemStack(Blocks.tallgrass, 1, 1), 2500); - podzolSeedsRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.grassSeeds, 1, 1), new ItemStack(Blocks.tallgrass), 2500); - - mycelSeedsRecipes = new ArrayList(); - mycelSeedsRecipes.add(BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.grassSeeds, 1, 2), new ItemStack(Blocks.red_mushroom), 6500)); - mycelSeedsRecipes.add(BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.grassSeeds, 1, 2), new ItemStack(Blocks.brown_mushroom), 6500)); - } + manasteelRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaResource, 1, 0), "ingotIron", 3000); + manaPearlRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaResource, 1, 1), new ItemStack(Items.ender_pearl), 6000); + manaDiamondRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaResource, 1, 2), "gemDiamond", 10000); + pistonRelayRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModBlocks.pistonRelay), new ItemStack(Blocks.piston), 15000); + manaCookieRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaCookie), new ItemStack(Items.cookie), 20000); + grassSeedsRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.grassSeeds), new ItemStack(Blocks.tallgrass, 1, 1), 2500); + podzolSeedsRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.grassSeeds, 1, 1), new ItemStack(Blocks.tallgrass), 2500); + + mycelSeedsRecipes = new ArrayList(); + mycelSeedsRecipes.add(BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.grassSeeds, 1, 2), new ItemStack(Blocks.red_mushroom), 6500)); + mycelSeedsRecipes.add(BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.grassSeeds, 1, 2), new ItemStack(Blocks.brown_mushroom), 6500)); + } } diff --git a/MODSRC/vazkii/botania/common/crafting/ModPetalRecipes.java b/MODSRC/vazkii/botania/common/crafting/ModPetalRecipes.java index 021d18b3d..3abbb3c43 100644 --- a/MODSRC/vazkii/botania/common/crafting/ModPetalRecipes.java +++ b/MODSRC/vazkii/botania/common/crafting/ModPetalRecipes.java @@ -2,11 +2,11 @@ * This class was created by . 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 22], 2014], 2:22:21 PM (GMT)] */ package vazkii.botania.common.crafting; @@ -19,51 +19,51 @@ import vazkii.botania.common.lib.LibOreDict; public final class ModPetalRecipes { - public static final String white = LibOreDict.PETAL[0], orange = LibOreDict.PETAL[1], magenta = LibOreDict.PETAL[2], lightBlue = LibOreDict.PETAL[3], yellow = LibOreDict.PETAL[4], lime = LibOreDict.PETAL[5], pink = LibOreDict.PETAL[6], gray = LibOreDict.PETAL[7], lightGray = LibOreDict.PETAL[8], cyan = LibOreDict.PETAL[9], purple = LibOreDict.PETAL[10], blue = LibOreDict.PETAL[11], brown = LibOreDict.PETAL[12], green = LibOreDict.PETAL[13], red = LibOreDict.PETAL[14], black = LibOreDict.PETAL[15]; - public static final String whiteMana = LibOreDict.MANA_PETAL[0], orangeMana = LibOreDict.MANA_PETAL[1], magentaMana = LibOreDict.MANA_PETAL[2], lightBlueMana = LibOreDict.MANA_PETAL[3], yellowMana = LibOreDict.MANA_PETAL[4], limeMana = LibOreDict.MANA_PETAL[5], pinkMana = LibOreDict.MANA_PETAL[6], grayMana = LibOreDict.MANA_PETAL[7], lightGrayMana = LibOreDict.MANA_PETAL[8], cyanMana = LibOreDict.MANA_PETAL[9], purpleMana = LibOreDict.MANA_PETAL[10], blueMana = LibOreDict.MANA_PETAL[11], brownMana = LibOreDict.MANA_PETAL[12], greenMana = LibOreDict.MANA_PETAL[13], redMana = LibOreDict.MANA_PETAL[14], blackMana = LibOreDict.MANA_PETAL[15]; - public static final String runeWater = LibOreDict.RUNE[0], runeFire = LibOreDict.RUNE[1], runeEarth = LibOreDict.RUNE[2], runeAir = LibOreDict.RUNE[3], runeSpring = LibOreDict.RUNE[4], runeSummer = LibOreDict.RUNE[5], runeAutumn = LibOreDict.RUNE[6], runeWinter = LibOreDict.RUNE[7], runeMana = LibOreDict.RUNE[8], runeLust = LibOreDict.RUNE[9], runeGluttony = LibOreDict.RUNE[10], runeGreed = LibOreDict.RUNE[11], runeSloth = LibOreDict.RUNE[12], runeWrath = LibOreDict.RUNE[13], runeEnvy = LibOreDict.RUNE[14], runePride = LibOreDict.RUNE[15]; + public static final String white = LibOreDict.PETAL[0], orange = LibOreDict.PETAL[1], magenta = LibOreDict.PETAL[2], lightBlue = LibOreDict.PETAL[3], yellow = LibOreDict.PETAL[4], lime = LibOreDict.PETAL[5], pink = LibOreDict.PETAL[6], gray = LibOreDict.PETAL[7], lightGray = LibOreDict.PETAL[8], cyan = LibOreDict.PETAL[9], purple = LibOreDict.PETAL[10], blue = LibOreDict.PETAL[11], brown = LibOreDict.PETAL[12], green = LibOreDict.PETAL[13], red = LibOreDict.PETAL[14], black = LibOreDict.PETAL[15]; + public static final String whiteMana = LibOreDict.MANA_PETAL[0], orangeMana = LibOreDict.MANA_PETAL[1], magentaMana = LibOreDict.MANA_PETAL[2], lightBlueMana = LibOreDict.MANA_PETAL[3], yellowMana = LibOreDict.MANA_PETAL[4], limeMana = LibOreDict.MANA_PETAL[5], pinkMana = LibOreDict.MANA_PETAL[6], grayMana = LibOreDict.MANA_PETAL[7], lightGrayMana = LibOreDict.MANA_PETAL[8], cyanMana = LibOreDict.MANA_PETAL[9], purpleMana = LibOreDict.MANA_PETAL[10], blueMana = LibOreDict.MANA_PETAL[11], brownMana = LibOreDict.MANA_PETAL[12], greenMana = LibOreDict.MANA_PETAL[13], redMana = LibOreDict.MANA_PETAL[14], blackMana = LibOreDict.MANA_PETAL[15]; + public static final String runeWater = LibOreDict.RUNE[0], runeFire = LibOreDict.RUNE[1], runeEarth = LibOreDict.RUNE[2], runeAir = LibOreDict.RUNE[3], runeSpring = LibOreDict.RUNE[4], runeSummer = LibOreDict.RUNE[5], runeAutumn = LibOreDict.RUNE[6], runeWinter = LibOreDict.RUNE[7], runeMana = LibOreDict.RUNE[8], runeLust = LibOreDict.RUNE[9], runeGluttony = LibOreDict.RUNE[10], runeGreed = LibOreDict.RUNE[11], runeSloth = LibOreDict.RUNE[12], runeWrath = LibOreDict.RUNE[13], runeEnvy = LibOreDict.RUNE[14], runePride = LibOreDict.RUNE[15]; - public static RecipePetals pureDaisyRecipe; + public static RecipePetals pureDaisyRecipe; - public static RecipePetals daybloomRecipe; - public static RecipePetals nightshadeRecipe; - public static RecipePetals endoflameRecipe; - public static RecipePetals hydroangeasRecipe; - public static RecipePetals thermalilyRecipe; - public static RecipePetals arcaneRoseRecipe; + public static RecipePetals daybloomRecipe; + public static RecipePetals nightshadeRecipe; + public static RecipePetals endoflameRecipe; + public static RecipePetals hydroangeasRecipe; + public static RecipePetals thermalilyRecipe; + public static RecipePetals arcaneRoseRecipe; - public static RecipePetals jadedAmaranthusRecipe; - public static RecipePetals bellethorneRecipe; - public static RecipePetals heiseiDreamRecipe; - public static RecipePetals tigerseyeRecipe; - public static RecipePetals orechidRecipe; - public static RecipePetals fallenKanadeRecipe; - public static RecipePetals exoflameRecipe; - public static RecipePetals agricarnationRecipe; - public static RecipePetals hopperhockRecipe; - public static RecipePetals tangleberrieRecipe; - public static RecipePetals jiyuuliaRecipe; + public static RecipePetals jadedAmaranthusRecipe; + public static RecipePetals bellethorneRecipe; + public static RecipePetals heiseiDreamRecipe; + public static RecipePetals tigerseyeRecipe; + public static RecipePetals orechidRecipe; + public static RecipePetals fallenKanadeRecipe; + public static RecipePetals exoflameRecipe; + public static RecipePetals agricarnationRecipe; + public static RecipePetals hopperhockRecipe; + public static RecipePetals tangleberrieRecipe; + public static RecipePetals jiyuuliaRecipe; - public static void init() { - pureDaisyRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY), white, white, white, white); + public static void init() { + pureDaisyRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY), white, white, white, white); - daybloomRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_DAYBLOOM), yellow, yellow, orange, lightBlue); - nightshadeRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_NIGHTSHADE), black, black, purple, gray); - endoflameRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ENDOFLAME), brown, red, redMana, brownMana, lightGray); - hydroangeasRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_HYDROANGEAS), blueMana, blue, pink, lightBlue); - thermalilyRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_THERMALILY), red, orangeMana, orange, runeEarth, runeFire); - arcaneRoseRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ARCANE_ROSE), pink, pinkMana, pinkMana, lime, purple, purpleMana, runeMana); + daybloomRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_DAYBLOOM), yellow, yellow, orange, lightBlue); + nightshadeRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_NIGHTSHADE), black, black, purple, gray); + endoflameRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ENDOFLAME), brown, red, redMana, brownMana, lightGray); + hydroangeasRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_HYDROANGEAS), blueMana, blue, pink, lightBlue); + thermalilyRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_THERMALILY), red, orangeMana, orange, runeEarth, runeFire); + arcaneRoseRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ARCANE_ROSE), pink, pinkMana, pinkMana, lime, purple, purpleMana, runeMana); - jadedAmaranthusRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_JADED_AMARANTHUS), purpleMana, purpleMana, lime, purple, green, runeSpring); - bellethorneRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_BELLETHORN), redMana, redMana, cyan, cyan, red); - heiseiDreamRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_HEISEI_DREAM), purpleMana, pinkMana, magentaMana, purple, pink, magenta, runeWrath); - tigerseyeRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_TIGERSEYE), yellow, brownMana, orangeMana, lime, runeAutumn); - orechidRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID), gray, grayMana, lightGray, lightGrayMana, lightBlue, yellow, green, red, runePride, runeSloth); - fallenKanadeRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_FALLEN_KANADE), white, whiteMana, whiteMana, yellowMana, orangeMana, brownMana, runeSpring); - exoflameRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_EXOFLAME), red, redMana, redMana, gray, lightGray, runeFire, runeSummer); - agricarnationRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_AGRICARNATION), redMana, yellow, greenMana, lime, lime, limeMana, runeSpring); - hopperhockRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_HOPPERHOCK), gray, grayMana, lightGray, lightGrayMana, runeAir); - tangleberrieRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_TANGLEBERRIE), grayMana, lightGrayMana, cyanMana, cyan, runeAir, runeEarth); - jiyuuliaRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_JIYUULIA), pinkMana, purpleMana, lightGrayMana, pink, runeWater, runeAir); - } + jadedAmaranthusRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_JADED_AMARANTHUS), purpleMana, purpleMana, lime, purple, green, runeSpring); + bellethorneRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_BELLETHORN), redMana, redMana, cyan, cyan, red); + heiseiDreamRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_HEISEI_DREAM), purpleMana, pinkMana, magentaMana, purple, pink, magenta, runeWrath); + tigerseyeRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_TIGERSEYE), yellow, brownMana, orangeMana, lime, runeAutumn); + orechidRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID), gray, grayMana, lightGray, lightGrayMana, lightBlue, yellow, green, red, runePride, runeSloth); + fallenKanadeRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_FALLEN_KANADE), white, whiteMana, whiteMana, yellowMana, orangeMana, brownMana, runeSpring); + exoflameRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_EXOFLAME), red, redMana, redMana, gray, lightGray, runeFire, runeSummer); + agricarnationRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_AGRICARNATION), redMana, yellow, greenMana, lime, lime, limeMana, runeSpring); + hopperhockRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_HOPPERHOCK), gray, grayMana, lightGray, lightGrayMana, runeAir); + tangleberrieRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_TANGLEBERRIE), grayMana, lightGrayMana, cyanMana, cyan, runeAir, runeEarth); + jiyuuliaRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_JIYUULIA), pinkMana, purpleMana, lightGrayMana, pink, runeWater, runeAir); + } } diff --git a/MODSRC/vazkii/botania/common/crafting/ModRuneRecipes.java b/MODSRC/vazkii/botania/common/crafting/ModRuneRecipes.java index 3148a8738..c3cbe1fe6 100644 --- a/MODSRC/vazkii/botania/common/crafting/ModRuneRecipes.java +++ b/MODSRC/vazkii/botania/common/crafting/ModRuneRecipes.java @@ -2,74 +2,72 @@ * This class was created by . 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 @ [Feb 6, 2014, 5:59:28 PM (GMT)] */ package vazkii.botania.common.crafting; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.recipe.RecipeRuneAltar; import vazkii.botania.common.item.ModItems; import vazkii.botania.common.lib.LibOreDict; +import java.util.ArrayList; +import java.util.List; + public final class ModRuneRecipes { - public static RecipeRuneAltar recipeWaterRune; - public static RecipeRuneAltar recipeFireRune; - public static List recipesEarthRune; - public static RecipeRuneAltar recipeAirRune; - public static RecipeRuneAltar recipeSpringRune; - public static RecipeRuneAltar recipeSummerRune; - public static RecipeRuneAltar recipeAutumnRune; - public static RecipeRuneAltar recipeWinterRune; - public static RecipeRuneAltar recipeManaRune; - public static RecipeRuneAltar recipeLustRune; - public static RecipeRuneAltar recipeGluttonyRune; - public static RecipeRuneAltar recipeGreedRune; - public static RecipeRuneAltar recipeSlothRune; - public static RecipeRuneAltar recipeWrathRune; - public static RecipeRuneAltar recipeEnvyRune; - public static RecipeRuneAltar recipePrideRune; + public static RecipeRuneAltar recipeWaterRune; + public static RecipeRuneAltar recipeFireRune; + public static List recipesEarthRune; + public static RecipeRuneAltar recipeAirRune; + public static RecipeRuneAltar recipeSpringRune; + public static RecipeRuneAltar recipeSummerRune; + public static RecipeRuneAltar recipeAutumnRune; + public static RecipeRuneAltar recipeWinterRune; + public static RecipeRuneAltar recipeManaRune; + public static RecipeRuneAltar recipeLustRune; + public static RecipeRuneAltar recipeGluttonyRune; + public static RecipeRuneAltar recipeGreedRune; + public static RecipeRuneAltar recipeSlothRune; + public static RecipeRuneAltar recipeWrathRune; + public static RecipeRuneAltar recipeEnvyRune; + public static RecipeRuneAltar recipePrideRune; - public static void init() { - final int costTier1 = 2500; - final int costTier2 = 4000; - final int costTier3 = 6000; + public static void init() { + final int costTier1 = 2500; + final int costTier2 = 4000; + final int costTier3 = 6000; - recipeWaterRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 0), costTier1, LibOreDict.MANA_STEEL, new ItemStack(Items.dye, 1, 15), new ItemStack(Items.reeds), new ItemStack(Items.fishing_rod)); - recipeFireRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 1), costTier1, LibOreDict.MANA_STEEL, new ItemStack(Items.blaze_rod), new ItemStack(Items.gunpowder), new ItemStack(Items.nether_wart)); + recipeWaterRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 0), costTier1, LibOreDict.MANA_STEEL, new ItemStack(Items.dye, 1, 15), new ItemStack(Items.reeds), new ItemStack(Items.fishing_rod)); + recipeFireRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 1), costTier1, LibOreDict.MANA_STEEL, new ItemStack(Items.blaze_rod), new ItemStack(Items.gunpowder), new ItemStack(Items.nether_wart)); - recipesEarthRune = new ArrayList(); - recipesEarthRune.add(BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 2), costTier1, LibOreDict.MANA_STEEL, "stone", new ItemStack(Blocks.dirt), new ItemStack(Blocks.brown_mushroom))); - recipesEarthRune.add(BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 2), costTier1, LibOreDict.MANA_STEEL, "stone", new ItemStack(Blocks.dirt), new ItemStack(Blocks.red_mushroom))); + recipesEarthRune = new ArrayList(); + recipesEarthRune.add(BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 2), costTier1, LibOreDict.MANA_STEEL, "stone", new ItemStack(Blocks.dirt), new ItemStack(Blocks.brown_mushroom))); + recipesEarthRune.add(BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 2), costTier1, LibOreDict.MANA_STEEL, "stone", new ItemStack(Blocks.dirt), new ItemStack(Blocks.red_mushroom))); - recipeAirRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 3), costTier1, LibOreDict.MANA_STEEL, new ItemStack(Blocks.carpet), new ItemStack(Items.feather), new ItemStack(Items.carrot)); + recipeAirRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 3), costTier1, LibOreDict.MANA_STEEL, new ItemStack(Blocks.carpet), new ItemStack(Items.feather), new ItemStack(Items.carrot)); - recipeSpringRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 4), costTier2, LibOreDict.RUNE[0], LibOreDict.RUNE[1], "treeSapling", "treeSapling", "treeSapling", new ItemStack(Items.wheat)); - recipeSummerRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 5), costTier2, LibOreDict.RUNE[2], LibOreDict.RUNE[3], new ItemStack(Blocks.sand), new ItemStack(Blocks.sand), new ItemStack(Items.slime_ball), new ItemStack(Items.melon)); - recipeAutumnRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 6), costTier2, LibOreDict.RUNE[1], LibOreDict.RUNE[3], "treeLeaves", "treeLeaves", "treeLeaves", new ItemStack(Items.spider_eye)); - recipeWinterRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 7), costTier2, LibOreDict.RUNE[0], LibOreDict.RUNE[2], new ItemStack(Blocks.snow), new ItemStack(Blocks.snow), new ItemStack(Blocks.wool), new ItemStack(Items.cake)); + recipeSpringRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 4), costTier2, LibOreDict.RUNE[0], LibOreDict.RUNE[1], "treeSapling", "treeSapling", "treeSapling", new ItemStack(Items.wheat)); + recipeSummerRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 5), costTier2, LibOreDict.RUNE[2], LibOreDict.RUNE[3], new ItemStack(Blocks.sand), new ItemStack(Blocks.sand), new ItemStack(Items.slime_ball), new ItemStack(Items.melon)); + recipeAutumnRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 6), costTier2, LibOreDict.RUNE[1], LibOreDict.RUNE[3], "treeLeaves", "treeLeaves", "treeLeaves", new ItemStack(Items.spider_eye)); + recipeWinterRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 7), costTier2, LibOreDict.RUNE[0], LibOreDict.RUNE[2], new ItemStack(Blocks.snow), new ItemStack(Blocks.snow), new ItemStack(Blocks.wool), new ItemStack(Items.cake)); - recipeManaRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 8), costTier2, LibOreDict.MANA_STEEL, LibOreDict.MANA_STEEL, LibOreDict.MANA_STEEL, LibOreDict.MANA_STEEL, LibOreDict.MANA_STEEL, LibOreDict.MANA_PEARL); + recipeManaRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 1, 8), costTier2, LibOreDict.MANA_STEEL, LibOreDict.MANA_STEEL, LibOreDict.MANA_STEEL, LibOreDict.MANA_STEEL, LibOreDict.MANA_STEEL, LibOreDict.MANA_PEARL); - recipeLustRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 9), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[5], LibOreDict.RUNE[3]); - recipeGluttonyRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 10), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[7], LibOreDict.RUNE[1]); - recipeGreedRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 11), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[4], LibOreDict.RUNE[0]); - recipeSlothRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 12), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[6], LibOreDict.RUNE[3]); - recipeWrathRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 13), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[7], LibOreDict.RUNE[2]); - recipeEnvyRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 14), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[7], LibOreDict.RUNE[0]); - recipePrideRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 15), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[5], LibOreDict.RUNE[1]); - } + recipeLustRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 9), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[5], LibOreDict.RUNE[3]); + recipeGluttonyRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 10), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[7], LibOreDict.RUNE[1]); + recipeGreedRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 11), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[4], LibOreDict.RUNE[0]); + recipeSlothRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 12), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[6], LibOreDict.RUNE[3]); + recipeWrathRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 13), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[7], LibOreDict.RUNE[2]); + recipeEnvyRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 14), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[7], LibOreDict.RUNE[0]); + recipePrideRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 15), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[5], LibOreDict.RUNE[1]); + } } diff --git a/MODSRC/vazkii/botania/common/crafting/recipe/CompositeLensRecipe.java b/MODSRC/vazkii/botania/common/crafting/recipe/CompositeLensRecipe.java index f116546f8..2d4aaaac8 100644 --- a/MODSRC/vazkii/botania/common/crafting/recipe/CompositeLensRecipe.java +++ b/MODSRC/vazkii/botania/common/crafting/recipe/CompositeLensRecipe.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 17, 2014, 8:30:41 PM (GMT)] */ package vazkii.botania.common.crafting.recipe; @@ -22,64 +22,60 @@ import vazkii.botania.common.item.ModItems; public class CompositeLensRecipe implements IRecipe { - @Override - public boolean matches(InventoryCrafting var1, World var2) { - boolean foundLens = false; - boolean foundSecondLens = false; - boolean foundSlimeball = false; + @Override + public boolean matches(InventoryCrafting var1, World var2) { + boolean foundLens = false; + boolean foundSecondLens = false; + boolean foundSlimeball = false; - for(int i = 0; i < var1.getSizeInventory(); i++) { - ItemStack stack = var1.getStackInSlot(i); - if(stack != null) { - if(stack.getItem() instanceof ILens && !foundSecondLens) { - if(foundLens) - foundSecondLens = true; - else foundLens = true; - } else if(stack.getItem() == Items.slime_ball) - foundSlimeball = true; - else return false; // Found an invalid item, breaking the recipe - } - } + for(int i = 0; i < var1.getSizeInventory(); i++) { + ItemStack stack = var1.getStackInSlot(i); + if(stack != null) { + if(stack.getItem() instanceof ILens && !foundSecondLens) { + if(foundLens) foundSecondLens = true; + else foundLens = true; + } else if(stack.getItem() == Items.slime_ball) foundSlimeball = true; + else return false; // Found an invalid item, breaking the recipe + } + } - return foundSecondLens && foundSlimeball; - } + return foundSecondLens && foundSlimeball; + } - @Override - public ItemStack getCraftingResult(InventoryCrafting var1) { - ItemStack lens = null; - ItemStack secondLens = null; + @Override + public ItemStack getCraftingResult(InventoryCrafting var1) { + ItemStack lens = null; + ItemStack secondLens = null; - for(int i = 0; i < var1.getSizeInventory(); i++) { - ItemStack stack = var1.getStackInSlot(i); - if(stack != null) { - if(stack.getItem() instanceof ILens) - if(lens == null) - lens = stack; - else secondLens = stack; - } - } + for(int i = 0; i < var1.getSizeInventory(); i++) { + ItemStack stack = var1.getStackInSlot(i); + if(stack != null) { + if(stack.getItem() instanceof ILens) if(lens == null) lens = stack; + else secondLens = stack; + } + } - if(lens.getItem() instanceof ILens) { - ILens lensItem = (ILens) lens.getItem(); - if(secondLens == null || !lensItem.canCombineLenses(lens, secondLens) || lensItem.getCompositeLens(lens) != null || lensItem.getCompositeLens(secondLens) != null) - return null; + if(lens.getItem() instanceof ILens) { + ILens lensItem = (ILens) lens.getItem(); + if(secondLens == null || !lensItem.canCombineLenses(lens, secondLens) || lensItem.getCompositeLens(lens) != null || lensItem.getCompositeLens(secondLens) != null) + return null; - ItemStack lensCopy = lens.copy(); - ((ItemLens) ModItems.lens).setCompositeLens(lensCopy, secondLens); + ItemStack lensCopy = lens.copy(); + ((ItemLens) ModItems.lens).setCompositeLens(lensCopy, secondLens); - return lensCopy; - } + return lensCopy; + } - return null; - } + return null; + } - @Override - public int getRecipeSize() { - return 10; - } + @Override + public int getRecipeSize() { + return 10; + } - @Override - public ItemStack getRecipeOutput() { - return null; - } + @Override + public ItemStack getRecipeOutput() { + return null; + } } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/common/crafting/recipe/ManaGunLensRecipe.java b/MODSRC/vazkii/botania/common/crafting/recipe/ManaGunLensRecipe.java index d2fdc2765..6b0020d53 100644 --- a/MODSRC/vazkii/botania/common/crafting/recipe/ManaGunLensRecipe.java +++ b/MODSRC/vazkii/botania/common/crafting/recipe/ManaGunLensRecipe.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 13, 2014, 8:01:14 PM (GMT)] */ package vazkii.botania.common.crafting.recipe; @@ -20,60 +20,55 @@ import vazkii.botania.common.item.ItemManaGun; public class ManaGunLensRecipe implements IRecipe { - @Override - public boolean matches(InventoryCrafting var1, World var2) { - boolean foundLens = false; - boolean foundGun = false; + @Override + public boolean matches(InventoryCrafting var1, World var2) { + boolean foundLens = false; + boolean foundGun = false; - for(int i = 0; i < var1.getSizeInventory(); i++) { - ItemStack stack = var1.getStackInSlot(i); - if(stack != null) { - if(stack.getItem() instanceof ItemManaGun && ItemManaGun.getLens(stack) == null) - foundGun = true; + for(int i = 0; i < var1.getSizeInventory(); i++) { + ItemStack stack = var1.getStackInSlot(i); + if(stack != null) { + if(stack.getItem() instanceof ItemManaGun && ItemManaGun.getLens(stack) == null) foundGun = true; - else if(stack.getItem() instanceof ILens) - foundLens = true; + else if(stack.getItem() instanceof ILens) foundLens = true; - else return false; // Found an invalid item, breaking the recipe - } - } + else return false; // Found an invalid item, breaking the recipe + } + } - return foundLens && foundGun; - } + return foundLens && foundGun; + } - @Override - public ItemStack getCraftingResult(InventoryCrafting var1) { - ItemStack lens = null; - ItemStack gun = null; + @Override + public ItemStack getCraftingResult(InventoryCrafting var1) { + ItemStack lens = null; + ItemStack gun = null; - for(int i = 0; i < var1.getSizeInventory(); i++) { - ItemStack stack = var1.getStackInSlot(i); - if(stack != null) { - if(stack.getItem() instanceof ItemManaGun) - gun = stack; - else if(stack.getItem() instanceof ILens) - lens = stack; - } - } + for(int i = 0; i < var1.getSizeInventory(); i++) { + ItemStack stack = var1.getStackInSlot(i); + if(stack != null) { + if(stack.getItem() instanceof ItemManaGun) gun = stack; + else if(stack.getItem() instanceof ILens) lens = stack; + } + } - if(lens == null || gun == null) - return null; + if(lens == null || gun == null) return null; - ItemStack gunCopy = gun.copy(); - ItemManaGun.setLens(gunCopy, lens); + ItemStack gunCopy = gun.copy(); + ItemManaGun.setLens(gunCopy, lens); - return gunCopy; - } + return gunCopy; + } - @Override - public int getRecipeSize() { - return 10; - } + @Override + public int getRecipeSize() { + return 10; + } - @Override - public ItemStack getRecipeOutput() { - return null; - } + @Override + public ItemStack getRecipeOutput() { + return null; + } } diff --git a/MODSRC/vazkii/botania/common/entity/EntityManaBurst.java b/MODSRC/vazkii/botania/common/entity/EntityManaBurst.java index ac726c523..f4345b598 100644 --- a/MODSRC/vazkii/botania/common/entity/EntityManaBurst.java +++ b/MODSRC/vazkii/botania/common/entity/EntityManaBurst.java @@ -2,19 +2,15 @@ * This class was created by . 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 26, 2014, 5:09:12 PM (GMT)] */ package vazkii.botania.common.entity; -import java.awt.Color; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.entity.Entity; @@ -25,11 +21,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.*; import net.minecraft.world.World; import vazkii.botania.api.internal.IManaBurst; import vazkii.botania.api.mana.ILensEffect; @@ -41,703 +33,668 @@ import vazkii.botania.common.block.tile.TileSpreader; import vazkii.botania.common.core.handler.ConfigHandler; import vazkii.botania.common.core.helper.Vector3; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + public class EntityManaBurst extends EntityThrowable implements IManaBurst { - private static final String TAG_COLOR = "color"; - private static final String TAG_MANA = "mana"; - private static final String TAG_STARTING_MANA = "startingMana"; - private static final String TAG_MIN_MANA_LOSS = "minManaLoss"; - private static final String TAG_TICK_MANA_LOSS = "manaLossTick"; - private static final String TAG_SPREADER_X = "spreaderX"; - private static final String TAG_SPREADER_Y = "spreaderY"; - private static final String TAG_SPREADER_Z = "spreaderZ"; - private static final String TAG_GRAVITY = "gravity"; - private static final String TAG_LAST_MOTION_X = "lastMotionX"; - private static final String TAG_LAST_MOTION_Y = "lastMotionY"; - private static final String TAG_LAST_MOTION_Z = "lastMotionZ"; - - boolean fake = false; - - final int dataWatcherEntries = 10; - final int dataWatcherStart = 32 - dataWatcherEntries; - - List alreadyCollidedAt = new ArrayList(); - - boolean fullManaLastTick = true; - - boolean scanBeam = false; - public List propsList = new ArrayList(); - - public EntityManaBurst(World world) { - super(world); - setSize(0F, 0F); - for(int i = 0; i < dataWatcherEntries; i++) { - int j = dataWatcherStart + i; - if(i == 4 || i == 5 || i == 10 || i == 11 || i == 12) - dataWatcher.addObject(j, 0F); - else if(i == 9) - dataWatcher.addObject(j, new ItemStack(Blocks.stone, 0, 0)); - else dataWatcher.addObject(j, 0); - - dataWatcher.setObjectWatched(j); - } - } - - public EntityManaBurst(TileSpreader spreader, boolean fake) { - this(spreader.getWorldObj()); - this.fake = fake; - - setBurstSourceCoords(spreader.xCoord, spreader.yCoord, spreader.zCoord); - setLocationAndAngles(spreader.xCoord + 0.5, spreader.yCoord + 0.5, spreader.zCoord + 0.5, 0, 0); - rotationYaw = -(spreader.rotationX + 90F); - rotationPitch = spreader.rotationY; - - float f = 0.4F; - double mx = MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f / 2D; - double mz = -(MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D; - double my = MathHelper.sin((rotationPitch + func_70183_g()) / 180.0F * (float) Math.PI) * f / 2D; - setMotion(mx, my, mz); - } - - public EntityManaBurst(EntityPlayer player) { - this(player.worldObj); - - setBurstSourceCoords(0, -1, 0); - setLocationAndAngles(player.posX, player.posY + player.getEyeHeight(), player.posZ, player.rotationYaw + 180, -player.rotationPitch); - - posX -= MathHelper.cos((rotationYaw + 180) / 180.0F * (float) Math.PI) * 0.16F; - posY -= 0.10000000149011612D; - posZ -= MathHelper.sin((rotationYaw + 180) / 180.0F * (float) Math.PI) * 0.16F; - - setPosition(posX, posY, posZ); - yOffset = 0.0F; - float f = 0.4F; - double mx = MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f / 2D; - double mz = -(MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D; - double my = MathHelper.sin((rotationPitch + func_70183_g()) / 180.0F * (float) Math.PI) * f / 2D; - setMotion(mx, my, mz); - } - - float accumulatedManaLoss = 0; - - private int ticksInAir; - - // Hacked code copied from super.onUpdate, to use Vector3 rather than the world vector pool - public void superUpdate() { - lastTickPosX = posX; - lastTickPosY = posY; - lastTickPosZ = posZ; - onEntityUpdate(); - - if(throwableShake > 0) - --throwableShake; - - Vec3 vec3 = new Vector3(posX, posY, posZ).toVec3D(); - Vec3 vec31 = new Vector3(posX + motionX, posY + motionY, posZ + motionZ).toVec3D(); - MovingObjectPosition movingobjectposition = clip(vec3, vec31); - - if(movingobjectposition != null) - vec31 = new Vector3(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord).toVec3D(); - - if(!worldObj.isRemote) { - Entity entity = null; - List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D)); - double d0 = 0.0D; - EntityLivingBase entitylivingbase = getThrower(); - - for(int j = 0; j < list.size(); ++j) { - Entity entity1 = (Entity) list.get(j); - - if(entity1.canBeCollidedWith() && (entity1 != entitylivingbase || ticksInAir >= 5)) { - float f = 0.3F; - AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f); - MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); - - if(movingobjectposition1 != null) { - double d1 = vec3.distanceTo(movingobjectposition1.hitVec); - - if (d1 < d0 || d0 == 0.0D) { - entity = entity1; - d0 = d1; - } - } - } - } - - if(entity != null) - movingobjectposition = new MovingObjectPosition(entity); - } - - if(movingobjectposition != null) - onImpact(movingobjectposition); - - posX += motionX; - posY += motionY; - posZ += motionZ; - float f1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ); - rotationYaw = (float)(Math.atan2(motionX, motionZ) * 180.0D / Math.PI); - - for(rotationPitch = (float)(Math.atan2(motionY, f1) * 180.0D / Math.PI); rotationPitch - prevRotationPitch < -180.0F; prevRotationPitch -= 360.0F); - - while(rotationPitch - prevRotationPitch >= 180.0F) - prevRotationPitch += 360.0F; - - while(rotationYaw - prevRotationYaw < -180.0F) - prevRotationYaw -= 360.0F; - - while(rotationYaw - prevRotationYaw >= 180.0F) - prevRotationYaw += 360.0F; - - rotationPitch = prevRotationPitch + (rotationPitch - prevRotationPitch) * 0.2F; - rotationYaw = prevRotationYaw + (rotationYaw - prevRotationYaw) * 0.2F; - float f3 = getGravityVelocity(); - - motionY -= f3; - setPosition(posX, posY, posZ); - } - - public MovingObjectPosition clip(Vec3 par1Vec3, Vec3 par2Vec3) { - boolean par3 = false; - boolean par4 = false; - if (!Double.isNaN(par1Vec3.xCoord) && !Double.isNaN(par1Vec3.yCoord) && !Double.isNaN(par1Vec3.zCoord)) { - if (!Double.isNaN(par2Vec3.xCoord) && !Double.isNaN(par2Vec3.yCoord) && !Double.isNaN(par2Vec3.zCoord)) { - int i = MathHelper.floor_double(par2Vec3.xCoord); - int j = MathHelper.floor_double(par2Vec3.yCoord); - int k = MathHelper.floor_double(par2Vec3.zCoord); - int l = MathHelper.floor_double(par1Vec3.xCoord); - int i1 = MathHelper.floor_double(par1Vec3.yCoord); - int j1 = MathHelper.floor_double(par1Vec3.zCoord); - Block block = worldObj.getBlock(l, i1, j1); - int l1 = worldObj.getBlockMetadata(l, i1, j1); - - if (block != null && (!par4 || block == null || block.getCollisionBoundingBoxFromPool(worldObj, l, i1, j1) != null) && block != Blocks.air && block.canCollideCheck(l1, par3)) { - MovingObjectPosition movingobjectposition = block.collisionRayTrace(worldObj, l, i1, j1, par1Vec3, par2Vec3); - - if (movingobjectposition != null) - return movingobjectposition; - } - - int k1 = 200; - - while (k1-- >= 0) { - if (Double.isNaN(par1Vec3.xCoord) || Double.isNaN(par1Vec3.yCoord) || Double.isNaN(par1Vec3.zCoord)) - return null; - - if (l == i && i1 == j && j1 == k) - return null; - - boolean flag2 = true; - boolean flag3 = true; - boolean flag4 = true; - double d0 = 999.0D; - double d1 = 999.0D; - double d2 = 999.0D; - - if (i > l) - d0 = l + 1.0D; - else if (i < l) - d0 = l + 0.0D; - else flag2 = false; - - if (j > i1) - d1 = i1 + 1.0D; - else if (j < i1) - d1 = i1 + 0.0D; - else flag3 = false; - - if (k > j1) - d2 = j1 + 1.0D; - else if (k < j1) - d2 = j1 + 0.0D; - else flag4 = false; - - double d3 = 999.0D; - double d4 = 999.0D; - double d5 = 999.0D; - double d6 = par2Vec3.xCoord - par1Vec3.xCoord; - double d7 = par2Vec3.yCoord - par1Vec3.yCoord; - double d8 = par2Vec3.zCoord - par1Vec3.zCoord; - - if (flag2) - d3 = (d0 - par1Vec3.xCoord) / d6; - - if (flag3) - d4 = (d1 - par1Vec3.yCoord) / d7; - - if (flag4) - d5 = (d2 - par1Vec3.zCoord) / d8; - - byte b0; - - if (d3 < d4 && d3 < d5) { - if (i > l) - b0 = 4; - else b0 = 5; - - par1Vec3.xCoord = d0; - par1Vec3.yCoord += d7 * d3; - par1Vec3.zCoord += d8 * d3; - } else if (d4 < d5) { - if (j > i1) - b0 = 0; - else b0 = 1; - - par1Vec3.xCoord += d6 * d4; - par1Vec3.yCoord = d1; - par1Vec3.zCoord += d8 * d4; - } else { - if (k > j1) - b0 = 2; - else b0 = 3; - - par1Vec3.xCoord += d6 * d5; - par1Vec3.yCoord += d7 * d5; - par1Vec3.zCoord = d2; - } - - Vec3 vec32 = new Vector3(par1Vec3.xCoord, par1Vec3.yCoord, par1Vec3.zCoord).toVec3D(); - l = (int)(vec32.xCoord = MathHelper.floor_double(par1Vec3.xCoord)); - - if (b0 == 5) { - --l; - ++vec32.xCoord; - } - - i1 = (int)(vec32.yCoord = MathHelper.floor_double(par1Vec3.yCoord)); - - if (b0 == 1) { - --i1; - ++vec32.yCoord; - } - - j1 = (int)(vec32.zCoord = MathHelper.floor_double(par1Vec3.zCoord)); - - if (b0 == 3) { - --j1; - ++vec32.zCoord; - } - - Block block1 = worldObj.getBlock(l, i1, j1); - int j2 = worldObj.getBlockMetadata(l, i1, j1); - - if ((!par4 || block1 == null || block1.getCollisionBoundingBoxFromPool(worldObj, l, i1, j1) != null) && block1 != Blocks.air && block1.canCollideCheck(j2, par3)) { - MovingObjectPosition movingobjectposition1 = block1.collisionRayTrace(worldObj, l, i1, j1, par1Vec3, par2Vec3); - - if (movingobjectposition1 != null) - return movingobjectposition1; - } - } - - return null; - } - else return null; - } else return null; - } - - @Override - public void onUpdate() { - superUpdate(); - - ILensEffect lens = getLensInstance(); - if(lens != null) - lens.updateBurst(this, getSourceLens()); - - int mana = getMana(); - if(ticksExisted >= getMinManaLoss()) { - accumulatedManaLoss += getManaLossPerTick(); - int loss = (int) accumulatedManaLoss; - setMana(mana - loss); - accumulatedManaLoss -= loss; - - if(getMana() <= 0) - setDead(); - } - - particles(); - - setMotion(motionX, motionY, motionZ); - - fullManaLastTick = getMana() == getStartingMana(); - - if(scanBeam) { - PositionProperties props = new PositionProperties(this); - if(propsList.isEmpty()) - propsList.add(props); - else { - PositionProperties lastProps = propsList.get(propsList.size() - 1); - if(!props.coordsEqual(lastProps)) - propsList.add(props); - } - } - } - - @Override - public boolean handleWaterMovement() { - return false; - } - - TileEntity collidedTile = null; - boolean noParticles = false; - - public TileEntity getCollidedTile(boolean noParticles) { - this.noParticles = noParticles; - - while(!isDead) { - ++ticksExisted; - onUpdate(); - } - - if(fake) - incrementFakeParticleTick(); - - return collidedTile; - } - - @Override - public void writeEntityToNBT(NBTTagCompound par1nbtTagCompound) { - super.writeEntityToNBT(par1nbtTagCompound); - par1nbtTagCompound.setInteger(TAG_COLOR, getColor()); - par1nbtTagCompound.setInteger(TAG_MANA, getMana()); - par1nbtTagCompound.setInteger(TAG_STARTING_MANA, getStartingMana()); - par1nbtTagCompound.setInteger(TAG_MIN_MANA_LOSS, getMinManaLoss()); - par1nbtTagCompound.setFloat(TAG_TICK_MANA_LOSS, getManaLossPerTick()); - par1nbtTagCompound.setFloat(TAG_GRAVITY, getGravity()); - - ChunkCoordinates coords = getBurstSourceChunkCoordinates(); - par1nbtTagCompound.setInteger(TAG_SPREADER_X, coords.posX); - par1nbtTagCompound.setInteger(TAG_SPREADER_Y, coords.posY); - par1nbtTagCompound.setInteger(TAG_SPREADER_Z, coords.posZ); - - par1nbtTagCompound.setDouble(TAG_LAST_MOTION_X, motionX); - par1nbtTagCompound.setDouble(TAG_LAST_MOTION_Y, motionY); - par1nbtTagCompound.setDouble(TAG_LAST_MOTION_Z, motionZ); - } - - @Override - public void readEntityFromNBT(NBTTagCompound par1nbtTagCompound) { - super.readEntityFromNBT(par1nbtTagCompound); - setColor(par1nbtTagCompound.getInteger(TAG_COLOR)); - setMana(par1nbtTagCompound.getInteger(TAG_MANA)); - setStartingMana(par1nbtTagCompound.getInteger(TAG_STARTING_MANA)); - setMinManaLoss(par1nbtTagCompound.getInteger(TAG_MIN_MANA_LOSS)); - setManaLossPerTick(par1nbtTagCompound.getFloat(TAG_TICK_MANA_LOSS)); - setGravity(par1nbtTagCompound.getFloat(TAG_GRAVITY)); - - int x = par1nbtTagCompound.getInteger(TAG_SPREADER_X); - int y = par1nbtTagCompound.getInteger(TAG_SPREADER_Y); - int z = par1nbtTagCompound.getInteger(TAG_SPREADER_Z); - - setBurstSourceCoords(x, y, z); - - double lastMotionX = par1nbtTagCompound.getDouble(TAG_LAST_MOTION_X); - double lastMotionY = par1nbtTagCompound.getDouble(TAG_LAST_MOTION_Y); - double lastMotionZ = par1nbtTagCompound.getDouble(TAG_LAST_MOTION_Z); - - setMotion(lastMotionX, lastMotionY, lastMotionZ); - } - - public void particles() { - if(isDead || !worldObj.isRemote) - return; - - ILensEffect lens = getLensInstance(); - if(lens != null && !lens.doParticles(this, getSourceLens())) - return; - - Color color = new Color(getColor()); - float r = color.getRed() / 255F; - float g = color.getGreen() / 255F; - float b = color.getBlue() / 255F; - - int mana = getMana(); - int maxMana = getStartingMana(); - float size = (float) mana / (float) maxMana; - - if(fake) { - if(getMana() == getStartingMana()) - size = 2F; - else if(fullManaLastTick) - size = 4F; - - if(!noParticles && shouldDoFakeParticles()) - Botania.proxy.sparkleFX(worldObj, posX, posY, posZ, r, g, b, 0.4F * size, 1, true); - } else { - if(ConfigHandler.subtlePowerSystem) - for(int i = 0; i < 1; i++) - Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.1F * size, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.01F); - else { - posX += motionX; - posY += motionY; - posZ += motionZ; - - Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.2F * size, (float) -motionX * 0.01F, (float) -motionY * 0.01F, (float) -motionZ * 0.01F); - Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.1F * size, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F); - - posX -= motionX / 2.0; - posY -= motionY / 2.0; - posZ -= motionZ / 2.0; - - Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.2F * size, (float) -motionX * 0.01F, (float) -motionY * 0.01F, (float) -motionZ * 0.01F); - - posX -= motionX / 2.0; - posY -= motionY / 2.0; - posZ -= motionZ / 2.0; - } - } - } - - @Override - protected void onImpact(MovingObjectPosition movingobjectposition) { - boolean collided = false; - boolean dead = false; - - if(movingobjectposition.entityHit == null) { - TileEntity tile = worldObj.getTileEntity(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); - Block block = worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); - - if((tile instanceof IManaCollisionGhost && ((IManaCollisionGhost) tile).isGhost()) || block instanceof BlockBush) - return; - - ChunkCoordinates coords = getBurstSourceChunkCoordinates(); - if(tile != null && (tile.xCoord != coords.posX || tile.yCoord != coords.posY || tile.zCoord != coords.posZ)) - collidedTile = tile; - - if(tile == null || tile.xCoord != coords.posX || tile.yCoord != coords.posY || tile.zCoord != coords.posZ) { - if(!fake && !noParticles && !worldObj.isRemote && tile != null && tile instanceof IManaReceiver && ((IManaReceiver) tile).canRecieveManaFromBursts()) { - int mana = getMana(); - if(tile instanceof IManaCollector) - mana *= ((IManaCollector) tile).getManaYieldMultiplier(this); - - ((IManaReceiver) tile).recieveMana(mana); - worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord); - } - - dead = true; - } - - collided = true; - } - - ILensEffect lens = getLensInstance(); - if(lens != null) - dead = lens.collideBurst(this, movingobjectposition, collidedTile != null && collidedTile instanceof IManaReceiver && ((IManaReceiver) collidedTile).canRecieveManaFromBursts(), dead, getSourceLens()); - - if(collided && !hasAlreadyCollidedAt(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ)) - alreadyCollidedAt.add(getCollisionLocString(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ)); - - if(dead && !isDead) { - if(!fake) { - Color color = new Color(getColor()); - float r = color.getRed() / 255F; - float g = color.getGreen() / 255F; - float b = color.getBlue() / 255F; - - int mana = getMana(); - int maxMana = getStartingMana(); - float size = (float) mana / (float) maxMana; - - if(!ConfigHandler.subtlePowerSystem) - for(int i = 0; i < 4; i++) - Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.15F * size, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F); - Botania.proxy.sparkleFX(worldObj, (float) posX, (float) posY, (float) posZ, r, g, b, 4, 2); - } - - setDead(); - } - } - - @Override - public void setDead() { - super.setDead(); - - if(!fake) { - ChunkCoordinates coords = getBurstSourceChunkCoordinates(); - TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ); - if(tile != null && tile instanceof TileSpreader) - ((TileSpreader) tile).canShootBurst = true; - } else setDeathTicksForFakeParticle(); - } - - @Override - protected float getGravityVelocity() { - return getGravity(); - } - - @Override - public boolean isFake() { - return fake; - } - - public void setScanBeam() { - scanBeam = true; - } - - @Override - public int getColor() { - return dataWatcher.getWatchableObjectInt(dataWatcherStart); - } - - @Override - public void setColor(int color) { - dataWatcher.updateObject(dataWatcherStart, color); - } - - @Override - public int getMana() { - return dataWatcher.getWatchableObjectInt(dataWatcherStart + 1); - } - - @Override - public void setMana(int mana) { - dataWatcher.updateObject(dataWatcherStart + 1, mana); - } - - @Override - public int getStartingMana() { - return dataWatcher.getWatchableObjectInt(dataWatcherStart + 2); - } - - @Override - public void setStartingMana(int mana) { - dataWatcher.updateObject(dataWatcherStart + 2, mana); - } - - @Override - public int getMinManaLoss() { - return dataWatcher.getWatchableObjectInt(dataWatcherStart + 3); - } - - @Override - public void setMinManaLoss(int minManaLoss) { - dataWatcher.updateObject(dataWatcherStart + 3, minManaLoss); - } - - @Override - public float getManaLossPerTick() { - return dataWatcher.getWatchableObjectFloat(dataWatcherStart + 4); - } - - @Override - public void setManaLossPerTick(float mana) { - dataWatcher.updateObject(dataWatcherStart + 4, mana); - } - - @Override - public float getGravity() { - return dataWatcher.getWatchableObjectFloat(dataWatcherStart + 5); - } - - @Override - public void setGravity(float gravity) { - dataWatcher.updateObject(dataWatcherStart + 5, gravity); - } - - final int coordsStart = dataWatcherStart + 6; - - @Override - public ChunkCoordinates getBurstSourceChunkCoordinates() { - int x = dataWatcher.getWatchableObjectInt(coordsStart); - int y = dataWatcher.getWatchableObjectInt(coordsStart + 1); - int z = dataWatcher.getWatchableObjectInt(coordsStart + 2); - - return new ChunkCoordinates(x, y, z); - } - - @Override - public void setBurstSourceCoords(int x, int y, int z) { - dataWatcher.updateObject(coordsStart, x); - dataWatcher.updateObject(coordsStart + 1, y); - dataWatcher.updateObject(coordsStart + 2, z); - } - - @Override - public ItemStack getSourceLens() { - return dataWatcher.getWatchableObjectItemStack(dataWatcherStart + 9); - } - - @Override - public void setSourceLens(ItemStack lens) { - dataWatcher.updateObject(dataWatcherStart + 9, lens == null ? new ItemStack(Blocks.stone, 0, 0) : lens); - } - - public ILensEffect getLensInstance() { - ItemStack lens = getSourceLens(); - if(lens != null && lens.getItem() instanceof ILensEffect) - return (ILensEffect) lens.getItem(); - - return null; - } - - final int motionStart = dataWatcherStart + 10; - - @Override - public void setMotion(double x, double y, double z) { - motionX = x; - motionY = y; - motionZ = z; - } - - @Override - public boolean hasAlreadyCollidedAt(int x, int y, int z) { - return alreadyCollidedAt.contains(getCollisionLocString(x, y, z)); - } - - private String getCollisionLocString(int x, int y, int z) { - return x + ":" + y + ":" + z; - } - - private boolean shouldDoFakeParticles() { - if(ConfigHandler.staticWandBeam) - return true; - - ChunkCoordinates coords = getBurstSourceChunkCoordinates(); - TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ); - if(tile != null && tile instanceof TileSpreader) - return getMana() != getStartingMana() && fullManaLastTick || Math.abs(((TileSpreader) tile).burstParticleTick - ticksExisted) < 4; - return false; - } - - private void incrementFakeParticleTick() { - ChunkCoordinates coords = getBurstSourceChunkCoordinates(); - TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ); - if(tile != null && tile instanceof TileSpreader) { - TileSpreader spreader = (TileSpreader) tile; - spreader.burstParticleTick += 2; - if(spreader.lastBurstDeathTick != -1 && spreader.burstParticleTick > spreader.lastBurstDeathTick) - spreader.burstParticleTick = 0; - } - } - - private void setDeathTicksForFakeParticle() { - ChunkCoordinates coords = getBurstSourceChunkCoordinates(); - TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ); - if(tile != null && tile instanceof TileSpreader) - ((TileSpreader) tile).lastBurstDeathTick = ticksExisted; - } - - public static class PositionProperties { - - public final ChunkCoordinates coords; - public final Block block; - public final int meta; - - public PositionProperties(Entity entity) { - int x = (int) entity.posX; - int y = (int) entity.posY; - int z = (int) entity.posZ; - coords = new ChunkCoordinates(x, y, z); - block = entity.worldObj.getBlock(x, y, z); - meta = entity.worldObj.getBlockMetadata(x, y, z); - } - - public boolean coordsEqual(PositionProperties props) { - return coords.equals(props.coords); - } - - public boolean contentsEqual(World world) { - Block block = world.getBlock(coords.posX, coords.posY, coords.posZ); - int meta = world.getBlockMetadata(coords.posX, coords.posY, coords.posZ); - return block == this.block && meta == this.meta; - } - } + private static final String TAG_COLOR = "color"; + private static final String TAG_MANA = "mana"; + private static final String TAG_STARTING_MANA = "startingMana"; + private static final String TAG_MIN_MANA_LOSS = "minManaLoss"; + private static final String TAG_TICK_MANA_LOSS = "manaLossTick"; + private static final String TAG_SPREADER_X = "spreaderX"; + private static final String TAG_SPREADER_Y = "spreaderY"; + private static final String TAG_SPREADER_Z = "spreaderZ"; + private static final String TAG_GRAVITY = "gravity"; + private static final String TAG_LAST_MOTION_X = "lastMotionX"; + private static final String TAG_LAST_MOTION_Y = "lastMotionY"; + private static final String TAG_LAST_MOTION_Z = "lastMotionZ"; + + boolean fake = false; + + final int dataWatcherEntries = 10; + final int dataWatcherStart = 32 - dataWatcherEntries; + + List alreadyCollidedAt = new ArrayList(); + + boolean fullManaLastTick = true; + + boolean scanBeam = false; + public List propsList = new ArrayList(); + + public EntityManaBurst(World world) { + super(world); + setSize(0F, 0F); + for(int i = 0; i < dataWatcherEntries; i++) { + int j = dataWatcherStart + i; + if(i == 4 || i == 5 || i == 10 || i == 11 || i == 12) dataWatcher.addObject(j, 0F); + else if(i == 9) dataWatcher.addObject(j, new ItemStack(Blocks.stone, 0, 0)); + else dataWatcher.addObject(j, 0); + + dataWatcher.setObjectWatched(j); + } + } + + public EntityManaBurst(TileSpreader spreader, boolean fake) { + this(spreader.getWorldObj()); + this.fake = fake; + + setBurstSourceCoords(spreader.xCoord, spreader.yCoord, spreader.zCoord); + setLocationAndAngles(spreader.xCoord + 0.5, spreader.yCoord + 0.5, spreader.zCoord + 0.5, 0, 0); + rotationYaw = -(spreader.rotationX + 90F); + rotationPitch = spreader.rotationY; + + float f = 0.4F; + double mx = MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f / 2D; + double mz = -(MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D; + double my = MathHelper.sin((rotationPitch + func_70183_g()) / 180.0F * (float) Math.PI) * f / 2D; + setMotion(mx, my, mz); + } + + public EntityManaBurst(EntityPlayer player) { + this(player.worldObj); + + setBurstSourceCoords(0, -1, 0); + setLocationAndAngles(player.posX, player.posY + player.getEyeHeight(), player.posZ, player.rotationYaw + 180, -player.rotationPitch); + + posX -= MathHelper.cos((rotationYaw + 180) / 180.0F * (float) Math.PI) * 0.16F; + posY -= 0.10000000149011612D; + posZ -= MathHelper.sin((rotationYaw + 180) / 180.0F * (float) Math.PI) * 0.16F; + + setPosition(posX, posY, posZ); + yOffset = 0.0F; + float f = 0.4F; + double mx = MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f / 2D; + double mz = -(MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D; + double my = MathHelper.sin((rotationPitch + func_70183_g()) / 180.0F * (float) Math.PI) * f / 2D; + setMotion(mx, my, mz); + } + + float accumulatedManaLoss = 0; + + private int ticksInAir; + + // Hacked code copied from super.onUpdate, to use Vector3 rather than the world vector pool + public void superUpdate() { + lastTickPosX = posX; + lastTickPosY = posY; + lastTickPosZ = posZ; + onEntityUpdate(); + + if(throwableShake > 0) --throwableShake; + + Vec3 vec3 = new Vector3(posX, posY, posZ).toVec3D(); + Vec3 vec31 = new Vector3(posX + motionX, posY + motionY, posZ + motionZ).toVec3D(); + MovingObjectPosition movingobjectposition = clip(vec3, vec31); + + if(movingobjectposition != null) + vec31 = new Vector3(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord).toVec3D(); + + if(!worldObj.isRemote) { + Entity entity = null; + List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D)); + double d0 = 0.0D; + EntityLivingBase entitylivingbase = getThrower(); + + for(int j = 0; j < list.size(); ++j) { + Entity entity1 = (Entity) list.get(j); + + if(entity1.canBeCollidedWith() && (entity1 != entitylivingbase || ticksInAir >= 5)) { + float f = 0.3F; + AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f); + MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); + + if(movingobjectposition1 != null) { + double d1 = vec3.distanceTo(movingobjectposition1.hitVec); + + if(d1 < d0 || d0 == 0.0D) { + entity = entity1; + d0 = d1; + } + } + } + } + + if(entity != null) movingobjectposition = new MovingObjectPosition(entity); + } + + if(movingobjectposition != null) onImpact(movingobjectposition); + + posX += motionX; + posY += motionY; + posZ += motionZ; + float f1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ); + rotationYaw = (float) (Math.atan2(motionX, motionZ) * 180.0D / Math.PI); + + for(rotationPitch = (float) (Math.atan2(motionY, f1) * 180.0D / Math.PI); rotationPitch - prevRotationPitch < -180.0F; prevRotationPitch -= 360.0F) + ; + + while(rotationPitch - prevRotationPitch >= 180.0F) prevRotationPitch += 360.0F; + + while(rotationYaw - prevRotationYaw < -180.0F) prevRotationYaw -= 360.0F; + + while(rotationYaw - prevRotationYaw >= 180.0F) prevRotationYaw += 360.0F; + + rotationPitch = prevRotationPitch + (rotationPitch - prevRotationPitch) * 0.2F; + rotationYaw = prevRotationYaw + (rotationYaw - prevRotationYaw) * 0.2F; + float f3 = getGravityVelocity(); + + motionY -= f3; + setPosition(posX, posY, posZ); + } + + public MovingObjectPosition clip(Vec3 par1Vec3, Vec3 par2Vec3) { + boolean par3 = false; + boolean par4 = false; + if(!Double.isNaN(par1Vec3.xCoord) && !Double.isNaN(par1Vec3.yCoord) && !Double.isNaN(par1Vec3.zCoord)) { + if(!Double.isNaN(par2Vec3.xCoord) && !Double.isNaN(par2Vec3.yCoord) && !Double.isNaN(par2Vec3.zCoord)) { + int i = MathHelper.floor_double(par2Vec3.xCoord); + int j = MathHelper.floor_double(par2Vec3.yCoord); + int k = MathHelper.floor_double(par2Vec3.zCoord); + int l = MathHelper.floor_double(par1Vec3.xCoord); + int i1 = MathHelper.floor_double(par1Vec3.yCoord); + int j1 = MathHelper.floor_double(par1Vec3.zCoord); + Block block = worldObj.getBlock(l, i1, j1); + int l1 = worldObj.getBlockMetadata(l, i1, j1); + + if(block != null && (!par4 || block == null || block.getCollisionBoundingBoxFromPool(worldObj, l, i1, j1) != null) && block != Blocks.air && block.canCollideCheck(l1, par3)) { + MovingObjectPosition movingobjectposition = block.collisionRayTrace(worldObj, l, i1, j1, par1Vec3, par2Vec3); + + if(movingobjectposition != null) return movingobjectposition; + } + + int k1 = 200; + + while(k1-- >= 0) { + if(Double.isNaN(par1Vec3.xCoord) || Double.isNaN(par1Vec3.yCoord) || Double.isNaN(par1Vec3.zCoord)) + return null; + + if(l == i && i1 == j && j1 == k) return null; + + boolean flag2 = true; + boolean flag3 = true; + boolean flag4 = true; + double d0 = 999.0D; + double d1 = 999.0D; + double d2 = 999.0D; + + if(i > l) d0 = l + 1.0D; + else if(i < l) d0 = l + 0.0D; + else flag2 = false; + + if(j > i1) d1 = i1 + 1.0D; + else if(j < i1) d1 = i1 + 0.0D; + else flag3 = false; + + if(k > j1) d2 = j1 + 1.0D; + else if(k < j1) d2 = j1 + 0.0D; + else flag4 = false; + + double d3 = 999.0D; + double d4 = 999.0D; + double d5 = 999.0D; + double d6 = par2Vec3.xCoord - par1Vec3.xCoord; + double d7 = par2Vec3.yCoord - par1Vec3.yCoord; + double d8 = par2Vec3.zCoord - par1Vec3.zCoord; + + if(flag2) d3 = (d0 - par1Vec3.xCoord) / d6; + + if(flag3) d4 = (d1 - par1Vec3.yCoord) / d7; + + if(flag4) d5 = (d2 - par1Vec3.zCoord) / d8; + + byte b0; + + if(d3 < d4 && d3 < d5) { + if(i > l) b0 = 4; + else b0 = 5; + + par1Vec3.xCoord = d0; + par1Vec3.yCoord += d7 * d3; + par1Vec3.zCoord += d8 * d3; + } else if(d4 < d5) { + if(j > i1) b0 = 0; + else b0 = 1; + + par1Vec3.xCoord += d6 * d4; + par1Vec3.yCoord = d1; + par1Vec3.zCoord += d8 * d4; + } else { + if(k > j1) b0 = 2; + else b0 = 3; + + par1Vec3.xCoord += d6 * d5; + par1Vec3.yCoord += d7 * d5; + par1Vec3.zCoord = d2; + } + + Vec3 vec32 = new Vector3(par1Vec3.xCoord, par1Vec3.yCoord, par1Vec3.zCoord).toVec3D(); + l = (int) (vec32.xCoord = MathHelper.floor_double(par1Vec3.xCoord)); + + if(b0 == 5) { + --l; + ++vec32.xCoord; + } + + i1 = (int) (vec32.yCoord = MathHelper.floor_double(par1Vec3.yCoord)); + + if(b0 == 1) { + --i1; + ++vec32.yCoord; + } + + j1 = (int) (vec32.zCoord = MathHelper.floor_double(par1Vec3.zCoord)); + + if(b0 == 3) { + --j1; + ++vec32.zCoord; + } + + Block block1 = worldObj.getBlock(l, i1, j1); + int j2 = worldObj.getBlockMetadata(l, i1, j1); + + if((!par4 || block1 == null || block1.getCollisionBoundingBoxFromPool(worldObj, l, i1, j1) != null) && block1 != Blocks.air && block1.canCollideCheck(j2, par3)) { + MovingObjectPosition movingobjectposition1 = block1.collisionRayTrace(worldObj, l, i1, j1, par1Vec3, par2Vec3); + + if(movingobjectposition1 != null) return movingobjectposition1; + } + } + + return null; + } else return null; + } else return null; + } + + @Override + public void onUpdate() { + superUpdate(); + + ILensEffect lens = getLensInstance(); + if(lens != null) lens.updateBurst(this, getSourceLens()); + + int mana = getMana(); + if(ticksExisted >= getMinManaLoss()) { + accumulatedManaLoss += getManaLossPerTick(); + int loss = (int) accumulatedManaLoss; + setMana(mana - loss); + accumulatedManaLoss -= loss; + + if(getMana() <= 0) setDead(); + } + + particles(); + + setMotion(motionX, motionY, motionZ); + + fullManaLastTick = getMana() == getStartingMana(); + + if(scanBeam) { + PositionProperties props = new PositionProperties(this); + if(propsList.isEmpty()) propsList.add(props); + else { + PositionProperties lastProps = propsList.get(propsList.size() - 1); + if(!props.coordsEqual(lastProps)) propsList.add(props); + } + } + } + + @Override + public boolean handleWaterMovement() { + return false; + } + + TileEntity collidedTile = null; + boolean noParticles = false; + + public TileEntity getCollidedTile(boolean noParticles) { + this.noParticles = noParticles; + + while(!isDead) { + ++ticksExisted; + onUpdate(); + } + + if(fake) incrementFakeParticleTick(); + + return collidedTile; + } + + @Override + public void writeEntityToNBT(NBTTagCompound par1nbtTagCompound) { + super.writeEntityToNBT(par1nbtTagCompound); + par1nbtTagCompound.setInteger(TAG_COLOR, getColor()); + par1nbtTagCompound.setInteger(TAG_MANA, getMana()); + par1nbtTagCompound.setInteger(TAG_STARTING_MANA, getStartingMana()); + par1nbtTagCompound.setInteger(TAG_MIN_MANA_LOSS, getMinManaLoss()); + par1nbtTagCompound.setFloat(TAG_TICK_MANA_LOSS, getManaLossPerTick()); + par1nbtTagCompound.setFloat(TAG_GRAVITY, getGravity()); + + ChunkCoordinates coords = getBurstSourceChunkCoordinates(); + par1nbtTagCompound.setInteger(TAG_SPREADER_X, coords.posX); + par1nbtTagCompound.setInteger(TAG_SPREADER_Y, coords.posY); + par1nbtTagCompound.setInteger(TAG_SPREADER_Z, coords.posZ); + + par1nbtTagCompound.setDouble(TAG_LAST_MOTION_X, motionX); + par1nbtTagCompound.setDouble(TAG_LAST_MOTION_Y, motionY); + par1nbtTagCompound.setDouble(TAG_LAST_MOTION_Z, motionZ); + } + + @Override + public void readEntityFromNBT(NBTTagCompound par1nbtTagCompound) { + super.readEntityFromNBT(par1nbtTagCompound); + setColor(par1nbtTagCompound.getInteger(TAG_COLOR)); + setMana(par1nbtTagCompound.getInteger(TAG_MANA)); + setStartingMana(par1nbtTagCompound.getInteger(TAG_STARTING_MANA)); + setMinManaLoss(par1nbtTagCompound.getInteger(TAG_MIN_MANA_LOSS)); + setManaLossPerTick(par1nbtTagCompound.getFloat(TAG_TICK_MANA_LOSS)); + setGravity(par1nbtTagCompound.getFloat(TAG_GRAVITY)); + + int x = par1nbtTagCompound.getInteger(TAG_SPREADER_X); + int y = par1nbtTagCompound.getInteger(TAG_SPREADER_Y); + int z = par1nbtTagCompound.getInteger(TAG_SPREADER_Z); + + setBurstSourceCoords(x, y, z); + + double lastMotionX = par1nbtTagCompound.getDouble(TAG_LAST_MOTION_X); + double lastMotionY = par1nbtTagCompound.getDouble(TAG_LAST_MOTION_Y); + double lastMotionZ = par1nbtTagCompound.getDouble(TAG_LAST_MOTION_Z); + + setMotion(lastMotionX, lastMotionY, lastMotionZ); + } + + public void particles() { + if(isDead || !worldObj.isRemote) return; + + ILensEffect lens = getLensInstance(); + if(lens != null && !lens.doParticles(this, getSourceLens())) return; + + Color color = new Color(getColor()); + float r = color.getRed() / 255F; + float g = color.getGreen() / 255F; + float b = color.getBlue() / 255F; + + int mana = getMana(); + int maxMana = getStartingMana(); + float size = (float) mana / (float) maxMana; + + if(fake) { + if(getMana() == getStartingMana()) size = 2F; + else if(fullManaLastTick) size = 4F; + + if(!noParticles && shouldDoFakeParticles()) + Botania.proxy.sparkleFX(worldObj, posX, posY, posZ, r, g, b, 0.4F * size, 1, true); + } else { + if(ConfigHandler.subtlePowerSystem) for(int i = 0; i < 1; i++) + Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.1F * size, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.01F); + else { + posX += motionX; + posY += motionY; + posZ += motionZ; + + Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.2F * size, (float) -motionX * 0.01F, (float) -motionY * 0.01F, (float) -motionZ * 0.01F); + Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.1F * size, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F); + + posX -= motionX / 2.0; + posY -= motionY / 2.0; + posZ -= motionZ / 2.0; + + Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.2F * size, (float) -motionX * 0.01F, (float) -motionY * 0.01F, (float) -motionZ * 0.01F); + + posX -= motionX / 2.0; + posY -= motionY / 2.0; + posZ -= motionZ / 2.0; + } + } + } + + @Override + protected void onImpact(MovingObjectPosition movingobjectposition) { + boolean collided = false; + boolean dead = false; + + if(movingobjectposition.entityHit == null) { + TileEntity tile = worldObj.getTileEntity(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); + Block block = worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); + + if((tile instanceof IManaCollisionGhost && ((IManaCollisionGhost) tile).isGhost()) || block instanceof BlockBush) + return; + + ChunkCoordinates coords = getBurstSourceChunkCoordinates(); + if(tile != null && (tile.xCoord != coords.posX || tile.yCoord != coords.posY || tile.zCoord != coords.posZ)) + collidedTile = tile; + + if(tile == null || tile.xCoord != coords.posX || tile.yCoord != coords.posY || tile.zCoord != coords.posZ) { + if(!fake && !noParticles && !worldObj.isRemote && tile != null && tile instanceof IManaReceiver && ((IManaReceiver) tile).canRecieveManaFromBursts()) { + int mana = getMana(); + if(tile instanceof IManaCollector) mana *= ((IManaCollector) tile).getManaYieldMultiplier(this); + + ((IManaReceiver) tile).recieveMana(mana); + worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord); + } + + dead = true; + } + + collided = true; + } + + ILensEffect lens = getLensInstance(); + if(lens != null) + dead = lens.collideBurst(this, movingobjectposition, collidedTile != null && collidedTile instanceof IManaReceiver && ((IManaReceiver) collidedTile).canRecieveManaFromBursts(), dead, getSourceLens()); + + if(collided && !hasAlreadyCollidedAt(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ)) + alreadyCollidedAt.add(getCollisionLocString(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ)); + + if(dead && !isDead) { + if(!fake) { + Color color = new Color(getColor()); + float r = color.getRed() / 255F; + float g = color.getGreen() / 255F; + float b = color.getBlue() / 255F; + + int mana = getMana(); + int maxMana = getStartingMana(); + float size = (float) mana / (float) maxMana; + + if(!ConfigHandler.subtlePowerSystem) for(int i = 0; i < 4; i++) + Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.15F * size, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F); + Botania.proxy.sparkleFX(worldObj, (float) posX, (float) posY, (float) posZ, r, g, b, 4, 2); + } + + setDead(); + } + } + + @Override + public void setDead() { + super.setDead(); + + if(!fake) { + ChunkCoordinates coords = getBurstSourceChunkCoordinates(); + TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ); + if(tile != null && tile instanceof TileSpreader) ((TileSpreader) tile).canShootBurst = true; + } else setDeathTicksForFakeParticle(); + } + + @Override + protected float getGravityVelocity() { + return getGravity(); + } + + @Override + public boolean isFake() { + return fake; + } + + public void setScanBeam() { + scanBeam = true; + } + + @Override + public int getColor() { + return dataWatcher.getWatchableObjectInt(dataWatcherStart); + } + + @Override + public void setColor(int color) { + dataWatcher.updateObject(dataWatcherStart, color); + } + + @Override + public int getMana() { + return dataWatcher.getWatchableObjectInt(dataWatcherStart + 1); + } + + @Override + public void setMana(int mana) { + dataWatcher.updateObject(dataWatcherStart + 1, mana); + } + + @Override + public int getStartingMana() { + return dataWatcher.getWatchableObjectInt(dataWatcherStart + 2); + } + + @Override + public void setStartingMana(int mana) { + dataWatcher.updateObject(dataWatcherStart + 2, mana); + } + + @Override + public int getMinManaLoss() { + return dataWatcher.getWatchableObjectInt(dataWatcherStart + 3); + } + + @Override + public void setMinManaLoss(int minManaLoss) { + dataWatcher.updateObject(dataWatcherStart + 3, minManaLoss); + } + + @Override + public float getManaLossPerTick() { + return dataWatcher.getWatchableObjectFloat(dataWatcherStart + 4); + } + + @Override + public void setManaLossPerTick(float mana) { + dataWatcher.updateObject(dataWatcherStart + 4, mana); + } + + @Override + public float getGravity() { + return dataWatcher.getWatchableObjectFloat(dataWatcherStart + 5); + } + + @Override + public void setGravity(float gravity) { + dataWatcher.updateObject(dataWatcherStart + 5, gravity); + } + + final int coordsStart = dataWatcherStart + 6; + + @Override + public ChunkCoordinates getBurstSourceChunkCoordinates() { + int x = dataWatcher.getWatchableObjectInt(coordsStart); + int y = dataWatcher.getWatchableObjectInt(coordsStart + 1); + int z = dataWatcher.getWatchableObjectInt(coordsStart + 2); + + return new ChunkCoordinates(x, y, z); + } + + @Override + public void setBurstSourceCoords(int x, int y, int z) { + dataWatcher.updateObject(coordsStart, x); + dataWatcher.updateObject(coordsStart + 1, y); + dataWatcher.updateObject(coordsStart + 2, z); + } + + @Override + public ItemStack getSourceLens() { + return dataWatcher.getWatchableObjectItemStack(dataWatcherStart + 9); + } + + @Override + public void setSourceLens(ItemStack lens) { + dataWatcher.updateObject(dataWatcherStart + 9, lens == null ? new ItemStack(Blocks.stone, 0, 0) : lens); + } + + public ILensEffect getLensInstance() { + ItemStack lens = getSourceLens(); + if(lens != null && lens.getItem() instanceof ILensEffect) return (ILensEffect) lens.getItem(); + + return null; + } + + final int motionStart = dataWatcherStart + 10; + + @Override + public void setMotion(double x, double y, double z) { + motionX = x; + motionY = y; + motionZ = z; + } + + @Override + public boolean hasAlreadyCollidedAt(int x, int y, int z) { + return alreadyCollidedAt.contains(getCollisionLocString(x, y, z)); + } + + private String getCollisionLocString(int x, int y, int z) { + return x + ":" + y + ":" + z; + } + + private boolean shouldDoFakeParticles() { + if(ConfigHandler.staticWandBeam) return true; + + ChunkCoordinates coords = getBurstSourceChunkCoordinates(); + TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ); + if(tile != null && tile instanceof TileSpreader) + return getMana() != getStartingMana() && fullManaLastTick || Math.abs(((TileSpreader) tile).burstParticleTick - ticksExisted) < 4; + return false; + } + + private void incrementFakeParticleTick() { + ChunkCoordinates coords = getBurstSourceChunkCoordinates(); + TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ); + if(tile != null && tile instanceof TileSpreader) { + TileSpreader spreader = (TileSpreader) tile; + spreader.burstParticleTick += 2; + if(spreader.lastBurstDeathTick != -1 && spreader.burstParticleTick > spreader.lastBurstDeathTick) + spreader.burstParticleTick = 0; + } + } + + private void setDeathTicksForFakeParticle() { + ChunkCoordinates coords = getBurstSourceChunkCoordinates(); + TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ); + if(tile != null && tile instanceof TileSpreader) ((TileSpreader) tile).lastBurstDeathTick = ticksExisted; + } + + public static class PositionProperties { + + public final ChunkCoordinates coords; + public final Block block; + public final int meta; + + public PositionProperties(Entity entity) { + int x = (int) entity.posX; + int y = (int) entity.posY; + int z = (int) entity.posZ; + coords = new ChunkCoordinates(x, y, z); + block = entity.worldObj.getBlock(x, y, z); + meta = entity.worldObj.getBlockMetadata(x, y, z); + } + + public boolean coordsEqual(PositionProperties props) { + return coords.equals(props.coords); + } + + public boolean contentsEqual(World world) { + Block block = world.getBlock(coords.posX, coords.posY, coords.posZ); + int meta = world.getBlockMetadata(coords.posX, coords.posY, coords.posZ); + return block == this.block && meta == this.meta; + } + } } diff --git a/MODSRC/vazkii/botania/common/entity/EntitySignalFlare.java b/MODSRC/vazkii/botania/common/entity/EntitySignalFlare.java index cff7c7940..cc45d0497 100644 --- a/MODSRC/vazkii/botania/common/entity/EntitySignalFlare.java +++ b/MODSRC/vazkii/botania/common/entity/EntitySignalFlare.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Mar 3, 2014, 7:10:32 PM (GMT)] */ package vazkii.botania.common.entity; @@ -19,61 +19,59 @@ import vazkii.botania.common.Botania; public class EntitySignalFlare extends Entity { - private static final String COLOR_TAG = "color"; + private static final String COLOR_TAG = "color"; - public EntitySignalFlare(World par1World) { - super(par1World); - setSize(0F, 0F); - dataWatcher.addObject(30, 0); - dataWatcher.setObjectWatched(30); - } + public EntitySignalFlare(World par1World) { + super(par1World); + setSize(0F, 0F); + dataWatcher.addObject(30, 0); + dataWatcher.setObjectWatched(30); + } - @Override - protected void entityInit() { - // NO-OP - } + @Override + protected void entityInit() { + // NO-OP + } - @Override - public void onEntityUpdate() { - super.onEntityUpdate(); - if(ticksExisted++ >= 100) - setDead(); + @Override + public void onEntityUpdate() { + super.onEntityUpdate(); + if(ticksExisted++ >= 100) setDead(); - if(!isDead) { - if(ticksExisted % 10 == 0) - playSound("creeper.primed", 1F, 1F); + if(!isDead) { + if(ticksExisted % 10 == 0) playSound("creeper.primed", 1F, 1F); - int color = getColor(); - if(color < 16 && color >= 0) { - float[] colorArray = EntitySheep.fleeceColorTable[color]; + int color = getColor(); + if(color < 16 && color >= 0) { + float[] colorArray = EntitySheep.fleeceColorTable[color]; - Botania.proxy.setWispFXDistanceLimit(false); - for(int i = 0; i < 3; i++) - Botania.proxy.wispFX(worldObj, posX, posY, posZ + 0.5, colorArray[0], colorArray[1], colorArray[2], (float) Math.random() * 5 + 1F, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt(256F / (256F - (float) posY)), (float) (Math.random() - 0.5F)); + Botania.proxy.setWispFXDistanceLimit(false); + for(int i = 0; i < 3; i++) + Botania.proxy.wispFX(worldObj, posX, posY, posZ + 0.5, colorArray[0], colorArray[1], colorArray[2], (float) Math.random() * 5 + 1F, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt(256F / (256F - (float) posY)), (float) (Math.random() - 0.5F)); - for(int i = 0; i < 4; i++) - Botania.proxy.wispFX(worldObj, posX + 0.5, 256, posZ + 0.5, colorArray[0], colorArray[1], colorArray[2], (float) Math.random() * 15 + 8F, (float) (Math.random() - 0.5F) * 8F, 0F, (float) (Math.random() - 0.5F) * 8F); - Botania.proxy.setWispFXDistanceLimit(true); - } - } - } + for(int i = 0; i < 4; i++) + Botania.proxy.wispFX(worldObj, posX + 0.5, 256, posZ + 0.5, colorArray[0], colorArray[1], colorArray[2], (float) Math.random() * 15 + 8F, (float) (Math.random() - 0.5F) * 8F, 0F, (float) (Math.random() - 0.5F) * 8F); + Botania.proxy.setWispFXDistanceLimit(true); + } + } + } - @Override - protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { - setColor(nbttagcompound.getInteger(COLOR_TAG)); - } + @Override + protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { + setColor(nbttagcompound.getInteger(COLOR_TAG)); + } - @Override - protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { - nbttagcompound.setInteger(COLOR_TAG, getColor()); - } + @Override + protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setInteger(COLOR_TAG, getColor()); + } - public void setColor(int color) { - dataWatcher.updateObject(30, color); - } + public void setColor(int color) { + dataWatcher.updateObject(30, color); + } - public int getColor() { - return dataWatcher.getWatchableObjectInt(30); - } + public int getColor() { + return dataWatcher.getWatchableObjectInt(30); + } } diff --git a/MODSRC/vazkii/botania/common/entity/ModEntities.java b/MODSRC/vazkii/botania/common/entity/ModEntities.java index 17d6e0a54..f85b2778e 100644 --- a/MODSRC/vazkii/botania/common/entity/ModEntities.java +++ b/MODSRC/vazkii/botania/common/entity/ModEntities.java @@ -2,25 +2,25 @@ * This class was created by . 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 26, 2014, 4:11:03 PM (GMT)] */ package vazkii.botania.common.entity; +import cpw.mods.fml.common.registry.EntityRegistry; import vazkii.botania.common.Botania; import vazkii.botania.common.lib.LibEntityNames; -import cpw.mods.fml.common.registry.EntityRegistry; public final class ModEntities { - public static void init() { - int id = 0; - EntityRegistry.registerModEntity(EntityManaBurst.class, LibEntityNames.MANA_BURST, id++, Botania.instance, 64, 10, true); - EntityRegistry.registerModEntity(EntitySignalFlare.class, LibEntityNames.SIGNAL_FLARE, id++, Botania.instance, 2048, 10, false); - } + public static void init() { + int id = 0; + EntityRegistry.registerModEntity(EntityManaBurst.class, LibEntityNames.MANA_BURST, id++, Botania.instance, 64, 10, true); + EntityRegistry.registerModEntity(EntitySignalFlare.class, LibEntityNames.SIGNAL_FLARE, id++, Botania.instance, 2048, 10, false); + } } diff --git a/MODSRC/vazkii/botania/common/item/Item16Colors.java b/MODSRC/vazkii/botania/common/item/Item16Colors.java index 3ff721388..13e0202ca 100644 --- a/MODSRC/vazkii/botania/common/item/Item16Colors.java +++ b/MODSRC/vazkii/botania/common/item/Item16Colors.java @@ -2,50 +2,50 @@ * This class was created by . 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 19, 2014, 4:09:57 PM (GMT)] */ package vazkii.botania.common.item; -import java.awt.Color; -import java.util.List; - import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import java.awt.*; +import java.util.List; + public class Item16Colors extends ItemMod { - public Item16Colors(String name) { - super(); - setHasSubtypes(true); - setUnlocalizedName(name); - } + public Item16Colors(String name) { + super(); + setHasSubtypes(true); + setUnlocalizedName(name); + } - @Override - public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { - float[] color = EntitySheep.fleeceColorTable[par1ItemStack.getItemDamage()]; - return new Color(color[0], color[1], color[2]).getRGB(); - } + @Override + public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { + float[] color = EntitySheep.fleeceColorTable[par1ItemStack.getItemDamage()]; + return new Color(color[0], color[1], color[2]).getRGB(); + } - @Override - public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List par3List) { - for(int i = 0; i < 16; i++) - par3List.add(new ItemStack(item, 1, i)); - } + @Override + public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List par3List) { + for(int i = 0; i < 16; i++) + par3List.add(new ItemStack(item, 1, i)); + } - @Override - public String getUnlocalizedName(ItemStack par1ItemStack) { - return getUnlocalizedNameLazy(par1ItemStack) + par1ItemStack.getItemDamage(); - } + @Override + public String getUnlocalizedName(ItemStack par1ItemStack) { + return getUnlocalizedNameLazy(par1ItemStack) + par1ItemStack.getItemDamage(); + } - String getUnlocalizedNameLazy(ItemStack par1ItemStack) { - return super.getUnlocalizedName(par1ItemStack); - } + String getUnlocalizedNameLazy(ItemStack par1ItemStack) { + return super.getUnlocalizedName(par1ItemStack); + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemDirtRod.java b/MODSRC/vazkii/botania/common/item/ItemDirtRod.java index 234acc8de..1eeecfce7 100644 --- a/MODSRC/vazkii/botania/common/item/ItemDirtRod.java +++ b/MODSRC/vazkii/botania/common/item/ItemDirtRod.java @@ -2,18 +2,17 @@ * This class was created by . 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 @ [Apr 11, 2014, 2:53:41 PM (GMT)] */ package vazkii.botania.common.item; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -23,34 +22,34 @@ import vazkii.botania.common.lib.LibItemNames; public class ItemDirtRod extends ItemMod { - private static final int COST = 75; - - public ItemDirtRod() { - super(); - setMaxStackSize(1); - setUnlocalizedName(LibItemNames.DIRT_ROD); - } - - @Override - public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { - if(ManaItemHandler.requestManaExact(par1ItemStack, par2EntityPlayer, COST, false)) { - ItemStack stackToPlace = new ItemStack(Blocks.dirt); - stackToPlace.tryPlaceItemIntoWorld(par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10); - - if(stackToPlace.stackSize == 0) { - ManaItemHandler.requestManaExact(par1ItemStack, par2EntityPlayer, COST, true); - ForgeDirection dir = ForgeDirection.getOrientation(par7); - for(int i = 0; i < 6; i++) - Botania.proxy.sparkleFX(par3World, par4 + dir.offsetX + Math.random(), par5 + dir.offsetY + Math.random(), par6 + dir.offsetZ + Math.random(), 0.35F, 0.2F, 0.05F, 1F, 5); - } - } - return true; - } - - @Override - public boolean isFull3D() { - return true; - } + private static final int COST = 75; + + public ItemDirtRod() { + super(); + setMaxStackSize(1); + setUnlocalizedName(LibItemNames.DIRT_ROD); + } + + @Override + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { + if(ManaItemHandler.requestManaExact(par1ItemStack, par2EntityPlayer, COST, false)) { + ItemStack stackToPlace = new ItemStack(Blocks.dirt); + stackToPlace.tryPlaceItemIntoWorld(par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10); + + if(stackToPlace.stackSize == 0) { + ManaItemHandler.requestManaExact(par1ItemStack, par2EntityPlayer, COST, true); + ForgeDirection dir = ForgeDirection.getOrientation(par7); + for(int i = 0; i < 6; i++) + Botania.proxy.sparkleFX(par3World, par4 + dir.offsetX + Math.random(), par5 + dir.offsetY + Math.random(), par6 + dir.offsetZ + Math.random(), 0.35F, 0.2F, 0.05F, 1F, 5); + } + } + return true; + } + + @Override + public boolean isFull3D() { + return true; + } + - } diff --git a/MODSRC/vazkii/botania/common/item/ItemDye.java b/MODSRC/vazkii/botania/common/item/ItemDye.java index 2b2eac0c2..90bf246e8 100644 --- a/MODSRC/vazkii/botania/common/item/ItemDye.java +++ b/MODSRC/vazkii/botania/common/item/ItemDye.java @@ -2,11 +2,11 @@ * This class was created by . 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 19, 2014, 4:10:47 PM (GMT)] */ package vazkii.botania.common.item; @@ -15,8 +15,8 @@ import vazkii.botania.common.lib.LibItemNames; public class ItemDye extends Item16Colors { - public ItemDye() { - super(LibItemNames.DYE); - } + public ItemDye() { + super(LibItemNames.DYE); + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemFertilizer.java b/MODSRC/vazkii/botania/common/item/ItemFertilizer.java index 78f1f97d5..a02f0ab32 100644 --- a/MODSRC/vazkii/botania/common/item/ItemFertilizer.java +++ b/MODSRC/vazkii/botania/common/item/ItemFertilizer.java @@ -2,19 +2,15 @@ * This class was created by . 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 @ [Mar 29, 2014, 10:41:52 PM (GMT)] */ package vazkii.botania.common.item; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ChunkCoordinates; @@ -23,49 +19,52 @@ import vazkii.botania.common.Botania; import vazkii.botania.common.block.ModBlocks; import vazkii.botania.common.lib.LibItemNames; +import java.util.ArrayList; +import java.util.List; + public class ItemFertilizer extends ItemMod { - public ItemFertilizer() { - super(); - setUnlocalizedName(LibItemNames.FERTILIZER); - } - - @Override - public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { - final int range = 3; - if(!par3World.isRemote) { - List validCoords = new ArrayList(); - - for(int i = -range - 1; i < range; i++) - for(int j = -range - 1; j < range; j++) { - for(int k = 2; k >= -2; k--) { - int x = par4 + i + 1; - int y = par5 + k + 1; - int z = par6 + j + 1; - if(par3World.isAirBlock(x, y, z) && (!par3World.provider.hasNoSky || y < 255) && ModBlocks.flower.canBlockStay(par3World, x, y, z)) - validCoords.add(new ChunkCoordinates(x, y, z)); - } - } - - int flowerCount = Math.min(validCoords.size(), par3World.rand.nextBoolean() ? 2 : 3); - for(int i = 0; i < flowerCount; i++) { - ChunkCoordinates coords = validCoords.get(par3World.rand.nextInt(validCoords.size())); - validCoords.remove(coords); - par3World.setBlock(coords.posX, coords.posY, coords.posZ, ModBlocks.flower, par3World.rand.nextInt(16), 1 | 2); - } - par1ItemStack.stackSize--; - } else { - for(int i = 0; i < 15; i++) { - double x = par4 - range + par3World.rand.nextInt(range * 2 + 1) + Math.random(); - double y = par5 + 1; - double z = par6 - range + par3World.rand.nextInt(range * 2 + 1) + Math.random(); - float red = (float) Math.random(); - float green = (float) Math.random(); - float blue = (float) Math.random(); - Botania.proxy.wispFX(par3World, x, y, z, red, green, blue, 0.15F + (float) Math.random() * 0.25F, -(float) Math.random() * 0.1F - 0.05F); - } - } - - return true; - } + public ItemFertilizer() { + super(); + setUnlocalizedName(LibItemNames.FERTILIZER); + } + + @Override + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { + final int range = 3; + if(!par3World.isRemote) { + List validCoords = new ArrayList(); + + for(int i = -range - 1; i < range; i++) + for(int j = -range - 1; j < range; j++) { + for(int k = 2; k >= -2; k--) { + int x = par4 + i + 1; + int y = par5 + k + 1; + int z = par6 + j + 1; + if(par3World.isAirBlock(x, y, z) && (!par3World.provider.hasNoSky || y < 255) && ModBlocks.flower.canBlockStay(par3World, x, y, z)) + validCoords.add(new ChunkCoordinates(x, y, z)); + } + } + + int flowerCount = Math.min(validCoords.size(), par3World.rand.nextBoolean() ? 2 : 3); + for(int i = 0; i < flowerCount; i++) { + ChunkCoordinates coords = validCoords.get(par3World.rand.nextInt(validCoords.size())); + validCoords.remove(coords); + par3World.setBlock(coords.posX, coords.posY, coords.posZ, ModBlocks.flower, par3World.rand.nextInt(16), 1 | 2); + } + par1ItemStack.stackSize--; + } else { + for(int i = 0; i < 15; i++) { + double x = par4 - range + par3World.rand.nextInt(range * 2 + 1) + Math.random(); + double y = par5 + 1; + double z = par6 - range + par3World.rand.nextInt(range * 2 + 1) + Math.random(); + float red = (float) Math.random(); + float green = (float) Math.random(); + float blue = (float) Math.random(); + Botania.proxy.wispFX(par3World, x, y, z, red, green, blue, 0.15F + (float) Math.random() * 0.25F, -(float) Math.random() * 0.1F - 0.05F); + } + } + + return true; + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemGrassHorn.java b/MODSRC/vazkii/botania/common/item/ItemGrassHorn.java index 6bef4b443..3ab4bc9ca 100644 --- a/MODSRC/vazkii/botania/common/item/ItemGrassHorn.java +++ b/MODSRC/vazkii/botania/common/item/ItemGrassHorn.java @@ -2,20 +2,15 @@ * This class was created by . 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 @ [Apr 11, 2014, 2:57:30 PM (GMT)] */ package vazkii.botania.common.item; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.entity.item.EntityItem; @@ -27,70 +22,74 @@ import net.minecraft.world.World; import vazkii.botania.api.ISpecialFlower; import vazkii.botania.common.lib.LibItemNames; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Random; + public class ItemGrassHorn extends ItemMod { - public ItemGrassHorn() { - super(); - setMaxStackSize(1); - setUnlocalizedName(LibItemNames.GRASS_HORN); - } + public ItemGrassHorn() { + super(); + setMaxStackSize(1); + setUnlocalizedName(LibItemNames.GRASS_HORN); + } - @Override - public EnumAction getItemUseAction(ItemStack par1ItemStack) { - return EnumAction.bow; - } + @Override + public EnumAction getItemUseAction(ItemStack par1ItemStack) { + return EnumAction.bow; + } - @Override - public int getMaxItemUseDuration(ItemStack par1ItemStack) { - return 72000; - } + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack) { + return 72000; + } - @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { - par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack)); - return par1ItemStack; - } + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack)); + return par1ItemStack; + } - @Override - public void onUsingTick(ItemStack stack, EntityPlayer player, int time) { - if(time != getMaxItemUseDuration(stack) && time % 5 == 0) { - Random rand = new Random((int) player.posX ^ (int) player.posZ); - int range = 12; - List coords = new ArrayList(); + @Override + public void onUsingTick(ItemStack stack, EntityPlayer player, int time) { + if(time != getMaxItemUseDuration(stack) && time % 5 == 0) { + Random rand = new Random((int) player.posX ^ (int) player.posZ); + int range = 12; + List coords = new ArrayList(); - for(int i = -range; i < range + 1; i++) - for(int j = -range; j < range + 1; j++) - for(int k = -3; k < 4; k++) { - int x = (int) player.posX + i; - int y = (int) player.posY + k; - int z = (int) player.posZ + j; + for(int i = -range; i < range + 1; i++) + for(int j = -range; j < range + 1; j++) + for(int k = -3; k < 4; k++) { + int x = (int) player.posX + i; + int y = (int) player.posY + k; + int z = (int) player.posZ + j; - Block block = player.worldObj.getBlock(x, y, z); - if(block instanceof BlockBush && !(block instanceof ISpecialFlower)) - coords.add(new ChunkCoordinates(x, y, z)); - } + Block block = player.worldObj.getBlock(x, y, z); + if(block instanceof BlockBush && !(block instanceof ISpecialFlower)) + coords.add(new ChunkCoordinates(x, y, z)); + } - Collections.shuffle(coords, rand); + Collections.shuffle(coords, rand); - int count = Math.min(coords.size(), 32); - for(int i = 0; i < count; i++) { - ChunkCoordinates currCoords = coords.get(i); - List items = new ArrayList(); - Block block = player.worldObj.getBlock(currCoords.posX, currCoords.posY, currCoords.posZ); - int meta = player.worldObj.getBlockMetadata(currCoords.posX, currCoords.posY, currCoords.posZ); - items.addAll(block.getDrops(player.worldObj, currCoords.posX, currCoords.posY, currCoords.posZ, meta, 0)); + int count = Math.min(coords.size(), 32); + for(int i = 0; i < count; i++) { + ChunkCoordinates currCoords = coords.get(i); + List items = new ArrayList(); + Block block = player.worldObj.getBlock(currCoords.posX, currCoords.posY, currCoords.posZ); + int meta = player.worldObj.getBlockMetadata(currCoords.posX, currCoords.posY, currCoords.posZ); + items.addAll(block.getDrops(player.worldObj, currCoords.posX, currCoords.posY, currCoords.posZ, meta, 0)); - if(!player.worldObj.isRemote) { - player.worldObj.setBlockToAir(currCoords.posX, currCoords.posY, currCoords.posZ); - player.worldObj.playAuxSFX(2001, currCoords.posX, currCoords.posY, currCoords.posZ, Block.getIdFromBlock(block) + (meta << 12)); + if(!player.worldObj.isRemote) { + player.worldObj.setBlockToAir(currCoords.posX, currCoords.posY, currCoords.posZ); + player.worldObj.playAuxSFX(2001, currCoords.posX, currCoords.posY, currCoords.posZ, Block.getIdFromBlock(block) + (meta << 12)); - for(ItemStack stack_ : items) - player.worldObj.spawnEntityInWorld(new EntityItem(player.worldObj, currCoords.posX + 0.5, currCoords.posY + 0.5, currCoords.posZ + 0.5, stack_)); - } - } - } + for(ItemStack stack_ : items) + player.worldObj.spawnEntityInWorld(new EntityItem(player.worldObj, currCoords.posX + 0.5, currCoords.posY + 0.5, currCoords.posZ + 0.5, stack_)); + } + } + } - if(!player.worldObj.isRemote) - player.worldObj.playSoundAtEntity(player, "note.bassattack", 1F, 0.001F); - } + if(!player.worldObj.isRemote) player.worldObj.playSoundAtEntity(player, "note.bassattack", 1F, 0.001F); + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemGrassSeeds.java b/MODSRC/vazkii/botania/common/item/ItemGrassSeeds.java index f2486f16f..5032ca665 100644 --- a/MODSRC/vazkii/botania/common/item/ItemGrassSeeds.java +++ b/MODSRC/vazkii/botania/common/item/ItemGrassSeeds.java @@ -2,21 +2,21 @@ * This class was created by . 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 @ [Apr 9, 2014, 5:11:34 PM (GMT)] */ package vazkii.botania.common.item; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; +import cpw.mods.fml.common.gameevent.TickEvent.Phase; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -30,178 +30,175 @@ import net.minecraft.world.World; import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.common.Botania; import vazkii.botania.common.lib.LibItemNames; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.TickEvent; -import cpw.mods.fml.common.gameevent.TickEvent.Phase; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + +import java.util.*; public class ItemGrassSeeds extends ItemMod { - private static Map> blockSwappers = new HashMap(); - - private static final int types = 3; - IIcon[] icons; - - public ItemGrassSeeds() { - super(); - setUnlocalizedName(LibItemNames.GRASS_SEEDS); - setHasSubtypes(true); - FMLCommonHandler.instance().bus().register(this); - } - - @Override - public void getSubItems(Item par1, CreativeTabs par2, List par3) { - for(int i = 0; i < types; i++) - par3.add(new ItemStack(par1, 1, i)); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - icons = new IIcon[types]; - for(int i = 0; i < types; i++) - icons[i] = IconHelper.forItem(par1IconRegister, this, i); - } + private static Map> blockSwappers = new HashMap(); - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) { - return icons[Math.min(icons.length - 1, par1)]; - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName() + stack.getItemDamage(); - } - - @Override - public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { - Block block = par3World.getBlock(par4, par5, par6); - int bmeta = par3World.getBlockMetadata(par4, par5, par6); - - if(block == Blocks.dirt && bmeta == 0) { - int meta = par1ItemStack.getItemDamage(); - - BlockSwapper swapper = addBlockSwapper(par3World, par4, par5, par6, meta); - par3World.setBlock(par4, par5, par6, swapper.blockToSet, swapper.metaToSet, 1 | 2); - for(int i = 0; i < 50; i++) { - double x = (Math.random() - 0.5) * 3; - double y = (Math.random() - 0.5) + 1; - double z = (Math.random() - 0.5) * 3; + private static final int types = 3; + IIcon[] icons; - float r = 0F; - float g = 0.4F; - float b = 0F; - if(meta == 1) { - r = 0.5F; - g = 0.37F; - b = 0F; - } else if(meta == 2) { - r = 0.27F; - g = 0F; - b = 0.33F; - } - - float velMul = 0.025F; + public ItemGrassSeeds() { + super(); + setUnlocalizedName(LibItemNames.GRASS_SEEDS); + setHasSubtypes(true); + FMLCommonHandler.instance().bus().register(this); + } - Botania.proxy.wispFX(par3World, par4 + 0.5 + x, par5 + 0.5 + y, par6 + 0.5 + z, r, g, b, (float) Math.random() * 0.15F + 0.15F, (float) -x * velMul, (float) -y * velMul, (float) -z * velMul); - } + @Override + public void getSubItems(Item par1, CreativeTabs par2, List par3) { + for(int i = 0; i < types; i++) + par3.add(new ItemStack(par1, 1, i)); + } - par1ItemStack.stackSize--; - } - - return true; - } - - @SubscribeEvent - public void onTickEnd(TickEvent.WorldTickEvent event) { - if(event.phase == Phase.END) { - int dim = event.world.provider.dimensionId; - if(blockSwappers.containsKey(dim)) { - List swappers = blockSwappers.get(dim); - List swappersSafe = new ArrayList(swappers); - - for(BlockSwapper s : swappersSafe) - s.tick(swappers); - } - } - } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + icons = new IIcon[types]; + for(int i = 0; i < types; i++) + icons[i] = IconHelper.forItem(par1IconRegister, this, i); + } - private static BlockSwapper addBlockSwapper(World world, int x, int y, int z, int meta) { - BlockSwapper swapper = swapperFromMeta(world, x, y, z, meta); - - int dim = world.provider.dimensionId; - if(!blockSwappers.containsKey(dim)) - blockSwappers.put(dim, new ArrayList()); - blockSwappers.get(dim).add(swapper); - - return swapper; - } - - private static BlockSwapper swapperFromMeta(World world, int x, int y, int z, int meta) { - switch(meta) { - case 1 : return new BlockSwapper(world, new ChunkCoordinates(x, y, z), Blocks.dirt, 2); - case 2 : return new BlockSwapper(world, new ChunkCoordinates(x, y, z), Blocks.mycelium, 0); - default : return new BlockSwapper(world, new ChunkCoordinates(x, y, z), Blocks.grass, 0); - } - } - - private static class BlockSwapper { - - final World world; - final Random rand; - final Block blockToSet; - final int metaToSet; + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int par1) { + return icons[Math.min(icons.length - 1, par1)]; + } - ChunkCoordinates startCoords; - int ticksExisted = 0; - - BlockSwapper(World world, ChunkCoordinates coords, Block block, int meta) { - this.world = world; - blockToSet = block; - metaToSet = meta; - rand = new Random(coords.posX ^ coords.posY ^ coords.posZ); - startCoords = coords; - } - - void tick(List list) { - ++ticksExisted; - - int range = 3; - for(int i = -range; i < range + 1; i++) - for(int j = -range; j < range + 1; j++) { - int x = startCoords.posX + i; - int y = startCoords.posY; - int z = startCoords.posZ + j; - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - - if(block == blockToSet && meta == metaToSet) { - if(ticksExisted % 20 == 0) { - List validCoords = new ArrayList(); - for(int k = -1; k < 2; k++) - for(int l = -1; l < 2; l++) { - int x1 = x + k; - int z1 = z + l; - Block block1 = world.getBlock(x1, y, z1); - int meta1 = world.getBlockMetadata(x1, y, z1); - if(block1 == Blocks.dirt && meta1 == 0) - validCoords.add(new ChunkCoordinates(x1, y, z1)); - } - - if(!validCoords.isEmpty() && !world.isRemote) { - ChunkCoordinates coords = validCoords.get(rand.nextInt(validCoords.size())); - world.setBlock(coords.posX, coords.posY, coords.posZ, blockToSet, metaToSet, 1 | 2); - } - } - } - } + @Override + public String getUnlocalizedName(ItemStack stack) { + return super.getUnlocalizedName() + stack.getItemDamage(); + } + + @Override + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { + Block block = par3World.getBlock(par4, par5, par6); + int bmeta = par3World.getBlockMetadata(par4, par5, par6); + + if(block == Blocks.dirt && bmeta == 0) { + int meta = par1ItemStack.getItemDamage(); + + BlockSwapper swapper = addBlockSwapper(par3World, par4, par5, par6, meta); + par3World.setBlock(par4, par5, par6, swapper.blockToSet, swapper.metaToSet, 1 | 2); + for(int i = 0; i < 50; i++) { + double x = (Math.random() - 0.5) * 3; + double y = (Math.random() - 0.5) + 1; + double z = (Math.random() - 0.5) * 3; + + float r = 0F; + float g = 0.4F; + float b = 0F; + if(meta == 1) { + r = 0.5F; + g = 0.37F; + b = 0F; + } else if(meta == 2) { + r = 0.27F; + g = 0F; + b = 0.33F; + } + + float velMul = 0.025F; + + Botania.proxy.wispFX(par3World, par4 + 0.5 + x, par5 + 0.5 + y, par6 + 0.5 + z, r, g, b, (float) Math.random() * 0.15F + 0.15F, (float) -x * velMul, (float) -y * velMul, (float) -z * velMul); + } + + par1ItemStack.stackSize--; + } + + return true; + } + + @SubscribeEvent + public void onTickEnd(TickEvent.WorldTickEvent event) { + if(event.phase == Phase.END) { + int dim = event.world.provider.dimensionId; + if(blockSwappers.containsKey(dim)) { + List swappers = blockSwappers.get(dim); + List swappersSafe = new ArrayList(swappers); + + for(BlockSwapper s : swappersSafe) + s.tick(swappers); + } + } + } + + private static BlockSwapper addBlockSwapper(World world, int x, int y, int z, int meta) { + BlockSwapper swapper = swapperFromMeta(world, x, y, z, meta); + + int dim = world.provider.dimensionId; + if(!blockSwappers.containsKey(dim)) blockSwappers.put(dim, new ArrayList()); + blockSwappers.get(dim).add(swapper); + + return swapper; + } + + private static BlockSwapper swapperFromMeta(World world, int x, int y, int z, int meta) { + switch(meta) { + case 1: + return new BlockSwapper(world, new ChunkCoordinates(x, y, z), Blocks.dirt, 2); + case 2: + return new BlockSwapper(world, new ChunkCoordinates(x, y, z), Blocks.mycelium, 0); + default: + return new BlockSwapper(world, new ChunkCoordinates(x, y, z), Blocks.grass, 0); + } + } + + private static class BlockSwapper { + + final World world; + final Random rand; + final Block blockToSet; + final int metaToSet; + + ChunkCoordinates startCoords; + int ticksExisted = 0; + + BlockSwapper(World world, ChunkCoordinates coords, Block block, int meta) { + this.world = world; + blockToSet = block; + metaToSet = meta; + rand = new Random(coords.posX ^ coords.posY ^ coords.posZ); + startCoords = coords; + } + + void tick(List list) { + ++ticksExisted; + + int range = 3; + for(int i = -range; i < range + 1; i++) + for(int j = -range; j < range + 1; j++) { + int x = startCoords.posX + i; + int y = startCoords.posY; + int z = startCoords.posZ + j; + Block block = world.getBlock(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + + if(block == blockToSet && meta == metaToSet) { + if(ticksExisted % 20 == 0) { + List validCoords = new ArrayList(); + for(int k = -1; k < 2; k++) + for(int l = -1; l < 2; l++) { + int x1 = x + k; + int z1 = z + l; + Block block1 = world.getBlock(x1, y, z1); + int meta1 = world.getBlockMetadata(x1, y, z1); + if(block1 == Blocks.dirt && meta1 == 0) + validCoords.add(new ChunkCoordinates(x1, y, z1)); + } + + if(!validCoords.isEmpty() && !world.isRemote) { + ChunkCoordinates coords = validCoords.get(rand.nextInt(validCoords.size())); + world.setBlock(coords.posX, coords.posY, coords.posZ, blockToSet, metaToSet, 1 | 2); + } + } + } + } + + if(ticksExisted >= 80) list.remove(this); + } + } - if(ticksExisted >= 80) - list.remove(this); - } - } - } diff --git a/MODSRC/vazkii/botania/common/item/ItemLens.java b/MODSRC/vazkii/botania/common/item/ItemLens.java index dcb97232d..cc17e38e2 100644 --- a/MODSRC/vazkii/botania/common/item/ItemLens.java +++ b/MODSRC/vazkii/botania/common/item/ItemLens.java @@ -2,21 +2,16 @@ * This class was created by . 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 31, 2014, 3:02:58 PM (GMT)] */ package vazkii.botania.common.item; -import java.awt.Color; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -29,11 +24,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.DamageSource; -import net.minecraft.util.IIcon; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.StatCollector; +import net.minecraft.util.*; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import vazkii.botania.api.internal.IManaBurst; @@ -47,377 +38,368 @@ import vazkii.botania.common.core.helper.MathHelper; import vazkii.botania.common.core.helper.Vector3; import vazkii.botania.common.crafting.recipe.CompositeLensRecipe; import vazkii.botania.common.lib.LibItemNames; -import cpw.mods.fml.common.registry.GameRegistry; + +import java.awt.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class ItemLens extends ItemMod implements ILens { - private static final int NORMAL = 0, SPEED = 1, POWER = 2, TIME = 3, EFFICIENCY = 4, - BOUNCE = 5, GRAVITY = 6, MINE = 7, DAMAGE = 8, PHANTOM = 9, - MAGNET = 10, EXPLOSIVE = 11; - - private static final Map> blacklist = new HashMap(); - - static { - blacklistLenses(POWER, EXPLOSIVE); - blacklistLenses(GRAVITY, MAGNET); - blacklistLenses(PHANTOM, MINE); - blacklistLenses(PHANTOM, EXPLOSIVE); - blacklistLenses(PHANTOM, BOUNCE); - } - - private static final String TAG_COLOR = "color"; - private static final String TAG_COMPOSITE_LENS = "compositeLens"; - - public static IIcon iconGlass; - - public static final int SUBTYPES = 12; - IIcon[] ringIcons; - - public ItemLens() { - super(); - setUnlocalizedName(LibItemNames.LENS); - setMaxStackSize(1); - setHasSubtypes(true); - - GameRegistry.addRecipe(new CompositeLensRecipe()); - } - - @Override - public void registerIcons(IIconRegister par1IconRegister) { - iconGlass = IconHelper.forName(par1IconRegister, "lensInside"); - - ringIcons = new IIcon[SUBTYPES]; - for(int i = 0; i < ringIcons.length; i++) - ringIcons[i] = IconHelper.forNameRaw(par1IconRegister, LibItemNames.LENS_NAMES[i]); - } - - @Override - public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - for(int i = 0; i < SUBTYPES; i++) - par3List.add(new ItemStack(par1, 1, i)); - } - - @Override - public boolean requiresMultipleRenderPasses() { - return true; - } - - @Override - public IIcon getIconFromDamageForRenderPass(int par1, int par2) { - return par2 == 1 ? ringIcons[Math.min(SUBTYPES - 1, par1)] : iconGlass; - } - - @Override - public IIcon getIconFromDamage(int par1) { - return getIconFromDamageForRenderPass(par1, 0); - } - - @Override - public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { - return par2 == 0 ? getLensColor(par1ItemStack) : 0xFFFFFF; - } - - @Override - public String getUnlocalizedName(ItemStack par1ItemStack) { - return "item." + LibItemNames.LENS_NAMES[Math.min(SUBTYPES - 1, par1ItemStack.getItemDamage())]; - } - - @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - int storedColor = getStoredColor(par1ItemStack); - if(storedColor != -1) - par3List.add(String.format(StatCollector.translateToLocal("botaniamisc.color"), StatCollector.translateToLocal("botania.color" + storedColor))); - } - - - public String getItemShortTermName(ItemStack stack) { - return StatCollector.translateToLocal(stack.getUnlocalizedName() + ".short"); - } - - @Override - public String getItemStackDisplayName(ItemStack stack) { - ItemStack compositeLens = getCompositeLens(stack); - if(compositeLens == null) - return super.getItemStackDisplayName(stack); - return String.format(StatCollector.translateToLocal("item.botania:compositeLens.name"), getItemShortTermName(stack), getItemShortTermName(compositeLens)); - } - - @Override - public void apply(ItemStack stack, BurstProperties props) { - int storedColor = getStoredColor(stack); - if(storedColor != -1) - props.color = getLensColor(stack); - - switch(stack.getItemDamage()) { - case SPEED : { - props.motionModifier *= 2F; - props.maxMana *= 0.75F; - props.ticksBeforeManaLoss /= 3F; - props.manaLossPerTick *= 2F; - break; - } - case POWER : { - props.maxMana *= 2; - props.motionModifier *= 0.85F; - props.manaLossPerTick *= 2F; - break; - } - case TIME : { - props.ticksBeforeManaLoss *= 2.25F; - props.motionModifier *= 0.8F; - break; - } - case EFFICIENCY : { - props.manaLossPerTick /= 5F; - props.ticksBeforeManaLoss *= 1.1F; - break; - } - case GRAVITY : { - props.gravity = 0.0015F; - props.ticksBeforeManaLoss *= 1.2F; - break; - } - } - - ItemStack compositeLens = getCompositeLens(stack); - if(compositeLens != null && compositeLens.getItem() instanceof ILens) - ((ILens) compositeLens.getItem()).apply(compositeLens, props); - } - - @Override - public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) { - EntityThrowable entity = (EntityThrowable) burst; - - switch(stack.getItemDamage()) { - case BOUNCE : { - if(!isManaBlock && pos.entityHit == null) { - ChunkCoordinates coords = burst.getBurstSourceChunkCoordinates(); - if(coords.posX != pos.blockX || coords.posY != pos.blockY || coords.posZ != pos.blockZ) { - Vector3 currentMovementVec = new Vector3(entity.motionX, entity.motionY, entity.motionZ); - ForgeDirection dir = ForgeDirection.getOrientation(pos.sideHit); - Vector3 normalVector = new Vector3(dir.offsetX, dir.offsetY, dir.offsetZ).normalize(); - Vector3 movementVec = normalVector.multiply(-2 * currentMovementVec.dotProduct(normalVector)).add(currentMovementVec); - - burst.setMotion(movementVec.x, movementVec.y, movementVec.z); - dead = false; - } - } - break; - } - case MINE : { - World world = entity.worldObj; - int x = pos.blockX; - int y = pos.blockY; - int z = pos.blockZ; - Block block = world.getBlock(x, y, z); - - int meta = world.getBlockMetadata(x, y, z); - float hardness = block.getBlockHardness(world, x, y, z); - int mana = burst.getMana(); - - ChunkCoordinates coords = burst.getBurstSourceChunkCoordinates(); - if((coords.posX != x || coords.posY != y || coords.posZ != z) && !isManaBlock && block != null && hardness != -1 && hardness < 50F && (burst.isFake() || mana >= 24)) { - List items = new ArrayList(); - - items.addAll(block.getDrops(world, x, y, z, meta, 0)); - - if(!burst.hasAlreadyCollidedAt(x, y, z)) { - if(!burst.isFake() && !entity.worldObj.isRemote) { - world.setBlockToAir(x, y, z); - entity.worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12)); - - for(ItemStack stack_ : items) - world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, stack_)); - burst.setMana(mana - 24); - } - } - - dead = false; - } - break; - } - case DAMAGE : { - if(pos.entityHit != null && pos.entityHit instanceof EntityLivingBase && !(pos.entityHit instanceof EntityPlayer)) { - EntityLivingBase living = (EntityLivingBase) pos.entityHit; - if(living.hurtTime == 0) { - int mana = burst.getMana(); - if(mana >= 16) { - burst.setMana(mana - 16); - if(!burst.isFake() && !entity.worldObj.isRemote) - living.attackEntityFrom(DamageSource.magic, 4); - } - } - } - } - case PHANTOM : { - if(!isManaBlock) { - dead = false; - burst.setMinManaLoss(Math.max(0, burst.getMinManaLoss() - 4)); - } - break; - } - case EXPLOSIVE : { - if(!burst.isFake()) { - ChunkCoordinates coords = burst.getBurstSourceChunkCoordinates(); - if(!entity.worldObj.isRemote && pos.entityHit == null && !isManaBlock && (pos.blockX != coords.posX || pos.blockY != coords.posY || pos.blockZ != coords.posZ)) - entity.worldObj.createExplosion(entity, entity.posX, entity.posY, entity.posZ, burst.getMana() / 50F, true); - } else dead = false; - } - break; - } - - ItemStack compositeLens = getCompositeLens(stack); - if(compositeLens != null && compositeLens.getItem() instanceof ILens) - dead = ((ILens) compositeLens.getItem()).collideBurst(burst, pos, isManaBlock, dead, compositeLens); - - return dead; - } - - @Override - public void updateBurst(IManaBurst burst, ItemStack stack) { - int storedColor = getStoredColor(stack); - if(storedColor == 16) - burst.setColor(getLensColor(stack)); - - EntityThrowable entity = (EntityThrowable) burst; - - boolean magnetized = entity.getEntityData().hasKey("Botania:Magnetized"); - switch(stack.getItemDamage()) { - case MAGNET : { - int x = (int) entity.posX; - int y = (int) entity.posY; - int z = (int) entity.posZ; - int range = 3; - - magnetize : { - for(int i = -range; i < range; i++) - for(int j = -range; j < range; j++) - for(int k = -range; k < range; k++) - if(entity.worldObj.getTileEntity(i + x, j + y, k + z) instanceof IManaReceiver) { - TileEntity tile = entity.worldObj.getTileEntity(i + x, j + y, k + z); - - if(magnetized) { - int magX = entity.getEntityData().getInteger("Botania:MagnetizedX"); - int magY = entity.getEntityData().getInteger("Botania:MagnetizedY"); - int magZ = entity.getEntityData().getInteger("Botania:MagnetizedZ"); - if(tile.xCoord != magX || tile.yCoord != magY || tile.zCoord != magZ) - continue; - } - - IManaReceiver receiver = (IManaReceiver) tile; - - ChunkCoordinates srcCoords = burst.getBurstSourceChunkCoordinates(); - - if(MathHelper.pointDistanceSpace(tile.xCoord, tile.yCoord, tile.zCoord, srcCoords.posX, srcCoords.posY, srcCoords.posZ) > 3 && receiver.canRecieveManaFromBursts() && !receiver.isFull()) { - Vector3 burstVec = Vector3.fromEntity(entity); - Vector3 tileVec = Vector3.fromTileEntityCenter(tile).add(0, -0.1, 0); - Vector3 motionVec = new Vector3(entity.motionX, entity.motionY, entity.motionZ); - - Vector3 normalMotionVec = motionVec.copy().normalize(); - Vector3 magnetVec = tileVec.sub(burstVec).normalize(); - Vector3 differenceVec = normalMotionVec.sub(magnetVec).multiply(motionVec.mag() * 0.1); - - Vector3 finalMotionVec = motionVec.sub(differenceVec); - if(!magnetized) { - finalMotionVec.multiply(0.75); - entity.getEntityData().setBoolean("Botania:Magnetized", true); - entity.getEntityData().setInteger("Botania:MagnetizedX", tile.xCoord); - entity.getEntityData().setInteger("Botania:MagnetizedY", tile.yCoord); - entity.getEntityData().setInteger("Botania:MagnetizedZ", tile.zCoord); - } - - burst.setMotion(finalMotionVec.x, finalMotionVec.y, finalMotionVec.z); - break magnetize; - } - } - } - } - } - - ItemStack compositeLens = getCompositeLens(stack); - if(compositeLens != null && compositeLens.getItem() instanceof ILens) - ((ILens) compositeLens.getItem()).updateBurst(burst, compositeLens); - } - - @Override - public int getLensColor(ItemStack stack) { - int storedColor = getStoredColor(stack); - - if(storedColor == -1) - return 0xFFFFFF; - - if(storedColor == 16) - return Color.HSBtoRGB(Botania.proxy.getWorldElapsedTicks() * 2 % 360 / 360F, 1F, 1F); - - float[] color = EntitySheep.fleeceColorTable[storedColor]; - return new Color(color[0], color[1], color[2]).getRGB(); - } - - public static int getStoredColor(ItemStack stack) { - return ItemNBTHelper.getInt(stack, TAG_COLOR, -1); - } - - public static ItemStack setLensColor(ItemStack stack, int color) { - ItemNBTHelper.setInt(stack, TAG_COLOR, color); - return stack; - } - - @Override - public boolean doParticles(IManaBurst burst, ItemStack stack) { - int storedColor = getStoredColor(stack); - if(storedColor == 16 && !burst.isFake()) - return ((EntityThrowable) burst).ticksExisted > 5; - - return true; - } - - public static void blacklistLenses(int lens1, int lens2) { - blacklistLenses(lens1, lens2, true); - } - - public static void blacklistLenses(int lens1, int lens2, boolean recursive) { - if(!blacklist.containsKey(lens1)) - blacklist.put(lens1, new ArrayList()); - blacklist.get(lens1).add(lens2); - - if(recursive) - blacklistLenses(lens2, lens1, false); - } - - public static boolean isBlacklisted(int lens1, int lens2) { - if(!blacklist.containsKey(lens1)) - return false; - - return blacklist.get(lens1).contains(lens2); - } - - @Override - public boolean canCombineLenses(ItemStack sourceLens, ItemStack compositeLens) { - if(sourceLens.getItemDamage() == compositeLens.getItemDamage()) - return false; - - if(sourceLens.getItemDamage() == NORMAL || compositeLens.getItemDamage() == NORMAL) - return false; - - if(isBlacklisted(sourceLens.getItemDamage(), compositeLens.getItemDamage())) - return false; - - return true; - } - - @Override - public ItemStack getCompositeLens(ItemStack stack) { - NBTTagCompound cmp = ItemNBTHelper.getCompound(stack, TAG_COMPOSITE_LENS, false); - ItemStack lens = ItemStack.loadItemStackFromNBT(cmp); - return lens; - } - - @Override - public ItemStack setCompositeLens(ItemStack sourceLens, ItemStack compositeLens) { - NBTTagCompound cmp = new NBTTagCompound(); - compositeLens.writeToNBT(cmp); - ItemNBTHelper.setCompound(sourceLens, TAG_COMPOSITE_LENS, cmp); - - return sourceLens; - } + private static final int NORMAL = 0, SPEED = 1, POWER = 2, TIME = 3, EFFICIENCY = 4, BOUNCE = 5, GRAVITY = 6, MINE = 7, DAMAGE = 8, PHANTOM = 9, MAGNET = 10, EXPLOSIVE = 11; + + private static final Map> blacklist = new HashMap(); + + static { + blacklistLenses(POWER, EXPLOSIVE); + blacklistLenses(GRAVITY, MAGNET); + blacklistLenses(PHANTOM, MINE); + blacklistLenses(PHANTOM, EXPLOSIVE); + blacklistLenses(PHANTOM, BOUNCE); + } + + private static final String TAG_COLOR = "color"; + private static final String TAG_COMPOSITE_LENS = "compositeLens"; + + public static IIcon iconGlass; + + public static final int SUBTYPES = 12; + IIcon[] ringIcons; + + public ItemLens() { + super(); + setUnlocalizedName(LibItemNames.LENS); + setMaxStackSize(1); + setHasSubtypes(true); + + GameRegistry.addRecipe(new CompositeLensRecipe()); + } + + @Override + public void registerIcons(IIconRegister par1IconRegister) { + iconGlass = IconHelper.forName(par1IconRegister, "lensInside"); + + ringIcons = new IIcon[SUBTYPES]; + for(int i = 0; i < ringIcons.length; i++) + ringIcons[i] = IconHelper.forNameRaw(par1IconRegister, LibItemNames.LENS_NAMES[i]); + } + + @Override + public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for(int i = 0; i < SUBTYPES; i++) + par3List.add(new ItemStack(par1, 1, i)); + } + + @Override + public boolean requiresMultipleRenderPasses() { + return true; + } + + @Override + public IIcon getIconFromDamageForRenderPass(int par1, int par2) { + return par2 == 1 ? ringIcons[Math.min(SUBTYPES - 1, par1)] : iconGlass; + } + + @Override + public IIcon getIconFromDamage(int par1) { + return getIconFromDamageForRenderPass(par1, 0); + } + + @Override + public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { + return par2 == 0 ? getLensColor(par1ItemStack) : 0xFFFFFF; + } + + @Override + public String getUnlocalizedName(ItemStack par1ItemStack) { + return "item." + LibItemNames.LENS_NAMES[Math.min(SUBTYPES - 1, par1ItemStack.getItemDamage())]; + } + + @Override + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + int storedColor = getStoredColor(par1ItemStack); + if(storedColor != -1) + par3List.add(String.format(StatCollector.translateToLocal("botaniamisc.color"), StatCollector.translateToLocal("botania.color" + storedColor))); + } + + + public String getItemShortTermName(ItemStack stack) { + return StatCollector.translateToLocal(stack.getUnlocalizedName() + ".short"); + } + + @Override + public String getItemStackDisplayName(ItemStack stack) { + ItemStack compositeLens = getCompositeLens(stack); + if(compositeLens == null) return super.getItemStackDisplayName(stack); + return String.format(StatCollector.translateToLocal("item.botania:compositeLens.name"), getItemShortTermName(stack), getItemShortTermName(compositeLens)); + } + + @Override + public void apply(ItemStack stack, BurstProperties props) { + int storedColor = getStoredColor(stack); + if(storedColor != -1) props.color = getLensColor(stack); + + switch(stack.getItemDamage()) { + case SPEED: { + props.motionModifier *= 2F; + props.maxMana *= 0.75F; + props.ticksBeforeManaLoss /= 3F; + props.manaLossPerTick *= 2F; + break; + } + case POWER: { + props.maxMana *= 2; + props.motionModifier *= 0.85F; + props.manaLossPerTick *= 2F; + break; + } + case TIME: { + props.ticksBeforeManaLoss *= 2.25F; + props.motionModifier *= 0.8F; + break; + } + case EFFICIENCY: { + props.manaLossPerTick /= 5F; + props.ticksBeforeManaLoss *= 1.1F; + break; + } + case GRAVITY: { + props.gravity = 0.0015F; + props.ticksBeforeManaLoss *= 1.2F; + break; + } + } + + ItemStack compositeLens = getCompositeLens(stack); + if(compositeLens != null && compositeLens.getItem() instanceof ILens) + ((ILens) compositeLens.getItem()).apply(compositeLens, props); + } + + @Override + public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) { + EntityThrowable entity = (EntityThrowable) burst; + + switch(stack.getItemDamage()) { + case BOUNCE: { + if(!isManaBlock && pos.entityHit == null) { + ChunkCoordinates coords = burst.getBurstSourceChunkCoordinates(); + if(coords.posX != pos.blockX || coords.posY != pos.blockY || coords.posZ != pos.blockZ) { + Vector3 currentMovementVec = new Vector3(entity.motionX, entity.motionY, entity.motionZ); + ForgeDirection dir = ForgeDirection.getOrientation(pos.sideHit); + Vector3 normalVector = new Vector3(dir.offsetX, dir.offsetY, dir.offsetZ).normalize(); + Vector3 movementVec = normalVector.multiply(-2 * currentMovementVec.dotProduct(normalVector)).add(currentMovementVec); + + burst.setMotion(movementVec.x, movementVec.y, movementVec.z); + dead = false; + } + } + break; + } + case MINE: { + World world = entity.worldObj; + int x = pos.blockX; + int y = pos.blockY; + int z = pos.blockZ; + Block block = world.getBlock(x, y, z); + + int meta = world.getBlockMetadata(x, y, z); + float hardness = block.getBlockHardness(world, x, y, z); + int mana = burst.getMana(); + + ChunkCoordinates coords = burst.getBurstSourceChunkCoordinates(); + if((coords.posX != x || coords.posY != y || coords.posZ != z) && !isManaBlock && block != null && hardness != -1 && hardness < 50F && (burst.isFake() || mana >= 24)) { + List items = new ArrayList(); + + items.addAll(block.getDrops(world, x, y, z, meta, 0)); + + if(!burst.hasAlreadyCollidedAt(x, y, z)) { + if(!burst.isFake() && !entity.worldObj.isRemote) { + world.setBlockToAir(x, y, z); + entity.worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12)); + + for(ItemStack stack_ : items) + world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, stack_)); + burst.setMana(mana - 24); + } + } + + dead = false; + } + break; + } + case DAMAGE: { + if(pos.entityHit != null && pos.entityHit instanceof EntityLivingBase && !(pos.entityHit instanceof EntityPlayer)) { + EntityLivingBase living = (EntityLivingBase) pos.entityHit; + if(living.hurtTime == 0) { + int mana = burst.getMana(); + if(mana >= 16) { + burst.setMana(mana - 16); + if(!burst.isFake() && !entity.worldObj.isRemote) + living.attackEntityFrom(DamageSource.magic, 4); + } + } + } + } + case PHANTOM: { + if(!isManaBlock) { + dead = false; + burst.setMinManaLoss(Math.max(0, burst.getMinManaLoss() - 4)); + } + break; + } + case EXPLOSIVE: { + if(!burst.isFake()) { + ChunkCoordinates coords = burst.getBurstSourceChunkCoordinates(); + if(!entity.worldObj.isRemote && pos.entityHit == null && !isManaBlock && (pos.blockX != coords.posX || pos.blockY != coords.posY || pos.blockZ != coords.posZ)) + entity.worldObj.createExplosion(entity, entity.posX, entity.posY, entity.posZ, burst.getMana() / 50F, true); + } else dead = false; + } + break; + } + + ItemStack compositeLens = getCompositeLens(stack); + if(compositeLens != null && compositeLens.getItem() instanceof ILens) + dead = ((ILens) compositeLens.getItem()).collideBurst(burst, pos, isManaBlock, dead, compositeLens); + + return dead; + } + + @Override + public void updateBurst(IManaBurst burst, ItemStack stack) { + int storedColor = getStoredColor(stack); + if(storedColor == 16) burst.setColor(getLensColor(stack)); + + EntityThrowable entity = (EntityThrowable) burst; + + boolean magnetized = entity.getEntityData().hasKey("Botania:Magnetized"); + switch(stack.getItemDamage()) { + case MAGNET: { + int x = (int) entity.posX; + int y = (int) entity.posY; + int z = (int) entity.posZ; + int range = 3; + + magnetize: + { + for(int i = -range; i < range; i++) + for(int j = -range; j < range; j++) + for(int k = -range; k < range; k++) + if(entity.worldObj.getTileEntity(i + x, j + y, k + z) instanceof IManaReceiver) { + TileEntity tile = entity.worldObj.getTileEntity(i + x, j + y, k + z); + + if(magnetized) { + int magX = entity.getEntityData().getInteger("Botania:MagnetizedX"); + int magY = entity.getEntityData().getInteger("Botania:MagnetizedY"); + int magZ = entity.getEntityData().getInteger("Botania:MagnetizedZ"); + if(tile.xCoord != magX || tile.yCoord != magY || tile.zCoord != magZ) continue; + } + + IManaReceiver receiver = (IManaReceiver) tile; + + ChunkCoordinates srcCoords = burst.getBurstSourceChunkCoordinates(); + + if(MathHelper.pointDistanceSpace(tile.xCoord, tile.yCoord, tile.zCoord, srcCoords.posX, srcCoords.posY, srcCoords.posZ) > 3 && receiver.canRecieveManaFromBursts() && !receiver.isFull()) { + Vector3 burstVec = Vector3.fromEntity(entity); + Vector3 tileVec = Vector3.fromTileEntityCenter(tile).add(0, -0.1, 0); + Vector3 motionVec = new Vector3(entity.motionX, entity.motionY, entity.motionZ); + + Vector3 normalMotionVec = motionVec.copy().normalize(); + Vector3 magnetVec = tileVec.sub(burstVec).normalize(); + Vector3 differenceVec = normalMotionVec.sub(magnetVec).multiply(motionVec.mag() * 0.1); + + Vector3 finalMotionVec = motionVec.sub(differenceVec); + if(!magnetized) { + finalMotionVec.multiply(0.75); + entity.getEntityData().setBoolean("Botania:Magnetized", true); + entity.getEntityData().setInteger("Botania:MagnetizedX", tile.xCoord); + entity.getEntityData().setInteger("Botania:MagnetizedY", tile.yCoord); + entity.getEntityData().setInteger("Botania:MagnetizedZ", tile.zCoord); + } + + burst.setMotion(finalMotionVec.x, finalMotionVec.y, finalMotionVec.z); + break magnetize; + } + } + } + } + } + + ItemStack compositeLens = getCompositeLens(stack); + if(compositeLens != null && compositeLens.getItem() instanceof ILens) + ((ILens) compositeLens.getItem()).updateBurst(burst, compositeLens); + } + + @Override + public int getLensColor(ItemStack stack) { + int storedColor = getStoredColor(stack); + + if(storedColor == -1) return 0xFFFFFF; + + if(storedColor == 16) return Color.HSBtoRGB(Botania.proxy.getWorldElapsedTicks() * 2 % 360 / 360F, 1F, 1F); + + float[] color = EntitySheep.fleeceColorTable[storedColor]; + return new Color(color[0], color[1], color[2]).getRGB(); + } + + public static int getStoredColor(ItemStack stack) { + return ItemNBTHelper.getInt(stack, TAG_COLOR, -1); + } + + public static ItemStack setLensColor(ItemStack stack, int color) { + ItemNBTHelper.setInt(stack, TAG_COLOR, color); + return stack; + } + + @Override + public boolean doParticles(IManaBurst burst, ItemStack stack) { + int storedColor = getStoredColor(stack); + if(storedColor == 16 && !burst.isFake()) return ((EntityThrowable) burst).ticksExisted > 5; + + return true; + } + + public static void blacklistLenses(int lens1, int lens2) { + blacklistLenses(lens1, lens2, true); + } + + public static void blacklistLenses(int lens1, int lens2, boolean recursive) { + if(!blacklist.containsKey(lens1)) blacklist.put(lens1, new ArrayList()); + blacklist.get(lens1).add(lens2); + + if(recursive) blacklistLenses(lens2, lens1, false); + } + + public static boolean isBlacklisted(int lens1, int lens2) { + if(!blacklist.containsKey(lens1)) return false; + + return blacklist.get(lens1).contains(lens2); + } + + @Override + public boolean canCombineLenses(ItemStack sourceLens, ItemStack compositeLens) { + if(sourceLens.getItemDamage() == compositeLens.getItemDamage()) return false; + + if(sourceLens.getItemDamage() == NORMAL || compositeLens.getItemDamage() == NORMAL) return false; + + if(isBlacklisted(sourceLens.getItemDamage(), compositeLens.getItemDamage())) return false; + + return true; + } + + @Override + public ItemStack getCompositeLens(ItemStack stack) { + NBTTagCompound cmp = ItemNBTHelper.getCompound(stack, TAG_COMPOSITE_LENS, false); + ItemStack lens = ItemStack.loadItemStackFromNBT(cmp); + return lens; + } + + @Override + public ItemStack setCompositeLens(ItemStack sourceLens, ItemStack compositeLens) { + NBTTagCompound cmp = new NBTTagCompound(); + compositeLens.writeToNBT(cmp); + ItemNBTHelper.setCompound(sourceLens, TAG_COMPOSITE_LENS, cmp); + + return sourceLens; + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemLexicon.java b/MODSRC/vazkii/botania/common/item/ItemLexicon.java index 22d4a8014..bc43ef664 100644 --- a/MODSRC/vazkii/botania/common/item/ItemLexicon.java +++ b/MODSRC/vazkii/botania/common/item/ItemLexicon.java @@ -2,11 +2,11 @@ * This class was created by . 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 14, 2014, 5:53:00 PM (GMT)] */ package vazkii.botania.common.item; @@ -24,39 +24,39 @@ import vazkii.botania.common.lib.LibItemNames; public class ItemLexicon extends ItemMod { - public ItemLexicon() { - super(); - setMaxStackSize(1); - setUnlocalizedName(LibItemNames.LEXICON); - } + public ItemLexicon() { + super(); + setMaxStackSize(1); + setUnlocalizedName(LibItemNames.LEXICON); + } - @Override - public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { - if(par2EntityPlayer.isSneaking()) { - Block block = par3World.getBlock(par4, par5, par6); + @Override + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { + if(par2EntityPlayer.isSneaking()) { + Block block = par3World.getBlock(par4, par5, par6); - if(block != null && block instanceof ILexiconable) { - LexiconEntry entry = ((ILexiconable) block).getEntry(par3World, par4, par5, par6, par2EntityPlayer, par1ItemStack); - if(entry != null) { - Botania.proxy.setEntryToOpen(entry); - par2EntityPlayer.openGui(Botania.instance, LibGuiIDs.LEXICON, par3World, 0, 0, 0); - return true; - } - } - } + if(block != null && block instanceof ILexiconable) { + LexiconEntry entry = ((ILexiconable) block).getEntry(par3World, par4, par5, par6, par2EntityPlayer, par1ItemStack); + if(entry != null) { + Botania.proxy.setEntryToOpen(entry); + par2EntityPlayer.openGui(Botania.instance, LibGuiIDs.LEXICON, par3World, 0, 0, 0); + return true; + } + } + } - return false; - } + return false; + } - @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { - par3EntityPlayer.openGui(Botania.instance, LibGuiIDs.LEXICON, par2World, 0, 0, 0); - return par1ItemStack; - } + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + par3EntityPlayer.openGui(Botania.instance, LibGuiIDs.LEXICON, par2World, 0, 0, 0); + return par1ItemStack; + } - @Override - public EnumRarity getRarity(ItemStack par1ItemStack) { - return EnumRarity.uncommon; - } + @Override + public EnumRarity getRarity(ItemStack par1ItemStack) { + return EnumRarity.uncommon; + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemManaCookie.java b/MODSRC/vazkii/botania/common/item/ItemManaCookie.java index 69d8a7ef8..45e0cad7c 100644 --- a/MODSRC/vazkii/botania/common/item/ItemManaCookie.java +++ b/MODSRC/vazkii/botania/common/item/ItemManaCookie.java @@ -2,15 +2,18 @@ * This class was created by . 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 @ [Mar 21, 2014, 8:44:35 PM (GMT)] */ package vazkii.botania.common.item; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; @@ -18,29 +21,26 @@ import net.minecraft.potion.Potion; import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.common.core.BotaniaCreativeTab; import vazkii.botania.common.lib.LibItemNames; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class ItemManaCookie extends ItemFood { - public ItemManaCookie() { - super(0, 0.1F, false); - setPotionEffect(Potion.field_76443_y.id, 1, 0, 1F); - setCreativeTab(BotaniaCreativeTab.INSTANCE); - setUnlocalizedName(LibItemNames.MANA_COOKIE); - } + public ItemManaCookie() { + super(0, 0.1F, false); + setPotionEffect(Potion.field_76443_y.id, 1, 0, 1F); + setCreativeTab(BotaniaCreativeTab.INSTANCE); + setUnlocalizedName(LibItemNames.MANA_COOKIE); + } - @Override - public Item setUnlocalizedName(String par1Str) { - GameRegistry.registerItem(this, par1Str); - return super.setUnlocalizedName(par1Str); - } + @Override + public Item setUnlocalizedName(String par1Str) { + GameRegistry.registerItem(this, par1Str); + return super.setUnlocalizedName(par1Str); + } - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - itemIcon = IconHelper.forItem(par1IconRegister, this); - } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + itemIcon = IconHelper.forItem(par1IconRegister, this); + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemManaGun.java b/MODSRC/vazkii/botania/common/item/ItemManaGun.java index 256b6eb02..72bd53705 100644 --- a/MODSRC/vazkii/botania/common/item/ItemManaGun.java +++ b/MODSRC/vazkii/botania/common/item/ItemManaGun.java @@ -2,17 +2,16 @@ * This class was created by . 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 @ [Mar 13, 2014, 4:30:27 PM (GMT)] */ package vazkii.botania.common.item; -import java.util.List; - +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -27,121 +26,118 @@ import vazkii.botania.common.core.helper.ItemNBTHelper; import vazkii.botania.common.crafting.recipe.ManaGunLensRecipe; import vazkii.botania.common.entity.EntityManaBurst; import vazkii.botania.common.lib.LibItemNames; -import cpw.mods.fml.common.registry.GameRegistry; + +import java.util.List; public class ItemManaGun extends ItemMod { - private static final String TAG_LENS = "lens"; - private static final int COOLDOWN = 30; + private static final String TAG_LENS = "lens"; + private static final int COOLDOWN = 30; - public ItemManaGun() { - super(); - setMaxDamage(COOLDOWN); - setMaxStackSize(1); - setNoRepair(); - setUnlocalizedName(LibItemNames.MANA_GUN); + public ItemManaGun() { + super(); + setMaxDamage(COOLDOWN); + setMaxStackSize(1); + setNoRepair(); + setUnlocalizedName(LibItemNames.MANA_GUN); - GameRegistry.addRecipe(new ManaGunLensRecipe()); - } + GameRegistry.addRecipe(new ManaGunLensRecipe()); + } - @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { - if(!par3EntityPlayer.isSneaking()) { - if(par1ItemStack.getItemDamage() == 0) { - EntityManaBurst burst = getBurst(par3EntityPlayer, par1ItemStack); - if(burst != null && ManaItemHandler.requestManaExact(par1ItemStack, par3EntityPlayer, burst.getMana(), true)) { - if(!par2World.isRemote) { - par2World.playSoundAtEntity(par3EntityPlayer, "random.explode", 0.9F, 3F); - par2World.spawnEntityInWorld(burst); - } else par3EntityPlayer.swingItem(); - par1ItemStack.setItemDamage(COOLDOWN); - } else if(!par2World.isRemote) - par2World.playSoundAtEntity(par3EntityPlayer, "random.click", 0.6F, (1.0F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.2F) * 0.7F); + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if(!par3EntityPlayer.isSneaking()) { + if(par1ItemStack.getItemDamage() == 0) { + EntityManaBurst burst = getBurst(par3EntityPlayer, par1ItemStack); + if(burst != null && ManaItemHandler.requestManaExact(par1ItemStack, par3EntityPlayer, burst.getMana(), true)) { + if(!par2World.isRemote) { + par2World.playSoundAtEntity(par3EntityPlayer, "random.explode", 0.9F, 3F); + par2World.spawnEntityInWorld(burst); + } else par3EntityPlayer.swingItem(); + par1ItemStack.setItemDamage(COOLDOWN); + } else if(!par2World.isRemote) + par2World.playSoundAtEntity(par3EntityPlayer, "random.click", 0.6F, (1.0F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.2F) * 0.7F); - } - } else { - ItemStack lens = getLens(par1ItemStack); - if(lens != null) { - if(!par3EntityPlayer.inventory.addItemStackToInventory(lens.copy())) - par3EntityPlayer.addChatMessage(new ChatComponentTranslation("botaniamisc.invFull")); - else setLens(par1ItemStack, null); - } - } + } + } else { + ItemStack lens = getLens(par1ItemStack); + if(lens != null) { + if(!par3EntityPlayer.inventory.addItemStackToInventory(lens.copy())) + par3EntityPlayer.addChatMessage(new ChatComponentTranslation("botaniamisc.invFull")); + else setLens(par1ItemStack, null); + } + } - return par1ItemStack; - } + return par1ItemStack; + } - public EntityManaBurst getBurst(EntityPlayer player, ItemStack stack) { - EntityManaBurst burst = new EntityManaBurst(player); + public EntityManaBurst getBurst(EntityPlayer player, ItemStack stack) { + EntityManaBurst burst = new EntityManaBurst(player); - int maxMana = 120; - int color = 0x20FF20; - int ticksBeforeManaLoss = 60; - float manaLossPerTick = 4F; - float motionModifier = 5F; - float gravity = 0F; - BurstProperties props = new BurstProperties(maxMana, ticksBeforeManaLoss, manaLossPerTick, gravity, motionModifier, color); + int maxMana = 120; + int color = 0x20FF20; + int ticksBeforeManaLoss = 60; + float manaLossPerTick = 4F; + float motionModifier = 5F; + float gravity = 0F; + BurstProperties props = new BurstProperties(maxMana, ticksBeforeManaLoss, manaLossPerTick, gravity, motionModifier, color); - ItemStack lens = getLens(stack); - if(lens != null) - ((ILens) lens.getItem()).apply(lens, props); + ItemStack lens = getLens(stack); + if(lens != null) ((ILens) lens.getItem()).apply(lens, props); - burst.setSourceLens(lens); - if(ManaItemHandler.requestManaExact(stack, player, props.maxMana, false)) { - burst.setColor(props.color); - burst.setMana(props.maxMana); - burst.setStartingMana(props.maxMana); - burst.setMinManaLoss(props.ticksBeforeManaLoss); - burst.setManaLossPerTick(props.manaLossPerTick); - burst.setGravity(props.gravity); - burst.setMotion(burst.motionX * props.motionModifier, burst.motionY * props.motionModifier, burst.motionZ * props.motionModifier); + burst.setSourceLens(lens); + if(ManaItemHandler.requestManaExact(stack, player, props.maxMana, false)) { + burst.setColor(props.color); + burst.setMana(props.maxMana); + burst.setStartingMana(props.maxMana); + burst.setMinManaLoss(props.ticksBeforeManaLoss); + burst.setManaLossPerTick(props.manaLossPerTick); + burst.setGravity(props.gravity); + burst.setMotion(burst.motionX * props.motionModifier, burst.motionY * props.motionModifier, burst.motionZ * props.motionModifier); - return burst; - } - return null; - } + return burst; + } + return null; + } - @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - ItemStack lens = getLens(par1ItemStack); - if(lens != null) { - List tooltip = lens.getTooltip(par2EntityPlayer, false); - if(tooltip.size() > 1) - par3List.addAll(tooltip.subList(1, tooltip.size())); - } - } + @Override + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + ItemStack lens = getLens(par1ItemStack); + if(lens != null) { + List tooltip = lens.getTooltip(par2EntityPlayer, false); + if(tooltip.size() > 1) par3List.addAll(tooltip.subList(1, tooltip.size())); + } + } - @Override - public String getItemStackDisplayName(ItemStack par1ItemStack) { - ItemStack lens = getLens(par1ItemStack); - return super.getItemStackDisplayName(par1ItemStack) + (lens == null ? "" : " (" + EnumChatFormatting.GREEN + lens.getDisplayName() + EnumChatFormatting.RESET + ")"); - } + @Override + public String getItemStackDisplayName(ItemStack par1ItemStack) { + ItemStack lens = getLens(par1ItemStack); + return super.getItemStackDisplayName(par1ItemStack) + (lens == null ? "" : " (" + EnumChatFormatting.GREEN + lens.getDisplayName() + EnumChatFormatting.RESET + ")"); + } - public static void setLens(ItemStack stack, ItemStack lens) { - NBTTagCompound cmp = new NBTTagCompound(); - if(lens != null) - lens.writeToNBT(cmp); - ItemNBTHelper.setCompound(stack, TAG_LENS, cmp); - } + public static void setLens(ItemStack stack, ItemStack lens) { + NBTTagCompound cmp = new NBTTagCompound(); + if(lens != null) lens.writeToNBT(cmp); + ItemNBTHelper.setCompound(stack, TAG_LENS, cmp); + } - public static ItemStack getLens(ItemStack stack) { - NBTTagCompound cmp = ItemNBTHelper.getCompound(stack, TAG_LENS, true); - if(cmp != null) { - ItemStack lens = ItemStack.loadItemStackFromNBT(cmp); - return lens; - } - return null; - } + public static ItemStack getLens(ItemStack stack) { + NBTTagCompound cmp = ItemNBTHelper.getCompound(stack, TAG_LENS, true); + if(cmp != null) { + ItemStack lens = ItemStack.loadItemStackFromNBT(cmp); + return lens; + } + return null; + } - @Override - public boolean isFull3D() { - return true; - } + @Override + public boolean isFull3D() { + return true; + } - @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { - if(par1ItemStack.isItemDamaged()) - par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() - 1); - } + @Override + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + if(par1ItemStack.isItemDamaged()) par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() - 1); + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemManaMirror.java b/MODSRC/vazkii/botania/common/item/ItemManaMirror.java index ed78db83a..1ef9af7cd 100644 --- a/MODSRC/vazkii/botania/common/item/ItemManaMirror.java +++ b/MODSRC/vazkii/botania/common/item/ItemManaMirror.java @@ -2,18 +2,15 @@ * This class was created by . 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 @ [Apr 13, 2014, 5:39:24 PM (GMT)] */ package vazkii.botania.common.item; -import java.awt.Color; -import java.util.List; - import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -22,7 +19,6 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; import net.minecraft.world.World; import vazkii.botania.api.mana.IManaItem; import vazkii.botania.api.mana.IManaPool; @@ -31,207 +27,206 @@ import vazkii.botania.common.block.tile.TilePool; import vazkii.botania.common.core.helper.ItemNBTHelper; import vazkii.botania.common.lib.LibItemNames; +import java.awt.*; +import java.util.List; + public class ItemManaMirror extends ItemMod implements IManaItem { - IIcon[] icons; + IIcon[] icons; - private static final String TAG_MANA_VISUAL = "manaVisual"; - private static final String TAG_POS_X = "posX"; - private static final String TAG_POS_Y = "posY"; - private static final String TAG_POS_Z = "posZ"; - private static final String TAG_DIM = "dim"; + private static final String TAG_MANA_VISUAL = "manaVisual"; + private static final String TAG_POS_X = "posX"; + private static final String TAG_POS_Y = "posY"; + private static final String TAG_POS_Z = "posZ"; + private static final String TAG_DIM = "dim"; - public ItemManaMirror() { - super(); - setMaxStackSize(1); - setMaxDamage(1000); - setUnlocalizedName(LibItemNames.MANA_MIRROR); - } + public ItemManaMirror() { + super(); + setMaxStackSize(1); + setMaxDamage(1000); + setUnlocalizedName(LibItemNames.MANA_MIRROR); + } - @Override - public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { - float mana = getManaForDisplay(par1ItemStack); - return par2 == 1 ? Color.HSBtoRGB(0.528F, mana / TilePool.MAX_MANA, 1F) : 0xFFFFFF; - } + @Override + public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { + float mana = getManaForDisplay(par1ItemStack); + return par2 == 1 ? Color.HSBtoRGB(0.528F, mana / TilePool.MAX_MANA, 1F) : 0xFFFFFF; + } - @Override - public int getDamage(ItemStack stack) { - float mana = getManaForDisplay(stack); - return 1000 - (int) (mana / TilePool.MAX_MANA * 1000); - } + @Override + public int getDamage(ItemStack stack) { + float mana = getManaForDisplay(stack); + return 1000 - (int) (mana / TilePool.MAX_MANA * 1000); + } - @Override - public int getDisplayDamage(ItemStack stack) { - return getDamage(stack); - } + @Override + public int getDisplayDamage(ItemStack stack) { + return getDamage(stack); + } - @Override - public void registerIcons(IIconRegister par1IconRegister) { - icons = new IIcon[2]; - for(int i = 0; i < icons.length; i++) - icons[i] = IconHelper.forItem(par1IconRegister, this, i); - } + @Override + public void registerIcons(IIconRegister par1IconRegister) { + icons = new IIcon[2]; + for(int i = 0; i < icons.length; i++) + icons[i] = IconHelper.forItem(par1IconRegister, this, i); + } - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return icons[Math.min(1, pass)]; - } - - @Override - public boolean isFull3D() { - return true; - } + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return icons[Math.min(1, pass)]; + } - @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { - IManaPool pool = getManaPool(par1ItemStack); - if(!(pool instanceof DummyPool)) { - if(pool == null) { - bindPool(par1ItemStack, null); - setManaForDisplay(par1ItemStack, 0); - } else setManaForDisplay(par1ItemStack, pool.getCurrentMana()); - } - } - - @Override - public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { - if(par2EntityPlayer.isSneaking() && !par3World.isRemote) { - TileEntity tile = par3World.getTileEntity(par4, par5, par6); - if(tile != null && tile instanceof IManaPool) { - bindPool(par1ItemStack, tile); - par3World.playSoundAtEntity(par2EntityPlayer, "random.orb", 1F, 1F); - return true; - } - } - - return false; - } - - @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - ChunkCoordinates coords = getPoolCoords(par1ItemStack); - if(coords.posY != -1) { - par3List.add("X: " + coords.posX); - par3List.add("Y: " + coords.posY); - par3List.add("Z: " + coords.posZ); - } - } + @Override + public boolean isFull3D() { + return true; + } - @Override - public boolean requiresMultipleRenderPasses() { - return true; - } + @Override + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + IManaPool pool = getManaPool(par1ItemStack); + if(!(pool instanceof DummyPool)) { + if(pool == null) { + bindPool(par1ItemStack, null); + setManaForDisplay(par1ItemStack, 0); + } else setManaForDisplay(par1ItemStack, pool.getCurrentMana()); + } + } - @Override - public int getMana(ItemStack stack) { - IManaPool pool = getManaPool(stack); - return pool == null ? 0 : pool.getCurrentMana(); - } - - public int getManaForDisplay(ItemStack stack) { - return ItemNBTHelper.getInt(stack, TAG_MANA_VISUAL, 0); - } - - public void setManaForDisplay(ItemStack stack, int mana) { - ItemNBTHelper.setInt(stack, TAG_MANA_VISUAL, mana); - } + @Override + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { + if(par2EntityPlayer.isSneaking() && !par3World.isRemote) { + TileEntity tile = par3World.getTileEntity(par4, par5, par6); + if(tile != null && tile instanceof IManaPool) { + bindPool(par1ItemStack, tile); + par3World.playSoundAtEntity(par2EntityPlayer, "random.orb", 1F, 1F); + return true; + } + } - @Override - public int getMaxMana(ItemStack stack) { - return TilePool.MAX_MANA; - } + return false; + } - @Override - public void addMana(ItemStack stack, int mana) { - IManaPool pool = getManaPool(stack); - if(pool != null) - pool.recieveMana(mana); - } - - public void bindPool(ItemStack stack, TileEntity pool) { - ItemNBTHelper.setInt(stack, TAG_POS_X, pool == null ? 0 : pool.xCoord); - ItemNBTHelper.setInt(stack, TAG_POS_Y, pool == null ? -1 : pool.yCoord); - ItemNBTHelper.setInt(stack, TAG_POS_Z, pool == null ? 0 : pool.zCoord); - ItemNBTHelper.setInt(stack, TAG_DIM, pool == null ? 0 : pool.getWorldObj().provider.dimensionId); - } - - public ChunkCoordinates getPoolCoords(ItemStack stack) { - int x = ItemNBTHelper.getInt(stack, TAG_POS_X, 0); - int y = ItemNBTHelper.getInt(stack, TAG_POS_Y, -1); - int z = ItemNBTHelper.getInt(stack, TAG_POS_Z, 0); - return new ChunkCoordinates(x, y, z); - } - - public int getDimension(ItemStack stack) { - return ItemNBTHelper.getInt(stack, TAG_DIM, 0); - } - - public IManaPool getManaPool(ItemStack stack) { - MinecraftServer server = MinecraftServer.getServer(); - if(server == null) - return new DummyPool(); - - ChunkCoordinates coords = getPoolCoords(stack); - if(coords.posY == -1) - return null; - - int dim = getDimension(stack); - if(server.worldServers.length > dim && server.worldServers[dim] != null) { - TileEntity tile = server.worldServers[dim].getTileEntity(coords.posX, coords.posY, coords.posZ); - if(tile != null && tile instanceof IManaPool) - return (IManaPool) tile; - } - - return null; - } + @Override + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + ChunkCoordinates coords = getPoolCoords(par1ItemStack); + if(coords.posY != -1) { + par3List.add("X: " + coords.posX); + par3List.add("Y: " + coords.posY); + par3List.add("Z: " + coords.posZ); + } + } - @Override - public boolean canReceiveManaFromPool(ItemStack stack, TileEntity pool) { - return false; - } + @Override + public boolean requiresMultipleRenderPasses() { + return true; + } - @Override - public boolean canReceiveManaFromItem(ItemStack stack, ItemStack otherStack) { - return false; - } + @Override + public int getMana(ItemStack stack) { + IManaPool pool = getManaPool(stack); + return pool == null ? 0 : pool.getCurrentMana(); + } - @Override - public boolean canExportManaToPool(ItemStack stack, TileEntity pool) { - return false; - } + public int getManaForDisplay(ItemStack stack) { + return ItemNBTHelper.getInt(stack, TAG_MANA_VISUAL, 0); + } - @Override - public boolean canExportManaToItem(ItemStack stack, ItemStack otherStack) { - return true; - } - - private static class DummyPool implements IManaPool { + public void setManaForDisplay(ItemStack stack, int mana) { + ItemNBTHelper.setInt(stack, TAG_MANA_VISUAL, mana); + } - @Override - public boolean isFull() { - return false; - } + @Override + public int getMaxMana(ItemStack stack) { + return TilePool.MAX_MANA; + } - @Override - public void recieveMana(int mana) { - // NO-OP - } + @Override + public void addMana(ItemStack stack, int mana) { + IManaPool pool = getManaPool(stack); + if(pool != null) pool.recieveMana(mana); + } - @Override - public boolean canRecieveManaFromBursts() { - return false; - } + public void bindPool(ItemStack stack, TileEntity pool) { + ItemNBTHelper.setInt(stack, TAG_POS_X, pool == null ? 0 : pool.xCoord); + ItemNBTHelper.setInt(stack, TAG_POS_Y, pool == null ? -1 : pool.yCoord); + ItemNBTHelper.setInt(stack, TAG_POS_Z, pool == null ? 0 : pool.zCoord); + ItemNBTHelper.setInt(stack, TAG_DIM, pool == null ? 0 : pool.getWorldObj().provider.dimensionId); + } - @Override - public int getCurrentMana() { - return 0; - } + public ChunkCoordinates getPoolCoords(ItemStack stack) { + int x = ItemNBTHelper.getInt(stack, TAG_POS_X, 0); + int y = ItemNBTHelper.getInt(stack, TAG_POS_Y, -1); + int z = ItemNBTHelper.getInt(stack, TAG_POS_Z, 0); + return new ChunkCoordinates(x, y, z); + } - @Override - public boolean isOutputtingPower() { - return false; - } - - } + public int getDimension(ItemStack stack) { + return ItemNBTHelper.getInt(stack, TAG_DIM, 0); + } + + public IManaPool getManaPool(ItemStack stack) { + MinecraftServer server = MinecraftServer.getServer(); + if(server == null) return new DummyPool(); + + ChunkCoordinates coords = getPoolCoords(stack); + if(coords.posY == -1) return null; + + int dim = getDimension(stack); + if(server.worldServers.length > dim && server.worldServers[dim] != null) { + TileEntity tile = server.worldServers[dim].getTileEntity(coords.posX, coords.posY, coords.posZ); + if(tile != null && tile instanceof IManaPool) return (IManaPool) tile; + } + + return null; + } + + @Override + public boolean canReceiveManaFromPool(ItemStack stack, TileEntity pool) { + return false; + } + + @Override + public boolean canReceiveManaFromItem(ItemStack stack, ItemStack otherStack) { + return false; + } + + @Override + public boolean canExportManaToPool(ItemStack stack, TileEntity pool) { + return false; + } + + @Override + public boolean canExportManaToItem(ItemStack stack, ItemStack otherStack) { + return true; + } + + private static class DummyPool implements IManaPool { + + @Override + public boolean isFull() { + return false; + } + + @Override + public void recieveMana(int mana) { + // NO-OP + } + + @Override + public boolean canRecieveManaFromBursts() { + return false; + } + + @Override + public int getCurrentMana() { + return 0; + } + + @Override + public boolean isOutputtingPower() { + return false; + } + + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemManaPetal.java b/MODSRC/vazkii/botania/common/item/ItemManaPetal.java index c38f5be5b..6e05fe126 100644 --- a/MODSRC/vazkii/botania/common/item/ItemManaPetal.java +++ b/MODSRC/vazkii/botania/common/item/ItemManaPetal.java @@ -2,35 +2,33 @@ * This class was created by . 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 @ [Feb 2, 2014, 12:57:22 PM (GMT)] */ package vazkii.botania.common.item; -import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; import vazkii.botania.api.recipe.IFlowerComponent; import vazkii.botania.common.lib.LibItemNames; public class ItemManaPetal extends Item16Colors implements IFlowerComponent { - public ItemManaPetal() { - super(LibItemNames.MANA_PETAL); - } + public ItemManaPetal() { + super(LibItemNames.MANA_PETAL); + } - @Override - public boolean canFit(ItemStack stack, IInventory apothecary) { - return true; - } + @Override + public boolean canFit(ItemStack stack, IInventory apothecary) { + return true; + } - @Override - public int getParticleColor(ItemStack stack) { - return getColorFromItemStack(stack, 0); - } + @Override + public int getParticleColor(ItemStack stack) { + return getColorFromItemStack(stack, 0); + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemManaResource.java b/MODSRC/vazkii/botania/common/item/ItemManaResource.java index d5b17dd80..7da76e5fe 100644 --- a/MODSRC/vazkii/botania/common/item/ItemManaResource.java +++ b/MODSRC/vazkii/botania/common/item/ItemManaResource.java @@ -2,17 +2,15 @@ * This class was created by . 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 30, 2014, 4:49:16 PM (GMT)] */ package vazkii.botania.common.item; -import java.util.List; - import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -21,37 +19,39 @@ import net.minecraft.util.IIcon; import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.common.lib.LibItemNames; +import java.util.List; + public class ItemManaResource extends ItemMod { - final int types = 5; - IIcon[] icons; + final int types = 5; + IIcon[] icons; - public ItemManaResource() { - super(); - setUnlocalizedName(LibItemNames.MANA_RESOURCE); - setHasSubtypes(true); - } + public ItemManaResource() { + super(); + setUnlocalizedName(LibItemNames.MANA_RESOURCE); + setHasSubtypes(true); + } - @Override - public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - for(int i = 0; i < types; i++) - par3List.add(new ItemStack(par1, 1, i)); - } + @Override + public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for(int i = 0; i < types; i++) + par3List.add(new ItemStack(par1, 1, i)); + } - @Override - public void registerIcons(IIconRegister par1IconRegister) { - icons = new IIcon[types]; - for(int i = 0; i < icons.length; i++) - icons[i] = IconHelper.forNameRaw(par1IconRegister, LibItemNames.MANA_RESOURCE_NAMES[i]); - } + @Override + public void registerIcons(IIconRegister par1IconRegister) { + icons = new IIcon[types]; + for(int i = 0; i < icons.length; i++) + icons[i] = IconHelper.forNameRaw(par1IconRegister, LibItemNames.MANA_RESOURCE_NAMES[i]); + } - @Override - public String getUnlocalizedName(ItemStack par1ItemStack) { - return "item." + LibItemNames.MANA_RESOURCE_NAMES[Math.min(types - 1, par1ItemStack.getItemDamage())]; - } + @Override + public String getUnlocalizedName(ItemStack par1ItemStack) { + return "item." + LibItemNames.MANA_RESOURCE_NAMES[Math.min(types - 1, par1ItemStack.getItemDamage())]; + } - @Override - public IIcon getIconFromDamage(int par1) { - return icons[Math.min(icons.length - 1, par1)]; - } + @Override + public IIcon getIconFromDamage(int par1) { + return icons[Math.min(icons.length - 1, par1)]; + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemManaTablet.java b/MODSRC/vazkii/botania/common/item/ItemManaTablet.java index 6d3c1494a..39bfa81f6 100644 --- a/MODSRC/vazkii/botania/common/item/ItemManaTablet.java +++ b/MODSRC/vazkii/botania/common/item/ItemManaTablet.java @@ -2,18 +2,15 @@ * This class was created by . 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 @ [Mar 7, 2014, 7:06:20 PM (GMT)] */ package vazkii.botania.common.item; -import java.awt.Color; -import java.util.List; - import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -28,126 +25,127 @@ import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.common.core.helper.ItemNBTHelper; import vazkii.botania.common.lib.LibItemNames; +import java.awt.*; +import java.util.List; + public class ItemManaTablet extends ItemMod implements IManaItem { - IIcon[] icons; + IIcon[] icons; - private static final int MAX_MANA = 500000; + private static final int MAX_MANA = 500000; - private static final String TAG_MANA = "mana"; - private static final String TAG_CREATIVE = "creative"; + private static final String TAG_MANA = "mana"; + private static final String TAG_CREATIVE = "creative"; - public ItemManaTablet() { - super(); - setMaxStackSize(1); - setMaxDamage(1000); - setUnlocalizedName(LibItemNames.MANA_TABLET); - } + public ItemManaTablet() { + super(); + setMaxStackSize(1); + setMaxDamage(1000); + setUnlocalizedName(LibItemNames.MANA_TABLET); + } - @Override - public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - par3List.add(new ItemStack(par1, 1, 10000)); + @Override + public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + par3List.add(new ItemStack(par1, 1, 10000)); - ItemStack fullPower = new ItemStack(par1, 1, 1); - setMana(fullPower, MAX_MANA); - par3List.add(fullPower); + ItemStack fullPower = new ItemStack(par1, 1, 1); + setMana(fullPower, MAX_MANA); + par3List.add(fullPower); - ItemStack creative = new ItemStack(par1, 1, 0); - setMana(creative, MAX_MANA); - setStackCreative(creative); - par3List.add(creative); - } + ItemStack creative = new ItemStack(par1, 1, 0); + setMana(creative, MAX_MANA); + setStackCreative(creative); + par3List.add(creative); + } - @Override - public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { - float mana = getMana(par1ItemStack); - return par2 == 1 ? Color.HSBtoRGB(0.528F, mana / MAX_MANA, 1F) : 0xFFFFFF; - } + @Override + public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { + float mana = getMana(par1ItemStack); + return par2 == 1 ? Color.HSBtoRGB(0.528F, mana / MAX_MANA, 1F) : 0xFFFFFF; + } - @Override - public int getDamage(ItemStack stack) { - float mana = getMana(stack); - return 1000 - (int) (mana / MAX_MANA * 1000); - } + @Override + public int getDamage(ItemStack stack) { + float mana = getMana(stack); + return 1000 - (int) (mana / MAX_MANA * 1000); + } - @Override - public int getDisplayDamage(ItemStack stack) { - return getDamage(stack); - } + @Override + public int getDisplayDamage(ItemStack stack) { + return getDamage(stack); + } - @Override - public void registerIcons(IIconRegister par1IconRegister) { - icons = new IIcon[2]; - for(int i = 0; i < icons.length; i++) - icons[i] = IconHelper.forItem(par1IconRegister, this, i); - } + @Override + public void registerIcons(IIconRegister par1IconRegister) { + icons = new IIcon[2]; + for(int i = 0; i < icons.length; i++) + icons[i] = IconHelper.forItem(par1IconRegister, this, i); + } - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return icons[Math.min(1, pass)]; - } + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return icons[Math.min(1, pass)]; + } - @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - if(isStackCreative(par1ItemStack)) - par3List.add(StatCollector.translateToLocal("botaniamisc.creative")); - } + @Override + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + if(isStackCreative(par1ItemStack)) par3List.add(StatCollector.translateToLocal("botaniamisc.creative")); + } - @Override - public boolean requiresMultipleRenderPasses() { - return true; - } + @Override + public boolean requiresMultipleRenderPasses() { + return true; + } - @Override - public int getEntityLifespan(ItemStack itemStack, World world) { - return Integer.MAX_VALUE; - } + @Override + public int getEntityLifespan(ItemStack itemStack, World world) { + return Integer.MAX_VALUE; + } - public static void setMana(ItemStack stack, int mana) { - ItemNBTHelper.setInt(stack, TAG_MANA, mana); - } + public static void setMana(ItemStack stack, int mana) { + ItemNBTHelper.setInt(stack, TAG_MANA, mana); + } - public static void setStackCreative(ItemStack stack) { - ItemNBTHelper.setBoolean(stack, TAG_CREATIVE, true); - } + public static void setStackCreative(ItemStack stack) { + ItemNBTHelper.setBoolean(stack, TAG_CREATIVE, true); + } - public static boolean isStackCreative(ItemStack stack) { - return ItemNBTHelper.getBoolean(stack, TAG_CREATIVE, false); - } + public static boolean isStackCreative(ItemStack stack) { + return ItemNBTHelper.getBoolean(stack, TAG_CREATIVE, false); + } - @Override - public int getMana(ItemStack stack) { - return ItemNBTHelper.getInt(stack, TAG_MANA, 0); - } + @Override + public int getMana(ItemStack stack) { + return ItemNBTHelper.getInt(stack, TAG_MANA, 0); + } - @Override - public int getMaxMana(ItemStack stack) { - return isStackCreative(stack) ? MAX_MANA + 1000 : MAX_MANA; - } + @Override + public int getMaxMana(ItemStack stack) { + return isStackCreative(stack) ? MAX_MANA + 1000 : MAX_MANA; + } - @Override - public void addMana(ItemStack stack, int mana) { - if(!isStackCreative(stack)) - setMana(stack, Math.min(getMana(stack) + mana, MAX_MANA)); - } + @Override + public void addMana(ItemStack stack, int mana) { + if(!isStackCreative(stack)) setMana(stack, Math.min(getMana(stack) + mana, MAX_MANA)); + } - @Override - public boolean canReceiveManaFromPool(ItemStack stack, TileEntity pool) { - return true; - } + @Override + public boolean canReceiveManaFromPool(ItemStack stack, TileEntity pool) { + return true; + } - @Override - public boolean canReceiveManaFromItem(ItemStack stack, ItemStack otherStack) { - return false; - } + @Override + public boolean canReceiveManaFromItem(ItemStack stack, ItemStack otherStack) { + return false; + } - @Override - public boolean canExportManaToPool(ItemStack stack, TileEntity pool) { - return true; - } + @Override + public boolean canExportManaToPool(ItemStack stack, TileEntity pool) { + return true; + } - @Override - public boolean canExportManaToItem(ItemStack stack, ItemStack otherStack) { - return true; - } + @Override + public boolean canExportManaToItem(ItemStack stack, ItemStack otherStack) { + return true; + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemMod.java b/MODSRC/vazkii/botania/common/item/ItemMod.java index 9796c3f58..79e4a56bd 100644 --- a/MODSRC/vazkii/botania/common/item/ItemMod.java +++ b/MODSRC/vazkii/botania/common/item/ItemMod.java @@ -2,39 +2,39 @@ * This class was created by . 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 14, 2014, 5:30:18 PM (GMT)] */ package vazkii.botania.common.item; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.common.core.BotaniaCreativeTab; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class ItemMod extends Item { - public ItemMod() { - super(); - setCreativeTab(BotaniaCreativeTab.INSTANCE); - } + public ItemMod() { + super(); + setCreativeTab(BotaniaCreativeTab.INSTANCE); + } - @Override - public Item setUnlocalizedName(String par1Str) { - GameRegistry.registerItem(this, par1Str); - return super.setUnlocalizedName(par1Str); - } + @Override + public Item setUnlocalizedName(String par1Str) { + GameRegistry.registerItem(this, par1Str); + return super.setUnlocalizedName(par1Str); + } - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - itemIcon = IconHelper.forItem(par1IconRegister, this); - } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + itemIcon = IconHelper.forItem(par1IconRegister, this); + } } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/common/item/ItemPestleAndMortar.java b/MODSRC/vazkii/botania/common/item/ItemPestleAndMortar.java index f27e49a6a..637aba9c7 100644 --- a/MODSRC/vazkii/botania/common/item/ItemPestleAndMortar.java +++ b/MODSRC/vazkii/botania/common/item/ItemPestleAndMortar.java @@ -2,11 +2,11 @@ * This class was created by . 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 19, 2014, 7:00:34 PM (GMT)] */ package vazkii.botania.common.item; @@ -16,16 +16,16 @@ import vazkii.botania.common.lib.LibItemNames; public class ItemPestleAndMortar extends ItemMod { - public ItemPestleAndMortar() { - super(); - setMaxStackSize(1); - setContainerItem(this); - setUnlocalizedName(LibItemNames.PESTLE_AND_MORTAR); - } - - @Override - public boolean doesContainerItemLeaveCraftingGrid(ItemStack par1ItemStack) { - return false; - } + public ItemPestleAndMortar() { + super(); + setMaxStackSize(1); + setContainerItem(this); + setUnlocalizedName(LibItemNames.PESTLE_AND_MORTAR); + } + + @Override + public boolean doesContainerItemLeaveCraftingGrid(ItemStack par1ItemStack) { + return false; + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemPetal.java b/MODSRC/vazkii/botania/common/item/ItemPetal.java index cd51131bc..7fbd0c626 100644 --- a/MODSRC/vazkii/botania/common/item/ItemPetal.java +++ b/MODSRC/vazkii/botania/common/item/ItemPetal.java @@ -2,11 +2,11 @@ * This class was created by . 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 19, 2014, 3:28:21 PM (GMT)] */ package vazkii.botania.common.item; @@ -18,17 +18,17 @@ import vazkii.botania.common.lib.LibItemNames; public class ItemPetal extends Item16Colors implements IFlowerComponent { - public ItemPetal() { - super(LibItemNames.PETAL); - } + public ItemPetal() { + super(LibItemNames.PETAL); + } - @Override - public boolean canFit(ItemStack stack, IInventory apothecary) { - return true; - } + @Override + public boolean canFit(ItemStack stack, IInventory apothecary) { + return true; + } - @Override - public int getParticleColor(ItemStack stack) { - return getColorFromItemStack(stack, 0); - } + @Override + public int getParticleColor(ItemStack stack) { + return getColorFromItemStack(stack, 0); + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemRune.java b/MODSRC/vazkii/botania/common/item/ItemRune.java index bf57422f7..269bf4499 100644 --- a/MODSRC/vazkii/botania/common/item/ItemRune.java +++ b/MODSRC/vazkii/botania/common/item/ItemRune.java @@ -2,17 +2,15 @@ * This class was created by . 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 @ [Feb 7, 2014, 9:46:24 PM (GMT)] */ package vazkii.botania.common.item; -import java.util.List; - import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.inventory.IInventory; @@ -23,51 +21,53 @@ import vazkii.botania.api.recipe.IFlowerComponent; import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.common.lib.LibItemNames; +import java.util.List; + public class ItemRune extends ItemMod implements IFlowerComponent { - IIcon[] icons; + IIcon[] icons; - public ItemRune() { - super(); - setHasSubtypes(true); - setUnlocalizedName(LibItemNames.RUNE); - } + public ItemRune() { + super(); + setHasSubtypes(true); + setUnlocalizedName(LibItemNames.RUNE); + } - @Override - public void registerIcons(IIconRegister par1IconRegister) { - icons = new IIcon[16]; - for(int i = 0; i < icons.length; i++) - icons[i] = IconHelper.forItem(par1IconRegister, this, i); - } + @Override + public void registerIcons(IIconRegister par1IconRegister) { + icons = new IIcon[16]; + for(int i = 0; i < icons.length; i++) + icons[i] = IconHelper.forItem(par1IconRegister, this, i); + } - @Override - public IIcon getIconFromDamage(int par1) { - return icons[Math.min(icons.length - 1, par1)]; - } + @Override + public IIcon getIconFromDamage(int par1) { + return icons[Math.min(icons.length - 1, par1)]; + } - @Override - public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - for(int i = 0; i < 16; i++) - par3List.add(new ItemStack(par1, 1, i)); - } + @Override + public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for(int i = 0; i < 16; i++) + par3List.add(new ItemStack(par1, 1, i)); + } - @Override - public String getUnlocalizedName(ItemStack par1ItemStack) { - return getUnlocalizedNameLazy(par1ItemStack) + par1ItemStack.getItemDamage(); - } + @Override + public String getUnlocalizedName(ItemStack par1ItemStack) { + return getUnlocalizedNameLazy(par1ItemStack) + par1ItemStack.getItemDamage(); + } - String getUnlocalizedNameLazy(ItemStack par1ItemStack) { - return super.getUnlocalizedName(par1ItemStack); - } + String getUnlocalizedNameLazy(ItemStack par1ItemStack) { + return super.getUnlocalizedName(par1ItemStack); + } - @Override - public boolean canFit(ItemStack stack, IInventory apothecary) { - return true; - } + @Override + public boolean canFit(ItemStack stack, IInventory apothecary) { + return true; + } - @Override - public int getParticleColor(ItemStack stack) { - return 0xA8A8A8; - } + @Override + public int getParticleColor(ItemStack stack) { + return 0xA8A8A8; + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemSignalFlare.java b/MODSRC/vazkii/botania/common/item/ItemSignalFlare.java index b9acb0892..a065b4376 100644 --- a/MODSRC/vazkii/botania/common/item/ItemSignalFlare.java +++ b/MODSRC/vazkii/botania/common/item/ItemSignalFlare.java @@ -2,18 +2,15 @@ * This class was created by . 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 @ [Mar 3, 2014, 6:49:15 PM (GMT)] */ package vazkii.botania.common.item; -import java.awt.Color; -import java.util.List; - import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -34,102 +31,102 @@ import vazkii.botania.common.core.helper.ItemNBTHelper; import vazkii.botania.common.entity.EntitySignalFlare; import vazkii.botania.common.lib.LibItemNames; +import java.awt.*; +import java.util.List; + public class ItemSignalFlare extends ItemMod { - IIcon[] icons; + IIcon[] icons; - private static final String TAG_COLOR = "color"; + private static final String TAG_COLOR = "color"; - public ItemSignalFlare() { - super(); - setMaxStackSize(1); - setNoRepair(); - setMaxDamage(200); - setUnlocalizedName(LibItemNames.SIGNAL_FLARE); - } + public ItemSignalFlare() { + super(); + setMaxStackSize(1); + setNoRepair(); + setMaxDamage(200); + setUnlocalizedName(LibItemNames.SIGNAL_FLARE); + } - @Override - public boolean isFull3D() { - return true; - } + @Override + public boolean isFull3D() { + return true; + } - @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { - if(par1ItemStack.getItemDamage() == 0) { - if(par2World.isRemote) - par3EntityPlayer.swingItem(); - else { - EntitySignalFlare flare = new EntitySignalFlare(par2World); - flare.setPosition(par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ); - flare.setColor(getColor(par1ItemStack)); - par2World.playSoundAtEntity(par3EntityPlayer, "random.explode", 40F, (1.0F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.2F) * 0.7F); + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + if(par1ItemStack.getItemDamage() == 0) { + if(par2World.isRemote) par3EntityPlayer.swingItem(); + else { + EntitySignalFlare flare = new EntitySignalFlare(par2World); + flare.setPosition(par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ); + flare.setColor(getColor(par1ItemStack)); + par2World.playSoundAtEntity(par3EntityPlayer, "random.explode", 40F, (1.0F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.2F) * 0.7F); - par2World.spawnEntityInWorld(flare); + par2World.spawnEntityInWorld(flare); - int range = 5; - List entities = par2World.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX - range, par3EntityPlayer.posY - range, par3EntityPlayer.posZ - range, par3EntityPlayer.posX + range, par3EntityPlayer.posY + range, par3EntityPlayer.posZ + range)); - for(EntityLivingBase entity : entities) - if(entity != par3EntityPlayer && (!(entity instanceof EntityPlayer) || MinecraftServer.getServer() == null || MinecraftServer.getServer().isPVPEnabled())) - entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 50, 5)); - } - par1ItemStack.damageItem(200, par3EntityPlayer); - } + int range = 5; + List entities = par2World.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX - range, par3EntityPlayer.posY - range, par3EntityPlayer.posZ - range, par3EntityPlayer.posX + range, par3EntityPlayer.posY + range, par3EntityPlayer.posZ + range)); + for(EntityLivingBase entity : entities) + if(entity != par3EntityPlayer && (!(entity instanceof EntityPlayer) || MinecraftServer.getServer() == null || MinecraftServer.getServer().isPVPEnabled())) + entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 50, 5)); + } + par1ItemStack.damageItem(200, par3EntityPlayer); + } - return par1ItemStack; - } + return par1ItemStack; + } - @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { - if(par1ItemStack.isItemDamaged()) - par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() - 1); - } + @Override + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + if(par1ItemStack.isItemDamaged()) par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() - 1); + } - @Override - public void registerIcons(IIconRegister par1IconRegister) { - icons = new IIcon[2]; - for(int i = 0; i < icons.length; i++) - icons[i] = IconHelper.forItem(par1IconRegister, this, i); - } + @Override + public void registerIcons(IIconRegister par1IconRegister) { + icons = new IIcon[2]; + for(int i = 0; i < icons.length; i++) + icons[i] = IconHelper.forItem(par1IconRegister, this, i); + } - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return icons[Math.min(1, pass)]; - } + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return icons[Math.min(1, pass)]; + } - @Override - public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { - if(par2 == 0) - return 0xFFFFFF; + @Override + public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { + if(par2 == 0) return 0xFFFFFF; - float[] color = EntitySheep.fleeceColorTable[getColor(par1ItemStack)]; - return new Color(color[0], color[1], color[2]).getRGB(); - } + float[] color = EntitySheep.fleeceColorTable[getColor(par1ItemStack)]; + return new Color(color[0], color[1], color[2]).getRGB(); + } - @Override - public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - for(int i = 0; i < 16; i++) - par3List.add(forColor(i)); - } + @Override + public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for(int i = 0; i < 16; i++) + par3List.add(forColor(i)); + } - @Override - public boolean requiresMultipleRenderPasses() { - return true; - } + @Override + public boolean requiresMultipleRenderPasses() { + return true; + } - @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - int storedColor = getColor(par1ItemStack); - par3List.add(String.format(StatCollector.translateToLocal("botaniamisc.flareColor"), StatCollector.translateToLocal("botania.color" + storedColor))); - } + @Override + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + int storedColor = getColor(par1ItemStack); + par3List.add(String.format(StatCollector.translateToLocal("botaniamisc.flareColor"), StatCollector.translateToLocal("botania.color" + storedColor))); + } - public static ItemStack forColor(int color) { - ItemStack stack = new ItemStack(ModItems.signalFlare); - ItemNBTHelper.setInt(stack, TAG_COLOR, color); + public static ItemStack forColor(int color) { + ItemStack stack = new ItemStack(ModItems.signalFlare); + ItemNBTHelper.setInt(stack, TAG_COLOR, color); - return stack; - } + return stack; + } - public static int getColor(ItemStack stack) { - return ItemNBTHelper.getInt(stack, TAG_COLOR, 0xFFFFFF); - } + public static int getColor(ItemStack stack) { + return ItemNBTHelper.getInt(stack, TAG_COLOR, 0xFFFFFF); + } } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/common/item/ItemTerraformRod.java b/MODSRC/vazkii/botania/common/item/ItemTerraformRod.java index 2cc2d70a5..5764260c0 100644 --- a/MODSRC/vazkii/botania/common/item/ItemTerraformRod.java +++ b/MODSRC/vazkii/botania/common/item/ItemTerraformRod.java @@ -2,18 +2,15 @@ * This class was created by . 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 @ [Apr 11, 2014, 2:56:39 PM (GMT)] */ package vazkii.botania.common.item; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.block.BlockFlower; import net.minecraft.entity.player.EntityPlayer; @@ -28,137 +25,134 @@ import vazkii.botania.api.mana.ManaItemHandler; import vazkii.botania.common.Botania; import vazkii.botania.common.lib.LibItemNames; +import java.util.ArrayList; +import java.util.List; + public class ItemTerraformRod extends ItemMod { - private static final int COST_PER = 55; + private static final int COST_PER = 55; - static final List validBlocks = new ArrayList() {{ - add(Blocks.stone); - add(Blocks.dirt); - add(Blocks.grass); - add(Blocks.sand); - add(Blocks.gravel); - add(Blocks.hardened_clay); - add(Blocks.snow_layer); - add(Blocks.mycelium); - add(Blocks.sandstone); - }}; - - public ItemTerraformRod() { - super(); - setMaxStackSize(1); - setUnlocalizedName(LibItemNames.TERRAFORM_ROD); - } + static final List validBlocks = new ArrayList() {{ + add(Blocks.stone); + add(Blocks.dirt); + add(Blocks.grass); + add(Blocks.sand); + add(Blocks.gravel); + add(Blocks.hardened_clay); + add(Blocks.snow_layer); + add(Blocks.mycelium); + add(Blocks.sandstone); + }}; - @Override - public EnumAction getItemUseAction(ItemStack par1ItemStack) { - return EnumAction.bow; - } + public ItemTerraformRod() { + super(); + setMaxStackSize(1); + setUnlocalizedName(LibItemNames.TERRAFORM_ROD); + } - @Override - public int getMaxItemUseDuration(ItemStack par1ItemStack) { - return 72000; - } + @Override + public EnumAction getItemUseAction(ItemStack par1ItemStack) { + return EnumAction.bow; + } - @Override - public void onUsingTick(ItemStack stack, EntityPlayer player, int count) { - if(count != getMaxItemUseDuration(stack) && count % 10 == 0) - terraform(stack, player.worldObj, player); - } + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack) { + return 72000; + } - @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { - par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack)); - return par1ItemStack; - } + @Override + public void onUsingTick(ItemStack stack, EntityPlayer player, int count) { + if(count != getMaxItemUseDuration(stack) && count % 10 == 0) terraform(stack, player.worldObj, player); + } - public void terraform(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { - int range = 16; + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack)); + return par1ItemStack; + } - int xCenter = (int) par3EntityPlayer.posX; - int yCenter = (int) par3EntityPlayer.posY - (par2World.isRemote ? 2 : 1); - int zCenter = (int) par3EntityPlayer.posZ; + public void terraform(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { + int range = 16; - int yStart = yCenter + range; + int xCenter = (int) par3EntityPlayer.posX; + int yCenter = (int) par3EntityPlayer.posY - (par2World.isRemote ? 2 : 1); + int zCenter = (int) par3EntityPlayer.posZ; - List blocks = new ArrayList(); + int yStart = yCenter + range; - for(int i = -range; i < range + 1; i++) - for(int j = -range; j < range + 1; j++) { - int k = 0; - while(true) { - if(yStart + k < 0) - break; + List blocks = new ArrayList(); - int x = xCenter + i; - int y = yStart + k; - int z = zCenter + j; - - Block block = par2World.getBlock(x, y, z); - if(validBlocks.contains(block)) { - boolean hasAir = false; - List airBlocks = new ArrayList(); + for(int i = -range; i < range + 1; i++) + for(int j = -range; j < range + 1; j++) { + int k = 0; + while(true) { + if(yStart + k < 0) break; - final ForgeDirection[] dirs = new ForgeDirection[] { - ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST - }; + int x = xCenter + i; + int y = yStart + k; + int z = zCenter + j; - for(ForgeDirection dir : dirs) { - int x_ = x + dir.offsetX; - int y_ = y + dir.offsetY; - int z_ = z + dir.offsetZ; + Block block = par2World.getBlock(x, y, z); + if(validBlocks.contains(block)) { + boolean hasAir = false; + List airBlocks = new ArrayList(); - Block block_ = par2World.getBlock(x_, y_, z_); - if(block_.isAir(par2World, x_, y_, z_) || block_.isReplaceable(par2World, x_, y_, z_) || (block_ instanceof BlockFlower && !(block_ instanceof ISpecialFlower)) || block_ == Blocks.double_plant) { - airBlocks.add(new ChunkCoordinates(x_, y_, z_)); - hasAir = true; - } - } + final ForgeDirection[] dirs = new ForgeDirection[]{ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST}; - if(hasAir) { - if(y > yCenter) - blocks.add(new CoordsWithBlock(x, y, z, Blocks.air)); - else for(ChunkCoordinates coords : airBlocks) { - if(par2World.getBlock(coords.posX, coords.posY - 1, coords.posZ) != Blocks.air) - blocks.add(new CoordsWithBlock(coords.posX, coords.posY, coords.posZ, Blocks.dirt)); - } - } - break; - } - --k; - } - } + for(ForgeDirection dir : dirs) { + int x_ = x + dir.offsetX; + int y_ = y + dir.offsetY; + int z_ = z + dir.offsetZ; - int cost = COST_PER * blocks.size(); + Block block_ = par2World.getBlock(x_, y_, z_); + if(block_.isAir(par2World, x_, y_, z_) || block_.isReplaceable(par2World, x_, y_, z_) || (block_ instanceof BlockFlower && !(block_ instanceof ISpecialFlower)) || block_ == Blocks.double_plant) { + airBlocks.add(new ChunkCoordinates(x_, y_, z_)); + hasAir = true; + } + } - if(par2World.isRemote || ManaItemHandler.requestManaExact(par1ItemStack, par3EntityPlayer, cost, true)) { - if(!par2World.isRemote) - for(CoordsWithBlock block : blocks) - par2World.setBlock(block.posX, block.posY, block.posZ, block.block); + if(hasAir) { + if(y > yCenter) blocks.add(new CoordsWithBlock(x, y, z, Blocks.air)); + else for(ChunkCoordinates coords : airBlocks) { + if(par2World.getBlock(coords.posX, coords.posY - 1, coords.posZ) != Blocks.air) + blocks.add(new CoordsWithBlock(coords.posX, coords.posY, coords.posZ, Blocks.dirt)); + } + } + break; + } + --k; + } + } - if(!blocks.isEmpty()) { - for(int i = 0; i < 10; i++) - par2World.playSoundAtEntity(par3EntityPlayer, "step.sand", 1F, 0.4F); - for(int i = 0; i < 120; i++) - Botania.proxy.sparkleFX(par2World, xCenter - range + range * 2 * Math.random(), yCenter + 2 + (Math.random() - 0.5) * 2, zCenter - range + range * 2 * Math.random(), 0.35F, 0.2F, 0.05F, 2F, 5); - } - } - } - - @Override - public boolean isFull3D() { - return true; - } + int cost = COST_PER * blocks.size(); - class CoordsWithBlock extends ChunkCoordinates { + if(par2World.isRemote || ManaItemHandler.requestManaExact(par1ItemStack, par3EntityPlayer, cost, true)) { + if(!par2World.isRemote) for(CoordsWithBlock block : blocks) + par2World.setBlock(block.posX, block.posY, block.posZ, block.block); - final Block block; + if(!blocks.isEmpty()) { + for(int i = 0; i < 10; i++) + par2World.playSoundAtEntity(par3EntityPlayer, "step.sand", 1F, 0.4F); + for(int i = 0; i < 120; i++) + Botania.proxy.sparkleFX(par2World, xCenter - range + range * 2 * Math.random(), yCenter + 2 + (Math.random() - 0.5) * 2, zCenter - range + range * 2 * Math.random(), 0.35F, 0.2F, 0.05F, 2F, 5); + } + } + } - public CoordsWithBlock(int x, int y, int z, Block block) { - super(x, y, z); - this.block = block; - } + @Override + public boolean isFull3D() { + return true; + } - } + class CoordsWithBlock extends ChunkCoordinates { + + final Block block; + + public CoordsWithBlock(int x, int y, int z, Block block) { + super(x, y, z); + this.block = block; + } + + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemTwigWand.java b/MODSRC/vazkii/botania/common/item/ItemTwigWand.java index 229ed6a60..eb710634b 100644 --- a/MODSRC/vazkii/botania/common/item/ItemTwigWand.java +++ b/MODSRC/vazkii/botania/common/item/ItemTwigWand.java @@ -2,18 +2,15 @@ * This class was created by . 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.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -34,133 +31,131 @@ import vazkii.botania.common.block.tile.TileEnchanter; import vazkii.botania.common.core.helper.ItemNBTHelper; import vazkii.botania.common.lib.LibItemNames; +import java.awt.*; +import java.util.List; + public class ItemTwigWand extends Item16Colors { - IIcon[] icons; + IIcon[] icons; - private static final String TAG_COLOR1 = "color1"; - private static final String TAG_COLOR2 = "color2"; + private static final String TAG_COLOR1 = "color1"; + private static final String TAG_COLOR2 = "color2"; - public ItemTwigWand() { - super(LibItemNames.TWIG_WAND); - setMaxStackSize(1); - } + public ItemTwigWand() { + super(LibItemNames.TWIG_WAND); + setMaxStackSize(1); + } - @Override - public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { - Block block = par3World.getBlock(par4, par5, par6); - if(block == Blocks.lapis_block) { - int meta = -1; - if(TileEnchanter.canEnchanterExist(par3World, par4, par5, par6, 0)) - meta = 0; - else if(TileEnchanter.canEnchanterExist(par3World, par4, par5, par6, 1)) - meta = 1; + @Override + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { + Block block = par3World.getBlock(par4, par5, par6); + if(block == Blocks.lapis_block) { + int meta = -1; + if(TileEnchanter.canEnchanterExist(par3World, par4, par5, par6, 0)) meta = 0; + else if(TileEnchanter.canEnchanterExist(par3World, par4, par5, par6, 1)) meta = 1; - if(meta != -1 && !par3World.isRemote) { - par3World.setBlock(par4, par5, par6, ModBlocks.enchanter, meta, 1 | 2); - par3World.playSoundEffect(par4, par5, par6, "random.levelup", 0.5F, 0.6F); - for(int i = 0; i < 50; i++) { - float red = (float) Math.random(); - float green = (float) Math.random(); - float blue = (float) Math.random(); + if(meta != -1 && !par3World.isRemote) { + par3World.setBlock(par4, par5, par6, ModBlocks.enchanter, meta, 1 | 2); + par3World.playSoundEffect(par4, par5, par6, "random.levelup", 0.5F, 0.6F); + for(int i = 0; i < 50; i++) { + float red = (float) Math.random(); + float green = (float) Math.random(); + float blue = (float) Math.random(); - double x = (Math.random() - 0.5) * 6; - double y = (Math.random() - 0.5) * 6; - double z = (Math.random() - 0.5) * 6; + double x = (Math.random() - 0.5) * 6; + double y = (Math.random() - 0.5) * 6; + double z = (Math.random() - 0.5) * 6; - float velMul = 0.07F; + float velMul = 0.07F; - Botania.proxy.wispFX(par3World, par4 + 0.5 + x, par5 + 0.5 + y, par6 + 0.5 + z, red, green, blue, (float) Math.random() * 0.15F + 0.15F, (float) -x * velMul, (float) -y * velMul, (float) -z * velMul); - } - } - } else if(block instanceof IWandable) { - boolean wanded = ((IWandable) block).onUsedByWand(par2EntityPlayer, par1ItemStack, par3World, par4, par5, par6, par7); - if(wanded && par3World.isRemote) - par2EntityPlayer.swingItem(); + Botania.proxy.wispFX(par3World, par4 + 0.5 + x, par5 + 0.5 + y, par6 + 0.5 + z, red, green, blue, (float) Math.random() * 0.15F + 0.15F, (float) -x * velMul, (float) -y * velMul, (float) -z * velMul); + } + } + } else if(block instanceof IWandable) { + boolean wanded = ((IWandable) block).onUsedByWand(par2EntityPlayer, par1ItemStack, par3World, par4, par5, par6, par7); + if(wanded && par3World.isRemote) par2EntityPlayer.swingItem(); - return wanded; + return wanded; - } else if(BlockPistonRelay.playerPositions.containsKey(par2EntityPlayer.getCommandSenderName())) { - String bindPos = BlockPistonRelay.playerPositions.get(par2EntityPlayer.getCommandSenderName()); - String currentPos = BlockPistonRelay.getCoordsAsString(par3World.provider.dimensionId, par4, par5, par6); + } else if(BlockPistonRelay.playerPositions.containsKey(par2EntityPlayer.getCommandSenderName())) { + String bindPos = BlockPistonRelay.playerPositions.get(par2EntityPlayer.getCommandSenderName()); + String currentPos = BlockPistonRelay.getCoordsAsString(par3World.provider.dimensionId, par4, par5, par6); - BlockPistonRelay.playerPositions.remove(par2EntityPlayer.getCommandSenderName()); - BlockPistonRelay.mappedPositions.put(bindPos, currentPos); - BlockPistonRelay.WorldData.get(par3World).markDirty(); + BlockPistonRelay.playerPositions.remove(par2EntityPlayer.getCommandSenderName()); + BlockPistonRelay.mappedPositions.put(bindPos, currentPos); + BlockPistonRelay.WorldData.get(par3World).markDirty(); - if(par3World.isRemote) - par2EntityPlayer.swingItem(); - } + if(par3World.isRemote) par2EntityPlayer.swingItem(); + } - return false; - } + return false; + } - @Override - public boolean isFull3D() { - return true; - } + @Override + public boolean isFull3D() { + return true; + } - @Override - public void registerIcons(IIconRegister par1IconRegister) { - icons = new IIcon[3]; - for(int i = 0; i < icons.length; i++) - icons[i] = IconHelper.forItem(par1IconRegister, this, i); - } + @Override + public void registerIcons(IIconRegister par1IconRegister) { + icons = new IIcon[3]; + for(int i = 0; i < icons.length; i++) + icons[i] = IconHelper.forItem(par1IconRegister, this, i); + } - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return icons[Math.min(2, pass)]; - } + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return icons[Math.min(2, pass)]; + } - @Override - public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { - if(par2 == 0) - return 0xFFFFFF; + @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(); - } + 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 boolean requiresMultipleRenderPasses() { + return true; + } - @Override - public int getRenderPasses(int metadata) { - return 3; - } + @Override + public int getRenderPasses(int metadata) { + return 3; + } - @Override - public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - for(int i = 0; i < 16; i++) - par3List.add(forColors(i, i)); - } + @Override + public void getSubItems(Item 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 String getUnlocalizedName(ItemStack par1ItemStack) { + return getUnlocalizedNameLazy(par1ItemStack); + } - @Override - public EnumRarity getRarity(ItemStack par1ItemStack) { - return EnumRarity.rare; - } + @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); + 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; - } + return stack; + } - public static int getColor1(ItemStack stack) { - return ItemNBTHelper.getInt(stack, TAG_COLOR1, 0xFFFFFF); - } + 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); - } + public static int getColor2(ItemStack stack) { + return ItemNBTHelper.getInt(stack, TAG_COLOR2, 0xFFFFFF); + } } diff --git a/MODSRC/vazkii/botania/common/item/ModItems.java b/MODSRC/vazkii/botania/common/item/ModItems.java index b42e1add0..2f4698364 100644 --- a/MODSRC/vazkii/botania/common/item/ModItems.java +++ b/MODSRC/vazkii/botania/common/item/ModItems.java @@ -2,11 +2,11 @@ * This class was created by . 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 14, 2014, 5:17:47 PM (GMT)] */ package vazkii.botania.common.item; @@ -15,110 +15,101 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -import vazkii.botania.common.item.equipment.armor.ItemManasteelBoots; -import vazkii.botania.common.item.equipment.armor.ItemManasteelChest; -import vazkii.botania.common.item.equipment.armor.ItemManasteelHelm; -import vazkii.botania.common.item.equipment.armor.ItemManasteelLegs; -import vazkii.botania.common.item.equipment.armor.ItemTerrasteelBoots; -import vazkii.botania.common.item.equipment.armor.ItemTerrasteelChest; -import vazkii.botania.common.item.equipment.armor.ItemTerrasteelHelm; -import vazkii.botania.common.item.equipment.armor.ItemTerrasteelLegs; -import vazkii.botania.common.item.equipment.tool.ItemManasteelAxe; -import vazkii.botania.common.item.equipment.tool.ItemManasteelPick; -import vazkii.botania.common.item.equipment.tool.ItemManasteelShears; -import vazkii.botania.common.item.equipment.tool.ItemManasteelShovel; -import vazkii.botania.common.item.equipment.tool.ItemManasteelSword; -import vazkii.botania.common.item.equipment.tool.ItemTerraSword; +import vazkii.botania.common.item.equipment.armor.*; +import vazkii.botania.common.item.equipment.bauble.ItemSimpleRing; +import vazkii.botania.common.item.equipment.tool.*; import vazkii.botania.common.lib.LibOreDict; public final class ModItems { - public static Item lexicon; - public static Item petal; - public static Item dye; - public static Item pestleAndMortar; - public static Item twigWand; - public static Item manaResource; - public static Item lens; - public static Item manaPetal; - public static Item rune; - public static Item signalFlare; - public static Item manaTablet; - public static Item manaGun; - public static Item manaCookie; - public static Item fertilizer; - public static Item grassSeeds; - public static Item dirtRod; - public static Item terraformRod; - public static Item grassHorn; - public static Item manaMirror; - public static Item manasteelHelm; - public static Item manasteelChest; - public static Item manasteelLegs; - public static Item manasteelBoots; - public static Item manasteelPick; - public static Item manasteelShovel; - public static Item manasteelAxe; - public static Item manasteelSword; - public static Item manasteelShears; - public static Item terrasteelHelm; - public static Item terrasteelChest; - public static Item terrasteelLegs; - public static Item terrasteelBoots; - public static Item terraSword; + public static Item lexicon; + public static Item petal; + public static Item dye; + public static Item pestleAndMortar; + public static Item twigWand; + public static Item manaResource; + public static Item lens; + public static Item manaPetal; + public static Item rune; + public static Item signalFlare; + public static Item manaTablet; + public static Item manaGun; + public static Item manaCookie; + public static Item fertilizer; + public static Item grassSeeds; + public static Item dirtRod; + public static Item terraformRod; + public static Item grassHorn; + public static Item manaMirror; + public static Item manasteelHelm; + public static Item manasteelChest; + public static Item manasteelLegs; + public static Item manasteelBoots; + public static Item manasteelPick; + public static Item manasteelShovel; + public static Item manasteelAxe; + public static Item manasteelSword; + public static Item manasteelShears; + public static Item terrasteelHelm; + public static Item terrasteelChest; + public static Item terrasteelLegs; + public static Item terrasteelBoots; + public static Item terraSword; + public static Item test; - public static void init() { - lexicon = new ItemLexicon(); - petal = new ItemPetal(); - dye = new ItemDye(); - pestleAndMortar = new ItemPestleAndMortar(); - twigWand = new ItemTwigWand(); - manaResource = new ItemManaResource(); - lens = new ItemLens(); - manaPetal = new ItemManaPetal(); - rune = new ItemRune(); - signalFlare = new ItemSignalFlare(); - manaTablet = new ItemManaTablet(); - manaGun = new ItemManaGun(); - manaCookie = new ItemManaCookie(); - fertilizer = new ItemFertilizer(); - grassSeeds = new ItemGrassSeeds(); - dirtRod = new ItemDirtRod(); - terraformRod = new ItemTerraformRod(); - grassHorn = new ItemGrassHorn(); - manaMirror = new ItemManaMirror(); - manasteelHelm = new ItemManasteelHelm(); - manasteelChest = new ItemManasteelChest(); - manasteelLegs = new ItemManasteelLegs(); - manasteelBoots = new ItemManasteelBoots(); - manasteelPick = new ItemManasteelPick(); - manasteelShovel = new ItemManasteelShovel(); - manasteelAxe = new ItemManasteelAxe(); - manasteelSword = new ItemManasteelSword(); - manasteelShears = new ItemManasteelShears(); - terrasteelHelm = new ItemTerrasteelHelm(); - terrasteelChest = new ItemTerrasteelChest(); - terrasteelLegs = new ItemTerrasteelLegs(); - terrasteelBoots = new ItemTerrasteelBoots(); - terraSword = new ItemTerraSword(); - - OreDictionary.registerOre(LibOreDict.LEXICON, lexicon); - for(int i = 0; i < 16; i++) { - OreDictionary.registerOre(LibOreDict.PETAL[i], new ItemStack(petal, 1, i)); - OreDictionary.registerOre(LibOreDict.DYE[i], new ItemStack(dye, 1, i)); - OreDictionary.registerOre(LibOreDict.MANA_PETAL[i], new ItemStack(manaPetal, 1, i)); - OreDictionary.registerOre(LibOreDict.RUNE[i], new ItemStack(rune, 1, i)); - } - OreDictionary.registerOre(LibOreDict.PESTLE_AND_MORTAR, pestleAndMortar); - OreDictionary.registerOre(LibOreDict.MANA_STEEL, new ItemStack(manaResource, 1, 0)); - OreDictionary.registerOre(LibOreDict.MANA_PEARL, new ItemStack(manaResource, 1, 1)); - OreDictionary.registerOre(LibOreDict.MANA_DIAMOND, new ItemStack(manaResource, 1, 2)); - OreDictionary.registerOre(LibOreDict.LIVINGWOOD_TWIG, new ItemStack(manaResource, 1, 3)); - OreDictionary.registerOre(LibOreDict.TERRA_STEEL, new ItemStack(manaResource, 1, 4)); + public static void init() { + lexicon = new ItemLexicon(); + petal = new ItemPetal(); + dye = new ItemDye(); + pestleAndMortar = new ItemPestleAndMortar(); + twigWand = new ItemTwigWand(); + manaResource = new ItemManaResource(); + lens = new ItemLens(); + manaPetal = new ItemManaPetal(); + rune = new ItemRune(); + signalFlare = new ItemSignalFlare(); + manaTablet = new ItemManaTablet(); + manaGun = new ItemManaGun(); + manaCookie = new ItemManaCookie(); + fertilizer = new ItemFertilizer(); + grassSeeds = new ItemGrassSeeds(); + dirtRod = new ItemDirtRod(); + terraformRod = new ItemTerraformRod(); + grassHorn = new ItemGrassHorn(); + manaMirror = new ItemManaMirror(); + manasteelHelm = new ItemManasteelHelm(); + manasteelChest = new ItemManasteelChest(); + manasteelLegs = new ItemManasteelLegs(); + manasteelBoots = new ItemManasteelBoots(); + manasteelPick = new ItemManasteelPick(); + manasteelShovel = new ItemManasteelShovel(); + manasteelAxe = new ItemManasteelAxe(); + manasteelSword = new ItemManasteelSword(); + manasteelShears = new ItemManasteelShears(); + terrasteelHelm = new ItemTerrasteelHelm(); + terrasteelChest = new ItemTerrasteelChest(); + terrasteelLegs = new ItemTerrasteelLegs(); + terrasteelBoots = new ItemTerrasteelBoots(); + terraSword = new ItemTerraSword(); + test = new ItemSimpleRing(); - // Vanilla ores (because forge doesn't do this by default for some reason) - OreDictionary.registerOre("ingotIron", Items.iron_ingot); - OreDictionary.registerOre("ingotGold", Items.gold_ingot); - OreDictionary.registerOre("gemDiamond", Items.diamond); - } + OreDictionary.registerOre(LibOreDict.LEXICON, lexicon); + for(int i = 0; i < 16; i++) { + OreDictionary.registerOre(LibOreDict.PETAL[i], new ItemStack(petal, 1, i)); + OreDictionary.registerOre(LibOreDict.DYE[i], new ItemStack(dye, 1, i)); + OreDictionary.registerOre(LibOreDict.MANA_PETAL[i], new ItemStack(manaPetal, 1, i)); + OreDictionary.registerOre(LibOreDict.RUNE[i], new ItemStack(rune, 1, i)); + } + OreDictionary.registerOre(LibOreDict.PESTLE_AND_MORTAR, pestleAndMortar); + OreDictionary.registerOre(LibOreDict.MANA_STEEL, new ItemStack(manaResource, 1, 0)); + OreDictionary.registerOre(LibOreDict.MANA_PEARL, new ItemStack(manaResource, 1, 1)); + OreDictionary.registerOre(LibOreDict.MANA_DIAMOND, new ItemStack(manaResource, 1, 2)); + OreDictionary.registerOre(LibOreDict.LIVINGWOOD_TWIG, new ItemStack(manaResource, 1, 3)); + OreDictionary.registerOre(LibOreDict.TERRA_STEEL, new ItemStack(manaResource, 1, 4)); + + // Vanilla ores (because forge doesn't do this by default for some reason) + OreDictionary.registerOre("ingotIron", Items.iron_ingot); + OreDictionary.registerOre("ingotGold", Items.gold_ingot); + OreDictionary.registerOre("gemDiamond", Items.diamond); + } } diff --git a/MODSRC/vazkii/botania/common/item/block/ItemBlockSpecialFlower.java b/MODSRC/vazkii/botania/common/item/block/ItemBlockSpecialFlower.java index dba2e40f4..aaf0166dc 100644 --- a/MODSRC/vazkii/botania/common/item/block/ItemBlockSpecialFlower.java +++ b/MODSRC/vazkii/botania/common/item/block/ItemBlockSpecialFlower.java @@ -2,17 +2,15 @@ * This class was created by . 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 25, 2014, 2:04:15 PM (GMT)] */ package vazkii.botania.common.item.block; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -29,62 +27,62 @@ import vazkii.botania.common.block.tile.TileSpecialFlower; import vazkii.botania.common.core.helper.ItemNBTHelper; import vazkii.botania.common.lib.LibBlockNames; +import java.util.List; + public class ItemBlockSpecialFlower extends ItemBlock implements IRecipeKeyProvider { - public ItemBlockSpecialFlower(Block block1) { - super(block1); - } + public ItemBlockSpecialFlower(Block block1) { + super(block1); + } - @Override - public IIcon getIconIndex(ItemStack stack) { - return BotaniaAPI.internalHandler.getSubTileIconForName(getType(stack)); - } + @Override + public IIcon getIconIndex(ItemStack stack) { + return BotaniaAPI.internalHandler.getSubTileIconForName(getType(stack)); + } - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return getIconIndex(stack); - } + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return getIconIndex(stack); + } - @Override - public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) { - boolean placed = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata); - if(placed) { - String type = getType(stack); - TileSpecialFlower tile = (TileSpecialFlower) world.getTileEntity(x, y, z); - tile.setSubTile(type); - if(!world.isRemote) - world.markBlockForUpdate(x, y, z); - } + @Override + public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) { + boolean placed = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata); + if(placed) { + String type = getType(stack); + TileSpecialFlower tile = (TileSpecialFlower) world.getTileEntity(x, y, z); + tile.setSubTile(type); + if(!world.isRemote) world.markBlockForUpdate(x, y, z); + } - return placed; - } + return placed; + } - @Override - public String getUnlocalizedName(ItemStack stack) { - return "tile." + LibBlockNames.SPECIAL_FLOWER_PREFIX + getType(stack); - } + @Override + public String getUnlocalizedName(ItemStack stack) { + return "tile." + LibBlockNames.SPECIAL_FLOWER_PREFIX + getType(stack); + } - @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - String refUnlocalized = "tile." + LibBlockNames.SPECIAL_FLOWER_PREFIX + getType(par1ItemStack) + ".reference"; - String refLocalized = StatCollector.translateToLocal(refUnlocalized); - if(!refLocalized.equals(refUnlocalized)) - par3List.add(EnumChatFormatting.ITALIC + refLocalized); - } + @Override + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + String refUnlocalized = "tile." + LibBlockNames.SPECIAL_FLOWER_PREFIX + getType(par1ItemStack) + ".reference"; + String refLocalized = StatCollector.translateToLocal(refUnlocalized); + if(!refLocalized.equals(refUnlocalized)) par3List.add(EnumChatFormatting.ITALIC + refLocalized); + } - public static String getType(ItemStack stack) { - return ItemNBTHelper.getString(stack, SubTileEntity.TAG_TYPE, ""); - } + public static String getType(ItemStack stack) { + return ItemNBTHelper.getString(stack, SubTileEntity.TAG_TYPE, ""); + } - public static ItemStack ofType(String type) { - ItemStack stack = new ItemStack(ModBlocks.specialFlower); - ItemNBTHelper.setString(stack, SubTileEntity.TAG_TYPE, type); - return stack; - } + public static ItemStack ofType(String type) { + ItemStack stack = new ItemStack(ModBlocks.specialFlower); + ItemNBTHelper.setString(stack, SubTileEntity.TAG_TYPE, type); + return stack; + } - @Override - public String getKey(ItemStack stack) { - return getType(stack); - } + @Override + public String getKey(ItemStack stack) { + return getType(stack); + } } diff --git a/MODSRC/vazkii/botania/common/item/block/ItemBlockWithMetadataAndName.java b/MODSRC/vazkii/botania/common/item/block/ItemBlockWithMetadataAndName.java index 2bb12a2e1..4ab2456a1 100644 --- a/MODSRC/vazkii/botania/common/item/block/ItemBlockWithMetadataAndName.java +++ b/MODSRC/vazkii/botania/common/item/block/ItemBlockWithMetadataAndName.java @@ -2,11 +2,11 @@ * This class was created by . 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 16, 2014, 5:54:06 PM (GMT)] */ package vazkii.botania.common.item.block; @@ -17,13 +17,13 @@ import net.minecraft.item.ItemStack; public class ItemBlockWithMetadataAndName extends ItemBlockWithMetadata { - public ItemBlockWithMetadataAndName(Block par2Block) { - super(par2Block, par2Block); - } + public ItemBlockWithMetadataAndName(Block par2Block) { + super(par2Block, par2Block); + } - @Override - public String getUnlocalizedName(ItemStack par1ItemStack) { - return super.getUnlocalizedName(par1ItemStack) + par1ItemStack.getItemDamage(); - } + @Override + public String getUnlocalizedName(ItemStack par1ItemStack) { + return super.getUnlocalizedName(par1ItemStack) + par1ItemStack.getItemDamage(); + } } diff --git a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelArmor.java b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelArmor.java index 888c900ab..4165bb2f6 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelArmor.java +++ b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelArmor.java @@ -2,21 +2,15 @@ * This class was created by . 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 @ [Apr 13, 2014, 6:38:21 PM (GMT)] */ package vazkii.botania.common.item.equipment.armor; -import vazkii.botania.api.BotaniaAPI; -import vazkii.botania.api.mana.ManaItemHandler; -import vazkii.botania.client.core.helper.IconHelper; -import vazkii.botania.client.lib.LibResources; -import vazkii.botania.common.core.BotaniaCreativeTab; -import vazkii.botania.common.item.equipment.tool.ManasteelToolCommons; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -29,53 +23,56 @@ import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraftforge.common.ISpecialArmor; -import net.minecraftforge.common.ISpecialArmor.ArmorProperties; -import net.minecraftforge.common.util.EnumHelper; +import vazkii.botania.api.BotaniaAPI; +import vazkii.botania.client.core.helper.IconHelper; +import vazkii.botania.client.lib.LibResources; +import vazkii.botania.common.core.BotaniaCreativeTab; +import vazkii.botania.common.item.equipment.tool.ManasteelToolCommons; public class ItemManasteelArmor extends ItemArmor implements ISpecialArmor { - private static final int MANA_PER_DAMAGE = 70; - - public ItemManasteelArmor(int type, String name) { - this(type, name, BotaniaAPI.manasteelArmorMaterial); - } - - public ItemManasteelArmor(int type, String name, ArmorMaterial mat) { - super(mat, 0, type); - setCreativeTab(BotaniaCreativeTab.INSTANCE); - setUnlocalizedName(name); - } + private static final int MANA_PER_DAMAGE = 70; - @Override - public Item setUnlocalizedName(String par1Str) { - GameRegistry.registerItem(this, par1Str); - return super.setUnlocalizedName(par1Str); - } + public ItemManasteelArmor(int type, String name) { + this(type, name, BotaniaAPI.manasteelArmorMaterial); + } - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - itemIcon = IconHelper.forItem(par1IconRegister, this); - } + public ItemManasteelArmor(int type, String name, ArmorMaterial mat) { + super(mat, 0, type); + setCreativeTab(BotaniaCreativeTab.INSTANCE); + setUnlocalizedName(name); + } - @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { - return new ArmorProperties(0, damageReduceAmount / 25D, armor.getMaxDamage() + 1 - armor.getItemDamage()); - } + @Override + public Item setUnlocalizedName(String par1Str) { + GameRegistry.registerItem(this, par1Str); + return super.setUnlocalizedName(par1Str); + } - @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { - return damageReduceAmount; - } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + itemIcon = IconHelper.forItem(par1IconRegister, this); + } - @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { - ManasteelToolCommons.damageItem(stack, damage, entity, MANA_PER_DAMAGE); - } - - @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { - return slot == 2 ? LibResources.MODEL_MANASTEEL_1 : LibResources.MODEL_MANASTEEL_0; - } + @Override + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { + return new ArmorProperties(0, damageReduceAmount / 25D, armor.getMaxDamage() + 1 - armor.getItemDamage()); + } + + @Override + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + return damageReduceAmount; + } + + @Override + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + ManasteelToolCommons.damageItem(stack, damage, entity, MANA_PER_DAMAGE); + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + return slot == 2 ? LibResources.MODEL_MANASTEEL_1 : LibResources.MODEL_MANASTEEL_0; + } } diff --git a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelBoots.java b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelBoots.java index da9a6a8dc..d99e6133d 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelBoots.java +++ b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelBoots.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Apr 13, 2014, 10:24:08 PM (GMT)] */ package vazkii.botania.common.item.equipment.armor; @@ -15,8 +15,8 @@ import vazkii.botania.common.lib.LibItemNames; public class ItemManasteelBoots extends ItemManasteelArmor { - public ItemManasteelBoots() { - super(3, LibItemNames.MANASTEEL_BOOTS); - } + public ItemManasteelBoots() { + super(3, LibItemNames.MANASTEEL_BOOTS); + } } diff --git a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelChest.java b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelChest.java index 286813c22..374083ddd 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelChest.java +++ b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelChest.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Apr 13, 2014, 10:22:57 PM (GMT)] */ package vazkii.botania.common.item.equipment.armor; @@ -15,8 +15,8 @@ import vazkii.botania.common.lib.LibItemNames; public class ItemManasteelChest extends ItemManasteelArmor { - public ItemManasteelChest() { - super(1, LibItemNames.MANASTEEL_CHEST); - } + public ItemManasteelChest() { + super(1, LibItemNames.MANASTEEL_CHEST); + } } diff --git a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelHelm.java b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelHelm.java index 33a95c840..e07a2fa9d 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelHelm.java +++ b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelHelm.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Apr 13, 2014, 10:22:24 PM (GMT)] */ package vazkii.botania.common.item.equipment.armor; @@ -15,8 +15,8 @@ import vazkii.botania.common.lib.LibItemNames; public class ItemManasteelHelm extends ItemManasteelArmor { - public ItemManasteelHelm() { - super(0, LibItemNames.MANASTEEL_HELM); - } + public ItemManasteelHelm() { + super(0, LibItemNames.MANASTEEL_HELM); + } } diff --git a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelLegs.java b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelLegs.java index 0987b9b35..9977acd19 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelLegs.java +++ b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemManasteelLegs.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Apr 13, 2014, 10:23:28 PM (GMT)] */ package vazkii.botania.common.item.equipment.armor; @@ -15,8 +15,8 @@ import vazkii.botania.common.lib.LibItemNames; public class ItemManasteelLegs extends ItemManasteelArmor { - public ItemManasteelLegs() { - super(2, LibItemNames.MANASTEEL_LEGS); - } + public ItemManasteelLegs() { + super(2, LibItemNames.MANASTEEL_LEGS); + } } diff --git a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteeelArmor.java b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteeelArmor.java index e19e8550d..dba230778 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteeelArmor.java +++ b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteeelArmor.java @@ -2,17 +2,17 @@ * This class was created by . 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 @ [Apr 14, 2014, 2:58:13 PM (GMT)] */ package vazkii.botania.common.item.equipment.armor; -import java.util.UUID; - +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; import net.minecraft.entity.Entity; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; @@ -20,29 +20,28 @@ import net.minecraft.item.ItemStack; import vazkii.botania.api.BotaniaAPI; import vazkii.botania.client.lib.LibResources; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; +import java.util.UUID; public class ItemTerrasteeelArmor extends ItemManasteelArmor { - public ItemTerrasteeelArmor(int type, String name) { - super(type, name, BotaniaAPI.terrasteelArmorMaterial); - } - - int getHealthBoost() { - return 0; - } - - @Override - public Multimap getItemAttributeModifiers() { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(171328 /** Random number **/, armorType), "Armor modifier" + armorType, getHealthBoost(), 0)); - return map; - } - - @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { - return slot == 2 ? LibResources.MODEL_TERRASTEEL_1 : LibResources.MODEL_TERRASTEEL_0; - } + public ItemTerrasteeelArmor(int type, String name) { + super(type, name, BotaniaAPI.terrasteelArmorMaterial); + } + + int getHealthBoost() { + return 0; + } + + @Override + public Multimap getItemAttributeModifiers() { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(171328 /** Random number **/, armorType), "Armor modifier" + armorType, getHealthBoost(), 0)); + return map; + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + return slot == 2 ? LibResources.MODEL_TERRASTEEL_1 : LibResources.MODEL_TERRASTEEL_0; + } } diff --git a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelBoots.java b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelBoots.java index 4d7c7b9c2..5e9f8d136 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelBoots.java +++ b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelBoots.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Apr 14, 2014, 3:14:11 PM (GMT)] */ package vazkii.botania.common.item.equipment.armor; @@ -15,13 +15,13 @@ import vazkii.botania.common.lib.LibItemNames; public class ItemTerrasteelBoots extends ItemTerrasteeelArmor { - public ItemTerrasteelBoots() { - super(3, LibItemNames.TERRASTEEL_BOOTS); - } + public ItemTerrasteelBoots() { + super(3, LibItemNames.TERRASTEEL_BOOTS); + } - @Override - int getHealthBoost() { - return 4; - } + @Override + int getHealthBoost() { + return 4; + } } diff --git a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelChest.java b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelChest.java index d41da4ef9..5c74a79d3 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelChest.java +++ b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelChest.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Apr 14, 2014, 3:13:36 PM (GMT)] */ package vazkii.botania.common.item.equipment.armor; @@ -15,13 +15,13 @@ import vazkii.botania.common.lib.LibItemNames; public class ItemTerrasteelChest extends ItemTerrasteeelArmor { - public ItemTerrasteelChest() { - super(1, LibItemNames.TERRASTEEL_CHEST); - } + public ItemTerrasteelChest() { + super(1, LibItemNames.TERRASTEEL_CHEST); + } - @Override - int getHealthBoost() { - return 6; - } + @Override + int getHealthBoost() { + return 6; + } } diff --git a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelHelm.java b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelHelm.java index 42a3c5027..b998f9912 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelHelm.java +++ b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelHelm.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Apr 14, 2014, 3:13:05 PM (GMT)] */ package vazkii.botania.common.item.equipment.armor; @@ -15,13 +15,13 @@ import vazkii.botania.common.lib.LibItemNames; public class ItemTerrasteelHelm extends ItemTerrasteeelArmor { - public ItemTerrasteelHelm() { - super(0, LibItemNames.TERRASTEEL_HELM); - } - - @Override - int getHealthBoost() { - return 5; - } + public ItemTerrasteelHelm() { + super(0, LibItemNames.TERRASTEEL_HELM); + } + + @Override + int getHealthBoost() { + return 5; + } } diff --git a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelLegs.java b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelLegs.java index 241d299e5..eb9fadac4 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelLegs.java +++ b/MODSRC/vazkii/botania/common/item/equipment/armor/ItemTerrasteelLegs.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Apr 14, 2014, 3:13:49 PM (GMT)] */ package vazkii.botania.common.item.equipment.armor; @@ -15,13 +15,13 @@ import vazkii.botania.common.lib.LibItemNames; public class ItemTerrasteelLegs extends ItemTerrasteeelArmor { - public ItemTerrasteelLegs() { - super(2, LibItemNames.TERRASTEEL_LEGS); - } + public ItemTerrasteelLegs() { + super(2, LibItemNames.TERRASTEEL_LEGS); + } + + @Override + int getHealthBoost() { + return 5; + } - @Override - int getHealthBoost() { - return 5; - } - } diff --git a/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelAxe.java b/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelAxe.java index 3e9a19ff5..bad2b82b9 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelAxe.java +++ b/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelAxe.java @@ -2,15 +2,18 @@ * This class was created by . 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 @ [Apr 13, 2014, 7:15:39 PM (GMT)] */ package vazkii.botania.common.item.equipment.tool; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; @@ -22,44 +25,41 @@ import vazkii.botania.api.BotaniaAPI; import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.common.core.BotaniaCreativeTab; import vazkii.botania.common.lib.LibItemNames; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class ItemManasteelAxe extends ItemAxe { - private static final int MANA_PER_DAMAGE = 60; - - public ItemManasteelAxe() { - super(BotaniaAPI.manasteelToolMaterial); - setCreativeTab(BotaniaCreativeTab.INSTANCE); - setUnlocalizedName(LibItemNames.MANASTEEL_AXE); - } + private static final int MANA_PER_DAMAGE = 60; - @Override - public Item setUnlocalizedName(String par1Str) { - GameRegistry.registerItem(this, par1Str); - return super.setUnlocalizedName(par1Str); - } + public ItemManasteelAxe() { + super(BotaniaAPI.manasteelToolMaterial); + setCreativeTab(BotaniaCreativeTab.INSTANCE); + setUnlocalizedName(LibItemNames.MANASTEEL_AXE); + } - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - itemIcon = IconHelper.forItem(par1IconRegister, this); - } + @Override + public Item setUnlocalizedName(String par1Str) { + GameRegistry.registerItem(this, par1Str); + return super.setUnlocalizedName(par1Str); + } - @Override - public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { - ManasteelToolCommons.damageItem(par1ItemStack, 1, par3EntityLivingBase, MANA_PER_DAMAGE); - return true; - } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + itemIcon = IconHelper.forItem(par1IconRegister, this); + } - @Override - public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity) { - if (block.getBlockHardness(world, x, y, z) != 0F) - ManasteelToolCommons.damageItem(stack, 1, entity, MANA_PER_DAMAGE); + @Override + public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { + ManasteelToolCommons.damageItem(par1ItemStack, 1, par3EntityLivingBase, MANA_PER_DAMAGE); + return true; + } + + @Override + public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity) { + if(block.getBlockHardness(world, x, y, z) != 0F) + ManasteelToolCommons.damageItem(stack, 1, entity, MANA_PER_DAMAGE); + + return true; + } - return true; - } - } \ No newline at end of file diff --git a/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelPick.java b/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelPick.java index f275b6a35..646758620 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelPick.java +++ b/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelPick.java @@ -2,15 +2,18 @@ * This class was created by . 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 @ [Apr 13, 2014, 7:05:58 PM (GMT)] */ package vazkii.botania.common.item.equipment.tool; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; @@ -22,44 +25,41 @@ import vazkii.botania.api.BotaniaAPI; import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.common.core.BotaniaCreativeTab; import vazkii.botania.common.lib.LibItemNames; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class ItemManasteelPick extends ItemPickaxe { - private static final int MANA_PER_DAMAGE = 60; - - public ItemManasteelPick() { - super(BotaniaAPI.manasteelToolMaterial); - setCreativeTab(BotaniaCreativeTab.INSTANCE); - setUnlocalizedName(LibItemNames.MANASTEEL_PICK); - } + private static final int MANA_PER_DAMAGE = 60; - @Override - public Item setUnlocalizedName(String par1Str) { - GameRegistry.registerItem(this, par1Str); - return super.setUnlocalizedName(par1Str); - } + public ItemManasteelPick() { + super(BotaniaAPI.manasteelToolMaterial); + setCreativeTab(BotaniaCreativeTab.INSTANCE); + setUnlocalizedName(LibItemNames.MANASTEEL_PICK); + } - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - itemIcon = IconHelper.forItem(par1IconRegister, this); - } + @Override + public Item setUnlocalizedName(String par1Str) { + GameRegistry.registerItem(this, par1Str); + return super.setUnlocalizedName(par1Str); + } - @Override - public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { - ManasteelToolCommons.damageItem(par1ItemStack, 1, par3EntityLivingBase, MANA_PER_DAMAGE); - return true; - } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + itemIcon = IconHelper.forItem(par1IconRegister, this); + } - @Override - public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity) { - if (block.getBlockHardness(world, x, y, z) != 0F) - ManasteelToolCommons.damageItem(stack, 1, entity, MANA_PER_DAMAGE); + @Override + public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { + ManasteelToolCommons.damageItem(par1ItemStack, 1, par3EntityLivingBase, MANA_PER_DAMAGE); + return true; + } + + @Override + public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity) { + if(block.getBlockHardness(world, x, y, z) != 0F) + ManasteelToolCommons.damageItem(stack, 1, entity, MANA_PER_DAMAGE); + + return true; + } - return true; - } - } diff --git a/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelShears.java b/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelShears.java index 129ac51b1..2c53d19d1 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelShears.java +++ b/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelShears.java @@ -2,21 +2,15 @@ * This class was created by . 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 @ [Apr 13, 2014, 7:28:35 PM (GMT)] */ package vazkii.botania.common.item.equipment.tool; -import java.util.ArrayList; -import java.util.Random; - -import vazkii.botania.client.core.helper.IconHelper; -import vazkii.botania.common.core.BotaniaCreativeTab; -import vazkii.botania.common.lib.LibItemNames; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -32,83 +26,87 @@ import net.minecraft.item.ItemShears; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; import net.minecraftforge.common.IShearable; +import vazkii.botania.client.core.helper.IconHelper; +import vazkii.botania.common.core.BotaniaCreativeTab; +import vazkii.botania.common.lib.LibItemNames; + +import java.util.ArrayList; +import java.util.Random; public class ItemManasteelShears extends ItemShears { - private static final int MANA_PER_DAMAGE = 30; - - public ItemManasteelShears() { - setCreativeTab(BotaniaCreativeTab.INSTANCE); - setUnlocalizedName(LibItemNames.MANASTEEL_SHEARS); - } + private static final int MANA_PER_DAMAGE = 30; - @Override - public Item setUnlocalizedName(String par1Str) { - GameRegistry.registerItem(this, par1Str); - return super.setUnlocalizedName(par1Str); - } + public ItemManasteelShears() { + setCreativeTab(BotaniaCreativeTab.INSTANCE); + setUnlocalizedName(LibItemNames.MANASTEEL_SHEARS); + } - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - itemIcon = IconHelper.forItem(par1IconRegister, this); - } - - @Override - public boolean itemInteractionForEntity(ItemStack itemstack, EntityPlayer player, EntityLivingBase entity) { - if(entity.worldObj.isRemote) - return false; - - if(entity instanceof IShearable) { - IShearable target = (IShearable)entity; - if(target.isShearable(itemstack, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ)) { - ArrayList drops = target.onSheared(itemstack, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack)); + @Override + public Item setUnlocalizedName(String par1Str) { + GameRegistry.registerItem(this, par1Str); + return super.setUnlocalizedName(par1Str); + } - Random rand = new Random(); - for(ItemStack stack : drops) { - EntityItem ent = entity.entityDropItem(stack, 1.0F); - ent.motionY += rand.nextFloat() * 0.05F; - ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; - ent.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; - } - - ManasteelToolCommons.damageItem(itemstack, 1, player, MANA_PER_DAMAGE); - } - - return true; - } - - return false; - } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + itemIcon = IconHelper.forItem(par1IconRegister, this); + } - @Override - public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) { - if (player.worldObj.isRemote) - return false; + @Override + public boolean itemInteractionForEntity(ItemStack itemstack, EntityPlayer player, EntityLivingBase entity) { + if(entity.worldObj.isRemote) return false; - Block block = player.worldObj.getBlock(x, y, z); - if(block instanceof IShearable) { - IShearable target = (IShearable)block; - if(target.isShearable(itemstack, player.worldObj, x, y, z)) { - ArrayList drops = target.onSheared(itemstack, player.worldObj, x, y, z, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack)); - Random rand = new Random(); + if(entity instanceof IShearable) { + IShearable target = (IShearable) entity; + if(target.isShearable(itemstack, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ)) { + ArrayList drops = target.onSheared(itemstack, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack)); - for(ItemStack stack : drops) { - float f = 0.7F; - double d = rand.nextFloat() * f + (1D - f) * 0.5; - double d1 = rand.nextFloat() * f + (1D - f) * 0.5; - double d2 = rand.nextFloat() * f + (1D - f) * 0.5; - - EntityItem entityitem = new EntityItem(player.worldObj, x + d, y + d1, z + d2, stack); - entityitem.delayBeforeCanPickup = 10; - player.worldObj.spawnEntityInWorld(entityitem); - } + Random rand = new Random(); + for(ItemStack stack : drops) { + EntityItem ent = entity.entityDropItem(stack, 1.0F); + ent.motionY += rand.nextFloat() * 0.05F; + ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; + ent.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; + } - ManasteelToolCommons.damageItem(itemstack, 1, player, MANA_PER_DAMAGE); - player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); - } - } - return false; - } + ManasteelToolCommons.damageItem(itemstack, 1, player, MANA_PER_DAMAGE); + } + + return true; + } + + return false; + } + + @Override + public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) { + if(player.worldObj.isRemote) return false; + + Block block = player.worldObj.getBlock(x, y, z); + if(block instanceof IShearable) { + IShearable target = (IShearable) block; + if(target.isShearable(itemstack, player.worldObj, x, y, z)) { + ArrayList drops = target.onSheared(itemstack, player.worldObj, x, y, z, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack)); + Random rand = new Random(); + + for(ItemStack stack : drops) { + float f = 0.7F; + double d = rand.nextFloat() * f + (1D - f) * 0.5; + double d1 = rand.nextFloat() * f + (1D - f) * 0.5; + double d2 = rand.nextFloat() * f + (1D - f) * 0.5; + + EntityItem entityitem = new EntityItem(player.worldObj, x + d, y + d1, z + d2, stack); + entityitem.delayBeforeCanPickup = 10; + player.worldObj.spawnEntityInWorld(entityitem); + } + + ManasteelToolCommons.damageItem(itemstack, 1, player, MANA_PER_DAMAGE); + player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); + } + } + return false; + } } diff --git a/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelShovel.java b/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelShovel.java index e34a3cf03..0a619db9e 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelShovel.java +++ b/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelShovel.java @@ -2,15 +2,18 @@ * This class was created by . 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 @ [Apr 13, 2014, 7:14:54 PM (GMT)] */ package vazkii.botania.common.item.equipment.tool; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; @@ -22,44 +25,41 @@ import vazkii.botania.api.BotaniaAPI; import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.common.core.BotaniaCreativeTab; import vazkii.botania.common.lib.LibItemNames; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class ItemManasteelShovel extends ItemSpade { - private static final int MANA_PER_DAMAGE = 60; - - public ItemManasteelShovel() { - super(BotaniaAPI.manasteelToolMaterial); - setCreativeTab(BotaniaCreativeTab.INSTANCE); - setUnlocalizedName(LibItemNames.MANASTEEL_SHOVEL); - } + private static final int MANA_PER_DAMAGE = 60; - @Override - public Item setUnlocalizedName(String par1Str) { - GameRegistry.registerItem(this, par1Str); - return super.setUnlocalizedName(par1Str); - } + public ItemManasteelShovel() { + super(BotaniaAPI.manasteelToolMaterial); + setCreativeTab(BotaniaCreativeTab.INSTANCE); + setUnlocalizedName(LibItemNames.MANASTEEL_SHOVEL); + } - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - itemIcon = IconHelper.forItem(par1IconRegister, this); - } + @Override + public Item setUnlocalizedName(String par1Str) { + GameRegistry.registerItem(this, par1Str); + return super.setUnlocalizedName(par1Str); + } - @Override - public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { - ManasteelToolCommons.damageItem(par1ItemStack, 1, par3EntityLivingBase, MANA_PER_DAMAGE); - return true; - } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + itemIcon = IconHelper.forItem(par1IconRegister, this); + } - @Override - public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity) { - if (block.getBlockHardness(world, x, y, z) != 0F) - ManasteelToolCommons.damageItem(stack, 1, entity, MANA_PER_DAMAGE); + @Override + public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { + ManasteelToolCommons.damageItem(par1ItemStack, 1, par3EntityLivingBase, MANA_PER_DAMAGE); + return true; + } + + @Override + public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity) { + if(block.getBlockHardness(world, x, y, z) != 0F) + ManasteelToolCommons.damageItem(stack, 1, entity, MANA_PER_DAMAGE); + + return true; + } - return true; - } - } diff --git a/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelSword.java b/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelSword.java index 82da84c54..33dafd555 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelSword.java +++ b/MODSRC/vazkii/botania/common/item/equipment/tool/ItemManasteelSword.java @@ -2,15 +2,18 @@ * This class was created by . 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 @ [Apr 13, 2014, 7:21:32 PM (GMT)] */ package vazkii.botania.common.item.equipment.tool; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; @@ -23,61 +26,58 @@ import vazkii.botania.api.BotaniaAPI; import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.common.core.BotaniaCreativeTab; import vazkii.botania.common.lib.LibItemNames; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class ItemManasteelSword extends ItemSword { - static final int MANA_PER_DAMAGE = 51; + static final int MANA_PER_DAMAGE = 51; - IIcon elucidatorIcon; + IIcon elucidatorIcon; - public ItemManasteelSword() { - this(BotaniaAPI.manasteelToolMaterial, LibItemNames.MANASTEEL_SWORD); - } - - public ItemManasteelSword(ToolMaterial mat, String name) { - super(mat); - setCreativeTab(BotaniaCreativeTab.INSTANCE); - setUnlocalizedName(name); - } + public ItemManasteelSword() { + this(BotaniaAPI.manasteelToolMaterial, LibItemNames.MANASTEEL_SWORD); + } - @Override - public Item setUnlocalizedName(String par1Str) { - GameRegistry.registerItem(this, par1Str); - return super.setUnlocalizedName(par1Str); - } + public ItemManasteelSword(ToolMaterial mat, String name) { + super(mat); + setCreativeTab(BotaniaCreativeTab.INSTANCE); + setUnlocalizedName(name); + } - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - itemIcon = IconHelper.forItem(par1IconRegister, this); - elucidatorIcon = IconHelper.forName(par1IconRegister, "elucidator"); - } + @Override + public Item setUnlocalizedName(String par1Str) { + GameRegistry.registerItem(this, par1Str); + return super.setUnlocalizedName(par1Str); + } - @Override - public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { - ManasteelToolCommons.damageItem(par1ItemStack, 1, par3EntityLivingBase, MANA_PER_DAMAGE); - return true; - } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + itemIcon = IconHelper.forItem(par1IconRegister, this); + elucidatorIcon = IconHelper.forName(par1IconRegister, "elucidator"); + } - @Override - public IIcon getIconIndex(ItemStack par1ItemStack) { - return par1ItemStack.getDisplayName().equals("The Elucidator") ? elucidatorIcon : super.getIconIndex(par1ItemStack); - } - - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return getIconIndex(stack); - } + @Override + public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { + ManasteelToolCommons.damageItem(par1ItemStack, 1, par3EntityLivingBase, MANA_PER_DAMAGE); + return true; + } - @Override - public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity) { - if (block.getBlockHardness(world, x, y, z) != 0F) - ManasteelToolCommons.damageItem(stack, 1, entity, MANA_PER_DAMAGE); + @Override + public IIcon getIconIndex(ItemStack par1ItemStack) { + return par1ItemStack.getDisplayName().equals("The Elucidator") ? elucidatorIcon : super.getIconIndex(par1ItemStack); + } - return true; - } + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return getIconIndex(stack); + } + + @Override + public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity) { + if(block.getBlockHardness(world, x, y, z) != 0F) + ManasteelToolCommons.damageItem(stack, 1, entity, MANA_PER_DAMAGE); + + return true; + } } diff --git a/MODSRC/vazkii/botania/common/item/equipment/tool/ItemTerraSword.java b/MODSRC/vazkii/botania/common/item/equipment/tool/ItemTerraSword.java index 9e3697c22..2228329f1 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/tool/ItemTerraSword.java +++ b/MODSRC/vazkii/botania/common/item/equipment/tool/ItemTerraSword.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Apr 14, 2014, 7:34:56 PM (GMT)] */ package vazkii.botania.common.item.equipment.tool; @@ -21,80 +21,78 @@ import net.minecraft.world.World; import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.internal.IManaBurst; import vazkii.botania.api.mana.BurstProperties; -import vazkii.botania.api.mana.ILens; import vazkii.botania.api.mana.ILensEffect; -import vazkii.botania.api.mana.ManaItemHandler; import vazkii.botania.common.entity.EntityManaBurst; import vazkii.botania.common.lib.LibItemNames; public class ItemTerraSword extends ItemManasteelSword implements ILensEffect { - public ItemTerraSword() { - super(BotaniaAPI.terrasteelToolMaterial, LibItemNames.TERRA_SWORD); - } + public ItemTerraSword() { + super(BotaniaAPI.terrasteelToolMaterial, LibItemNames.TERRA_SWORD); + } - @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { - if(par3Entity instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) par3Entity; - if(player.getCurrentEquippedItem() == par1ItemStack && player.swingProgress == 0.16666667F && !par2World.isRemote && par2World.rand.nextInt(2) == 0) { - EntityManaBurst burst = getBurst(player, par1ItemStack); - par2World.spawnEntityInWorld(burst); - ManasteelToolCommons.damageItem(par1ItemStack, 1, player, MANA_PER_DAMAGE); - par2World.playSoundAtEntity(player, "random.levelup", 1F, 1.4F); - } - } - } + @Override + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + if(par3Entity instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) par3Entity; + if(player.getCurrentEquippedItem() == par1ItemStack && player.swingProgress == 0.16666667F && !par2World.isRemote && par2World.rand.nextInt(2) == 0) { + EntityManaBurst burst = getBurst(player, par1ItemStack); + par2World.spawnEntityInWorld(burst); + ManasteelToolCommons.damageItem(par1ItemStack, 1, player, MANA_PER_DAMAGE); + par2World.playSoundAtEntity(player, "random.levelup", 1F, 1.4F); + } + } + } - public EntityManaBurst getBurst(EntityPlayer player, ItemStack stack) { - EntityManaBurst burst = new EntityManaBurst(player); + public EntityManaBurst getBurst(EntityPlayer player, ItemStack stack) { + EntityManaBurst burst = new EntityManaBurst(player); - float motionModifier = 5F; - - burst.setColor(0x20FF20); - burst.setMana(MANA_PER_DAMAGE); - burst.setStartingMana(MANA_PER_DAMAGE); - burst.setMinManaLoss(40); - burst.setManaLossPerTick(4F); - burst.setGravity(0F); - burst.setMotion(burst.motionX * motionModifier, burst.motionY * motionModifier, burst.motionZ * motionModifier); + float motionModifier = 5F; - burst.setSourceLens(stack); - return burst; - } + burst.setColor(0x20FF20); + burst.setMana(MANA_PER_DAMAGE); + burst.setStartingMana(MANA_PER_DAMAGE); + burst.setMinManaLoss(40); + burst.setManaLossPerTick(4F); + burst.setGravity(0F); + burst.setMotion(burst.motionX * motionModifier, burst.motionY * motionModifier, burst.motionZ * motionModifier); - @Override - public void apply(ItemStack stack, BurstProperties props) { - // NO-OP - } + burst.setSourceLens(stack); + return burst; + } - @Override - public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) { - Entity entity = (Entity) burst; - if(pos.entityHit != null && pos.entityHit instanceof EntityLivingBase && !(pos.entityHit instanceof EntityPlayer)) { - EntityLivingBase living = (EntityLivingBase) pos.entityHit; - if(living.hurtTime == 0) { - int cost = MANA_PER_DAMAGE / 3; - int mana = burst.getMana(); - if(mana >= cost) { - burst.setMana(mana - cost); - float damage = 4F + BotaniaAPI.terrasteelToolMaterial.getDamageVsEntity(); - if(!burst.isFake() && !entity.worldObj.isRemote) - living.attackEntityFrom(DamageSource.magic, damage); - } - } - } - return dead; - } + @Override + public void apply(ItemStack stack, BurstProperties props) { + // NO-OP + } - @Override - public void updateBurst(IManaBurst burst, ItemStack stack) { - // NO-OP - } + @Override + public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) { + Entity entity = (Entity) burst; + if(pos.entityHit != null && pos.entityHit instanceof EntityLivingBase && !(pos.entityHit instanceof EntityPlayer)) { + EntityLivingBase living = (EntityLivingBase) pos.entityHit; + if(living.hurtTime == 0) { + int cost = MANA_PER_DAMAGE / 3; + int mana = burst.getMana(); + if(mana >= cost) { + burst.setMana(mana - cost); + float damage = 4F + BotaniaAPI.terrasteelToolMaterial.getDamageVsEntity(); + if(!burst.isFake() && !entity.worldObj.isRemote) + living.attackEntityFrom(DamageSource.magic, damage); + } + } + } + return dead; + } - @Override - public boolean doParticles(IManaBurst burst, ItemStack stack) { - return true; - } + @Override + public void updateBurst(IManaBurst burst, ItemStack stack) { + // NO-OP + } + + @Override + public boolean doParticles(IManaBurst burst, ItemStack stack) { + return true; + } } diff --git a/MODSRC/vazkii/botania/common/item/equipment/tool/ManasteelToolCommons.java b/MODSRC/vazkii/botania/common/item/equipment/tool/ManasteelToolCommons.java index 5fb18ec5f..1357ce668 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/tool/ManasteelToolCommons.java +++ b/MODSRC/vazkii/botania/common/item/equipment/tool/ManasteelToolCommons.java @@ -2,11 +2,11 @@ * This class was created by . 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 @ [Apr 13, 2014, 7:13:04 PM (GMT)] */ package vazkii.botania.common.item.equipment.tool; @@ -17,14 +17,13 @@ import net.minecraft.item.ItemStack; import vazkii.botania.api.mana.ManaItemHandler; public final class ManasteelToolCommons { - - public static void damageItem(ItemStack stack, int dmg, EntityLivingBase entity, int manaPerDamage) { - int manaToRequest = dmg * manaPerDamage; - int manaRequested = entity instanceof EntityPlayer ? ManaItemHandler.requestMana(stack, (EntityPlayer) entity, manaToRequest, true) : 0; - - int finalDamage = dmg - manaRequested / manaPerDamage; - if(finalDamage > 0) - stack.damageItem(finalDamage, entity); - } - + + public static void damageItem(ItemStack stack, int dmg, EntityLivingBase entity, int manaPerDamage) { + int manaToRequest = dmg * manaPerDamage; + int manaRequested = entity instanceof EntityPlayer ? ManaItemHandler.requestMana(stack, (EntityPlayer) entity, manaToRequest, true) : 0; + + int finalDamage = dmg - manaRequested / manaPerDamage; + if(finalDamage > 0) stack.damageItem(finalDamage, entity); + } + } diff --git a/MODSRC/vazkii/botania/common/lexicon/BLexiconEntry.java b/MODSRC/vazkii/botania/common/lexicon/BLexiconEntry.java index 276a17db4..8c6cadc9f 100644 --- a/MODSRC/vazkii/botania/common/lexicon/BLexiconEntry.java +++ b/MODSRC/vazkii/botania/common/lexicon/BLexiconEntry.java @@ -2,11 +2,11 @@ * This class was created by . 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 14, 2014, 9:47:21 PM (GMT)] */ package vazkii.botania.common.lexicon; @@ -18,26 +18,26 @@ import vazkii.botania.api.lexicon.LexiconPage; public class BLexiconEntry extends LexiconEntry { - public BLexiconEntry(String unlocalizedName, LexiconCategory category) { - super(unlocalizedName, category); - BotaniaAPI.addEntry(this, category); - } + public BLexiconEntry(String unlocalizedName, LexiconCategory category) { + super(unlocalizedName, category); + BotaniaAPI.addEntry(this, category); + } - @Override - public LexiconEntry setLexiconPages(LexiconPage... pages) { - for(LexiconPage page : pages) - page.unlocalizedName = "botania.page." + getLazyUnlocalizedName() + page.unlocalizedName; + @Override + public LexiconEntry setLexiconPages(LexiconPage... pages) { + for(LexiconPage page : pages) + page.unlocalizedName = "botania.page." + getLazyUnlocalizedName() + page.unlocalizedName; - return super.setLexiconPages(pages); - } + return super.setLexiconPages(pages); + } - @Override - public String getUnlocalizedName() { - return "botania.entry." + super.getUnlocalizedName(); - } + @Override + public String getUnlocalizedName() { + return "botania.entry." + super.getUnlocalizedName(); + } - public String getLazyUnlocalizedName() { - return super.getUnlocalizedName(); - } + public String getLazyUnlocalizedName() { + return super.getUnlocalizedName(); + } } diff --git a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java index 75931fd6a..a3a9aecb3 100644 --- a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java +++ b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java @@ -2,11 +2,11 @@ * This class was created by . 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 14, 2014, 9:12:15 PM (GMT)] */ package vazkii.botania.common.lexicon; @@ -22,297 +22,282 @@ import vazkii.botania.common.crafting.ModCrafingRecipes; import vazkii.botania.common.crafting.ModManaInfusionRecipes; import vazkii.botania.common.crafting.ModPetalRecipes; import vazkii.botania.common.crafting.ModRuneRecipes; -import vazkii.botania.common.lexicon.page.PageCraftingRecipe; -import vazkii.botania.common.lexicon.page.PageImage; -import vazkii.botania.common.lexicon.page.PageManaInfusionRecipe; -import vazkii.botania.common.lexicon.page.PagePetalRecipe; -import vazkii.botania.common.lexicon.page.PageRuneRecipe; -import vazkii.botania.common.lexicon.page.PageTerrasteel; -import vazkii.botania.common.lexicon.page.PageText; +import vazkii.botania.common.lexicon.page.*; import vazkii.botania.common.lib.LibLexicon; public final class LexiconData { - public static LexiconCategory categoryBasics; - public static LexiconCategory categoryMana; - public static LexiconCategory categoryFunctionalFlowers; - public static LexiconCategory categoryGenerationFlowers; - public static LexiconCategory categoryDevices; - public static LexiconCategory categoryTools; - public static LexiconCategory categoryMisc; + public static LexiconCategory categoryBasics; + public static LexiconCategory categoryMana; + public static LexiconCategory categoryFunctionalFlowers; + public static LexiconCategory categoryGenerationFlowers; + public static LexiconCategory categoryDevices; + public static LexiconCategory categoryTools; + public static LexiconCategory categoryMisc; - public static LexiconEntry flowers; - public static LexiconEntry apothecary; - public static LexiconEntry lexicon; - public static LexiconEntry wand; - public static LexiconEntry pureDaisy; - public static LexiconEntry runicAltar; - public static LexiconEntry terrasteel; + public static LexiconEntry flowers; + public static LexiconEntry apothecary; + public static LexiconEntry lexicon; + public static LexiconEntry wand; + public static LexiconEntry pureDaisy; + public static LexiconEntry runicAltar; + public static LexiconEntry terrasteel; - public static LexiconEntry manaIntro; - public static LexiconEntry spreader; - public static LexiconEntry pool; - public static LexiconEntry distributor; - public static LexiconEntry manaVoid; - public static LexiconEntry lensVelocity; - public static LexiconEntry lensPotency; - public static LexiconEntry lensResistance; - public static LexiconEntry lensEfficiency; - public static LexiconEntry lensBounce; - public static LexiconEntry lensGravity; - public static LexiconEntry lensBore; - public static LexiconEntry lensDamaging; - public static LexiconEntry lensPhantom; - public static LexiconEntry lensMagnet; - public static LexiconEntry lensExplosive; - public static LexiconEntry manaTransport; - public static LexiconEntry manaDetector; - public static LexiconEntry compositeLens; - public static LexiconEntry redstoneSpreader; + public static LexiconEntry manaIntro; + public static LexiconEntry spreader; + public static LexiconEntry pool; + public static LexiconEntry distributor; + public static LexiconEntry manaVoid; + public static LexiconEntry lensVelocity; + public static LexiconEntry lensPotency; + public static LexiconEntry lensResistance; + public static LexiconEntry lensEfficiency; + public static LexiconEntry lensBounce; + public static LexiconEntry lensGravity; + public static LexiconEntry lensBore; + public static LexiconEntry lensDamaging; + public static LexiconEntry lensPhantom; + public static LexiconEntry lensMagnet; + public static LexiconEntry lensExplosive; + public static LexiconEntry manaTransport; + public static LexiconEntry manaDetector; + public static LexiconEntry compositeLens; + public static LexiconEntry redstoneSpreader; - public static LexiconEntry functionalIntro; - public static LexiconEntry jadedAmaranthus; - public static LexiconEntry bellethorne; - public static LexiconEntry heiseiDream; - public static LexiconEntry tigerseye; - public static LexiconEntry orechid; - public static LexiconEntry fallenKanade; - public static LexiconEntry exoflame; - public static LexiconEntry agricarnation; - public static LexiconEntry hopperhock; - public static LexiconEntry tangleberrie; - public static LexiconEntry jiyuulia; + public static LexiconEntry functionalIntro; + public static LexiconEntry jadedAmaranthus; + public static LexiconEntry bellethorne; + public static LexiconEntry heiseiDream; + public static LexiconEntry tigerseye; + public static LexiconEntry orechid; + public static LexiconEntry fallenKanade; + public static LexiconEntry exoflame; + public static LexiconEntry agricarnation; + public static LexiconEntry hopperhock; + public static LexiconEntry tangleberrie; + public static LexiconEntry jiyuulia; - public static LexiconEntry generatingIntro; - public static LexiconEntry daybloom; - public static LexiconEntry nightshade; - public static LexiconEntry endoflame; - public static LexiconEntry hydroangeas; - public static LexiconEntry thermalily; - public static LexiconEntry arcaneRose; + public static LexiconEntry generatingIntro; + public static LexiconEntry daybloom; + public static LexiconEntry nightshade; + public static LexiconEntry endoflame; + public static LexiconEntry hydroangeas; + public static LexiconEntry thermalily; + public static LexiconEntry arcaneRose; - public static LexiconEntry pistonRelay; - public static LexiconEntry pylon; - public static LexiconEntry manaEnchanting; - public static LexiconEntry turntable; + public static LexiconEntry pistonRelay; + public static LexiconEntry pylon; + public static LexiconEntry manaEnchanting; + public static LexiconEntry turntable; - public static LexiconEntry manaBlaster; - public static LexiconEntry grassSeeds; - public static LexiconEntry dirtRod; - public static LexiconEntry terraformRod; - public static LexiconEntry manasteelGear; - public static LexiconEntry terrasteelArmor; - public static LexiconEntry grassHorn; - public static LexiconEntry terraBlade; + public static LexiconEntry manaBlaster; + public static LexiconEntry grassSeeds; + public static LexiconEntry dirtRod; + public static LexiconEntry terraformRod; + public static LexiconEntry manasteelGear; + public static LexiconEntry terrasteelArmor; + public static LexiconEntry grassHorn; + public static LexiconEntry terraBlade; - public static LexiconEntry unstableBlocks; - public static LexiconEntry decorativeBlocks; + public static LexiconEntry unstableBlocks; + public static LexiconEntry decorativeBlocks; - public static void init() { - BotaniaAPI.addCategory(categoryBasics = new LexiconCategory(LibLexicon.CATEGORY_BASICS)); - BotaniaAPI.addCategory(categoryMana = new LexiconCategory(LibLexicon.CATEGORY_MANA)); - BotaniaAPI.addCategory(categoryFunctionalFlowers = new LexiconCategory(LibLexicon.CATEGORY_FUNCTIONAL_FLOWERS)); - BotaniaAPI.addCategory(categoryGenerationFlowers = new LexiconCategory(LibLexicon.CATEGORY_GENERATION_FLOWERS)); - BotaniaAPI.addCategory(categoryDevices = new LexiconCategory(LibLexicon.CATEGORY_DEVICES)); - BotaniaAPI.addCategory(categoryTools = new LexiconCategory(LibLexicon.CATEGORY_TOOLS)); - BotaniaAPI.addCategory(categoryMisc = new LexiconCategory(LibLexicon.CATEGORY_MISC)); + public static void init() { + BotaniaAPI.addCategory(categoryBasics = new LexiconCategory(LibLexicon.CATEGORY_BASICS)); + BotaniaAPI.addCategory(categoryMana = new LexiconCategory(LibLexicon.CATEGORY_MANA)); + BotaniaAPI.addCategory(categoryFunctionalFlowers = new LexiconCategory(LibLexicon.CATEGORY_FUNCTIONAL_FLOWERS)); + BotaniaAPI.addCategory(categoryGenerationFlowers = new LexiconCategory(LibLexicon.CATEGORY_GENERATION_FLOWERS)); + BotaniaAPI.addCategory(categoryDevices = new LexiconCategory(LibLexicon.CATEGORY_DEVICES)); + BotaniaAPI.addCategory(categoryTools = new LexiconCategory(LibLexicon.CATEGORY_TOOLS)); + BotaniaAPI.addCategory(categoryMisc = new LexiconCategory(LibLexicon.CATEGORY_MISC)); - // BASICS ENTRIES - flowers = new BLexiconEntry(LibLexicon.BASICS_FLOWERS, categoryBasics); - flowers.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_FLOWERS), new PageText("2"), new PageCraftingRecipe("3", ModCrafingRecipes.recipesPetals), new PageCraftingRecipe("4", ModCrafingRecipes.recipePestleAndMortar), new PageCraftingRecipe("5", ModCrafingRecipes.recipesDyes), - new PageText("6"), new PageCraftingRecipe("7", ModCrafingRecipes.recipeFertilizerPowder), new PageCraftingRecipe("8", ModCrafingRecipes.recipeFerilizerDye)); + // BASICS ENTRIES + flowers = new BLexiconEntry(LibLexicon.BASICS_FLOWERS, categoryBasics); + flowers.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_FLOWERS), new PageText("2"), new PageCraftingRecipe("3", ModCrafingRecipes.recipesPetals), new PageCraftingRecipe("4", ModCrafingRecipes.recipePestleAndMortar), new PageCraftingRecipe("5", ModCrafingRecipes.recipesDyes), new PageText("6"), new PageCraftingRecipe("7", ModCrafingRecipes.recipeFertilizerPowder), new PageCraftingRecipe("8", ModCrafingRecipes.recipeFerilizerDye)); - apothecary = new BLexiconEntry(LibLexicon.BASICS_APOTHECARY, categoryBasics); - apothecary.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_APOTHECARY), new PageText("2"), new PageText("3"), new PageCraftingRecipe("4", ModCrafingRecipes.recipesApothecary)); + apothecary = new BLexiconEntry(LibLexicon.BASICS_APOTHECARY, categoryBasics); + apothecary.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_APOTHECARY), new PageText("2"), new PageText("3"), new PageCraftingRecipe("4", ModCrafingRecipes.recipesApothecary)); - lexicon = new BLexiconEntry(LibLexicon.BASICS_LEXICON, categoryBasics); - lexicon.setPriority().setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLexicon)); + lexicon = new BLexiconEntry(LibLexicon.BASICS_LEXICON, categoryBasics); + lexicon.setPriority().setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLexicon)); - wand = new BLexiconEntry(LibLexicon.BASICS_WAND, categoryBasics); - wand.setPriority().setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipesTwigWand)); + wand = new BLexiconEntry(LibLexicon.BASICS_WAND, categoryBasics); + wand.setPriority().setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipesTwigWand)); - pureDaisy = new BLexiconEntry(LibLexicon.BASICS_PURE_DAISY, categoryBasics); - pureDaisy.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_PURE_DAISY), new PageCraftingRecipe("2", ModCrafingRecipes.recipeLivingwoodTwig), new PagePetalRecipe("3", ModPetalRecipes.pureDaisyRecipe)); - LexiconRecipeMappings.map(new ItemStack(ModBlocks.livingwood), pureDaisy, 1); - LexiconRecipeMappings.map(new ItemStack(ModBlocks.livingrock), pureDaisy, 1); + pureDaisy = new BLexiconEntry(LibLexicon.BASICS_PURE_DAISY, categoryBasics); + pureDaisy.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_PURE_DAISY), new PageCraftingRecipe("2", ModCrafingRecipes.recipeLivingwoodTwig), new PagePetalRecipe("3", ModPetalRecipes.pureDaisyRecipe)); + LexiconRecipeMappings.map(new ItemStack(ModBlocks.livingwood), pureDaisy, 1); + LexiconRecipeMappings.map(new ItemStack(ModBlocks.livingrock), pureDaisy, 1); - runicAltar = new BLexiconEntry(LibLexicon.BASICS_RUNE_ALTAR, categoryBasics); - runicAltar.setPriority().setLexiconPages(new PageText("0"), new PageText("1"), new PageCraftingRecipe("2", ModCrafingRecipes.recipesRuneAltar), new PageText("3"), new PageRuneRecipe("4", ModRuneRecipes.recipeWaterRune), new PageRuneRecipe("5", ModRuneRecipes.recipesEarthRune), new PageRuneRecipe("6", ModRuneRecipes.recipeAirRune), new PageRuneRecipe("7", ModRuneRecipes.recipeFireRune), - new PageRuneRecipe("8", ModRuneRecipes.recipeSpringRune), new PageRuneRecipe("9", ModRuneRecipes.recipeSummerRune), new PageRuneRecipe("10", ModRuneRecipes.recipeAutumnRune), new PageRuneRecipe("11", ModRuneRecipes.recipeWinterRune), new PageRuneRecipe("12", ModRuneRecipes.recipeManaRune), - new PageRuneRecipe("13", ModRuneRecipes.recipeLustRune), new PageRuneRecipe("14", ModRuneRecipes.recipeGluttonyRune), new PageRuneRecipe("15", ModRuneRecipes.recipeGreedRune), new PageRuneRecipe("16", ModRuneRecipes.recipeSlothRune), new PageRuneRecipe("17", ModRuneRecipes.recipeWrathRune), new PageRuneRecipe("18", ModRuneRecipes.recipeEnvyRune), new PageRuneRecipe("19", ModRuneRecipes.recipePrideRune)); + runicAltar = new BLexiconEntry(LibLexicon.BASICS_RUNE_ALTAR, categoryBasics); + runicAltar.setPriority().setLexiconPages(new PageText("0"), new PageText("1"), new PageCraftingRecipe("2", ModCrafingRecipes.recipesRuneAltar), new PageText("3"), new PageRuneRecipe("4", ModRuneRecipes.recipeWaterRune), new PageRuneRecipe("5", ModRuneRecipes.recipesEarthRune), new PageRuneRecipe("6", ModRuneRecipes.recipeAirRune), new PageRuneRecipe("7", ModRuneRecipes.recipeFireRune), new PageRuneRecipe("8", ModRuneRecipes.recipeSpringRune), new PageRuneRecipe("9", ModRuneRecipes.recipeSummerRune), new PageRuneRecipe("10", ModRuneRecipes.recipeAutumnRune), new PageRuneRecipe("11", ModRuneRecipes.recipeWinterRune), new PageRuneRecipe("12", ModRuneRecipes.recipeManaRune), new PageRuneRecipe("13", ModRuneRecipes.recipeLustRune), new PageRuneRecipe("14", ModRuneRecipes.recipeGluttonyRune), new PageRuneRecipe("15", ModRuneRecipes.recipeGreedRune), new PageRuneRecipe("16", ModRuneRecipes.recipeSlothRune), new PageRuneRecipe("17", ModRuneRecipes.recipeWrathRune), new PageRuneRecipe("18", ModRuneRecipes.recipeEnvyRune), new PageRuneRecipe("19", ModRuneRecipes.recipePrideRune)); - terrasteel = new BLexiconEntry(LibLexicon.BASICS_TERRASTEEL, categoryBasics); - terrasteel.setLexiconPages(new PageText("0"), new PageTerrasteel("1")); - - // MANA ENTRIES - manaIntro = new BLexiconEntry(LibLexicon.MANA_INTRO, categoryMana); - manaIntro.setPriority().setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2")); + terrasteel = new BLexiconEntry(LibLexicon.BASICS_TERRASTEEL, categoryBasics); + terrasteel.setLexiconPages(new PageText("0"), new PageTerrasteel("1")); - spreader = new BLexiconEntry(LibLexicon.MANA_SPREADER, categoryMana); - spreader.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_SPREADER), new PageText("2"), new PageText("3"), new PageText("4"), new PageCraftingRecipe("5", ModCrafingRecipes.recipesSpreader), new PageText("6"), new PageCraftingRecipe("7", ModCrafingRecipes.recipeManaLens), new PageCraftingRecipe("8", ModCrafingRecipes.recipesLensDying), new PageCraftingRecipe("9", ModCrafingRecipes.recipeRainbowLens)); + // MANA ENTRIES + manaIntro = new BLexiconEntry(LibLexicon.MANA_INTRO, categoryMana); + manaIntro.setPriority().setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2")); - pool = new BLexiconEntry(LibLexicon.MANA_POOL, categoryMana); - pool.setPriority().setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipePool), new PageText("2"), new PageManaInfusionRecipe("3", ModManaInfusionRecipes.manasteelRecipe), new PageManaInfusionRecipe("4", ModManaInfusionRecipes.manaPearlRecipe), new PageManaInfusionRecipe("5", ModManaInfusionRecipes.manaDiamondRecipe), new PageManaInfusionRecipe("6", ModManaInfusionRecipes.manaPetalRecipes), new PageManaInfusionRecipe("7", ModManaInfusionRecipes.manaCookieRecipe)); + spreader = new BLexiconEntry(LibLexicon.MANA_SPREADER, categoryMana); + spreader.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_SPREADER), new PageText("2"), new PageText("3"), new PageText("4"), new PageCraftingRecipe("5", ModCrafingRecipes.recipesSpreader), new PageText("6"), new PageCraftingRecipe("7", ModCrafingRecipes.recipeManaLens), new PageCraftingRecipe("8", ModCrafingRecipes.recipesLensDying), new PageCraftingRecipe("9", ModCrafingRecipes.recipeRainbowLens)); - distributor = new BLexiconEntry(LibLexicon.MANA_DISTRIBUTOR, categoryMana); - distributor.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeDistributor)); + pool = new BLexiconEntry(LibLexicon.MANA_POOL, categoryMana); + pool.setPriority().setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipePool), new PageText("2"), new PageManaInfusionRecipe("3", ModManaInfusionRecipes.manasteelRecipe), new PageManaInfusionRecipe("4", ModManaInfusionRecipes.manaPearlRecipe), new PageManaInfusionRecipe("5", ModManaInfusionRecipes.manaDiamondRecipe), new PageManaInfusionRecipe("6", ModManaInfusionRecipes.manaPetalRecipes), new PageManaInfusionRecipe("7", ModManaInfusionRecipes.manaCookieRecipe)); - lensVelocity = new BLexiconEntry(LibLexicon.MANA_LENS_VELOCITY, categoryMana); - lensVelocity.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensVelocity)); + distributor = new BLexiconEntry(LibLexicon.MANA_DISTRIBUTOR, categoryMana); + distributor.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeDistributor)); - lensPotency = new BLexiconEntry(LibLexicon.MANA_LENS_POTENCY, categoryMana); - lensPotency.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensPotency)); + lensVelocity = new BLexiconEntry(LibLexicon.MANA_LENS_VELOCITY, categoryMana); + lensVelocity.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensVelocity)); - lensResistance = new BLexiconEntry(LibLexicon.MANA_LENS_RESISTANCE, categoryMana); - lensResistance.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensResistance)); + lensPotency = new BLexiconEntry(LibLexicon.MANA_LENS_POTENCY, categoryMana); + lensPotency.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensPotency)); - lensEfficiency = new BLexiconEntry(LibLexicon.MANA_LENS_EFFICIENCY, categoryMana); - lensEfficiency.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensEfficiency)); + lensResistance = new BLexiconEntry(LibLexicon.MANA_LENS_RESISTANCE, categoryMana); + lensResistance.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensResistance)); - lensBounce = new BLexiconEntry(LibLexicon.MANA_LENS_BOUNCE, categoryMana); - lensBounce.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensBounce)); + lensEfficiency = new BLexiconEntry(LibLexicon.MANA_LENS_EFFICIENCY, categoryMana); + lensEfficiency.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensEfficiency)); - lensGravity = new BLexiconEntry(LibLexicon.MANA_LENS_GRAVITY, categoryMana); - lensGravity.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensGravity)); + lensBounce = new BLexiconEntry(LibLexicon.MANA_LENS_BOUNCE, categoryMana); + lensBounce.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensBounce)); - lensBore = new BLexiconEntry(LibLexicon.MANA_LENS_BORE, categoryMana); - lensBore.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensBore)); + lensGravity = new BLexiconEntry(LibLexicon.MANA_LENS_GRAVITY, categoryMana); + lensGravity.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensGravity)); - lensDamaging = new BLexiconEntry(LibLexicon.MANA_LENS_DAMAGING, categoryMana); - lensDamaging.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensDamaging)); + lensBore = new BLexiconEntry(LibLexicon.MANA_LENS_BORE, categoryMana); + lensBore.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensBore)); - lensPhantom = new BLexiconEntry(LibLexicon.MANA_LENS_PHANTOM, categoryMana); - lensPhantom.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensPhantom)); + lensDamaging = new BLexiconEntry(LibLexicon.MANA_LENS_DAMAGING, categoryMana); + lensDamaging.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensDamaging)); - lensMagnet = new BLexiconEntry(LibLexicon.MANA_LENS_MAGNET, categoryMana); - lensMagnet.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensMagnet)); + lensPhantom = new BLexiconEntry(LibLexicon.MANA_LENS_PHANTOM, categoryMana); + lensPhantom.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensPhantom)); - lensExplosive = new BLexiconEntry(LibLexicon.MANA_LENS_EXPLOSIVE, categoryMana); - lensExplosive.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensExplosive)); + lensMagnet = new BLexiconEntry(LibLexicon.MANA_LENS_MAGNET, categoryMana); + lensMagnet.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensMagnet)); - manaVoid = new BLexiconEntry(LibLexicon.MANA_VOID, categoryMana); - manaVoid.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeManaVoid)); + lensExplosive = new BLexiconEntry(LibLexicon.MANA_LENS_EXPLOSIVE, categoryMana); + lensExplosive.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensExplosive)); - manaTransport = new BLexiconEntry(LibLexicon.MANA_TRANSPORT, categoryMana); - manaTransport.setLexiconPages(new PageText("0"), new PageText("1"), new PageCraftingRecipe("2", ModCrafingRecipes.recipesManaTablet), - new PageText("3"), new PageCraftingRecipe("4", ModCrafingRecipes.recipeManaMirror)); + manaVoid = new BLexiconEntry(LibLexicon.MANA_VOID, categoryMana); + manaVoid.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeManaVoid)); - manaDetector = new BLexiconEntry(LibLexicon.MANA_DETECTOR, categoryMana); - manaDetector.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeManaDetector)); + manaTransport = new BLexiconEntry(LibLexicon.MANA_TRANSPORT, categoryMana); + manaTransport.setLexiconPages(new PageText("0"), new PageText("1"), new PageCraftingRecipe("2", ModCrafingRecipes.recipesManaTablet), new PageText("3"), new PageCraftingRecipe("4", ModCrafingRecipes.recipeManaMirror)); - compositeLens = new BLexiconEntry(LibLexicon.MANA_COMPOSITE_LENS, categoryMana); - compositeLens.setLexiconPages(new PageText("0")); + manaDetector = new BLexiconEntry(LibLexicon.MANA_DETECTOR, categoryMana); + manaDetector.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeManaDetector)); - redstoneSpreader = new BLexiconEntry(LibLexicon.MANA_REDSTONE_SPREADER, categoryMana); - redstoneSpreader.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeRedstoneSpreader)); - - // FUNCTIONAL FLOWERS ENTRIES - functionalIntro = new BLexiconEntry(LibLexicon.FFLOWER_INTRO, categoryFunctionalFlowers); - functionalIntro.setPriority().setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2")); + compositeLens = new BLexiconEntry(LibLexicon.MANA_COMPOSITE_LENS, categoryMana); + compositeLens.setLexiconPages(new PageText("0")); - jadedAmaranthus = new BLexiconEntry(LibLexicon.FFLOWER_JADED_AMARANTHUS, categoryFunctionalFlowers); - jadedAmaranthus.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.jadedAmaranthusRecipe)); + redstoneSpreader = new BLexiconEntry(LibLexicon.MANA_REDSTONE_SPREADER, categoryMana); + redstoneSpreader.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeRedstoneSpreader)); - bellethorne = new BLexiconEntry(LibLexicon.FFLOWER_BELLETHORNE, categoryFunctionalFlowers); - bellethorne.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.bellethorneRecipe)); + // FUNCTIONAL FLOWERS ENTRIES + functionalIntro = new BLexiconEntry(LibLexicon.FFLOWER_INTRO, categoryFunctionalFlowers); + functionalIntro.setPriority().setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2")); - heiseiDream = new BLexiconEntry(LibLexicon.FFLOWER_HEISEI_DREAM, categoryFunctionalFlowers); - heiseiDream.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.heiseiDreamRecipe)); + jadedAmaranthus = new BLexiconEntry(LibLexicon.FFLOWER_JADED_AMARANTHUS, categoryFunctionalFlowers); + jadedAmaranthus.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.jadedAmaranthusRecipe)); - tigerseye = new BLexiconEntry(LibLexicon.FFLOWER_TIGERSEYE, categoryFunctionalFlowers); - tigerseye.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.tigerseyeRecipe)); + bellethorne = new BLexiconEntry(LibLexicon.FFLOWER_BELLETHORNE, categoryFunctionalFlowers); + bellethorne.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.bellethorneRecipe)); - orechid = new BLexiconEntry(LibLexicon.FFLOWER_ORECHID, categoryFunctionalFlowers); - orechid.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.orechidRecipe)); + heiseiDream = new BLexiconEntry(LibLexicon.FFLOWER_HEISEI_DREAM, categoryFunctionalFlowers); + heiseiDream.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.heiseiDreamRecipe)); - fallenKanade = new BLexiconEntry(LibLexicon.FFLOWER_FALLEN_KANADE, categoryFunctionalFlowers); - fallenKanade.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.fallenKanadeRecipe)); + tigerseye = new BLexiconEntry(LibLexicon.FFLOWER_TIGERSEYE, categoryFunctionalFlowers); + tigerseye.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.tigerseyeRecipe)); - exoflame = new BLexiconEntry(LibLexicon.FFLOWER_EXOFLAME, categoryFunctionalFlowers); - exoflame.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.exoflameRecipe)); + orechid = new BLexiconEntry(LibLexicon.FFLOWER_ORECHID, categoryFunctionalFlowers); + orechid.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.orechidRecipe)); - agricarnation = new BLexiconEntry(LibLexicon.FFLOWER_AGRICARNATION, categoryFunctionalFlowers); - agricarnation.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.agricarnationRecipe)); + fallenKanade = new BLexiconEntry(LibLexicon.FFLOWER_FALLEN_KANADE, categoryFunctionalFlowers); + fallenKanade.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.fallenKanadeRecipe)); - hopperhock = new BLexiconEntry(LibLexicon.FFLOWER_HOPPERHOCK, categoryFunctionalFlowers); - hopperhock.setLexiconPages(new PageText("0"), new PageText("1"), new PagePetalRecipe("2", ModPetalRecipes.hopperhockRecipe)); + exoflame = new BLexiconEntry(LibLexicon.FFLOWER_EXOFLAME, categoryFunctionalFlowers); + exoflame.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.exoflameRecipe)); - tangleberrie = new BLexiconEntry(LibLexicon.FFLOWER_TANGLEBERRIE, categoryFunctionalFlowers); - tangleberrie.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.tangleberrieRecipe)); + agricarnation = new BLexiconEntry(LibLexicon.FFLOWER_AGRICARNATION, categoryFunctionalFlowers); + agricarnation.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.agricarnationRecipe)); - jiyuulia = new BLexiconEntry(LibLexicon.FFLOWER_JIYUULIA, categoryFunctionalFlowers); - jiyuulia.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.jiyuuliaRecipe)); + hopperhock = new BLexiconEntry(LibLexicon.FFLOWER_HOPPERHOCK, categoryFunctionalFlowers); + hopperhock.setLexiconPages(new PageText("0"), new PageText("1"), new PagePetalRecipe("2", ModPetalRecipes.hopperhockRecipe)); - // GENERATING FLOWERS ENTRIES - generatingIntro = new BLexiconEntry(LibLexicon.GFLOWER_INTRO, categoryGenerationFlowers); - generatingIntro.setPriority().setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2")); + tangleberrie = new BLexiconEntry(LibLexicon.FFLOWER_TANGLEBERRIE, categoryFunctionalFlowers); + tangleberrie.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.tangleberrieRecipe)); - daybloom = new BLexiconEntry(LibLexicon.GFLOWER_DAYBLOOM, categoryGenerationFlowers); - daybloom.setPriority().setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.daybloomRecipe)); + jiyuulia = new BLexiconEntry(LibLexicon.FFLOWER_JIYUULIA, categoryFunctionalFlowers); + jiyuulia.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.jiyuuliaRecipe)); - nightshade = new BLexiconEntry(LibLexicon.GFLOWER_NIGHTSHADE, categoryGenerationFlowers); - nightshade.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.nightshadeRecipe)); + // GENERATING FLOWERS ENTRIES + generatingIntro = new BLexiconEntry(LibLexicon.GFLOWER_INTRO, categoryGenerationFlowers); + generatingIntro.setPriority().setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2")); - endoflame = new BLexiconEntry(LibLexicon.GFLOWER_ENDOFLAME, categoryGenerationFlowers); - endoflame.setLexiconPages(new PageText("0"), new PageText("1"), new PagePetalRecipe("2", ModPetalRecipes.endoflameRecipe)); + daybloom = new BLexiconEntry(LibLexicon.GFLOWER_DAYBLOOM, categoryGenerationFlowers); + daybloom.setPriority().setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.daybloomRecipe)); - hydroangeas = new BLexiconEntry(LibLexicon.GFLOWER_HYDROANGEAS, categoryGenerationFlowers); - hydroangeas.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.hydroangeasRecipe)); + nightshade = new BLexiconEntry(LibLexicon.GFLOWER_NIGHTSHADE, categoryGenerationFlowers); + nightshade.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.nightshadeRecipe)); - thermalily = new BLexiconEntry(LibLexicon.GFLOWER_THERMALILY, categoryGenerationFlowers); - thermalily.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.thermalilyRecipe)); + endoflame = new BLexiconEntry(LibLexicon.GFLOWER_ENDOFLAME, categoryGenerationFlowers); + endoflame.setLexiconPages(new PageText("0"), new PageText("1"), new PagePetalRecipe("2", ModPetalRecipes.endoflameRecipe)); - arcaneRose = new BLexiconEntry(LibLexicon.GFLOWER_ARCANE_ROSE, categoryGenerationFlowers); - arcaneRose.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.arcaneRoseRecipe)); + hydroangeas = new BLexiconEntry(LibLexicon.GFLOWER_HYDROANGEAS, categoryGenerationFlowers); + hydroangeas.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.hydroangeasRecipe)); - // DEVICES ENTRIES - pistonRelay = new BLexiconEntry(LibLexicon.DEVICE_PISTON_RELAY, categoryDevices); - pistonRelay.setLexiconPages(new PageText("0"), new PageText("1"), new PageManaInfusionRecipe("2", ModManaInfusionRecipes.pistonRelayRecipe)); + thermalily = new BLexiconEntry(LibLexicon.GFLOWER_THERMALILY, categoryGenerationFlowers); + thermalily.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.thermalilyRecipe)); - pylon = new BLexiconEntry(LibLexicon.DEVICE_PYLON, categoryDevices); - pylon.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipePylon)); + arcaneRose = new BLexiconEntry(LibLexicon.GFLOWER_ARCANE_ROSE, categoryGenerationFlowers); + arcaneRose.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.arcaneRoseRecipe)); - manaEnchanting = new BLexiconEntry(LibLexicon.DEVICE_MANA_ENCHANTING, categoryDevices); - manaEnchanting.setLexiconPages(new PageText("0"), new PageText("1"), - new PageImage("2", LibResources.ENTRY_ENCHANTER0), new PageImage("3", LibResources.ENTRY_ENCHANTER1), new PageImage("4", LibResources.ENTRY_ENCHANTER2), new PageImage("5", LibResources.ENTRY_ENCHANTER3), - new PageText("6"), new PageText("7"), new PageText("8"), new PageText("9"), new PageText("10")); + // DEVICES ENTRIES + pistonRelay = new BLexiconEntry(LibLexicon.DEVICE_PISTON_RELAY, categoryDevices); + pistonRelay.setLexiconPages(new PageText("0"), new PageText("1"), new PageManaInfusionRecipe("2", ModManaInfusionRecipes.pistonRelayRecipe)); - turntable = new BLexiconEntry(LibLexicon.DEVICE_TURNTABLE, categoryDevices); - turntable.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeTurntable)); + pylon = new BLexiconEntry(LibLexicon.DEVICE_PYLON, categoryDevices); + pylon.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipePylon)); - // TOOLS ENTRIES - manaBlaster = new BLexiconEntry(LibLexicon.TOOL_MANA_BLASTER, categoryTools); - manaBlaster.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageCraftingRecipe("3", ModCrafingRecipes.recipeManaBlaster)); + manaEnchanting = new BLexiconEntry(LibLexicon.DEVICE_MANA_ENCHANTING, categoryDevices); + manaEnchanting.setLexiconPages(new PageText("0"), new PageText("1"), new PageImage("2", LibResources.ENTRY_ENCHANTER0), new PageImage("3", LibResources.ENTRY_ENCHANTER1), new PageImage("4", LibResources.ENTRY_ENCHANTER2), new PageImage("5", LibResources.ENTRY_ENCHANTER3), new PageText("6"), new PageText("7"), new PageText("8"), new PageText("9"), new PageText("10")); - grassSeeds = new BLexiconEntry(LibLexicon.TOOL_GRASS_SEEDS, categoryTools); - grassSeeds.setLexiconPages(new PageText("0"), new PageManaInfusionRecipe("1", ModManaInfusionRecipes.grassSeedsRecipe), new PageManaInfusionRecipe("2", ModManaInfusionRecipes.podzolSeedsRecipe), new PageManaInfusionRecipe("3", ModManaInfusionRecipes.mycelSeedsRecipes)); - - dirtRod = new BLexiconEntry(LibLexicon.TOOL_DIRT_ROD, categoryTools); - dirtRod.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeDirtRod)); - - terraformRod = new BLexiconEntry(LibLexicon.TOOL_TERRAFORM_ROD, categoryTools); - terraformRod.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageCraftingRecipe("3", ModCrafingRecipes.recipeTerraformRod)); - - manasteelGear = new BLexiconEntry(LibLexicon.TOOL_MANASTEEL_GEAR, categoryTools); - manasteelGear.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeManasteelPick), new PageCraftingRecipe("2", ModCrafingRecipes.recipeManasteelShovel), new PageCraftingRecipe("3", ModCrafingRecipes.recipeManasteelAxe), - new PageCraftingRecipe("4", ModCrafingRecipes.recipeManasteelShears), new PageCraftingRecipe("5", ModCrafingRecipes.recipeManasteelSword), - new PageCraftingRecipe("6", ModCrafingRecipes.recipeManasteelHelm), new PageCraftingRecipe("7", ModCrafingRecipes.recipeManasteelChest), new PageCraftingRecipe("8", ModCrafingRecipes.recipeManasteelLegs), new PageCraftingRecipe("9", ModCrafingRecipes.recipeManasteelBoots)); - - terrasteelArmor = new BLexiconEntry(LibLexicon.TOOL_TERRASTEEL_ARMOR, categoryTools); - terrasteelArmor.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeTerrasteelHelm), new PageCraftingRecipe("2", ModCrafingRecipes.recipeTerrasteelChest), new PageCraftingRecipe("3", ModCrafingRecipes.recipeTerrasteelLegs), new PageCraftingRecipe("4", ModCrafingRecipes.recipeTerrasteelBoots)); - - grassHorn = new BLexiconEntry(LibLexicon.TOOL_GRASS_HORN, categoryTools); - grassHorn.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeGrassHorn)); - - terraBlade = new BLexiconEntry(LibLexicon.TOOL_TERRA_SWORD, categoryTools); - terraBlade.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeTerraSword)); - - // MISCLENAEOUS ENTRIES - unstableBlocks = new BLexiconEntry(LibLexicon.MISC_UNSTABLE_BLOCKS, categoryMisc); - unstableBlocks.setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_UNSTABLE_BLOCK), new PageCraftingRecipe("2", ModCrafingRecipes.recipesUnstableBlocks), new PageText("3"), new PageImage("4", LibResources.ENTRY_UNSTABLE_BEACON), new PageCraftingRecipe("5", ModCrafingRecipes.recipesManaBeacons), new PageText("6"), new PageCraftingRecipe("7", ModCrafingRecipes.recipesSignalFlares)); + turntable = new BLexiconEntry(LibLexicon.DEVICE_TURNTABLE, categoryDevices); + turntable.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeTurntable)); - decorativeBlocks = new BLexiconEntry(LibLexicon.MISC_DECORATIVE_BLOCKS, categoryMisc); - decorativeBlocks.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLivingrockDecor1), new PageCraftingRecipe("2", ModCrafingRecipes.recipeLivingrockDecor2), new PageCraftingRecipe("3", ModCrafingRecipes.recipeLivingrockDecor3), new PageCraftingRecipe("4", ModCrafingRecipes.recipeLivingrockDecor4), - new PageCraftingRecipe("5", ModCrafingRecipes.recipeLivingwoodDecor1), new PageCraftingRecipe("6", ModCrafingRecipes.recipeLivingwoodDecor2), new PageCraftingRecipe("7", ModCrafingRecipes.recipeLivingwoodDecor3), new PageCraftingRecipe("8", ModCrafingRecipes.recipeLivingwoodDecor4), new PageCraftingRecipe("9", ModCrafingRecipes.recipeLivingwoodDecor5)); - } + // TOOLS ENTRIES + manaBlaster = new BLexiconEntry(LibLexicon.TOOL_MANA_BLASTER, categoryTools); + manaBlaster.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageCraftingRecipe("3", ModCrafingRecipes.recipeManaBlaster)); + + grassSeeds = new BLexiconEntry(LibLexicon.TOOL_GRASS_SEEDS, categoryTools); + grassSeeds.setLexiconPages(new PageText("0"), new PageManaInfusionRecipe("1", ModManaInfusionRecipes.grassSeedsRecipe), new PageManaInfusionRecipe("2", ModManaInfusionRecipes.podzolSeedsRecipe), new PageManaInfusionRecipe("3", ModManaInfusionRecipes.mycelSeedsRecipes)); + + dirtRod = new BLexiconEntry(LibLexicon.TOOL_DIRT_ROD, categoryTools); + dirtRod.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeDirtRod)); + + terraformRod = new BLexiconEntry(LibLexicon.TOOL_TERRAFORM_ROD, categoryTools); + terraformRod.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageCraftingRecipe("3", ModCrafingRecipes.recipeTerraformRod)); + + manasteelGear = new BLexiconEntry(LibLexicon.TOOL_MANASTEEL_GEAR, categoryTools); + manasteelGear.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeManasteelPick), new PageCraftingRecipe("2", ModCrafingRecipes.recipeManasteelShovel), new PageCraftingRecipe("3", ModCrafingRecipes.recipeManasteelAxe), new PageCraftingRecipe("4", ModCrafingRecipes.recipeManasteelShears), new PageCraftingRecipe("5", ModCrafingRecipes.recipeManasteelSword), new PageCraftingRecipe("6", ModCrafingRecipes.recipeManasteelHelm), new PageCraftingRecipe("7", ModCrafingRecipes.recipeManasteelChest), new PageCraftingRecipe("8", ModCrafingRecipes.recipeManasteelLegs), new PageCraftingRecipe("9", ModCrafingRecipes.recipeManasteelBoots)); + + terrasteelArmor = new BLexiconEntry(LibLexicon.TOOL_TERRASTEEL_ARMOR, categoryTools); + terrasteelArmor.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeTerrasteelHelm), new PageCraftingRecipe("2", ModCrafingRecipes.recipeTerrasteelChest), new PageCraftingRecipe("3", ModCrafingRecipes.recipeTerrasteelLegs), new PageCraftingRecipe("4", ModCrafingRecipes.recipeTerrasteelBoots)); + + grassHorn = new BLexiconEntry(LibLexicon.TOOL_GRASS_HORN, categoryTools); + grassHorn.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeGrassHorn)); + + terraBlade = new BLexiconEntry(LibLexicon.TOOL_TERRA_SWORD, categoryTools); + terraBlade.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeTerraSword)); + + // MISCLENAEOUS ENTRIES + unstableBlocks = new BLexiconEntry(LibLexicon.MISC_UNSTABLE_BLOCKS, categoryMisc); + unstableBlocks.setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_UNSTABLE_BLOCK), new PageCraftingRecipe("2", ModCrafingRecipes.recipesUnstableBlocks), new PageText("3"), new PageImage("4", LibResources.ENTRY_UNSTABLE_BEACON), new PageCraftingRecipe("5", ModCrafingRecipes.recipesManaBeacons), new PageText("6"), new PageCraftingRecipe("7", ModCrafingRecipes.recipesSignalFlares)); + + decorativeBlocks = new BLexiconEntry(LibLexicon.MISC_DECORATIVE_BLOCKS, categoryMisc); + decorativeBlocks.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLivingrockDecor1), new PageCraftingRecipe("2", ModCrafingRecipes.recipeLivingrockDecor2), new PageCraftingRecipe("3", ModCrafingRecipes.recipeLivingrockDecor3), new PageCraftingRecipe("4", ModCrafingRecipes.recipeLivingrockDecor4), new PageCraftingRecipe("5", ModCrafingRecipes.recipeLivingwoodDecor1), new PageCraftingRecipe("6", ModCrafingRecipes.recipeLivingwoodDecor2), new PageCraftingRecipe("7", ModCrafingRecipes.recipeLivingwoodDecor3), new PageCraftingRecipe("8", ModCrafingRecipes.recipeLivingwoodDecor4), new PageCraftingRecipe("9", ModCrafingRecipes.recipeLivingwoodDecor5)); + } } diff --git a/MODSRC/vazkii/botania/common/lexicon/page/PageCraftingRecipe.java b/MODSRC/vazkii/botania/common/lexicon/page/PageCraftingRecipe.java index ffec05581..071483a21 100644 --- a/MODSRC/vazkii/botania/common/lexicon/page/PageCraftingRecipe.java +++ b/MODSRC/vazkii/botania/common/lexicon/page/PageCraftingRecipe.java @@ -2,19 +2,18 @@ * This class was created by . 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 19, 2014, 4:58:19 PM (GMT)] */ package vazkii.botania.common.lexicon.page; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - +import cpw.mods.fml.relauncher.ReflectionHelper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.texture.TextureManager; @@ -26,157 +25,155 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; - import org.lwjgl.opengl.GL11; - import vazkii.botania.api.internal.IGuiLexiconEntry; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.lexicon.LexiconRecipeMappings; import vazkii.botania.client.core.helper.RenderHelper; import vazkii.botania.client.lib.LibResources; -import cpw.mods.fml.relauncher.ReflectionHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; public class PageCraftingRecipe extends PageRecipe { - private static final ResourceLocation craftingOverlay = new ResourceLocation(LibResources.GUI_CRAFTING_OVERLAY); + private static final ResourceLocation craftingOverlay = new ResourceLocation(LibResources.GUI_CRAFTING_OVERLAY); - List recipes; - int ticksElapsed = 0; - int recipeAt = 0; + List recipes; + int ticksElapsed = 0; + int recipeAt = 0; - boolean oreDictRecipe, shapelessRecipe; + boolean oreDictRecipe, shapelessRecipe; - public PageCraftingRecipe(String unlocalizedName, List recipes) { - super(unlocalizedName); - this.recipes = recipes; - } + public PageCraftingRecipe(String unlocalizedName, List recipes) { + super(unlocalizedName); + this.recipes = recipes; + } - public PageCraftingRecipe(String unlocalizedName, IRecipe recipe) { - this(unlocalizedName, Arrays.asList(recipe)); - } + public PageCraftingRecipe(String unlocalizedName, IRecipe recipe) { + this(unlocalizedName, Arrays.asList(recipe)); + } - @Override - public void onPageAdded(LexiconEntry entry, int index) { - for(IRecipe recipe : recipes) - LexiconRecipeMappings.map(recipe.getRecipeOutput(), entry, index); - } + @Override + public void onPageAdded(LexiconEntry entry, int index) { + for(IRecipe recipe : recipes) + LexiconRecipeMappings.map(recipe.getRecipeOutput(), entry, index); + } - @Override - @SideOnly(Side.CLIENT) - public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) { - oreDictRecipe = shapelessRecipe = false; + @Override + @SideOnly(Side.CLIENT) + public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) { + oreDictRecipe = shapelessRecipe = false; - IRecipe recipe = recipes.get(recipeAt); - renderCraftingRecipe(gui, recipe); + IRecipe recipe = recipes.get(recipeAt); + renderCraftingRecipe(gui, recipe); - TextureManager render = Minecraft.getMinecraft().renderEngine; - render.bindTexture(craftingOverlay); + TextureManager render = Minecraft.getMinecraft().renderEngine; + render.bindTexture(craftingOverlay); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(1F, 1F, 1F, 1F); - ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight()); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1F, 1F, 1F, 1F); + ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight()); - int iconX = gui.getLeft() + 115; - int iconY = gui.getTop() + 12; + int iconX = gui.getLeft() + 115; + int iconY = gui.getTop() + 12; - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - if(shapelessRecipe) { - ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 0, 16, 16); + if(shapelessRecipe) { + ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 0, 16, 16); - if(mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16) - RenderHelper.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("botaniamisc.shapeless"))); + if(mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16) + RenderHelper.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("botaniamisc.shapeless"))); - iconY += 20; - } + iconY += 20; + } - render.bindTexture(craftingOverlay); - GL11.glEnable(GL11.GL_BLEND); + render.bindTexture(craftingOverlay); + GL11.glEnable(GL11.GL_BLEND); - if(oreDictRecipe) { - ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 16, 16, 16); + if(oreDictRecipe) { + ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 16, 16, 16); - if(mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16) - RenderHelper.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("botaniamisc.oredict"))); - } - GL11.glDisable(GL11.GL_BLEND); - } + if(mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16) + RenderHelper.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("botaniamisc.oredict"))); + } + GL11.glDisable(GL11.GL_BLEND); + } - @Override - @SideOnly(Side.CLIENT) - public void updateScreen() { - if(ticksElapsed % 20 == 0) { - recipeAt++; + @Override + @SideOnly(Side.CLIENT) + public void updateScreen() { + if(ticksElapsed % 20 == 0) { + recipeAt++; - if(recipeAt == recipes.size()) - recipeAt = 0; - } - ++ticksElapsed; - } + if(recipeAt == recipes.size()) recipeAt = 0; + } + ++ticksElapsed; + } - @SideOnly(Side.CLIENT) - public void renderCraftingRecipe(IGuiLexiconEntry gui, IRecipe recipe) { - if(recipe instanceof ShapedRecipes) { - ShapedRecipes shaped = (ShapedRecipes)recipe; + @SideOnly(Side.CLIENT) + public void renderCraftingRecipe(IGuiLexiconEntry gui, IRecipe recipe) { + if(recipe instanceof ShapedRecipes) { + ShapedRecipes shaped = (ShapedRecipes) recipe; - for(int y = 0; y < shaped.recipeHeight; y++) - for(int x = 0; x < shaped.recipeWidth; x++) - renderItemAtGridPos(gui, 1 + x, 1 + y, shaped.recipeItems[y * shaped.recipeWidth + x], true); - } else if(recipe instanceof ShapedOreRecipe) { - ShapedOreRecipe shaped = (ShapedOreRecipe) recipe; - int width = (Integer) ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 4); - int height = (Integer) ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 5); + for(int y = 0; y < shaped.recipeHeight; y++) + for(int x = 0; x < shaped.recipeWidth; x++) + renderItemAtGridPos(gui, 1 + x, 1 + y, shaped.recipeItems[y * shaped.recipeWidth + x], true); + } else if(recipe instanceof ShapedOreRecipe) { + ShapedOreRecipe shaped = (ShapedOreRecipe) recipe; + int width = (Integer) ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 4); + int height = (Integer) ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 5); - for(int y = 0; y < height; y++) - for(int x = 0; x < width; x++) { - Object input = shaped.getInput()[y * width + x]; - if(input != null) - renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof ItemStack ? (ItemStack) input : ((ArrayList) input).get(0), true); - } + for(int y = 0; y < height; y++) + for(int x = 0; x < width; x++) { + Object input = shaped.getInput()[y * width + x]; + if(input != null) + renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof ItemStack ? (ItemStack) input : ((ArrayList) input).get(0), true); + } - oreDictRecipe = true; - } else if(recipe instanceof ShapelessRecipes) { - ShapelessRecipes shapeless = (ShapelessRecipes) recipe; + oreDictRecipe = true; + } else if(recipe instanceof ShapelessRecipes) { + ShapelessRecipes shapeless = (ShapelessRecipes) recipe; - drawGrid : { - for(int y = 0; y < 3; y++) - for(int x = 0; x < 3; x++) { - int index = y * 3 + x; + drawGrid: + { + for(int y = 0; y < 3; y++) + for(int x = 0; x < 3; x++) { + int index = y * 3 + x; - if(index >= shapeless.recipeItems.size()) - break drawGrid; + if(index >= shapeless.recipeItems.size()) break drawGrid; - renderItemAtGridPos(gui, 1 + x, 1 + y, (ItemStack) shapeless.recipeItems.get(index), true); - } - } + renderItemAtGridPos(gui, 1 + x, 1 + y, (ItemStack) shapeless.recipeItems.get(index), true); + } + } - shapelessRecipe = true; - } else if(recipe instanceof ShapelessOreRecipe) { - ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe; + shapelessRecipe = true; + } else if(recipe instanceof ShapelessOreRecipe) { + ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe; - drawGrid : { - for(int y = 0; y < 3; y++) - for(int x = 0; x < 3; x++) { - int index = y * 3 + x; + drawGrid: + { + for(int y = 0; y < 3; y++) + for(int x = 0; x < 3; x++) { + int index = y * 3 + x; - if(index >= shapeless.getRecipeSize()) - break drawGrid; + if(index >= shapeless.getRecipeSize()) break drawGrid; - Object input = shapeless.getInput().get(index); - if(input != null) - renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof ItemStack ? (ItemStack) input : ((ArrayList) input).get(0), true); - } - } + Object input = shapeless.getInput().get(index); + if(input != null) + renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof ItemStack ? (ItemStack) input : ((ArrayList) input).get(0), true); + } + } - shapelessRecipe = true; - oreDictRecipe = true; - } + shapelessRecipe = true; + oreDictRecipe = true; + } - renderItemAtGridPos(gui, 2, 0, recipe.getRecipeOutput(), false); - } + renderItemAtGridPos(gui, 2, 0, recipe.getRecipeOutput(), false); + } } diff --git a/MODSRC/vazkii/botania/common/lexicon/page/PageImage.java b/MODSRC/vazkii/botania/common/lexicon/page/PageImage.java index ea7ae0512..a8b73f6ea 100644 --- a/MODSRC/vazkii/botania/common/lexicon/page/PageImage.java +++ b/MODSRC/vazkii/botania/common/lexicon/page/PageImage.java @@ -2,53 +2,51 @@ * This class was created by . 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 16, 2014, 6:13:08 PM (GMT)] */ package vazkii.botania.common.lexicon.page; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; - import vazkii.botania.api.internal.IGuiLexiconEntry; import vazkii.botania.api.lexicon.LexiconPage; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class PageImage extends LexiconPage { - ResourceLocation resource; + ResourceLocation resource; - public PageImage(String unlocalizedName, String resource) { - super(unlocalizedName); - this.resource = new ResourceLocation(resource); - } + public PageImage(String unlocalizedName, String resource) { + super(unlocalizedName); + this.resource = new ResourceLocation(resource); + } - @Override - @SideOnly(Side.CLIENT) - public void renderScreen(IGuiLexiconEntry gui, int mx, int my) { - TextureManager render = Minecraft.getMinecraft().renderEngine; - render.bindTexture(resource); + @Override + @SideOnly(Side.CLIENT) + public void renderScreen(IGuiLexiconEntry gui, int mx, int my) { + TextureManager render = Minecraft.getMinecraft().renderEngine; + render.bindTexture(resource); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(1F, 1F, 1F, 1F); - ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight()); - GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1F, 1F, 1F, 1F); + ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight()); + GL11.glDisable(GL11.GL_BLEND); - int width = gui.getWidth() - 30; - int height = gui.getHeight(); - int x = gui.getLeft() + 16; - int y = gui.getTop() + height - 40; - PageText.renderText(x, y, width, height, getUnlocalizedName()); - } + int width = gui.getWidth() - 30; + int height = gui.getHeight(); + int x = gui.getLeft() + 16; + int y = gui.getTop() + height - 40; + PageText.renderText(x, y, width, height, getUnlocalizedName()); + } } diff --git a/MODSRC/vazkii/botania/common/lexicon/page/PageManaInfusionRecipe.java b/MODSRC/vazkii/botania/common/lexicon/page/PageManaInfusionRecipe.java index 20c644bd2..ab9a7c868 100644 --- a/MODSRC/vazkii/botania/common/lexicon/page/PageManaInfusionRecipe.java +++ b/MODSRC/vazkii/botania/common/lexicon/page/PageManaInfusionRecipe.java @@ -2,18 +2,17 @@ * This class was created by . 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 @ [Feb 8, 2014, 1:11:42 PM (GMT)] */ package vazkii.botania.common.lexicon.page; -import java.util.Arrays; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; @@ -22,9 +21,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraftforge.oredict.OreDictionary; - import org.lwjgl.opengl.GL11; - import vazkii.botania.api.internal.IGuiLexiconEntry; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.lexicon.LexiconRecipeMappings; @@ -33,74 +30,73 @@ import vazkii.botania.client.core.handler.HUDHandler; import vazkii.botania.client.lib.LibResources; import vazkii.botania.common.block.ModBlocks; import vazkii.botania.common.block.tile.TilePool; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + +import java.util.Arrays; +import java.util.List; public class PageManaInfusionRecipe extends PageRecipe { - private static final ResourceLocation manaInfusionOverlay = new ResourceLocation(LibResources.GUI_MANA_INFUSION_OVERLAY); + private static final ResourceLocation manaInfusionOverlay = new ResourceLocation(LibResources.GUI_MANA_INFUSION_OVERLAY); - List recipes; - int ticksElapsed = 0; - int recipeAt = 0; + List recipes; + int ticksElapsed = 0; + int recipeAt = 0; - public PageManaInfusionRecipe(String unlocalizedName, List recipes) { - super(unlocalizedName); - this.recipes = recipes; - } + public PageManaInfusionRecipe(String unlocalizedName, List recipes) { + super(unlocalizedName); + this.recipes = recipes; + } - public PageManaInfusionRecipe(String unlocalizedName, RecipeManaInfusion recipe) { - this(unlocalizedName, Arrays.asList(recipe)); - } + public PageManaInfusionRecipe(String unlocalizedName, RecipeManaInfusion recipe) { + this(unlocalizedName, Arrays.asList(recipe)); + } - @Override - public void onPageAdded(LexiconEntry entry, int index) { - for(RecipeManaInfusion recipe : recipes) - LexiconRecipeMappings.map(recipe.getOutput(), entry, index); - } + @Override + public void onPageAdded(LexiconEntry entry, int index) { + for(RecipeManaInfusion recipe : recipes) + LexiconRecipeMappings.map(recipe.getOutput(), entry, index); + } - @Override - @SideOnly(Side.CLIENT) - public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) { - RecipeManaInfusion recipe = recipes.get(recipeAt); - TextureManager render = Minecraft.getMinecraft().renderEngine; - FontRenderer font = Minecraft.getMinecraft().fontRenderer; + @Override + @SideOnly(Side.CLIENT) + public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) { + RecipeManaInfusion recipe = recipes.get(recipeAt); + TextureManager render = Minecraft.getMinecraft().renderEngine; + FontRenderer font = Minecraft.getMinecraft().fontRenderer; - Object input = recipe.getInput(); - if(input instanceof String) - input = OreDictionary.getOres((String) input).get(0); + Object input = recipe.getInput(); + if(input instanceof String) input = OreDictionary.getOres((String) input).get(0); - renderItemAtGridPos(gui, 1, 1, (ItemStack) input, false); - renderItemAtGridPos(gui, 2, 1, new ItemStack(ModBlocks.pool), false); - renderItemAtGridPos(gui, 3, 1, recipe.getOutput(), false); + renderItemAtGridPos(gui, 1, 1, (ItemStack) input, false); + renderItemAtGridPos(gui, 2, 1, new ItemStack(ModBlocks.pool), false); + renderItemAtGridPos(gui, 3, 1, recipe.getOutput(), false); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - String manaUsage = StatCollector.translateToLocal("botaniamisc.manaUsage"); - font.drawString(manaUsage, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(manaUsage) / 2, gui.getTop() + 105, 0x66000000); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + String manaUsage = StatCollector.translateToLocal("botaniamisc.manaUsage"); + font.drawString(manaUsage, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(manaUsage) / 2, gui.getTop() + 105, 0x66000000); - HUDHandler.renderManaBar(gui.getLeft() + gui.getWidth() / 2 - 50, gui.getTop() + 115, 0x0000FF, 0.75F, recipe.getManaToConsume(), TilePool.MAX_MANA / 10); - GL11.glDisable(GL11.GL_BLEND); + HUDHandler.renderManaBar(gui.getLeft() + gui.getWidth() / 2 - 50, gui.getTop() + 115, 0x0000FF, 0.75F, recipe.getManaToConsume(), TilePool.MAX_MANA / 10); + GL11.glDisable(GL11.GL_BLEND); - render.bindTexture(manaInfusionOverlay); + render.bindTexture(manaInfusionOverlay); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(1F, 1F, 1F, 1F); - ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight()); - GL11.glDisable(GL11.GL_BLEND); - } + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1F, 1F, 1F, 1F); + ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight()); + GL11.glDisable(GL11.GL_BLEND); + } - @Override - @SideOnly(Side.CLIENT) - public void updateScreen() { - if(ticksElapsed % 20 == 0) { - recipeAt++; + @Override + @SideOnly(Side.CLIENT) + public void updateScreen() { + if(ticksElapsed % 20 == 0) { + recipeAt++; - if(recipeAt == recipes.size()) - recipeAt = 0; - } - ++ticksElapsed; - } + if(recipeAt == recipes.size()) recipeAt = 0; + } + ++ticksElapsed; + } } diff --git a/MODSRC/vazkii/botania/common/lexicon/page/PagePetalRecipe.java b/MODSRC/vazkii/botania/common/lexicon/page/PagePetalRecipe.java index 44a4a294d..7cc12c751 100644 --- a/MODSRC/vazkii/botania/common/lexicon/page/PagePetalRecipe.java +++ b/MODSRC/vazkii/botania/common/lexicon/page/PagePetalRecipe.java @@ -2,27 +2,24 @@ * This class was created by . 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 @ [Feb 8, 2014, 1:11:35 PM (GMT)] */ package vazkii.botania.common.lexicon.page; -import java.util.Arrays; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.oredict.OreDictionary; - import org.lwjgl.opengl.GL11; - import vazkii.botania.api.internal.IGuiLexiconEntry; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.lexicon.LexiconRecipeMappings; @@ -30,85 +27,84 @@ import vazkii.botania.api.recipe.RecipePetals; import vazkii.botania.client.lib.LibResources; import vazkii.botania.common.block.ModBlocks; import vazkii.botania.common.core.handler.ConfigHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + +import java.util.Arrays; +import java.util.List; public class PagePetalRecipe extends PageRecipe { - private static final ResourceLocation petalOverlay = new ResourceLocation(LibResources.GUI_PETAL_OVERLAY); + private static final ResourceLocation petalOverlay = new ResourceLocation(LibResources.GUI_PETAL_OVERLAY); - List recipes; - int ticksElapsed = 0; - int recipeAt = 0; + List recipes; + int ticksElapsed = 0; + int recipeAt = 0; - public PagePetalRecipe(String unlocalizedName, List recipes) { - super(unlocalizedName); - this.recipes = recipes; - } + public PagePetalRecipe(String unlocalizedName, List recipes) { + super(unlocalizedName); + this.recipes = recipes; + } - public PagePetalRecipe(String unlocalizedName, T recipe) { - this(unlocalizedName, Arrays.asList(recipe)); - } + public PagePetalRecipe(String unlocalizedName, T recipe) { + this(unlocalizedName, Arrays.asList(recipe)); + } - @Override - public void onPageAdded(LexiconEntry entry, int index) { - for(T recipe : recipes) - LexiconRecipeMappings.map(recipe.getOutput(), entry, index); - } + @Override + public void onPageAdded(LexiconEntry entry, int index) { + for(T recipe : recipes) + LexiconRecipeMappings.map(recipe.getOutput(), entry, index); + } - @Override - @SideOnly(Side.CLIENT) - public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) { - T recipe = recipes.get(recipeAt); - TextureManager render = Minecraft.getMinecraft().renderEngine; + @Override + @SideOnly(Side.CLIENT) + public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) { + T recipe = recipes.get(recipeAt); + TextureManager render = Minecraft.getMinecraft().renderEngine; - renderItemAtGridPos(gui, 3, 0, recipe.getOutput(), false); - renderItemAtGridPos(gui, 2, 1, getMiddleStack(), false); + renderItemAtGridPos(gui, 3, 0, recipe.getOutput(), false); + renderItemAtGridPos(gui, 2, 1, getMiddleStack(), false); - List inputs = recipe.getInputs(); - int degreePerInput = (int) (360F / inputs.size()); - int currentDegree = ConfigHandler.lexiconRotatingItems ? (int) Minecraft.getMinecraft().theWorld.getTotalWorldTime() : 0; + List inputs = recipe.getInputs(); + int degreePerInput = (int) (360F / inputs.size()); + int currentDegree = ConfigHandler.lexiconRotatingItems ? (int) Minecraft.getMinecraft().theWorld.getTotalWorldTime() : 0; - for(Object obj : inputs) { - Object input = obj; - if(input instanceof String) - input = OreDictionary.getOres((String) input).get(0); + for(Object obj : inputs) { + Object input = obj; + if(input instanceof String) input = OreDictionary.getOres((String) input).get(0); - renderItemAtAngle(gui, currentDegree, (ItemStack) input); + renderItemAtAngle(gui, currentDegree, (ItemStack) input); - currentDegree += degreePerInput; - } + currentDegree += degreePerInput; + } - renderManaBar(gui, recipe, mx, my); + renderManaBar(gui, recipe, mx, my); - render.bindTexture(petalOverlay); + render.bindTexture(petalOverlay); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(1F, 1F, 1F, 1F); - ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight()); - GL11.glDisable(GL11.GL_BLEND); - } + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1F, 1F, 1F, 1F); + ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight()); + GL11.glDisable(GL11.GL_BLEND); + } - ItemStack getMiddleStack() { - return new ItemStack(ModBlocks.altar); - } + ItemStack getMiddleStack() { + return new ItemStack(ModBlocks.altar); + } - @SideOnly(Side.CLIENT) - public void renderManaBar(IGuiLexiconEntry gui, T recipe, int mx, int my) { - // NO-OP - } + @SideOnly(Side.CLIENT) + public void renderManaBar(IGuiLexiconEntry gui, T recipe, int mx, int my) { + // NO-OP + } - @Override - @SideOnly(Side.CLIENT) - public void updateScreen() { - if(ticksElapsed % 20 == 0) { - recipeAt++; + @Override + @SideOnly(Side.CLIENT) + public void updateScreen() { + if(ticksElapsed % 20 == 0) { + recipeAt++; - if(recipeAt == recipes.size()) - recipeAt = 0; - } - ++ticksElapsed; - } + if(recipeAt == recipes.size()) recipeAt = 0; + } + ++ticksElapsed; + } } diff --git a/MODSRC/vazkii/botania/common/lexicon/page/PageRecipe.java b/MODSRC/vazkii/botania/common/lexicon/page/PageRecipe.java index 804b456e1..894b52232 100644 --- a/MODSRC/vazkii/botania/common/lexicon/page/PageRecipe.java +++ b/MODSRC/vazkii/botania/common/lexicon/page/PageRecipe.java @@ -2,18 +2,17 @@ * This class was created by . 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 @ [Feb 8, 2014, 2:46:36 PM (GMT)] */ package vazkii.botania.common.lexicon.page; -import java.util.Arrays; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; @@ -24,142 +23,134 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.client.ForgeHooksClient; - import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; - import vazkii.botania.api.internal.IGuiLexiconEntry; import vazkii.botania.api.lexicon.LexiconPage; import vazkii.botania.api.lexicon.LexiconRecipeMappings; import vazkii.botania.api.lexicon.LexiconRecipeMappings.EntryData; import vazkii.botania.client.core.helper.RenderHelper; import vazkii.botania.client.gui.GuiLexiconEntry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + +import java.util.Arrays; +import java.util.List; public class PageRecipe extends LexiconPage { - int relativeMouseX, relativeMouseY; - ItemStack tooltipStack, tooltipContainerStack; - boolean tooltipEntry; + int relativeMouseX, relativeMouseY; + ItemStack tooltipStack, tooltipContainerStack; + boolean tooltipEntry; - public PageRecipe(String unlocalizedName) { - super(unlocalizedName); - } + public PageRecipe(String unlocalizedName) { + super(unlocalizedName); + } - @Override - @SideOnly(Side.CLIENT) - public void renderScreen(IGuiLexiconEntry gui, int mx, int my) { - relativeMouseX = mx; - relativeMouseY = my; + @Override + @SideOnly(Side.CLIENT) + public void renderScreen(IGuiLexiconEntry gui, int mx, int my) { + relativeMouseX = mx; + relativeMouseY = my; - renderRecipe(gui, mx, my); + renderRecipe(gui, mx, my); - int width = gui.getWidth() - 30; - int height = gui.getHeight(); - int x = gui.getLeft() + 16; - int y = gui.getTop() + height - 40; - PageText.renderText(x, y, width, height, getUnlocalizedName()); + int width = gui.getWidth() - 30; + int height = gui.getHeight(); + int x = gui.getLeft() + 16; + int y = gui.getTop() + height - 40; + PageText.renderText(x, y, width, height, getUnlocalizedName()); - if(tooltipStack != null) { - List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - RenderHelper.renderTooltip(mx, my, tooltipData); + if(tooltipStack != null) { + List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + RenderHelper.renderTooltip(mx, my, tooltipData); - int tooltipY = 8 + tooltipData.size() * 11; + int tooltipY = 8 + tooltipData.size() * 11; - if(tooltipEntry) { - RenderHelper.renderTooltipOrange(mx, my + tooltipY, Arrays.asList(EnumChatFormatting.GRAY + StatCollector.translateToLocal("botaniamisc.clickToRecipe"))); - tooltipY += 18; - } + if(tooltipEntry) { + RenderHelper.renderTooltipOrange(mx, my + tooltipY, Arrays.asList(EnumChatFormatting.GRAY + StatCollector.translateToLocal("botaniamisc.clickToRecipe"))); + tooltipY += 18; + } - if(tooltipContainerStack != null) - RenderHelper.renderTooltipGreen(mx, my + tooltipY, Arrays.asList(EnumChatFormatting.AQUA + StatCollector.translateToLocal("botaniamisc.craftingContainer"), tooltipContainerStack.getDisplayName())); - } + if(tooltipContainerStack != null) + RenderHelper.renderTooltipGreen(mx, my + tooltipY, Arrays.asList(EnumChatFormatting.AQUA + StatCollector.translateToLocal("botaniamisc.craftingContainer"), tooltipContainerStack.getDisplayName())); + } - tooltipStack = tooltipContainerStack = null; - tooltipEntry = false; - GL11.glDisable(GL11.GL_BLEND); - } + tooltipStack = tooltipContainerStack = null; + tooltipEntry = false; + GL11.glDisable(GL11.GL_BLEND); + } - @SideOnly(Side.CLIENT) - public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) { - // NO-OP - } + @SideOnly(Side.CLIENT) + public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) { + // NO-OP + } - @SideOnly(Side.CLIENT) - public void renderItemAtAngle(IGuiLexiconEntry gui, int angle, ItemStack stack) { - if(stack == null || stack.getItem() == null) - return; - stack = stack.copy(); + @SideOnly(Side.CLIENT) + public void renderItemAtAngle(IGuiLexiconEntry gui, int angle, ItemStack stack) { + if(stack == null || stack.getItem() == null) return; + stack = stack.copy(); - if(stack.getItemDamage() == Short.MAX_VALUE) - stack.setItemDamage(0); + if(stack.getItemDamage() == Short.MAX_VALUE) stack.setItemDamage(0); - angle -= 90; - int radius = 32; - double xPos = gui.getLeft() + Math.cos(angle * Math.PI / 180D) * radius + gui.getWidth() / 2 - 8; - double yPos = gui.getTop() + Math.sin(angle * Math.PI / 180D) * radius + 53; - ItemStack stack1 = stack.copy(); - if(stack1.getItemDamage() == -1) - stack1.setItemDamage(0); + angle -= 90; + int radius = 32; + double xPos = gui.getLeft() + Math.cos(angle * Math.PI / 180D) * radius + gui.getWidth() / 2 - 8; + double yPos = gui.getTop() + Math.sin(angle * Math.PI / 180D) * radius + 53; + ItemStack stack1 = stack.copy(); + if(stack1.getItemDamage() == -1) stack1.setItemDamage(0); - renderItem(gui, (int) xPos, (int) yPos, stack1, false); - } + renderItem(gui, (int) xPos, (int) yPos, stack1, false); + } - @SideOnly(Side.CLIENT) - public void renderItemAtGridPos(IGuiLexiconEntry gui, int x, int y, ItemStack stack, boolean accountForContainer) { - if(stack == null || stack.getItem() == null) - return; - stack = stack.copy(); + @SideOnly(Side.CLIENT) + public void renderItemAtGridPos(IGuiLexiconEntry gui, int x, int y, ItemStack stack, boolean accountForContainer) { + if(stack == null || stack.getItem() == null) return; + stack = stack.copy(); - if(stack.getItemDamage() == Short.MAX_VALUE) - stack.setItemDamage(0); + if(stack.getItemDamage() == Short.MAX_VALUE) stack.setItemDamage(0); - int xPos = gui.getLeft() + x * 29 + 7 + (y == 0 && x == 3 ? 10 : 0); - int yPos = gui.getTop() + y * 29 + 24 - (y == 0 ? 7 : 0); - ItemStack stack1 = stack.copy(); - if(stack1.getItemDamage() == -1) - stack1.setItemDamage(0); + int xPos = gui.getLeft() + x * 29 + 7 + (y == 0 && x == 3 ? 10 : 0); + int yPos = gui.getTop() + y * 29 + 24 - (y == 0 ? 7 : 0); + ItemStack stack1 = stack.copy(); + if(stack1.getItemDamage() == -1) stack1.setItemDamage(0); - renderItem(gui, xPos, yPos, stack1, accountForContainer); - } + renderItem(gui, xPos, yPos, stack1, accountForContainer); + } - @SideOnly(Side.CLIENT) - public void renderItem(IGuiLexiconEntry gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer) { - RenderItem render = new RenderItem(); - TextureManager renderEngine = Minecraft.getMinecraft().renderEngine; - FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; + @SideOnly(Side.CLIENT) + public void renderItem(IGuiLexiconEntry gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer) { + RenderItem render = new RenderItem(); + TextureManager renderEngine = Minecraft.getMinecraft().renderEngine; + FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - // Translations required so the glint doesn't merge with the book texture - GL11.glTranslatef(0F, 0F, 200F); - if(!ForgeHooksClient.renderInventoryItem(new RenderBlocks(), renderEngine, stack, render.renderWithColor, gui.getZLevel(), xPos, yPos)) - render.renderItemIntoGUI(fontRenderer, renderEngine, stack, xPos, yPos); - render.renderItemOverlayIntoGUI(fontRenderer, renderEngine, stack, xPos, yPos); - GL11.glTranslatef(0F, 0F, -200F); + // Translations required so the glint doesn't merge with the book texture + GL11.glTranslatef(0F, 0F, 200F); + if(!ForgeHooksClient.renderInventoryItem(new RenderBlocks(), renderEngine, stack, render.renderWithColor, gui.getZLevel(), xPos, yPos)) + render.renderItemIntoGUI(fontRenderer, renderEngine, stack, xPos, yPos); + render.renderItemOverlayIntoGUI(fontRenderer, renderEngine, stack, xPos, yPos); + GL11.glTranslatef(0F, 0F, -200F); - if(relativeMouseX >= xPos && relativeMouseY >= yPos && relativeMouseX <= xPos + 16 && relativeMouseY <= yPos + 16) { - tooltipStack = stack; + if(relativeMouseX >= xPos && relativeMouseY >= yPos && relativeMouseX <= xPos + 16 && relativeMouseY <= yPos + 16) { + tooltipStack = stack; - EntryData data = LexiconRecipeMappings.getDataForStack(tooltipStack); - if(data != null && (data.entry != gui.getEntry() || data.page != gui.getPageOn())) { - tooltipEntry = true; + EntryData data = LexiconRecipeMappings.getDataForStack(tooltipStack); + if(data != null && (data.entry != gui.getEntry() || data.page != gui.getPageOn())) { + tooltipEntry = true; - if(Mouse.isButtonDown(0) && GuiScreen.isShiftKeyDown()) { - GuiLexiconEntry newGui = new GuiLexiconEntry(data.entry, (GuiScreen) gui); - newGui.page = data.page; - Minecraft.getMinecraft().displayGuiScreen(newGui); - } - } + if(Mouse.isButtonDown(0) && GuiScreen.isShiftKeyDown()) { + GuiLexiconEntry newGui = new GuiLexiconEntry(data.entry, (GuiScreen) gui); + newGui.page = data.page; + Minecraft.getMinecraft().displayGuiScreen(newGui); + } + } - if(accountForContainer) { - ItemStack containerStack = stack.getItem().getContainerItem(stack); - if(containerStack != null && containerStack.getItem() != null) - tooltipContainerStack = containerStack; - } - } + if(accountForContainer) { + ItemStack containerStack = stack.getItem().getContainerItem(stack); + if(containerStack != null && containerStack.getItem() != null) tooltipContainerStack = containerStack; + } + } - GL11.glDisable(GL11.GL_LIGHTING); - } + GL11.glDisable(GL11.GL_LIGHTING); + } } diff --git a/MODSRC/vazkii/botania/common/lexicon/page/PageRuneRecipe.java b/MODSRC/vazkii/botania/common/lexicon/page/PageRuneRecipe.java index 754c1a463..871e1bf1d 100644 --- a/MODSRC/vazkii/botania/common/lexicon/page/PageRuneRecipe.java +++ b/MODSRC/vazkii/botania/common/lexicon/page/PageRuneRecipe.java @@ -2,58 +2,56 @@ * This class was created by . 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 @ [Feb 8, 2014, 1:11:48 PM (GMT)] */ package vazkii.botania.common.lexicon.page; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; - import vazkii.botania.api.internal.IGuiLexiconEntry; import vazkii.botania.api.recipe.RecipeRuneAltar; import vazkii.botania.client.core.handler.HUDHandler; import vazkii.botania.common.block.ModBlocks; import vazkii.botania.common.block.tile.TilePool; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + +import java.util.List; public class PageRuneRecipe extends PagePetalRecipe { - public PageRuneRecipe(String unlocalizedName, List recipes) { - super(unlocalizedName, recipes); - } + public PageRuneRecipe(String unlocalizedName, List recipes) { + super(unlocalizedName, recipes); + } - public PageRuneRecipe(String unlocalizedName, RecipeRuneAltar recipes) { - super(unlocalizedName, recipes); - } + public PageRuneRecipe(String unlocalizedName, RecipeRuneAltar recipes) { + super(unlocalizedName, recipes); + } - @Override - ItemStack getMiddleStack() { - return new ItemStack(ModBlocks.runeAltar); - } + @Override + ItemStack getMiddleStack() { + return new ItemStack(ModBlocks.runeAltar); + } - @Override - @SideOnly(Side.CLIENT) - public void renderManaBar(IGuiLexiconEntry gui, RecipeRuneAltar recipe, int mx, int my) { - FontRenderer font = Minecraft.getMinecraft().fontRenderer; - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - String manaUsage = StatCollector.translateToLocal("botaniamisc.manaUsage"); - font.drawString(manaUsage, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(manaUsage) / 2, gui.getTop() + 120, 0x66000000); + @Override + @SideOnly(Side.CLIENT) + public void renderManaBar(IGuiLexiconEntry gui, RecipeRuneAltar recipe, int mx, int my) { + FontRenderer font = Minecraft.getMinecraft().fontRenderer; + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + String manaUsage = StatCollector.translateToLocal("botaniamisc.manaUsage"); + font.drawString(manaUsage, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(manaUsage) / 2, gui.getTop() + 120, 0x66000000); - HUDHandler.renderManaBar(gui.getLeft() + gui.getWidth() / 2 - 50, gui.getTop() + 130, 0x0000FF, 0.75F, recipe.getManaUsage(), TilePool.MAX_MANA / 10); - GL11.glDisable(GL11.GL_BLEND); - } + HUDHandler.renderManaBar(gui.getLeft() + gui.getWidth() / 2 - 50, gui.getTop() + 130, 0x0000FF, 0.75F, recipe.getManaUsage(), TilePool.MAX_MANA / 10); + GL11.glDisable(GL11.GL_BLEND); + } } diff --git a/MODSRC/vazkii/botania/common/lexicon/page/PageTerrasteel.java b/MODSRC/vazkii/botania/common/lexicon/page/PageTerrasteel.java index eceb5d59b..51b990b66 100644 --- a/MODSRC/vazkii/botania/common/lexicon/page/PageTerrasteel.java +++ b/MODSRC/vazkii/botania/common/lexicon/page/PageTerrasteel.java @@ -2,105 +2,99 @@ * This class was created by . 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 @ [Apr 14, 2014, 5:57:26 PM (GMT)] */ package vazkii.botania.common.lexicon.page; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import vazkii.botania.api.internal.IGuiLexiconEntry; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.lexicon.LexiconRecipeMappings; -import vazkii.botania.api.recipe.RecipeManaInfusion; import vazkii.botania.client.lib.LibResources; import vazkii.botania.common.item.ModItems; public class PageTerrasteel extends PageRecipe { - private static final ResourceLocation terrasteelOverlay = new ResourceLocation(LibResources.GUI_TERRASTEEL_OVERLAY); + private static final ResourceLocation terrasteelOverlay = new ResourceLocation(LibResources.GUI_TERRASTEEL_OVERLAY); - int ticksElapsed = 0; - int index = 0; + int ticksElapsed = 0; + int index = 0; - static final Block[] blocks = new Block[] { - Blocks.iron_block, Blocks.gold_block, Blocks.emerald_block, Blocks.diamond_block - }; + static final Block[] blocks = new Block[]{Blocks.iron_block, Blocks.gold_block, Blocks.emerald_block, Blocks.diamond_block}; - public PageTerrasteel(String unlocalizedName) { - super(unlocalizedName); - } + public PageTerrasteel(String unlocalizedName) { + super(unlocalizedName); + } - @Override - @SideOnly(Side.CLIENT) - public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) { - Block block = blocks[index]; + @Override + @SideOnly(Side.CLIENT) + public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) { + Block block = blocks[index]; - GL11.glTranslatef(0F, 0F, -10F); - renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8, gui.getTop() + 103, new ItemStack(block), false); + GL11.glTranslatef(0F, 0F, -10F); + renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8, gui.getTop() + 103, new ItemStack(block), false); - GL11.glTranslatef(0F, 0F, 5F); - renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 + 7, gui.getTop() + 106, new ItemStack(block), false); - renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 - 6, gui.getTop() + 106, new ItemStack(block), false); + GL11.glTranslatef(0F, 0F, 5F); + renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 + 7, gui.getTop() + 106, new ItemStack(block), false); + renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 - 6, gui.getTop() + 106, new ItemStack(block), false); - GL11.glTranslatef(0F, 0F, 5F); - renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8, gui.getTop() + 110, new ItemStack(block), false); - renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 + 14, gui.getTop() + 110, new ItemStack(block), false); - renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 - 13, gui.getTop() + 110, new ItemStack(block), false); + GL11.glTranslatef(0F, 0F, 5F); + renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8, gui.getTop() + 110, new ItemStack(block), false); + renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 + 14, gui.getTop() + 110, new ItemStack(block), false); + renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 - 13, gui.getTop() + 110, new ItemStack(block), false); - GL11.glTranslatef(0F, 0F, 5F); - renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 - 6, gui.getTop() + 114, new ItemStack(block), false); - renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 + 7, gui.getTop() + 114, new ItemStack(block), false); + GL11.glTranslatef(0F, 0F, 5F); + renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 - 6, gui.getTop() + 114, new ItemStack(block), false); + renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 + 7, gui.getTop() + 114, new ItemStack(block), false); - GL11.glTranslatef(0F, 0F, 5F); - renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 + 1, gui.getTop() + 117, new ItemStack(block), false); + GL11.glTranslatef(0F, 0F, 5F); + renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 + 1, gui.getTop() + 117, new ItemStack(block), false); - GL11.glTranslatef(0F, 0F, 5F); - renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8, gui.getTop() + 102, new ItemStack(Blocks.beacon), false); - GL11.glTranslatef(0F, 0F, -10F); + GL11.glTranslatef(0F, 0F, 5F); + renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8, gui.getTop() + 102, new ItemStack(Blocks.beacon), false); + GL11.glTranslatef(0F, 0F, -10F); - renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8, gui.getTop() + 30, new ItemStack(ModItems.manaResource, 1, 4), false); - renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8, gui.getTop() + 80, new ItemStack(ModItems.manaResource, 1, 0), false); - renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 - 20, gui.getTop() + 86, new ItemStack(ModItems.manaResource, 1, 1), false); - renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 + 19, gui.getTop() + 86, new ItemStack(ModItems.manaResource, 1, 2), false); + renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8, gui.getTop() + 30, new ItemStack(ModItems.manaResource, 1, 4), false); + renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8, gui.getTop() + 80, new ItemStack(ModItems.manaResource, 1, 0), false); + renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 - 20, gui.getTop() + 86, new ItemStack(ModItems.manaResource, 1, 1), false); + renderItem(gui, gui.getLeft() + gui.getWidth() / 2 - 8 + 19, gui.getTop() + 86, new ItemStack(ModItems.manaResource, 1, 2), false); - Minecraft.getMinecraft().renderEngine.bindTexture(terrasteelOverlay); + Minecraft.getMinecraft().renderEngine.bindTexture(terrasteelOverlay); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(1F, 1F, 1F, 1F); - ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight()); - GL11.glDisable(GL11.GL_BLEND); - } + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1F, 1F, 1F, 1F); + ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight()); + GL11.glDisable(GL11.GL_BLEND); + } - @Override - @SideOnly(Side.CLIENT) - public void updateScreen() { - if(ticksElapsed % 20 == 0) { - index++; + @Override + @SideOnly(Side.CLIENT) + public void updateScreen() { + if(ticksElapsed % 20 == 0) { + index++; - if(index == blocks.length) - index = 0; - } - ++ticksElapsed; - } + if(index == blocks.length) index = 0; + } + ++ticksElapsed; + } - @Override - public void onPageAdded(LexiconEntry entry, int index) { - LexiconRecipeMappings.map(new ItemStack(ModItems.manaResource, 1, 4), entry, index); - } + @Override + public void onPageAdded(LexiconEntry entry, int index) { + LexiconRecipeMappings.map(new ItemStack(ModItems.manaResource, 1, 4), entry, index); + } } diff --git a/MODSRC/vazkii/botania/common/lexicon/page/PageText.java b/MODSRC/vazkii/botania/common/lexicon/page/PageText.java index 44c22c765..f95d6995d 100644 --- a/MODSRC/vazkii/botania/common/lexicon/page/PageText.java +++ b/MODSRC/vazkii/botania/common/lexicon/page/PageText.java @@ -2,18 +2,17 @@ * This class was created by . 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 14, 2014, 6:45:33 PM (GMT)] */ package vazkii.botania.common.lexicon.page; -import java.util.ArrayList; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.util.MathHelper; @@ -21,81 +20,80 @@ import net.minecraft.util.StatCollector; import vazkii.botania.api.internal.IGuiLexiconEntry; import vazkii.botania.api.lexicon.LexiconPage; import vazkii.botania.client.core.helper.FontHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + +import java.util.ArrayList; +import java.util.List; public class PageText extends LexiconPage { - public PageText(String unlocalizedName) { - super(unlocalizedName); - } + public PageText(String unlocalizedName) { + super(unlocalizedName); + } - @Override - @SideOnly(Side.CLIENT) - public void renderScreen(IGuiLexiconEntry gui, int mx, int my) { - int width = gui.getWidth() - 34; - int x = gui.getLeft() + 16; - int y = gui.getTop() + 2; + @Override + @SideOnly(Side.CLIENT) + public void renderScreen(IGuiLexiconEntry gui, int mx, int my) { + int width = gui.getWidth() - 34; + int x = gui.getLeft() + 16; + int y = gui.getTop() + 2; - renderText(x, y, width, gui.getHeight(), getUnlocalizedName()); - } + renderText(x, y, width, gui.getHeight(), getUnlocalizedName()); + } - @SideOnly(Side.CLIENT) - public static void renderText(int x, int y, int width, int height, String unlocalizedText) { - FontRenderer renderer = Minecraft.getMinecraft().fontRenderer; - boolean unicode = renderer.getUnicodeFlag(); - renderer.setUnicodeFlag(true); - String text = StatCollector.translateToLocal(unlocalizedText).replaceAll("&", "\u00a7"); - String[] textEntries = text.split("
"); + @SideOnly(Side.CLIENT) + public static void renderText(int x, int y, int width, int height, String unlocalizedText) { + FontRenderer renderer = Minecraft.getMinecraft().fontRenderer; + boolean unicode = renderer.getUnicodeFlag(); + renderer.setUnicodeFlag(true); + String text = StatCollector.translateToLocal(unlocalizedText).replaceAll("&", "\u00a7"); + String[] textEntries = text.split("
"); - String lastFormat = ""; - String pendingFormat = ""; - for(String s : textEntries) { - List wrappedLines = new ArrayList(); - String workingOn = ""; + String lastFormat = ""; + String pendingFormat = ""; + for(String s : textEntries) { + List wrappedLines = new ArrayList(); + String workingOn = ""; - int i = 0; - String[] tokens = s.split(" "); - for(String s1 : tokens) { - boolean skipPending = false; - String format = FontHelper.getFormatFromString(s1); + int i = 0; + String[] tokens = s.split(" "); + for(String s1 : tokens) { + boolean skipPending = false; + String format = FontHelper.getFormatFromString(s1); - if(!format.isEmpty() && s1.length() > 0 && s1.charAt(0) != '\u00a7') { - skipPending = true; - pendingFormat = format; - format = ""; - } + if(!format.isEmpty() && s1.length() > 0 && s1.charAt(0) != '\u00a7') { + skipPending = true; + pendingFormat = format; + format = ""; + } - if(!pendingFormat.isEmpty() && !skipPending) { - format = pendingFormat; - pendingFormat = ""; - } + if(!pendingFormat.isEmpty() && !skipPending) { + format = pendingFormat; + pendingFormat = ""; + } - if(MathHelper.stringNullOrLengthZero(format)) - format = lastFormat; + if(MathHelper.stringNullOrLengthZero(format)) format = lastFormat; - if(renderer.getStringWidth(workingOn + " " + s1) >= width) { - wrappedLines.add(workingOn); - workingOn = ""; - } - workingOn = workingOn + format + " " + s1; + if(renderer.getStringWidth(workingOn + " " + s1) >= width) { + wrappedLines.add(workingOn); + workingOn = ""; + } + workingOn = workingOn + format + " " + s1; - if(i == tokens.length - 1) - wrappedLines.add(workingOn); + if(i == tokens.length - 1) wrappedLines.add(workingOn); - ++i; - lastFormat = format; - } + ++i; + lastFormat = format; + } - for(String s1 : wrappedLines) { - y += 10; - renderer.drawString(s1, x, y, 0); - } + for(String s1 : wrappedLines) { + y += 10; + renderer.drawString(s1, x, y, 0); + } - y += 10; - } + y += 10; + } - renderer.setUnicodeFlag(unicode); - } + renderer.setUnicodeFlag(unicode); + } } diff --git a/MODSRC/vazkii/botania/common/lib/LibBlockNames.java b/MODSRC/vazkii/botania/common/lib/LibBlockNames.java index 684792fd3..8174be456 100644 --- a/MODSRC/vazkii/botania/common/lib/LibBlockNames.java +++ b/MODSRC/vazkii/botania/common/lib/LibBlockNames.java @@ -2,11 +2,11 @@ * This class was created by . 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 16, 2014, 5:55:03 PM (GMT)] */ package vazkii.botania.common.lib; @@ -15,44 +15,44 @@ import vazkii.botania.client.lib.LibResources; public final class LibBlockNames { - public static final String FLOWER = LibResources.PREFIX_MOD + "flower"; - public static final String ALTAR = LibResources.PREFIX_MOD + "altar"; - public static final String SPECIAL_FLOWER = LibResources.PREFIX_MOD + "specialFlower"; - public static final String LIVING_ROCK = LibResources.PREFIX_MOD + "livingrock"; - public static final String LIVING_WOOD = LibResources.PREFIX_MOD + "livingwood"; - public static final String SPREADER = LibResources.PREFIX_MOD + "spreader"; - public static final String POOL = LibResources.PREFIX_MOD + "pool"; - public static final String RUNE_ALTAR = LibResources.PREFIX_MOD + "runeAltar"; - public static final String UNSTABLE_BLOCK = LibResources.PREFIX_MOD + "unstableBlock"; - public static final String PYLON = LibResources.PREFIX_MOD + "pylon"; - public static final String PISTON_RELAY = LibResources.PREFIX_MOD + "pistonRelay"; - public static final String DISTRIBUTOR = LibResources.PREFIX_MOD + "distributor"; - public static final String MANA_BEACON = LibResources.PREFIX_MOD + "manaBeacon"; - public static final String MANA_VOID = LibResources.PREFIX_MOD + "manaVoid"; - public static final String MANA_DETECTOR = LibResources.PREFIX_MOD + "manaDetector"; - public static final String ENCHANTER = LibResources.PREFIX_MOD + "enchanter"; - public static final String TURNTABLE = LibResources.PREFIX_MOD + "turntable"; + public static final String FLOWER = LibResources.PREFIX_MOD + "flower"; + public static final String ALTAR = LibResources.PREFIX_MOD + "altar"; + public static final String SPECIAL_FLOWER = LibResources.PREFIX_MOD + "specialFlower"; + public static final String LIVING_ROCK = LibResources.PREFIX_MOD + "livingrock"; + public static final String LIVING_WOOD = LibResources.PREFIX_MOD + "livingwood"; + public static final String SPREADER = LibResources.PREFIX_MOD + "spreader"; + public static final String POOL = LibResources.PREFIX_MOD + "pool"; + public static final String RUNE_ALTAR = LibResources.PREFIX_MOD + "runeAltar"; + public static final String UNSTABLE_BLOCK = LibResources.PREFIX_MOD + "unstableBlock"; + public static final String PYLON = LibResources.PREFIX_MOD + "pylon"; + public static final String PISTON_RELAY = LibResources.PREFIX_MOD + "pistonRelay"; + public static final String DISTRIBUTOR = LibResources.PREFIX_MOD + "distributor"; + public static final String MANA_BEACON = LibResources.PREFIX_MOD + "manaBeacon"; + public static final String MANA_VOID = LibResources.PREFIX_MOD + "manaVoid"; + public static final String MANA_DETECTOR = LibResources.PREFIX_MOD + "manaDetector"; + public static final String ENCHANTER = LibResources.PREFIX_MOD + "enchanter"; + public static final String TURNTABLE = LibResources.PREFIX_MOD + "turntable"; - public static final String SPECIAL_FLOWER_PREFIX = FLOWER + "."; + public static final String SPECIAL_FLOWER_PREFIX = FLOWER + "."; - public static final String SUBTILE_PUREDAISY = "puredaisy"; + public static final String SUBTILE_PUREDAISY = "puredaisy"; - public static final String SUBTILE_DAYBLOOM = "daybloom"; - public static final String SUBTILE_ENDOFLAME = "endoflame"; - public static final String SUBTILE_HYDROANGEAS = "hydroangeas"; - public static final String SUBTILE_THERMALILY = "thermalily"; - public static final String SUBTILE_NIGHTSHADE = "nightshade"; - public static final String SUBTILE_ARCANE_ROSE = "arcanerose"; + public static final String SUBTILE_DAYBLOOM = "daybloom"; + public static final String SUBTILE_ENDOFLAME = "endoflame"; + public static final String SUBTILE_HYDROANGEAS = "hydroangeas"; + public static final String SUBTILE_THERMALILY = "thermalily"; + public static final String SUBTILE_NIGHTSHADE = "nightshade"; + public static final String SUBTILE_ARCANE_ROSE = "arcanerose"; - public static final String SUBTILE_BELLETHORN = "bellethorn"; - public static final String SUBTILE_HEISEI_DREAM = "heiseiDream"; - public static final String SUBTILE_TIGERSEYE = "tigerseye"; - public static final String SUBTILE_JADED_AMARANTHUS = "jadedAmaranthus"; - public static final String SUBTILE_ORECHID = "orechid"; - public static final String SUBTILE_FALLEN_KANADE = "fallenKanade"; - public static final String SUBTILE_EXOFLAME = "exoflame"; - public static final String SUBTILE_AGRICARNATION = "agricarnation"; - public static final String SUBTILE_HOPPERHOCK = "hopperhock"; - public static final String SUBTILE_TANGLEBERRIE = "tangleberrie"; - public static final String SUBTILE_JIYUULIA = "jiyuulia"; + public static final String SUBTILE_BELLETHORN = "bellethorn"; + public static final String SUBTILE_HEISEI_DREAM = "heiseiDream"; + public static final String SUBTILE_TIGERSEYE = "tigerseye"; + public static final String SUBTILE_JADED_AMARANTHUS = "jadedAmaranthus"; + public static final String SUBTILE_ORECHID = "orechid"; + public static final String SUBTILE_FALLEN_KANADE = "fallenKanade"; + public static final String SUBTILE_EXOFLAME = "exoflame"; + public static final String SUBTILE_AGRICARNATION = "agricarnation"; + public static final String SUBTILE_HOPPERHOCK = "hopperhock"; + public static final String SUBTILE_TANGLEBERRIE = "tangleberrie"; + public static final String SUBTILE_JIYUULIA = "jiyuulia"; } diff --git a/MODSRC/vazkii/botania/common/lib/LibEntityNames.java b/MODSRC/vazkii/botania/common/lib/LibEntityNames.java index 5fc8167c9..73e806681 100644 --- a/MODSRC/vazkii/botania/common/lib/LibEntityNames.java +++ b/MODSRC/vazkii/botania/common/lib/LibEntityNames.java @@ -2,11 +2,11 @@ * This class was created by . 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 26, 2014, 5:30:03 PM (GMT)] */ package vazkii.botania.common.lib; @@ -15,7 +15,7 @@ import vazkii.botania.client.lib.LibResources; public final class LibEntityNames { - public static final String MANA_BURST = LibResources.PREFIX_MOD + "manaBurst"; - public static final String SIGNAL_FLARE = LibResources.PREFIX_MOD + "signalFlare"; + public static final String MANA_BURST = LibResources.PREFIX_MOD + "manaBurst"; + public static final String SIGNAL_FLARE = LibResources.PREFIX_MOD + "signalFlare"; } diff --git a/MODSRC/vazkii/botania/common/lib/LibGuiIDs.java b/MODSRC/vazkii/botania/common/lib/LibGuiIDs.java index 280793393..0531c91de 100644 --- a/MODSRC/vazkii/botania/common/lib/LibGuiIDs.java +++ b/MODSRC/vazkii/botania/common/lib/LibGuiIDs.java @@ -2,17 +2,17 @@ * This class was created by . 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 14, 2014, 6:50:36 PM (GMT)] */ package vazkii.botania.common.lib; public final class LibGuiIDs { - public static final int LEXICON = 0; + public static final int LEXICON = 0; } diff --git a/MODSRC/vazkii/botania/common/lib/LibItemNames.java b/MODSRC/vazkii/botania/common/lib/LibItemNames.java index b07b0e549..0bf08fe40 100644 --- a/MODSRC/vazkii/botania/common/lib/LibItemNames.java +++ b/MODSRC/vazkii/botania/common/lib/LibItemNames.java @@ -2,11 +2,11 @@ * This class was created by . 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 14, 2014, 5:49:06 PM (GMT)] */ package vazkii.botania.common.lib; @@ -15,60 +15,42 @@ import vazkii.botania.client.lib.LibResources; public final class LibItemNames { - public static final String LEXICON = LibResources.PREFIX_MOD + "lexicon"; - 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"; - public static final String MANA_RESOURCE = LibResources.PREFIX_MOD + "manaResource"; - public static final String LENS = LibResources.PREFIX_MOD + "lens"; - public static final String MANA_PETAL = LibResources.PREFIX_MOD + "manaPetal"; - public static final String RUNE = LibResources.PREFIX_MOD + "rune"; - public static final String SIGNAL_FLARE = LibResources.PREFIX_MOD + "signalFlare"; - public static final String MANA_TABLET = LibResources.PREFIX_MOD + "manaTablet"; - public static final String MANA_GUN = LibResources.PREFIX_MOD + "manaGun"; - public static final String MANA_COOKIE = LibResources.PREFIX_MOD + "manaCookie"; - public static final String FERTILIZER = LibResources.PREFIX_MOD + "fertilizer"; - public static final String GRASS_SEEDS = LibResources.PREFIX_MOD + "grassSeeds"; - public static final String DIRT_ROD = LibResources.PREFIX_MOD + "dirtRod"; - public static final String TERRAFORM_ROD = LibResources.PREFIX_MOD + "terraformRod"; - public static final String MANA_MIRROR = LibResources.PREFIX_MOD + "manaMirror"; - public static final String MANASTEEL_HELM = LibResources.PREFIX_MOD + "manasteelHelm"; - public static final String MANASTEEL_CHEST = LibResources.PREFIX_MOD + "manasteelChest"; - public static final String MANASTEEL_LEGS = LibResources.PREFIX_MOD + "manasteelLegs"; - public static final String MANASTEEL_BOOTS = LibResources.PREFIX_MOD + "manasteelBoots"; - public static final String MANASTEEL_PICK = LibResources.PREFIX_MOD + "manasteelPick"; - public static final String MANASTEEL_SHOVEL = LibResources.PREFIX_MOD + "manasteelShovel"; - public static final String MANASTEEL_AXE = LibResources.PREFIX_MOD + "manasteelAxe"; - public static final String MANASTEEL_SWORD = LibResources.PREFIX_MOD + "manasteelSword"; - public static final String MANASTEEL_SHEARS = LibResources.PREFIX_MOD + "manasteelShears"; - public static final String GRASS_HORN = LibResources.PREFIX_MOD + "grassHorn"; - public static final String TERRASTEEL_HELM = LibResources.PREFIX_MOD + "terrasteelHelm"; - public static final String TERRASTEEL_CHEST = LibResources.PREFIX_MOD + "terrasteelChest"; - public static final String TERRASTEEL_LEGS = LibResources.PREFIX_MOD + "terrasteelLegs"; - public static final String TERRASTEEL_BOOTS = LibResources.PREFIX_MOD + "terrasteelBoots"; - public static final String TERRA_SWORD = LibResources.PREFIX_MOD + "terraSword"; + public static final String LEXICON = LibResources.PREFIX_MOD + "lexicon"; + 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"; + public static final String MANA_RESOURCE = LibResources.PREFIX_MOD + "manaResource"; + public static final String LENS = LibResources.PREFIX_MOD + "lens"; + public static final String MANA_PETAL = LibResources.PREFIX_MOD + "manaPetal"; + public static final String RUNE = LibResources.PREFIX_MOD + "rune"; + public static final String SIGNAL_FLARE = LibResources.PREFIX_MOD + "signalFlare"; + public static final String MANA_TABLET = LibResources.PREFIX_MOD + "manaTablet"; + public static final String MANA_GUN = LibResources.PREFIX_MOD + "manaGun"; + public static final String MANA_COOKIE = LibResources.PREFIX_MOD + "manaCookie"; + public static final String FERTILIZER = LibResources.PREFIX_MOD + "fertilizer"; + public static final String GRASS_SEEDS = LibResources.PREFIX_MOD + "grassSeeds"; + public static final String DIRT_ROD = LibResources.PREFIX_MOD + "dirtRod"; + public static final String TERRAFORM_ROD = LibResources.PREFIX_MOD + "terraformRod"; + public static final String MANA_MIRROR = LibResources.PREFIX_MOD + "manaMirror"; + public static final String MANASTEEL_HELM = LibResources.PREFIX_MOD + "manasteelHelm"; + public static final String MANASTEEL_CHEST = LibResources.PREFIX_MOD + "manasteelChest"; + public static final String MANASTEEL_LEGS = LibResources.PREFIX_MOD + "manasteelLegs"; + public static final String MANASTEEL_BOOTS = LibResources.PREFIX_MOD + "manasteelBoots"; + public static final String MANASTEEL_PICK = LibResources.PREFIX_MOD + "manasteelPick"; + public static final String MANASTEEL_SHOVEL = LibResources.PREFIX_MOD + "manasteelShovel"; + public static final String MANASTEEL_AXE = LibResources.PREFIX_MOD + "manasteelAxe"; + public static final String MANASTEEL_SWORD = LibResources.PREFIX_MOD + "manasteelSword"; + public static final String MANASTEEL_SHEARS = LibResources.PREFIX_MOD + "manasteelShears"; + public static final String GRASS_HORN = LibResources.PREFIX_MOD + "grassHorn"; + public static final String TERRASTEEL_HELM = LibResources.PREFIX_MOD + "terrasteelHelm"; + public static final String TERRASTEEL_CHEST = LibResources.PREFIX_MOD + "terrasteelChest"; + public static final String TERRASTEEL_LEGS = LibResources.PREFIX_MOD + "terrasteelLegs"; + public static final String TERRASTEEL_BOOTS = LibResources.PREFIX_MOD + "terrasteelBoots"; + public static final String TERRA_SWORD = LibResources.PREFIX_MOD + "terraSword"; + public static final String TEST = LibResources.PREFIX_MOD + "ring"; - public static final String[] LENS_NAMES = new String[] { - LibResources.PREFIX_MOD + "lensNormal", - LibResources.PREFIX_MOD + "lensSpeed", - LibResources.PREFIX_MOD + "lensPower", - LibResources.PREFIX_MOD + "lensTime", - LibResources.PREFIX_MOD + "lensEfficiency", - LibResources.PREFIX_MOD + "lensBounce", - LibResources.PREFIX_MOD + "lensGravity", - LibResources.PREFIX_MOD + "lensMine", - LibResources.PREFIX_MOD + "lensDamage", - LibResources.PREFIX_MOD + "lensPhantom", - LibResources.PREFIX_MOD + "lensMagnet", - LibResources.PREFIX_MOD + "lensExplosive" - }; + public static final String[] LENS_NAMES = new String[]{LibResources.PREFIX_MOD + "lensNormal", LibResources.PREFIX_MOD + "lensSpeed", LibResources.PREFIX_MOD + "lensPower", LibResources.PREFIX_MOD + "lensTime", LibResources.PREFIX_MOD + "lensEfficiency", LibResources.PREFIX_MOD + "lensBounce", LibResources.PREFIX_MOD + "lensGravity", LibResources.PREFIX_MOD + "lensMine", LibResources.PREFIX_MOD + "lensDamage", LibResources.PREFIX_MOD + "lensPhantom", LibResources.PREFIX_MOD + "lensMagnet", LibResources.PREFIX_MOD + "lensExplosive"}; - public static final String[] MANA_RESOURCE_NAMES = new String[] { - LibResources.PREFIX_MOD + "manasteel", - LibResources.PREFIX_MOD + "manaPearl", - LibResources.PREFIX_MOD + "manaDiamond", - LibResources.PREFIX_MOD + "livingwoodTwig", - LibResources.PREFIX_MOD + "terrasteel" - }; + public static final String[] MANA_RESOURCE_NAMES = new String[]{LibResources.PREFIX_MOD + "manasteel", LibResources.PREFIX_MOD + "manaPearl", LibResources.PREFIX_MOD + "manaDiamond", LibResources.PREFIX_MOD + "livingwoodTwig", LibResources.PREFIX_MOD + "terrasteel"}; } diff --git a/MODSRC/vazkii/botania/common/lib/LibLexicon.java b/MODSRC/vazkii/botania/common/lib/LibLexicon.java index d40f44784..153ccf532 100644 --- a/MODSRC/vazkii/botania/common/lib/LibLexicon.java +++ b/MODSRC/vazkii/botania/common/lib/LibLexicon.java @@ -2,92 +2,92 @@ * This class was created by . 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 14, 2014, 9:14:08 PM (GMT)] */ package vazkii.botania.common.lib; public final class LibLexicon { - public static final String CATEGORY_PREFIX = "botania.category."; + public static final String CATEGORY_PREFIX = "botania.category."; - public static final String CATEGORY_BASICS = CATEGORY_PREFIX + "basics"; - public static final String CATEGORY_MANA = CATEGORY_PREFIX + "mana"; - public static final String CATEGORY_FUNCTIONAL_FLOWERS = CATEGORY_PREFIX + "functionalFlowers"; - public static final String CATEGORY_GENERATION_FLOWERS = CATEGORY_PREFIX + "generationFlowers"; - public static final String CATEGORY_DEVICES = CATEGORY_PREFIX + "devices"; - public static final String CATEGORY_TOOLS = CATEGORY_PREFIX + "tools"; - public static final String CATEGORY_MISC = CATEGORY_PREFIX + "misc"; + public static final String CATEGORY_BASICS = CATEGORY_PREFIX + "basics"; + public static final String CATEGORY_MANA = CATEGORY_PREFIX + "mana"; + public static final String CATEGORY_FUNCTIONAL_FLOWERS = CATEGORY_PREFIX + "functionalFlowers"; + public static final String CATEGORY_GENERATION_FLOWERS = CATEGORY_PREFIX + "generationFlowers"; + public static final String CATEGORY_DEVICES = CATEGORY_PREFIX + "devices"; + public static final String CATEGORY_TOOLS = CATEGORY_PREFIX + "tools"; + public static final String CATEGORY_MISC = CATEGORY_PREFIX + "misc"; - public static final String BASICS_FLOWERS = "flowers"; - public static final String BASICS_APOTHECARY = "apothecary"; - public static final String BASICS_LEXICON = "lexicon"; - public static final String BASICS_WAND = "wand"; - public static final String BASICS_PURE_DAISY = "pureDaisy"; - public static final String BASICS_RUNE_ALTAR = "runeAltar"; - public static final String BASICS_TERRASTEEL = "terrasteel"; + public static final String BASICS_FLOWERS = "flowers"; + public static final String BASICS_APOTHECARY = "apothecary"; + public static final String BASICS_LEXICON = "lexicon"; + public static final String BASICS_WAND = "wand"; + public static final String BASICS_PURE_DAISY = "pureDaisy"; + public static final String BASICS_RUNE_ALTAR = "runeAltar"; + public static final String BASICS_TERRASTEEL = "terrasteel"; - public static final String MANA_INTRO = "mIntro"; - public static final String MANA_SPREADER = "spreader"; - public static final String MANA_POOL = "pool"; - public static final String MANA_DISTRIBUTOR = "distributor"; - public static final String MANA_LENS_VELOCITY = "lensVelocity"; - public static final String MANA_LENS_POTENCY = "lensPotency"; - public static final String MANA_LENS_RESISTANCE = "lensResistance"; - public static final String MANA_LENS_EFFICIENCY = "lensEfficiency"; - public static final String MANA_LENS_BOUNCE = "lensBounce"; - public static final String MANA_LENS_GRAVITY = "lensGravity"; - public static final String MANA_LENS_BORE = "lensBore"; - public static final String MANA_LENS_DAMAGING = "lensDamaging"; - public static final String MANA_LENS_PHANTOM = "lensPhantom"; - public static final String MANA_LENS_MAGNET = "lensMagnet"; - public static final String MANA_LENS_EXPLOSIVE = "lensExplosive"; - public static final String MANA_VOID = "manaVoid"; - public static final String MANA_TRANSPORT = "manaTransport"; - public static final String MANA_DETECTOR = "manaDetector"; - public static final String MANA_COMPOSITE_LENS = "compositeLens"; - public static final String MANA_REDSTONE_SPREADER = "redstoneSpreader"; + public static final String MANA_INTRO = "mIntro"; + public static final String MANA_SPREADER = "spreader"; + public static final String MANA_POOL = "pool"; + public static final String MANA_DISTRIBUTOR = "distributor"; + public static final String MANA_LENS_VELOCITY = "lensVelocity"; + public static final String MANA_LENS_POTENCY = "lensPotency"; + public static final String MANA_LENS_RESISTANCE = "lensResistance"; + public static final String MANA_LENS_EFFICIENCY = "lensEfficiency"; + public static final String MANA_LENS_BOUNCE = "lensBounce"; + public static final String MANA_LENS_GRAVITY = "lensGravity"; + public static final String MANA_LENS_BORE = "lensBore"; + public static final String MANA_LENS_DAMAGING = "lensDamaging"; + public static final String MANA_LENS_PHANTOM = "lensPhantom"; + public static final String MANA_LENS_MAGNET = "lensMagnet"; + public static final String MANA_LENS_EXPLOSIVE = "lensExplosive"; + public static final String MANA_VOID = "manaVoid"; + public static final String MANA_TRANSPORT = "manaTransport"; + public static final String MANA_DETECTOR = "manaDetector"; + public static final String MANA_COMPOSITE_LENS = "compositeLens"; + public static final String MANA_REDSTONE_SPREADER = "redstoneSpreader"; - public static final String FFLOWER_INTRO = "fIntro"; - public static final String FFLOWER_JADED_AMARANTHUS = "jadedAmaranthus"; - public static final String FFLOWER_BELLETHORNE = "bellethorne"; - public static final String FFLOWER_HEISEI_DREAM = "heiseiDream"; - public static final String FFLOWER_TIGERSEYE = "tigerseye"; - public static final String FFLOWER_ORECHID = "orechid"; - public static final String FFLOWER_FALLEN_KANADE = "fallenKanade"; - public static final String FFLOWER_EXOFLAME = "exoflame"; - public static final String FFLOWER_AGRICARNATION = "agricarnation"; - public static final String FFLOWER_HOPPERHOCK = "hopperhock"; - public static final String FFLOWER_TANGLEBERRIE = "tangleberrie"; - public static final String FFLOWER_JIYUULIA = "jiyuulia"; + public static final String FFLOWER_INTRO = "fIntro"; + public static final String FFLOWER_JADED_AMARANTHUS = "jadedAmaranthus"; + public static final String FFLOWER_BELLETHORNE = "bellethorne"; + public static final String FFLOWER_HEISEI_DREAM = "heiseiDream"; + public static final String FFLOWER_TIGERSEYE = "tigerseye"; + public static final String FFLOWER_ORECHID = "orechid"; + public static final String FFLOWER_FALLEN_KANADE = "fallenKanade"; + public static final String FFLOWER_EXOFLAME = "exoflame"; + public static final String FFLOWER_AGRICARNATION = "agricarnation"; + public static final String FFLOWER_HOPPERHOCK = "hopperhock"; + public static final String FFLOWER_TANGLEBERRIE = "tangleberrie"; + public static final String FFLOWER_JIYUULIA = "jiyuulia"; - public static final String GFLOWER_INTRO = "gIntro"; - public static final String GFLOWER_DAYBLOOM = "daybloom"; - public static final String GFLOWER_NIGHTSHADE = "nightshade"; - public static final String GFLOWER_ENDOFLAME = "endoflame"; - public static final String GFLOWER_HYDROANGEAS = "hydroangeas"; - public static final String GFLOWER_THERMALILY = "thermalily"; - public static final String GFLOWER_ARCANE_ROSE = "arcanerose"; + public static final String GFLOWER_INTRO = "gIntro"; + public static final String GFLOWER_DAYBLOOM = "daybloom"; + public static final String GFLOWER_NIGHTSHADE = "nightshade"; + public static final String GFLOWER_ENDOFLAME = "endoflame"; + public static final String GFLOWER_HYDROANGEAS = "hydroangeas"; + public static final String GFLOWER_THERMALILY = "thermalily"; + public static final String GFLOWER_ARCANE_ROSE = "arcanerose"; - public static final String DEVICE_PISTON_RELAY = "pistonRelay"; - public static final String DEVICE_PYLON = "pylon"; - public static final String DEVICE_MANA_ENCHANTING = "manaEnchanting"; - public static final String DEVICE_TURNTABLE = "turntable"; + public static final String DEVICE_PISTON_RELAY = "pistonRelay"; + public static final String DEVICE_PYLON = "pylon"; + public static final String DEVICE_MANA_ENCHANTING = "manaEnchanting"; + public static final String DEVICE_TURNTABLE = "turntable"; - public static final String TOOL_MANA_BLASTER = "manaBlaster"; - public static final String TOOL_GRASS_SEEDS = "grassSeeds"; - public static final String TOOL_DIRT_ROD = "dirtRod"; - public static final String TOOL_TERRAFORM_ROD = "terraformRod"; - public static final String TOOL_MANASTEEL_GEAR = "manaGear"; - public static final String TOOL_TERRASTEEL_ARMOR = "terrasteelArmor"; - public static final String TOOL_GRASS_HORN = "grassHorn"; - public static final String TOOL_TERRA_SWORD = "terraSword"; - - public static final String MISC_UNSTABLE_BLOCKS = "unstableBlocks"; - public static final String MISC_DECORATIVE_BLOCKS = "decorativeBlocks"; + public static final String TOOL_MANA_BLASTER = "manaBlaster"; + public static final String TOOL_GRASS_SEEDS = "grassSeeds"; + public static final String TOOL_DIRT_ROD = "dirtRod"; + public static final String TOOL_TERRAFORM_ROD = "terraformRod"; + public static final String TOOL_MANASTEEL_GEAR = "manaGear"; + public static final String TOOL_TERRASTEEL_ARMOR = "terrasteelArmor"; + public static final String TOOL_GRASS_HORN = "grassHorn"; + public static final String TOOL_TERRA_SWORD = "terraSword"; + + public static final String MISC_UNSTABLE_BLOCKS = "unstableBlocks"; + public static final String MISC_DECORATIVE_BLOCKS = "decorativeBlocks"; } diff --git a/MODSRC/vazkii/botania/common/lib/LibMisc.java b/MODSRC/vazkii/botania/common/lib/LibMisc.java index 3b7138791..e13074a82 100644 --- a/MODSRC/vazkii/botania/common/lib/LibMisc.java +++ b/MODSRC/vazkii/botania/common/lib/LibMisc.java @@ -2,27 +2,27 @@ * This class was created by . 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 13, 2014, 6:32:05 PM (GMT)] */ package vazkii.botania.common.lib; public final class LibMisc { - // Mod Constants - public static final String MOD_ID = "Botania"; - public static final String MOD_NAME = MOD_ID; - public static final String VERSION = "ANT:VERSION-ANT:BUILD"; + // Mod Constants + public static final String MOD_ID = "Botania"; + public static final String MOD_NAME = MOD_ID; + public static final String VERSION = "ANT:VERSION-ANT:BUILD"; - // Network Contants - public static final String NETWORK_CHANNEL = MOD_ID; + // Network Contants + public static final String NETWORK_CHANNEL = MOD_ID; - // Proxy Constants - public static final String PROXY_COMMON = "vazkii.botania.common.core.proxy.CommonProxy"; - public static final String PROXY_CLIENT = "vazkii.botania.client.core.proxy.ClientProxy"; + // Proxy Constants + public static final String PROXY_COMMON = "vazkii.botania.common.core.proxy.CommonProxy"; + public static final String PROXY_CLIENT = "vazkii.botania.client.core.proxy.ClientProxy"; } diff --git a/MODSRC/vazkii/botania/common/lib/LibObfuscation.java b/MODSRC/vazkii/botania/common/lib/LibObfuscation.java index ce2cdc5e5..c949e1f4a 100644 --- a/MODSRC/vazkii/botania/common/lib/LibObfuscation.java +++ b/MODSRC/vazkii/botania/common/lib/LibObfuscation.java @@ -2,33 +2,33 @@ * This class was created by . 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 17, 2014, 4:52:15 PM (GMT)] */ package vazkii.botania.common.lib; public final class LibObfuscation { - // EffectRenderer - public static final String[] PARTICLE_TEXTURES = new String[] { "particleTextures", "field_110737_b", "b" }; + // EffectRenderer + public static final String[] PARTICLE_TEXTURES = new String[]{"particleTextures", "field_110737_b", "b"}; - // EntityAINearestAttackableTarget - public static final String[] TARGET_CLASS = new String[] { "targetClass", "field_75307_b", "a" }; + // EntityAINearestAttackableTarget + public static final String[] TARGET_CLASS = new String[]{"targetClass", "field_75307_b", "a"}; - // EntityAIAttackOnCollide - public static final String[] CLASS_TARGET = new String[] { "classTarget", "field_75444_h", "g" }; + // EntityAIAttackOnCollide + public static final String[] CLASS_TARGET = new String[]{"classTarget", "field_75444_h", "g"}; - // EntityAIAvoidEntity - public static final String[] TARGET_ENTITY_CLASS = new String[] { "targetEntityClass", "field_75381_h", "i" }; + // EntityAIAvoidEntity + public static final String[] TARGET_ENTITY_CLASS = new String[]{"targetEntityClass", "field_75381_h", "i"}; - // EntityCreeper - public static final String[] TIME_SINCE_IGNITED = new String[] { "timeSinceIgnited", "field_70833_d", "bq" }; + // EntityCreeper + public static final String[] TIME_SINCE_IGNITED = new String[]{"timeSinceIgnited", "field_70833_d", "bq"}; - // ThreadDownloadImageData - public static final String[] TEXTURE_UPLOADED = new String[] { "textureUploaded", "field_110559_g", "i" }; - public static final String[] BUFFERED_IMAGE = new String[] { "bufferedImage", "field_110560_d", "g" }; + // ThreadDownloadImageData + public static final String[] TEXTURE_UPLOADED = new String[]{"textureUploaded", "field_110559_g", "i"}; + public static final String[] BUFFERED_IMAGE = new String[]{"bufferedImage", "field_110560_d", "g"}; } diff --git a/MODSRC/vazkii/botania/common/lib/LibOreDict.java b/MODSRC/vazkii/botania/common/lib/LibOreDict.java index 5e4bb02ba..a47d883f4 100644 --- a/MODSRC/vazkii/botania/common/lib/LibOreDict.java +++ b/MODSRC/vazkii/botania/common/lib/LibOreDict.java @@ -2,45 +2,35 @@ * This class was created by . 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 19, 2014, 4:30:32 PM (GMT)] */ 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 LIVING_WOOD = "livingwood"; - public static final String LIVING_ROCK = "livingrock"; - public static final String MANA_STEEL = "ingotManasteel"; - public static final String MANA_PEARL = "manaPearl"; - public static final String MANA_DIAMOND = "manaDiamond"; - public static final String LIVINGWOOD_TWIG = "livingwoodTwig"; - public static final String TERRA_STEEL = "ingotTerrasteel"; + 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 LIVING_WOOD = "livingwood"; + public static final String LIVING_ROCK = "livingrock"; + public static final String MANA_STEEL = "ingotManasteel"; + public static final String MANA_PEARL = "manaPearl"; + public static final String MANA_DIAMOND = "manaDiamond"; + public static final String LIVINGWOOD_TWIG = "livingwoodTwig"; + public static final String TERRA_STEEL = "ingotTerrasteel"; - 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[] FLOWER = new String[]{"mysticFlowerWhite", "mysticFlowerOrange", "mysticFlowerMagenta", "mysticFlowerLightBlue", "mysticFlowerYellow", "mysticFlowerLime", "mysticFlowerPink", "mysticFlowerGray", "mysticFlowerLightGray", "mysticFlowerCyan", "mysticFlowerPurple", "mysticFlowerBlue", "mysticFlowerBrown", "mysticFlowerGreen", "mysticFlowerRed", "mysticFlowerBlack",}; - public static final String[] PETAL = new String[] { - "petalWhite", "petalOrange", "petalMagenta", "petalLightBlue", "petalYellow", "petalLime", "petalPink", "petalGray", "petalLightGray", "petalCyan", "petalPurple", "petalBlue", "petalBrown", "petalGreen", "petalRed", "petalBlack", - }; + public static final String[] PETAL = new String[]{"petalWhite", "petalOrange", "petalMagenta", "petalLightBlue", "petalYellow", "petalLime", "petalPink", "petalGray", "petalLightGray", "petalCyan", "petalPurple", "petalBlue", "petalBrown", "petalGreen", "petalRed", "petalBlack",}; - 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[] DYE = new String[]{"dyeWhite", "dyeOrange", "dyeMagenta", "dyeLightBlue", "dyeYellow", "dyeLime", "dyePink", "dyeGray", "dyeLightGray", "dyeCyan", "dyePurple", "dyeBlue", "dyeBrown", "dyeGreen", "dyeRed", "dyeBlack",}; - public static final String[] MANA_PETAL = new String[] { - "manaPetalWhite", "manaPetalOrange", "manaPetalMagenta", "manaPetalLightBlue", "manaPetalYellow", "manaPetalLime", "manaPetalPink", "manaPetalGray", "manaPetalLightGray", "manaPetalCyan", "manaPetalPurple", "manaPetalBlue", "manaPetalBrown", "manaPetalGreen", "manaPetalRed", "manaPetalBlack", - }; + public static final String[] MANA_PETAL = new String[]{"manaPetalWhite", "manaPetalOrange", "manaPetalMagenta", "manaPetalLightBlue", "manaPetalYellow", "manaPetalLime", "manaPetalPink", "manaPetalGray", "manaPetalLightGray", "manaPetalCyan", "manaPetalPurple", "manaPetalBlue", "manaPetalBrown", "manaPetalGreen", "manaPetalRed", "manaPetalBlack",}; - public static final String[] RUNE = new String[] { - "runeWaterB", "runeFireB", "runeEarthB", "runeAirB", "runeSpringB", "runeSummerB", "runeAutumnB", "runeWinterB", "runeManaB", "runeLustB", "runeGluttonyB", "runeGreedB", "runeSlothB", "runeWrathB", "runeEnvyB", "runePrideB" - }; + public static final String[] RUNE = new String[]{"runeWaterB", "runeFireB", "runeEarthB", "runeAirB", "runeSpringB", "runeSummerB", "runeAutumnB", "runeWinterB", "runeManaB", "runeLustB", "runeGluttonyB", "runeGreedB", "runeSlothB", "runeWrathB", "runeEnvyB", "runePrideB"}; } diff --git a/MODSRC/vazkii/botania/common/network/GuiHandler.java b/MODSRC/vazkii/botania/common/network/GuiHandler.java index f9e172cd8..d5e7ff432 100644 --- a/MODSRC/vazkii/botania/common/network/GuiHandler.java +++ b/MODSRC/vazkii/botania/common/network/GuiHandler.java @@ -2,36 +2,36 @@ * This class was created by . 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 14, 2014, 6:50:15 PM (GMT)] */ package vazkii.botania.common.network; +import cpw.mods.fml.common.network.IGuiHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import vazkii.botania.client.gui.GuiLexicon; import vazkii.botania.common.lib.LibGuiIDs; -import cpw.mods.fml.common.network.IGuiHandler; public class GuiHandler implements IGuiHandler { - @Override - public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - return null; - } + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + return null; + } - @Override - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - switch(ID) { - case LibGuiIDs.LEXICON : - return GuiLexicon.currentOpenLexicon; - } + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + switch(ID) { + case LibGuiIDs.LEXICON: + return GuiLexicon.currentOpenLexicon; + } - return null; - } + return null; + } } diff --git a/eclipse/Cleanup Profile.xml b/eclipse/Cleanup Profile.xml deleted file mode 100644 index e012f04b7..000000000 --- a/eclipse/Cleanup Profile.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eclipse/Code Template.xml b/eclipse/Code Template.xml deleted file mode 100644 index 541b9f312..000000000 --- a/eclipse/Code Template.xml +++ /dev/null @@ -1,21 +0,0 @@ -