diff --git a/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java b/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java index 819cf3693..3533b6067 100644 --- a/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java +++ b/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java @@ -211,18 +211,24 @@ public class ClientProxy extends CommonProxy { } private static boolean distanceLimit = true; + private static boolean depthTest = true; @Override public void setWispFXDistanceLimit(boolean limit) { distanceLimit = limit; } + + @Override + public void setWispFXDepthTest(boolean test) { + depthTest = test; + } @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) { if(!doParticle()) return; - FXWisp wisp = new FXWisp(world, x, y, z, size, r, g, b, distanceLimit, maxAgeMul); + FXWisp wisp = new FXWisp(world, x, y, z, size, r, g, b, distanceLimit, depthTest, maxAgeMul); wisp.motionX = motionx; wisp.motionY = motiony; wisp.motionZ = motionz; diff --git a/MODSRC/vazkii/botania/client/fx/FXWisp.java b/MODSRC/vazkii/botania/client/fx/FXWisp.java index c6126811c..6a0f8fe3a 100644 --- a/MODSRC/vazkii/botania/client/fx/FXWisp.java +++ b/MODSRC/vazkii/botania/client/fx/FXWisp.java @@ -33,6 +33,7 @@ public class FXWisp extends EntityFX { public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_WISP_LARGE); public static Queue queuedRenders = new ArrayDeque(); + public static Queue queuedDepthIgnoringRenders = new ArrayDeque(); // Queue values float f; @@ -42,7 +43,7 @@ public class FXWisp extends EntityFX { float f4; float f5; - public FXWisp(World world, double d, double d1, double d2, float size, float red, float green, float blue, boolean distanceLimit, float maxAgeMul) { + public FXWisp(World world, double d, double d1, double d2, float size, float red, float green, float blue, boolean distanceLimit, boolean depthTest, float maxAgeMul) { super(world, d, d1, d2, 0.0D, 0.0D, 0.0D); particleRed = red; particleGreen = green; @@ -52,7 +53,8 @@ public class FXWisp extends EntityFX { particleScale *= size; moteParticleScale = particleScale; particleMaxAge = (int)(28D / (Math.random() * 0.3D + 0.7D) * maxAgeMul); - + this.depthTest = depthTest; + moteHalfLife = particleMaxAge / 2; noClip = true; setSize(0.01F, 0.01F); @@ -76,12 +78,24 @@ public class FXWisp extends EntityFX { GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.matrixMode ? ObfuscationHelper.getParticleTexture() : particles); - tessellator.startDrawingQuads(); - for(FXWisp wisp : queuedRenders) - wisp.renderQueued(tessellator); - tessellator.draw(); + if(!queuedRenders.isEmpty()) { + tessellator.startDrawingQuads(); + for(FXWisp wisp : queuedRenders) + wisp.renderQueued(tessellator); + tessellator.draw(); + } + + if(!queuedDepthIgnoringRenders.isEmpty()) { + GL11.glDisable(GL11.GL_DEPTH_TEST); + tessellator.startDrawingQuads(); + for(FXWisp wisp : queuedDepthIgnoringRenders) + wisp.renderQueued(tessellator); + tessellator.draw(); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } queuedRenders.clear(); + queuedDepthIgnoringRenders.clear(); } private void renderQueued(Tessellator tessellator) { @@ -114,7 +128,9 @@ public class FXWisp extends EntityFX { this.f4 = f4; this.f5 = f5; - queuedRenders.add(this); + if(depthTest) + queuedRenders.add(this); + else queuedDepthIgnoringRenders.add(this); } @Override @@ -139,6 +155,7 @@ public class FXWisp extends EntityFX { particleGravity = value; } + boolean depthTest = true; public boolean distanceLimit = true; float moteParticleScale; int moteHalfLife; diff --git a/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java b/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java index b5ab271e6..597eb70eb 100644 --- a/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java +++ b/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java @@ -72,6 +72,7 @@ public final class BotaniaCreativeTab extends CreativeTabs { addItem(ModItems.rainbowRod); addItem(ModItems.tornadoRod); addItem(ModItems.fireRod); + addItem(ModItems.diviningRod); addItem(ModItems.virus); addItem(ModItems.slingshot); addItem(ModItems.vineBall); diff --git a/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java b/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java index 326b9ee32..839d1b8ca 100644 --- a/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java +++ b/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java @@ -126,6 +126,10 @@ public class CommonProxy { public void setWispFXDistanceLimit(boolean limit) { // NO-OP } + + public void setWispFXDepthTest(boolean depth) { + // 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); diff --git a/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java b/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java index 21576e43d..6fb7fb204 100644 --- a/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java +++ b/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java @@ -190,6 +190,7 @@ public final class ModCrafingRecipes { public static List recipesSpark; public static List recipesSparkUpgrades; public static IRecipe recipeLeafHorn; + public static IRecipe recipeDiviningRod; public static void init() { // Lexicon Recipe @@ -1193,6 +1194,13 @@ public final class ModCrafingRecipes { addShapelessOreDictRecipe(new ItemStack(ModItems.grassHorn, 1, 1), new ItemStack(ModItems.grassHorn), "treeLeaves"); recipeLeafHorn = BotaniaAPI.getLatestAddedRecipe(); + // Rod of Divining Recipe + addOreDictRecipe(new ItemStack(ModItems.diviningRod), + " TD", " TT", "T ", + 'T', LibOreDict.TWIG_WAND, + 'D', LibOreDict.MANA_DIAMOND); + recipeDiviningRod = BotaniaAPI.getLatestAddedRecipe(); + // Mana and Terrasteel Block Recipes addOreDictRecipe(new ItemStack(ModBlocks.storage, 1, 0), "III", "III", "III", diff --git a/MODSRC/vazkii/botania/common/item/ItemDiviningRod.java b/MODSRC/vazkii/botania/common/item/ItemDiviningRod.java new file mode 100644 index 000000000..6c2f341ca --- /dev/null +++ b/MODSRC/vazkii/botania/common/item/ItemDiviningRod.java @@ -0,0 +1,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 @ [Aug 25, 2014, 2:57:16 PM (GMT)] + */ +package vazkii.botania.common.item; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; +import vazkii.botania.api.mana.IManaUsingItem; +import vazkii.botania.api.mana.ManaItemHandler; +import vazkii.botania.common.Botania; +import vazkii.botania.common.lib.LibItemNames; + +public class ItemDiviningRod extends ItemMod implements IManaUsingItem { + + static final int COST = 3000; + + public ItemDiviningRod() { + setMaxStackSize(1); + setUnlocalizedName(LibItemNames.DIVINING_ROD); + } + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer p) { + if(ManaItemHandler.requestManaExact(stack, p, COST, true) && world.isRemote) { + int x = (int) MathHelper.floor_double(p.posX); + int y = (int) MathHelper.floor_double(p.posY); + int z = (int) MathHelper.floor_double(p.posZ); + int range = 15; + long seedxor = world.rand.nextLong(); + + Botania.proxy.setWispFXDepthTest(false); + for(int i = -range; i < range + 1; i++) + for(int j = -range; j < range + 1; j++) + for(int k = -range; k < range + 1; k++) { + int xp = x + i; + int yp = y + j; + int zp = z + k; + Block block = world.getBlock(xp, yp, zp); + int meta = world.getBlockMetadata(xp, yp, zp); + ItemStack orestack = new ItemStack(block, 1, meta); + for(int id : OreDictionary.getOreIDs(orestack)) { + String s = OreDictionary.getOreName(id); + if(s.matches("^ore.+")) { + Random rand = new Random(s.hashCode() ^ seedxor); + Botania.proxy.wispFX(world, xp + world.rand.nextFloat(), yp + world.rand.nextFloat(), zp + world.rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), 0.25F, 0F, 8); + break; + } + } + } + Botania.proxy.setWispFXDepthTest(true); + p.swingItem(); + } + + return stack; + } + + @Override + public boolean usesMana(ItemStack stack) { + return true; + } +} \ No newline at end of file diff --git a/MODSRC/vazkii/botania/common/item/ModItems.java b/MODSRC/vazkii/botania/common/item/ModItems.java index 087a36345..fd471d4b2 100644 --- a/MODSRC/vazkii/botania/common/item/ModItems.java +++ b/MODSRC/vazkii/botania/common/item/ModItems.java @@ -151,6 +151,7 @@ public final class ModItems { public static Item glassPick; public static Item spark; public static Item sparkUpgrade; + public static Item diviningRod; public static void init() { lexicon = new ItemLexicon(); @@ -237,7 +238,8 @@ public final class ModItems { glassPick = new ItemGlassPick(); spark = new ItemSpark(); sparkUpgrade = new ItemSparkUpgrade(); - + diviningRod = new ItemDiviningRod(); + OreDictionary.registerOre(LibOreDict.LEXICON, lexicon); for(int i = 0; i < 16; i++) { OreDictionary.registerOre(LibOreDict.PETAL[i], new ItemStack(petal, 1, i)); diff --git a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java index 1fdefbf03..b2d907a2a 100644 --- a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java +++ b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java @@ -146,6 +146,7 @@ public final class LexiconData { public static LexiconEntry skyDirtRod; public static LexiconEntry enderHand; public static LexiconEntry glassPick; + public static LexiconEntry diviningRod; public static LexiconEntry baublesIntro; public static LexiconEntry tinyPlanet; @@ -510,6 +511,9 @@ public final class LexiconData { glassPick = new BLexiconEntry(LibLexicon.TOOL_GLASS_PICK, categoryTools); glassPick.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeGlassPick)); + diviningRod = new BLexiconEntry(LibLexicon.TOOL_DIVINING_ROD, categoryTools); + diviningRod.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeDiviningRod)); + // BAUBLES ENTRIES baublesIntro = new BLexiconEntry(LibLexicon.BAUBLE_INTRO, categoryBaubles); baublesIntro.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_BAUBLES), new PageText("2")); diff --git a/MODSRC/vazkii/botania/common/lib/LibItemNames.java b/MODSRC/vazkii/botania/common/lib/LibItemNames.java index aba72e2d2..547474a30 100644 --- a/MODSRC/vazkii/botania/common/lib/LibItemNames.java +++ b/MODSRC/vazkii/botania/common/lib/LibItemNames.java @@ -97,6 +97,7 @@ public final class LibItemNames { public static final String GLASS_PICK = "glassPick"; public static final String SPARK = "spark"; public static final String SPARK_UPGRADE = "sparkUpgrade"; + public static final String DIVINING_ROD = "diviningRod"; public static final String[] LENS_NAMES = new String[] { "lensNormal", diff --git a/MODSRC/vazkii/botania/common/lib/LibLexicon.java b/MODSRC/vazkii/botania/common/lib/LibLexicon.java index 71a6fdeea..727594592 100644 --- a/MODSRC/vazkii/botania/common/lib/LibLexicon.java +++ b/MODSRC/vazkii/botania/common/lib/LibLexicon.java @@ -121,6 +121,7 @@ public final class LibLexicon { public static final String TOOL_SKY_DIRT_ROD = "skyDirtRod"; public static final String TOOL_ENDER_HAND = "enderHand"; public static final String TOOL_GLASS_PICK = "glassPick"; + public static final String TOOL_DIVINING_ROD = "diviningRod"; public static final String BAUBLE_INTRO = "bIntro"; public static final String BAUBLE_TINY_PLANET = "tinyPlanet"; diff --git a/resources/assets/botania/lang/en_US.lang b/resources/assets/botania/lang/en_US.lang index 6ee1eb9a4..49aff2b86 100644 --- a/resources/assets/botania/lang/en_US.lang +++ b/resources/assets/botania/lang/en_US.lang @@ -692,6 +692,7 @@ item.botania:sparkUpgrade0.name=Spark Augment: Dispersive item.botania:sparkUpgrade1.name=Spark Augment: Dominant item.botania:sparkUpgrade2.name=Spark Augment: Recessive item.botania:sparkUpgrade3.name=Spark Augment: Isolated +item.botania:diviningRod.name=Rod of Divining # GUI TEXT botania.gui.lexicon.header=Lexica Botania, %s Edition Table of Contents @@ -1369,6 +1370,11 @@ botania.entry.glassPick=Vitreous Pickaxe botania.page.glassPick0=Placing down &1Glass&0 and having to break it again can be a heartbreaking experience. Luckily, by creating a &1Vitreous Pickaxe&0, one can gather the &1Glass&0 back by mining it with the pick, it's like cheap &4Silk Touch&0 for glass! botania.page.glassPick1=Trapped inside with food +# -- ROD OF DIVINING +botania.entry.diviningRod=Rod of Divining +botania.page.diviningRod0=As it's name implies, the &1Rod of Divining&0 has the ability to divine in a decently large radius around the user to find any ores. These will shine for a little bit, allowing their location.
This process, obviously, requires a decent amount of &4Mana&0 from the user's inventory. +botania.page.diviningRod1=inb4 ee3 + # - BAUBLES # -- AN INTRODUCTION TO BAUBLES botania.entry.bIntro=An Introduction to Baubles diff --git a/resources/assets/botania/textures/items/diviningRod.png b/resources/assets/botania/textures/items/diviningRod.png new file mode 100644 index 000000000..375dcc689 Binary files /dev/null and b/resources/assets/botania/textures/items/diviningRod.png differ