From c6e2016f4d068fcfac69ab8f7b59141bf29ce387 Mon Sep 17 00:00:00 2001 From: Jeremy Diamond Date: Wed, 19 Nov 2014 04:37:12 -0800 Subject: [PATCH] Added Tainthistle --- .../forbidden/compat/ForbiddenBotany.java | 14 ++ .../forbidden/tiles/SubTileTainthistle.java | 128 ++++++++++++++++++ .../assets/forbidden/lang/en_US.lang | 5 +- .../forbidden/textures/blocks/tainthistle.png | Bin 0 -> 350 bytes 4 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 src/main/java/fox/spiteful/forbidden/tiles/SubTileTainthistle.java create mode 100644 src/main/resources/assets/forbidden/textures/blocks/tainthistle.png diff --git a/src/main/java/fox/spiteful/forbidden/compat/ForbiddenBotany.java b/src/main/java/fox/spiteful/forbidden/compat/ForbiddenBotany.java index e3c6816..c218bbf 100644 --- a/src/main/java/fox/spiteful/forbidden/compat/ForbiddenBotany.java +++ b/src/main/java/fox/spiteful/forbidden/compat/ForbiddenBotany.java @@ -6,6 +6,7 @@ import fox.spiteful.forbidden.DarkResearchItem; import fox.spiteful.forbidden.LogHandler; import fox.spiteful.forbidden.items.ForbiddenItems; import fox.spiteful.forbidden.tiles.SubTileEuclidaisy; +import fox.spiteful.forbidden.tiles.SubTileTainthistle; import fox.spiteful.forbidden.tiles.SubTileWhisperweed; import net.minecraft.init.Blocks; import net.minecraft.item.Item; @@ -56,9 +57,12 @@ public class ForbiddenBotany { List cats = BotaniaAPI.getAllCategories(); LexiconCategory functional = null; + LexiconCategory generating = null; for(LexiconCategory cat : cats){ if(cat.getUnlocalizedName().equals("botania.category.functionalFlowers")) functional = cat; + else if(cat.getUnlocalizedName().equals("botania.category.generationFlowers")) + generating = cat; } SubTileEuclidaisy.lexicon = new ForbiddenLexicon("euclidaisy", functional); @@ -81,6 +85,16 @@ public class ForbiddenBotany { InfusionRecipe whispercraft = ThaumcraftApi.addInfusionCraftingRecipe("WHISPERWEED", whisperweed, 4, (new AspectList()).add(Aspect.MIND, 8).add(Aspect.MAGIC, 4).add(Aspect.SENSES, 4), new ItemStack(Blocks.tallgrass, 1, 1), new ItemStack[] { new ItemStack(resource, 1, 2), new ItemStack(resource, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 9), new ItemStack(manaPetal, 1, 7), new ItemStack(manaPetal, 1, 10), new ItemStack(rune, 1, 14), new ItemStack(ConfigItems.itemResource, 1, 6) }); (new DarkResearchItem("WHISPERWEED", "FORBIDDEN", "[B]", (new AspectList()).add(Aspect.PLANT, 8).add(Aspect.MIND, 10).add(Aspect.SENSES, 4), -8, 5, 3, whisperweed)).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.WHISPERWEED.1"), new ResearchPage(whispercraft) }).setParents(new String[] { "INFAUXSION" }).setConcealed().registerResearchItem(); + BotaniaAPI.registerSubTile("tainthistle", SubTileTainthistle.class); + BotaniaAPI.registerSubTileSignature(SubTileTainthistle.class, new DarkSignature("tainthistle")); + BotaniaAPI.addSubTileToCreativeMenu("tainthistle"); + + SubTileTainthistle.lexicon = new ForbiddenLexicon("tainthistle", generating); + + SubTileTainthistle.lexicon.addPage(BotaniaAPI.internalHandler.textPage("forbidden.lexicon.tainthistle.0")); + + ThaumcraftApi.registerObjectTag(GameRegistry.findItemStack("Botania", "specialFlower", 1), (new AspectList()).add(Aspect.PLANT, 4).add(Aspect.MAGIC, 1)); + } catch (Throwable e) { LogHandler.log(Level.INFO, e, "Forbidden Magic: Botania? Do you wanna build a snowman?"); Compat.botan = false; diff --git a/src/main/java/fox/spiteful/forbidden/tiles/SubTileTainthistle.java b/src/main/java/fox/spiteful/forbidden/tiles/SubTileTainthistle.java new file mode 100644 index 0000000..161679f --- /dev/null +++ b/src/main/java/fox/spiteful/forbidden/tiles/SubTileTainthistle.java @@ -0,0 +1,128 @@ +/** + * This class based on a class created by . + * It was 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) + * + */ + +package fox.spiteful.forbidden.tiles; + +import net.minecraft.block.Block; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IIcon; +import thaumcraft.common.Thaumcraft; +import thaumcraft.common.config.ConfigBlocks; +import vazkii.botania.api.BotaniaAPI; +import vazkii.botania.api.lexicon.LexiconEntry; +import vazkii.botania.api.subtile.SubTileGenerating; + +public class SubTileTainthistle extends SubTileGenerating { + + private static final String TAG_BURN_TIME = "burnTime"; + private static final int range = 4; + public static LexiconEntry lexicon; + int burnTime = 0; + + @Override + public void onUpdate() { + super.onUpdate(); + boolean didSomething = false; + if(burnTime == 0) { + if(supertile.getWorldObj().getWorldTime() % 80L == 0) + if(mana < getMaxMana() && !supertile.getWorldObj().isRemote) { + for(int ex = supertile.xCoord - range;ex <= supertile.xCoord + range;ex++){ + for(int wy = supertile.yCoord - range;wy <= supertile.yCoord + range;wy++){ + for(int zee = supertile.zCoord - range;zee <= supertile.zCoord + range;zee++){ + if(isFlux(ex, wy, zee)) { + int depth = supertile.getWorldObj().getBlockMetadata(ex, wy, zee); + supertile.getWorldObj().setBlockToAir(ex, wy, zee); + didSomething = true; + burnTime += depth * (1 +supertile.getWorldObj().rand.nextInt(4)); + } + } + } + } + + if(didSomething){ + playSound(); + sync(); + } + } + } else { + if(supertile.getWorldObj().rand.nextInt(8) == 0) + doBurnParticles(); + burnTime--; + } + } + + @Override + public boolean isPassiveFlower() { + return true; + } + + public void doBurnParticles() { + Thaumcraft.proxy.reservoirBubble(supertile.getWorldObj(), supertile.xCoord, supertile.yCoord, supertile.zCoord, 0x4D00FF); + } + + public boolean isFlux(int x, int y, int z){ + Block target = supertile.getWorldObj().getBlock(x, y, z); + return target == ConfigBlocks.blockFluxGas || target == ConfigBlocks.blockFluxGoo; + } + + public void playSound() { + supertile.getWorldObj().playSoundEffect(supertile.xCoord, supertile.yCoord, supertile.zCoord, "random.drink", 0.05F, 0.5F + (float) Math.random() * 0.5F); + } + + @Override + public int getMaxMana() { + return 150; + } + + @Override + public int getColor() { + return 0x4D00FF; + } + + @Override + public LexiconEntry getEntry() { + return lexicon; + } + + @Override + public void writeToPacketNBT(NBTTagCompound cmp) { + super.writeToPacketNBT(cmp); + cmp.setInteger(TAG_BURN_TIME, burnTime); + } + + @Override + public void readFromPacketNBT(NBTTagCompound cmp) { + super.readFromPacketNBT(cmp); + burnTime = cmp.getInteger(TAG_BURN_TIME); + } + + @Override + public boolean canGeneratePassively() { + return burnTime > 0; + } + + @Override + public int getDelayBetweenPassiveGeneration() { + return 3; + } + + @Override + public int getValueForPassiveGeneration() { + return 1 + supertile.getWorldObj().rand.nextInt(4); + } + + @Override + public IIcon getIcon(){ + return BotaniaAPI.getSignatureForName("tainthistle").getIconForStack(null); + } + +} \ No newline at end of file diff --git a/src/main/resources/assets/forbidden/lang/en_US.lang b/src/main/resources/assets/forbidden/lang/en_US.lang index a475368..4eae4f0 100644 --- a/src/main/resources/assets/forbidden/lang/en_US.lang +++ b/src/main/resources/assets/forbidden/lang/en_US.lang @@ -83,6 +83,7 @@ tile.StarBlock.name=Nether Star Block tile.blackRoseBush.name=Umbral Rose Bush darkflower.euclidaisy.name=Euclidaisy darkflower.whisperweed.name=Whisperweed +darkflower.tainthistle.name=Tainthistle # # Enchantments enchantment.cluster=Fiery Core @@ -281,4 +282,6 @@ forbidden.research_page.SUBCOLLAR.1=Sometimes, people just want to get hurt. Esp forbidden.lexicon.euclidaisy=Euclidaisy forbidden.lexicon.euclidaisy.0=The eerie, pink &1Euclidaisy&0 is an oddity. It uses large amounts of mana to conjure some sort of ethereal substance that only seems useful to thaumaturges.
&oIt doesn't combustion bend.&r forbidden.lexicon.whisperweed=Whisperweed -forbidden.lexicon.whisperweed.0=The &1Whisperweed&0 is an unpleasant plant that whispers secrets into the ears of anyone who'll listen. There doesn't seem to be much point to the plant, since the secrets aren't even relevant to botany.
&oMore secrets than Wan Shi Tong&r \ No newline at end of file +forbidden.lexicon.whisperweed.0=The &1Whisperweed&0 is an unpleasant plant that whispers secrets into the ears of anyone who'll listen. There doesn't seem to be much point to the plant, since the secrets aren't even relevant to botany.
&oMore secrets than Wan Shi Tong&r +forbidden.lexicon.tainthistle=Tainthistle +forbidden.lexicon.tainthistle.0=The disgusting &1Tainthistle&0 derives sustenance from the tainted runoff of magical experiments. It'll suck up any such substance it can find and try to turn it into mana. Since Botany is an environmentally friendly practice, there doesn't seem to be much point to it.
&oMore intrusive than a Spirit Vine&r \ No newline at end of file diff --git a/src/main/resources/assets/forbidden/textures/blocks/tainthistle.png b/src/main/resources/assets/forbidden/textures/blocks/tainthistle.png new file mode 100644 index 0000000000000000000000000000000000000000..23ce2d3123b850eb9f3136198759a0e72638e36c GIT binary patch literal 350 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=Dh+L6~vJ#O${~L8%hgh?3y^w370~qEv=}#LT=BJwMkFg)(D3Q$0gN_s>q|KvlOq zT^vI!{I^avv|!}^Zm`E=ztJ&49hX&;%>KQv zU!I%&Un<*r_l?58ljWP{-u;uoZ-3*idD%zBBX?)7^O(*d@Ooh}+k+N{h1Z&